@uxf/ui 1.0.0-beta.117 → 1.0.0-beta.118

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.
@@ -8,6 +8,7 @@ declare type SingleButtonProps = Omit<ButtonProps, "children"> & {
8
8
  };
9
9
  export interface ButtonGroupProps {
10
10
  buttons: SingleButtonProps[];
11
+ className?: string;
11
12
  openButton?: SingleButtonProps;
12
13
  visibleButtonsCount: number;
13
14
  color?: ButtonProps["color"];
@@ -29,7 +29,7 @@ const ButtonList = (props) => {
29
29
  const openButtonIcon = ((_a = props.openButton) === null || _a === void 0 ? void 0 : _a.icon) === null ? null : (_c = (_b = props.openButton) === null || _b === void 0 ? void 0 : _b.icon) !== null && _c !== void 0 ? _c : "ellipsis-vertical";
30
30
  const openButtonLabel = (_e = (_d = props.openButton) === null || _d === void 0 ? void 0 : _d.label) !== null && _e !== void 0 ? _e : null;
31
31
  const dropdown = (0, use_dropdown_1.useDropdown)((_f = props.menuPlacement) !== null && _f !== void 0 ? _f : "bottom-start");
32
- return (react_1.default.createElement("div", { className: "uxf-button-list" },
32
+ return (react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-button-list", props.className) },
33
33
  buttonsToRender.map((button, index) => {
34
34
  var _a, _b, _c;
35
35
  const { icon, label, ...restProps } = button;
@@ -39,13 +39,12 @@ const label_1 = require("@uxf/ui/label");
39
39
  const react_2 = __importStar(require("react"));
40
40
  // TODO make the component generic ComboboxProps<T>
41
41
  exports.Combobox = (0, forwardRef_1.forwardRef)("Combobox", (props, ref) => {
42
- var _a, _b, _c, _d, _e, _f;
42
+ var _a, _b, _c, _d, _e, _f, _g;
43
43
  const generatedId = (0, react_2.useId)();
44
44
  const id = (_a = props.id) !== null && _a !== void 0 ? _a : generatedId;
45
45
  const isAsync = !!props.loadOptions;
46
46
  const [query, setQuery] = (0, react_2.useState)("");
47
47
  const options = (0, use_async_loading_1.useAsyncLoading)(query, (_b = props.options) !== null && _b !== void 0 ? _b : [], props.loadOptions);
48
- const selectedOption = options.find((option) => { var _a; return option.id === ((_a = props.value) === null || _a === void 0 ? void 0 : _a.id); });
49
48
  const filteredData = query === "" || isAsync ? options : options.filter((item) => (0, slugify_1.slugify)(item.label).includes((0, slugify_1.slugify)(query)));
50
49
  const innerRef = (0, react_2.useRef)(null);
51
50
  const errorId = props.isInvalid ? `${id}--error-message` : undefined;
@@ -56,7 +55,7 @@ exports.Combobox = (0, forwardRef_1.forwardRef)("Combobox", (props, ref) => {
56
55
  const emptyMessage = query.length === 0
57
56
  ? (_e = props.noQueryMessage) !== null && _e !== void 0 ? _e : "Pro zobrazení možností začněte psát"
58
57
  : (_f = props.notFoundMessage) !== null && _f !== void 0 ? _f : "Nic nenalezeno";
59
- return (react_2.default.createElement(react_1.Combobox, { as: "div", className: (0, cx_1.cx)("uxf-combobox", props.isInvalid && classes_1.CLASSES.IS_INVALID, props.isRequired && classes_1.CLASSES.IS_REQUIRED, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.className), onChange: (v) => { var _a; return (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, v); }, value: selectedOption !== null && selectedOption !== void 0 ? selectedOption : null, disabled: props.isDisabled || props.isReadOnly }, (renderProps) => (react_2.default.createElement(react_2.default.Fragment, null,
58
+ return (react_2.default.createElement(react_1.Combobox, { as: "div", className: (0, cx_1.cx)("uxf-combobox", props.isInvalid && classes_1.CLASSES.IS_INVALID, props.isRequired && classes_1.CLASSES.IS_REQUIRED, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.className), onChange: (v) => { var _a; return (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, v); }, value: (_g = props.value) !== null && _g !== void 0 ? _g : null, disabled: props.isDisabled || props.isReadOnly }, (renderProps) => (react_2.default.createElement(react_2.default.Fragment, null,
60
59
  react_2.default.createElement(react_1.Combobox.Label, { as: label_1.Label, isHidden: props.hiddenLabel, onClick: props.isDisabled || props.isReadOnly ? undefined : input.focus }, props.label),
61
60
  react_2.default.createElement(react_1.Combobox.Button, { as: "div", className: (0, cx_1.cx)("uxf-combobox__button", (renderProps.open || input.focused) && classes_1.CLASSES.IS_FOCUSED, renderProps.disabled && classes_1.CLASSES.IS_DISABLED, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.isInvalid && classes_1.CLASSES.IS_INVALID, dropdown.placement === "bottom" && "is-open--bottom", dropdown.placement === "top" && "is-open--top", renderProps.open && classes_1.CLASSES.IS_OPEN), onBlur: input.onBlur, onFocus: input.onFocus, tabIndex: props.isDisabled || props.isReadOnly ? undefined : 0, ref: stableRef, "aria-invalid": props.isInvalid, "aria-describedby": errorId },
62
61
  react_2.default.createElement(react_1.Combobox.Input, { className: (0, cx_1.cx)("uxf-combobox__input"), displayValue: (item) => { var _a; return (_a = item === null || item === void 0 ? void 0 : item.label) !== null && _a !== void 0 ? _a : ""; }, onBlur: props.onBlur, onChange: (event) => setQuery(event.target.value), placeholder: props.placeholder, ref: stableRef, type: "text" }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/ui",
3
- "version": "1.0.0-beta.117",
3
+ "version": "1.0.0-beta.118",
4
4
  "description": "",
5
5
  "publishConfig": {
6
6
  "access": "public"