UNPKG

@coveord/plasma-mantine

Version:

A Plasma flavoured Mantine theme

86 lines (85 loc) 3.67 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "TablePredicate", { enumerable: true, get: function() { return TablePredicate; } }); var _define_property = require("@swc/helpers/_/_define_property"); var _object_spread = require("@swc/helpers/_/_object_spread"); var _object_spread_props = require("@swc/helpers/_/_object_spread_props"); var _object_without_properties = require("@swc/helpers/_/_object_without_properties"); var _jsxruntime = require("react/jsx-runtime"); var _core = require("@mantine/core"); var _Table = require("../Table"); var _TableContext = require("../TableContext"); var defaultProps = {}; var TablePredicate = (0, _core.factory)(function(props, ref) { var _useTableContext = (0, _TableContext.useTableContext)(), store = _useTableContext.store, getStyles = _useTableContext.getStyles; var _useProps = (0, _core.useProps)('PlasmaTablePredicate', defaultProps, props), id = _useProps.id, data = _useProps.data, label = _useProps.label, classNames = _useProps.classNames, className = _useProps.className, styles = _useProps.styles, style = _useProps.style, renderOption = _useProps.renderOption, comboboxProps = _useProps.comboboxProps, vars = _useProps.vars, others = _object_without_properties._(_useProps, [ "id", "data", "label", "classNames", "className", "styles", "style", "renderOption", "comboboxProps", "vars" ]); var handleChange = function(newValue) { store.setPredicates(function(prev) { return _object_spread_props._(_object_spread._({}, prev), _define_property._({}, id, newValue)); }); store.setPagination(function(prev) { return _object_spread_props._(_object_spread._({}, prev), { pageIndex: 0 }); }); }; var stylesApiProps = { classNames: classNames, styles: styles }; return /*#__PURE__*/ (0, _jsxruntime.jsx)(_core.Grid.Col, _object_spread_props._(_object_spread._({ span: "content", order: _Table.TableComponentsOrder.Predicate, ref: ref }, getStyles('predicate', _object_spread._({ className: className, style: style }, stylesApiProps)), others), { children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_core.Group, _object_spread_props._(_object_spread._({ gap: "xs", wrap: "nowrap" }, getStyles('predicateWrapper', stylesApiProps)), { children: [ label ? /*#__PURE__*/ (0, _jsxruntime.jsxs)(_core.Text, _object_spread_props._(_object_spread._({}, getStyles('predicateLabel', stylesApiProps)), { children: [ label, ":" ] })) : null, /*#__PURE__*/ (0, _jsxruntime.jsx)(_core.Select, _object_spread._({ comboboxProps: _object_spread._({ withinPortal: true }, comboboxProps), value: store.state.predicates[id], onChange: handleChange, data: data, "aria-label": label !== null && label !== void 0 ? label : id, searchable: data.length > 7, renderOption: renderOption, scrollAreaProps: { type: 'always' } }, getStyles('predicateSelect', stylesApiProps))) ] })) })); }); //# sourceMappingURL=TablePredicate.js.map