@uxf/ui 1.0.0-beta.106 → 1.0.0-beta.108

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/chip/theme.d.ts CHANGED
@@ -1,12 +1,13 @@
1
1
  export interface ChipColors {
2
- default: true;
2
+ orange: true;
3
3
  red: true;
4
4
  yellow: true;
5
+ pink: true;
6
+ purple: true;
7
+ indigo: true;
5
8
  green: true;
6
9
  blue: true;
7
- indigo: true;
8
- purple: true;
9
- pink: true;
10
+ default: true;
10
11
  }
11
12
  export interface ChipSizes {
12
13
  default: true;
@@ -20,6 +20,7 @@ export interface ComboboxProps<ValueId = ComboboxValueId, Option = ComboboxOptio
20
20
  keyExtractor?: (option: Option) => string | number;
21
21
  label: string;
22
22
  loadOptions?: (query: string) => Promise<Option[]>;
23
+ notFoundMessage?: string;
23
24
  options?: Option[];
24
25
  placeholder?: string;
25
26
  renderOption?: (option: Option) => ReactNode;
@@ -38,7 +38,7 @@ const label_1 = require("../label");
38
38
  const use_async_loading_1 = require("../hooks/use-async-loading");
39
39
  // TODO make the component generic ComboboxProps<T>
40
40
  exports.Combobox = (0, forwardRef_1.forwardRef)("Combobox", (props, ref) => {
41
- var _a, _b, _c, _d;
41
+ var _a, _b, _c, _d, _e;
42
42
  const generatedId = (0, react_2.useId)();
43
43
  const id = (_a = props.id) !== null && _a !== void 0 ? _a : generatedId;
44
44
  const isAsync = !!props.loadOptions;
@@ -52,14 +52,15 @@ exports.Combobox = (0, forwardRef_1.forwardRef)("Combobox", (props, ref) => {
52
52
  const dropdown = (0, use_dropdown_1.useDropdown)((_c = props.dropdownPlacement) !== null && _c !== void 0 ? _c : "bottom", true);
53
53
  const stableRef = (0, react_2.useMemo)(() => (0, composeRefs_1.composeRefs)(innerRef, ref, dropdown.reference), [ref, dropdown.reference]);
54
54
  const iconName = (_d = props.iconName) !== null && _d !== void 0 ? _d : "chevronDown";
55
+ const emptyMessage = (_e = props.notFoundMessage) !== null && _e !== void 0 ? _e : "Nic nenalezeno";
55
56
  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, disabled: props.isDisabled || props.isReadOnly }, (renderProps) => (react_2.default.createElement(react_2.default.Fragment, null,
56
57
  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),
57
58
  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 },
58
59
  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" }),
59
60
  react_2.default.createElement(icon_1.Icon, { className: (0, cx_1.cx)("uxf-select__button-icon", renderProps.open && "is-open"), name: iconName })),
60
- react_2.default.createElement(react_1.Combobox.Options, { className: (0, cx_1.cx)("uxf-dropdown", dropdown.placement === "bottom" && "uxf-dropdown--bottom", dropdown.placement === "top" && "uxf-dropdown--top"), ref: dropdown.floating }, filteredData.map((option) => {
61
+ react_2.default.createElement(react_1.Combobox.Options, { className: (0, cx_1.cx)("uxf-dropdown", dropdown.placement === "bottom" && "uxf-dropdown--bottom", dropdown.placement === "top" && "uxf-dropdown--top"), ref: dropdown.floating }, filteredData.length > 0 ? (filteredData.map((option) => {
61
62
  var _a, _b, _c, _d;
62
63
  return (react_2.default.createElement(react_1.Combobox.Option, { key: (_b = (_a = props.keyExtractor) === null || _a === void 0 ? void 0 : _a.call(props, option)) !== null && _b !== void 0 ? _b : option.id, value: option, className: (optionState) => (0, cx_1.cx)("uxf-dropdown__item", optionState.active && classes_1.CLASSES.IS_ACTIVE, optionState.disabled && classes_1.CLASSES.IS_DISABLED, optionState.selected && classes_1.CLASSES.IS_SELECTED) }, (_d = (_c = props.renderOption) === null || _c === void 0 ? void 0 : _c.call(props, option)) !== null && _d !== void 0 ? _d : option.label));
63
- })),
64
+ })) : (react_2.default.createElement("div", { className: "uxf-dropdown__empty-wrapper" }, emptyMessage))),
64
65
  props.helperText && (react_2.default.createElement("div", { className: (0, cx_1.cx)("uxf-helper-text", props.isInvalid && classes_1.CLASSES.IS_INVALID), id: errorId }, props.helperText))))));
