@charcoal-ui/react 4.0.0-beta.8 → 4.0.0-rc.0
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/_lib/compat.d.ts +0 -12
- package/dist/_lib/compat.d.ts.map +1 -1
- package/dist/_lib/createDivComponent.d.ts +2 -2
- package/dist/_lib/createDivComponent.d.ts.map +1 -1
- package/dist/components/Button/index.d.ts +2 -6
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Clickable/index.d.ts +4 -7
- package/dist/components/Clickable/index.d.ts.map +1 -1
- package/dist/components/IconButton/index.d.ts +1 -2
- package/dist/components/IconButton/index.d.ts.map +1 -1
- package/dist/components/Modal/Dialog/index.d.ts +1 -1
- package/dist/components/Modal/Dialog/index.d.ts.map +1 -1
- package/dist/components/Modal/ModalPlumbing.d.ts +6 -6
- package/dist/components/Modal/ModalPlumbing.d.ts.map +1 -1
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/Modal/useCustomModalOverlay.d.ts +1 -0
- package/dist/components/Modal/useCustomModalOverlay.d.ts.map +1 -1
- package/dist/components/TagItem/index.d.ts +2 -6
- package/dist/components/TagItem/index.d.ts.map +1 -1
- package/dist/components/TextArea/index.d.ts +1 -1
- package/dist/components/TextArea/index.d.ts.map +1 -1
- package/dist/components/TextField/AssistiveText/index.d.ts +2 -2
- package/dist/components/TextField/AssistiveText/index.d.ts.map +1 -1
- package/dist/components/TextField/index.d.ts +3 -3
- package/dist/components/TextField/index.d.ts.map +1 -1
- package/dist/core/CharcoalProvider.d.ts +4 -11
- package/dist/core/CharcoalProvider.d.ts.map +1 -1
- package/dist/index.cjs.js +300 -334
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +2 -5
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +233 -265
- package/dist/index.esm.js.map +1 -1
- package/dist/layered.css +1214 -0
- package/dist/layered.css.map +1 -0
- package/package.json +17 -13
- package/src/README.mdx +68 -0
- package/src/SSR.mdx +67 -0
- package/src/_lib/compat.ts +0 -11
- package/src/_lib/index.ts +1 -1
- package/src/components/Button/__snapshots__/index.story.storyshot +9 -9
- package/src/components/Button/index.tsx +4 -10
- package/src/components/Checkbox/CheckboxInput/__snapshots__/index.story.storyshot +5 -5
- package/src/components/Checkbox/CheckboxInput/index.css +4 -5
- package/src/components/Checkbox/__snapshots__/index.story.storyshot +6 -6
- package/src/components/Clickable/__snapshots__/index.story.storyshot +2 -2
- package/src/components/Clickable/index.story.tsx +1 -1
- package/src/components/Clickable/index.tsx +7 -12
- package/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot +7 -6
- package/src/components/DropdownSelector/ListItem/index.story.tsx +11 -5
- package/src/components/DropdownSelector/MenuList/__snapshots__/index.story.storyshot +3 -3
- package/src/components/DropdownSelector/Popover/__snapshots__/index.story.storyshot +1 -1
- package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +14 -14
- package/src/components/Icon/__snapshots__/index.story.storyshot +1 -1
- package/src/components/IconButton/__snapshots__/index.story.storyshot +3 -3
- package/src/components/IconButton/index.tsx +3 -6
- package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +4 -4
- package/src/components/Modal/Dialog/index.tsx +2 -1
- package/src/components/Modal/__snapshots__/index.story.storyshot +102 -261
- package/src/components/Modal/index.story.tsx +26 -11
- package/src/components/Modal/index.tsx +5 -6
- package/src/components/Modal/useCustomModalOverlay.tsx +20 -0
- package/src/components/Radio/__snapshots__/index.story.storyshot +40 -65
- package/src/components/Radio/index.story.tsx +14 -7
- package/src/components/Radio/index.test.tsx +20 -27
- package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +2 -2
- package/src/components/Switch/__snapshots__/index.story.storyshot +4 -4
- package/src/components/TagItem/__snapshots__/index.story.storyshot +8 -8
- package/src/components/TagItem/index.tsx +4 -8
- package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +11 -11
- package/src/components/TextField/TextField.story.tsx +8 -9
- package/src/components/TextField/__snapshots__/TextField.story.storyshot +20 -26
- package/src/components/TextField/index.tsx +2 -2
- package/src/core/CharcoalProvider.tsx +5 -29
- package/src/index.ts +0 -5
- package/src/type.d.ts +2 -13
- package/dist/components/Modal/__stories__/InternalScrollStory.d.ts +0 -4
- package/dist/components/Modal/__stories__/InternalScrollStory.d.ts.map +0 -1
- package/dist/core/ComponentAbstraction.d.ts +0 -24
- package/dist/core/ComponentAbstraction.d.ts.map +0 -1
- package/dist/styled.d.ts +0 -95
- package/dist/styled.d.ts.map +0 -1
- package/src/components/Button/__snapshots__/index.test.tsx.snap +0 -11
- package/src/components/Button/index.test.tsx +0 -32
- package/src/components/Modal/__stories__/InternalScrollStory.tsx +0 -75
- package/src/components/a11y.test.tsx +0 -99
- package/src/core/ComponentAbstraction.tsx +0 -48
- package/src/styled.ts +0 -3
package/dist/index.esm.js
CHANGED
|
@@ -1,31 +1,3 @@
|
|
|
1
|
-
// src/core/ComponentAbstraction.tsx
|
|
2
|
-
import { useContext } from "react";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
var DefaultLink = React.forwardRef(function DefaultLink2({
|
|
6
|
-
to,
|
|
7
|
-
children,
|
|
8
|
-
...rest
|
|
9
|
-
}, ref) {
|
|
10
|
-
return /* @__PURE__ */ jsx("a", { href: to, ref, ...rest, children });
|
|
11
|
-
});
|
|
12
|
-
var DefaultValue = {
|
|
13
|
-
Link: DefaultLink
|
|
14
|
-
};
|
|
15
|
-
var ComponentAbstractionContext = React.createContext(DefaultValue);
|
|
16
|
-
function ComponentAbstraction({
|
|
17
|
-
children,
|
|
18
|
-
components
|
|
19
|
-
}) {
|
|
20
|
-
return /* @__PURE__ */ jsx(ComponentAbstractionContext.Provider, { value: {
|
|
21
|
-
...DefaultValue,
|
|
22
|
-
...components
|
|
23
|
-
}, children });
|
|
24
|
-
}
|
|
25
|
-
function useComponentAbstraction() {
|
|
26
|
-
return useContext(ComponentAbstractionContext);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
1
|
// src/core/SSRProvider.tsx
|
|
30
2
|
import { SSRProvider as OriginSSRProvider } from "@react-aria/ssr";
|
|
31
3
|
import { version, Fragment } from "react";
|
|
@@ -39,25 +11,15 @@ var SSRProvider = isReactVersionOver(18) ? Fragment : OriginSSRProvider;
|
|
|
39
11
|
import { OverlayProvider } from "@react-aria/overlays";
|
|
40
12
|
|
|
41
13
|
// src/core/CharcoalProvider.tsx
|
|
42
|
-
import {
|
|
43
|
-
import { TokenInjector } from "@charcoal-ui/styled";
|
|
44
|
-
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { jsx } from "react/jsx-runtime";
|
|
45
15
|
function CharcoalProvider({
|
|
46
|
-
|
|
47
|
-
defaultTheme = themeMap[":root"],
|
|
48
|
-
components = {},
|
|
49
|
-
injectTokens = true,
|
|
50
|
-
children,
|
|
51
|
-
background
|
|
16
|
+
children
|
|
52
17
|
}) {
|
|
53
|
-
return /* @__PURE__ */
|
|
54
|
-
injectTokens && /* @__PURE__ */ jsx2(TokenInjector, { theme: themeMap, background }),
|
|
55
|
-
/* @__PURE__ */ jsx2(ComponentAbstraction, { components, children: /* @__PURE__ */ jsx2(OverlayProvider, { children }) })
|
|
56
|
-
] }) });
|
|
18
|
+
return /* @__PURE__ */ jsx(SSRProvider, { children: /* @__PURE__ */ jsx(OverlayProvider, { children }) });
|
|
57
19
|
}
|
|
58
20
|
|
|
59
21
|
// src/components/Button/index.tsx
|
|
60
|
-
import { forwardRef
|
|
22
|
+
import { forwardRef, useMemo as useMemo2 } from "react";
|
|
61
23
|
|
|
62
24
|
// src/_lib/useClassNames.ts
|
|
63
25
|
import { useMemo } from "react";
|
|
@@ -66,53 +28,50 @@ function useClassNames(...classNames) {
|
|
|
66
28
|
}
|
|
67
29
|
|
|
68
30
|
// src/components/Button/index.tsx
|
|
69
|
-
import { jsx as
|
|
70
|
-
var Button =
|
|
31
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
32
|
+
var Button = forwardRef(function Button2({
|
|
71
33
|
variant,
|
|
72
34
|
fullWidth,
|
|
73
35
|
size,
|
|
74
36
|
className,
|
|
75
|
-
|
|
37
|
+
component,
|
|
76
38
|
isActive,
|
|
77
|
-
componentAs,
|
|
78
39
|
...props
|
|
79
40
|
}, ref) {
|
|
80
|
-
const Component = useMemo2(() =>
|
|
41
|
+
const Component = useMemo2(() => component ?? "button", [component]);
|
|
81
42
|
const classNames = useClassNames("charcoal-button", className);
|
|
82
|
-
return /* @__PURE__ */
|
|
43
|
+
return /* @__PURE__ */ jsx2(Component, { ...props, className: classNames, "data-variant": variant, "data-size": size, "data-full-width": fullWidth, "data-active": isActive, ref });
|
|
83
44
|
});
|
|
84
45
|
var Button_default = Button;
|
|
85
46
|
|
|
86
47
|
// src/components/Clickable/index.tsx
|
|
87
|
-
import { useMemo as useMemo3, forwardRef as
|
|
88
|
-
import { jsx as
|
|
89
|
-
var Clickable =
|
|
90
|
-
|
|
91
|
-
as,
|
|
48
|
+
import { useMemo as useMemo3, forwardRef as forwardRef2 } from "react";
|
|
49
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
50
|
+
var Clickable = forwardRef2(function Clickable2({
|
|
51
|
+
component,
|
|
92
52
|
...props
|
|
93
53
|
}, ref) {
|
|
94
54
|
const className = useClassNames("charcoal-clickable", props.className);
|
|
95
|
-
const Component = useMemo3(() =>
|
|
96
|
-
return /* @__PURE__ */
|
|
55
|
+
const Component = useMemo3(() => component ?? "button", [component]);
|
|
56
|
+
return /* @__PURE__ */ jsx3(Component, { ...props, ref, className });
|
|
97
57
|
});
|
|
98
58
|
var Clickable_default = Clickable;
|
|
99
59
|
|
|
100
60
|
// src/components/IconButton/index.tsx
|
|
101
|
-
import { forwardRef as
|
|
102
|
-
import { jsx as
|
|
103
|
-
var IconButton =
|
|
61
|
+
import { forwardRef as forwardRef3, useMemo as useMemo4 } from "react";
|
|
62
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
63
|
+
var IconButton = forwardRef3(function IconButtonInner({
|
|
104
64
|
variant = "Default",
|
|
105
65
|
size = "M",
|
|
106
66
|
icon,
|
|
107
67
|
isActive = false,
|
|
108
|
-
|
|
109
|
-
as,
|
|
68
|
+
component,
|
|
110
69
|
...rest
|
|
111
70
|
}, ref) {
|
|
112
71
|
validateIconSize(size, icon);
|
|
113
|
-
const Component = useMemo4(() =>
|
|
72
|
+
const Component = useMemo4(() => component ?? "button", [component]);
|
|
114
73
|
const classNames = useClassNames("charcoal-icon-button", rest.className);
|
|
115
|
-
return /* @__PURE__ */
|
|
74
|
+
return /* @__PURE__ */ jsx4(Component, { ...rest, ref, className: classNames, "data-size": size, "data-active": isActive, "data-variant": variant, children: /* @__PURE__ */ jsx4("pixiv-icon", { name: icon }) });
|
|
116
75
|
});
|
|
117
76
|
var IconButton_default = IconButton;
|
|
118
77
|
function validateIconSize(size, icon) {
|
|
@@ -137,12 +96,12 @@ function validateIconSize(size, icon) {
|
|
|
137
96
|
}
|
|
138
97
|
|
|
139
98
|
// src/components/Radio/index.tsx
|
|
140
|
-
import { memo as memo2, forwardRef as
|
|
99
|
+
import { memo as memo2, forwardRef as forwardRef5, useContext } from "react";
|
|
141
100
|
import warning from "warning";
|
|
142
101
|
|
|
143
102
|
// src/components/Radio/RadioGroupContext.ts
|
|
144
|
-
import * as
|
|
145
|
-
var RadioGroupContext =
|
|
103
|
+
import * as React4 from "react";
|
|
104
|
+
var RadioGroupContext = React4.createContext({
|
|
146
105
|
name: void 0,
|
|
147
106
|
selected: void 0,
|
|
148
107
|
disabled: false,
|
|
@@ -154,9 +113,9 @@ var RadioGroupContext = React5.createContext({
|
|
|
154
113
|
});
|
|
155
114
|
|
|
156
115
|
// src/components/Radio/RadioInput/index.tsx
|
|
157
|
-
import { forwardRef as
|
|
158
|
-
import { jsx as
|
|
159
|
-
var RadioInput =
|
|
116
|
+
import { forwardRef as forwardRef4, memo, useCallback } from "react";
|
|
117
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
118
|
+
var RadioInput = forwardRef4(function RadioInput2({
|
|
160
119
|
onChange,
|
|
161
120
|
invalid,
|
|
162
121
|
className,
|
|
@@ -167,13 +126,13 @@ var RadioInput = forwardRef5(function RadioInput2({
|
|
|
167
126
|
onChange?.(el.value);
|
|
168
127
|
}, [onChange]);
|
|
169
128
|
const classNames = useClassNames("charcoal-radio-input", className);
|
|
170
|
-
return /* @__PURE__ */
|
|
129
|
+
return /* @__PURE__ */ jsx5("input", { className: classNames, ref, type: "radio", onChange: handleChange, "aria-invalid": invalid, ...props });
|
|
171
130
|
});
|
|
172
131
|
var RadioInput_default = memo(RadioInput);
|
|
173
132
|
|
|
174
133
|
// src/components/Radio/index.tsx
|
|
175
|
-
import { jsx as
|
|
176
|
-
var Radio =
|
|
134
|
+
import { jsx as jsx6, jsxs } from "react/jsx-runtime";
|
|
135
|
+
var Radio = forwardRef5(function RadioInner({
|
|
177
136
|
value,
|
|
178
137
|
disabled = false,
|
|
179
138
|
children,
|
|
@@ -186,7 +145,7 @@ var Radio = forwardRef6(function RadioInner({
|
|
|
186
145
|
readonly,
|
|
187
146
|
invalid,
|
|
188
147
|
onChange
|
|
189
|
-
} =
|
|
148
|
+
} = useContext(RadioGroupContext);
|
|
190
149
|
const classNames = useClassNames("charcoal-radio__label", props.className);
|
|
191
150
|
warning(
|
|
192
151
|
name !== void 0,
|
|
@@ -195,17 +154,17 @@ var Radio = forwardRef6(function RadioInner({
|
|
|
195
154
|
const isSelected = value === selected;
|
|
196
155
|
const isDisabled = disabled || isParentDisabled;
|
|
197
156
|
const isReadonly = readonly && !isSelected;
|
|
198
|
-
return /* @__PURE__ */
|
|
199
|
-
/* @__PURE__ */
|
|
200
|
-
children != null && /* @__PURE__ */
|
|
157
|
+
return /* @__PURE__ */ jsxs("label", { "aria-disabled": isDisabled || isReadonly, className: classNames, children: [
|
|
158
|
+
/* @__PURE__ */ jsx6(RadioInput_default, { name, value, checked: isSelected, "aria-invalid": invalid, onChange, disabled: isDisabled || isReadonly, ref }),
|
|
159
|
+
children != null && /* @__PURE__ */ jsx6("div", { className: "charcoal-radio__label_div", children })
|
|
201
160
|
] });
|
|
202
161
|
});
|
|
203
162
|
var Radio_default = memo2(Radio);
|
|
204
163
|
|
|
205
164
|
// src/components/Radio/RadioGroup/index.tsx
|
|
206
|
-
import { forwardRef as
|
|
207
|
-
import { jsx as
|
|
208
|
-
var RadioGroup =
|
|
165
|
+
import { forwardRef as forwardRef6, useCallback as useCallback2, useMemo as useMemo5 } from "react";
|
|
166
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
167
|
+
var RadioGroup = forwardRef6(function RadioGroupInner({
|
|
209
168
|
value,
|
|
210
169
|
label,
|
|
211
170
|
name,
|
|
@@ -229,17 +188,17 @@ var RadioGroup = forwardRef7(function RadioGroupInner({
|
|
|
229
188
|
invalid: invalid ?? false,
|
|
230
189
|
onChange: handleChange
|
|
231
190
|
}), [disabled, handleChange, invalid, name, readonly, value]);
|
|
232
|
-
return /* @__PURE__ */
|
|
191
|
+
return /* @__PURE__ */ jsx7(RadioGroupContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx7("div", { role: "radiogroup", "aria-disabled": disabled, "aria-invalid": invalid, "aria-label": label, "aria-labelledby": props["aria-labelledby"], "aria-orientation": ariaOrientation, className: classNames, ref, children }) });
|
|
233
192
|
});
|
|
234
193
|
|
|
235
194
|
// src/components/Switch/index.tsx
|
|
236
|
-
import { memo as memo4, forwardRef as
|
|
195
|
+
import { memo as memo4, forwardRef as forwardRef8 } from "react";
|
|
237
196
|
import { useId } from "@react-aria/utils";
|
|
238
197
|
|
|
239
198
|
// src/components/Switch/SwitchInput/index.tsx
|
|
240
|
-
import { forwardRef as
|
|
241
|
-
import { jsx as
|
|
242
|
-
var SwitchInput =
|
|
199
|
+
import { forwardRef as forwardRef7, useCallback as useCallback3 } from "react";
|
|
200
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
201
|
+
var SwitchInput = forwardRef7(function SwitchInput2({
|
|
243
202
|
onChange,
|
|
244
203
|
className,
|
|
245
204
|
...props
|
|
@@ -250,14 +209,14 @@ var SwitchInput = forwardRef8(function SwitchInput2({
|
|
|
250
209
|
}, [onChange]);
|
|
251
210
|
props.children;
|
|
252
211
|
const classNames = useClassNames("charcoal-switch-input", className);
|
|
253
|
-
return /* @__PURE__ */
|
|
212
|
+
return /* @__PURE__ */ jsx8("input", { ref, className: classNames, type: "checkbox", onChange: handleChange, ...props });
|
|
254
213
|
});
|
|
255
214
|
var SwitchInput_default = SwitchInput;
|
|
256
215
|
|
|
257
216
|
// src/components/Switch/SwitchWithLabel.tsx
|
|
258
|
-
import * as
|
|
259
|
-
import { jsx as
|
|
260
|
-
var SwitchWithLabel =
|
|
217
|
+
import * as React5 from "react";
|
|
218
|
+
import { jsx as jsx9, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
219
|
+
var SwitchWithLabel = React5.memo(function SwitchWithLabel2({
|
|
261
220
|
children,
|
|
262
221
|
className,
|
|
263
222
|
disabled,
|
|
@@ -265,15 +224,15 @@ var SwitchWithLabel = React6.memo(function SwitchWithLabel2({
|
|
|
265
224
|
input
|
|
266
225
|
}) {
|
|
267
226
|
const classNames = useClassNames("charcoal-switch__label", className);
|
|
268
|
-
return /* @__PURE__ */
|
|
227
|
+
return /* @__PURE__ */ jsxs2("label", { htmlFor: id, className: classNames, "aria-disabled": disabled, children: [
|
|
269
228
|
input,
|
|
270
|
-
/* @__PURE__ */
|
|
229
|
+
/* @__PURE__ */ jsx9("div", { className: "charcoal-switch__label_div", children })
|
|
271
230
|
] });
|
|
272
231
|
});
|
|
273
232
|
|
|
274
233
|
// src/components/Switch/index.tsx
|
|
275
|
-
import { jsx as
|
|
276
|
-
var Switch =
|
|
234
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
235
|
+
var Switch = forwardRef8(function Switch2({
|
|
277
236
|
children,
|
|
278
237
|
onChange,
|
|
279
238
|
disabled,
|
|
@@ -283,23 +242,23 @@ var Switch = forwardRef9(function Switch2({
|
|
|
283
242
|
}, ref) {
|
|
284
243
|
const htmlId = useId(id);
|
|
285
244
|
const noChildren = children === void 0;
|
|
286
|
-
const input = /* @__PURE__ */
|
|
245
|
+
const input = /* @__PURE__ */ jsx10(SwitchInput_default, { ...props, disabled, className: noChildren ? className : void 0, id: htmlId, onChange, ref, role: "switch", type: "checkbox" });
|
|
287
246
|
if (noChildren) {
|
|
288
247
|
return input;
|
|
289
248
|
}
|
|
290
|
-
return /* @__PURE__ */
|
|
249
|
+
return /* @__PURE__ */ jsx10(SwitchWithLabel, { className, disabled, id: htmlId, input, children });
|
|
291
250
|
});
|
|
292
251
|
var Switch_default = memo4(Switch);
|
|
293
252
|
|
|
294
253
|
// src/components/TextField/index.tsx
|
|
295
254
|
import { useVisuallyHidden } from "@react-aria/visually-hidden";
|
|
296
255
|
import { useCallback as useCallback4, useEffect as useEffect2, useRef, useState } from "react";
|
|
297
|
-
import * as
|
|
256
|
+
import * as React7 from "react";
|
|
298
257
|
|
|
299
258
|
// src/components/FieldLabel/index.tsx
|
|
300
|
-
import * as
|
|
301
|
-
import { jsx as
|
|
302
|
-
var FieldLabel =
|
|
259
|
+
import * as React6 from "react";
|
|
260
|
+
import { jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
261
|
+
var FieldLabel = React6.forwardRef(function FieldLabel2({
|
|
303
262
|
style,
|
|
304
263
|
className,
|
|
305
264
|
label,
|
|
@@ -309,10 +268,10 @@ var FieldLabel = React7.forwardRef(function FieldLabel2({
|
|
|
309
268
|
...labelProps
|
|
310
269
|
}, ref) {
|
|
311
270
|
const classNames = useClassNames("charcoal-field-label-root", className);
|
|
312
|
-
return /* @__PURE__ */
|
|
313
|
-
/* @__PURE__ */
|
|
314
|
-
required && /* @__PURE__ */
|
|
315
|
-
/* @__PURE__ */
|
|
271
|
+
return /* @__PURE__ */ jsxs3("div", { style, className: classNames, children: [
|
|
272
|
+
/* @__PURE__ */ jsx11("label", { ref, className: "charcoal-field-label", ...labelProps, children: label }),
|
|
273
|
+
required && /* @__PURE__ */ jsx11("div", { className: "charcoal-field-label-required-text", children: requiredText }),
|
|
274
|
+
/* @__PURE__ */ jsx11("div", { className: "charcoal-field-label-sub-label", children: /* @__PURE__ */ jsx11("span", { children: subLabel }) })
|
|
316
275
|
] });
|
|
317
276
|
});
|
|
318
277
|
var FieldLabel_default = FieldLabel;
|
|
@@ -357,15 +316,15 @@ function useFocusWithClick(containerRef, inputRef) {
|
|
|
357
316
|
import { mergeRefs as mergeRefs2, useId as useId2 } from "@react-aria/utils";
|
|
358
317
|
|
|
359
318
|
// src/_lib/createDivComponent.tsx
|
|
360
|
-
import { forwardRef as
|
|
361
|
-
import { jsx as
|
|
319
|
+
import { forwardRef as forwardRef10 } from "react";
|
|
320
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
362
321
|
function createDivComponent(mainClassName) {
|
|
363
|
-
return
|
|
322
|
+
return forwardRef10(function DivComponent({
|
|
364
323
|
className,
|
|
365
324
|
...props
|
|
366
325
|
}, ref) {
|
|
367
326
|
const classNames = useClassNames(mainClassName, className);
|
|
368
|
-
return /* @__PURE__ */
|
|
327
|
+
return /* @__PURE__ */ jsx12("div", { className: classNames, ref, ...props });
|
|
369
328
|
});
|
|
370
329
|
}
|
|
371
330
|
|
|
@@ -373,8 +332,8 @@ function createDivComponent(mainClassName) {
|
|
|
373
332
|
var AssistiveText = createDivComponent("charcoal-text-field-assistive-text");
|
|
374
333
|
|
|
375
334
|
// src/components/TextField/index.tsx
|
|
376
|
-
import { jsx as
|
|
377
|
-
var TextField =
|
|
335
|
+
import { jsx as jsx13, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
336
|
+
var TextField = React7.forwardRef(function SingleLineTextFieldInner({
|
|
378
337
|
assistiveText,
|
|
379
338
|
className,
|
|
380
339
|
disabled = false,
|
|
@@ -393,7 +352,7 @@ var TextField = React8.forwardRef(function SingleLineTextFieldInner({
|
|
|
393
352
|
value,
|
|
394
353
|
getCount = countCodePointsInString,
|
|
395
354
|
...props
|
|
396
|
-
},
|
|
355
|
+
}, forwardRef23) {
|
|
397
356
|
const inputRef = useRef(null);
|
|
398
357
|
const {
|
|
399
358
|
visuallyHiddenProps
|
|
@@ -417,28 +376,28 @@ var TextField = React8.forwardRef(function SingleLineTextFieldInner({
|
|
|
417
376
|
const describedbyId = useId2();
|
|
418
377
|
const labelledbyId = useId2();
|
|
419
378
|
const showAssistiveText = assistiveText != null && assistiveText.length !== 0;
|
|
420
|
-
const classNames = useClassNames("charcoal-text-field-root");
|
|
421
|
-
return /* @__PURE__ */
|
|
422
|
-
/* @__PURE__ */
|
|
423
|
-
/* @__PURE__ */
|
|
424
|
-
prefix && /* @__PURE__ */
|
|
425
|
-
/* @__PURE__ */
|
|
426
|
-
(suffix || showCount) && /* @__PURE__ */
|
|
379
|
+
const classNames = useClassNames("charcoal-text-field-root", className);
|
|
380
|
+
return /* @__PURE__ */ jsxs4("div", { className: classNames, "aria-disabled": disabled, children: [
|
|
381
|
+
/* @__PURE__ */ jsx13(FieldLabel_default, { htmlFor: inputId, id: labelledbyId, label, required, requiredText, subLabel, ...!showLabel ? visuallyHiddenProps : {} }),
|
|
382
|
+
/* @__PURE__ */ jsxs4("div", { className: "charcoal-text-field-container", "aria-disabled": disabled === true ? true : void 0, "data-invalid": invalid === true, ref: containerRef, children: [
|
|
383
|
+
prefix && /* @__PURE__ */ jsx13("div", { className: "charcoal-text-field-prefix", children: prefix }),
|
|
384
|
+
/* @__PURE__ */ jsx13("input", { className: "charcoal-text-field-input", "aria-describedby": showAssistiveText ? describedbyId : void 0, "aria-invalid": invalid, "aria-labelledby": labelledbyId, id: inputId, "data-invalid": invalid === true, maxLength, onChange: handleChange, disabled, ref: mergeRefs2(forwardRef23, inputRef), type, value, ...props }),
|
|
385
|
+
(suffix || showCount) && /* @__PURE__ */ jsxs4("div", { className: "charcoal-text-field-suffix", children: [
|
|
427
386
|
suffix,
|
|
428
|
-
showCount && /* @__PURE__ */
|
|
387
|
+
showCount && /* @__PURE__ */ jsx13("span", { className: "charcoal-text-field-line-counter", children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
|
|
429
388
|
] })
|
|
430
389
|
] }),
|
|
431
|
-
showAssistiveText && /* @__PURE__ */
|
|
390
|
+
showAssistiveText && /* @__PURE__ */ jsx13(AssistiveText, { "data-invalid": invalid === true, id: describedbyId, children: assistiveText })
|
|
432
391
|
] });
|
|
433
392
|
});
|
|
434
393
|
var TextField_default = TextField;
|
|
435
394
|
|
|
436
395
|
// src/components/TextArea/index.tsx
|
|
437
396
|
import { useVisuallyHidden as useVisuallyHidden2 } from "@react-aria/visually-hidden";
|
|
438
|
-
import { forwardRef as
|
|
397
|
+
import { forwardRef as forwardRef12, useCallback as useCallback5, useEffect as useEffect3, useRef as useRef2, useState as useState2 } from "react";
|
|
439
398
|
import { useId as useId3 } from "@react-aria/utils";
|
|
440
|
-
import { jsx as
|
|
441
|
-
var TextArea =
|
|
399
|
+
import { jsx as jsx14, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
400
|
+
var TextArea = forwardRef12(function TextAreaInner({
|
|
442
401
|
onChange,
|
|
443
402
|
className,
|
|
444
403
|
value,
|
|
@@ -456,7 +415,7 @@ var TextArea = forwardRef13(function TextAreaInner({
|
|
|
456
415
|
invalid,
|
|
457
416
|
getCount = countCodePointsInString,
|
|
458
417
|
...props
|
|
459
|
-
},
|
|
418
|
+
}, forwardRef23) {
|
|
460
419
|
const {
|
|
461
420
|
visuallyHiddenProps
|
|
462
421
|
} = useVisuallyHidden2();
|
|
@@ -498,53 +457,50 @@ var TextArea = forwardRef13(function TextAreaInner({
|
|
|
498
457
|
const labelledbyId = useId3();
|
|
499
458
|
const classNames = useClassNames("charcoal-text-area-root", className);
|
|
500
459
|
const showAssistiveText = assistiveText != null && assistiveText.length !== 0;
|
|
501
|
-
return /* @__PURE__ */
|
|
502
|
-
/* @__PURE__ */
|
|
503
|
-
/* @__PURE__ */
|
|
460
|
+
return /* @__PURE__ */ jsxs5("div", { className: classNames, "aria-disabled": disabled, children: [
|
|
461
|
+
/* @__PURE__ */ jsx14(FieldLabel_default, { htmlFor: textAreaId, id: labelledbyId, label, required, requiredText, subLabel, ...!showLabel ? visuallyHiddenProps : {} }),
|
|
462
|
+
/* @__PURE__ */ jsxs5("div", { className: "charcoal-text-area-container", "aria-disabled": disabled === true ? "true" : void 0, "aria-invalid": invalid === true, ref: containerRef, style: {
|
|
504
463
|
"--charcoal-text-area-rows": `${showCount ? rows + 1 : rows}`
|
|
505
464
|
}, children: [
|
|
506
|
-
/* @__PURE__ */
|
|
507
|
-
showCount && /* @__PURE__ */
|
|
465
|
+
/* @__PURE__ */ jsx14("textarea", { className: "charcoal-text-area-textarea", "aria-describedby": showAssistiveText ? describedbyId : void 0, "aria-invalid": invalid, "aria-labelledby": labelledbyId, id: textAreaId, maxLength, "data-no-bottom-padding": showCount, onChange: handleChange, ref: mergeRefs(forwardRef23, textareaRef), rows, value, disabled, ...props }),
|
|
466
|
+
showCount && /* @__PURE__ */ jsx14("span", { className: "charcoal-text-area-counter", children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
|
|
508
467
|
] }),
|
|
509
|
-
showAssistiveText && /* @__PURE__ */
|
|
468
|
+
showAssistiveText && /* @__PURE__ */ jsx14(AssistiveText, { "data-invalid": invalid === true, id: describedbyId, children: assistiveText })
|
|
510
469
|
] });
|
|
511
470
|
});
|
|
512
471
|
var TextArea_default = TextArea;
|
|
513
472
|
|
|
514
473
|
// src/components/Icon/index.tsx
|
|
515
|
-
import * as
|
|
474
|
+
import * as React8 from "react";
|
|
516
475
|
import "@charcoal-ui/icons";
|
|
517
|
-
import { jsx as
|
|
518
|
-
var Icon =
|
|
476
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
477
|
+
var Icon = React8.forwardRef(function IconInner({
|
|
519
478
|
name,
|
|
520
479
|
scale,
|
|
521
480
|
unsafeNonGuidelineScale,
|
|
522
481
|
className,
|
|
523
482
|
...rest
|
|
524
483
|
}, ref) {
|
|
525
|
-
return /* @__PURE__ */
|
|
484
|
+
return /* @__PURE__ */ jsx15("pixiv-icon", { ref, name, scale, "unsafe-non-guideline-scale": unsafeNonGuidelineScale, class: className, ...rest });
|
|
526
485
|
});
|
|
527
486
|
var Icon_default = Icon;
|
|
528
487
|
|
|
529
488
|
// src/components/Modal/index.tsx
|
|
530
|
-
import { useContext as
|
|
531
|
-
import * as
|
|
489
|
+
import { useContext as useContext2, forwardRef as forwardRef15, memo as memo5 } from "react";
|
|
490
|
+
import * as React12 from "react";
|
|
532
491
|
import { Overlay } from "@react-aria/overlays";
|
|
533
|
-
import { useTheme } from "styled-components";
|
|
534
|
-
import { maxWidth } from "@charcoal-ui/utils";
|
|
535
|
-
import { useMedia } from "@charcoal-ui/styled";
|
|
536
492
|
import { animated, useTransition, easings } from "react-spring";
|
|
537
493
|
import { useObjectRef } from "@react-aria/utils";
|
|
538
494
|
|
|
539
495
|
// src/components/Modal/Dialog/index.tsx
|
|
540
|
-
import { forwardRef as
|
|
496
|
+
import { forwardRef as forwardRef14 } from "react";
|
|
541
497
|
import { useDialog } from "@react-aria/dialog";
|
|
542
498
|
|
|
543
499
|
// src/_lib/useForwardedRef.tsx
|
|
544
|
-
import * as
|
|
500
|
+
import * as React9 from "react";
|
|
545
501
|
function useForwardedRef(ref) {
|
|
546
|
-
const innerRef =
|
|
547
|
-
|
|
502
|
+
const innerRef = React9.useRef(null);
|
|
503
|
+
React9.useEffect(() => {
|
|
548
504
|
if (!ref)
|
|
549
505
|
return;
|
|
550
506
|
if (typeof ref === "function") {
|
|
@@ -557,30 +513,29 @@ function useForwardedRef(ref) {
|
|
|
557
513
|
}
|
|
558
514
|
|
|
559
515
|
// src/components/Modal/Dialog/index.tsx
|
|
560
|
-
import { jsx as
|
|
561
|
-
var Dialog =
|
|
516
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
517
|
+
var Dialog = forwardRef14(function Dialog2({
|
|
562
518
|
size,
|
|
563
519
|
bottomSheet,
|
|
564
|
-
css,
|
|
565
520
|
className,
|
|
566
521
|
...props
|
|
567
|
-
},
|
|
568
|
-
const ref = useForwardedRef(
|
|
522
|
+
}, forwardRef23) {
|
|
523
|
+
const ref = useForwardedRef(forwardRef23);
|
|
569
524
|
const {
|
|
570
525
|
dialogProps
|
|
571
526
|
} = useDialog({
|
|
572
527
|
role: "dialog"
|
|
573
528
|
}, ref);
|
|
574
529
|
const classNames = useClassNames("charcoal-modal-dialog", className);
|
|
575
|
-
return /* @__PURE__ */
|
|
530
|
+
return /* @__PURE__ */ jsx16("div", { className: classNames, role: dialogProps.role, "data-bottom-sheet": bottomSheet, tabIndex: dialogProps.tabIndex, "aria-labelledby": dialogProps["aria-labelledby"], onBlur: dialogProps.onBlur, "data-size": size, ref, ...props });
|
|
576
531
|
});
|
|
577
532
|
|
|
578
533
|
// src/components/Modal/ModalBackgroundContext.tsx
|
|
579
|
-
import * as
|
|
580
|
-
var ModalBackgroundContext =
|
|
534
|
+
import * as React10 from "react";
|
|
535
|
+
var ModalBackgroundContext = React10.createContext(null);
|
|
581
536
|
|
|
582
537
|
// src/components/Modal/useCustomModalOverlay.tsx
|
|
583
|
-
import * as
|
|
538
|
+
import * as React11 from "react";
|
|
584
539
|
import { ariaHideOutside, useOverlay, useOverlayFocusContain } from "@react-aria/overlays";
|
|
585
540
|
|
|
586
541
|
// src/components/DropdownSelector/Popover/usePreventScroll.tsx
|
|
@@ -613,7 +568,7 @@ function useCharcoalModalOverlay(props, state, ref) {
|
|
|
613
568
|
}, ref);
|
|
614
569
|
usePreventScroll(typeof document !== "undefined" ? document.body : null, state.isOpen);
|
|
615
570
|
useOverlayFocusContain();
|
|
616
|
-
|
|
571
|
+
React11.useEffect(() => {
|
|
617
572
|
if (state.isOpen && ref.current) {
|
|
618
573
|
return ariaHideOutside([ref.current]);
|
|
619
574
|
}
|
|
@@ -623,11 +578,27 @@ function useCharcoalModalOverlay(props, state, ref) {
|
|
|
623
578
|
underlayProps
|
|
624
579
|
};
|
|
625
580
|
}
|
|
581
|
+
function isWindowDefined() {
|
|
582
|
+
return typeof window !== "undefined";
|
|
583
|
+
}
|
|
584
|
+
function useWindowWidth() {
|
|
585
|
+
const [width, setWidth] = React11.useState(isWindowDefined() ? window.innerWidth : null);
|
|
586
|
+
React11.useEffect(() => {
|
|
587
|
+
const handleResize = () => {
|
|
588
|
+
setWidth(window.innerWidth);
|
|
589
|
+
};
|
|
590
|
+
window.addEventListener("resize", handleResize);
|
|
591
|
+
return () => {
|
|
592
|
+
window.removeEventListener("resize", handleResize);
|
|
593
|
+
};
|
|
594
|
+
});
|
|
595
|
+
return width;
|
|
596
|
+
}
|
|
626
597
|
|
|
627
598
|
// src/components/Modal/index.tsx
|
|
628
|
-
import { jsx as
|
|
599
|
+
import { jsx as jsx17, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
629
600
|
var DEFAULT_Z_INDEX = 10;
|
|
630
|
-
var Modal =
|
|
601
|
+
var Modal = forwardRef15(function ModalInner({
|
|
631
602
|
children,
|
|
632
603
|
zIndex = DEFAULT_Z_INDEX,
|
|
633
604
|
portalContainer,
|
|
@@ -654,8 +625,7 @@ var Modal = forwardRef16(function ModalInner({
|
|
|
654
625
|
onClose,
|
|
655
626
|
isOpen
|
|
656
627
|
}, ref);
|
|
657
|
-
const
|
|
658
|
-
const isMobile = useMedia(maxWidth(theme.breakpoint.screen1)) ?? false;
|
|
628
|
+
const isMobile = (useWindowWidth() ?? Infinity) < 744;
|
|
659
629
|
const transitionEnabled = isMobile && bottomSheet !== false;
|
|
660
630
|
const showDismiss = !isMobile || bottomSheet !== true;
|
|
661
631
|
const transition = useTransition(isOpen, {
|
|
@@ -683,8 +653,8 @@ var Modal = forwardRef16(function ModalInner({
|
|
|
683
653
|
duration: 0
|
|
684
654
|
}
|
|
685
655
|
});
|
|
686
|
-
const bgRef =
|
|
687
|
-
const handleClick =
|
|
656
|
+
const bgRef = React12.useRef(null);
|
|
657
|
+
const handleClick = React12.useCallback((e) => {
|
|
688
658
|
if (e.currentTarget === e.target) {
|
|
689
659
|
onClose();
|
|
690
660
|
}
|
|
@@ -693,15 +663,15 @@ var Modal = forwardRef16(function ModalInner({
|
|
|
693
663
|
backgroundColor,
|
|
694
664
|
overflow,
|
|
695
665
|
transform
|
|
696
|
-
}, item) => item && /* @__PURE__ */
|
|
666
|
+
}, item) => item && /* @__PURE__ */ jsx17(Overlay, { portalContainer, children: /* @__PURE__ */ jsx17(animated.div, { className: "charcoal-modal-background", ref: bgRef, ...underlayProps, style: transitionEnabled ? {
|
|
697
667
|
backgroundColor,
|
|
698
668
|
overflow,
|
|
699
669
|
zIndex
|
|
700
670
|
} : {
|
|
701
671
|
zIndex
|
|
702
|
-
}, "data-bottom-sheet": bottomSheet, onClick: handleClick, children: /* @__PURE__ */
|
|
672
|
+
}, "data-bottom-sheet": bottomSheet, onClick: handleClick, children: /* @__PURE__ */ jsx17(ModalBackgroundContext.Provider, { value: bgRef.current, children: /* @__PURE__ */ jsx17(AnimatedDialog, { ref, ...modalProps, style: transitionEnabled ? {
|
|
703
673
|
transform
|
|
704
|
-
} : {}, size, bottomSheet, className, children: /* @__PURE__ */
|
|
674
|
+
} : {}, size, bottomSheet, className, children: /* @__PURE__ */ jsxs6(ModalContext.Provider, { value: {
|
|
705
675
|
titleProps: {},
|
|
706
676
|
title,
|
|
707
677
|
close: onClose,
|
|
@@ -709,12 +679,12 @@ var Modal = forwardRef16(function ModalInner({
|
|
|
709
679
|
bottomSheet
|
|
710
680
|
}, children: [
|
|
711
681
|
children,
|
|
712
|
-
isDismissable === true && /* @__PURE__ */
|
|
682
|
+
isDismissable === true && /* @__PURE__ */ jsx17(ModalCloseButton, { "aria-label": closeButtonAriaLabel, onClick: onClose })
|
|
713
683
|
] }) }) }) }) }));
|
|
714
684
|
});
|
|
715
685
|
var AnimatedDialog = animated(Dialog);
|
|
716
686
|
var Modal_default = memo5(Modal);
|
|
717
|
-
var ModalContext =
|
|
687
|
+
var ModalContext = React12.createContext({
|
|
718
688
|
titleProps: {},
|
|
719
689
|
title: "",
|
|
720
690
|
close: void 0,
|
|
@@ -722,37 +692,37 @@ var ModalContext = React13.createContext({
|
|
|
722
692
|
bottomSheet: false
|
|
723
693
|
});
|
|
724
694
|
function ModalCloseButton(props) {
|
|
725
|
-
return /* @__PURE__ */
|
|
695
|
+
return /* @__PURE__ */ jsx17(IconButton_default, { className: "charcoal-modal-close-button", size: "S", icon: "24/Close", type: "button", ...props });
|
|
726
696
|
}
|
|
727
697
|
|
|
728
698
|
// src/components/Modal/ModalPlumbing.tsx
|
|
729
|
-
import { useContext as
|
|
730
|
-
import { jsx as
|
|
699
|
+
import { useContext as useContext3 } from "react";
|
|
700
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
731
701
|
function ModalHeader() {
|
|
732
|
-
const modalCtx =
|
|
733
|
-
return /* @__PURE__ */
|
|
702
|
+
const modalCtx = useContext3(ModalContext);
|
|
703
|
+
return /* @__PURE__ */ jsx18("div", { className: "charcoal-modal-header-root", "data-bottom-sheet": modalCtx.bottomSheet, children: /* @__PURE__ */ jsx18("div", { className: "charcoal-modal-header-title", children: modalCtx.title }) });
|
|
734
704
|
}
|
|
735
705
|
var ModalAlign = createDivComponent("charcoal-modal-align");
|
|
736
706
|
var ModalBody = createDivComponent("charcoal-modal-body");
|
|
737
707
|
var ModalButtons = createDivComponent("charcoal-modal-buttons");
|
|
738
708
|
|
|
739
709
|
// src/components/LoadingSpinner/index.tsx
|
|
740
|
-
import { forwardRef as
|
|
741
|
-
import { jsx as
|
|
742
|
-
var LoadingSpinner =
|
|
710
|
+
import { forwardRef as forwardRef16, useImperativeHandle, useRef as useRef5, memo as memo6 } from "react";
|
|
711
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
712
|
+
var LoadingSpinner = forwardRef16(function LoadingSpinnerInner({
|
|
743
713
|
size = 48,
|
|
744
714
|
padding = 16,
|
|
745
715
|
transparent = false,
|
|
746
716
|
...props
|
|
747
717
|
}, ref) {
|
|
748
718
|
const classNames = useClassNames("charcoal-loading-spinner", props.className);
|
|
749
|
-
return /* @__PURE__ */
|
|
719
|
+
return /* @__PURE__ */ jsx19("div", { role: "progressbar", style: {
|
|
750
720
|
"--charcoal-loading-spinner-size": `${size}px`,
|
|
751
721
|
"--charcoal-loading-spinner-padding": `${padding}px`
|
|
752
|
-
}, "data-transparent": transparent, className: classNames, ref, children: /* @__PURE__ */
|
|
722
|
+
}, "data-transparent": transparent, className: classNames, ref, children: /* @__PURE__ */ jsx19(LoadingSpinnerIcon, {}) });
|
|
753
723
|
});
|
|
754
724
|
var LoadingSpinner_default = memo6(LoadingSpinner);
|
|
755
|
-
var LoadingSpinnerIcon =
|
|
725
|
+
var LoadingSpinnerIcon = forwardRef16(function LoadingSpinnerIcon2({
|
|
756
726
|
once = false
|
|
757
727
|
}, ref) {
|
|
758
728
|
const iconRef = useRef5(null);
|
|
@@ -766,19 +736,19 @@ var LoadingSpinnerIcon = forwardRef17(function LoadingSpinnerIcon2({
|
|
|
766
736
|
delete iconRef.current.dataset.resetAnimation;
|
|
767
737
|
}
|
|
768
738
|
}));
|
|
769
|
-
return /* @__PURE__ */
|
|
739
|
+
return /* @__PURE__ */ jsx19("div", { role: "presentation", ref: iconRef, "data-once": once, className: "charcoal-loading-spinner-icon" });
|
|
770
740
|
});
|
|
771
741
|
|
|
772
742
|
// src/components/DropdownSelector/index.tsx
|
|
773
|
-
import { useState as
|
|
743
|
+
import { useState as useState4, useRef as useRef9, useMemo as useMemo7, useCallback as useCallback7 } from "react";
|
|
774
744
|
|
|
775
745
|
// src/components/DropdownSelector/DropdownPopover.tsx
|
|
776
746
|
import { useEffect as useEffect7, useRef as useRef7 } from "react";
|
|
777
747
|
|
|
778
748
|
// src/components/DropdownSelector/Popover/index.tsx
|
|
779
|
-
import { useContext as
|
|
749
|
+
import { useContext as useContext4, useRef as useRef6 } from "react";
|
|
780
750
|
import { DismissButton, Overlay as Overlay2, usePopover } from "@react-aria/overlays";
|
|
781
|
-
import { jsx as
|
|
751
|
+
import { jsx as jsx20, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
782
752
|
var _empty = () => null;
|
|
783
753
|
function Popover(props) {
|
|
784
754
|
const defaultPopoverRef = useRef6(null);
|
|
@@ -797,28 +767,28 @@ function Popover(props) {
|
|
|
797
767
|
setOpen: _empty,
|
|
798
768
|
toggle: _empty
|
|
799
769
|
});
|
|
800
|
-
const modalBackground =
|
|
770
|
+
const modalBackground = useContext4(ModalBackgroundContext);
|
|
801
771
|
usePreventScroll(modalBackground, props.isOpen);
|
|
802
772
|
if (!props.isOpen)
|
|
803
773
|
return null;
|
|
804
|
-
return /* @__PURE__ */
|
|
805
|
-
/* @__PURE__ */
|
|
774
|
+
return /* @__PURE__ */ jsxs7(Overlay2, { portalContainer: document.body, children: [
|
|
775
|
+
/* @__PURE__ */ jsx20("div", { ...underlayProps, style: {
|
|
806
776
|
position: "fixed",
|
|
807
777
|
zIndex: typeof popoverProps.style?.zIndex === "number" ? popoverProps.style.zIndex - 1 : 99999,
|
|
808
778
|
inset: 0
|
|
809
779
|
} }),
|
|
810
|
-
/* @__PURE__ */
|
|
811
|
-
/* @__PURE__ */
|
|
812
|
-
/* @__PURE__ */
|
|
780
|
+
/* @__PURE__ */ jsxs7("div", { ...popoverProps, ref: finalPopoverRef, className: "charcoal-popover", children: [
|
|
781
|
+
/* @__PURE__ */ jsx20(DismissButton, { onDismiss: () => props.onClose() }),
|
|
782
|
+
/* @__PURE__ */ jsx20("div", { tabIndex: 0, onFocus: props.onClose }),
|
|
813
783
|
props.children,
|
|
814
|
-
/* @__PURE__ */
|
|
815
|
-
/* @__PURE__ */
|
|
784
|
+
/* @__PURE__ */ jsx20("div", { tabIndex: 0, onFocus: props.onClose }),
|
|
785
|
+
/* @__PURE__ */ jsx20(DismissButton, { onDismiss: () => props.onClose() })
|
|
816
786
|
] })
|
|
817
787
|
] });
|
|
818
788
|
}
|
|
819
789
|
|
|
820
790
|
// src/components/DropdownSelector/DropdownPopover.tsx
|
|
821
|
-
import { jsx as
|
|
791
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
822
792
|
function DropdownPopover({
|
|
823
793
|
children,
|
|
824
794
|
...props
|
|
@@ -845,16 +815,16 @@ function DropdownPopover({
|
|
|
845
815
|
}
|
|
846
816
|
}
|
|
847
817
|
}, [props.value, props.isOpen]);
|
|
848
|
-
return /* @__PURE__ */
|
|
818
|
+
return /* @__PURE__ */ jsx21(Popover, { isOpen: props.isOpen, onClose: props.onClose, popoverRef: ref, triggerRef: props.triggerRef, children });
|
|
849
819
|
}
|
|
850
820
|
|
|
851
821
|
// src/components/DropdownSelector/utils/findPreviewRecursive.tsx
|
|
852
|
-
import * as
|
|
822
|
+
import * as React13 from "react";
|
|
853
823
|
function findPreviewRecursive(children, value) {
|
|
854
|
-
const childArray =
|
|
824
|
+
const childArray = React13.Children.toArray(children);
|
|
855
825
|
for (let i = 0; i < childArray.length; i++) {
|
|
856
826
|
const child = childArray[i];
|
|
857
|
-
if (
|
|
827
|
+
if (React13.isValidElement(child)) {
|
|
858
828
|
if ("value" in child.props) {
|
|
859
829
|
const childValue = child.props.value;
|
|
860
830
|
if (childValue === value && "children" in child.props) {
|
|
@@ -876,8 +846,8 @@ function findPreviewRecursive(children, value) {
|
|
|
876
846
|
import { useMemo as useMemo6, useRef as useRef8 } from "react";
|
|
877
847
|
|
|
878
848
|
// src/components/DropdownSelector/MenuList/MenuListContext.ts
|
|
879
|
-
import { createContext as
|
|
880
|
-
var MenuListContext =
|
|
849
|
+
import { createContext as createContext4 } from "react";
|
|
850
|
+
var MenuListContext = createContext4({
|
|
881
851
|
root: void 0,
|
|
882
852
|
value: "",
|
|
883
853
|
propsArray: [],
|
|
@@ -886,13 +856,13 @@ var MenuListContext = createContext5({
|
|
|
886
856
|
});
|
|
887
857
|
|
|
888
858
|
// src/components/DropdownSelector/MenuList/internals/getValuesRecursive.tsx
|
|
889
|
-
import * as
|
|
859
|
+
import * as React14 from "react";
|
|
890
860
|
function getValuesRecursive(children) {
|
|
891
|
-
const childArray =
|
|
861
|
+
const childArray = React14.Children.toArray(children);
|
|
892
862
|
const propsArray = [];
|
|
893
863
|
for (let i = 0; i < childArray.length; i++) {
|
|
894
864
|
const child = childArray[i];
|
|
895
|
-
if (
|
|
865
|
+
if (React14.isValidElement(child)) {
|
|
896
866
|
const props = child.props;
|
|
897
867
|
if ("value" in props && typeof props.value === "string") {
|
|
898
868
|
propsArray.push({
|
|
@@ -909,11 +879,11 @@ function getValuesRecursive(children) {
|
|
|
909
879
|
}
|
|
910
880
|
|
|
911
881
|
// src/components/DropdownSelector/MenuList/index.tsx
|
|
912
|
-
import { jsx as
|
|
882
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
913
883
|
function MenuList(props) {
|
|
914
884
|
const root = useRef8(null);
|
|
915
885
|
const propsArray = useMemo6(() => getValuesRecursive(props.children), [props.children]);
|
|
916
|
-
return /* @__PURE__ */
|
|
886
|
+
return /* @__PURE__ */ jsx22("ul", { className: "charcoal-menu-list", ref: root, children: /* @__PURE__ */ jsx22(MenuListContext.Provider, { value: {
|
|
917
887
|
value: props.value ?? "",
|
|
918
888
|
root,
|
|
919
889
|
propsArray,
|
|
@@ -926,14 +896,14 @@ function MenuList(props) {
|
|
|
926
896
|
// src/components/DropdownSelector/index.tsx
|
|
927
897
|
import { useVisuallyHidden as useVisuallyHidden3 } from "@react-aria/visually-hidden";
|
|
928
898
|
import { useId as useId4 } from "@react-aria/utils";
|
|
929
|
-
import { jsx as
|
|
899
|
+
import { jsx as jsx23, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
930
900
|
function DropdownSelector({
|
|
931
901
|
onChange,
|
|
932
902
|
showLabel = false,
|
|
933
903
|
...props
|
|
934
904
|
}) {
|
|
935
905
|
const triggerRef = useRef9(null);
|
|
936
|
-
const [isOpen, setIsOpen] =
|
|
906
|
+
const [isOpen, setIsOpen] = useState4(false);
|
|
937
907
|
const preview = findPreviewRecursive(props.children, props.value);
|
|
938
908
|
const isPlaceholder = useMemo7(() => props.placeholder !== void 0 && preview === void 0, [preview, props.placeholder]);
|
|
939
909
|
const propsArray = getValuesRecursive(props.children);
|
|
@@ -946,46 +916,46 @@ function DropdownSelector({
|
|
|
946
916
|
const labelId = useId4();
|
|
947
917
|
const describedbyId = useId4();
|
|
948
918
|
const classNames = useClassNames("charcoal-dropdown-selector-root", props.className);
|
|
949
|
-
return /* @__PURE__ */
|
|
950
|
-
/* @__PURE__ */
|
|
951
|
-
/* @__PURE__ */
|
|
952
|
-
return /* @__PURE__ */
|
|
919
|
+
return /* @__PURE__ */ jsxs8("div", { className: classNames, "aria-disabled": props.disabled, children: [
|
|
920
|
+
/* @__PURE__ */ jsx23(FieldLabel_default, { id: labelId, label: props.label, required: props.required, requiredText: props.requiredText, subLabel: props.subLabel, ...!showLabel ? visuallyHiddenProps : {} }),
|
|
921
|
+
/* @__PURE__ */ jsx23("div", { ...visuallyHiddenProps, "aria-hidden": "true", children: /* @__PURE__ */ jsx23("select", { name: props.name, value: props.value, onChange: handleChange, tabIndex: -1, children: propsArray.map((itemProps) => {
|
|
922
|
+
return /* @__PURE__ */ jsx23("option", { value: itemProps.value, disabled: itemProps.disabled, children: itemProps.value }, itemProps.value);
|
|
953
923
|
}) }) }),
|
|
954
|
-
/* @__PURE__ */
|
|
924
|
+
/* @__PURE__ */ jsxs8("button", { className: "charcoal-dropdown-selector-button", "aria-labelledby": labelId, "aria-invalid": props.invalid, "aria-describedby": props.assistiveText !== void 0 ? describedbyId : void 0, disabled: props.disabled, onClick: () => {
|
|
955
925
|
if (props.disabled === true)
|
|
956
926
|
return;
|
|
957
927
|
setIsOpen(true);
|
|
958
928
|
}, ref: triggerRef, type: "button", "data-active": isOpen, children: [
|
|
959
|
-
/* @__PURE__ */
|
|
960
|
-
/* @__PURE__ */
|
|
929
|
+
/* @__PURE__ */ jsx23("span", { className: "charcoal-ui-dropdown-selector-text", "data-placeholder": isPlaceholder, children: isPlaceholder ? props.placeholder : preview }),
|
|
930
|
+
/* @__PURE__ */ jsx23(Icon_default, { className: "charcoal-ui-dropdown-selector-icon", name: "16/Menu" })
|
|
961
931
|
] }),
|
|
962
|
-
isOpen && /* @__PURE__ */
|
|
932
|
+
isOpen && /* @__PURE__ */ jsx23(DropdownPopover, { isOpen, onClose: () => setIsOpen(false), triggerRef, value: props.value, children: /* @__PURE__ */ jsx23(MenuList, { value: props.value, onChange: (v) => {
|
|
963
933
|
onChange(v);
|
|
964
934
|
setIsOpen(false);
|
|
965
935
|
}, children: props.children }) }),
|
|
966
|
-
props.assistiveText !== void 0 && /* @__PURE__ */
|
|
936
|
+
props.assistiveText !== void 0 && /* @__PURE__ */ jsx23(AssistiveText, { "data-invalid": props.invalid === true, id: describedbyId, children: props.assistiveText })
|
|
967
937
|
] });
|
|
968
938
|
}
|
|
969
939
|
|
|
970
940
|
// src/components/DropdownSelector/MenuItem/index.tsx
|
|
971
|
-
import { forwardRef as
|
|
941
|
+
import { forwardRef as forwardRef18 } from "react";
|
|
972
942
|
|
|
973
943
|
// src/components/DropdownSelector/ListItem/index.tsx
|
|
974
|
-
import { forwardRef as
|
|
975
|
-
import { jsx as
|
|
976
|
-
var ListItem =
|
|
944
|
+
import { forwardRef as forwardRef17, useMemo as useMemo8 } from "react";
|
|
945
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
946
|
+
var ListItem = forwardRef17(function ListItem2({
|
|
977
947
|
as,
|
|
978
948
|
className,
|
|
979
949
|
...props
|
|
980
950
|
}, ref) {
|
|
981
951
|
const Component = useMemo8(() => as ?? "li", [as]);
|
|
982
952
|
const classNames = useClassNames("charcoal-list-item", className);
|
|
983
|
-
return /* @__PURE__ */
|
|
953
|
+
return /* @__PURE__ */ jsx24(Component, { className: classNames, ref, ...props });
|
|
984
954
|
});
|
|
985
955
|
var ListItem_default = ListItem;
|
|
986
956
|
|
|
987
957
|
// src/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.tsx
|
|
988
|
-
import { useCallback as useCallback8, useContext as
|
|
958
|
+
import { useCallback as useCallback8, useContext as useContext5 } from "react";
|
|
989
959
|
|
|
990
960
|
// src/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.tsx
|
|
991
961
|
function handleFocusByKeyBoard(element, parent) {
|
|
@@ -1022,7 +992,7 @@ function useMenuItemHandleKeyDown(value) {
|
|
|
1022
992
|
setValue,
|
|
1023
993
|
root,
|
|
1024
994
|
propsArray
|
|
1025
|
-
} =
|
|
995
|
+
} = useContext5(MenuListContext);
|
|
1026
996
|
const setContextValue = useCallback8(() => {
|
|
1027
997
|
if (value !== void 0)
|
|
1028
998
|
setValue(value);
|
|
@@ -1062,70 +1032,70 @@ function useMenuItemHandleKeyDown(value) {
|
|
|
1062
1032
|
}
|
|
1063
1033
|
|
|
1064
1034
|
// src/components/DropdownSelector/MenuItem/index.tsx
|
|
1065
|
-
import { jsx as
|
|
1066
|
-
var MenuItem =
|
|
1035
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
1036
|
+
var MenuItem = forwardRef18(function MenuItem2({
|
|
1067
1037
|
className,
|
|
1068
1038
|
value,
|
|
1069
1039
|
disabled,
|
|
1070
1040
|
...props
|
|
1071
1041
|
}, ref) {
|
|
1072
1042
|
const [handleKeyDown, setContextValue] = useMenuItemHandleKeyDown(value);
|
|
1073
|
-
return /* @__PURE__ */
|
|
1043
|
+
return /* @__PURE__ */ jsx25(ListItem_default, { ...props, ref, "data-key": value, onKeyDown: handleKeyDown, onClick: disabled === true ? void 0 : setContextValue, tabIndex: -1, "aria-disabled": disabled, role: "option", children: props.children });
|
|
1074
1044
|
});
|
|
1075
1045
|
var MenuItem_default = MenuItem;
|
|
1076
1046
|
|
|
1077
1047
|
// src/components/DropdownSelector/DropdownMenuItem/index.tsx
|
|
1078
|
-
import { useContext as
|
|
1079
|
-
import { jsx as
|
|
1048
|
+
import { useContext as useContext6 } from "react";
|
|
1049
|
+
import { jsx as jsx26, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1080
1050
|
function DropdownMenuItem(props) {
|
|
1081
1051
|
const {
|
|
1082
1052
|
value: ctxValue
|
|
1083
|
-
} =
|
|
1053
|
+
} = useContext6(MenuListContext);
|
|
1084
1054
|
const isSelected = props.value === ctxValue;
|
|
1085
1055
|
const {
|
|
1086
1056
|
children,
|
|
1087
1057
|
...rest
|
|
1088
1058
|
} = props;
|
|
1089
|
-
return /* @__PURE__ */
|
|
1090
|
-
isSelected && /* @__PURE__ */
|
|
1091
|
-
/* @__PURE__ */
|
|
1059
|
+
return /* @__PURE__ */ jsxs9(MenuItem_default, { ...rest, "aria-selected": isSelected, children: [
|
|
1060
|
+
isSelected && /* @__PURE__ */ jsx26(Icon_default, { className: "charcoal-dropdown-selector-menu-item-icon", name: "16/Check" }),
|
|
1061
|
+
/* @__PURE__ */ jsx26("span", { className: "charcoal-dropdown-selector-menu-item", "data-selected": isSelected, children: props.children })
|
|
1092
1062
|
] });
|
|
1093
1063
|
}
|
|
1094
1064
|
|
|
1095
1065
|
// src/components/DropdownSelector/MenuItemGroup/index.tsx
|
|
1096
|
-
import { jsx as
|
|
1066
|
+
import { jsx as jsx27, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1097
1067
|
function MenuItemGroup(props) {
|
|
1098
|
-
return /* @__PURE__ */
|
|
1099
|
-
/* @__PURE__ */
|
|
1100
|
-
/* @__PURE__ */
|
|
1068
|
+
return /* @__PURE__ */ jsxs10("li", { className: "charcoal-menu-item-group", role: "presentation", children: [
|
|
1069
|
+
/* @__PURE__ */ jsx27("span", { children: props.text }),
|
|
1070
|
+
/* @__PURE__ */ jsx27("ul", { role: "group", children: props.children })
|
|
1101
1071
|
] });
|
|
1102
1072
|
}
|
|
1103
1073
|
|
|
1104
1074
|
// src/components/SegmentedControl/index.tsx
|
|
1105
|
-
import { forwardRef as
|
|
1075
|
+
import { forwardRef as forwardRef19, memo as memo7, useMemo as useMemo9, useRef as useRef10 } from "react";
|
|
1106
1076
|
import { useRadioGroupState } from "@react-stately/radio";
|
|
1107
1077
|
import { useRadio, useRadioGroup } from "@react-aria/radio";
|
|
1108
1078
|
|
|
1109
1079
|
// src/components/SegmentedControl/RadioGroupContext.tsx
|
|
1110
|
-
import { createContext as
|
|
1111
|
-
import { jsx as
|
|
1112
|
-
var RadioContext =
|
|
1080
|
+
import { createContext as createContext5, useContext as useContext7 } from "react";
|
|
1081
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
1082
|
+
var RadioContext = createContext5(null);
|
|
1113
1083
|
var RadioProvider = ({
|
|
1114
1084
|
value,
|
|
1115
1085
|
children
|
|
1116
1086
|
}) => {
|
|
1117
|
-
return /* @__PURE__ */
|
|
1087
|
+
return /* @__PURE__ */ jsx28(RadioContext.Provider, { value, children });
|
|
1118
1088
|
};
|
|
1119
1089
|
var useRadioContext = () => {
|
|
1120
|
-
const state =
|
|
1090
|
+
const state = useContext7(RadioContext);
|
|
1121
1091
|
if (state === null)
|
|
1122
1092
|
throw new Error("`<RadioProvider>` is not likely mounted.");
|
|
1123
1093
|
return state;
|
|
1124
1094
|
};
|
|
1125
1095
|
|
|
1126
1096
|
// src/components/SegmentedControl/index.tsx
|
|
1127
|
-
import { jsx as
|
|
1128
|
-
var SegmentedControl =
|
|
1097
|
+
import { jsx as jsx29, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1098
|
+
var SegmentedControl = forwardRef19(function SegmentedControlInner(props, ref) {
|
|
1129
1099
|
const className = useClassNames("charcoal-segmented-control", props.className);
|
|
1130
1100
|
const ariaRadioGroupProps = useMemo9(() => ({
|
|
1131
1101
|
...props,
|
|
@@ -1144,7 +1114,7 @@ var SegmentedControl = forwardRef20(function SegmentedControlInner(props, ref) {
|
|
|
1144
1114
|
label: d
|
|
1145
1115
|
} : d);
|
|
1146
1116
|
}, [props.data]);
|
|
1147
|
-
return /* @__PURE__ */
|
|
1117
|
+
return /* @__PURE__ */ jsx29("div", { ref, ...radioGroupProps, className, children: /* @__PURE__ */ jsx29(RadioProvider, { value: state, children: segmentedControlItems.map((item) => /* @__PURE__ */ jsx29(Segmented, { value: item.value, disabled: item.disabled, children: item.label }, item.value)) }) });
|
|
1148
1118
|
});
|
|
1149
1119
|
var SegmentedControl_default = memo7(SegmentedControl);
|
|
1150
1120
|
var Segmented = (props) => {
|
|
@@ -1160,20 +1130,20 @@ var Segmented = (props) => {
|
|
|
1160
1130
|
isDisabled,
|
|
1161
1131
|
isSelected
|
|
1162
1132
|
} = useRadio(ariaRadioProps, state, ref);
|
|
1163
|
-
return /* @__PURE__ */
|
|
1164
|
-
/* @__PURE__ */
|
|
1133
|
+
return /* @__PURE__ */ jsxs11("label", { className: "charcoal-segmented-control-radio__label", "aria-disabled": isDisabled || state.isReadOnly, "data-checked": isSelected, children: [
|
|
1134
|
+
/* @__PURE__ */ jsx29("input", { className: "charcoal-segmented-control-radio__input", ...inputProps, ref }),
|
|
1165
1135
|
props.children
|
|
1166
1136
|
] });
|
|
1167
1137
|
};
|
|
1168
1138
|
|
|
1169
1139
|
// src/components/Checkbox/index.tsx
|
|
1170
|
-
import { forwardRef as
|
|
1140
|
+
import { forwardRef as forwardRef21, memo as memo9 } from "react";
|
|
1171
1141
|
import { useId as useId5 } from "@react-aria/utils";
|
|
1172
1142
|
|
|
1173
1143
|
// src/components/Checkbox/CheckboxInput/index.tsx
|
|
1174
|
-
import { forwardRef as
|
|
1175
|
-
import { jsx as
|
|
1176
|
-
var CheckboxInput =
|
|
1144
|
+
import { forwardRef as forwardRef20, memo as memo8, useCallback as useCallback9 } from "react";
|
|
1145
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
1146
|
+
var CheckboxInput = forwardRef20(function CheckboxInput2({
|
|
1177
1147
|
onChange,
|
|
1178
1148
|
checked,
|
|
1179
1149
|
invalid,
|
|
@@ -1186,14 +1156,14 @@ var CheckboxInput = forwardRef21(function CheckboxInput2({
|
|
|
1186
1156
|
onChange?.(el.checked);
|
|
1187
1157
|
}, [onChange]);
|
|
1188
1158
|
const classNames = useClassNames("charcoal-checkbox-input", className);
|
|
1189
|
-
return /* @__PURE__ */
|
|
1159
|
+
return /* @__PURE__ */ jsx30("input", { className: classNames, ref, type: "checkbox", onChange: handleChange, "aria-invalid": invalid, checked, "data-rounded": rounded, ...props });
|
|
1190
1160
|
});
|
|
1191
1161
|
var CheckboxInput_default = memo8(CheckboxInput);
|
|
1192
1162
|
|
|
1193
1163
|
// src/components/Checkbox/CheckboxWithLabel.tsx
|
|
1194
|
-
import
|
|
1195
|
-
import { jsx as
|
|
1196
|
-
var CheckboxWithLabel =
|
|
1164
|
+
import React16 from "react";
|
|
1165
|
+
import { jsx as jsx31, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1166
|
+
var CheckboxWithLabel = React16.memo(function CheckboxWithLabel2({
|
|
1197
1167
|
className,
|
|
1198
1168
|
children,
|
|
1199
1169
|
input,
|
|
@@ -1201,15 +1171,15 @@ var CheckboxWithLabel = React17.memo(function CheckboxWithLabel2({
|
|
|
1201
1171
|
disabled
|
|
1202
1172
|
}) {
|
|
1203
1173
|
const classNames = useClassNames("charcoal-checkbox__label", className);
|
|
1204
|
-
return /* @__PURE__ */
|
|
1174
|
+
return /* @__PURE__ */ jsxs12("label", { htmlFor: id, "aria-disabled": disabled, className: classNames, children: [
|
|
1205
1175
|
input,
|
|
1206
|
-
/* @__PURE__ */
|
|
1176
|
+
/* @__PURE__ */ jsx31("div", { className: "charcoal-checkbox__label_div", children })
|
|
1207
1177
|
] });
|
|
1208
1178
|
});
|
|
1209
1179
|
|
|
1210
1180
|
// src/components/Checkbox/index.tsx
|
|
1211
|
-
import { jsx as
|
|
1212
|
-
var Checkbox =
|
|
1181
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
1182
|
+
var Checkbox = forwardRef21(function Checkbox2({
|
|
1213
1183
|
disabled,
|
|
1214
1184
|
className,
|
|
1215
1185
|
id,
|
|
@@ -1218,20 +1188,20 @@ var Checkbox = forwardRef22(function Checkbox2({
|
|
|
1218
1188
|
}, ref) {
|
|
1219
1189
|
const htmlId = useId5(id);
|
|
1220
1190
|
const noChildren = children === void 0;
|
|
1221
|
-
const input = /* @__PURE__ */
|
|
1191
|
+
const input = /* @__PURE__ */ jsx32(CheckboxInput_default, { ...props, className: noChildren ? className : void 0, disabled, id: htmlId, ref });
|
|
1222
1192
|
if (noChildren) {
|
|
1223
1193
|
return input;
|
|
1224
1194
|
}
|
|
1225
|
-
return /* @__PURE__ */
|
|
1195
|
+
return /* @__PURE__ */ jsx32(CheckboxWithLabel, { className, disabled, id: htmlId, input, children });
|
|
1226
1196
|
});
|
|
1227
1197
|
var Checkbox_default = memo9(Checkbox);
|
|
1228
1198
|
|
|
1229
1199
|
// src/components/TagItem/index.tsx
|
|
1230
|
-
import { forwardRef as
|
|
1200
|
+
import { forwardRef as forwardRef22, memo as memo10, useMemo as useMemo10 } from "react";
|
|
1231
1201
|
import { useObjectRef as useObjectRef2 } from "@react-aria/utils";
|
|
1232
|
-
import { jsx as
|
|
1233
|
-
var TagItem =
|
|
1234
|
-
|
|
1202
|
+
import { jsx as jsx33, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1203
|
+
var TagItem = forwardRef22(function TagItemInner({
|
|
1204
|
+
component,
|
|
1235
1205
|
label,
|
|
1236
1206
|
translatedLabel,
|
|
1237
1207
|
bgColor = "#7ACCB1",
|
|
@@ -1245,15 +1215,15 @@ var TagItem = forwardRef23(function TagItemInner({
|
|
|
1245
1215
|
const className = useClassNames("charcoal-tag-item", "charcoal-tag-item__bg", props.className);
|
|
1246
1216
|
const bgVariant = bgImage !== void 0 && bgImage.length > 0 ? "image" : "color";
|
|
1247
1217
|
const bg = bgVariant === "color" ? bgColor : `url(${bgImage ?? ""})`;
|
|
1248
|
-
const Component = useMemo10(() =>
|
|
1249
|
-
return /* @__PURE__ */
|
|
1218
|
+
const Component = useMemo10(() => component ?? "button", [component]);
|
|
1219
|
+
return /* @__PURE__ */ jsxs13(Component, { ...props, ref, className, "data-state": status, "data-bg-variant": bgVariant, "data-size": hasTranslatedLabel ? "M" : size, style: {
|
|
1250
1220
|
"--charcoal-tag-item-bg": bg
|
|
1251
1221
|
}, children: [
|
|
1252
|
-
/* @__PURE__ */
|
|
1253
|
-
hasTranslatedLabel && /* @__PURE__ */
|
|
1254
|
-
/* @__PURE__ */
|
|
1222
|
+
/* @__PURE__ */ jsxs13("div", { className: "charcoal-tag-item__label", "data-has-translate": hasTranslatedLabel, children: [
|
|
1223
|
+
hasTranslatedLabel && /* @__PURE__ */ jsx33("span", { className: "charcoal-tag-item__label__translated", children: translatedLabel }),
|
|
1224
|
+
/* @__PURE__ */ jsx33("span", { className: "charcoal-tag-item__label__text", "data-has-translate": hasTranslatedLabel, children: label })
|
|
1255
1225
|
] }),
|
|
1256
|
-
status === "active" && /* @__PURE__ */
|
|
1226
|
+
status === "active" && /* @__PURE__ */ jsx33(Icon_default, { name: "16/Remove" })
|
|
1257
1227
|
] });
|
|
1258
1228
|
});
|
|
1259
1229
|
var TagItem_default = memo10(TagItem);
|
|
@@ -1262,7 +1232,6 @@ export {
|
|
|
1262
1232
|
CharcoalProvider,
|
|
1263
1233
|
Checkbox_default as Checkbox,
|
|
1264
1234
|
Clickable_default as Clickable,
|
|
1265
|
-
ComponentAbstraction,
|
|
1266
1235
|
DropdownMenuItem,
|
|
1267
1236
|
DropdownSelector,
|
|
1268
1237
|
Icon_default as Icon,
|
|
@@ -1284,7 +1253,6 @@ export {
|
|
|
1284
1253
|
Switch_default as Switch,
|
|
1285
1254
|
TagItem_default as TagItem,
|
|
1286
1255
|
TextArea_default as TextArea,
|
|
1287
|
-
TextField_default as TextField
|
|
1288
|
-
useComponentAbstraction
|
|
1256
|
+
TextField_default as TextField
|
|
1289
1257
|
};
|
|
1290
1258
|
//# sourceMappingURL=index.esm.js.map
|