@eightshift/ui-components 5.1.3 → 5.1.4
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/README.md +3 -6
- package/dist/components/notice/notice.js +1 -1
- package/dist/components/repeater/repeater-item.js +2 -2
- package/dist/components/repeater/repeater.js +5 -2
- package/dist/components/select/v2/async-select.js +6 -4
- package/dist/components/select/v2/single-select.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,11 +7,11 @@ Built using [React Aria components](https://react-spectrum.adobe.com/react-aria/
|
|
|
7
7
|
## Local setup
|
|
8
8
|
|
|
9
9
|
> [!IMPORTANT]
|
|
10
|
-
> Uses [
|
|
10
|
+
> Uses [Bun](https://bun.com/) for package management.
|
|
11
11
|
|
|
12
12
|
1. Clone the repository
|
|
13
|
-
2. `
|
|
14
|
-
3. `
|
|
13
|
+
2. `bun install`
|
|
14
|
+
3. `bun start` to run the example
|
|
15
15
|
|
|
16
16
|
## Who do I talk to?
|
|
17
17
|
|
|
@@ -24,9 +24,6 @@ Eightshift UI components is maintained and sponsored by
|
|
|
24
24
|
## License
|
|
25
25
|
Eightshift UI components are provided by [Team Eightshift](https://eightshift.com) at [Infinum](https://infinum.com). This is free software, and may be redistributed under the terms specified in the LICENSE file.
|
|
26
26
|
|
|
27
|
-
## To-do
|
|
28
|
-
[] AdvancedColorPicker
|
|
29
|
-
|
|
30
27
|
### Won't bring over from Frontend libs
|
|
31
28
|
- BlockInserter
|
|
32
29
|
- Responsive components (ResponsiveNumberPicker, ResponsiveSlider, ResponsiveToggleButton)
|
|
@@ -85,7 +85,7 @@ const Notice = (props) => {
|
|
|
85
85
|
"div",
|
|
86
86
|
{
|
|
87
87
|
className: clsx(
|
|
88
|
-
"es:col-span-1 es:col-start-1 es:row-span-2 es:row-start-1 es:shrink-0 es:icon:size-
|
|
88
|
+
"es:col-span-1 es:col-start-1 es:row-span-2 es:row-start-1 es:shrink-0 es:icon:size-5.5",
|
|
89
89
|
alignIconToTitle ? "es:self-baseline" : "es:self-center",
|
|
90
90
|
styles[type].iconColorClassName
|
|
91
91
|
),
|
|
@@ -30,7 +30,7 @@ import { RepeaterContext } from "./repeater-context.js";
|
|
|
30
30
|
*/
|
|
31
31
|
const RepeaterItem = (props) => {
|
|
32
32
|
const { children, icon, label, subtitle, "aria-label": ariaLabel, className, actions, textValue, expandDisabled, menuOptions, noMenuButton, ...rest } = props;
|
|
33
|
-
const { deleteItem, duplicateItem, isDragged, isOutOfBounds, isSelected, canDelete, canAdd, allOpen, setAllOpen, setOpenItems, id, isItemOpen } = useContext(RepeaterContext);
|
|
33
|
+
const { deleteItem, duplicateItem, isDragged, isOutOfBounds, isSelected, canDelete, canAdd, allOpen, setAllOpen, setOpenItems, id, isItemOpen, noDuplicateButton } = useContext(RepeaterContext);
|
|
34
34
|
return /* @__PURE__ */ jsx(
|
|
35
35
|
Expandable,
|
|
36
36
|
{
|
|
@@ -71,7 +71,7 @@ const RepeaterItem = (props) => {
|
|
|
71
71
|
children: [
|
|
72
72
|
menuOptions,
|
|
73
73
|
menuOptions && /* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
74
|
-
/* @__PURE__ */ jsx(
|
|
74
|
+
!noDuplicateButton && /* @__PURE__ */ jsx(
|
|
75
75
|
MenuItem,
|
|
76
76
|
{
|
|
77
77
|
disabled: !canAdd,
|
|
@@ -38,6 +38,7 @@ const fixIds = (items, itemIdBase) => {
|
|
|
38
38
|
* @param {JSX.Element} [props.addButton] - If provided, overrides the default add button. `(props: { addItem: (additional: Object<string, any>?) => void, disabled: Boolean }) => JSX.Element`.
|
|
39
39
|
* @param {string} [props.className] - Classes to pass to the item wrapper.
|
|
40
40
|
* @param {boolean} [props.noExpandAllButton] - If `true`, the "Expand all"/"Collapse all" button is not displayed.
|
|
41
|
+
* @param {boolean} [props.noDuplicateButton] - If `true`, the "Duplicate" button is not displayed.
|
|
41
42
|
* @param {boolean} [props.noDragToRemove] - If `true`, the "drag to remove" functionality will be disabled.
|
|
42
43
|
* @param {JSX.Element|JSX.Element[]} [props.moreOptions] - Options to add in the "More options" menu.
|
|
43
44
|
* @param {JSX.Element} [props.emptyState] - Allows overriding the default empty state.
|
|
@@ -93,6 +94,7 @@ const Repeater = (props) => {
|
|
|
93
94
|
className,
|
|
94
95
|
emptyState,
|
|
95
96
|
noExpandAllButton,
|
|
97
|
+
noDuplicateButton,
|
|
96
98
|
noDragToRemove,
|
|
97
99
|
moreOptions,
|
|
98
100
|
hidden
|
|
@@ -104,7 +106,7 @@ const Repeater = (props) => {
|
|
|
104
106
|
}
|
|
105
107
|
const items = fixIds(rawItems ?? [], itemIdBase);
|
|
106
108
|
const canDelete = items.length > (minItems ?? 0);
|
|
107
|
-
const canAdd = items.length < (maxItems ?? Number.MAX_SAFE_INTEGER);
|
|
109
|
+
const canAdd = items.length < (maxItems ?? Number.MAX_SAFE_INTEGER) && !addDisabled;
|
|
108
110
|
if (hidden) {
|
|
109
111
|
return null;
|
|
110
112
|
}
|
|
@@ -219,7 +221,8 @@ const Repeater = (props) => {
|
|
|
219
221
|
allOpen,
|
|
220
222
|
setAllOpen,
|
|
221
223
|
setOpenItems,
|
|
222
|
-
isItemOpen: openItems[item.id] ?? allOpen
|
|
224
|
+
isItemOpen: openItems[item.id] ?? allOpen,
|
|
225
|
+
noDuplicateButton
|
|
223
226
|
},
|
|
224
227
|
children: children({
|
|
225
228
|
...item,
|
|
@@ -30,14 +30,17 @@ import { $ as $f86e6c1ec7da6ebb$export$bc3384a35de93d66 } from "../../../useAsyn
|
|
|
30
30
|
* @param {{label: string, value: string, metadata: Object<string, any>?}} props.value - Current value of the select.
|
|
31
31
|
* @param {Function} props.onChange - Function to call when the value changes.
|
|
32
32
|
* @param {boolean} [props.clearable=false] - Whether the select is clearable.
|
|
33
|
-
* @param {boolean} [props.noSearch=false] - Whether the search is disabled.
|
|
34
33
|
* @param {boolean} [props.disabled=false] - Whether the select is disabled.
|
|
35
|
-
* @param {boolean} [props.keepMenuOpenAfterSelect=false] - Whether the menu stays open after an select.
|
|
36
34
|
* @param {string} [props.placeholder] - Placeholder text to show when no value is selected.
|
|
35
|
+
* @param {Function} [props.getLabel] - Function to get the label for the item from the fetched data. `(item: Object<string, any>) => string`
|
|
36
|
+
* @param {Function} [props.getValue] - Function to get the value for the item from the fetched data. `(item: Object<string, any>) => string`
|
|
37
|
+
* @param {Function} [props.getMeta] - Function to get the metadata for the item from the fetched data. `(item: Object<string, any>) => Object<string, any>` (optional)
|
|
38
|
+
* @param {Function} [props.getIcon] - Function to get the icon for the item from the fetched data. `(item: Object<string, any>) => JSX.Element | string`
|
|
39
|
+
* @param {Function} [props.getSubtitle] - Function to get the subtitle for the item from the fetched data. `(item: Object<string, any>) => string`
|
|
40
|
+
* @param {Function} [props.getData] - Function to pre-process the fetched data before it is used in the select. `(data: Object<string, any>[]) => Object<string, any>[]`
|
|
37
41
|
* @param {JSX.Element} [props.customMenuOption] - If provided, replaces the default item in the dropdown menu. `({ value: string, label: string, subtitle: string, metadata: any }) => JSX.Element`
|
|
38
42
|
* @param {JSX.Element} [props.customValueDisplay] - If provided, replaces the default current value display of each selected item. `({ value: string, label: string, subtitle: string, metadata: any }) => JSX.Element`
|
|
39
43
|
* @param {JSX.Element} [props.customDropdownArrow] - If provided, replaces the default dropdown arrow indicator.
|
|
40
|
-
* @param {Function} [props.processLoadedOptions] - Allows modifying (filtering, grouping, ...) options output after the items have been dynamically fetched. Must include `label`, `value`, and `id` keys in the output, additional fields can be added as required.
|
|
41
44
|
* @param {string} props.className - Classes to pass to the select menu.
|
|
42
45
|
* @param {boolean} [props.noMinWidth=false] - If `true`, the select menu will not have a minimum width.
|
|
43
46
|
* @param {boolean} [props.hidden] - If `true`, the component is not rendered.
|
|
@@ -68,7 +71,6 @@ const AsyncSelectNext = (props) => {
|
|
|
68
71
|
inline,
|
|
69
72
|
value,
|
|
70
73
|
onChange,
|
|
71
|
-
noSearch = false,
|
|
72
74
|
disabled = false,
|
|
73
75
|
clearable = false,
|
|
74
76
|
className,
|