@parrot-co/parrot-ui 0.1.9 → 0.1.11
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/main.js +397 -8
- package/dist/main.js.map +1 -1
- package/dist/module.js +396 -9
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +43 -15
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/styles.css +1 -1
package/dist/main.js
CHANGED
|
@@ -72,6 +72,8 @@ $parcel$export(module.exports, "ColorPicker", () => $b4c448f742efa2a7$export$9fe
|
|
|
72
72
|
$parcel$export(module.exports, "ColorSlider", () => $7796dcb4fe09bf12$export$44fd664bcca5b6fb);
|
|
73
73
|
$parcel$export(module.exports, "ColorSwatchPicker", () => $799f02b9b0e744b9$export$b46792416e3d8515);
|
|
74
74
|
$parcel$export(module.exports, "parseColor", () => $e93fd810053d36a8$export$6e865ea70d7724f);
|
|
75
|
+
$parcel$export(module.exports, "Toggle", () => $fcb2cacda3f71fdc$export$bea8ebba691c5813);
|
|
76
|
+
$parcel$export(module.exports, "ToggleGroup", () => $fcb2cacda3f71fdc$export$af3ec21f6cfb5e30);
|
|
75
77
|
|
|
76
78
|
|
|
77
79
|
function $d99c85a751d7ffbd$export$7e4aa119212bc614(value) {
|
|
@@ -148,6 +150,211 @@ function $62f1c614c0962470$export$c9058316764c140e(...refs) {
|
|
|
148
150
|
}
|
|
149
151
|
};
|
|
150
152
|
}
|
|
153
|
+
const $62f1c614c0962470$var$validDOMProperties = new Set([
|
|
154
|
+
// Common HTML attributes
|
|
155
|
+
"accept",
|
|
156
|
+
"acceptCharset",
|
|
157
|
+
"accessKey",
|
|
158
|
+
"action",
|
|
159
|
+
"allowFullScreen",
|
|
160
|
+
"allowTransparency",
|
|
161
|
+
"alt",
|
|
162
|
+
"async",
|
|
163
|
+
"autoComplete",
|
|
164
|
+
"autoFocus",
|
|
165
|
+
"autoPlay",
|
|
166
|
+
"capture",
|
|
167
|
+
"cellPadding",
|
|
168
|
+
"cellSpacing",
|
|
169
|
+
"challenge",
|
|
170
|
+
"charSet",
|
|
171
|
+
"checked",
|
|
172
|
+
"cite",
|
|
173
|
+
"classID",
|
|
174
|
+
"className",
|
|
175
|
+
"colSpan",
|
|
176
|
+
"cols",
|
|
177
|
+
"content",
|
|
178
|
+
"contentEditable",
|
|
179
|
+
"contextMenu",
|
|
180
|
+
"controls",
|
|
181
|
+
"coords",
|
|
182
|
+
"crossOrigin",
|
|
183
|
+
"data",
|
|
184
|
+
"dateTime",
|
|
185
|
+
"default",
|
|
186
|
+
"defer",
|
|
187
|
+
"dir",
|
|
188
|
+
"disabled",
|
|
189
|
+
"download",
|
|
190
|
+
"draggable",
|
|
191
|
+
"encType",
|
|
192
|
+
"form",
|
|
193
|
+
"formAction",
|
|
194
|
+
"formEncType",
|
|
195
|
+
"formMethod",
|
|
196
|
+
"formNoValidate",
|
|
197
|
+
"formTarget",
|
|
198
|
+
"frameBorder",
|
|
199
|
+
"headers",
|
|
200
|
+
"height",
|
|
201
|
+
"hidden",
|
|
202
|
+
"high",
|
|
203
|
+
"href",
|
|
204
|
+
"hrefLang",
|
|
205
|
+
"htmlFor",
|
|
206
|
+
"httpEquiv",
|
|
207
|
+
"icon",
|
|
208
|
+
"id",
|
|
209
|
+
"inputMode",
|
|
210
|
+
"integrity",
|
|
211
|
+
"is",
|
|
212
|
+
"keyParams",
|
|
213
|
+
"keyType",
|
|
214
|
+
"kind",
|
|
215
|
+
"label",
|
|
216
|
+
"lang",
|
|
217
|
+
"list",
|
|
218
|
+
"loop",
|
|
219
|
+
"low",
|
|
220
|
+
"manifest",
|
|
221
|
+
"marginHeight",
|
|
222
|
+
"marginWidth",
|
|
223
|
+
"max",
|
|
224
|
+
"maxLength",
|
|
225
|
+
"media",
|
|
226
|
+
"mediaGroup",
|
|
227
|
+
"method",
|
|
228
|
+
"min",
|
|
229
|
+
"minLength",
|
|
230
|
+
"multiple",
|
|
231
|
+
"muted",
|
|
232
|
+
"name",
|
|
233
|
+
"noValidate",
|
|
234
|
+
"nonce",
|
|
235
|
+
"open",
|
|
236
|
+
"optimum",
|
|
237
|
+
"pattern",
|
|
238
|
+
"placeholder",
|
|
239
|
+
"poster",
|
|
240
|
+
"preload",
|
|
241
|
+
"profile",
|
|
242
|
+
"radioGroup",
|
|
243
|
+
"readOnly",
|
|
244
|
+
"referrerPolicy",
|
|
245
|
+
"rel",
|
|
246
|
+
"required",
|
|
247
|
+
"reversed",
|
|
248
|
+
"role",
|
|
249
|
+
"rowSpan",
|
|
250
|
+
"rows",
|
|
251
|
+
"sandbox",
|
|
252
|
+
"scope",
|
|
253
|
+
"scoped",
|
|
254
|
+
"scrolling",
|
|
255
|
+
"seamless",
|
|
256
|
+
"selected",
|
|
257
|
+
"shape",
|
|
258
|
+
"size",
|
|
259
|
+
"sizes",
|
|
260
|
+
"span",
|
|
261
|
+
"spellCheck",
|
|
262
|
+
"src",
|
|
263
|
+
"srcDoc",
|
|
264
|
+
"srcLang",
|
|
265
|
+
"srcSet",
|
|
266
|
+
"start",
|
|
267
|
+
"step",
|
|
268
|
+
"style",
|
|
269
|
+
"summary",
|
|
270
|
+
"tabIndex",
|
|
271
|
+
"target",
|
|
272
|
+
"title",
|
|
273
|
+
"type",
|
|
274
|
+
"useMap",
|
|
275
|
+
"value",
|
|
276
|
+
"width",
|
|
277
|
+
"wmode",
|
|
278
|
+
"wrap",
|
|
279
|
+
// Event handlers
|
|
280
|
+
"onCopy",
|
|
281
|
+
"onCut",
|
|
282
|
+
"onPaste",
|
|
283
|
+
"onCompositionEnd",
|
|
284
|
+
"onCompositionStart",
|
|
285
|
+
"onCompositionUpdate",
|
|
286
|
+
"onKeyDown",
|
|
287
|
+
"onKeyPress",
|
|
288
|
+
"onKeyUp",
|
|
289
|
+
"onFocus",
|
|
290
|
+
"onBlur",
|
|
291
|
+
"onChange",
|
|
292
|
+
"onInput",
|
|
293
|
+
"onInvalid",
|
|
294
|
+
"onSubmit",
|
|
295
|
+
"onClick",
|
|
296
|
+
"onContextMenu",
|
|
297
|
+
"onDoubleClick",
|
|
298
|
+
"onDrag",
|
|
299
|
+
"onDragEnd",
|
|
300
|
+
"onDragEnter",
|
|
301
|
+
"onDragExit",
|
|
302
|
+
"onDragLeave",
|
|
303
|
+
"onDragOver",
|
|
304
|
+
"onDragStart",
|
|
305
|
+
"onDrop",
|
|
306
|
+
"onMouseDown",
|
|
307
|
+
"onMouseEnter",
|
|
308
|
+
"onMouseLeave",
|
|
309
|
+
"onMouseMove",
|
|
310
|
+
"onMouseOut",
|
|
311
|
+
"onMouseOver",
|
|
312
|
+
"onMouseUp",
|
|
313
|
+
"onSelect",
|
|
314
|
+
"onTouchCancel",
|
|
315
|
+
"onTouchEnd",
|
|
316
|
+
"onTouchMove",
|
|
317
|
+
"onTouchStart",
|
|
318
|
+
"onScroll",
|
|
319
|
+
"onWheel",
|
|
320
|
+
"onAbort",
|
|
321
|
+
"onCanPlay",
|
|
322
|
+
"onCanPlayThrough",
|
|
323
|
+
"onDurationChange",
|
|
324
|
+
"onEmptied",
|
|
325
|
+
"onEncrypted",
|
|
326
|
+
"onEnded",
|
|
327
|
+
"onError",
|
|
328
|
+
"onLoadedData",
|
|
329
|
+
"onLoadedMetadata",
|
|
330
|
+
"onLoadStart",
|
|
331
|
+
"onPause",
|
|
332
|
+
"onPlay",
|
|
333
|
+
"onPlaying",
|
|
334
|
+
"onProgress",
|
|
335
|
+
"onRateChange",
|
|
336
|
+
"onSeeked",
|
|
337
|
+
"onSeeking",
|
|
338
|
+
"onStalled",
|
|
339
|
+
"onSuspend",
|
|
340
|
+
"onTimeUpdate",
|
|
341
|
+
"onVolumeChange",
|
|
342
|
+
"onWaiting",
|
|
343
|
+
"onLoad",
|
|
344
|
+
"onAnimationStart",
|
|
345
|
+
"onAnimationEnd",
|
|
346
|
+
"onAnimationIteration",
|
|
347
|
+
"onTransitionEnd",
|
|
348
|
+
"onToggle"
|
|
349
|
+
]);
|
|
350
|
+
function $62f1c614c0962470$export$457c3d6518dd4c6f(props) {
|
|
351
|
+
const newProps = {};
|
|
352
|
+
for(const key in props){
|
|
353
|
+
if (!key.startsWith("data-") && !$62f1c614c0962470$var$validDOMProperties.has(key)) continue;
|
|
354
|
+
newProps[key] = props[key];
|
|
355
|
+
}
|
|
356
|
+
return newProps;
|
|
357
|
+
}
|
|
151
358
|
|
|
152
359
|
|
|
153
360
|
const $eb8f27c3596a0e6b$export$23c260ee8e4dfaad = ({ stretchX: stretchX, stretchY: stretchY, stretchXY: stretchXY, children: children, className: className, position: position, as: as = "div", ...props }, ref)=>{
|
|
@@ -295,7 +502,7 @@ const $c3a954a7c0cb5109$export$21ee1313e2afe36c = (props, ref)=>{
|
|
|
295
502
|
className: (0, $62f1c614c0962470$export$a274e22fb40f762e)(className, inline ? "display-inline-flex" : "display-flex", `flex-direction-${flexDirection}`, wrap && `flex-${wrap}`, justify && `flex-justify-${justify}`, align && `flex-align-${align}`, (0, $4af7da5c7dd0b9c2$export$2db1d02db18b2d82)("gap", gap), (0, $4af7da5c7dd0b9c2$export$2db1d02db18b2d82)("column-gap", columnGap), (0, $4af7da5c7dd0b9c2$export$2db1d02db18b2d82)("row-gap", rowGap)),
|
|
296
503
|
// TODO - Fix types here - seems to work just fine though
|
|
297
504
|
ref: ref,
|
|
298
|
-
...otherProps,
|
|
505
|
+
...(0, $62f1c614c0962470$export$457c3d6518dd4c6f)(otherProps),
|
|
299
506
|
children: props.children
|
|
300
507
|
});
|
|
301
508
|
};
|
|
@@ -652,7 +859,7 @@ function $ff6fce0e059b3a1a$export$d2dae087199d2383(object) {
|
|
|
652
859
|
|
|
653
860
|
|
|
654
861
|
const $7f70742e736041ff$var$ButtonGroupContext = /*#__PURE__*/ $8zHUo$react.createContext({});
|
|
655
|
-
function $7f70742e736041ff$export$69b1032f2ecdf404({ color: color, variant: variant, size: size, compact: compact, radius: radius, gap: gap, children: children, idleColor: idleColor, activeColor: activeColor, idleVariant: idleVariant, activeVariant: activeVariant, isToggle: isToggle }) {
|
|
862
|
+
function $7f70742e736041ff$export$69b1032f2ecdf404({ color: color, variant: variant, size: size, compact: compact, radius: radius, gap: gap, children: children, idleColor: idleColor, activeColor: activeColor, idleVariant: idleVariant, activeVariant: activeVariant, isToggle: isToggle, className: className, classNames: classNames, style: style, styles: styles }) {
|
|
656
863
|
const cleanProps = (0, $ff6fce0e059b3a1a$export$d2dae087199d2383)({
|
|
657
864
|
color: color,
|
|
658
865
|
variant: variant,
|
|
@@ -667,6 +874,10 @@ function $7f70742e736041ff$export$69b1032f2ecdf404({ color: color, variant: vari
|
|
|
667
874
|
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)($7f70742e736041ff$var$ButtonGroupContext.Provider, {
|
|
668
875
|
value: cleanProps,
|
|
669
876
|
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $eae337549f49a5a2$export$eef1e68107c58ef2), {
|
|
877
|
+
className: className,
|
|
878
|
+
classNames: classNames,
|
|
879
|
+
style: style,
|
|
880
|
+
styles: styles,
|
|
670
881
|
gap: gap,
|
|
671
882
|
compact: compact,
|
|
672
883
|
children: children
|
|
@@ -719,7 +930,7 @@ const $5a6f28f3fd58ff6e$export$353f5b6fc5456de1 = /*#__PURE__*/ (0, ($parcel$int
|
|
|
719
930
|
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)(Comp, {
|
|
720
931
|
style: {
|
|
721
932
|
...style,
|
|
722
|
-
...styles?.
|
|
933
|
+
...styles?.wrapper
|
|
723
934
|
},
|
|
724
935
|
"data-is-toggle": isToggle,
|
|
725
936
|
"data-pressed": isPressed,
|
|
@@ -2833,7 +3044,7 @@ $c5c6f63b49c9056a$export$b5d5cf8927ab7262.displayName = "Switch";
|
|
|
2833
3044
|
|
|
2834
3045
|
|
|
2835
3046
|
|
|
2836
|
-
function $a945a7e4eb75da9e$export$472062a354075cee({ className: className, classNames: classNames, style: style, styles: styles, name: name, size: size = "sm", orientation: orientation = "horizontal", ...props }) {
|
|
3047
|
+
function $a945a7e4eb75da9e$export$472062a354075cee({ className: className, classNames: classNames, style: style, styles: styles, name: name, size: size = "sm", color: color, orientation: orientation = "horizontal", ...props }) {
|
|
2837
3048
|
const trackRef = $8zHUo$react.useRef(null);
|
|
2838
3049
|
const numberFormatter = (0, $8zHUo$reactaria.useNumberFormatter)();
|
|
2839
3050
|
const state = (0, $8zHUo$reactstately.useSliderState)({
|
|
@@ -2846,6 +3057,7 @@ function $a945a7e4eb75da9e$export$472062a354075cee({ className: className, class
|
|
|
2846
3057
|
}, state, trackRef);
|
|
2847
3058
|
const percent = state.getThumbPercent(0);
|
|
2848
3059
|
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)("div", {
|
|
3060
|
+
"data-color": color,
|
|
2849
3061
|
"data-size": size,
|
|
2850
3062
|
style: {
|
|
2851
3063
|
...style,
|
|
@@ -2860,15 +3072,20 @@ function $a945a7e4eb75da9e$export$472062a354075cee({ className: className, class
|
|
|
2860
3072
|
children: props.label
|
|
2861
3073
|
}),
|
|
2862
3074
|
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)("div", {
|
|
3075
|
+
...trackProps,
|
|
2863
3076
|
ref: trackRef,
|
|
2864
3077
|
className: (0, $62f1c614c0962470$export$a274e22fb40f762e)("p-slider-track", classNames?.track),
|
|
2865
|
-
|
|
3078
|
+
style: {
|
|
3079
|
+
...styles?.track,
|
|
3080
|
+
...trackProps.style
|
|
3081
|
+
},
|
|
2866
3082
|
children: [
|
|
2867
3083
|
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("div", {
|
|
2868
3084
|
style: {
|
|
3085
|
+
...styles?.fill,
|
|
2869
3086
|
width: `${percent * 100}%`
|
|
2870
3087
|
},
|
|
2871
|
-
className: "p-slider-track-fill"
|
|
3088
|
+
className: (0, $62f1c614c0962470$export$a274e22fb40f762e)("p-slider-track-fill", classNames?.fill)
|
|
2872
3089
|
}),
|
|
2873
3090
|
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)($a945a7e4eb75da9e$var$Thumb, {
|
|
2874
3091
|
styles: {
|
|
@@ -2899,14 +3116,15 @@ function $a945a7e4eb75da9e$var$Thumb({ state: state, trackRef: trackRef, index:
|
|
|
2899
3116
|
}, state);
|
|
2900
3117
|
const { focusProps: focusProps, isFocusVisible: isFocusVisible } = (0, $8zHUo$reactaria.useFocusRing)();
|
|
2901
3118
|
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)("div", {
|
|
3119
|
+
...thumbProps,
|
|
2902
3120
|
"data-dragging": isDragging,
|
|
2903
3121
|
"data-focus-visible": isFocusVisible,
|
|
2904
3122
|
className: (0, $62f1c614c0962470$export$a274e22fb40f762e)("p-slider-thumb", className, classNames?.wrapper),
|
|
2905
3123
|
style: {
|
|
3124
|
+
...thumbProps.style,
|
|
2906
3125
|
...style,
|
|
2907
3126
|
...styles?.wrapper
|
|
2908
3127
|
},
|
|
2909
|
-
...thumbProps,
|
|
2910
3128
|
children: [
|
|
2911
3129
|
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("div", {
|
|
2912
3130
|
style: styles?.inner,
|
|
@@ -3608,7 +3826,7 @@ const $d26053f02b9f370b$export$a79147a60006308c = (0, $8zHUo$reactstately.Item);
|
|
|
3608
3826
|
|
|
3609
3827
|
|
|
3610
3828
|
|
|
3611
|
-
function $b4c448f742efa2a7$export$9feb1bc2e5f1ccb3({ onChange: onChange, color: colorProp }) {
|
|
3829
|
+
function $b4c448f742efa2a7$export$9feb1bc2e5f1ccb3({ onChange: onChange, color: colorProp, styles: styles, classNames: classNames, className: className, style: style }) {
|
|
3612
3830
|
const [colorSpace, setColorSpace] = $8zHUo$react.useState("hex");
|
|
3613
3831
|
const [color, setColor] = (0, $c410efc80bcce413$export$40bfa8c7b0832715)(colorProp, (0, $8zHUo$reactstatelycolor.parseColor)("#BB66CC").toFormat("hsla"), onChange);
|
|
3614
3832
|
function handleChange(color) {
|
|
@@ -4105,4 +4323,175 @@ function $e93fd810053d36a8$export$6e865ea70d7724f(color) {
|
|
|
4105
4323
|
|
|
4106
4324
|
|
|
4107
4325
|
|
|
4326
|
+
|
|
4327
|
+
|
|
4328
|
+
|
|
4329
|
+
|
|
4330
|
+
|
|
4331
|
+
|
|
4332
|
+
const $fcb2cacda3f71fdc$var$ToggleGroupContext = /*#__PURE__*/ $8zHUo$react.createContext(null);
|
|
4333
|
+
function $fcb2cacda3f71fdc$export$af3ec21f6cfb5e30({ children: children, mode: mode = "single", value: value, defaultValue: defaultValue, onChange: onChange, validate: validate, styles: styles, classNames: classNames, className: className, style: style, ...props }) {
|
|
4334
|
+
const Wrapper = $8zHUo$react.useMemo(()=>{
|
|
4335
|
+
if (mode === "single") return $fcb2cacda3f71fdc$var$SingleSelectGroup;
|
|
4336
|
+
return $fcb2cacda3f71fdc$var$MultiSelectGroup;
|
|
4337
|
+
}, [
|
|
4338
|
+
mode
|
|
4339
|
+
]);
|
|
4340
|
+
props = {
|
|
4341
|
+
...props
|
|
4342
|
+
};
|
|
4343
|
+
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $ec2376a5dd0d13e6$export$a455218a85c89869), {
|
|
4344
|
+
label: props.label,
|
|
4345
|
+
replaceDefaultControlWrapper: true,
|
|
4346
|
+
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)(Wrapper, {
|
|
4347
|
+
value: value,
|
|
4348
|
+
defaultValue: defaultValue,
|
|
4349
|
+
onChange: onChange,
|
|
4350
|
+
validate: validate,
|
|
4351
|
+
...props,
|
|
4352
|
+
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $eae337549f49a5a2$export$eef1e68107c58ef2), {
|
|
4353
|
+
className: className,
|
|
4354
|
+
styles: styles,
|
|
4355
|
+
classNames: classNames,
|
|
4356
|
+
style: style,
|
|
4357
|
+
...props,
|
|
4358
|
+
children: children
|
|
4359
|
+
})
|
|
4360
|
+
})
|
|
4361
|
+
});
|
|
4362
|
+
}
|
|
4363
|
+
function $fcb2cacda3f71fdc$var$SingleSelectGroup({ children: children, orientation: orientation = "horizontal", ...props }) {
|
|
4364
|
+
const state = (0, $8zHUo$reactstately.useRadioGroupState)(props);
|
|
4365
|
+
const { radioGroupProps: radioGroupProps } = (0, $8zHUo$reactaria.useRadioGroup)({
|
|
4366
|
+
...props,
|
|
4367
|
+
orientation: orientation,
|
|
4368
|
+
"aria-label": "single toggle group"
|
|
4369
|
+
}, state);
|
|
4370
|
+
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("div", {
|
|
4371
|
+
...radioGroupProps,
|
|
4372
|
+
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)($fcb2cacda3f71fdc$var$ToggleGroupContext.Provider, {
|
|
4373
|
+
value: {
|
|
4374
|
+
state: state,
|
|
4375
|
+
mode: "single",
|
|
4376
|
+
props: props
|
|
4377
|
+
},
|
|
4378
|
+
children: children
|
|
4379
|
+
})
|
|
4380
|
+
});
|
|
4381
|
+
}
|
|
4382
|
+
function $fcb2cacda3f71fdc$var$MultiSelectGroup({ children: children, ...props }) {
|
|
4383
|
+
const state = (0, $8zHUo$reactstately.useCheckboxGroupState)(props);
|
|
4384
|
+
const { groupProps: groupProps } = (0, $8zHUo$reactaria.useCheckboxGroup)({
|
|
4385
|
+
...props,
|
|
4386
|
+
"aria-label": "multiple toggle group"
|
|
4387
|
+
}, state);
|
|
4388
|
+
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("div", {
|
|
4389
|
+
...groupProps,
|
|
4390
|
+
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)($fcb2cacda3f71fdc$var$ToggleGroupContext.Provider, {
|
|
4391
|
+
value: {
|
|
4392
|
+
state: state,
|
|
4393
|
+
mode: "multiple",
|
|
4394
|
+
props: props
|
|
4395
|
+
},
|
|
4396
|
+
children: children
|
|
4397
|
+
})
|
|
4398
|
+
});
|
|
4399
|
+
}
|
|
4400
|
+
function $fcb2cacda3f71fdc$var$SingleToggle({ ...props }) {
|
|
4401
|
+
const ctx = $8zHUo$react.useContext($fcb2cacda3f71fdc$var$ToggleGroupContext);
|
|
4402
|
+
const state = ctx?.state;
|
|
4403
|
+
const ref = $8zHUo$react.useRef(null);
|
|
4404
|
+
if (!ctx) throw new Error("Toggle must be used within a ToggleGroup");
|
|
4405
|
+
const { focusProps: focusProps, isFocusVisible: isFocusVisible } = (0, $8zHUo$reactaria.useFocusRing)();
|
|
4406
|
+
const isSelected = state.selectedValue === props.value;
|
|
4407
|
+
const { inputProps: inputProps } = (0, $8zHUo$reactaria.useRadio)(props, ctx.state, ref);
|
|
4408
|
+
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)($fcb2cacda3f71fdc$var$ToggleButton, {
|
|
4409
|
+
isSelected: isSelected,
|
|
4410
|
+
isFocusVisible: isFocusVisible,
|
|
4411
|
+
children: [
|
|
4412
|
+
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $8zHUo$reactaria.VisuallyHidden), {
|
|
4413
|
+
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("input", {
|
|
4414
|
+
ref: ref,
|
|
4415
|
+
...(0, $8zHUo$reactaria.mergeProps)(inputProps, focusProps)
|
|
4416
|
+
})
|
|
4417
|
+
}),
|
|
4418
|
+
props.children
|
|
4419
|
+
]
|
|
4420
|
+
});
|
|
4421
|
+
}
|
|
4422
|
+
function $fcb2cacda3f71fdc$var$MultiToggle({ ...props }) {
|
|
4423
|
+
const ctx = $8zHUo$react.useContext($fcb2cacda3f71fdc$var$ToggleGroupContext);
|
|
4424
|
+
const state = ctx?.state;
|
|
4425
|
+
const ref = $8zHUo$react.useRef(null);
|
|
4426
|
+
if (!ctx) throw new Error("Toggle must be used within a ToggleGroup");
|
|
4427
|
+
const { focusProps: focusProps, isFocusVisible: isFocusVisible } = (0, $8zHUo$reactaria.useFocusRing)();
|
|
4428
|
+
const isSelected = state.isSelected(props.value);
|
|
4429
|
+
const { inputProps: inputProps } = (0, $8zHUo$reactaria.useCheckboxGroupItem)(props, ctx.state, ref);
|
|
4430
|
+
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)($fcb2cacda3f71fdc$var$ToggleButton, {
|
|
4431
|
+
isSelected: isSelected,
|
|
4432
|
+
isFocusVisible: isFocusVisible,
|
|
4433
|
+
children: [
|
|
4434
|
+
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $8zHUo$reactaria.VisuallyHidden), {
|
|
4435
|
+
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("input", {
|
|
4436
|
+
ref: ref,
|
|
4437
|
+
...(0, $8zHUo$reactaria.mergeProps)(inputProps, focusProps)
|
|
4438
|
+
})
|
|
4439
|
+
}),
|
|
4440
|
+
props.children
|
|
4441
|
+
]
|
|
4442
|
+
});
|
|
4443
|
+
}
|
|
4444
|
+
const $fcb2cacda3f71fdc$var$ToggleContext = /*#__PURE__*/ $8zHUo$react.createContext(null);
|
|
4445
|
+
function $fcb2cacda3f71fdc$export$bea8ebba691c5813({ ...props }) {
|
|
4446
|
+
const ctx = $8zHUo$react.useContext($fcb2cacda3f71fdc$var$ToggleGroupContext);
|
|
4447
|
+
if (!ctx) throw new Error("Toggle must be used within a ToggleGroup");
|
|
4448
|
+
const Wrapper = $8zHUo$react.useMemo(()=>{
|
|
4449
|
+
if (ctx?.mode === "single") return $fcb2cacda3f71fdc$var$SingleToggle;
|
|
4450
|
+
return $fcb2cacda3f71fdc$var$MultiToggle;
|
|
4451
|
+
}, [
|
|
4452
|
+
ctx?.mode
|
|
4453
|
+
]);
|
|
4454
|
+
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)($fcb2cacda3f71fdc$var$ToggleContext.Provider, {
|
|
4455
|
+
value: {
|
|
4456
|
+
props: props
|
|
4457
|
+
},
|
|
4458
|
+
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)(Wrapper, {
|
|
4459
|
+
value: props.value,
|
|
4460
|
+
children: props.children
|
|
4461
|
+
})
|
|
4462
|
+
});
|
|
4463
|
+
}
|
|
4464
|
+
function $fcb2cacda3f71fdc$var$ToggleButton({ children: children, isFocusVisible: isFocusVisible, isSelected: isSelected, ...props }) {
|
|
4465
|
+
const ctx = $8zHUo$react.useContext($fcb2cacda3f71fdc$var$ToggleContext)?.props;
|
|
4466
|
+
const groupCtx = $8zHUo$react.useContext($fcb2cacda3f71fdc$var$ToggleGroupContext);
|
|
4467
|
+
if (!ctx || !groupCtx) throw new Error("Toggle must be used within a ToggleGroup");
|
|
4468
|
+
const theme = (0, $f2fd0cbe11b7f0dd$export$93d4e7f90805808f)();
|
|
4469
|
+
const space = (0, $eae337549f49a5a2$export$450c36e0b0e62ccd)();
|
|
4470
|
+
const idleColor = ctx.idleColor ?? groupCtx.props.idleColor ?? "gray";
|
|
4471
|
+
const activeColor = ctx.activeColor ?? groupCtx.props.activeColor ?? theme?.color ?? "gray";
|
|
4472
|
+
const idleVariant = ctx.idleVariant ?? groupCtx.props.idleVariant ?? "light";
|
|
4473
|
+
const activeVariant = ctx.activeVariant ?? groupCtx.props.activeVariant ?? "solid";
|
|
4474
|
+
const color = isSelected ? activeColor : idleColor;
|
|
4475
|
+
const variant = isSelected ? activeVariant : idleVariant;
|
|
4476
|
+
const radius = ctx.radius ?? groupCtx.props.radius ?? "full";
|
|
4477
|
+
const size = ctx.size ?? groupCtx.props.size ?? "md";
|
|
4478
|
+
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("label", {
|
|
4479
|
+
"data-icon-button": ctx.isIconButton,
|
|
4480
|
+
"data-is-toggle": true,
|
|
4481
|
+
"data-radius": radius,
|
|
4482
|
+
"data-color": color,
|
|
4483
|
+
"data-variant": variant,
|
|
4484
|
+
className: (0, $62f1c614c0962470$export$a274e22fb40f762e)("p-button", ctx.className, ctx.classNames?.wrapper, `size-${size}`, space.classNames),
|
|
4485
|
+
"data-selected": isSelected,
|
|
4486
|
+
"data-focus-visible": isFocusVisible,
|
|
4487
|
+
...props,
|
|
4488
|
+
children: children
|
|
4489
|
+
});
|
|
4490
|
+
}
|
|
4491
|
+
|
|
4492
|
+
|
|
4493
|
+
|
|
4494
|
+
|
|
4495
|
+
|
|
4496
|
+
|
|
4108
4497
|
//# sourceMappingURL=main.js.map
|