@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/module.js
CHANGED
|
@@ -83,6 +83,211 @@ function $cce662c1d2ec881b$export$c9058316764c140e(...refs) {
|
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
|
+
const $cce662c1d2ec881b$var$validDOMProperties = new Set([
|
|
87
|
+
// Common HTML attributes
|
|
88
|
+
"accept",
|
|
89
|
+
"acceptCharset",
|
|
90
|
+
"accessKey",
|
|
91
|
+
"action",
|
|
92
|
+
"allowFullScreen",
|
|
93
|
+
"allowTransparency",
|
|
94
|
+
"alt",
|
|
95
|
+
"async",
|
|
96
|
+
"autoComplete",
|
|
97
|
+
"autoFocus",
|
|
98
|
+
"autoPlay",
|
|
99
|
+
"capture",
|
|
100
|
+
"cellPadding",
|
|
101
|
+
"cellSpacing",
|
|
102
|
+
"challenge",
|
|
103
|
+
"charSet",
|
|
104
|
+
"checked",
|
|
105
|
+
"cite",
|
|
106
|
+
"classID",
|
|
107
|
+
"className",
|
|
108
|
+
"colSpan",
|
|
109
|
+
"cols",
|
|
110
|
+
"content",
|
|
111
|
+
"contentEditable",
|
|
112
|
+
"contextMenu",
|
|
113
|
+
"controls",
|
|
114
|
+
"coords",
|
|
115
|
+
"crossOrigin",
|
|
116
|
+
"data",
|
|
117
|
+
"dateTime",
|
|
118
|
+
"default",
|
|
119
|
+
"defer",
|
|
120
|
+
"dir",
|
|
121
|
+
"disabled",
|
|
122
|
+
"download",
|
|
123
|
+
"draggable",
|
|
124
|
+
"encType",
|
|
125
|
+
"form",
|
|
126
|
+
"formAction",
|
|
127
|
+
"formEncType",
|
|
128
|
+
"formMethod",
|
|
129
|
+
"formNoValidate",
|
|
130
|
+
"formTarget",
|
|
131
|
+
"frameBorder",
|
|
132
|
+
"headers",
|
|
133
|
+
"height",
|
|
134
|
+
"hidden",
|
|
135
|
+
"high",
|
|
136
|
+
"href",
|
|
137
|
+
"hrefLang",
|
|
138
|
+
"htmlFor",
|
|
139
|
+
"httpEquiv",
|
|
140
|
+
"icon",
|
|
141
|
+
"id",
|
|
142
|
+
"inputMode",
|
|
143
|
+
"integrity",
|
|
144
|
+
"is",
|
|
145
|
+
"keyParams",
|
|
146
|
+
"keyType",
|
|
147
|
+
"kind",
|
|
148
|
+
"label",
|
|
149
|
+
"lang",
|
|
150
|
+
"list",
|
|
151
|
+
"loop",
|
|
152
|
+
"low",
|
|
153
|
+
"manifest",
|
|
154
|
+
"marginHeight",
|
|
155
|
+
"marginWidth",
|
|
156
|
+
"max",
|
|
157
|
+
"maxLength",
|
|
158
|
+
"media",
|
|
159
|
+
"mediaGroup",
|
|
160
|
+
"method",
|
|
161
|
+
"min",
|
|
162
|
+
"minLength",
|
|
163
|
+
"multiple",
|
|
164
|
+
"muted",
|
|
165
|
+
"name",
|
|
166
|
+
"noValidate",
|
|
167
|
+
"nonce",
|
|
168
|
+
"open",
|
|
169
|
+
"optimum",
|
|
170
|
+
"pattern",
|
|
171
|
+
"placeholder",
|
|
172
|
+
"poster",
|
|
173
|
+
"preload",
|
|
174
|
+
"profile",
|
|
175
|
+
"radioGroup",
|
|
176
|
+
"readOnly",
|
|
177
|
+
"referrerPolicy",
|
|
178
|
+
"rel",
|
|
179
|
+
"required",
|
|
180
|
+
"reversed",
|
|
181
|
+
"role",
|
|
182
|
+
"rowSpan",
|
|
183
|
+
"rows",
|
|
184
|
+
"sandbox",
|
|
185
|
+
"scope",
|
|
186
|
+
"scoped",
|
|
187
|
+
"scrolling",
|
|
188
|
+
"seamless",
|
|
189
|
+
"selected",
|
|
190
|
+
"shape",
|
|
191
|
+
"size",
|
|
192
|
+
"sizes",
|
|
193
|
+
"span",
|
|
194
|
+
"spellCheck",
|
|
195
|
+
"src",
|
|
196
|
+
"srcDoc",
|
|
197
|
+
"srcLang",
|
|
198
|
+
"srcSet",
|
|
199
|
+
"start",
|
|
200
|
+
"step",
|
|
201
|
+
"style",
|
|
202
|
+
"summary",
|
|
203
|
+
"tabIndex",
|
|
204
|
+
"target",
|
|
205
|
+
"title",
|
|
206
|
+
"type",
|
|
207
|
+
"useMap",
|
|
208
|
+
"value",
|
|
209
|
+
"width",
|
|
210
|
+
"wmode",
|
|
211
|
+
"wrap",
|
|
212
|
+
// Event handlers
|
|
213
|
+
"onCopy",
|
|
214
|
+
"onCut",
|
|
215
|
+
"onPaste",
|
|
216
|
+
"onCompositionEnd",
|
|
217
|
+
"onCompositionStart",
|
|
218
|
+
"onCompositionUpdate",
|
|
219
|
+
"onKeyDown",
|
|
220
|
+
"onKeyPress",
|
|
221
|
+
"onKeyUp",
|
|
222
|
+
"onFocus",
|
|
223
|
+
"onBlur",
|
|
224
|
+
"onChange",
|
|
225
|
+
"onInput",
|
|
226
|
+
"onInvalid",
|
|
227
|
+
"onSubmit",
|
|
228
|
+
"onClick",
|
|
229
|
+
"onContextMenu",
|
|
230
|
+
"onDoubleClick",
|
|
231
|
+
"onDrag",
|
|
232
|
+
"onDragEnd",
|
|
233
|
+
"onDragEnter",
|
|
234
|
+
"onDragExit",
|
|
235
|
+
"onDragLeave",
|
|
236
|
+
"onDragOver",
|
|
237
|
+
"onDragStart",
|
|
238
|
+
"onDrop",
|
|
239
|
+
"onMouseDown",
|
|
240
|
+
"onMouseEnter",
|
|
241
|
+
"onMouseLeave",
|
|
242
|
+
"onMouseMove",
|
|
243
|
+
"onMouseOut",
|
|
244
|
+
"onMouseOver",
|
|
245
|
+
"onMouseUp",
|
|
246
|
+
"onSelect",
|
|
247
|
+
"onTouchCancel",
|
|
248
|
+
"onTouchEnd",
|
|
249
|
+
"onTouchMove",
|
|
250
|
+
"onTouchStart",
|
|
251
|
+
"onScroll",
|
|
252
|
+
"onWheel",
|
|
253
|
+
"onAbort",
|
|
254
|
+
"onCanPlay",
|
|
255
|
+
"onCanPlayThrough",
|
|
256
|
+
"onDurationChange",
|
|
257
|
+
"onEmptied",
|
|
258
|
+
"onEncrypted",
|
|
259
|
+
"onEnded",
|
|
260
|
+
"onError",
|
|
261
|
+
"onLoadedData",
|
|
262
|
+
"onLoadedMetadata",
|
|
263
|
+
"onLoadStart",
|
|
264
|
+
"onPause",
|
|
265
|
+
"onPlay",
|
|
266
|
+
"onPlaying",
|
|
267
|
+
"onProgress",
|
|
268
|
+
"onRateChange",
|
|
269
|
+
"onSeeked",
|
|
270
|
+
"onSeeking",
|
|
271
|
+
"onStalled",
|
|
272
|
+
"onSuspend",
|
|
273
|
+
"onTimeUpdate",
|
|
274
|
+
"onVolumeChange",
|
|
275
|
+
"onWaiting",
|
|
276
|
+
"onLoad",
|
|
277
|
+
"onAnimationStart",
|
|
278
|
+
"onAnimationEnd",
|
|
279
|
+
"onAnimationIteration",
|
|
280
|
+
"onTransitionEnd",
|
|
281
|
+
"onToggle"
|
|
282
|
+
]);
|
|
283
|
+
function $cce662c1d2ec881b$export$457c3d6518dd4c6f(props) {
|
|
284
|
+
const newProps = {};
|
|
285
|
+
for(const key in props){
|
|
286
|
+
if (!key.startsWith("data-") && !$cce662c1d2ec881b$var$validDOMProperties.has(key)) continue;
|
|
287
|
+
newProps[key] = props[key];
|
|
288
|
+
}
|
|
289
|
+
return newProps;
|
|
290
|
+
}
|
|
86
291
|
|
|
87
292
|
|
|
88
293
|
const $ee0105641360f1c1$export$23c260ee8e4dfaad = ({ stretchX: stretchX, stretchY: stretchY, stretchXY: stretchXY, children: children, className: className, position: position, as: as = "div", ...props }, ref)=>{
|
|
@@ -230,7 +435,7 @@ const $e2f278d76a00796a$export$21ee1313e2afe36c = (props, ref)=>{
|
|
|
230
435
|
className: (0, $cce662c1d2ec881b$export$a274e22fb40f762e)(className, inline ? "display-inline-flex" : "display-flex", `flex-direction-${flexDirection}`, wrap && `flex-${wrap}`, justify && `flex-justify-${justify}`, align && `flex-align-${align}`, (0, $0ad0bc75b5eb16a6$export$2db1d02db18b2d82)("gap", gap), (0, $0ad0bc75b5eb16a6$export$2db1d02db18b2d82)("column-gap", columnGap), (0, $0ad0bc75b5eb16a6$export$2db1d02db18b2d82)("row-gap", rowGap)),
|
|
231
436
|
// TODO - Fix types here - seems to work just fine though
|
|
232
437
|
ref: ref,
|
|
233
|
-
...otherProps,
|
|
438
|
+
...(0, $cce662c1d2ec881b$export$457c3d6518dd4c6f)(otherProps),
|
|
234
439
|
children: props.children
|
|
235
440
|
});
|
|
236
441
|
};
|
|
@@ -587,7 +792,7 @@ function $b35ea695a7e1feb7$export$d2dae087199d2383(object) {
|
|
|
587
792
|
|
|
588
793
|
|
|
589
794
|
const $9230e224c5c26d9c$var$ButtonGroupContext = /*#__PURE__*/ $hgUW1$createContext({});
|
|
590
|
-
function $9230e224c5c26d9c$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 }) {
|
|
795
|
+
function $9230e224c5c26d9c$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 }) {
|
|
591
796
|
const cleanProps = (0, $b35ea695a7e1feb7$export$d2dae087199d2383)({
|
|
592
797
|
color: color,
|
|
593
798
|
variant: variant,
|
|
@@ -602,6 +807,10 @@ function $9230e224c5c26d9c$export$69b1032f2ecdf404({ color: color, variant: vari
|
|
|
602
807
|
return /*#__PURE__*/ (0, $hgUW1$jsx)($9230e224c5c26d9c$var$ButtonGroupContext.Provider, {
|
|
603
808
|
value: cleanProps,
|
|
604
809
|
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $41cc567ab0625f8f$export$eef1e68107c58ef2), {
|
|
810
|
+
className: className,
|
|
811
|
+
classNames: classNames,
|
|
812
|
+
style: style,
|
|
813
|
+
styles: styles,
|
|
605
814
|
gap: gap,
|
|
606
815
|
compact: compact,
|
|
607
816
|
children: children
|
|
@@ -654,7 +863,7 @@ const $d95a2216d3ccf702$export$353f5b6fc5456de1 = /*#__PURE__*/ (0, $hgUW1$react
|
|
|
654
863
|
return /*#__PURE__*/ (0, $hgUW1$jsxs)(Comp, {
|
|
655
864
|
style: {
|
|
656
865
|
...style,
|
|
657
|
-
...styles?.
|
|
866
|
+
...styles?.wrapper
|
|
658
867
|
},
|
|
659
868
|
"data-is-toggle": isToggle,
|
|
660
869
|
"data-pressed": isPressed,
|
|
@@ -2768,7 +2977,7 @@ $fac55dfefd316398$export$b5d5cf8927ab7262.displayName = "Switch";
|
|
|
2768
2977
|
|
|
2769
2978
|
|
|
2770
2979
|
|
|
2771
|
-
function $17f80f062b7f107f$export$472062a354075cee({ className: className, classNames: classNames, style: style, styles: styles, name: name, size: size = "sm", orientation: orientation = "horizontal", ...props }) {
|
|
2980
|
+
function $17f80f062b7f107f$export$472062a354075cee({ className: className, classNames: classNames, style: style, styles: styles, name: name, size: size = "sm", color: color, orientation: orientation = "horizontal", ...props }) {
|
|
2772
2981
|
const trackRef = $hgUW1$useRef(null);
|
|
2773
2982
|
const numberFormatter = (0, $hgUW1$useNumberFormatter)();
|
|
2774
2983
|
const state = (0, $hgUW1$useSliderState)({
|
|
@@ -2781,6 +2990,7 @@ function $17f80f062b7f107f$export$472062a354075cee({ className: className, class
|
|
|
2781
2990
|
}, state, trackRef);
|
|
2782
2991
|
const percent = state.getThumbPercent(0);
|
|
2783
2992
|
return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
2993
|
+
"data-color": color,
|
|
2784
2994
|
"data-size": size,
|
|
2785
2995
|
style: {
|
|
2786
2996
|
...style,
|
|
@@ -2795,15 +3005,20 @@ function $17f80f062b7f107f$export$472062a354075cee({ className: className, class
|
|
|
2795
3005
|
children: props.label
|
|
2796
3006
|
}),
|
|
2797
3007
|
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
3008
|
+
...trackProps,
|
|
2798
3009
|
ref: trackRef,
|
|
2799
3010
|
className: (0, $cce662c1d2ec881b$export$a274e22fb40f762e)("p-slider-track", classNames?.track),
|
|
2800
|
-
|
|
3011
|
+
style: {
|
|
3012
|
+
...styles?.track,
|
|
3013
|
+
...trackProps.style
|
|
3014
|
+
},
|
|
2801
3015
|
children: [
|
|
2802
3016
|
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
2803
3017
|
style: {
|
|
3018
|
+
...styles?.fill,
|
|
2804
3019
|
width: `${percent * 100}%`
|
|
2805
3020
|
},
|
|
2806
|
-
className: "p-slider-track-fill"
|
|
3021
|
+
className: (0, $cce662c1d2ec881b$export$a274e22fb40f762e)("p-slider-track-fill", classNames?.fill)
|
|
2807
3022
|
}),
|
|
2808
3023
|
/*#__PURE__*/ (0, $hgUW1$jsx)($17f80f062b7f107f$var$Thumb, {
|
|
2809
3024
|
styles: {
|
|
@@ -2834,14 +3049,15 @@ function $17f80f062b7f107f$var$Thumb({ state: state, trackRef: trackRef, index:
|
|
|
2834
3049
|
}, state);
|
|
2835
3050
|
const { focusProps: focusProps, isFocusVisible: isFocusVisible } = (0, $hgUW1$useFocusRing)();
|
|
2836
3051
|
return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
3052
|
+
...thumbProps,
|
|
2837
3053
|
"data-dragging": isDragging,
|
|
2838
3054
|
"data-focus-visible": isFocusVisible,
|
|
2839
3055
|
className: (0, $cce662c1d2ec881b$export$a274e22fb40f762e)("p-slider-thumb", className, classNames?.wrapper),
|
|
2840
3056
|
style: {
|
|
3057
|
+
...thumbProps.style,
|
|
2841
3058
|
...style,
|
|
2842
3059
|
...styles?.wrapper
|
|
2843
3060
|
},
|
|
2844
|
-
...thumbProps,
|
|
2845
3061
|
children: [
|
|
2846
3062
|
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
2847
3063
|
style: styles?.inner,
|
|
@@ -3543,7 +3759,7 @@ const $31aad62a65b342bc$export$a79147a60006308c = (0, $hgUW1$Item);
|
|
|
3543
3759
|
|
|
3544
3760
|
|
|
3545
3761
|
|
|
3546
|
-
function $b925f0cf89a3187d$export$9feb1bc2e5f1ccb3({ onChange: onChange, color: colorProp }) {
|
|
3762
|
+
function $b925f0cf89a3187d$export$9feb1bc2e5f1ccb3({ onChange: onChange, color: colorProp, styles: styles, classNames: classNames, className: className, style: style }) {
|
|
3547
3763
|
const [colorSpace, setColorSpace] = $hgUW1$useState("hex");
|
|
3548
3764
|
const [color, setColor] = (0, $fda09bbc0161c751$export$40bfa8c7b0832715)(colorProp, (0, $hgUW1$parseColor)("#BB66CC").toFormat("hsla"), onChange);
|
|
3549
3765
|
function handleChange(color) {
|
|
@@ -4040,5 +4256,176 @@ function $8f49d2e6ba434739$export$6e865ea70d7724f(color) {
|
|
|
4040
4256
|
|
|
4041
4257
|
|
|
4042
4258
|
|
|
4043
|
-
|
|
4259
|
+
|
|
4260
|
+
|
|
4261
|
+
|
|
4262
|
+
|
|
4263
|
+
|
|
4264
|
+
|
|
4265
|
+
const $aae8cd5f0e2ea26c$var$ToggleGroupContext = /*#__PURE__*/ $hgUW1$createContext(null);
|
|
4266
|
+
function $aae8cd5f0e2ea26c$export$af3ec21f6cfb5e30({ children: children, mode: mode = "single", value: value, defaultValue: defaultValue, onChange: onChange, validate: validate, styles: styles, classNames: classNames, className: className, style: style, ...props }) {
|
|
4267
|
+
const Wrapper = $hgUW1$useMemo(()=>{
|
|
4268
|
+
if (mode === "single") return $aae8cd5f0e2ea26c$var$SingleSelectGroup;
|
|
4269
|
+
return $aae8cd5f0e2ea26c$var$MultiSelectGroup;
|
|
4270
|
+
}, [
|
|
4271
|
+
mode
|
|
4272
|
+
]);
|
|
4273
|
+
props = {
|
|
4274
|
+
...props
|
|
4275
|
+
};
|
|
4276
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $095d89378519ff08$export$a455218a85c89869), {
|
|
4277
|
+
label: props.label,
|
|
4278
|
+
replaceDefaultControlWrapper: true,
|
|
4279
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)(Wrapper, {
|
|
4280
|
+
value: value,
|
|
4281
|
+
defaultValue: defaultValue,
|
|
4282
|
+
onChange: onChange,
|
|
4283
|
+
validate: validate,
|
|
4284
|
+
...props,
|
|
4285
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $41cc567ab0625f8f$export$eef1e68107c58ef2), {
|
|
4286
|
+
className: className,
|
|
4287
|
+
styles: styles,
|
|
4288
|
+
classNames: classNames,
|
|
4289
|
+
style: style,
|
|
4290
|
+
...props,
|
|
4291
|
+
children: children
|
|
4292
|
+
})
|
|
4293
|
+
})
|
|
4294
|
+
});
|
|
4295
|
+
}
|
|
4296
|
+
function $aae8cd5f0e2ea26c$var$SingleSelectGroup({ children: children, orientation: orientation = "horizontal", ...props }) {
|
|
4297
|
+
const state = (0, $hgUW1$useRadioGroupState)(props);
|
|
4298
|
+
const { radioGroupProps: radioGroupProps } = (0, $hgUW1$useRadioGroup)({
|
|
4299
|
+
...props,
|
|
4300
|
+
orientation: orientation,
|
|
4301
|
+
"aria-label": "single toggle group"
|
|
4302
|
+
}, state);
|
|
4303
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
4304
|
+
...radioGroupProps,
|
|
4305
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)($aae8cd5f0e2ea26c$var$ToggleGroupContext.Provider, {
|
|
4306
|
+
value: {
|
|
4307
|
+
state: state,
|
|
4308
|
+
mode: "single",
|
|
4309
|
+
props: props
|
|
4310
|
+
},
|
|
4311
|
+
children: children
|
|
4312
|
+
})
|
|
4313
|
+
});
|
|
4314
|
+
}
|
|
4315
|
+
function $aae8cd5f0e2ea26c$var$MultiSelectGroup({ children: children, ...props }) {
|
|
4316
|
+
const state = (0, $hgUW1$useCheckboxGroupState)(props);
|
|
4317
|
+
const { groupProps: groupProps } = (0, $hgUW1$useCheckboxGroup)({
|
|
4318
|
+
...props,
|
|
4319
|
+
"aria-label": "multiple toggle group"
|
|
4320
|
+
}, state);
|
|
4321
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
4322
|
+
...groupProps,
|
|
4323
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)($aae8cd5f0e2ea26c$var$ToggleGroupContext.Provider, {
|
|
4324
|
+
value: {
|
|
4325
|
+
state: state,
|
|
4326
|
+
mode: "multiple",
|
|
4327
|
+
props: props
|
|
4328
|
+
},
|
|
4329
|
+
children: children
|
|
4330
|
+
})
|
|
4331
|
+
});
|
|
4332
|
+
}
|
|
4333
|
+
function $aae8cd5f0e2ea26c$var$SingleToggle({ ...props }) {
|
|
4334
|
+
const ctx = $hgUW1$useContext($aae8cd5f0e2ea26c$var$ToggleGroupContext);
|
|
4335
|
+
const state = ctx?.state;
|
|
4336
|
+
const ref = $hgUW1$useRef(null);
|
|
4337
|
+
if (!ctx) throw new Error("Toggle must be used within a ToggleGroup");
|
|
4338
|
+
const { focusProps: focusProps, isFocusVisible: isFocusVisible } = (0, $hgUW1$useFocusRing)();
|
|
4339
|
+
const isSelected = state.selectedValue === props.value;
|
|
4340
|
+
const { inputProps: inputProps } = (0, $hgUW1$useRadio)(props, ctx.state, ref);
|
|
4341
|
+
return /*#__PURE__*/ (0, $hgUW1$jsxs)($aae8cd5f0e2ea26c$var$ToggleButton, {
|
|
4342
|
+
isSelected: isSelected,
|
|
4343
|
+
isFocusVisible: isFocusVisible,
|
|
4344
|
+
children: [
|
|
4345
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$VisuallyHidden), {
|
|
4346
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("input", {
|
|
4347
|
+
ref: ref,
|
|
4348
|
+
...(0, $hgUW1$mergeProps)(inputProps, focusProps)
|
|
4349
|
+
})
|
|
4350
|
+
}),
|
|
4351
|
+
props.children
|
|
4352
|
+
]
|
|
4353
|
+
});
|
|
4354
|
+
}
|
|
4355
|
+
function $aae8cd5f0e2ea26c$var$MultiToggle({ ...props }) {
|
|
4356
|
+
const ctx = $hgUW1$useContext($aae8cd5f0e2ea26c$var$ToggleGroupContext);
|
|
4357
|
+
const state = ctx?.state;
|
|
4358
|
+
const ref = $hgUW1$useRef(null);
|
|
4359
|
+
if (!ctx) throw new Error("Toggle must be used within a ToggleGroup");
|
|
4360
|
+
const { focusProps: focusProps, isFocusVisible: isFocusVisible } = (0, $hgUW1$useFocusRing)();
|
|
4361
|
+
const isSelected = state.isSelected(props.value);
|
|
4362
|
+
const { inputProps: inputProps } = (0, $hgUW1$useCheckboxGroupItem)(props, ctx.state, ref);
|
|
4363
|
+
return /*#__PURE__*/ (0, $hgUW1$jsxs)($aae8cd5f0e2ea26c$var$ToggleButton, {
|
|
4364
|
+
isSelected: isSelected,
|
|
4365
|
+
isFocusVisible: isFocusVisible,
|
|
4366
|
+
children: [
|
|
4367
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$VisuallyHidden), {
|
|
4368
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("input", {
|
|
4369
|
+
ref: ref,
|
|
4370
|
+
...(0, $hgUW1$mergeProps)(inputProps, focusProps)
|
|
4371
|
+
})
|
|
4372
|
+
}),
|
|
4373
|
+
props.children
|
|
4374
|
+
]
|
|
4375
|
+
});
|
|
4376
|
+
}
|
|
4377
|
+
const $aae8cd5f0e2ea26c$var$ToggleContext = /*#__PURE__*/ $hgUW1$createContext(null);
|
|
4378
|
+
function $aae8cd5f0e2ea26c$export$bea8ebba691c5813({ ...props }) {
|
|
4379
|
+
const ctx = $hgUW1$useContext($aae8cd5f0e2ea26c$var$ToggleGroupContext);
|
|
4380
|
+
if (!ctx) throw new Error("Toggle must be used within a ToggleGroup");
|
|
4381
|
+
const Wrapper = $hgUW1$useMemo(()=>{
|
|
4382
|
+
if (ctx?.mode === "single") return $aae8cd5f0e2ea26c$var$SingleToggle;
|
|
4383
|
+
return $aae8cd5f0e2ea26c$var$MultiToggle;
|
|
4384
|
+
}, [
|
|
4385
|
+
ctx?.mode
|
|
4386
|
+
]);
|
|
4387
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)($aae8cd5f0e2ea26c$var$ToggleContext.Provider, {
|
|
4388
|
+
value: {
|
|
4389
|
+
props: props
|
|
4390
|
+
},
|
|
4391
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)(Wrapper, {
|
|
4392
|
+
value: props.value,
|
|
4393
|
+
children: props.children
|
|
4394
|
+
})
|
|
4395
|
+
});
|
|
4396
|
+
}
|
|
4397
|
+
function $aae8cd5f0e2ea26c$var$ToggleButton({ children: children, isFocusVisible: isFocusVisible, isSelected: isSelected, ...props }) {
|
|
4398
|
+
const ctx = $hgUW1$useContext($aae8cd5f0e2ea26c$var$ToggleContext)?.props;
|
|
4399
|
+
const groupCtx = $hgUW1$useContext($aae8cd5f0e2ea26c$var$ToggleGroupContext);
|
|
4400
|
+
if (!ctx || !groupCtx) throw new Error("Toggle must be used within a ToggleGroup");
|
|
4401
|
+
const theme = (0, $5fc28f26e128d5c0$export$93d4e7f90805808f)();
|
|
4402
|
+
const space = (0, $41cc567ab0625f8f$export$450c36e0b0e62ccd)();
|
|
4403
|
+
const idleColor = ctx.idleColor ?? groupCtx.props.idleColor ?? "gray";
|
|
4404
|
+
const activeColor = ctx.activeColor ?? groupCtx.props.activeColor ?? theme?.color ?? "gray";
|
|
4405
|
+
const idleVariant = ctx.idleVariant ?? groupCtx.props.idleVariant ?? "light";
|
|
4406
|
+
const activeVariant = ctx.activeVariant ?? groupCtx.props.activeVariant ?? "solid";
|
|
4407
|
+
const color = isSelected ? activeColor : idleColor;
|
|
4408
|
+
const variant = isSelected ? activeVariant : idleVariant;
|
|
4409
|
+
const radius = ctx.radius ?? groupCtx.props.radius ?? "full";
|
|
4410
|
+
const size = ctx.size ?? groupCtx.props.size ?? "md";
|
|
4411
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)("label", {
|
|
4412
|
+
"data-icon-button": ctx.isIconButton,
|
|
4413
|
+
"data-is-toggle": true,
|
|
4414
|
+
"data-radius": radius,
|
|
4415
|
+
"data-color": color,
|
|
4416
|
+
"data-variant": variant,
|
|
4417
|
+
className: (0, $cce662c1d2ec881b$export$a274e22fb40f762e)("p-button", ctx.className, ctx.classNames?.wrapper, `size-${size}`, space.classNames),
|
|
4418
|
+
"data-selected": isSelected,
|
|
4419
|
+
"data-focus-visible": isFocusVisible,
|
|
4420
|
+
...props,
|
|
4421
|
+
children: children
|
|
4422
|
+
});
|
|
4423
|
+
}
|
|
4424
|
+
|
|
4425
|
+
|
|
4426
|
+
|
|
4427
|
+
|
|
4428
|
+
|
|
4429
|
+
|
|
4430
|
+
export {$ee0105641360f1c1$export$e71c4d32a2263218 as Box, $11bc53f9891a6532$export$ef2184bd89960b14 as Grid, $11bc53f9891a6532$export$9eb849b9b922d396 as GridItem, $e2f278d76a00796a$export$f51f4c4ede09e011 as Flex, $ef10b8551376ecd8$export$f5b8910cec6cf069 as Input, $2e89c7375b40283e$export$6bf0cd3a219bbade as NumberInput, $3157c40f7d0e6fa2$export$5f1af8db9871e1d6 as Text, $7794de767effca39$export$379139ebc1c2b235 as Textarea, $d95a2216d3ccf702$export$353f5b6fc5456de1 as Button, $e3f71af5eaf1c216$export$c25acd513dcc8062 as IconButton, $9230e224c5c26d9c$export$69b1032f2ecdf404 as ButtonGroup, $0ca204e719955216$export$48513f6b9f8ce62d as Checkbox, $1ab2e355b7aa4310$export$4aa08d5625cb8ead as CheckboxGroup, $3ba60d401cc6cc09$export$e44a253a59704894 as DropdownMenu, $618e53c42107439d$export$72b9695b8216309a as ComboBox, $e00a258f2e8c7774$export$d7b12c4107be0d61 as Radio, $e00a258f2e8c7774$export$a98f0dcb43a68a25 as RadioGroup, $e3711da06539818f$export$f8afaea2e9656b91 as RadioCard, $9f79d30a629e2c71$export$ef9b1a59e592288f as Select, $c35269c9504bc94d$export$5b7f4051a57920d0 as Option, $c35269c9504bc94d$export$5b7f4051a57920d0 as ListBoxItem, $c35269c9504bc94d$export$ef146090a6472d9e as Section, $c35269c9504bc94d$export$ef146090a6472d9e as ListBoxSection, $48aceaf3289ec325$export$7edc06cf1783b30f as DateInput, $11e1beb2a56c81ba$export$e1aef45b828286de as Calendar, $55bcc0e5986993c4$export$e2255cf6045e8d47 as Avatar, $f9f5a5b674d0a63f$export$1a5cb5295a7d2749 as FileUploader, $1a0bc09c6bea5bcc$export$1ff3c3f08ae963c0 as Separator, $2cc726bf01dd2fe8$export$b25a304ec7d746bb as Progress, $e1148cdb3a130657$export$3b0d6d7590275603 as Loader, $c700d45659d35204$export$3288d34c523a1192 as Tag, $fac55dfefd316398$export$b5d5cf8927ab7262 as Switch, $17f80f062b7f107f$export$472062a354075cee as Slider, $62ecff109eaa29fb$export$50e381fea3a45244 as IconTray, $6bbafdf52af7a191$export$ea98c603db73aee7 as Sticker, $28ce03a907630a4d$export$b2539bed5023c21c as Tabs, $28ce03a907630a4d$export$6d08773d2e66f8f2 as Tab, $18afd8c09c9f3065$export$54ec01a60f47d33d as Table, $727b3a4d9b39464f$export$e6a97ba2cae5bb94 as Timeline, $4bad2c10a2b6e638$export$2b77a92f1a5ad772 as Modal, $4bad2c10a2b6e638$export$33ffd74ebf07f060 as useModal, $41cc567ab0625f8f$export$eef1e68107c58ef2 as Space, $aca304249f917497$export$39299b56cfd4e361 as TagInput, $61ac9d13c14b7f5b$export$5b6b19405a83ff9d as Popover, $61ac9d13c14b7f5b$export$d7e1f420b25549ff as PopoverContent, $61ac9d13c14b7f5b$export$7dacb05d26466c3 as PopoverTrigger, $31aad62a65b342bc$export$67ea30858aaf75e3 as TagGroup, $31aad62a65b342bc$export$a79147a60006308c as TagGroupItem, $5fc28f26e128d5c0$export$d8964aec282183a3 as ThemeProvider, $5fc28f26e128d5c0$export$93d4e7f90805808f as useTheme, $d03055b0909e9e3a$export$b2103f68a961418e as ColorArea, $2abac2409e7cef4a$export$b865d4358897bb17 as ColorField, $b925f0cf89a3187d$export$9feb1bc2e5f1ccb3 as ColorPicker, $216a62c521cf5bbd$export$44fd664bcca5b6fb as ColorSlider, $a364ffae99b57fd7$export$b46792416e3d8515 as ColorSwatchPicker, $8f49d2e6ba434739$export$6e865ea70d7724f as parseColor, $aae8cd5f0e2ea26c$export$bea8ebba691c5813 as Toggle, $aae8cd5f0e2ea26c$export$af3ec21f6cfb5e30 as ToggleGroup};
|
|
4044
4431
|
//# sourceMappingURL=module.js.map
|