@luscii-healthtech/web-ui 54.3.2 → 54.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.development.js +55 -14
- package/dist/index.development.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/src/components/Select/Select.d.ts +25 -0
- package/dist/src/generated/components/Select/Select.d.ts +25 -0
- package/dist/stories/Select.stories.d.ts +1 -0
- package/dist/web-ui.esm.js +1 -1
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -25,6 +25,7 @@ var RadixHC = require('@radix-ui/react-hover-card');
|
|
|
25
25
|
var TabsPrimitive = require('@radix-ui/react-tabs');
|
|
26
26
|
var PropTypes = require('prop-types');
|
|
27
27
|
var ReactSelect = require('react-select');
|
|
28
|
+
var Creatable = require('react-select/creatable');
|
|
28
29
|
var RadixSwitch = require('@radix-ui/react-switch');
|
|
29
30
|
var react = require('@tiptap/react');
|
|
30
31
|
var StarterKit = require('@tiptap/starter-kit');
|
|
@@ -64,6 +65,7 @@ var RadixHC__namespace = /*#__PURE__*/_interopNamespace(RadixHC);
|
|
|
64
65
|
var TabsPrimitive__namespace = /*#__PURE__*/_interopNamespace(TabsPrimitive);
|
|
65
66
|
var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
|
|
66
67
|
var ReactSelect__default = /*#__PURE__*/_interopDefault(ReactSelect);
|
|
68
|
+
var Creatable__default = /*#__PURE__*/_interopDefault(Creatable);
|
|
67
69
|
var RadixSwitch__namespace = /*#__PURE__*/_interopNamespace(RadixSwitch);
|
|
68
70
|
var StarterKit__default = /*#__PURE__*/_interopDefault(StarterKit);
|
|
69
71
|
var ToggleGroup__namespace = /*#__PURE__*/_interopNamespace(ToggleGroup);
|
|
@@ -4540,9 +4542,30 @@ function generateCustomStyles(hasError) {
|
|
|
4540
4542
|
};
|
|
4541
4543
|
}
|
|
4542
4544
|
const Select = React__namespace.default.forwardRef((_a, innerRef) => {
|
|
4543
|
-
var
|
|
4545
|
+
var _b, _c;
|
|
4546
|
+
var { isError = false, styles, options, onChange, value, width = "full", isMulti, className, skipValueProcessing, isCreatable = false, onCreateOption, formatCreateLabel } = _a, otherProps = __rest(_a, ["isError", "styles", "options", "onChange", "value", "width", "isMulti", "className", "skipValueProcessing", "isCreatable", "onCreateOption", "formatCreateLabel"]);
|
|
4547
|
+
const internalRef = React__namespace.default.useRef(null);
|
|
4548
|
+
const mergedRef = React__namespace.default.useCallback((instance) => {
|
|
4549
|
+
internalRef.current = instance;
|
|
4550
|
+
if (typeof innerRef === "function") {
|
|
4551
|
+
innerRef(instance);
|
|
4552
|
+
} else if (innerRef) {
|
|
4553
|
+
innerRef.current = instance;
|
|
4554
|
+
}
|
|
4555
|
+
}, [innerRef]);
|
|
4544
4556
|
const customStyles = generateCustomStyles(isError);
|
|
4545
4557
|
const mergedStyles = ReactSelect.mergeStyles(customStyles, styles);
|
|
4558
|
+
const handleCreateOption = React__namespace.default.useCallback((inputValue) => {
|
|
4559
|
+
if (onCreateOption) {
|
|
4560
|
+
onCreateOption(inputValue);
|
|
4561
|
+
}
|
|
4562
|
+
const timeoutId = setTimeout(() => {
|
|
4563
|
+
if (internalRef.current && internalRef.current.focus) {
|
|
4564
|
+
internalRef.current.focus();
|
|
4565
|
+
}
|
|
4566
|
+
}, 0);
|
|
4567
|
+
return () => clearTimeout(timeoutId);
|
|
4568
|
+
}, [onCreateOption]);
|
|
4546
4569
|
const isOptionsGrouped = !options ? false : options.reduce((acc, o) => acc || "options" in o && !("values" in o), false);
|
|
4547
4570
|
const flatmappedOptions = !options ? [] : isOptionsGrouped ? options.flatMap((g) => g.options) : options;
|
|
4548
4571
|
const onChangeWrapped = !onChange ? void 0 : isMulti ? (val, a) => onChange(val.map((v) => v.value), a) : (val, a) => onChange(val === null || val === void 0 ? void 0 : val.value, a);
|
|
@@ -4557,20 +4580,38 @@ const Select = React__namespace.default.forwardRef((_a, innerRef) => {
|
|
|
4557
4580
|
return dataProps;
|
|
4558
4581
|
};
|
|
4559
4582
|
const CustomContainer = (_a2) => {
|
|
4560
|
-
var { children } = _a2,
|
|
4561
|
-
return jsxRuntime.jsx(ReactSelect.components.SelectContainer, Object.assign({},
|
|
4583
|
+
var { children } = _a2, commonProps2 = __rest(_a2, ["children"]);
|
|
4584
|
+
return jsxRuntime.jsx(ReactSelect.components.SelectContainer, Object.assign({}, commonProps2, { innerProps: Object.assign({}, commonProps2.innerProps, Object.assign({}, getDataAttributes())), children }));
|
|
4562
4585
|
};
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4586
|
+
const commonProps = Object.assign(Object.assign({}, otherProps), {
|
|
4587
|
+
ref: mergedRef,
|
|
4588
|
+
styles: mergedStyles,
|
|
4589
|
+
options,
|
|
4590
|
+
onChange: skipValueProcessing ? onChange : onChangeWrapped,
|
|
4591
|
+
value: skipValueProcessing ? value : valueWrapped,
|
|
4592
|
+
isMulti,
|
|
4593
|
+
// For multi-select or creatable, default to keeping the input focused and menu open
|
|
4594
|
+
// after selection so users can continue adding options without re-focusing.
|
|
4595
|
+
// Users can explicitly override this by passing these props.
|
|
4596
|
+
blurInputOnSelect: (_b = otherProps.blurInputOnSelect) !== null && _b !== void 0 ? _b : isMulti || isCreatable ? false : void 0,
|
|
4597
|
+
closeMenuOnSelect: (_c = otherProps.closeMenuOnSelect) !== null && _c !== void 0 ? _c : isMulti || isCreatable ? false : void 0,
|
|
4598
|
+
className: classNames__default.default("customized-select", className, {
|
|
4599
|
+
"ui:w-16": width === "sm",
|
|
4600
|
+
"ui:w-32": width === "md",
|
|
4601
|
+
"ui:w-56": width === "lg",
|
|
4602
|
+
"ui:w-80": width === "xl",
|
|
4603
|
+
"ui:grow": width === "full"
|
|
4604
|
+
}),
|
|
4605
|
+
components: {
|
|
4606
|
+
SelectContainer: CustomContainer,
|
|
4607
|
+
DropdownIndicator: SelectDropdownIndicator,
|
|
4608
|
+
LoadingIndicator: SelectLoadingIndicator
|
|
4609
|
+
}
|
|
4610
|
+
});
|
|
4611
|
+
if (isCreatable) {
|
|
4612
|
+
return jsxRuntime.jsx(Creatable__default.default, Object.assign({}, commonProps, { onCreateOption: handleCreateOption, formatCreateLabel }));
|
|
4613
|
+
}
|
|
4614
|
+
return jsxRuntime.jsx(ReactSelect__default.default, Object.assign({}, commonProps));
|
|
4574
4615
|
});
|
|
4575
4616
|
|
|
4576
4617
|
const LabeledSelect = React__namespace.default.forwardRef((props, ref) => {
|