@arc-ui/components 11.14.0 → 11.16.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/Breadcrumbs/Breadcrumbs.cjs.js +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.esm.js +1 -1
- package/dist/Checkbox/Checkbox.cjs.js +2 -2
- package/dist/Checkbox/Checkbox.esm.js +2 -2
- package/dist/FormControl/FormControl.cjs.js +1 -1
- package/dist/FormControl/FormControl.esm.js +1 -1
- package/dist/InformationCard/InformationCard.cjs.js +25 -43
- package/dist/InformationCard/InformationCard.esm.js +24 -42
- package/dist/Modal/Modal.cjs.js +16 -40
- package/dist/Modal/Modal.esm.js +6 -30
- package/dist/PaginationSimple/PaginationSimple.cjs.js +19 -16
- package/dist/PaginationSimple/PaginationSimple.esm.js +19 -16
- package/dist/RadioGroup/RadioGroup.cjs.js +2 -2
- package/dist/RadioGroup/RadioGroup.esm.js +2 -2
- package/dist/Select/Select.cjs.js +2736 -619
- package/dist/Select/Select.esm.js +2535 -418
- package/dist/Switch/Switch.cjs.js +335 -11
- package/dist/Switch/Switch.esm.js +328 -4
- package/dist/Tabs/Tabs.cjs.js +7 -4
- package/dist/Tabs/Tabs.esm.js +7 -4
- package/dist/TextArea/TextArea.cjs.js +17 -12
- package/dist/TextArea/TextArea.esm.js +17 -12
- package/dist/TextInput/TextInput.cjs.js +2 -2
- package/dist/TextInput/TextInput.esm.js +2 -2
- package/dist/Toast/Toast.cjs.js +7 -4
- package/dist/Toast/Toast.esm.js +7 -4
- package/dist/TypographyCard/TypographyCard.cjs.js +93 -0
- package/dist/TypographyCard/TypographyCard.esm.js +85 -0
- package/dist/TypographyCard/package.json +7 -0
- package/dist/UniversalHeader/UniversalHeader.cjs.js +1 -1
- package/dist/UniversalHeader/UniversalHeader.esm.js +1 -1
- package/dist/_shared/cjs/{Breadcrumbs-ed70e75a.js → Breadcrumbs-ef659d2b.js} +5 -5
- package/dist/_shared/cjs/BtIconArrowRight.esm-8e8ac316.js +30 -0
- package/dist/_shared/cjs/BtIconArrowRightFill.esm-435cf4bd.js +26 -0
- package/dist/_shared/cjs/{Checkbox-b126194e.js → Checkbox-904ad028.js} +1 -1
- package/dist/_shared/cjs/{FormControl-7daf8110.js → FormControl-166e0957.js} +5 -1
- package/dist/_shared/cjs/{RadioGroup-56e3b0e5.js → RadioGroup-1eddf86f.js} +1 -1
- package/dist/_shared/cjs/{Tabs-2d2a517d.js → Tabs-cc77dabb.js} +17 -37
- package/dist/_shared/cjs/{TextInput-bf1fe052.js → TextInput-fd9c756f.js} +10 -4
- package/dist/_shared/cjs/{Toast-69108261.js → Toast-91e96744.js} +36 -54
- package/dist/_shared/cjs/{UniversalHeader-5e43d320.js → UniversalHeader-b8389447.js} +4 -2
- package/dist/_shared/cjs/index-1641d0b4.js +27 -0
- package/dist/_shared/cjs/{index-43458549.js → index-3d69ea00.js} +28 -1
- package/dist/_shared/cjs/index-49c72a87.js +131 -0
- package/dist/_shared/cjs/{index-6b2a9ac3.js → index-4ecad2dd.js} +6 -22
- package/dist/_shared/cjs/{index.module-dd1d7d0b.js → index-56a040f4.js} +87 -104
- package/dist/_shared/cjs/index-6542b467.js +23 -0
- package/dist/_shared/cjs/{index-adbb63da.js → index-84e6a68f.js} +1 -1
- package/dist/_shared/cjs/{index-b2fd6338.js → index-d31f2b65.js} +1 -1
- package/dist/_shared/cjs/index-dcfdd5da.js +11 -0
- package/dist/_shared/esm/{Breadcrumbs-87e2bd46.js → Breadcrumbs-36edfb3d.js} +5 -5
- package/dist/_shared/esm/BtIconArrowRight.esm-267916a4.js +24 -0
- package/dist/_shared/esm/BtIconArrowRightFill.esm-99019d1a.js +20 -0
- package/dist/_shared/esm/{Checkbox-d6ec5024.js → Checkbox-8a5bb9a1.js} +1 -1
- package/dist/_shared/esm/{FormControl-351e5f1b.js → FormControl-9d4ddfec.js} +5 -1
- package/dist/_shared/esm/{RadioGroup-c838764c.js → RadioGroup-238db88d.js} +1 -1
- package/dist/_shared/esm/{Tabs-f903187a.js → Tabs-8719d952.js} +7 -27
- package/dist/_shared/esm/{TextInput-991804b6.js → TextInput-c1e2a1dd.js} +10 -4
- package/dist/_shared/esm/{Toast-37549e68.js → Toast-7cb1e544.js} +6 -24
- package/dist/_shared/esm/{UniversalHeader-b4c1577c.js → UniversalHeader-80c7313f.js} +4 -2
- package/dist/_shared/esm/{index.module-44714d3f.js → index-12f3a407.js} +89 -105
- package/dist/_shared/esm/index-246b4f18.js +21 -0
- package/dist/_shared/esm/{index-a1d2d9b3.js → index-39019a9b.js} +1 -1
- package/dist/_shared/esm/{index-41d7af2b.js → index-3e2bc99d.js} +29 -3
- package/dist/_shared/esm/index-6b7b075c.js +25 -0
- package/dist/_shared/esm/{index-efd9ef1c.js → index-936b5179.js} +1 -1
- package/dist/_shared/esm/index-a624de47.js +9 -0
- package/dist/_shared/esm/{index-3797d77e.js → index-d0307140.js} +5 -21
- package/dist/_shared/esm/index-db47e95a.js +129 -0
- package/dist/index.es.js +3062 -865
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +3062 -864
- package/dist/index.js.map +1 -1
- package/dist/styles.css +5 -5
- package/dist/types/components/MediaCard/MediaCard.d.ts +24 -30
- package/dist/types/components/Select/Select.d.ts +49 -0
- package/dist/types/components/TextInput/TextInput.d.ts +12 -1
- package/dist/types/components/TypographyCard/TypographyCard.d.ts +48 -0
- package/dist/types/components/TypographyCard/index.d.ts +1 -0
- package/dist/types/components/UniversalHeader/UniversalHeader.d.ts +4 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/internal-components/ConditionalWrapper/ConditionalWrapper.d.ts +6 -0
- package/dist/types/internal-components/ConditionalWrapper/index.d.ts +1 -0
- package/dist/types/internal-components/index.d.ts +1 -0
- package/dist/types/styles.d.ts +2 -1
- package/package.json +2 -2
- package/dist/_shared/cjs/index-c575a255.js +0 -490
- package/dist/_shared/esm/index-13d575cc.js +0 -479
- package/dist/types/components/MediaCard/MediaCard.stories-wip.d.ts +0 -15
|
@@ -6,14 +6,13 @@ var filterDataAttrs = require('../_shared/cjs/filter-data-attrs-1c9a530c.js');
|
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var index = require('../_shared/cjs/index-9947ac13.js');
|
|
8
8
|
var _extends = require('../_shared/cjs/extends-8c5e4b48.js');
|
|
9
|
-
|
|
9
|
+
require('react-dom');
|
|
10
10
|
var Icon = require('../_shared/cjs/Icon-a9801f05.js');
|
|
11
11
|
var BtIconTickAlt2Px_esm = require('../_shared/cjs/BtIconTickAlt2Px.esm-57c89acc.js');
|
|
12
12
|
var Surface = require('../_shared/cjs/Surface-038db6e1.js');
|
|
13
|
-
var FormControl = require('../_shared/cjs/FormControl-
|
|
13
|
+
var FormControl = require('../_shared/cjs/FormControl-166e0957.js');
|
|
14
14
|
var VerticalSpace = require('../_shared/cjs/VerticalSpace-dc53bb70.js');
|
|
15
15
|
var Text = require('../_shared/cjs/Text-606ca3a2.js');
|
|
16
|
-
require('react-dom');
|
|
17
16
|
require('../_shared/cjs/suffix-modifier-64dcd338.js');
|
|
18
17
|
require('../_shared/cjs/BtIconAlert.esm-1a0ff9f0.js');
|
|
19
18
|
require('../_shared/cjs/DisclosureMini-d0eeb6bb.js');
|
|
@@ -23,9 +22,220 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
23
22
|
|
|
24
23
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
25
24
|
|
|
25
|
+
function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEventHandler, { checkForDefaultPrevented: checkForDefaultPrevented = true } = {}) {
|
|
26
|
+
return function handleEvent(event) {
|
|
27
|
+
originalEventHandler === null || originalEventHandler === void 0 || originalEventHandler(event);
|
|
28
|
+
if (checkForDefaultPrevented === false || !event.defaultPrevented) return ourEventHandler === null || ourEventHandler === void 0 ? void 0 : ourEventHandler(event);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Set a given ref to a given value
|
|
34
|
+
* This utility takes care of different types of refs: callback refs and RefObject(s)
|
|
35
|
+
*/ function $6ed0406888f73fc4$var$setRef(ref, value) {
|
|
36
|
+
if (typeof ref === 'function') ref(value);
|
|
37
|
+
else if (ref !== null && ref !== undefined) ref.current = value;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A utility to compose multiple refs together
|
|
41
|
+
* Accepts callback refs and RefObject(s)
|
|
42
|
+
*/ function $6ed0406888f73fc4$export$43e446d32b3d21af(...refs) {
|
|
43
|
+
return (node)=>refs.forEach((ref)=>$6ed0406888f73fc4$var$setRef(ref, node)
|
|
44
|
+
)
|
|
45
|
+
;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A custom hook that composes multiple refs
|
|
49
|
+
* Accepts callback refs and RefObject(s)
|
|
50
|
+
*/ function $6ed0406888f73fc4$export$c7b2cbe3552a0d05(...refs) {
|
|
51
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
|
+
return React.useCallback($6ed0406888f73fc4$export$43e446d32b3d21af(...refs), refs);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* -------------------------------------------------------------------------------------------------
|
|
56
|
+
* createContextScope
|
|
57
|
+
* -----------------------------------------------------------------------------------------------*/ function $c512c27ab02ef895$export$50c7b4e9d9f19c1(scopeName, createContextScopeDeps = []) {
|
|
58
|
+
let defaultContexts = [];
|
|
59
|
+
/* -----------------------------------------------------------------------------------------------
|
|
60
|
+
* createContext
|
|
61
|
+
* ---------------------------------------------------------------------------------------------*/ function $c512c27ab02ef895$export$fd42f52fd3ae1109(rootComponentName, defaultContext) {
|
|
62
|
+
const BaseContext = /*#__PURE__*/ React.createContext(defaultContext);
|
|
63
|
+
const index = defaultContexts.length;
|
|
64
|
+
defaultContexts = [
|
|
65
|
+
...defaultContexts,
|
|
66
|
+
defaultContext
|
|
67
|
+
];
|
|
68
|
+
function Provider(props) {
|
|
69
|
+
const { scope: scope , children: children , ...context } = props;
|
|
70
|
+
const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index]) || BaseContext; // Only re-memoize when prop values change
|
|
71
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
72
|
+
const value = React.useMemo(()=>context
|
|
73
|
+
, Object.values(context));
|
|
74
|
+
return /*#__PURE__*/ React.createElement(Context.Provider, {
|
|
75
|
+
value: value
|
|
76
|
+
}, children);
|
|
77
|
+
}
|
|
78
|
+
function useContext(consumerName, scope) {
|
|
79
|
+
const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index]) || BaseContext;
|
|
80
|
+
const context = React.useContext(Context);
|
|
81
|
+
if (context) return context;
|
|
82
|
+
if (defaultContext !== undefined) return defaultContext; // if a defaultContext wasn't specified, it's a required context.
|
|
83
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
84
|
+
}
|
|
85
|
+
Provider.displayName = rootComponentName + 'Provider';
|
|
86
|
+
return [
|
|
87
|
+
Provider,
|
|
88
|
+
useContext
|
|
89
|
+
];
|
|
90
|
+
}
|
|
91
|
+
/* -----------------------------------------------------------------------------------------------
|
|
92
|
+
* createScope
|
|
93
|
+
* ---------------------------------------------------------------------------------------------*/ const createScope = ()=>{
|
|
94
|
+
const scopeContexts = defaultContexts.map((defaultContext)=>{
|
|
95
|
+
return /*#__PURE__*/ React.createContext(defaultContext);
|
|
96
|
+
});
|
|
97
|
+
return function useScope(scope) {
|
|
98
|
+
const contexts = (scope === null || scope === void 0 ? void 0 : scope[scopeName]) || scopeContexts;
|
|
99
|
+
return React.useMemo(()=>({
|
|
100
|
+
[`__scope${scopeName}`]: {
|
|
101
|
+
...scope,
|
|
102
|
+
[scopeName]: contexts
|
|
103
|
+
}
|
|
104
|
+
})
|
|
105
|
+
, [
|
|
106
|
+
scope,
|
|
107
|
+
contexts
|
|
108
|
+
]);
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
createScope.scopeName = scopeName;
|
|
112
|
+
return [
|
|
113
|
+
$c512c27ab02ef895$export$fd42f52fd3ae1109,
|
|
114
|
+
$c512c27ab02ef895$var$composeContextScopes(createScope, ...createContextScopeDeps)
|
|
115
|
+
];
|
|
116
|
+
}
|
|
117
|
+
/* -------------------------------------------------------------------------------------------------
|
|
118
|
+
* composeContextScopes
|
|
119
|
+
* -----------------------------------------------------------------------------------------------*/ function $c512c27ab02ef895$var$composeContextScopes(...scopes) {
|
|
120
|
+
const baseScope = scopes[0];
|
|
121
|
+
if (scopes.length === 1) return baseScope;
|
|
122
|
+
const createScope1 = ()=>{
|
|
123
|
+
const scopeHooks = scopes.map((createScope)=>({
|
|
124
|
+
useScope: createScope(),
|
|
125
|
+
scopeName: createScope.scopeName
|
|
126
|
+
})
|
|
127
|
+
);
|
|
128
|
+
return function useComposedScopes(overrideScopes) {
|
|
129
|
+
const nextScopes1 = scopeHooks.reduce((nextScopes, { useScope: useScope , scopeName: scopeName })=>{
|
|
130
|
+
// We are calling a hook inside a callback which React warns against to avoid inconsistent
|
|
131
|
+
// renders, however, scoping doesn't have render side effects so we ignore the rule.
|
|
132
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
133
|
+
const scopeProps = useScope(overrideScopes);
|
|
134
|
+
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
135
|
+
return {
|
|
136
|
+
...nextScopes,
|
|
137
|
+
...currentScope
|
|
138
|
+
};
|
|
139
|
+
}, {});
|
|
140
|
+
return React.useMemo(()=>({
|
|
141
|
+
[`__scope${baseScope.scopeName}`]: nextScopes1
|
|
142
|
+
})
|
|
143
|
+
, [
|
|
144
|
+
nextScopes1
|
|
145
|
+
]);
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
createScope1.scopeName = baseScope.scopeName;
|
|
149
|
+
return createScope1;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a
|
|
154
|
+
* prop or avoid re-executing effects when passed as a dependency
|
|
155
|
+
*/ function $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(callback) {
|
|
156
|
+
const callbackRef = React.useRef(callback);
|
|
157
|
+
React.useEffect(()=>{
|
|
158
|
+
callbackRef.current = callback;
|
|
159
|
+
}); // https://github.com/facebook/react/issues/19240
|
|
160
|
+
return React.useMemo(()=>(...args)=>{
|
|
161
|
+
var _callbackRef$current;
|
|
162
|
+
return (_callbackRef$current = callbackRef.current) === null || _callbackRef$current === void 0 ? void 0 : _callbackRef$current.call(callbackRef, ...args);
|
|
163
|
+
}
|
|
164
|
+
, []);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function $71cd76cc60e0454e$export$6f32135080cb4c3({ prop: prop , defaultProp: defaultProp , onChange: onChange = ()=>{} }) {
|
|
168
|
+
const [uncontrolledProp, setUncontrolledProp] = $71cd76cc60e0454e$var$useUncontrolledState({
|
|
169
|
+
defaultProp: defaultProp,
|
|
170
|
+
onChange: onChange
|
|
171
|
+
});
|
|
172
|
+
const isControlled = prop !== undefined;
|
|
173
|
+
const value1 = isControlled ? prop : uncontrolledProp;
|
|
174
|
+
const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onChange);
|
|
175
|
+
const setValue = React.useCallback((nextValue)=>{
|
|
176
|
+
if (isControlled) {
|
|
177
|
+
const setter = nextValue;
|
|
178
|
+
const value = typeof nextValue === 'function' ? setter(prop) : nextValue;
|
|
179
|
+
if (value !== prop) handleChange(value);
|
|
180
|
+
} else setUncontrolledProp(nextValue);
|
|
181
|
+
}, [
|
|
182
|
+
isControlled,
|
|
183
|
+
prop,
|
|
184
|
+
setUncontrolledProp,
|
|
185
|
+
handleChange
|
|
186
|
+
]);
|
|
187
|
+
return [
|
|
188
|
+
value1,
|
|
189
|
+
setValue
|
|
190
|
+
];
|
|
191
|
+
}
|
|
192
|
+
function $71cd76cc60e0454e$var$useUncontrolledState({ defaultProp: defaultProp , onChange: onChange }) {
|
|
193
|
+
const uncontrolledState = React.useState(defaultProp);
|
|
194
|
+
const [value] = uncontrolledState;
|
|
195
|
+
const prevValueRef = React.useRef(value);
|
|
196
|
+
const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onChange);
|
|
197
|
+
React.useEffect(()=>{
|
|
198
|
+
if (prevValueRef.current !== value) {
|
|
199
|
+
handleChange(value);
|
|
200
|
+
prevValueRef.current = value;
|
|
201
|
+
}
|
|
202
|
+
}, [
|
|
203
|
+
value,
|
|
204
|
+
prevValueRef,
|
|
205
|
+
handleChange
|
|
206
|
+
]);
|
|
207
|
+
return uncontrolledState;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function $010c2913dbd2fe3d$export$5cae361ad82dce8b(value) {
|
|
211
|
+
const ref = React.useRef({
|
|
212
|
+
value: value,
|
|
213
|
+
previous: value
|
|
214
|
+
}); // We compare values before making an update to ensure that
|
|
215
|
+
// a change has been made. This ensures the previous value is
|
|
216
|
+
// persisted correctly between renders.
|
|
217
|
+
return React.useMemo(()=>{
|
|
218
|
+
if (ref.current.value !== value) {
|
|
219
|
+
ref.current.previous = ref.current.value;
|
|
220
|
+
ref.current.value = value;
|
|
221
|
+
}
|
|
222
|
+
return ref.current.previous;
|
|
223
|
+
}, [
|
|
224
|
+
value
|
|
225
|
+
]);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* On the server, React emits a warning when calling `useLayoutEffect`.
|
|
230
|
+
* This is because neither `useLayoutEffect` nor `useEffect` run on the server.
|
|
231
|
+
* We use this safe version which suppresses the warning by replacing it with a noop on the server.
|
|
232
|
+
*
|
|
233
|
+
* See: https://reactjs.org/docs/hooks-reference.html#uselayouteffect
|
|
234
|
+
*/ const $9f79659886946c16$export$e5c5a5f917a5871c = Boolean(globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) ? React.useLayoutEffect : ()=>{};
|
|
235
|
+
|
|
26
236
|
function $db6c3485150b8e66$export$1ab7ae714698c4b8(element) {
|
|
27
237
|
const [size, setSize] = React.useState(undefined);
|
|
28
|
-
|
|
238
|
+
$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
29
239
|
if (element) {
|
|
30
240
|
// provide size as early as possible
|
|
31
241
|
setSize({
|
|
@@ -70,19 +280,133 @@ function $db6c3485150b8e66$export$1ab7ae714698c4b8(element) {
|
|
|
70
280
|
return size;
|
|
71
281
|
}
|
|
72
282
|
|
|
283
|
+
/* -------------------------------------------------------------------------------------------------
|
|
284
|
+
* Slot
|
|
285
|
+
* -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$export$8c6ed5c666ac1360 = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
286
|
+
const { children: children , ...slotProps } = props;
|
|
287
|
+
const childrenArray = React.Children.toArray(children);
|
|
288
|
+
const slottable = childrenArray.find($5e63c961fc1ce211$var$isSlottable);
|
|
289
|
+
if (slottable) {
|
|
290
|
+
// the new element to render is the one passed as a child of `Slottable`
|
|
291
|
+
const newElement = slottable.props.children;
|
|
292
|
+
const newChildren = childrenArray.map((child)=>{
|
|
293
|
+
if (child === slottable) {
|
|
294
|
+
// because the new element will be the one rendered, we are only interested
|
|
295
|
+
// in grabbing its children (`newElement.props.children`)
|
|
296
|
+
if (React.Children.count(newElement) > 1) return React.Children.only(null);
|
|
297
|
+
return /*#__PURE__*/ React.isValidElement(newElement) ? newElement.props.children : null;
|
|
298
|
+
} else return child;
|
|
299
|
+
});
|
|
300
|
+
return /*#__PURE__*/ React.createElement($5e63c961fc1ce211$var$SlotClone, _extends._extends({}, slotProps, {
|
|
301
|
+
ref: forwardedRef
|
|
302
|
+
}), /*#__PURE__*/ React.isValidElement(newElement) ? /*#__PURE__*/ React.cloneElement(newElement, undefined, newChildren) : null);
|
|
303
|
+
}
|
|
304
|
+
return /*#__PURE__*/ React.createElement($5e63c961fc1ce211$var$SlotClone, _extends._extends({}, slotProps, {
|
|
305
|
+
ref: forwardedRef
|
|
306
|
+
}), children);
|
|
307
|
+
});
|
|
308
|
+
$5e63c961fc1ce211$export$8c6ed5c666ac1360.displayName = 'Slot';
|
|
309
|
+
/* -------------------------------------------------------------------------------------------------
|
|
310
|
+
* SlotClone
|
|
311
|
+
* -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$var$SlotClone = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
312
|
+
const { children: children , ...slotProps } = props;
|
|
313
|
+
if (/*#__PURE__*/ React.isValidElement(children)) return /*#__PURE__*/ React.cloneElement(children, {
|
|
314
|
+
...$5e63c961fc1ce211$var$mergeProps(slotProps, children.props),
|
|
315
|
+
ref: $6ed0406888f73fc4$export$43e446d32b3d21af(forwardedRef, children.ref)
|
|
316
|
+
});
|
|
317
|
+
return React.Children.count(children) > 1 ? React.Children.only(null) : null;
|
|
318
|
+
});
|
|
319
|
+
$5e63c961fc1ce211$var$SlotClone.displayName = 'SlotClone';
|
|
320
|
+
/* -------------------------------------------------------------------------------------------------
|
|
321
|
+
* Slottable
|
|
322
|
+
* -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$export$d9f1ccf0bdb05d45 = ({ children: children })=>{
|
|
323
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, null, children);
|
|
324
|
+
};
|
|
325
|
+
/* ---------------------------------------------------------------------------------------------- */ function $5e63c961fc1ce211$var$isSlottable(child) {
|
|
326
|
+
return /*#__PURE__*/ React.isValidElement(child) && child.type === $5e63c961fc1ce211$export$d9f1ccf0bdb05d45;
|
|
327
|
+
}
|
|
328
|
+
function $5e63c961fc1ce211$var$mergeProps(slotProps, childProps) {
|
|
329
|
+
// all child props should override
|
|
330
|
+
const overrideProps = {
|
|
331
|
+
...childProps
|
|
332
|
+
};
|
|
333
|
+
for(const propName in childProps){
|
|
334
|
+
const slotPropValue = slotProps[propName];
|
|
335
|
+
const childPropValue = childProps[propName];
|
|
336
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
337
|
+
if (isHandler) {
|
|
338
|
+
// if the handler exists on both, we compose them
|
|
339
|
+
if (slotPropValue && childPropValue) overrideProps[propName] = (...args)=>{
|
|
340
|
+
childPropValue(...args);
|
|
341
|
+
slotPropValue(...args);
|
|
342
|
+
};
|
|
343
|
+
else if (slotPropValue) overrideProps[propName] = slotPropValue;
|
|
344
|
+
} else if (propName === 'style') overrideProps[propName] = {
|
|
345
|
+
...slotPropValue,
|
|
346
|
+
...childPropValue
|
|
347
|
+
};
|
|
348
|
+
else if (propName === 'className') overrideProps[propName] = [
|
|
349
|
+
slotPropValue,
|
|
350
|
+
childPropValue
|
|
351
|
+
].filter(Boolean).join(' ');
|
|
352
|
+
}
|
|
353
|
+
return {
|
|
354
|
+
...slotProps,
|
|
355
|
+
...overrideProps
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
const $8927f6f2acc4f386$var$NODES = [
|
|
360
|
+
'a',
|
|
361
|
+
'button',
|
|
362
|
+
'div',
|
|
363
|
+
'h2',
|
|
364
|
+
'h3',
|
|
365
|
+
'img',
|
|
366
|
+
'label',
|
|
367
|
+
'li',
|
|
368
|
+
'nav',
|
|
369
|
+
'ol',
|
|
370
|
+
'p',
|
|
371
|
+
'span',
|
|
372
|
+
'svg',
|
|
373
|
+
'ul'
|
|
374
|
+
]; // Temporary while we await merge of this fix:
|
|
375
|
+
// https://github.com/DefinitelyTyped/DefinitelyTyped/pull/55396
|
|
376
|
+
// prettier-ignore
|
|
377
|
+
/* -------------------------------------------------------------------------------------------------
|
|
378
|
+
* Primitive
|
|
379
|
+
* -----------------------------------------------------------------------------------------------*/ const $8927f6f2acc4f386$export$250ffa63cdc0d034 = $8927f6f2acc4f386$var$NODES.reduce((primitive, node)=>{
|
|
380
|
+
const Node = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
381
|
+
const { asChild: asChild , ...primitiveProps } = props;
|
|
382
|
+
const Comp = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : node;
|
|
383
|
+
React.useEffect(()=>{
|
|
384
|
+
window[Symbol.for('radix-ui')] = true;
|
|
385
|
+
}, []);
|
|
386
|
+
return /*#__PURE__*/ React.createElement(Comp, _extends._extends({}, primitiveProps, {
|
|
387
|
+
ref: forwardedRef
|
|
388
|
+
}));
|
|
389
|
+
});
|
|
390
|
+
Node.displayName = `Primitive.${node}`;
|
|
391
|
+
return {
|
|
392
|
+
...primitive,
|
|
393
|
+
[node]: Node
|
|
394
|
+
};
|
|
395
|
+
}, {});
|
|
396
|
+
|
|
73
397
|
/* -------------------------------------------------------------------------------------------------
|
|
74
398
|
* Switch
|
|
75
399
|
* -----------------------------------------------------------------------------------------------*/ const $6be4966fd9bbc698$var$SWITCH_NAME = 'Switch';
|
|
76
|
-
const [$6be4966fd9bbc698$var$createSwitchContext, $6be4966fd9bbc698$export$cf7f5f17f69cbd43] =
|
|
400
|
+
const [$6be4966fd9bbc698$var$createSwitchContext, $6be4966fd9bbc698$export$cf7f5f17f69cbd43] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($6be4966fd9bbc698$var$SWITCH_NAME);
|
|
77
401
|
const [$6be4966fd9bbc698$var$SwitchProvider, $6be4966fd9bbc698$var$useSwitchContext] = $6be4966fd9bbc698$var$createSwitchContext($6be4966fd9bbc698$var$SWITCH_NAME);
|
|
78
402
|
const $6be4966fd9bbc698$export$b5d5cf8927ab7262 = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
79
403
|
const { __scopeSwitch: __scopeSwitch , name: name , checked: checkedProp , defaultChecked: defaultChecked , required: required , disabled: disabled , value: value = 'on' , onCheckedChange: onCheckedChange , ...switchProps } = props;
|
|
80
404
|
const [button, setButton] = React.useState(null);
|
|
81
|
-
const composedRefs =
|
|
405
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setButton(node)
|
|
82
406
|
);
|
|
83
407
|
const hasConsumerStoppedPropagationRef = React.useRef(false); // We set this to true by default so that events bubble to forms without JS (SSR)
|
|
84
408
|
const isFormControl = button ? Boolean(button.closest('form')) : true;
|
|
85
|
-
const [checked = false, setChecked] =
|
|
409
|
+
const [checked = false, setChecked] = $71cd76cc60e0454e$export$6f32135080cb4c3({
|
|
86
410
|
prop: checkedProp,
|
|
87
411
|
defaultProp: defaultChecked,
|
|
88
412
|
onChange: onCheckedChange
|
|
@@ -91,7 +415,7 @@ const $6be4966fd9bbc698$export$b5d5cf8927ab7262 = /*#__PURE__*/ React.forwardRef
|
|
|
91
415
|
scope: __scopeSwitch,
|
|
92
416
|
checked: checked,
|
|
93
417
|
disabled: disabled
|
|
94
|
-
}, /*#__PURE__*/ React.createElement(
|
|
418
|
+
}, /*#__PURE__*/ React.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends._extends({
|
|
95
419
|
type: "button",
|
|
96
420
|
role: "switch",
|
|
97
421
|
"aria-checked": checked,
|
|
@@ -102,7 +426,7 @@ const $6be4966fd9bbc698$export$b5d5cf8927ab7262 = /*#__PURE__*/ React.forwardRef
|
|
|
102
426
|
value: value
|
|
103
427
|
}, switchProps, {
|
|
104
428
|
ref: composedRefs,
|
|
105
|
-
onClick:
|
|
429
|
+
onClick: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onClick, (event)=>{
|
|
106
430
|
setChecked((prevChecked)=>!prevChecked
|
|
107
431
|
);
|
|
108
432
|
if (isFormControl) {
|
|
@@ -132,7 +456,7 @@ const $6be4966fd9bbc698$export$b5d5cf8927ab7262 = /*#__PURE__*/ React.forwardRef
|
|
|
132
456
|
const $6be4966fd9bbc698$export$4d07bf653ea69106 = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
133
457
|
const { __scopeSwitch: __scopeSwitch , ...thumbProps } = props;
|
|
134
458
|
const context = $6be4966fd9bbc698$var$useSwitchContext($6be4966fd9bbc698$var$THUMB_NAME, __scopeSwitch);
|
|
135
|
-
return /*#__PURE__*/ React.createElement(
|
|
459
|
+
return /*#__PURE__*/ React.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends._extends({
|
|
136
460
|
"data-state": $6be4966fd9bbc698$var$getState(context.checked),
|
|
137
461
|
"data-disabled": context.disabled ? '' : undefined
|
|
138
462
|
}, thumbProps, {
|
|
@@ -142,7 +466,7 @@ const $6be4966fd9bbc698$export$4d07bf653ea69106 = /*#__PURE__*/ React.forwardRef
|
|
|
142
466
|
/* ---------------------------------------------------------------------------------------------- */ const $6be4966fd9bbc698$var$BubbleInput = (props)=>{
|
|
143
467
|
const { control: control , checked: checked , bubbles: bubbles = true , ...inputProps } = props;
|
|
144
468
|
const ref = React.useRef(null);
|
|
145
|
-
const prevChecked =
|
|
469
|
+
const prevChecked = $010c2913dbd2fe3d$export$5cae361ad82dce8b(checked);
|
|
146
470
|
const controlSize = $db6c3485150b8e66$export$1ab7ae714698c4b8(control); // Bubble checked change to parents (e.g form change event)
|
|
147
471
|
React.useEffect(()=>{
|
|
148
472
|
const input = ref.current;
|