@eightshift/ui-components 0.0.1
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 +27 -0
- package/dist/Checkbox-BLcVbhiO.js +178 -0
- package/dist/ColorSwatch-Cmlex_kT.js +66 -0
- package/dist/FieldError-wtMA4667.js +42 -0
- package/dist/FocusScope-1u9yyfIN.js +725 -0
- package/dist/Form-Cq3fu75_.js +5 -0
- package/dist/GridList-BZPXp3_O.js +1256 -0
- package/dist/Group-DyqpTRPe.js +49 -0
- package/dist/Input-jsbb4ugq.js +130 -0
- package/dist/Label-BPzS-sR7.js +17 -0
- package/dist/ListBox-w9gDaJkV.js +4423 -0
- package/dist/LiveAnnouncer-IsokfWQ5.js +73 -0
- package/dist/NumberFormatter-LzoKy975.js +160 -0
- package/dist/RSPContexts-CrNYmadY.js +14 -0
- package/dist/Select-49a62830.esm-C-RFtLiD.js +2541 -0
- package/dist/SelectionManager-mefd0ThJ.js +2155 -0
- package/dist/Separator-DHn0CwdK.js +325 -0
- package/dist/Slider-Pyh2V4bY.js +885 -0
- package/dist/Text-BM136LvS.js +17 -0
- package/dist/VisuallyHidden-BYRI1Lfo.js +51 -0
- package/dist/_commonjsHelpers-CUmg6egw.js +6 -0
- package/dist/ariaHideOutside-ByKBPHmX.js +113 -0
- package/dist/assets/style.css +1 -0
- package/dist/button-BkkdyHfJ.js +307 -0
- package/dist/components/animated-visibility/animated-visibility.js +7165 -0
- package/dist/components/base-control/base-control.js +97 -0
- package/dist/components/breakpoint-preview/breakpoint-preview.js +218 -0
- package/dist/components/button/button.js +10 -0
- package/dist/components/checkbox/checkbox.js +119 -0
- package/dist/components/color-pickers/color-picker.js +242 -0
- package/dist/components/color-pickers/color-swatch.js +62 -0
- package/dist/components/color-pickers/gradient-editor.js +516 -0
- package/dist/components/color-pickers/solid-color-picker.js +1633 -0
- package/dist/components/component-toggle/component-toggle.js +71 -0
- package/dist/components/container-panel/container-panel.js +39 -0
- package/dist/components/expandable/expandable.js +144 -0
- package/dist/components/input-field/input-field.js +224 -0
- package/dist/components/link-input/link-input.js +937 -0
- package/dist/components/list-box/list-box.js +152 -0
- package/dist/components/matrix-align/matrix-align.js +185 -0
- package/dist/components/menu/menu.js +1608 -0
- package/dist/components/notice/notice.js +119 -0
- package/dist/components/number-picker/number-picker.js +277 -0
- package/dist/components/popover/popover.js +9 -0
- package/dist/components/radio/radio.js +552 -0
- package/dist/components/repeater/repeater-item.js +127 -0
- package/dist/components/repeater/repeater.js +248 -0
- package/dist/components/responsive/responsive-legacy.js +326 -0
- package/dist/components/responsive/responsive.js +499 -0
- package/dist/components/responsive-preview/responsive-preview.js +119 -0
- package/dist/components/rich-label/rich-label.js +56 -0
- package/dist/components/select/async-multi-select.js +144 -0
- package/dist/components/select/async-single-select.js +126 -0
- package/dist/components/select/custom-select-default-components.js +38 -0
- package/dist/components/select/multi-select-components.js +8 -0
- package/dist/components/select/multi-select.js +134 -0
- package/dist/components/select/react-select-component-wrappers.js +90 -0
- package/dist/components/select/shared.js +45 -0
- package/dist/components/select/single-select.js +116 -0
- package/dist/components/select/styles.js +55 -0
- package/dist/components/slider/column-config-slider.js +225 -0
- package/dist/components/slider/slider.js +362 -0
- package/dist/components/slider/utils.js +45 -0
- package/dist/components/spacer/spacer.js +93 -0
- package/dist/components/tabs/tabs.js +626 -0
- package/dist/components/toggle/switch.js +140 -0
- package/dist/components/toggle/toggle.js +58 -0
- package/dist/components/toggle-button/toggle-button.js +206 -0
- package/dist/components/tooltip/tooltip.js +10 -0
- package/dist/context-jMy6xdVq.js +98 -0
- package/dist/default-i18n-BhE-OUmt.js +873 -0
- package/dist/filterDOMProps-DG2RfOUr.js +30 -0
- package/dist/focusSafely-C3K8zAKj.js +743 -0
- package/dist/hooks/use-cell-edit-mode.js +35 -0
- package/dist/icons/block-icon.js +42 -0
- package/dist/icons/generic-color-swatch.js +21 -0
- package/dist/icons/icons.js +3636 -0
- package/dist/index-Bfb9bWcb.js +28844 -0
- package/dist/index-a301f526.esm-Bioi4cGX.js +3576 -0
- package/dist/index.js +109 -0
- package/dist/intlStrings-CUhoK9EN.js +2484 -0
- package/dist/isScrollable-PcyglExV.js +10 -0
- package/dist/modifiers.esm-BuJQPI1X.js +31 -0
- package/dist/multi-select-components-CjVpCNko.js +3677 -0
- package/dist/number-rWqELA8W.js +39 -0
- package/dist/popover-Dx3vKXUX.js +1061 -0
- package/dist/react-select-async.esm-TFb_ZX6C.js +111 -0
- package/dist/react-select.esm-BjRWqf0E.js +15 -0
- package/dist/style.js +1 -0
- package/dist/textSelection-BosCCRVE.js +89 -0
- package/dist/tooltip-CkCndvTI.js +1094 -0
- package/dist/useButton-CuG5UzUw.js +74 -0
- package/dist/useEvent-DHv-yhOH.js +24 -0
- package/dist/useFocusRing-Cc-4eouh.js +41 -0
- package/dist/useFocusable-5q1Gek1J.js +81 -0
- package/dist/useFormReset-Buc9YJcv.js +23 -0
- package/dist/useFormValidationState-BAPPNXic.js +238 -0
- package/dist/useHasTabbableChild-D3uUNhJ0.js +37 -0
- package/dist/useLabel-CGlkoFG0.js +28 -0
- package/dist/useLabels-Dg62M_3P.js +25 -0
- package/dist/useListData-BelKu4kx.js +211 -0
- package/dist/useListState-Domq0blV.js +137 -0
- package/dist/useLocalizedStringFormatter-Prmz0h0A.js +130 -0
- package/dist/useNumberFieldState-BLU3uhSR.js +1253 -0
- package/dist/useNumberFormatter-BLc2xjZn.js +13 -0
- package/dist/usePress-BQgVor4T.js +698 -0
- package/dist/useToggle-C9ETOBaZ.js +58 -0
- package/dist/useToggleState-DJ_z5E2S.js +21 -0
- package/dist/utilities/classnames.js +16 -0
- package/dist/utilities/text-helpers.js +79 -0
- package/dist/utils-BsiH7-5Y.js +488 -0
- package/package.json +71 -0
package/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Eightshift UI components
|
|
2
|
+
|
|
3
|
+
A collection of commonly-used UI components, utilities and icons, meant to provide the best experience both for users and developers while making the editor UI look modern.
|
|
4
|
+
|
|
5
|
+
Built using [React Aria components](https://react-spectrum.adobe.com/react-aria/), styled using [TailwindCSS](https://tailwindcss.com/). Build process and library export is set up with [Vite](https://vitejs.dev/).
|
|
6
|
+
|
|
7
|
+
## Who do I talk to?
|
|
8
|
+
|
|
9
|
+
If you have any questions or problems, please [open an issue](https://github.com/infinum/eightshift-ui-components/issues) on GitHub and we will do our best to give you a timely answer.
|
|
10
|
+
|
|
11
|
+
## Maintainers
|
|
12
|
+
Eightshift UI components is maintained and sponsored by
|
|
13
|
+
[Eightshift](https://eightshift.com) and [Infinum](https://infinum.com).
|
|
14
|
+
|
|
15
|
+
## License
|
|
16
|
+
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.
|
|
17
|
+
|
|
18
|
+
## To-do
|
|
19
|
+
[] AdvancedColorPicker
|
|
20
|
+
|
|
21
|
+
### Won't bring over from Frontend libs
|
|
22
|
+
- BlockInserter
|
|
23
|
+
- Responsive components (ResponsiveNumberPicker, ResponsiveSlider, ResponsiveToggleButton)
|
|
24
|
+
- PresetPicker
|
|
25
|
+
- ReOrderable - will deprecate
|
|
26
|
+
- TileButton - will deprecate
|
|
27
|
+
- WidthOffsetRangeSlider
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { $ as $4e85f108e88277b8$export$b085522c77523c51 } from "./RSPContexts-CrNYmadY.js";
|
|
2
|
+
import { a as $64fa3d84918910a7$export$29f1550f4b0d4415, $ as $64fa3d84918910a7$export$fabf2dc03a41866e, l as $df56164dff5785e2$export$4338b53315abf666, m as $5dc95899b306f630$export$c9058316764c140e, c as $64fa3d84918910a7$export$4d86445c2cf5e3, d as $3ef42575df84b30b$export$9d1611c77c2fe928 } from "./utils-BsiH7-5Y.js";
|
|
3
|
+
import { $ as $d3e0e05bdfcf66bd$export$c24727297075ec6a } from "./Form-Cq3fu75_.js";
|
|
4
|
+
import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "./filterDOMProps-DG2RfOUr.js";
|
|
5
|
+
import React__default, { useEffect, useRef, forwardRef, useContext, createContext } from "react";
|
|
6
|
+
import { $ as $e5be200c675c3b3a$export$fc1a364ae1f3ff10, a as $e93e671b31057976$export$b8473d3665f3a75a, b as $e5be200c675c3b3a$export$dad6ae84456c676a, c as $e5be200c675c3b3a$export$a763b9476acd3eb } from "./useFormValidationState-BAPPNXic.js";
|
|
7
|
+
import { $ as $d2c8e2b0480f3f34$export$cbe85ee05b554577 } from "./useToggle-C9ETOBaZ.js";
|
|
8
|
+
import { $ as $3017fa7ffdddec74$export$8042c6c013fd5226 } from "./useToggleState-DJ_z5E2S.js";
|
|
9
|
+
import { $ as $f7dceffc5ad7768b$export$4e328f61c538687f } from "./useFocusRing-Cc-4eouh.js";
|
|
10
|
+
import { $ as $6179b936705e76d3$export$ae780daf29e6d456 } from "./focusSafely-C3K8zAKj.js";
|
|
11
|
+
import { $ as $5c3e21d68f1c4674$export$439d29a4e110a164 } from "./VisuallyHidden-BYRI1Lfo.js";
|
|
12
|
+
function $406796ff087fe49b$export$e375f10ce42261c5(props, state, inputRef) {
|
|
13
|
+
let validationState = $e5be200c675c3b3a$export$fc1a364ae1f3ff10({
|
|
14
|
+
...props,
|
|
15
|
+
value: state.isSelected
|
|
16
|
+
});
|
|
17
|
+
let { isInvalid, validationErrors, validationDetails } = validationState.displayValidation;
|
|
18
|
+
let { labelProps, inputProps, isSelected, isPressed, isDisabled, isReadOnly } = $d2c8e2b0480f3f34$export$cbe85ee05b554577({
|
|
19
|
+
...props,
|
|
20
|
+
isInvalid
|
|
21
|
+
}, state, inputRef);
|
|
22
|
+
$e93e671b31057976$export$b8473d3665f3a75a(props, validationState, inputRef);
|
|
23
|
+
let { isIndeterminate, isRequired, validationBehavior = "aria" } = props;
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (inputRef.current)
|
|
26
|
+
inputRef.current.indeterminate = !!isIndeterminate;
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
labelProps,
|
|
30
|
+
inputProps: {
|
|
31
|
+
...inputProps,
|
|
32
|
+
checked: isSelected,
|
|
33
|
+
"aria-required": isRequired && validationBehavior === "aria" || void 0,
|
|
34
|
+
required: isRequired && validationBehavior === "native"
|
|
35
|
+
},
|
|
36
|
+
isSelected,
|
|
37
|
+
isPressed,
|
|
38
|
+
isDisabled,
|
|
39
|
+
isReadOnly,
|
|
40
|
+
isInvalid,
|
|
41
|
+
validationErrors,
|
|
42
|
+
validationDetails
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
const $1ae600c947479353$export$ec98120685d4f57d = /* @__PURE__ */ new WeakMap();
|
|
46
|
+
function $fba3e38d5ca8983f$export$353b32fc6898d37d(props, state, inputRef) {
|
|
47
|
+
const toggleState = $3017fa7ffdddec74$export$8042c6c013fd5226({
|
|
48
|
+
isReadOnly: props.isReadOnly || state.isReadOnly,
|
|
49
|
+
isSelected: state.isSelected(props.value),
|
|
50
|
+
onChange(isSelected) {
|
|
51
|
+
if (isSelected)
|
|
52
|
+
state.addValue(props.value);
|
|
53
|
+
else
|
|
54
|
+
state.removeValue(props.value);
|
|
55
|
+
if (props.onChange)
|
|
56
|
+
props.onChange(isSelected);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
let { name, descriptionId, errorMessageId, validationBehavior } = $1ae600c947479353$export$ec98120685d4f57d.get(state);
|
|
60
|
+
var _props_validationBehavior;
|
|
61
|
+
validationBehavior = (_props_validationBehavior = props.validationBehavior) !== null && _props_validationBehavior !== void 0 ? _props_validationBehavior : validationBehavior;
|
|
62
|
+
let { realtimeValidation } = $e5be200c675c3b3a$export$fc1a364ae1f3ff10({
|
|
63
|
+
...props,
|
|
64
|
+
value: toggleState.isSelected,
|
|
65
|
+
// Server validation is handled at the group level.
|
|
66
|
+
name: void 0,
|
|
67
|
+
validationBehavior: "aria"
|
|
68
|
+
});
|
|
69
|
+
let nativeValidation = useRef($e5be200c675c3b3a$export$dad6ae84456c676a);
|
|
70
|
+
let updateValidation = () => {
|
|
71
|
+
state.setInvalid(props.value, realtimeValidation.isInvalid ? realtimeValidation : nativeValidation.current);
|
|
72
|
+
};
|
|
73
|
+
useEffect(updateValidation);
|
|
74
|
+
let combinedRealtimeValidation = state.realtimeValidation.isInvalid ? state.realtimeValidation : realtimeValidation;
|
|
75
|
+
let displayValidation = validationBehavior === "native" ? state.displayValidation : combinedRealtimeValidation;
|
|
76
|
+
var _props_isRequired;
|
|
77
|
+
let res = $406796ff087fe49b$export$e375f10ce42261c5({
|
|
78
|
+
...props,
|
|
79
|
+
isReadOnly: props.isReadOnly || state.isReadOnly,
|
|
80
|
+
isDisabled: props.isDisabled || state.isDisabled,
|
|
81
|
+
name: props.name || name,
|
|
82
|
+
isRequired: (_props_isRequired = props.isRequired) !== null && _props_isRequired !== void 0 ? _props_isRequired : state.isRequired,
|
|
83
|
+
validationBehavior,
|
|
84
|
+
[$e5be200c675c3b3a$export$a763b9476acd3eb]: {
|
|
85
|
+
realtimeValidation: combinedRealtimeValidation,
|
|
86
|
+
displayValidation,
|
|
87
|
+
resetValidation: state.resetValidation,
|
|
88
|
+
commitValidation: state.commitValidation,
|
|
89
|
+
updateValidation(v) {
|
|
90
|
+
nativeValidation.current = v;
|
|
91
|
+
updateValidation();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}, toggleState, inputRef);
|
|
95
|
+
return {
|
|
96
|
+
...res,
|
|
97
|
+
inputProps: {
|
|
98
|
+
...res.inputProps,
|
|
99
|
+
"aria-describedby": [
|
|
100
|
+
props["aria-describedby"],
|
|
101
|
+
state.isInvalid ? errorMessageId : null,
|
|
102
|
+
descriptionId
|
|
103
|
+
].filter(Boolean).join(" ") || void 0
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
const $bc237834342dbd75$export$139c5b8563afc1fc = /* @__PURE__ */ createContext(null);
|
|
108
|
+
function $bc237834342dbd75$var$Checkbox(props, ref) {
|
|
109
|
+
let { inputRef: userProvidedInputRef = null, ...otherProps } = props;
|
|
110
|
+
[props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(otherProps, ref, $4e85f108e88277b8$export$b085522c77523c51);
|
|
111
|
+
let { validationBehavior: formValidationBehavior } = $64fa3d84918910a7$export$fabf2dc03a41866e($d3e0e05bdfcf66bd$export$c24727297075ec6a) || {};
|
|
112
|
+
var _props_validationBehavior, _ref;
|
|
113
|
+
let validationBehavior = (_ref = (_props_validationBehavior = props.validationBehavior) !== null && _props_validationBehavior !== void 0 ? _props_validationBehavior : formValidationBehavior) !== null && _ref !== void 0 ? _ref : "native";
|
|
114
|
+
let groupState = useContext($bc237834342dbd75$export$139c5b8563afc1fc);
|
|
115
|
+
let inputRef = $df56164dff5785e2$export$4338b53315abf666($5dc95899b306f630$export$c9058316764c140e(userProvidedInputRef, props.inputRef !== void 0 ? props.inputRef : null));
|
|
116
|
+
let { labelProps, inputProps, isSelected, isDisabled, isReadOnly, isPressed, isInvalid } = groupState ? $fba3e38d5ca8983f$export$353b32fc6898d37d({
|
|
117
|
+
...props,
|
|
118
|
+
// Value is optional for standalone checkboxes, but required for CheckboxGroup items;
|
|
119
|
+
// it's passed explicitly here to avoid typescript error (requires ignore).
|
|
120
|
+
// @ts-ignore
|
|
121
|
+
value: props.value,
|
|
122
|
+
// ReactNode type doesn't allow function children.
|
|
123
|
+
children: typeof props.children === "function" ? true : props.children
|
|
124
|
+
}, groupState, inputRef) : $406796ff087fe49b$export$e375f10ce42261c5({
|
|
125
|
+
...props,
|
|
126
|
+
children: typeof props.children === "function" ? true : props.children,
|
|
127
|
+
validationBehavior
|
|
128
|
+
}, $3017fa7ffdddec74$export$8042c6c013fd5226(props), inputRef);
|
|
129
|
+
let { isFocused, isFocusVisible, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f();
|
|
130
|
+
let isInteractionDisabled = isDisabled || isReadOnly;
|
|
131
|
+
let { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456({
|
|
132
|
+
...props,
|
|
133
|
+
isDisabled: isInteractionDisabled
|
|
134
|
+
});
|
|
135
|
+
let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
|
|
136
|
+
// TODO: should data attrs go on the label or on the <input>? useCheckbox passes them to the input...
|
|
137
|
+
...props,
|
|
138
|
+
defaultClassName: "react-aria-Checkbox",
|
|
139
|
+
values: {
|
|
140
|
+
isSelected,
|
|
141
|
+
isIndeterminate: props.isIndeterminate || false,
|
|
142
|
+
isPressed,
|
|
143
|
+
isHovered,
|
|
144
|
+
isFocused,
|
|
145
|
+
isFocusVisible,
|
|
146
|
+
isDisabled,
|
|
147
|
+
isReadOnly,
|
|
148
|
+
isInvalid,
|
|
149
|
+
isRequired: props.isRequired || false
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props);
|
|
153
|
+
delete DOMProps.id;
|
|
154
|
+
return /* @__PURE__ */ React__default.createElement("label", {
|
|
155
|
+
...$3ef42575df84b30b$export$9d1611c77c2fe928(DOMProps, labelProps, hoverProps, renderProps),
|
|
156
|
+
ref,
|
|
157
|
+
slot: props.slot || void 0,
|
|
158
|
+
"data-selected": isSelected || void 0,
|
|
159
|
+
"data-indeterminate": props.isIndeterminate || void 0,
|
|
160
|
+
"data-pressed": isPressed || void 0,
|
|
161
|
+
"data-hovered": isHovered || void 0,
|
|
162
|
+
"data-focused": isFocused || void 0,
|
|
163
|
+
"data-focus-visible": isFocusVisible || void 0,
|
|
164
|
+
"data-disabled": isDisabled || void 0,
|
|
165
|
+
"data-readonly": isReadOnly || void 0,
|
|
166
|
+
"data-invalid": isInvalid || void 0,
|
|
167
|
+
"data-required": props.isRequired || void 0
|
|
168
|
+
}, /* @__PURE__ */ React__default.createElement($5c3e21d68f1c4674$export$439d29a4e110a164, {
|
|
169
|
+
elementType: "span"
|
|
170
|
+
}, /* @__PURE__ */ React__default.createElement("input", {
|
|
171
|
+
...$3ef42575df84b30b$export$9d1611c77c2fe928(inputProps, focusProps),
|
|
172
|
+
ref: inputRef
|
|
173
|
+
})), renderProps.children);
|
|
174
|
+
}
|
|
175
|
+
const $bc237834342dbd75$export$48513f6b9f8ce62d = /* @__PURE__ */ forwardRef($bc237834342dbd75$var$Checkbox);
|
|
176
|
+
export {
|
|
177
|
+
$bc237834342dbd75$export$48513f6b9f8ce62d as $
|
|
178
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { e as $bdb11010cef70236$export$f680877a34711e37, a as $64fa3d84918910a7$export$29f1550f4b0d4415, c as $64fa3d84918910a7$export$4d86445c2cf5e3 } from "./utils-BsiH7-5Y.js";
|
|
2
|
+
import { $ as $799cddbef784668f$export$6e865ea70d7724f, a as $3493a52097159720$exports } from "./intlStrings-CUhoK9EN.js";
|
|
3
|
+
import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "./filterDOMProps-DG2RfOUr.js";
|
|
4
|
+
import React__default, { useMemo, forwardRef, createContext } from "react";
|
|
5
|
+
import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "./context-jMy6xdVq.js";
|
|
6
|
+
import { $ as $fca6afa0e843324b$export$f12b703ca79dfbb1 } from "./useLocalizedStringFormatter-Prmz0h0A.js";
|
|
7
|
+
function $parcel$interopDefault(a) {
|
|
8
|
+
return a && a.__esModule ? a.default : a;
|
|
9
|
+
}
|
|
10
|
+
function $2993fcad7650b98d$export$9060ae606178d849(props) {
|
|
11
|
+
let { color: value, colorName } = props;
|
|
12
|
+
let nonNullValue = value || "#fff0";
|
|
13
|
+
let color = useMemo(() => typeof nonNullValue === "string" ? $799cddbef784668f$export$6e865ea70d7724f(nonNullValue) : nonNullValue, [
|
|
14
|
+
nonNullValue
|
|
15
|
+
]);
|
|
16
|
+
let { locale } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
|
|
17
|
+
let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, {
|
|
18
|
+
labelable: true
|
|
19
|
+
});
|
|
20
|
+
let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1($parcel$interopDefault($3493a52097159720$exports), "@react-aria/color");
|
|
21
|
+
let id = $bdb11010cef70236$export$f680877a34711e37(props.id);
|
|
22
|
+
if (!colorName)
|
|
23
|
+
colorName = color.getChannelValue("alpha") === 0 ? stringFormatter.format("transparent") : color.getColorName(locale);
|
|
24
|
+
return {
|
|
25
|
+
colorSwatchProps: {
|
|
26
|
+
...DOMProps,
|
|
27
|
+
role: "img",
|
|
28
|
+
"aria-roledescription": stringFormatter.format("colorSwatch"),
|
|
29
|
+
"aria-label": [
|
|
30
|
+
colorName,
|
|
31
|
+
props["aria-label"] || ""
|
|
32
|
+
].filter(Boolean).join(", "),
|
|
33
|
+
"aria-labelledby": props["aria-labelledby"] ? `${id} ${props["aria-labelledby"]}` : void 0,
|
|
34
|
+
id,
|
|
35
|
+
style: {
|
|
36
|
+
backgroundColor: color.toString("css"),
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
forcedColorAdjust: "none"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
color: color || null
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
const $251c695a52d94a8d$export$83cc445538396800 = /* @__PURE__ */ createContext(null);
|
|
45
|
+
function $251c695a52d94a8d$var$ColorSwatch(props, ref) {
|
|
46
|
+
[props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $251c695a52d94a8d$export$83cc445538396800);
|
|
47
|
+
let { colorSwatchProps, color } = $2993fcad7650b98d$export$9060ae606178d849(props);
|
|
48
|
+
let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
|
|
49
|
+
...props,
|
|
50
|
+
defaultClassName: "react-aria-ColorSwatch",
|
|
51
|
+
defaultStyle: colorSwatchProps.style,
|
|
52
|
+
values: {
|
|
53
|
+
color
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
57
|
+
...colorSwatchProps,
|
|
58
|
+
...renderProps,
|
|
59
|
+
slot: props.slot || void 0,
|
|
60
|
+
ref
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
const $251c695a52d94a8d$export$cae13e90592f246a = /* @__PURE__ */ forwardRef($251c695a52d94a8d$var$ColorSwatch);
|
|
64
|
+
export {
|
|
65
|
+
$251c695a52d94a8d$export$cae13e90592f246a as $
|
|
66
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { $ as $d191a55c9702f145$export$8467354a121f1b9f } from "./useLabel-CGlkoFG0.js";
|
|
2
|
+
import { k as $bdb11010cef70236$export$b4cc09c592e8fdb8, d as $3ef42575df84b30b$export$9d1611c77c2fe928 } from "./utils-BsiH7-5Y.js";
|
|
3
|
+
import { createContext } from "react";
|
|
4
|
+
function $2baaea4c71418dea$export$294aa081a6c6f55d(props) {
|
|
5
|
+
let { description, errorMessage, isInvalid, validationState } = props;
|
|
6
|
+
let { labelProps, fieldProps } = $d191a55c9702f145$export$8467354a121f1b9f(props);
|
|
7
|
+
let descriptionId = $bdb11010cef70236$export$b4cc09c592e8fdb8([
|
|
8
|
+
Boolean(description),
|
|
9
|
+
Boolean(errorMessage),
|
|
10
|
+
isInvalid,
|
|
11
|
+
validationState
|
|
12
|
+
]);
|
|
13
|
+
let errorMessageId = $bdb11010cef70236$export$b4cc09c592e8fdb8([
|
|
14
|
+
Boolean(description),
|
|
15
|
+
Boolean(errorMessage),
|
|
16
|
+
isInvalid,
|
|
17
|
+
validationState
|
|
18
|
+
]);
|
|
19
|
+
fieldProps = $3ef42575df84b30b$export$9d1611c77c2fe928(fieldProps, {
|
|
20
|
+
"aria-describedby": [
|
|
21
|
+
descriptionId,
|
|
22
|
+
// Use aria-describedby for error message because aria-errormessage is unsupported using VoiceOver or NVDA. See https://github.com/adobe/react-spectrum/issues/1346#issuecomment-740136268
|
|
23
|
+
errorMessageId,
|
|
24
|
+
props["aria-describedby"]
|
|
25
|
+
].filter(Boolean).join(" ") || void 0
|
|
26
|
+
});
|
|
27
|
+
return {
|
|
28
|
+
labelProps,
|
|
29
|
+
fieldProps,
|
|
30
|
+
descriptionProps: {
|
|
31
|
+
id: descriptionId
|
|
32
|
+
},
|
|
33
|
+
errorMessageProps: {
|
|
34
|
+
id: errorMessageId
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const $ee014567cb39d3f0$export$ff05c3ac10437e03 = /* @__PURE__ */ createContext(null);
|
|
39
|
+
export {
|
|
40
|
+
$ee014567cb39d3f0$export$ff05c3ac10437e03 as $,
|
|
41
|
+
$2baaea4c71418dea$export$294aa081a6c6f55d as a
|
|
42
|
+
};
|