65
66
  });
package/css/chip.css CHANGED
@@ -1,5 +1,5 @@
1
1
  .uxf-chip {
2
- @apply inline-flex items-center rounded py-0.5 px-2 text-xs font-medium max-w-full;
2
+ @apply inline-flex items-center rounded py-0.5 px-2 text-xs max-w-full;
3
3
 
4
4
  &.has-button {
5
5
  @apply pr-1;
@@ -27,7 +27,7 @@
27
27
 
28
28
  &--color-default {
29
29
  :root .light & {
30
- @apply text-gray-600 bg-gray-100;
30
+ @apply text-gray-700 bg-gray-100;
31
31
 
32
32
  .uxf-chip__button {
33
33
  @apply hover:bg-gray-200;
@@ -35,17 +35,35 @@
35
35
  }
36
36
 
37
37
  :root .dark & {
38
- @apply text-white bg-gray-600;
38
+ @apply text-gray-100 bg-gray-700;
39
39
 
40
40
  .uxf-chip__button {
41
- @apply hover:bg-gray-700;
41
+ @apply hover:bg-gray-800;
42
+ }
43
+ }
44
+ }
45
+
46
+ &--color-orange {
47
+ :root .light & {
48
+ @apply text-orange-700 bg-orange-100;
49
+
50
+ .uxf-chip__button {
51
+ @apply hover:bg-orange-200;
52
+ }
53
+ }
54
+
55
+ :root .dark & {
56
+ @apply text-orange-100 bg-orange-700;
57
+
58
+ .uxf-chip__button {
59
+ @apply hover:bg-orange-800;
42
60
  }
43
61
  }
44
62
  }
45
63
 
46
64
  &--color-red {
47
65
  :root .light & {
48
- @apply text-red-600 bg-red-100;
66
+ @apply text-red-700 bg-red-100;
49
67
 
50
68
  .uxf-chip__button {
51
69
  @apply hover:bg-red-200;
@@ -53,17 +71,17 @@
53
71
  }
54
72
 
55
73
  :root .dark & {
56
- @apply text-white bg-red-600;
74
+ @apply text-red-100 bg-red-700;
57
75
 
58
76
  .uxf-chip__button {
59
- @apply hover:bg-red-700;
77
+ @apply hover:bg-red-800;
60
78
  }
61
79
  }
62
80
  }
63
81
 
64
82
  &--color-yellow {
65
83
  :root .light & {
66
- @apply text-yellow-600 bg-yellow-100;
84
+ @apply text-yellow-700 bg-yellow-100;
67
85
 
68
86
  .uxf-chip__button {
69
87
  @apply hover:bg-yellow-200;
@@ -71,17 +89,17 @@
71
89
  }
72
90
 
73
91
  :root .dark & {
74
- @apply text-white bg-yellow-600;
92
+ @apply text-yellow-100 bg-yellow-700;
75
93
 
76
94
  .uxf-chip__button {
77
- @apply hover:bg-yellow-700;
95
+ @apply hover:bg-yellow-800;
78
96
  }
79
97
  }
80
98
  }
81
99
 
82
100
  &--color-green {
83
101
  :root .light & {
84
- @apply text-green-600 bg-green-100;
102
+ @apply text-green-700 bg-green-100;
85
103
 
86
104
  .uxf-chip__button {
87
105
  @apply hover:bg-green-200;
@@ -89,17 +107,17 @@
89
107
  }
90
108
 
91
109
  :root .dark & {
92
- @apply text-white bg-green-600;
110
+ @apply text-green-100 bg-green-700;
93
111
 
94
112
  .uxf-chip__button {
95
- @apply hover:bg-green-700;
113
+ @apply hover:bg-green-800;
96
114
  }
97
115
  }
98
116
  }
99
117
 
100
118
  &--color-blue {
101
119
  :root .light & {
102
- @apply text-blue-600 bg-blue-100;
120
+ @apply text-blue-700 bg-blue-100;
103
121
 
104
122
  .uxf-chip__button {
105
123
  @apply hover:bg-blue-200;
@@ -107,17 +125,17 @@
107
125
  }
108
126
 
109
127
  :root .dark & {
110
- @apply text-white bg-blue-600;
128
+ @apply text-blue-100 bg-blue-700;
111
129
 
112
130
  .uxf-chip__button {
113
- @apply hover:bg-blue-700;
131
+ @apply hover:bg-blue-800;
114
132
  }
115
133
  }
116
134
  }
117
135
 
118
136
  &--color-indigo {
119
137
  :root .light & {
120
- @apply text-indigo-600 bg-indigo-100;
138
+ @apply text-indigo-700 bg-indigo-100;
121
139
 
122
140
  .uxf-chip__button {
123
141
  @apply hover:bg-indigo-200;
@@ -125,17 +143,17 @@
125
143
  }
126
144
 
127
145
  :root .dark & {
128
- @apply text-white bg-indigo-600;
146
+ @apply text-indigo-100 bg-indigo-700;
129
147
 
130
148
  .uxf-chip__button {
131
- @apply hover:bg-indigo-700;
149
+ @apply hover:bg-indigo-800;
132
150
  }
133
151
  }
134
152
  }
135
153
 
136
154
  &--color-purple {
137
155
  :root .light & {
138
- @apply text-purple-600 bg-purple-100;
156
+ @apply text-purple-700 bg-purple-100;
139
157
 
140
158
  .uxf-chip__button {
141
159
  @apply hover:bg-purple-200;
@@ -143,17 +161,17 @@
143
161
  }
144
162
 
145
163
  :root .dark & {
146
- @apply text-white bg-purple-600;
164
+ @apply text-purple-100 bg-purple-700;
147
165
 
148
166
  .uxf-chip__button {
149
- @apply hover:bg-purple-700;
167
+ @apply hover:bg-purple-800;
150
168
  }
151
169
  }
152
170
  }
153
171
 
154
172
  &--color-pink {
155
173
  :root .light & {
156
- @apply text-pink-600 bg-pink-100;
174
+ @apply text-pink-700 bg-pink-100;
157
175
 
158
176
  .uxf-chip__button {
159
177
  @apply hover:bg-pink-200;
@@ -161,10 +179,10 @@
161
179
  }
162
180
 
163
181
  :root .dark & {
164
- @apply text-white bg-pink-600;
182
+ @apply text-pink-100 bg-pink-700;
165
183
 
166
184
  .uxf-chip__button {
167
- @apply hover:bg-pink-700;
185
+ @apply hover:bg-pink-800;
168
186
  }
169
187
  }
170
188
  }
package/css/dropdown.css CHANGED
@@ -21,4 +21,8 @@
21
21
  &__items {
22
22
  @apply absolute flex flex-col border border-black bg-white;
23
23
  }
24
+
25
+ &__empty-wrapper {
26
+ @apply py-2 px-4 text-gray-800;
27
+ }
24
28
  }
package/css/textarea.css CHANGED
@@ -3,11 +3,11 @@
3
3
  @apply rounded-md text-base border p-2 shadow-sm;
4
4
 
5
5
  :root .light & {
6
- @apply text-gray-900 border-gray-200;
6
+ @apply bg-white text-gray-900 border-gray-200;
7
7
  }
8
8
 
9
9
  :root .dark & {
10
- @apply text-gray-300 border-gray-700;
10
+ @apply bg-gray-800 text-gray-300 border-gray-700;
11
11
  }
12
12
  }
13
13
 
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- export { DropzoneInputProps } from "./dropzone-input";
3
- export { DropzoneListProps } from "./dropzone-list";
2
+ export type { DropzoneInputProps } from "./dropzone-input";
3
+ export type { DropzoneListProps } from "./dropzone-list";
4
4
  export declare const Dropzone: import("react").ForwardRefExoticComponent<import("./dropzone-input").DropzoneInputProps & import("react").RefAttributes<HTMLDivElement>> & {
5
5
  List: import("react").FC<import("./dropzone-list").DropzoneListProps>;
6
6
  };
@@ -13,6 +13,7 @@ export interface MultiComboboxOption<ValueId = MultiComboboxValueId> extends Mul
13
13
  disabled?: boolean;
14
14
  }
15
15
  export interface MultiComboboxProps<ValueId = MultiComboboxValueId, Option = MultiComboboxOption<ValueId>> extends FormControlProps<Option[] | null> {
16
+ allOptionsSelectedMessage?: string;
16
17
  className?: string;
17
18
  dropdownPlacement?: Placement;
18
19
  helperText?: ReactNode;
@@ -22,6 +23,7 @@ export interface MultiComboboxProps<ValueId = MultiComboboxValueId, Option = Mul
22
23
  keyExtractor?: (option: Option) => string | number;
23
24
  label: string;
24
25
  loadOptions?: (query: string) => Promise<Option[]>;
26
+ notFoundMessage?: string;
25
27
  options?: Option[];
26
28
  placeholder?: string;
27
29
  renderOption?: (option: Option) => ReactNode;
@@ -39,7 +39,7 @@ const icon_1 = require("../icon");
39
39
  const label_1 = require("../label");
40
40
  const use_async_loading_1 = require("../hooks/use-async-loading");
41
41
  exports.MultiCombobox = (0, forwardRef_1.forwardRef)("MultiCombobox", (props, ref) => {
42
- var _a, _b, _c, _d, _e;
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;
@@ -86,16 +86,19 @@ exports.MultiCombobox = (0, forwardRef_1.forwardRef)("MultiCombobox", (props, re
86
86
  (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, v.map((option) => option));
87
87
  setQuery("");
88
88
  };
89
+ const emptyMessage = selectedOptions.length === options.length
90
+ ? (_f = props.allOptionsSelectedMessage) !== null && _f !== void 0 ? _f : "Všechny možnosti jsou již vybrány"
91
+ : (_g = props.notFoundMessage) !== null && _g !== void 0 ? _g : "Nic nenalezeno";
89
92
  return (react_2.default.createElement(react_1.Combobox, { as: "div", by: "id", 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), disabled: props.isDisabled || props.isReadOnly, multiple: true, onChange: handleComboboxValueChange, value: selectedOptions }, (renderProps) => (react_2.default.createElement(react_2.default.Fragment, null,
90
93
  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),
91
94
  react_2.default.createElement(react_1.Combobox.Button, { as: "div", className: (0, cx_1.cx)("uxf-multi-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 },
92
95
  selectedOptions.map((item) => (react_2.default.createElement(chip_1.Chip, { className: "mr-2 mt-2", color: item.color, key: item.id, onClose: handleRemove(item.id), size: "large" }, item.label))),
93
96
  react_2.default.createElement(react_1.Combobox.Input, { className: (0, cx_1.cx)("uxf-multi-combobox__input", "mt-2"), onBlur: props.onBlur, onChange: handleInputChange, onKeyDown: handleInputKeyDown, placeholder: props.placeholder, ref: stableRef, type: "text", value: query }),
94
97
  react_2.default.createElement(icon_1.Icon, { className: (0, cx_1.cx)("uxf-select__button-icon", renderProps.open && "is-open"), name: iconName })),
95
- react_2.default.createElement(react_1.Combobox.Options, { className: (0, cx_1.cx)("uxf-dropdown", dropdown.placement === "bottom" && "uxf-dropdown--bottom", dropdown.placement === "top" && "uxf-dropdown--top"), ref: dropdown.floating }, filteredData.map((option) => {
98
+ react_2.default.createElement(react_1.Combobox.Options, { className: (0, cx_1.cx)("uxf-dropdown", dropdown.placement === "bottom" && "uxf-dropdown--bottom", dropdown.placement === "top" && "uxf-dropdown--top"), ref: dropdown.floating }, filteredData.length > 0 ? (filteredData.map((option) => {
96
99
  var _a, _b, _c, _d;
97
100
  const label = (_b = (_a = props.renderOption) === null || _a === void 0 ? void 0 : _a.call(props, option)) !== null && _b !== void 0 ? _b : option.label;
98
101
  return (react_2.default.createElement(react_1.Combobox.Option, { className: (optionState) => (0, cx_1.cx)("uxf-dropdown__item", optionState.active && !props.withCheckboxes && classes_1.CLASSES.IS_ACTIVE, optionState.disabled && classes_1.CLASSES.IS_DISABLED, optionState.selected && classes_1.CLASSES.IS_SELECTED), key: (_d = (_c = props.keyExtractor) === null || _c === void 0 ? void 0 : _c.call(props, option)) !== null && _d !== void 0 ? _d : option.id, value: option }, (optionState) => (react_2.default.createElement(react_2.default.Fragment, null, props.withCheckboxes ? (react_2.default.createElement(checkbox_1.Checkbox, { isDisabled: optionState.disabled, isFocused: optionState.active, label: label, onChange: handleCheckboxChange(option.id), value: optionState.selected })) : (label)))));
99
- })),
102
+ })) : (react_2.default.createElement("div", { className: "uxf-dropdown__empty-wrapper" }, emptyMessage))),
100
103
  props.helperText && (react_2.default.createElement("div", { className: (0, cx_1.cx)("uxf-helper-text", props.isInvalid && classes_1.CLASSES.IS_INVALID), id: errorId }, props.helperText))))));
101
104
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/ui",
3
- "version": "1.0.0-beta.106",
3
+ "version": "1.0.0-beta.108",
4
4
  "description": "",
5
5
  "publishConfig": {
6
6
  "access": "public"
package/paper/paper.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import React, { HTMLAttributes } from "react";
2
- export interface BadgeProps extends HTMLAttributes<HTMLDivElement> {
2
+ export interface PaperProps extends HTMLAttributes<HTMLDivElement> {
3
3
  className?: string;
4
4
  }
5
- export declare const Paper: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLDivElement>>;
5
+ export declare const Paper: React.ForwardRefExoticComponent<PaperProps & React.RefAttributes<HTMLDivElement>>;
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  declare const _default: {
3
3
  title: string;
4
- component: React.ForwardRefExoticComponent<import("./paper").BadgeProps & React.RefAttributes<HTMLDivElement>>;
4
+ component: React.ForwardRefExoticComponent<import("./paper").PaperProps & React.RefAttributes<HTMLDivElement>>;
5
5
  };
6
6
  export default _default;
7
7
  export declare function Default(): JSX.Element;
@@ -32,7 +32,7 @@ exports.defaultConfig = {
32
32
  variants: ["default", "outlined", "white", "text"],
33
33
  },
34
34
  Chip: {
35
- colors: ["default", "red", "yellow", "green", "blue", "indigo", "purple", "pink"],
35
+ colors: ["orange", "red", "yellow", "pink", "purple", "indigo", "green", "blue", "default"],
36
36
  },
37
37
  Input: {
38
38
  sizes: ["small", "default", "large"],