@eightshift/ui-components 1.4.3 → 1.4.5
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/assets/wp-ui-enhancements.css +1 -1
- package/dist/components/button/button.js +6 -2
- package/dist/components/input-field/input-field.js +3 -1
- package/dist/components/option-select/option-select.js +10 -5
- package/dist/components/repeater/repeater.js +5 -1
- package/package.json +1 -1
- package/dist/hooks/use-cell-edit-mode.js +0 -35
|
@@ -1 +1 @@
|
|
|
1
|
-
.edit-post-header__toolbar .components-button,.edit-post-header__settings .components-button,.edit-post-sidebar .components-button:not(:-webkit-any(.components-panel__body-toggle,.editor-post-last-revision__title)),.components-snackbar,.components-toggle-group-control,.editor-post-publish-panel .components-button,.edit-post-text-editor__toolbar .components-button,.edit-post-text-editor__body .components-textarea-control__input{border-radius:.375rem!important}.edit-post-header__toolbar .components-button,.edit-post-header__settings .components-button,.edit-post-sidebar .components-button:not(:-moz-any(.components-panel__body-toggle,.editor-post-last-revision__title)),.components-snackbar,.components-toggle-group-control,.editor-post-publish-panel .components-button,.edit-post-text-editor__toolbar .components-button,.edit-post-text-editor__body .components-textarea-control__input{border-radius:.375rem!important}.edit-post-header__toolbar .components-button,.edit-post-header__settings .components-button,.edit-post-sidebar .components-button:not(:is(.components-panel__body-toggle,.editor-post-last-revision__title)),.components-snackbar,.components-toggle-group-control,.editor-post-publish-panel .components-button,.edit-post-text-editor__toolbar .components-button,.edit-post-text-editor__body .components-textarea-control__input{border-radius:.375rem!important}.components-input-control__container,.components-combobox-control__suggestions-container,.components-checkbox-control__input,button.components-toggle-group-control-option-base,.editor-post-visibility__password-input{border-radius:.25rem!important}.components-button-group .components-button:first-child{border-top-left-radius:.375rem!important;border-bottom-left-radius:.375rem!important}.components-button-group .components-button:last-child{border-top-right-radius:.375rem!important;border-bottom-right-radius:.375rem!important}.components-popover__content{border-radius:.5rem!important}.block-editor-inserter__search{border-top-left-radius:.5rem!important;border-top-right-radius:.5rem!important}.components-base-control__label,.components-input-control__label,.components-custom-select-control__label{text-transform:none!important;letter-spacing:0!important;font-size:13px!important;font-weight:400!important}.edit-post-sidebar{width:20rem!important}.block-list-appender.wp-block{padding:.25rem!important;position:static!important}.components-dropdown.block-editor-inserter{width:-moz-fit-content!important;width:fit-content!important;margin-left:auto!important;margin-right:auto!important}.block-editor-block-list__block-crash-warning{--tw-shadow:var(--tw-shadow-colored)!important;--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)!important;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)!important;--tw-shadow-color:#b91c1c1a!important;border-color:#b91c1c26!important;border-radius:.5rem!important}.block-editor-block-list__block-crash-warning .block-editor-warning__message{--tw-text-opacity:1!important;color:rgb(69 10 10/var(--tw-text-opacity))!important}.block-editor-block-contextual-toolbar,.block-editor-block-parent-selector__button{--tw-shadow:0 1px 2px 0 #0000000d;--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);border-radius:.5rem!important}.block-editor-block-types-list .block-editor-block-types-list__item{border-radius:.5rem!important}.block-editor-block-types-list .block-editor-block-types-list__item:after{content:var(--tw-content)!important;border-radius:.5rem!important}.block-editor-block-types-list .block-editor-block-types-list__item svg{--tw-scale-x:1.25;--tw-scale-y:1.25;transform:translate(var(--tw-translate-x),var(--tw-translate-y))rotate(var(--tw-rotate))skewX(var(--tw-skew-x))skewY(var(--tw-skew-y))scaleX(var(--tw-scale-x))scaleY(var(--tw-scale-y))}.block-editor-list-view-tree .block-editor-block-icon{border-radius:.25rem!important}.block-editor-list-view-tree .block-editor-list-view-leaf>:first-child{border-top-left-radius:.5rem!important;border-bottom-left-radius:.5rem!important}.block-editor-list-view-tree .block-editor-list-view-leaf>:last-child{border-top-right-radius:.5rem!important;border-bottom-right-radius:.5rem!important}.block-editor-block-inspector .block-editor-block-card .block-editor-block-icon{border-radius:.25rem!important}.block-list-appender.wp-block>.block-editor-default-block-appender{width:-moz-fit-content;width:fit-content}.block-list-appender.wp-block>.block-editor-default-block-appender .block-editor-inserter__toggle{width:2.25rem!important;height:2.25rem!important}.block-list-appender.wp-block>.block-editor-default-block-appender .block-editor-inserter__toggle{border-radius:.375rem!important}.edit-post-header__toolbar .components-button{min-height:2.25rem!important}.edit-post-header__toolbar .components-button{min-width:2.25rem!important}.editor-styles-wrapper .wp-block:not(:-webkit-any(.editor-post-title,.block-list-appender)){max-width:100%!important}.editor-styles-wrapper .wp-block:not(:-moz-any(.editor-post-title,.block-list-appender)){max-width:100%!important}.editor-styles-wrapper .wp-block:not(:is(.editor-post-title,.block-list-appender)){max-width:100%!important}.components-tooltip{--tw-border-opacity:1;border-width:1px;border-color:rgb(31 41 55/var(--tw-border-opacity));--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity));--tw-shadow:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a;--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);--tw-backdrop-blur:blur(24px);--tw-backdrop-brightness:brightness(1.05);--tw-backdrop-saturate:saturate(1.5);-webkit-backdrop-filter:var(--tw-backdrop-blur)var(--tw-backdrop-brightness)var(--tw-backdrop-contrast)var(--tw-backdrop-grayscale)var(--tw-backdrop-hue-rotate)var(--tw-backdrop-invert)var(--tw-backdrop-opacity)var(--tw-backdrop-saturate)var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur)var(--tw-backdrop-brightness)var(--tw-backdrop-contrast)var(--tw-backdrop-grayscale)var(--tw-backdrop-hue-rotate)var(--tw-backdrop-invert)var(--tw-backdrop-opacity)var(--tw-backdrop-saturate)var(--tw-backdrop-sepia);background-color:#030712b3;padding:.125rem .25rem;border-radius:.375rem!important}.components-tooltip:has(>:first-child){--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity));--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity));background-color:#fffc}
|
|
1
|
+
.edit-post-header__toolbar .components-button,.edit-post-header__settings .components-button,.editor-document-tools__left .components-button,.editor-header__center .components-button,.editor-header__settings .components-button,.edit-post-sidebar .components-button:not(:-webkit-any(.components-panel__body-toggle,.editor-post-last-revision__title)),.components-snackbar,.components-toggle-group-control,.editor-post-publish-panel .components-button,.edit-post-text-editor__toolbar .components-button,.edit-post-text-editor__body .components-textarea-control__input,.media-modal-content,.media-modal-content .components-button,.components-guide__container .components-button,.components-notice__content .components-button,.editor-post-featured-image__toggle.components-button{border-radius:.375rem!important}.edit-post-header__toolbar .components-button,.edit-post-header__settings .components-button,.editor-document-tools__left .components-button,.editor-header__center .components-button,.editor-header__settings .components-button,.edit-post-sidebar .components-button:not(:-moz-any(.components-panel__body-toggle,.editor-post-last-revision__title)),.components-snackbar,.components-toggle-group-control,.editor-post-publish-panel .components-button,.edit-post-text-editor__toolbar .components-button,.edit-post-text-editor__body .components-textarea-control__input,.media-modal-content,.media-modal-content .components-button,.components-guide__container .components-button,.components-notice__content .components-button,.editor-post-featured-image__toggle.components-button{border-radius:.375rem!important}.edit-post-header__toolbar .components-button,.edit-post-header__settings .components-button,.editor-document-tools__left .components-button,.editor-header__center .components-button,.editor-header__settings .components-button,.edit-post-sidebar .components-button:not(:is(.components-panel__body-toggle,.editor-post-last-revision__title)),.components-snackbar,.components-toggle-group-control,.editor-post-publish-panel .components-button,.edit-post-text-editor__toolbar .components-button,.edit-post-text-editor__body .components-textarea-control__input,.media-modal-content,.media-modal-content .components-button,.components-guide__container .components-button,.components-notice__content .components-button,.editor-post-featured-image__toggle.components-button{border-radius:.375rem!important}.components-input-control__container,.components-combobox-control__suggestions-container,.components-checkbox-control__input,button.components-toggle-group-control-option-base,.editor-post-visibility__password-input{border-radius:.25rem!important}.components-button-group .components-button:first-child{border-top-left-radius:.375rem!important;border-bottom-left-radius:.375rem!important}.components-button-group .components-button:last-child{border-top-right-radius:.375rem!important;border-bottom-right-radius:.375rem!important}.components-popover__content,.components-guide{border-radius:.5rem!important}.block-editor-inserter__search{border-top-left-radius:.5rem!important;border-top-right-radius:.5rem!important}.media-menu-item.active{border-top-left-radius:.375rem!important;border-top-right-radius:.375rem!important}.components-base-control__label,.components-input-control__label,.components-custom-select-control__label{text-transform:none!important;letter-spacing:0!important;font-size:13px!important;font-weight:400!important}.edit-post-sidebar,.interface-interface-skeleton__sidebar:not(:empty)>.interface-complementary-area__fill[style="width: 280px;"],.interface-complementary-area.editor-sidebar{width:20rem!important}.block-list-appender.wp-block{padding:.25rem!important;position:static!important}.components-dropdown.block-editor-inserter{width:-moz-fit-content!important;width:fit-content!important;margin-left:auto!important;margin-right:auto!important}.block-editor-block-list__block-crash-warning{--tw-shadow:var(--tw-shadow-colored)!important;--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)!important;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)!important;--tw-shadow-color:#b91c1c1a!important;border-color:#b91c1c26!important;border-radius:.5rem!important}.block-editor-block-list__block-crash-warning .block-editor-warning__message{--tw-text-opacity:1!important;color:rgb(69 10 10/var(--tw-text-opacity))!important}.block-editor-block-contextual-toolbar,.block-editor-block-parent-selector__button{--tw-shadow:0 1px 2px 0 #0000000d;--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);border-radius:.5rem!important}.block-editor-block-types-list .block-editor-block-types-list__item{border-radius:.5rem!important}.block-editor-block-types-list .block-editor-block-types-list__item:after{content:var(--tw-content)!important;border-radius:.5rem!important}.block-editor-block-types-list .block-editor-block-types-list__item svg{--tw-scale-x:1.25;--tw-scale-y:1.25;transform:translate(var(--tw-translate-x),var(--tw-translate-y))rotate(var(--tw-rotate))skewX(var(--tw-skew-x))skewY(var(--tw-skew-y))scaleX(var(--tw-scale-x))scaleY(var(--tw-scale-y))}.block-editor-list-view-tree .block-editor-block-icon{border-radius:.25rem!important}.block-editor-list-view-tree .block-editor-list-view-leaf>:first-child{border-top-left-radius:.5rem!important;border-bottom-left-radius:.5rem!important}.block-editor-list-view-tree .block-editor-list-view-leaf>:last-child{border-top-right-radius:.5rem!important;border-bottom-right-radius:.5rem!important}.block-editor-block-inspector .block-editor-block-card .block-editor-block-icon{border-radius:.25rem!important}.block-list-appender.wp-block>.block-editor-default-block-appender{width:-moz-fit-content;width:fit-content}.block-list-appender.wp-block>.block-editor-default-block-appender .block-editor-inserter__toggle{width:2.25rem!important;height:2.25rem!important}.block-list-appender.wp-block>.block-editor-default-block-appender .block-editor-inserter__toggle{border-radius:.375rem!important}:is(.edit-post-header__toolbar,.edit-post-header__settings,.editor-document-tools__left,.editor-header__center,.editor-header__settings) .components-button{min-height:2.25rem!important}:is(.edit-post-header__toolbar,.edit-post-header__settings,.editor-document-tools__left,.editor-header__center,.editor-header__settings) .components-button{min-width:2.25rem!important}.editor-styles-wrapper .wp-block:not(:-webkit-any(.editor-post-title,.block-list-appender)){max-width:100%!important}.editor-styles-wrapper .wp-block:not(:-moz-any(.editor-post-title,.block-list-appender)){max-width:100%!important}.editor-styles-wrapper .wp-block:not(:is(.editor-post-title,.block-list-appender)){max-width:100%!important}.components-tooltip{--tw-border-opacity:1;border-width:1px;border-color:rgb(31 41 55/var(--tw-border-opacity));--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity));--tw-shadow:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a;--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);--tw-backdrop-blur:blur(24px);--tw-backdrop-brightness:brightness(1.05);--tw-backdrop-saturate:saturate(1.5);-webkit-backdrop-filter:var(--tw-backdrop-blur)var(--tw-backdrop-brightness)var(--tw-backdrop-contrast)var(--tw-backdrop-grayscale)var(--tw-backdrop-hue-rotate)var(--tw-backdrop-invert)var(--tw-backdrop-opacity)var(--tw-backdrop-saturate)var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur)var(--tw-backdrop-brightness)var(--tw-backdrop-contrast)var(--tw-backdrop-grayscale)var(--tw-backdrop-hue-rotate)var(--tw-backdrop-invert)var(--tw-backdrop-opacity)var(--tw-backdrop-saturate)var(--tw-backdrop-sepia);background-color:#030712b3;padding:.125rem .25rem;border-radius:.375rem!important}.components-tooltip:has(>:first-child){--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity));--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity));background-color:#fffc}
|
|
@@ -93,7 +93,7 @@ const $13c3c67164f4d5be$export$4c260019440d418f = /* @__PURE__ */ forwardRef($13
|
|
|
93
93
|
* @param {ButtonType} [props.type='default'] - The type of the button.
|
|
94
94
|
* @param {boolean} [props.disabled] - If `true`, the button is disabled.
|
|
95
95
|
* @param {string} [props.className] - Classes to pass to the button.
|
|
96
|
-
* @param {string} [props.tooltip] - Tooltip text to display on hover.
|
|
96
|
+
* @param {string|boolean} [props.tooltip] - Tooltip text to display on hover. If set to `true` and an `aria-label` is not provided, the tooltip text will be used as the `aria-label`.
|
|
97
97
|
* @param {Function} [props.onPress] - Function to run when the button is pressed.
|
|
98
98
|
* @param {React.Ref} [props.forwardedRef] - Ref to forward to the button. Use the same as the `ref` prop.
|
|
99
99
|
* @param {string} [props.wrapperClassName] - Classes to pass to the tooltip wrapper.
|
|
@@ -121,7 +121,7 @@ const Button = (props) => {
|
|
|
121
121
|
type = "default",
|
|
122
122
|
disabled,
|
|
123
123
|
className,
|
|
124
|
-
tooltip,
|
|
124
|
+
tooltip: rawTooltip,
|
|
125
125
|
onPress,
|
|
126
126
|
forwardedRef,
|
|
127
127
|
wrapperClassName,
|
|
@@ -130,6 +130,10 @@ const Button = (props) => {
|
|
|
130
130
|
hidden,
|
|
131
131
|
...other
|
|
132
132
|
} = props;
|
|
133
|
+
let tooltip = rawTooltip;
|
|
134
|
+
if (rawTooltip === true && (ariaLabel == null ? void 0 : ariaLabel.length) > 0) {
|
|
135
|
+
tooltip = ariaLabel;
|
|
136
|
+
}
|
|
133
137
|
const objRef = $df56164dff5785e2$export$4338b53315abf666(forwardedRef);
|
|
134
138
|
if (hidden) {
|
|
135
139
|
return null;
|
|
@@ -143,6 +143,7 @@ const $bcdf0525bf22703d$export$2c73285ae9390cec = /* @__PURE__ */ forwardRef($bc
|
|
|
143
143
|
* @param {boolean} [props.disabled] - If `true`, the input is disabled.
|
|
144
144
|
* @param {boolean} [props.readOnly] - If `true`, the input is read-only.
|
|
145
145
|
* @param {string} [props.className] - Classes to pass to the input field.
|
|
146
|
+
* @param {string} [props.wrapperClassName] - Classes to pass to the input field wrapping element.
|
|
146
147
|
* @param {boolean} [props.hidden] - If `true`, the component is not rendered.
|
|
147
148
|
*
|
|
148
149
|
* @returns {JSX.Element} The InputField component.
|
|
@@ -159,7 +160,7 @@ const $bcdf0525bf22703d$export$2c73285ae9390cec = /* @__PURE__ */ forwardRef($bc
|
|
|
159
160
|
* @preserve
|
|
160
161
|
*/
|
|
161
162
|
const InputField = (props) => {
|
|
162
|
-
const { icon, label, subtitle, help, actions, value, onChange, type = "text", disabled, readOnly, className, hidden, ...other } = props;
|
|
163
|
+
const { icon, label, subtitle, help, actions, value, onChange, type = "text", disabled, readOnly, className, wrapperClassName, hidden, ...other } = props;
|
|
163
164
|
if (hidden) {
|
|
164
165
|
return null;
|
|
165
166
|
}
|
|
@@ -170,6 +171,7 @@ const InputField = (props) => {
|
|
|
170
171
|
onChange,
|
|
171
172
|
isDisabled: disabled,
|
|
172
173
|
isReadOnly: readOnly,
|
|
174
|
+
className: wrapperClassName,
|
|
173
175
|
...other,
|
|
174
176
|
children: /* @__PURE__ */ jsxs(
|
|
175
177
|
BaseControl,
|
|
@@ -31,7 +31,7 @@ import { _ as __ } from "../../default-i18n-BqWys-1G.js";
|
|
|
31
31
|
* @param {Object} [props.itemProps] - Props to pass to each item.
|
|
32
32
|
* @param {boolean} [props.noTriggerLabel] - Whether the trigger label should be hidden. Applies only to the `menu` type.
|
|
33
33
|
* @param {boolean} [props.noTriggerIcon] - Whether the trigger icon should be hidden. Applies only to the `menu` type.
|
|
34
|
-
* @param {string} [props.tooltip] - If provided, overrides the default tooltip text. If there is no label, the value will still be shown within the tooltip. Applies only to the `menu` type.
|
|
34
|
+
* @param {string|boolean} [props.tooltip] - If provided, overrides the default tooltip text. If there is no label, the value will still be shown within the tooltip. Applies only to the `menu` type. If `true` is set and an `aria-label` is provided, the tooltip will show the same text as the `aria-label`.
|
|
35
35
|
* @param {boolean} [props.noItemLabel] - Whether the option label should be hidden.
|
|
36
36
|
* @param {boolean} [props.noItemIcon] - Whether the option icon should be hidden.
|
|
37
37
|
* @param {boolean} [props.hidden] - If `true`, the component is not rendered.
|
|
@@ -75,16 +75,21 @@ const OptionSelect = (props) => {
|
|
|
75
75
|
itemProps,
|
|
76
76
|
noTriggerLabel,
|
|
77
77
|
noTriggerIcon,
|
|
78
|
-
tooltip,
|
|
78
|
+
tooltip: rawTooltip,
|
|
79
79
|
noItemLabel,
|
|
80
80
|
noItemIcon,
|
|
81
81
|
children,
|
|
82
82
|
hidden,
|
|
83
|
+
"aria-label": ariaLabel,
|
|
83
84
|
...rest
|
|
84
85
|
} = props;
|
|
85
86
|
if (hidden) {
|
|
86
87
|
return null;
|
|
87
88
|
}
|
|
89
|
+
let tooltip = rawTooltip;
|
|
90
|
+
if (rawTooltip === true && (ariaLabel == null ? void 0 : ariaLabel.length) > 0) {
|
|
91
|
+
tooltip = ariaLabel;
|
|
92
|
+
}
|
|
88
93
|
const currentItem = options == null ? void 0 : options.find(({ value: optionValue }) => optionValue === value);
|
|
89
94
|
const notSetLabel = /* @__PURE__ */ jsx("span", { className: "es-uic-leading-3 es-uic-opacity-50", children: __("Not set", "eightshift-ui-components") });
|
|
90
95
|
return /* @__PURE__ */ jsxs(
|
|
@@ -103,7 +108,7 @@ const OptionSelect = (props) => {
|
|
|
103
108
|
ButtonGroup,
|
|
104
109
|
{
|
|
105
110
|
vertical,
|
|
106
|
-
"aria-label": typeof label !== "undefined" ? null :
|
|
111
|
+
"aria-label": typeof label !== "undefined" ? null : ariaLabel,
|
|
107
112
|
...wrapperProps,
|
|
108
113
|
children: options.map(
|
|
109
114
|
({
|
|
@@ -151,7 +156,7 @@ const OptionSelect = (props) => {
|
|
|
151
156
|
orientation: vertical ? "vertical" : "horizontal",
|
|
152
157
|
onChange: (v) => onChange(v),
|
|
153
158
|
design: type === "radios" ? "default" : "segmented",
|
|
154
|
-
"aria-label": typeof label !== "undefined" ? null :
|
|
159
|
+
"aria-label": typeof label !== "undefined" ? null : ariaLabel,
|
|
155
160
|
value,
|
|
156
161
|
...wrapperProps,
|
|
157
162
|
children: options.map(({ label: optionLabel, value: optionValue, icon: optionIcon, ariaLabel: optionAriaLabel, subtitle: optionSubtitle, disabled: optionDisabled }) => {
|
|
@@ -189,7 +194,7 @@ const OptionSelect = (props) => {
|
|
|
189
194
|
) : tooltip,
|
|
190
195
|
triggerProps: {
|
|
191
196
|
...wrapperProps == null ? void 0 : wrapperProps.triggerProps,
|
|
192
|
-
"aria-label": typeof label !== "undefined" ? null :
|
|
197
|
+
"aria-label": typeof label !== "undefined" ? null : ariaLabel
|
|
193
198
|
},
|
|
194
199
|
keepOpen: true,
|
|
195
200
|
...wrapperProps,
|
|
@@ -5174,7 +5174,8 @@ const Repeater = (props) => {
|
|
|
5174
5174
|
if (event.canceled) {
|
|
5175
5175
|
return;
|
|
5176
5176
|
}
|
|
5177
|
-
|
|
5177
|
+
setItems((items2) => move(items2, source, target));
|
|
5178
|
+
onChange(items);
|
|
5178
5179
|
},
|
|
5179
5180
|
children: items.map((item, index) => /* @__PURE__ */ jsx(
|
|
5180
5181
|
SortableItem,
|
|
@@ -5191,6 +5192,7 @@ const Repeater = (props) => {
|
|
|
5191
5192
|
index,
|
|
5192
5193
|
canDelete,
|
|
5193
5194
|
deleteItem: () => {
|
|
5195
|
+
setItems([...items].filter((i2) => i2.id !== item.id));
|
|
5194
5196
|
onChange([...items].filter((i2) => i2.id !== item.id));
|
|
5195
5197
|
if (onAfterItemRemove) {
|
|
5196
5198
|
onAfterItemRemove(item);
|
|
@@ -5219,9 +5221,11 @@ const Repeater = (props) => {
|
|
|
5219
5221
|
updateData: (newValue) => {
|
|
5220
5222
|
const updated = [...items].map((i2) => i2.id === item.id ? { ...i2, ...newValue } : i2);
|
|
5221
5223
|
onChange(updated);
|
|
5224
|
+
setItems(updated);
|
|
5222
5225
|
},
|
|
5223
5226
|
itemIndex: index,
|
|
5224
5227
|
deleteItem: () => {
|
|
5228
|
+
setItems([...items].filter((i2) => i2.id !== item.id));
|
|
5225
5229
|
onChange([...items].filter((i2) => i2.id !== item.id));
|
|
5226
5230
|
if (onAfterItemRemove) {
|
|
5227
5231
|
onAfterItemRemove(item);
|
package/package.json
CHANGED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { useRef, useEffect } from "react";
|
|
2
|
-
function useCellEditMode() {
|
|
3
|
-
const isFocusedRef = useRef(false);
|
|
4
|
-
const isEditModeRef = useRef(false);
|
|
5
|
-
useEffect(() => {
|
|
6
|
-
const handler = (e) => {
|
|
7
|
-
if (isFocusedRef.current) {
|
|
8
|
-
if (e.code === "Enter") {
|
|
9
|
-
isEditModeRef.current = true;
|
|
10
|
-
} else if (e.code === "Escape" || e.code === "Tab") {
|
|
11
|
-
isEditModeRef.current = false;
|
|
12
|
-
}
|
|
13
|
-
if (isEditModeRef.current) {
|
|
14
|
-
e.stopPropagation();
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
window.addEventListener("keydown", handler, true);
|
|
19
|
-
return () => {
|
|
20
|
-
window.removeEventListener("keydown", handler, true);
|
|
21
|
-
};
|
|
22
|
-
}, []);
|
|
23
|
-
const setFocus = (should) => isFocusedRef.current = should;
|
|
24
|
-
const preventProps = {
|
|
25
|
-
onFocus: () => setFocus(true),
|
|
26
|
-
onBlur: () => setFocus(false),
|
|
27
|
-
onClick: () => {
|
|
28
|
-
isEditModeRef.current = true;
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
return preventProps;
|
|
32
|
-
}
|
|
33
|
-
export {
|
|
34
|
-
useCellEditMode
|
|
35
|
-
};
|