@parrot-co/parrot-ui 0.1.10 → 0.1.12
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 +178 -3
- package/dist/main.js.map +1 -1
- package/dist/module.js +177 -4
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +32 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
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) {
|
|
@@ -740,10 +742,11 @@ function $ec2376a5dd0d13e6$export$a455218a85c89869({ label: label, description:
|
|
|
740
742
|
$ec2376a5dd0d13e6$export$a455218a85c89869.displayName = "Field";
|
|
741
743
|
|
|
742
744
|
|
|
743
|
-
function $d9ffc65197682590$export$f5b8910cec6cf069({ className: className, classNames: classNames, style: style, styles: styles, inputRef: inputRef, ...props }) {
|
|
745
|
+
function $d9ffc65197682590$export$f5b8910cec6cf069({ className: className, classNames: classNames, style: style, styles: styles, onChange: onChange, inputRef: inputRef, ...props }) {
|
|
744
746
|
const internalInputRef = (0, ($parcel$interopDefault($8zHUo$react))).useRef(null);
|
|
745
747
|
const { labelProps: labelProps, inputProps: inputProps, errorMessageProps: errorMessageProps, descriptionProps: descriptionProps } = (0, $8zHUo$reactaria.useTextField)({
|
|
746
748
|
...props,
|
|
749
|
+
onChange: onChange,
|
|
747
750
|
inputElementType: "input"
|
|
748
751
|
}, internalInputRef);
|
|
749
752
|
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $ec2376a5dd0d13e6$export$a455218a85c89869), {
|
|
@@ -756,7 +759,7 @@ function $d9ffc65197682590$export$f5b8910cec6cf069({ className: className, class
|
|
|
756
759
|
style: style,
|
|
757
760
|
...props,
|
|
758
761
|
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("input", {
|
|
759
|
-
ref: (0, $62f1c614c0962470$export$c9058316764c140e)(
|
|
762
|
+
ref: (0, $62f1c614c0962470$export$c9058316764c140e)(inputRef, internalInputRef),
|
|
760
763
|
"data-has-left-addon": !!props.prepend,
|
|
761
764
|
"data-has-right-addon": !!props.append,
|
|
762
765
|
className: (0, $62f1c614c0962470$export$a274e22fb40f762e)("p-text-input-el"),
|
|
@@ -987,12 +990,13 @@ $3af04cd154cf4de1$export$c25acd513dcc8062.displayName = "IconButton";
|
|
|
987
990
|
|
|
988
991
|
|
|
989
992
|
|
|
990
|
-
function $77c71203b3212c65$export$6bf0cd3a219bbade({ appearance: appearance = "outline", size: size = "md", color: color = "gray", classNames: classNames, styles: styles, append: append, prepend: prepend, placeholder: placeholder, showSteppers: showSteppers = false, error: error, label: label, minValue: minValue, maxValue: maxValue, formatOptions: formatOptions, inputRef: inputRef, incrementIcon: incrementIcon, decrementIcon: decrementIcon, ...props }) {
|
|
993
|
+
function $77c71203b3212c65$export$6bf0cd3a219bbade({ appearance: appearance = "outline", size: size = "md", color: color = "gray", classNames: classNames, styles: styles, append: append, prepend: prepend, placeholder: placeholder, showSteppers: showSteppers = false, error: error, label: label, minValue: minValue, maxValue: maxValue, formatOptions: formatOptions, inputRef: inputRef, incrementIcon: incrementIcon, decrementIcon: decrementIcon, onChange: onChange, ...props }) {
|
|
991
994
|
const ariaProps = {
|
|
992
995
|
...props,
|
|
993
996
|
maxValue: maxValue,
|
|
994
997
|
formatOptions: formatOptions,
|
|
995
998
|
minValue: minValue,
|
|
999
|
+
onChange: onChange,
|
|
996
1000
|
"aria-label": props["aria-label"] ?? "number input"
|
|
997
1001
|
};
|
|
998
1002
|
const space = (0, $eae337549f49a5a2$export$450c36e0b0e62ccd)();
|
|
@@ -4321,4 +4325,175 @@ function $e93fd810053d36a8$export$6e865ea70d7724f(color) {
|
|
|
4321
4325
|
|
|
4322
4326
|
|
|
4323
4327
|
|
|
4328
|
+
|
|
4329
|
+
|
|
4330
|
+
|
|
4331
|
+
|
|
4332
|
+
|
|
4333
|
+
|
|
4334
|
+
const $fcb2cacda3f71fdc$var$ToggleGroupContext = /*#__PURE__*/ $8zHUo$react.createContext(null);
|
|
4335
|
+
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 }) {
|
|
4336
|
+
const Wrapper = $8zHUo$react.useMemo(()=>{
|
|
4337
|
+
if (mode === "single") return $fcb2cacda3f71fdc$var$SingleSelectGroup;
|
|
4338
|
+
return $fcb2cacda3f71fdc$var$MultiSelectGroup;
|
|
4339
|
+
}, [
|
|
4340
|
+
mode
|
|
4341
|
+
]);
|
|
4342
|
+
props = {
|
|
4343
|
+
...props
|
|
4344
|
+
};
|
|
4345
|
+
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $ec2376a5dd0d13e6$export$a455218a85c89869), {
|
|
4346
|
+
label: props.label,
|
|
4347
|
+
replaceDefaultControlWrapper: true,
|
|
4348
|
+
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)(Wrapper, {
|
|
4349
|
+
value: value,
|
|
4350
|
+
defaultValue: defaultValue,
|
|
4351
|
+
onChange: onChange,
|
|
4352
|
+
validate: validate,
|
|
4353
|
+
...props,
|
|
4354
|
+
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $eae337549f49a5a2$export$eef1e68107c58ef2), {
|
|
4355
|
+
className: className,
|
|
4356
|
+
styles: styles,
|
|
4357
|
+
classNames: classNames,
|
|
4358
|
+
style: style,
|
|
4359
|
+
...props,
|
|
4360
|
+
children: children
|
|
4361
|
+
})
|
|
4362
|
+
})
|
|
4363
|
+
});
|
|
4364
|
+
}
|
|
4365
|
+
function $fcb2cacda3f71fdc$var$SingleSelectGroup({ children: children, orientation: orientation = "horizontal", ...props }) {
|
|
4366
|
+
const state = (0, $8zHUo$reactstately.useRadioGroupState)(props);
|
|
4367
|
+
const { radioGroupProps: radioGroupProps } = (0, $8zHUo$reactaria.useRadioGroup)({
|
|
4368
|
+
...props,
|
|
4369
|
+
orientation: orientation,
|
|
4370
|
+
"aria-label": "single toggle group"
|
|
4371
|
+
}, state);
|
|
4372
|
+
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("div", {
|
|
4373
|
+
...radioGroupProps,
|
|
4374
|
+
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)($fcb2cacda3f71fdc$var$ToggleGroupContext.Provider, {
|
|
4375
|
+
value: {
|
|
4376
|
+
state: state,
|
|
4377
|
+
mode: "single",
|
|
4378
|
+
props: props
|
|
4379
|
+
},
|
|
4380
|
+
children: children
|
|
4381
|
+
})
|
|
4382
|
+
});
|
|
4383
|
+
}
|
|
4384
|
+
function $fcb2cacda3f71fdc$var$MultiSelectGroup({ children: children, ...props }) {
|
|
4385
|
+
const state = (0, $8zHUo$reactstately.useCheckboxGroupState)(props);
|
|
4386
|
+
const { groupProps: groupProps } = (0, $8zHUo$reactaria.useCheckboxGroup)({
|
|
4387
|
+
...props,
|
|
4388
|
+
"aria-label": "multiple toggle group"
|
|
4389
|
+
}, state);
|
|
4390
|
+
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("div", {
|
|
4391
|
+
...groupProps,
|
|
4392
|
+
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)($fcb2cacda3f71fdc$var$ToggleGroupContext.Provider, {
|
|
4393
|
+
value: {
|
|
4394
|
+
state: state,
|
|
4395
|
+
mode: "multiple",
|
|
4396
|
+
props: props
|
|
4397
|
+
},
|
|
4398
|
+
children: children
|
|
4399
|
+
})
|
|
4400
|
+
});
|
|
4401
|
+
}
|
|
4402
|
+
function $fcb2cacda3f71fdc$var$SingleToggle({ ...props }) {
|
|
4403
|
+
const ctx = $8zHUo$react.useContext($fcb2cacda3f71fdc$var$ToggleGroupContext);
|
|
4404
|
+
const state = ctx?.state;
|
|
4405
|
+
const ref = $8zHUo$react.useRef(null);
|
|
4406
|
+
if (!ctx) throw new Error("Toggle must be used within a ToggleGroup");
|
|
4407
|
+
const { focusProps: focusProps, isFocusVisible: isFocusVisible } = (0, $8zHUo$reactaria.useFocusRing)();
|
|
4408
|
+
const isSelected = state.selectedValue === props.value;
|
|
4409
|
+
const { inputProps: inputProps } = (0, $8zHUo$reactaria.useRadio)(props, ctx.state, ref);
|
|
4410
|
+
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)($fcb2cacda3f71fdc$var$ToggleButton, {
|
|
4411
|
+
isSelected: isSelected,
|
|
4412
|
+
isFocusVisible: isFocusVisible,
|
|
4413
|
+
children: [
|
|
4414
|
+
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $8zHUo$reactaria.VisuallyHidden), {
|
|
4415
|
+
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("input", {
|
|
4416
|
+
ref: ref,
|
|
4417
|
+
...(0, $8zHUo$reactaria.mergeProps)(inputProps, focusProps)
|
|
4418
|
+
})
|
|
4419
|
+
}),
|
|
4420
|
+
props.children
|
|
4421
|
+
]
|
|
4422
|
+
});
|
|
4423
|
+
}
|
|
4424
|
+
function $fcb2cacda3f71fdc$var$MultiToggle({ ...props }) {
|
|
4425
|
+
const ctx = $8zHUo$react.useContext($fcb2cacda3f71fdc$var$ToggleGroupContext);
|
|
4426
|
+
const state = ctx?.state;
|
|
4427
|
+
const ref = $8zHUo$react.useRef(null);
|
|
4428
|
+
if (!ctx) throw new Error("Toggle must be used within a ToggleGroup");
|
|
4429
|
+
const { focusProps: focusProps, isFocusVisible: isFocusVisible } = (0, $8zHUo$reactaria.useFocusRing)();
|
|
4430
|
+
const isSelected = state.isSelected(props.value);
|
|
4431
|
+
const { inputProps: inputProps } = (0, $8zHUo$reactaria.useCheckboxGroupItem)(props, ctx.state, ref);
|
|
4432
|
+
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)($fcb2cacda3f71fdc$var$ToggleButton, {
|
|
4433
|
+
isSelected: isSelected,
|
|
4434
|
+
isFocusVisible: isFocusVisible,
|
|
4435
|
+
children: [
|
|
4436
|
+
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $8zHUo$reactaria.VisuallyHidden), {
|
|
4437
|
+
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("input", {
|
|
4438
|
+
ref: ref,
|
|
4439
|
+
...(0, $8zHUo$reactaria.mergeProps)(inputProps, focusProps)
|
|
4440
|
+
})
|
|
4441
|
+
}),
|
|
4442
|
+
props.children
|
|
4443
|
+
]
|
|
4444
|
+
});
|
|
4445
|
+
}
|
|
4446
|
+
const $fcb2cacda3f71fdc$var$ToggleContext = /*#__PURE__*/ $8zHUo$react.createContext(null);
|
|
4447
|
+
function $fcb2cacda3f71fdc$export$bea8ebba691c5813({ ...props }) {
|
|
4448
|
+
const ctx = $8zHUo$react.useContext($fcb2cacda3f71fdc$var$ToggleGroupContext);
|
|
4449
|
+
if (!ctx) throw new Error("Toggle must be used within a ToggleGroup");
|
|
4450
|
+
const Wrapper = $8zHUo$react.useMemo(()=>{
|
|
4451
|
+
if (ctx?.mode === "single") return $fcb2cacda3f71fdc$var$SingleToggle;
|
|
4452
|
+
return $fcb2cacda3f71fdc$var$MultiToggle;
|
|
4453
|
+
}, [
|
|
4454
|
+
ctx?.mode
|
|
4455
|
+
]);
|
|
4456
|
+
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)($fcb2cacda3f71fdc$var$ToggleContext.Provider, {
|
|
4457
|
+
value: {
|
|
4458
|
+
props: props
|
|
4459
|
+
},
|
|
4460
|
+
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)(Wrapper, {
|
|
4461
|
+
value: props.value,
|
|
4462
|
+
children: props.children
|
|
4463
|
+
})
|
|
4464
|
+
});
|
|
4465
|
+
}
|
|
4466
|
+
function $fcb2cacda3f71fdc$var$ToggleButton({ children: children, isFocusVisible: isFocusVisible, isSelected: isSelected, ...props }) {
|
|
4467
|
+
const ctx = $8zHUo$react.useContext($fcb2cacda3f71fdc$var$ToggleContext)?.props;
|
|
4468
|
+
const groupCtx = $8zHUo$react.useContext($fcb2cacda3f71fdc$var$ToggleGroupContext);
|
|
4469
|
+
if (!ctx || !groupCtx) throw new Error("Toggle must be used within a ToggleGroup");
|
|
4470
|
+
const theme = (0, $f2fd0cbe11b7f0dd$export$93d4e7f90805808f)();
|
|
4471
|
+
const space = (0, $eae337549f49a5a2$export$450c36e0b0e62ccd)();
|
|
4472
|
+
const idleColor = ctx.idleColor ?? groupCtx.props.idleColor ?? "gray";
|
|
4473
|
+
const activeColor = ctx.activeColor ?? groupCtx.props.activeColor ?? theme?.color ?? "gray";
|
|
4474
|
+
const idleVariant = ctx.idleVariant ?? groupCtx.props.idleVariant ?? "light";
|
|
4475
|
+
const activeVariant = ctx.activeVariant ?? groupCtx.props.activeVariant ?? "solid";
|
|
4476
|
+
const color = isSelected ? activeColor : idleColor;
|
|
4477
|
+
const variant = isSelected ? activeVariant : idleVariant;
|
|
4478
|
+
const radius = ctx.radius ?? groupCtx.props.radius ?? "full";
|
|
4479
|
+
const size = ctx.size ?? groupCtx.props.size ?? "md";
|
|
4480
|
+
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("label", {
|
|
4481
|
+
"data-icon-button": ctx.isIconButton,
|
|
4482
|
+
"data-is-toggle": true,
|
|
4483
|
+
"data-radius": radius,
|
|
4484
|
+
"data-color": color,
|
|
4485
|
+
"data-variant": variant,
|
|
4486
|
+
className: (0, $62f1c614c0962470$export$a274e22fb40f762e)("p-button", ctx.className, ctx.classNames?.wrapper, `size-${size}`, space.classNames),
|
|
4487
|
+
"data-selected": isSelected,
|
|
4488
|
+
"data-focus-visible": isFocusVisible,
|
|
4489
|
+
...props,
|
|
4490
|
+
children: children
|
|
4491
|
+
});
|
|
4492
|
+
}
|
|
4493
|
+
|
|
4494
|
+
|
|
4495
|
+
|
|
4496
|
+
|
|
4497
|
+
|
|
4498
|
+
|
|
4324
4499
|
//# sourceMappingURL=main.js.map
|