@photonix/basic 3.0.0 → 3.1.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/index.css +270 -14
- package/dist/index.d.mts +259 -2
- package/dist/index.d.ts +259 -2
- package/dist/index.js +1877 -349
- package/dist/index.mjs +1880 -363
- package/package.json +4 -3
package/dist/index.mjs
CHANGED
|
@@ -4869,11 +4869,16 @@ var Text_default = {};
|
|
|
4869
4869
|
|
|
4870
4870
|
// ../ultimate/src/components/text/Text.tsx
|
|
4871
4871
|
import { jsx as jsx201 } from "react/jsx-runtime";
|
|
4872
|
-
var getVariantVars = (value) => {
|
|
4872
|
+
var getVariantVars = (value, weight) => {
|
|
4873
4873
|
if (!value) return {};
|
|
4874
4874
|
const vars = {};
|
|
4875
4875
|
const breakpoints = ["base", "sm", "md", "lg", "xl", "2xl"];
|
|
4876
|
-
const getWeightToken = (variant) =>
|
|
4876
|
+
const getWeightToken = (variant) => {
|
|
4877
|
+
if (weight === "regular") return `var(--${variant}-weight, var(--body-md-weight))`;
|
|
4878
|
+
if (weight === "medium") return `var(--${variant}-weight-emphasize, var(--label-md-weight-emphasize))`;
|
|
4879
|
+
if (weight === "bold") return "var(--display-lg-weight)";
|
|
4880
|
+
return variant.startsWith("title-") || variant.startsWith("label-") ? `var(--${variant}-weight-emphasize)` : `var(--${variant}-weight)`;
|
|
4881
|
+
};
|
|
4877
4882
|
if (typeof value === "object" && value !== null) {
|
|
4878
4883
|
breakpoints.forEach((bp) => {
|
|
4879
4884
|
const v = value[bp];
|
|
@@ -4943,7 +4948,7 @@ var Text = React202.forwardRef(
|
|
|
4943
4948
|
].filter(Boolean).join(" ");
|
|
4944
4949
|
const inlineStyles = {
|
|
4945
4950
|
...style,
|
|
4946
|
-
...getVariantVars(variant),
|
|
4951
|
+
...getVariantVars(variant, weight),
|
|
4947
4952
|
...getAlignVars(align),
|
|
4948
4953
|
...typeof truncate === "number" && {
|
|
4949
4954
|
"--line-clamp": truncate
|
|
@@ -5032,6 +5037,10 @@ function getElementRef(element) {
|
|
|
5032
5037
|
}
|
|
5033
5038
|
function mergeProps(slotProps, childProps) {
|
|
5034
5039
|
const mergedProps = { ...childProps, ...slotProps };
|
|
5040
|
+
if (childProps.disabled === true) mergedProps.disabled = true;
|
|
5041
|
+
if (childProps["aria-disabled"] === true || childProps["aria-disabled"] === "true") {
|
|
5042
|
+
mergedProps["aria-disabled"] = childProps["aria-disabled"];
|
|
5043
|
+
}
|
|
5035
5044
|
Object.keys(childProps).forEach((propName) => {
|
|
5036
5045
|
const childPropValue = childProps[propName];
|
|
5037
5046
|
const slotPropValue = slotProps[propName];
|
|
@@ -5039,7 +5048,7 @@ function mergeProps(slotProps, childProps) {
|
|
|
5039
5048
|
if (isEventHandler && typeof childPropValue === "function" && typeof slotPropValue === "function") {
|
|
5040
5049
|
mergedProps[propName] = (...args) => {
|
|
5041
5050
|
childPropValue(...args);
|
|
5042
|
-
slotPropValue(...args);
|
|
5051
|
+
if (!args[0]?.defaultPrevented) slotPropValue(...args);
|
|
5043
5052
|
};
|
|
5044
5053
|
} else if (propName === "className") {
|
|
5045
5054
|
mergedProps[propName] = [childPropValue, slotPropValue].filter(Boolean).join(" ");
|
|
@@ -5060,6 +5069,20 @@ var Slot = React204.forwardRef(
|
|
|
5060
5069
|
}
|
|
5061
5070
|
const childRef = getElementRef(child);
|
|
5062
5071
|
const props = mergeProps(slotProps, child.props);
|
|
5072
|
+
if (props.disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true") {
|
|
5073
|
+
const block = (event) => {
|
|
5074
|
+
event.preventDefault();
|
|
5075
|
+
event.stopPropagation();
|
|
5076
|
+
};
|
|
5077
|
+
const onKeyDown = props.onKeyDown;
|
|
5078
|
+
props.onClick = block;
|
|
5079
|
+
props.onAuxClick = block;
|
|
5080
|
+
props.onKeyDown = (event) => {
|
|
5081
|
+
if (event.key === "Enter" || event.key === " ") block(event);
|
|
5082
|
+
else onKeyDown?.(event);
|
|
5083
|
+
};
|
|
5084
|
+
props.tabIndex = -1;
|
|
5085
|
+
}
|
|
5063
5086
|
if (childRef || forwardedRef) {
|
|
5064
5087
|
props.ref = composeRefs(childRef, forwardedRef);
|
|
5065
5088
|
}
|
|
@@ -5231,6 +5254,7 @@ var Button = React207.forwardRef(
|
|
|
5231
5254
|
{
|
|
5232
5255
|
className: buttonClasses,
|
|
5233
5256
|
ref,
|
|
5257
|
+
disabled: disabled || isLoading,
|
|
5234
5258
|
"aria-disabled": isLoading || disabled || void 0,
|
|
5235
5259
|
"data-loading": isLoading || void 0,
|
|
5236
5260
|
...rest,
|
|
@@ -5267,7 +5291,7 @@ var Button = React207.forwardRef(
|
|
|
5267
5291
|
{
|
|
5268
5292
|
className: buttonClasses,
|
|
5269
5293
|
ref,
|
|
5270
|
-
disabled,
|
|
5294
|
+
disabled: disabled || isLoading,
|
|
5271
5295
|
"aria-disabled": isLoading || disabled || void 0,
|
|
5272
5296
|
"data-loading": isLoading || void 0,
|
|
5273
5297
|
...rest,
|
|
@@ -5337,7 +5361,7 @@ var IconButton = React208.forwardRef(
|
|
|
5337
5361
|
{
|
|
5338
5362
|
className: buttonClasses,
|
|
5339
5363
|
ref,
|
|
5340
|
-
disabled,
|
|
5364
|
+
disabled: disabled || isLoading,
|
|
5341
5365
|
"aria-disabled": isLoading || disabled || void 0,
|
|
5342
5366
|
"data-loading": isLoading || void 0,
|
|
5343
5367
|
...rest,
|
|
@@ -5350,7 +5374,7 @@ var IconButton = React208.forwardRef(
|
|
|
5350
5374
|
{
|
|
5351
5375
|
className: buttonClasses,
|
|
5352
5376
|
ref,
|
|
5353
|
-
disabled,
|
|
5377
|
+
disabled: disabled || isLoading,
|
|
5354
5378
|
"aria-disabled": isLoading || disabled || void 0,
|
|
5355
5379
|
"data-loading": isLoading || void 0,
|
|
5356
5380
|
...rest,
|
|
@@ -5362,14 +5386,276 @@ var IconButton = React208.forwardRef(
|
|
|
5362
5386
|
IconButton.displayName = "IconButton";
|
|
5363
5387
|
|
|
5364
5388
|
// ../ultimate/src/components/checkbox/Checkbox.tsx
|
|
5389
|
+
import * as React214 from "react";
|
|
5390
|
+
|
|
5391
|
+
// ../ultimate/src/internal/form/NativeSelectionInput.tsx
|
|
5365
5392
|
import * as React209 from "react";
|
|
5366
5393
|
|
|
5394
|
+
// ../ultimate/src/hooks/useCallbackRef.ts
|
|
5395
|
+
import { useRef as useRef2, useEffect as useEffect3, useMemo } from "react";
|
|
5396
|
+
function useCallbackRef(callback) {
|
|
5397
|
+
const callbackRef = useRef2(callback);
|
|
5398
|
+
useEffect3(() => {
|
|
5399
|
+
callbackRef.current = callback;
|
|
5400
|
+
});
|
|
5401
|
+
return useMemo(() => ((...args) => callbackRef.current?.(...args)), []);
|
|
5402
|
+
}
|
|
5403
|
+
|
|
5404
|
+
// ../ultimate/src/internal/form/NativeSelectionInput.tsx
|
|
5405
|
+
import { jsx as jsx207 } from "react/jsx-runtime";
|
|
5406
|
+
var visuallyHiddenInputStyle = {
|
|
5407
|
+
position: "absolute",
|
|
5408
|
+
width: 1,
|
|
5409
|
+
height: 1,
|
|
5410
|
+
padding: 0,
|
|
5411
|
+
margin: -1,
|
|
5412
|
+
overflow: "hidden",
|
|
5413
|
+
clipPath: "inset(50%)",
|
|
5414
|
+
whiteSpace: "nowrap",
|
|
5415
|
+
border: 0
|
|
5416
|
+
};
|
|
5417
|
+
function NativeSelectionInput({
|
|
5418
|
+
checked,
|
|
5419
|
+
defaultChecked,
|
|
5420
|
+
controlled,
|
|
5421
|
+
onReset,
|
|
5422
|
+
controlRef,
|
|
5423
|
+
...props
|
|
5424
|
+
}) {
|
|
5425
|
+
const inputRef = React209.useRef(null);
|
|
5426
|
+
const reset = useCallbackRef((event) => {
|
|
5427
|
+
queueMicrotask(() => {
|
|
5428
|
+
if (event.defaultPrevented || !inputRef.current) return;
|
|
5429
|
+
const next = controlled ? checked : defaultChecked;
|
|
5430
|
+
inputRef.current.checked = next;
|
|
5431
|
+
if (!controlled) onReset(next);
|
|
5432
|
+
});
|
|
5433
|
+
});
|
|
5434
|
+
React209.useEffect(() => {
|
|
5435
|
+
const form = inputRef.current?.form;
|
|
5436
|
+
form?.addEventListener("reset", reset);
|
|
5437
|
+
return () => form?.removeEventListener("reset", reset);
|
|
5438
|
+
}, [props.form, reset]);
|
|
5439
|
+
return /* @__PURE__ */ jsx207(
|
|
5440
|
+
"input",
|
|
5441
|
+
{
|
|
5442
|
+
...props,
|
|
5443
|
+
ref: inputRef,
|
|
5444
|
+
checked,
|
|
5445
|
+
onChange: () => {
|
|
5446
|
+
},
|
|
5447
|
+
tabIndex: -1,
|
|
5448
|
+
"aria-hidden": "true",
|
|
5449
|
+
style: visuallyHiddenInputStyle,
|
|
5450
|
+
onInvalid: (event) => {
|
|
5451
|
+
event.preventDefault();
|
|
5452
|
+
controlRef.current?.focus();
|
|
5453
|
+
}
|
|
5454
|
+
}
|
|
5455
|
+
);
|
|
5456
|
+
}
|
|
5457
|
+
|
|
5458
|
+
// ../ultimate/src/components/checkbox-group/CheckboxGroup.tsx
|
|
5459
|
+
import * as React213 from "react";
|
|
5460
|
+
|
|
5461
|
+
// ../ultimate/src/hooks/useControllableState.ts
|
|
5462
|
+
import * as React210 from "react";
|
|
5463
|
+
function useControllableState({
|
|
5464
|
+
value: valueProp,
|
|
5465
|
+
defaultValue,
|
|
5466
|
+
onChange
|
|
5467
|
+
}) {
|
|
5468
|
+
const [uncontrolledValue, setUncontrolledValue] = React210.useState(() => typeof defaultValue === "function" ? defaultValue() : defaultValue);
|
|
5469
|
+
const isControlledRef = React210.useRef(valueProp !== void 0);
|
|
5470
|
+
const isControlled = isControlledRef.current;
|
|
5471
|
+
const value = isControlled ? valueProp : uncontrolledValue;
|
|
5472
|
+
const handleChange = useCallbackRef(onChange);
|
|
5473
|
+
const previousUncontrolledValueRef = React210.useRef(uncontrolledValue);
|
|
5474
|
+
React210.useEffect(() => {
|
|
5475
|
+
if (isControlled) return;
|
|
5476
|
+
if (previousUncontrolledValueRef.current === uncontrolledValue) return;
|
|
5477
|
+
previousUncontrolledValueRef.current = uncontrolledValue;
|
|
5478
|
+
handleChange(uncontrolledValue);
|
|
5479
|
+
}, [isControlled, uncontrolledValue, handleChange]);
|
|
5480
|
+
const setValue = React210.useCallback(
|
|
5481
|
+
(nextValue) => {
|
|
5482
|
+
if (isControlled) {
|
|
5483
|
+
const setter = nextValue;
|
|
5484
|
+
const valueToEmit = typeof nextValue === "function" ? setter(valueProp) : nextValue;
|
|
5485
|
+
handleChange(valueToEmit);
|
|
5486
|
+
} else {
|
|
5487
|
+
setUncontrolledValue((prev) => {
|
|
5488
|
+
const setter = nextValue;
|
|
5489
|
+
return typeof nextValue === "function" ? setter(prev) : nextValue;
|
|
5490
|
+
});
|
|
5491
|
+
}
|
|
5492
|
+
},
|
|
5493
|
+
[isControlled, valueProp, handleChange]
|
|
5494
|
+
);
|
|
5495
|
+
const reset = React210.useCallback(() => {
|
|
5496
|
+
if (isControlled) return;
|
|
5497
|
+
const next = typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
5498
|
+
previousUncontrolledValueRef.current = next;
|
|
5499
|
+
setUncontrolledValue(next);
|
|
5500
|
+
}, [isControlled, defaultValue]);
|
|
5501
|
+
return [value, setValue, reset];
|
|
5502
|
+
}
|
|
5503
|
+
|
|
5504
|
+
// ../ultimate/src/internal/form/SelectionGroup.tsx
|
|
5505
|
+
import * as React212 from "react";
|
|
5506
|
+
|
|
5507
|
+
// ../ultimate/src/components/fieldset/Fieldset.tsx
|
|
5508
|
+
import * as React211 from "react";
|
|
5509
|
+
|
|
5510
|
+
// ../ultimate/src/utils/aria.utils.ts
|
|
5511
|
+
function mergeAriaIds(...values) {
|
|
5512
|
+
const ids = values.filter((value) => Boolean(value)).flatMap((value) => value.split(/\s+/));
|
|
5513
|
+
return [...new Set(ids)].join(" ") || void 0;
|
|
5514
|
+
}
|
|
5515
|
+
|
|
5516
|
+
// ../ultimate/src/components/fieldset/Fieldset.tsx
|
|
5517
|
+
import { jsx as jsx208, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
5518
|
+
var Fieldset = React211.forwardRef(
|
|
5519
|
+
({ legend, description, error, children, className, ...props }, ref) => {
|
|
5520
|
+
const id = React211.useId();
|
|
5521
|
+
return /* @__PURE__ */ jsxs7(
|
|
5522
|
+
Box,
|
|
5523
|
+
{
|
|
5524
|
+
as: "fieldset",
|
|
5525
|
+
border: "none",
|
|
5526
|
+
p: "none",
|
|
5527
|
+
m: "none",
|
|
5528
|
+
minW: 0,
|
|
5529
|
+
...props,
|
|
5530
|
+
ref,
|
|
5531
|
+
className,
|
|
5532
|
+
"aria-describedby": mergeAriaIds(
|
|
5533
|
+
props["aria-describedby"],
|
|
5534
|
+
description ? `${id}-description` : void 0,
|
|
5535
|
+
error ? `${id}-error` : void 0
|
|
5536
|
+
),
|
|
5537
|
+
"aria-invalid": error ? true : props["aria-invalid"],
|
|
5538
|
+
children: [
|
|
5539
|
+
legend != null && /* @__PURE__ */ jsx208(Box, { as: "legend", p: "none", mb: "2xs", children: /* @__PURE__ */ jsx208(Text, { as: "span", variant: "title-md", children: legend }) }),
|
|
5540
|
+
/* @__PURE__ */ jsxs7(VStack, { gap: "2xs", children: [
|
|
5541
|
+
description && /* @__PURE__ */ jsx208(
|
|
5542
|
+
Text,
|
|
5543
|
+
{
|
|
5544
|
+
as: "div",
|
|
5545
|
+
variant: "body-md",
|
|
5546
|
+
color: "secondary",
|
|
5547
|
+
id: `${id}-description`,
|
|
5548
|
+
children: description
|
|
5549
|
+
}
|
|
5550
|
+
),
|
|
5551
|
+
children,
|
|
5552
|
+
error && /* @__PURE__ */ jsx208(Text, { as: "div", variant: "body-md", color: "red", id: `${id}-error`, children: error })
|
|
5553
|
+
] })
|
|
5554
|
+
]
|
|
5555
|
+
}
|
|
5556
|
+
);
|
|
5557
|
+
}
|
|
5558
|
+
);
|
|
5559
|
+
Fieldset.displayName = "Fieldset";
|
|
5560
|
+
|
|
5561
|
+
// ../ultimate/src/internal/form/SelectionGroup.tsx
|
|
5562
|
+
import { jsx as jsx209 } from "react/jsx-runtime";
|
|
5563
|
+
var SelectionGroupFrame = React212.forwardRef(({ label, description, error, orientation = "vertical", disabled, children, ...props }, ref) => /* @__PURE__ */ jsx209(Fieldset, { ref, legend: label, description, error, disabled, ...props, children: /* @__PURE__ */ jsx209(Stack, { direction: orientation === "horizontal" ? "row" : "column", gap: "2xs", wrap: true, children }) }));
|
|
5564
|
+
SelectionGroupFrame.displayName = "SelectionGroupFrame";
|
|
5565
|
+
function useGroupFormReset(rootRef, form, reset) {
|
|
5566
|
+
const onReset = useCallbackRef((event) => {
|
|
5567
|
+
queueMicrotask(() => {
|
|
5568
|
+
if (!event.defaultPrevented) reset();
|
|
5569
|
+
});
|
|
5570
|
+
});
|
|
5571
|
+
React212.useEffect(() => {
|
|
5572
|
+
const owner = form ? document.getElementById(form) : rootRef.current?.closest("form");
|
|
5573
|
+
owner?.addEventListener("reset", onReset);
|
|
5574
|
+
return () => owner?.removeEventListener("reset", onReset);
|
|
5575
|
+
}, [form, rootRef, onReset]);
|
|
5576
|
+
}
|
|
5577
|
+
function assignRef(ref, node) {
|
|
5578
|
+
if (typeof ref === "function") ref(node);
|
|
5579
|
+
else if (ref) ref.current = node;
|
|
5580
|
+
}
|
|
5581
|
+
|
|
5582
|
+
// ../ultimate/src/components/checkbox-group/CheckboxGroup.tsx
|
|
5583
|
+
import { jsx as jsx210, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
5584
|
+
var CheckboxGroupContext = React213.createContext(null);
|
|
5585
|
+
var EMPTY = [];
|
|
5586
|
+
var CheckboxGroup = React213.forwardRef(({
|
|
5587
|
+
value,
|
|
5588
|
+
defaultValue = EMPTY,
|
|
5589
|
+
onChange,
|
|
5590
|
+
name,
|
|
5591
|
+
form,
|
|
5592
|
+
disabled,
|
|
5593
|
+
required,
|
|
5594
|
+
requiredMessage = "Select at least one option.",
|
|
5595
|
+
children,
|
|
5596
|
+
...props
|
|
5597
|
+
}, forwardedRef) => {
|
|
5598
|
+
const [selected = EMPTY, setSelected, reset] = useControllableState({ value, defaultValue, onChange });
|
|
5599
|
+
const rootRef = React213.useRef(null);
|
|
5600
|
+
const validationRef = React213.useRef(null);
|
|
5601
|
+
useGroupFormReset(rootRef, form, reset);
|
|
5602
|
+
const missing = Boolean(required) && selected.length === 0;
|
|
5603
|
+
React213.useLayoutEffect(() => {
|
|
5604
|
+
const input = validationRef.current;
|
|
5605
|
+
input.checked = !missing;
|
|
5606
|
+
input.setCustomValidity(missing ? requiredMessage : "");
|
|
5607
|
+
}, [missing, requiredMessage]);
|
|
5608
|
+
const context = React213.useMemo(() => ({
|
|
5609
|
+
value: selected,
|
|
5610
|
+
name,
|
|
5611
|
+
form,
|
|
5612
|
+
disabled,
|
|
5613
|
+
toggle: (option, checked) => setSelected(
|
|
5614
|
+
checked ? [...selected.filter((item) => item !== option), option] : selected.filter((item) => item !== option)
|
|
5615
|
+
)
|
|
5616
|
+
}), [selected, name, form, disabled, setSelected]);
|
|
5617
|
+
return /* @__PURE__ */ jsxs8(CheckboxGroupContext.Provider, { value: context, children: [
|
|
5618
|
+
/* @__PURE__ */ jsx210(
|
|
5619
|
+
SelectionGroupFrame,
|
|
5620
|
+
{
|
|
5621
|
+
...props,
|
|
5622
|
+
ref: (node) => {
|
|
5623
|
+
rootRef.current = node;
|
|
5624
|
+
assignRef(forwardedRef, node);
|
|
5625
|
+
},
|
|
5626
|
+
disabled,
|
|
5627
|
+
"aria-required": required || void 0,
|
|
5628
|
+
children
|
|
5629
|
+
}
|
|
5630
|
+
),
|
|
5631
|
+
/* @__PURE__ */ jsx210(
|
|
5632
|
+
"input",
|
|
5633
|
+
{
|
|
5634
|
+
ref: validationRef,
|
|
5635
|
+
type: "checkbox",
|
|
5636
|
+
form,
|
|
5637
|
+
required,
|
|
5638
|
+
defaultChecked: !missing,
|
|
5639
|
+
disabled,
|
|
5640
|
+
tabIndex: -1,
|
|
5641
|
+
"aria-hidden": "true",
|
|
5642
|
+
style: visuallyHiddenInputStyle,
|
|
5643
|
+
onInvalid: (event) => {
|
|
5644
|
+
event.preventDefault();
|
|
5645
|
+
rootRef.current?.querySelector('[role="checkbox"]:not(:disabled)')?.focus();
|
|
5646
|
+
}
|
|
5647
|
+
}
|
|
5648
|
+
)
|
|
5649
|
+
] });
|
|
5650
|
+
});
|
|
5651
|
+
CheckboxGroup.displayName = "CheckboxGroup";
|
|
5652
|
+
|
|
5367
5653
|
// ../ultimate/src/components/checkbox/Checkbox.module.css
|
|
5368
5654
|
var Checkbox_default = {};
|
|
5369
5655
|
|
|
5370
5656
|
// ../ultimate/src/components/checkbox/Checkbox.tsx
|
|
5371
|
-
import { jsx as
|
|
5372
|
-
var Checkbox =
|
|
5657
|
+
import { Fragment as Fragment4, jsx as jsx211, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
5658
|
+
var Checkbox = React214.forwardRef(
|
|
5373
5659
|
({
|
|
5374
5660
|
className,
|
|
5375
5661
|
style,
|
|
@@ -5381,18 +5667,33 @@ var Checkbox = React209.forwardRef(
|
|
|
5381
5667
|
disabled,
|
|
5382
5668
|
onChange,
|
|
5383
5669
|
onClick,
|
|
5670
|
+
name,
|
|
5671
|
+
value,
|
|
5672
|
+
form,
|
|
5673
|
+
required,
|
|
5384
5674
|
...rest
|
|
5385
5675
|
}, ref) => {
|
|
5676
|
+
const group = React214.useContext(CheckboxGroupContext);
|
|
5677
|
+
const inGroup = Boolean(group) && value !== void 0;
|
|
5678
|
+
const optionValue = String(value);
|
|
5679
|
+
if (inGroup) {
|
|
5680
|
+
controlledChecked = group.value.includes(optionValue);
|
|
5681
|
+
name = group.name ?? name;
|
|
5682
|
+
form = group.form ?? form;
|
|
5683
|
+
disabled = disabled || group.disabled;
|
|
5684
|
+
}
|
|
5386
5685
|
const isControlled = controlledChecked !== void 0;
|
|
5387
|
-
const [internalChecked, setInternalChecked] =
|
|
5388
|
-
const [rippleActive, setRippleActive] =
|
|
5389
|
-
const rippleTimeoutRef =
|
|
5390
|
-
const checked = isControlled ? controlledChecked : internalChecked;
|
|
5686
|
+
const [internalChecked, setInternalChecked] = React214.useState(defaultChecked);
|
|
5687
|
+
const [rippleActive, setRippleActive] = React214.useState(false);
|
|
5688
|
+
const rippleTimeoutRef = React214.useRef(null);
|
|
5689
|
+
const checked = isControlled ? Boolean(controlledChecked) : internalChecked;
|
|
5690
|
+
const controlRef = React214.useRef(null);
|
|
5391
5691
|
const isIndeterminate = indeterminate;
|
|
5392
5692
|
const isChecked = !indeterminate && checked;
|
|
5393
5693
|
const isUnchecked = !indeterminate && !checked;
|
|
5394
5694
|
const iconSize = size === "small" ? 20 : 24;
|
|
5395
5695
|
const handleClick = (e) => {
|
|
5696
|
+
e.preventDefault();
|
|
5396
5697
|
if (disabled) return;
|
|
5397
5698
|
if (rippleTimeoutRef.current) {
|
|
5398
5699
|
clearTimeout(rippleTimeoutRef.current);
|
|
@@ -5405,6 +5706,7 @@ var Checkbox = React209.forwardRef(
|
|
|
5405
5706
|
if (!isControlled) {
|
|
5406
5707
|
setInternalChecked(nextChecked);
|
|
5407
5708
|
}
|
|
5709
|
+
if (inGroup) group.toggle(optionValue, nextChecked);
|
|
5408
5710
|
if (onChange) {
|
|
5409
5711
|
onChange(nextChecked);
|
|
5410
5712
|
}
|
|
@@ -5412,7 +5714,7 @@ var Checkbox = React209.forwardRef(
|
|
|
5412
5714
|
onClick(e);
|
|
5413
5715
|
}
|
|
5414
5716
|
};
|
|
5415
|
-
|
|
5717
|
+
React214.useEffect(() => {
|
|
5416
5718
|
return () => {
|
|
5417
5719
|
if (rippleTimeoutRef.current) {
|
|
5418
5720
|
clearTimeout(rippleTimeoutRef.current);
|
|
@@ -5432,11 +5734,18 @@ var Checkbox = React209.forwardRef(
|
|
|
5432
5734
|
disabled && Checkbox_default.disabled,
|
|
5433
5735
|
label && className
|
|
5434
5736
|
].filter(Boolean).join(" ");
|
|
5435
|
-
const checkboxContent = /* @__PURE__ */
|
|
5737
|
+
const checkboxContent = /* @__PURE__ */ jsx211(
|
|
5436
5738
|
"button",
|
|
5437
5739
|
{
|
|
5438
|
-
ref
|
|
5740
|
+
ref: (node) => {
|
|
5741
|
+
controlRef.current = node;
|
|
5742
|
+
if (typeof ref === "function") ref(node);
|
|
5743
|
+
else if (ref) ref.current = node;
|
|
5744
|
+
},
|
|
5439
5745
|
type: "button",
|
|
5746
|
+
form,
|
|
5747
|
+
value,
|
|
5748
|
+
"aria-required": required || void 0,
|
|
5440
5749
|
role: "checkbox",
|
|
5441
5750
|
"aria-checked": indeterminate ? "mixed" : checked,
|
|
5442
5751
|
className: checkboxClasses,
|
|
@@ -5444,35 +5753,137 @@ var Checkbox = React209.forwardRef(
|
|
|
5444
5753
|
onClick: handleClick,
|
|
5445
5754
|
style: !label ? style : void 0,
|
|
5446
5755
|
...rest,
|
|
5447
|
-
children: /* @__PURE__ */
|
|
5448
|
-
/* @__PURE__ */
|
|
5449
|
-
(isChecked || isIndeterminate) && /* @__PURE__ */
|
|
5450
|
-
isChecked && /* @__PURE__ */
|
|
5451
|
-
isIndeterminate && /* @__PURE__ */
|
|
5756
|
+
children: /* @__PURE__ */ jsxs9("span", { className: Checkbox_default.checkboxIcon, children: [
|
|
5757
|
+
/* @__PURE__ */ jsx211("span", { className: Checkbox_default.checkboxBase, children: isUnchecked ? /* @__PURE__ */ jsx211(RectangleOutline, { size: iconSize }) : /* @__PURE__ */ jsx211(RectangleFilled, { size: iconSize }) }),
|
|
5758
|
+
(isChecked || isIndeterminate) && /* @__PURE__ */ jsxs9("span", { className: Checkbox_default.checkboxOverlay, children: [
|
|
5759
|
+
isChecked && /* @__PURE__ */ jsx211(CheckSmallOutline, { size: iconSize }),
|
|
5760
|
+
isIndeterminate && /* @__PURE__ */ jsx211(IndeterminateSmallOutline, { size: iconSize })
|
|
5452
5761
|
] })
|
|
5453
5762
|
] })
|
|
5454
5763
|
}
|
|
5455
5764
|
);
|
|
5765
|
+
const formInput = /* @__PURE__ */ jsx211(
|
|
5766
|
+
NativeSelectionInput,
|
|
5767
|
+
{
|
|
5768
|
+
type: "checkbox",
|
|
5769
|
+
name,
|
|
5770
|
+
value,
|
|
5771
|
+
form,
|
|
5772
|
+
required,
|
|
5773
|
+
disabled,
|
|
5774
|
+
checked,
|
|
5775
|
+
defaultChecked,
|
|
5776
|
+
controlled: isControlled,
|
|
5777
|
+
controlRef,
|
|
5778
|
+
onReset: setInternalChecked
|
|
5779
|
+
}
|
|
5780
|
+
);
|
|
5456
5781
|
if (label) {
|
|
5457
|
-
return /* @__PURE__ */
|
|
5458
|
-
|
|
5459
|
-
/* @__PURE__ */
|
|
5782
|
+
return /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
5783
|
+
formInput,
|
|
5784
|
+
/* @__PURE__ */ jsxs9("label", { className: containerClasses, style, children: [
|
|
5785
|
+
checkboxContent,
|
|
5786
|
+
/* @__PURE__ */ jsx211("span", { className: Checkbox_default.checkboxLabel, children: label })
|
|
5787
|
+
] })
|
|
5460
5788
|
] });
|
|
5461
5789
|
}
|
|
5462
|
-
return
|
|
5790
|
+
return /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
5791
|
+
formInput,
|
|
5792
|
+
checkboxContent
|
|
5793
|
+
] });
|
|
5463
5794
|
}
|
|
5464
5795
|
);
|
|
5465
5796
|
Checkbox.displayName = "Checkbox";
|
|
5466
5797
|
|
|
5467
5798
|
// ../ultimate/src/components/radio/Radio.tsx
|
|
5468
|
-
import * as
|
|
5799
|
+
import * as React216 from "react";
|
|
5800
|
+
|
|
5801
|
+
// ../ultimate/src/components/radio/RadioGroup.tsx
|
|
5802
|
+
import * as React215 from "react";
|
|
5803
|
+
import { jsx as jsx212 } from "react/jsx-runtime";
|
|
5804
|
+
var RadioGroupContext = React215.createContext(null);
|
|
5805
|
+
var NAVIGATION_KEYS = ["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Home", "End"];
|
|
5806
|
+
var RadioGroup = React215.forwardRef(
|
|
5807
|
+
({
|
|
5808
|
+
value,
|
|
5809
|
+
defaultValue,
|
|
5810
|
+
onChange,
|
|
5811
|
+
name,
|
|
5812
|
+
form,
|
|
5813
|
+
disabled,
|
|
5814
|
+
required,
|
|
5815
|
+
onKeyDown,
|
|
5816
|
+
children,
|
|
5817
|
+
...props
|
|
5818
|
+
}, forwardedRef) => {
|
|
5819
|
+
const generatedName = React215.useId();
|
|
5820
|
+
const [currentValue, setValue, reset] = useControllableState({
|
|
5821
|
+
value,
|
|
5822
|
+
defaultValue,
|
|
5823
|
+
onChange
|
|
5824
|
+
});
|
|
5825
|
+
const rootRef = React215.useRef(null);
|
|
5826
|
+
useGroupFormReset(rootRef, form, reset);
|
|
5827
|
+
const ownRadios = (root) => Array.from(root.querySelectorAll('[role="radio"]:not(:disabled)')).filter(
|
|
5828
|
+
(item) => item.closest('[role="radiogroup"]') === root
|
|
5829
|
+
);
|
|
5830
|
+
React215.useLayoutEffect(() => {
|
|
5831
|
+
if (!rootRef.current) return;
|
|
5832
|
+
const items = ownRadios(rootRef.current);
|
|
5833
|
+
const selected = items.find((item) => item.getAttribute("aria-checked") === "true") ?? items[0];
|
|
5834
|
+
items.forEach((item) => {
|
|
5835
|
+
item.tabIndex = item === selected ? 0 : -1;
|
|
5836
|
+
});
|
|
5837
|
+
}, [currentValue, children, disabled]);
|
|
5838
|
+
const context = React215.useMemo(
|
|
5839
|
+
() => ({
|
|
5840
|
+
value: currentValue,
|
|
5841
|
+
name: name ?? generatedName,
|
|
5842
|
+
form,
|
|
5843
|
+
disabled,
|
|
5844
|
+
required,
|
|
5845
|
+
onChange: (next) => setValue(next)
|
|
5846
|
+
}),
|
|
5847
|
+
[currentValue, name, generatedName, form, disabled, required, setValue]
|
|
5848
|
+
);
|
|
5849
|
+
return /* @__PURE__ */ jsx212(RadioGroupContext.Provider, { value: context, children: /* @__PURE__ */ jsx212(
|
|
5850
|
+
SelectionGroupFrame,
|
|
5851
|
+
{
|
|
5852
|
+
...props,
|
|
5853
|
+
ref: (node) => {
|
|
5854
|
+
rootRef.current = node;
|
|
5855
|
+
assignRef(forwardedRef, node);
|
|
5856
|
+
},
|
|
5857
|
+
disabled,
|
|
5858
|
+
role: "radiogroup",
|
|
5859
|
+
"aria-required": required || void 0,
|
|
5860
|
+
onKeyDown: (event) => {
|
|
5861
|
+
onKeyDown?.(event);
|
|
5862
|
+
if (event.defaultPrevented || event.nativeEvent.isComposing || disabled || !NAVIGATION_KEYS.includes(event.key))
|
|
5863
|
+
return;
|
|
5864
|
+
const items = ownRadios(event.currentTarget);
|
|
5865
|
+
const index = items.indexOf(event.target);
|
|
5866
|
+
if (index < 0) return;
|
|
5867
|
+
event.preventDefault();
|
|
5868
|
+
const rtl = getComputedStyle(event.currentTarget).direction === "rtl";
|
|
5869
|
+
const previous = event.key === "ArrowUp" || event.key === (rtl ? "ArrowRight" : "ArrowLeft");
|
|
5870
|
+
const next = event.key === "Home" ? 0 : event.key === "End" ? items.length - 1 : (index + (previous ? -1 : 1) + items.length) % items.length;
|
|
5871
|
+
items[next]?.focus();
|
|
5872
|
+
items[next]?.click();
|
|
5873
|
+
},
|
|
5874
|
+
children
|
|
5875
|
+
}
|
|
5876
|
+
) });
|
|
5877
|
+
}
|
|
5878
|
+
);
|
|
5879
|
+
RadioGroup.displayName = "RadioGroup";
|
|
5469
5880
|
|
|
5470
5881
|
// ../ultimate/src/components/radio/Radio.module.css
|
|
5471
5882
|
var Radio_default = {};
|
|
5472
5883
|
|
|
5473
5884
|
// ../ultimate/src/components/radio/Radio.tsx
|
|
5474
|
-
import { jsx as
|
|
5475
|
-
var Radio =
|
|
5885
|
+
import { Fragment as Fragment5, jsx as jsx213, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
5886
|
+
var Radio = React216.forwardRef(
|
|
5476
5887
|
({
|
|
5477
5888
|
className,
|
|
5478
5889
|
style,
|
|
@@ -5483,16 +5894,35 @@ var Radio = React210.forwardRef(
|
|
|
5483
5894
|
disabled,
|
|
5484
5895
|
onChange,
|
|
5485
5896
|
onClick,
|
|
5897
|
+
name,
|
|
5898
|
+
value,
|
|
5899
|
+
form,
|
|
5900
|
+
required,
|
|
5486
5901
|
...rest
|
|
5487
5902
|
}, ref) => {
|
|
5488
|
-
const
|
|
5489
|
-
const
|
|
5490
|
-
const
|
|
5491
|
-
const
|
|
5492
|
-
|
|
5903
|
+
const group = React216.useContext(RadioGroupContext);
|
|
5904
|
+
const optionValue = value === void 0 ? "on" : String(value);
|
|
5905
|
+
const effectiveChecked = group ? group.value === optionValue : controlledChecked;
|
|
5906
|
+
const isControlled = effectiveChecked !== void 0 || Boolean(group);
|
|
5907
|
+
disabled = disabled || group?.disabled;
|
|
5908
|
+
name = group?.name ?? name;
|
|
5909
|
+
form = group?.form ?? form;
|
|
5910
|
+
required = required || group?.required;
|
|
5911
|
+
const [internalChecked, setInternalChecked] = React216.useState(defaultChecked);
|
|
5912
|
+
const [pressed, setPressed] = React216.useState(false);
|
|
5913
|
+
const timeoutRef = React216.useRef(null);
|
|
5914
|
+
const checked = isControlled ? Boolean(effectiveChecked) : internalChecked;
|
|
5915
|
+
const controlRef = React216.useRef(null);
|
|
5493
5916
|
const iconSize = size === "small" ? 20 : 24;
|
|
5494
5917
|
const handleClick = (e) => {
|
|
5918
|
+
e.preventDefault();
|
|
5495
5919
|
if (disabled) return;
|
|
5920
|
+
if (name && !checked) {
|
|
5921
|
+
controlRef.current?.dispatchEvent(new CustomEvent("photonix-radio-select", {
|
|
5922
|
+
bubbles: true,
|
|
5923
|
+
detail: { name, form: controlRef.current.form }
|
|
5924
|
+
}));
|
|
5925
|
+
}
|
|
5496
5926
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
5497
5927
|
setPressed(true);
|
|
5498
5928
|
timeoutRef.current = setTimeout(() => setPressed(false), 350);
|
|
@@ -5500,6 +5930,7 @@ var Radio = React210.forwardRef(
|
|
|
5500
5930
|
if (!isControlled) {
|
|
5501
5931
|
setInternalChecked(true);
|
|
5502
5932
|
}
|
|
5933
|
+
group?.onChange(optionValue);
|
|
5503
5934
|
if (onChange) {
|
|
5504
5935
|
onChange(true);
|
|
5505
5936
|
}
|
|
@@ -5508,11 +5939,22 @@ var Radio = React210.forwardRef(
|
|
|
5508
5939
|
onClick(e);
|
|
5509
5940
|
}
|
|
5510
5941
|
};
|
|
5511
|
-
|
|
5942
|
+
React216.useEffect(() => {
|
|
5512
5943
|
return () => {
|
|
5513
5944
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
5514
5945
|
};
|
|
5515
5946
|
}, []);
|
|
5947
|
+
React216.useEffect(() => {
|
|
5948
|
+
if (isControlled || !name) return;
|
|
5949
|
+
const clearSibling = (event) => {
|
|
5950
|
+
const selection = event;
|
|
5951
|
+
if (selection.target !== controlRef.current && selection.detail.name === name && selection.detail.form === controlRef.current?.form) {
|
|
5952
|
+
setInternalChecked(false);
|
|
5953
|
+
}
|
|
5954
|
+
};
|
|
5955
|
+
document.addEventListener("photonix-radio-select", clearSibling);
|
|
5956
|
+
return () => document.removeEventListener("photonix-radio-select", clearSibling);
|
|
5957
|
+
}, [isControlled, name]);
|
|
5516
5958
|
const radioClasses = [
|
|
5517
5959
|
"phx-radio",
|
|
5518
5960
|
Radio_default.radioRoot,
|
|
@@ -5526,41 +5968,71 @@ var Radio = React210.forwardRef(
|
|
|
5526
5968
|
disabled && Radio_default.disabled,
|
|
5527
5969
|
label && className
|
|
5528
5970
|
].filter(Boolean).join(" ");
|
|
5529
|
-
const radioContent = /* @__PURE__ */
|
|
5971
|
+
const radioContent = /* @__PURE__ */ jsx213(
|
|
5530
5972
|
"button",
|
|
5531
5973
|
{
|
|
5532
|
-
ref
|
|
5974
|
+
ref: (node) => {
|
|
5975
|
+
controlRef.current = node;
|
|
5976
|
+
if (typeof ref === "function") ref(node);
|
|
5977
|
+
else if (ref) ref.current = node;
|
|
5978
|
+
},
|
|
5533
5979
|
type: "button",
|
|
5980
|
+
form,
|
|
5981
|
+
value,
|
|
5982
|
+
"aria-required": required || void 0,
|
|
5534
5983
|
role: "radio",
|
|
5535
5984
|
"aria-checked": checked,
|
|
5536
5985
|
className: radioClasses,
|
|
5537
5986
|
disabled,
|
|
5538
5987
|
onClick: handleClick,
|
|
5539
5988
|
style: !label ? style : void 0,
|
|
5989
|
+
tabIndex: group ? checked || group.value === void 0 ? 0 : -1 : void 0,
|
|
5540
5990
|
...rest,
|
|
5541
|
-
children: /* @__PURE__ */
|
|
5991
|
+
children: /* @__PURE__ */ jsx213("span", { className: Radio_default.radioIcon, children: checked ? /* @__PURE__ */ jsx213(RadioOutline, { size: iconSize }) : /* @__PURE__ */ jsx213(CircleOutline, { size: iconSize }) })
|
|
5992
|
+
}
|
|
5993
|
+
);
|
|
5994
|
+
const formInput = /* @__PURE__ */ jsx213(
|
|
5995
|
+
NativeSelectionInput,
|
|
5996
|
+
{
|
|
5997
|
+
type: "radio",
|
|
5998
|
+
name,
|
|
5999
|
+
value,
|
|
6000
|
+
form,
|
|
6001
|
+
required,
|
|
6002
|
+
disabled,
|
|
6003
|
+
checked,
|
|
6004
|
+
defaultChecked,
|
|
6005
|
+
controlled: isControlled,
|
|
6006
|
+
controlRef,
|
|
6007
|
+
onReset: setInternalChecked
|
|
5542
6008
|
}
|
|
5543
6009
|
);
|
|
5544
6010
|
if (label) {
|
|
5545
|
-
return /* @__PURE__ */
|
|
5546
|
-
|
|
5547
|
-
/* @__PURE__ */
|
|
6011
|
+
return /* @__PURE__ */ jsxs10(Fragment5, { children: [
|
|
6012
|
+
formInput,
|
|
6013
|
+
/* @__PURE__ */ jsxs10("label", { className: containerClasses, style, children: [
|
|
6014
|
+
radioContent,
|
|
6015
|
+
/* @__PURE__ */ jsx213("span", { className: Radio_default.radioLabel, children: label })
|
|
6016
|
+
] })
|
|
5548
6017
|
] });
|
|
5549
6018
|
}
|
|
5550
|
-
return
|
|
6019
|
+
return /* @__PURE__ */ jsxs10(Fragment5, { children: [
|
|
6020
|
+
formInput,
|
|
6021
|
+
radioContent
|
|
6022
|
+
] });
|
|
5551
6023
|
}
|
|
5552
6024
|
);
|
|
5553
6025
|
Radio.displayName = "Radio";
|
|
5554
6026
|
|
|
5555
6027
|
// ../ultimate/src/components/switch/Switch.tsx
|
|
5556
|
-
import * as
|
|
6028
|
+
import * as React217 from "react";
|
|
5557
6029
|
|
|
5558
6030
|
// ../ultimate/src/components/switch/Switch.module.css
|
|
5559
6031
|
var Switch_default = {};
|
|
5560
6032
|
|
|
5561
6033
|
// ../ultimate/src/components/switch/Switch.tsx
|
|
5562
|
-
import { jsx as
|
|
5563
|
-
var Switch =
|
|
6034
|
+
import { Fragment as Fragment6, jsx as jsx214, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
6035
|
+
var Switch = React217.forwardRef(
|
|
5564
6036
|
({
|
|
5565
6037
|
className,
|
|
5566
6038
|
checked: controlledChecked,
|
|
@@ -5570,14 +6042,19 @@ var Switch = React211.forwardRef(
|
|
|
5570
6042
|
disabled,
|
|
5571
6043
|
onChange,
|
|
5572
6044
|
onClick,
|
|
6045
|
+
name,
|
|
6046
|
+
value,
|
|
6047
|
+
form,
|
|
6048
|
+
required,
|
|
5573
6049
|
...rest
|
|
5574
6050
|
}, ref) => {
|
|
5575
6051
|
const isControlled = controlledChecked !== void 0;
|
|
5576
|
-
const [internalChecked, setInternalChecked] =
|
|
5577
|
-
const [pressed, setPressed] =
|
|
5578
|
-
const timeoutRef =
|
|
6052
|
+
const [internalChecked, setInternalChecked] = React217.useState(defaultChecked);
|
|
6053
|
+
const [pressed, setPressed] = React217.useState(false);
|
|
6054
|
+
const timeoutRef = React217.useRef(null);
|
|
5579
6055
|
const checked = isControlled ? controlledChecked : internalChecked;
|
|
5580
6056
|
const handleClick = (e) => {
|
|
6057
|
+
e.preventDefault();
|
|
5581
6058
|
if (disabled) return;
|
|
5582
6059
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
5583
6060
|
setPressed(true);
|
|
@@ -5593,7 +6070,7 @@ var Switch = React211.forwardRef(
|
|
|
5593
6070
|
onClick(e);
|
|
5594
6071
|
}
|
|
5595
6072
|
};
|
|
5596
|
-
|
|
6073
|
+
React217.useEffect(() => {
|
|
5597
6074
|
return () => {
|
|
5598
6075
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
5599
6076
|
};
|
|
@@ -5611,45 +6088,75 @@ var Switch = React211.forwardRef(
|
|
|
5611
6088
|
Switch_default[size],
|
|
5612
6089
|
disabled && Switch_default.disabled
|
|
5613
6090
|
].filter(Boolean).join(" ");
|
|
6091
|
+
const controlRef = React217.useRef(null);
|
|
5614
6092
|
const iconSize = size === "small" ? 16 : 24;
|
|
5615
|
-
const switchContent = /* @__PURE__ */
|
|
6093
|
+
const switchContent = /* @__PURE__ */ jsx214(
|
|
5616
6094
|
"button",
|
|
5617
6095
|
{
|
|
5618
|
-
ref
|
|
6096
|
+
ref: (node) => {
|
|
6097
|
+
controlRef.current = node;
|
|
6098
|
+
if (typeof ref === "function") ref(node);
|
|
6099
|
+
else if (ref) ref.current = node;
|
|
6100
|
+
},
|
|
5619
6101
|
type: "button",
|
|
6102
|
+
form,
|
|
6103
|
+
value,
|
|
6104
|
+
"aria-required": required || void 0,
|
|
5620
6105
|
role: "switch",
|
|
5621
6106
|
"aria-checked": checked,
|
|
5622
6107
|
className: switchClasses,
|
|
5623
6108
|
disabled,
|
|
5624
6109
|
onClick: handleClick,
|
|
5625
6110
|
...rest,
|
|
5626
|
-
children: /* @__PURE__ */
|
|
6111
|
+
children: /* @__PURE__ */ jsx214("span", { className: Switch_default.switchTrack, children: /* @__PURE__ */ jsx214("span", { className: Switch_default.switchThumb, children: /* @__PURE__ */ jsx214("span", { className: Switch_default.switchThumbInner, children: checked && /* @__PURE__ */ jsx214("span", { className: Switch_default.switchIcon, children: /* @__PURE__ */ jsx214(CheckSmallOutline, { size: iconSize }) }) }) }) })
|
|
6112
|
+
}
|
|
6113
|
+
);
|
|
6114
|
+
const formInput = /* @__PURE__ */ jsx214(
|
|
6115
|
+
NativeSelectionInput,
|
|
6116
|
+
{
|
|
6117
|
+
type: "checkbox",
|
|
6118
|
+
name,
|
|
6119
|
+
value,
|
|
6120
|
+
form,
|
|
6121
|
+
required,
|
|
6122
|
+
disabled,
|
|
6123
|
+
checked,
|
|
6124
|
+
defaultChecked,
|
|
6125
|
+
controlled: isControlled,
|
|
6126
|
+
controlRef,
|
|
6127
|
+
onReset: setInternalChecked
|
|
5627
6128
|
}
|
|
5628
6129
|
);
|
|
5629
6130
|
if (label) {
|
|
5630
|
-
return /* @__PURE__ */
|
|
5631
|
-
|
|
5632
|
-
/* @__PURE__ */
|
|
6131
|
+
return /* @__PURE__ */ jsxs11(Fragment6, { children: [
|
|
6132
|
+
formInput,
|
|
6133
|
+
/* @__PURE__ */ jsxs11("label", { className: containerClasses, children: [
|
|
6134
|
+
switchContent,
|
|
6135
|
+
/* @__PURE__ */ jsx214("span", { className: Switch_default.switchLabel, children: label })
|
|
6136
|
+
] })
|
|
5633
6137
|
] });
|
|
5634
6138
|
}
|
|
5635
|
-
return
|
|
6139
|
+
return /* @__PURE__ */ jsxs11(Fragment6, { children: [
|
|
6140
|
+
formInput,
|
|
6141
|
+
switchContent
|
|
6142
|
+
] });
|
|
5636
6143
|
}
|
|
5637
6144
|
);
|
|
5638
6145
|
Switch.displayName = "Switch";
|
|
5639
6146
|
|
|
5640
6147
|
// ../ultimate/src/components/text-field/TextField.tsx
|
|
5641
|
-
import * as
|
|
6148
|
+
import * as React228 from "react";
|
|
5642
6149
|
import { createPortal as createPortal2 } from "react-dom";
|
|
5643
6150
|
|
|
5644
6151
|
// ../ultimate/src/components/divider/Divider.tsx
|
|
5645
|
-
import * as
|
|
6152
|
+
import * as React218 from "react";
|
|
5646
6153
|
|
|
5647
6154
|
// ../ultimate/src/components/divider/Divider.module.css
|
|
5648
6155
|
var Divider_default = {};
|
|
5649
6156
|
|
|
5650
6157
|
// ../ultimate/src/components/divider/Divider.tsx
|
|
5651
|
-
import { jsx as
|
|
5652
|
-
var Divider =
|
|
6158
|
+
import { jsx as jsx215 } from "react/jsx-runtime";
|
|
6159
|
+
var Divider = React218.forwardRef(
|
|
5653
6160
|
({
|
|
5654
6161
|
orientation = "horizontal",
|
|
5655
6162
|
variant = "solid",
|
|
@@ -5665,7 +6172,7 @@ var Divider = React212.forwardRef(
|
|
|
5665
6172
|
Divider_default[`divider${variant.charAt(0).toUpperCase() + variant.slice(1)}${thicknessKey}`],
|
|
5666
6173
|
className
|
|
5667
6174
|
].filter(Boolean).join(" ");
|
|
5668
|
-
return /* @__PURE__ */
|
|
6175
|
+
return /* @__PURE__ */ jsx215(
|
|
5669
6176
|
"hr",
|
|
5670
6177
|
{
|
|
5671
6178
|
ref,
|
|
@@ -5680,31 +6187,21 @@ var Divider = React212.forwardRef(
|
|
|
5680
6187
|
Divider.displayName = "Divider";
|
|
5681
6188
|
|
|
5682
6189
|
// ../ultimate/src/components/dropdown-list/DropdownList.tsx
|
|
5683
|
-
import * as
|
|
6190
|
+
import * as React226 from "react";
|
|
5684
6191
|
|
|
5685
6192
|
// ../ultimate/src/components/search-field/SearchField.tsx
|
|
5686
|
-
import * as
|
|
6193
|
+
import * as React225 from "react";
|
|
5687
6194
|
|
|
5688
6195
|
// ../ultimate/src/hooks/useComposedRefs.ts
|
|
5689
|
-
import { useCallback as
|
|
5690
|
-
|
|
5691
|
-
// ../ultimate/src/hooks/useCallbackRef.ts
|
|
5692
|
-
import { useRef as useRef5, useEffect as useEffect6, useMemo } from "react";
|
|
5693
|
-
function useCallbackRef(callback) {
|
|
5694
|
-
const callbackRef = useRef5(callback);
|
|
5695
|
-
useEffect6(() => {
|
|
5696
|
-
callbackRef.current = callback;
|
|
5697
|
-
});
|
|
5698
|
-
return useMemo(() => ((...args) => callbackRef.current?.(...args)), []);
|
|
5699
|
-
}
|
|
6196
|
+
import { useCallback as useCallback3 } from "react";
|
|
5700
6197
|
|
|
5701
6198
|
// ../ultimate/src/hooks/useIsomorphicLayoutEffect.ts
|
|
5702
|
-
import { useEffect as
|
|
6199
|
+
import { useEffect as useEffect10, useLayoutEffect as useLayoutEffect3 } from "react";
|
|
5703
6200
|
|
|
5704
6201
|
// ../ultimate/src/hooks/useClickOutside.ts
|
|
5705
|
-
import { useEffect as
|
|
6202
|
+
import { useEffect as useEffect11 } from "react";
|
|
5706
6203
|
function useClickOutside(ref, handler, enabled = true, ignoredRefs = []) {
|
|
5707
|
-
|
|
6204
|
+
useEffect11(() => {
|
|
5708
6205
|
if (!enabled) return;
|
|
5709
6206
|
const listener = (event) => {
|
|
5710
6207
|
const el = ref.current;
|
|
@@ -5729,72 +6226,59 @@ function useClickOutside(ref, handler, enabled = true, ignoredRefs = []) {
|
|
|
5729
6226
|
}
|
|
5730
6227
|
|
|
5731
6228
|
// ../ultimate/src/hooks/useBottomNavElevation.ts
|
|
5732
|
-
import * as
|
|
6229
|
+
import * as React219 from "react";
|
|
5733
6230
|
|
|
5734
|
-
// ../ultimate/src/hooks/
|
|
5735
|
-
import
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
const [uncontrolledValue, setUncontrolledValue] = React214.useState(() => typeof defaultValue === "function" ? defaultValue() : defaultValue);
|
|
5742
|
-
const isControlledRef = React214.useRef(valueProp !== void 0);
|
|
5743
|
-
const isControlled = isControlledRef.current;
|
|
5744
|
-
const value = isControlled ? valueProp : uncontrolledValue;
|
|
5745
|
-
const handleChange = useCallbackRef(onChange);
|
|
5746
|
-
const previousUncontrolledValueRef = React214.useRef(uncontrolledValue);
|
|
5747
|
-
React214.useEffect(() => {
|
|
5748
|
-
if (isControlled) return;
|
|
5749
|
-
if (previousUncontrolledValueRef.current === uncontrolledValue) return;
|
|
5750
|
-
previousUncontrolledValueRef.current = uncontrolledValue;
|
|
5751
|
-
handleChange(uncontrolledValue);
|
|
5752
|
-
}, [isControlled, uncontrolledValue, handleChange]);
|
|
5753
|
-
const setValue = React214.useCallback(
|
|
5754
|
-
(nextValue) => {
|
|
5755
|
-
if (isControlled) {
|
|
5756
|
-
const setter = nextValue;
|
|
5757
|
-
const valueToEmit = typeof nextValue === "function" ? setter(valueProp) : nextValue;
|
|
5758
|
-
handleChange(valueToEmit);
|
|
5759
|
-
} else {
|
|
5760
|
-
setUncontrolledValue((prev) => {
|
|
5761
|
-
const setter = nextValue;
|
|
5762
|
-
return typeof nextValue === "function" ? setter(prev) : nextValue;
|
|
5763
|
-
});
|
|
5764
|
-
}
|
|
5765
|
-
},
|
|
5766
|
-
[isControlled, valueProp, handleChange]
|
|
5767
|
-
);
|
|
5768
|
-
return [value, setValue];
|
|
5769
|
-
}
|
|
6231
|
+
// ../ultimate/src/hooks/useEscapeKeydown.ts
|
|
6232
|
+
import { useContext as useContext4, useEffect as useEffect13 } from "react";
|
|
6233
|
+
|
|
6234
|
+
// ../ultimate/src/internal/overlay/OverlayScope.tsx
|
|
6235
|
+
import * as React220 from "react";
|
|
6236
|
+
import { jsx as jsx216 } from "react/jsx-runtime";
|
|
6237
|
+
var OverlayDepthContext = React220.createContext(0);
|
|
5770
6238
|
|
|
5771
6239
|
// ../ultimate/src/hooks/useEscapeKeydown.ts
|
|
5772
|
-
|
|
6240
|
+
var layersByDocument = /* @__PURE__ */ new WeakMap();
|
|
5773
6241
|
function useEscapeKeydown(handler, enabled = true) {
|
|
5774
6242
|
const handleEscape = useCallbackRef(handler);
|
|
5775
|
-
|
|
6243
|
+
const depth = useContext4(OverlayDepthContext);
|
|
6244
|
+
useEffect13(() => {
|
|
5776
6245
|
if (!enabled) return;
|
|
6246
|
+
const owner = document;
|
|
6247
|
+
let layers = layersByDocument.get(owner);
|
|
6248
|
+
if (!layers) {
|
|
6249
|
+
layers = [];
|
|
6250
|
+
layersByDocument.set(owner, layers);
|
|
6251
|
+
}
|
|
6252
|
+
const layer = { depth, handler: handleEscape };
|
|
6253
|
+
layers.push(layer);
|
|
5777
6254
|
const onKeydown = (event) => {
|
|
5778
|
-
if (event.key
|
|
5779
|
-
|
|
5780
|
-
|
|
6255
|
+
if (event.key !== "Escape" || event.isComposing || event.defaultPrevented) return;
|
|
6256
|
+
const top = layers.reduce((candidate, item) => !candidate || item.depth >= candidate.depth ? item : candidate, void 0);
|
|
6257
|
+
if (top !== layer) return;
|
|
6258
|
+
event.preventDefault();
|
|
6259
|
+
event.stopPropagation();
|
|
6260
|
+
layer.handler(event);
|
|
6261
|
+
};
|
|
6262
|
+
owner.addEventListener("keydown", onKeydown);
|
|
6263
|
+
return () => {
|
|
6264
|
+
const index = layers.indexOf(layer);
|
|
6265
|
+
if (index >= 0) layers.splice(index, 1);
|
|
6266
|
+
owner.removeEventListener("keydown", onKeydown);
|
|
5781
6267
|
};
|
|
5782
|
-
|
|
5783
|
-
return () => document.removeEventListener("keydown", onKeydown);
|
|
5784
|
-
}, [enabled, handleEscape]);
|
|
6268
|
+
}, [enabled, handleEscape, depth]);
|
|
5785
6269
|
}
|
|
5786
6270
|
|
|
5787
6271
|
// ../ultimate/src/hooks/useFocusTrap.ts
|
|
5788
|
-
import * as
|
|
6272
|
+
import * as React221 from "react";
|
|
5789
6273
|
|
|
5790
6274
|
// ../ultimate/src/hooks/useId.ts
|
|
5791
|
-
import * as
|
|
6275
|
+
import * as React222 from "react";
|
|
5792
6276
|
|
|
5793
6277
|
// ../ultimate/src/hooks/useMediaQuery.ts
|
|
5794
|
-
import * as
|
|
6278
|
+
import * as React223 from "react";
|
|
5795
6279
|
|
|
5796
6280
|
// ../ultimate/src/hooks/usePopoverPosition.ts
|
|
5797
|
-
import { useState as useState9, useLayoutEffect as
|
|
6281
|
+
import { useState as useState9, useLayoutEffect as useLayoutEffect4, useRef as useRef11 } from "react";
|
|
5798
6282
|
var MOBILE_VIEWPORT_MARGIN = 16;
|
|
5799
6283
|
var POPOVER_SURFACE_SELECTOR = "[data-popover-surface]";
|
|
5800
6284
|
var resolvePopoverBoundary = (triggerEl, viewportWidth, viewportHeight, desktopMargin) => {
|
|
@@ -5824,10 +6308,10 @@ function usePopoverPosition(triggerRef, popoverRef, isOpen, options = {}) {
|
|
|
5824
6308
|
const { minHeight = 300, margin = 32, gap = 4, strategy = "absolute", matchTriggerWidth = false, onClose } = options;
|
|
5825
6309
|
const [position, setPosition] = useState9("bottom");
|
|
5826
6310
|
const [align, setAlign] = useState9("left");
|
|
5827
|
-
const onCloseRef =
|
|
6311
|
+
const onCloseRef = useRef11(onClose);
|
|
5828
6312
|
onCloseRef.current = onClose;
|
|
5829
6313
|
const [coords, setCoords] = useState9({});
|
|
5830
|
-
|
|
6314
|
+
useLayoutEffect4(() => {
|
|
5831
6315
|
if (isOpen && triggerRef.current) {
|
|
5832
6316
|
const updatePosition = () => {
|
|
5833
6317
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
@@ -5936,22 +6420,22 @@ function usePopoverPosition(triggerRef, popoverRef, isOpen, options = {}) {
|
|
|
5936
6420
|
}
|
|
5937
6421
|
|
|
5938
6422
|
// ../ultimate/src/hooks/usePresence.ts
|
|
5939
|
-
import { useState as useState10, useCallback as useCallback4, useEffect as
|
|
6423
|
+
import { useState as useState10, useCallback as useCallback4, useEffect as useEffect16 } from "react";
|
|
5940
6424
|
|
|
5941
6425
|
// ../ultimate/src/hooks/usePrevious.ts
|
|
5942
|
-
import { useRef as
|
|
6426
|
+
import { useRef as useRef12, useEffect as useEffect17 } from "react";
|
|
5943
6427
|
|
|
5944
6428
|
// ../ultimate/src/hooks/useResizeObserver.ts
|
|
5945
|
-
import { useEffect as
|
|
6429
|
+
import { useEffect as useEffect18 } from "react";
|
|
5946
6430
|
|
|
5947
6431
|
// ../ultimate/src/hooks/useScrollLock.ts
|
|
5948
|
-
import { useEffect as
|
|
6432
|
+
import { useEffect as useEffect19, useRef as useRef13 } from "react";
|
|
5949
6433
|
|
|
5950
6434
|
// ../ultimate/src/hooks/useSubHeaderStickyState.ts
|
|
5951
|
-
import * as
|
|
6435
|
+
import * as React224 from "react";
|
|
5952
6436
|
|
|
5953
6437
|
// ../ultimate/src/hooks/useVirtualList.ts
|
|
5954
|
-
import { useState as useState12, useMemo as
|
|
6438
|
+
import { useState as useState12, useMemo as useMemo4 } from "react";
|
|
5955
6439
|
function useVirtualList({
|
|
5956
6440
|
itemCount,
|
|
5957
6441
|
itemHeight,
|
|
@@ -5964,7 +6448,7 @@ function useVirtualList({
|
|
|
5964
6448
|
itemCount - 1,
|
|
5965
6449
|
Math.floor((scrollTop + containerHeight) / itemHeight) + overscan
|
|
5966
6450
|
);
|
|
5967
|
-
const virtualItems =
|
|
6451
|
+
const virtualItems = useMemo4(() => {
|
|
5968
6452
|
const items = [];
|
|
5969
6453
|
for (let i = startIndex; i <= endIndex; i++) {
|
|
5970
6454
|
items.push({
|
|
@@ -6007,18 +6491,18 @@ var FOCUSABLE_SELECTOR = [
|
|
|
6007
6491
|
].join(", ");
|
|
6008
6492
|
var isFocusable = (element) => {
|
|
6009
6493
|
if (element.hasAttribute("disabled")) return false;
|
|
6010
|
-
if (element.
|
|
6494
|
+
if (element.closest('[aria-hidden="true"], [inert], [hidden]')) return false;
|
|
6011
6495
|
if (element.tabIndex < 0) return false;
|
|
6012
6496
|
const style = window.getComputedStyle(element);
|
|
6013
6497
|
if (style.display === "none" || style.visibility === "hidden") return false;
|
|
6014
6498
|
return true;
|
|
6015
6499
|
};
|
|
6016
|
-
var focusNextElement = (currentElement) => {
|
|
6500
|
+
var focusNextElement = (currentElement, backwards = false) => {
|
|
6017
6501
|
if (typeof document === "undefined") return;
|
|
6018
6502
|
const focusableElements = Array.from(document.querySelectorAll(FOCUSABLE_SELECTOR)).filter(isFocusable);
|
|
6019
6503
|
const currentIndex = focusableElements.indexOf(currentElement);
|
|
6020
6504
|
if (currentIndex === -1) return;
|
|
6021
|
-
const nextElement = focusableElements[currentIndex + 1];
|
|
6505
|
+
const nextElement = focusableElements[currentIndex + (backwards ? -1 : 1)];
|
|
6022
6506
|
nextElement?.focus();
|
|
6023
6507
|
};
|
|
6024
6508
|
|
|
@@ -6026,8 +6510,8 @@ var focusNextElement = (currentElement) => {
|
|
|
6026
6510
|
var SearchField_default = {};
|
|
6027
6511
|
|
|
6028
6512
|
// ../ultimate/src/components/search-field/SearchField.tsx
|
|
6029
|
-
import { jsx as
|
|
6030
|
-
var SearchField =
|
|
6513
|
+
import { jsx as jsx217, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
6514
|
+
var SearchField = React225.forwardRef(
|
|
6031
6515
|
({
|
|
6032
6516
|
placeholder = "Search",
|
|
6033
6517
|
variant = "default",
|
|
@@ -6036,6 +6520,7 @@ var SearchField = React219.forwardRef(
|
|
|
6036
6520
|
showClear = true,
|
|
6037
6521
|
onClear,
|
|
6038
6522
|
disabled,
|
|
6523
|
+
readOnly,
|
|
6039
6524
|
className,
|
|
6040
6525
|
style,
|
|
6041
6526
|
onFocus,
|
|
@@ -6048,17 +6533,17 @@ var SearchField = React219.forwardRef(
|
|
|
6048
6533
|
width,
|
|
6049
6534
|
...props
|
|
6050
6535
|
}, ref) => {
|
|
6051
|
-
const [focused, setFocused] =
|
|
6536
|
+
const [focused, setFocused] = React225.useState(false);
|
|
6052
6537
|
const [valueState, setValueState] = useControllableState({
|
|
6053
6538
|
value,
|
|
6054
6539
|
defaultValue: defaultValue || "",
|
|
6055
6540
|
onChange
|
|
6056
6541
|
});
|
|
6057
|
-
const inputRef =
|
|
6058
|
-
|
|
6542
|
+
const inputRef = React225.useRef(null);
|
|
6543
|
+
React225.useEffect(() => {
|
|
6059
6544
|
if (!shortcutHint || disabled) return;
|
|
6060
6545
|
const handleGlobalKeyDown = (e) => {
|
|
6061
|
-
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "k") {
|
|
6546
|
+
if (!e.isComposing && !e.defaultPrevented && (e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "k") {
|
|
6062
6547
|
e.preventDefault();
|
|
6063
6548
|
inputRef.current?.focus();
|
|
6064
6549
|
}
|
|
@@ -6066,7 +6551,7 @@ var SearchField = React219.forwardRef(
|
|
|
6066
6551
|
window.addEventListener("keydown", handleGlobalKeyDown);
|
|
6067
6552
|
return () => window.removeEventListener("keydown", handleGlobalKeyDown);
|
|
6068
6553
|
}, [shortcutHint, disabled]);
|
|
6069
|
-
|
|
6554
|
+
React225.useImperativeHandle(ref, () => inputRef.current);
|
|
6070
6555
|
const currentValue = valueState;
|
|
6071
6556
|
const handleFocus = (e) => {
|
|
6072
6557
|
setFocused(true);
|
|
@@ -6077,6 +6562,7 @@ var SearchField = React219.forwardRef(
|
|
|
6077
6562
|
onBlur?.(e);
|
|
6078
6563
|
};
|
|
6079
6564
|
const handleChange = (e) => {
|
|
6565
|
+
if (disabled || readOnly) return;
|
|
6080
6566
|
setValueState(e.target.value);
|
|
6081
6567
|
};
|
|
6082
6568
|
const handleDoubleClick = (e) => {
|
|
@@ -6086,6 +6572,7 @@ var SearchField = React219.forwardRef(
|
|
|
6086
6572
|
}
|
|
6087
6573
|
};
|
|
6088
6574
|
const handleClear = (e) => {
|
|
6575
|
+
if (disabled || readOnly) return;
|
|
6089
6576
|
e.preventDefault();
|
|
6090
6577
|
e.stopPropagation();
|
|
6091
6578
|
setValueState("");
|
|
@@ -6093,12 +6580,13 @@ var SearchField = React219.forwardRef(
|
|
|
6093
6580
|
inputRef.current?.focus();
|
|
6094
6581
|
};
|
|
6095
6582
|
const handleKeyDown = (e) => {
|
|
6583
|
+
if (disabled || e.nativeEvent.isComposing) return;
|
|
6096
6584
|
if (e.key === "Enter") {
|
|
6097
6585
|
e.preventDefault();
|
|
6098
6586
|
focusNextElement(e.currentTarget);
|
|
6099
6587
|
}
|
|
6100
6588
|
};
|
|
6101
|
-
return /* @__PURE__ */
|
|
6589
|
+
return /* @__PURE__ */ jsxs12(
|
|
6102
6590
|
"div",
|
|
6103
6591
|
{
|
|
6104
6592
|
className: [
|
|
@@ -6114,13 +6602,14 @@ var SearchField = React219.forwardRef(
|
|
|
6114
6602
|
style: { ...style, width },
|
|
6115
6603
|
onClick: () => !disabled && inputRef.current?.focus(),
|
|
6116
6604
|
children: [
|
|
6117
|
-
/* @__PURE__ */
|
|
6118
|
-
/* @__PURE__ */
|
|
6605
|
+
/* @__PURE__ */ jsx217("span", { className: SearchField_default.searchFieldIcon, children: /* @__PURE__ */ jsx217(SearchOutline, { size: size === "large" ? 24 : 20 }) }),
|
|
6606
|
+
/* @__PURE__ */ jsx217(
|
|
6119
6607
|
"input",
|
|
6120
6608
|
{
|
|
6121
6609
|
ref: inputRef,
|
|
6122
6610
|
className: SearchField_default.searchFieldInput,
|
|
6123
6611
|
disabled,
|
|
6612
|
+
readOnly,
|
|
6124
6613
|
onFocus: handleFocus,
|
|
6125
6614
|
onBlur: handleBlur,
|
|
6126
6615
|
onDoubleClick: handleDoubleClick,
|
|
@@ -6132,8 +6621,8 @@ var SearchField = React219.forwardRef(
|
|
|
6132
6621
|
...props
|
|
6133
6622
|
}
|
|
6134
6623
|
),
|
|
6135
|
-
/* @__PURE__ */
|
|
6136
|
-
shortcutHint && (!focused || !currentValue) && /* @__PURE__ */
|
|
6624
|
+
/* @__PURE__ */ jsxs12("div", { className: SearchField_default.searchFieldTrailingGroup, children: [
|
|
6625
|
+
shortcutHint && (!focused || !currentValue) && /* @__PURE__ */ jsx217(
|
|
6137
6626
|
Badge,
|
|
6138
6627
|
{
|
|
6139
6628
|
variant: "secondary",
|
|
@@ -6142,12 +6631,12 @@ var SearchField = React219.forwardRef(
|
|
|
6142
6631
|
label: shortcutHint
|
|
6143
6632
|
}
|
|
6144
6633
|
),
|
|
6145
|
-
showClear && focused && currentValue && !disabled && /* @__PURE__ */
|
|
6634
|
+
showClear && focused && currentValue && !disabled && !readOnly && /* @__PURE__ */ jsx217(
|
|
6146
6635
|
IconButton,
|
|
6147
6636
|
{
|
|
6148
6637
|
variant: "primary",
|
|
6149
6638
|
shape: "pill",
|
|
6150
|
-
icon: /* @__PURE__ */
|
|
6639
|
+
icon: /* @__PURE__ */ jsx217(CloseSmallOutline, {}),
|
|
6151
6640
|
onMouseDown: (e) => e.preventDefault(),
|
|
6152
6641
|
onClick: handleClear,
|
|
6153
6642
|
tabIndex: -1,
|
|
@@ -6166,11 +6655,21 @@ SearchField.displayName = "SearchField";
|
|
|
6166
6655
|
// ../ultimate/src/components/dropdown-list/DropdownList.module.css
|
|
6167
6656
|
var DropdownList_default = {};
|
|
6168
6657
|
|
|
6658
|
+
// ../ultimate/src/internal/collection/getItemId.ts
|
|
6659
|
+
function getItemId(collectionId, part, key) {
|
|
6660
|
+
const escaped = key.replace(/[^A-Za-z0-9-]/g, (char) => `_${char.charCodeAt(0).toString(16)}_`);
|
|
6661
|
+
return `${collectionId}-${part}-${escaped}`;
|
|
6662
|
+
}
|
|
6663
|
+
|
|
6169
6664
|
// ../ultimate/src/components/dropdown-list/DropdownList.tsx
|
|
6170
|
-
import { jsx as
|
|
6171
|
-
var DropdownList =
|
|
6665
|
+
import { jsx as jsx218, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
6666
|
+
var DropdownList = React226.forwardRef(
|
|
6172
6667
|
({
|
|
6173
6668
|
items,
|
|
6669
|
+
role = "listbox",
|
|
6670
|
+
id,
|
|
6671
|
+
"aria-label": ariaLabel,
|
|
6672
|
+
"aria-labelledby": ariaLabelledBy,
|
|
6174
6673
|
value = [],
|
|
6175
6674
|
size = "md",
|
|
6176
6675
|
mode = "single",
|
|
@@ -6182,29 +6681,32 @@ var DropdownList = React220.forwardRef(
|
|
|
6182
6681
|
className,
|
|
6183
6682
|
style
|
|
6184
6683
|
}, ref) => {
|
|
6185
|
-
const
|
|
6186
|
-
const
|
|
6187
|
-
const
|
|
6684
|
+
const typeaheadRef = React226.useRef({ text: "", time: 0 });
|
|
6685
|
+
const [searchQuery, setSearchQuery] = React226.useState("");
|
|
6686
|
+
const showSearch = role === "listbox" && items.length >= 10;
|
|
6687
|
+
const instanceId = React226.useId();
|
|
6688
|
+
const itemId = (value2) => value2 === void 0 ? void 0 : getItemId(instanceId, "item", value2);
|
|
6689
|
+
const selectedValues = React226.useMemo(() => {
|
|
6188
6690
|
if (Array.isArray(value)) return value;
|
|
6189
6691
|
return value ? [value] : [];
|
|
6190
6692
|
}, [value]);
|
|
6191
|
-
const filteredItems =
|
|
6693
|
+
const filteredItems = React226.useMemo(() => {
|
|
6192
6694
|
if (!searchQuery.trim()) return items;
|
|
6193
6695
|
const query = searchQuery.toLowerCase();
|
|
6194
6696
|
return items.filter(
|
|
6195
6697
|
(item) => item.label.toLowerCase().includes(query)
|
|
6196
6698
|
);
|
|
6197
6699
|
}, [items, searchQuery]);
|
|
6198
|
-
const selectableFilteredValues =
|
|
6700
|
+
const selectableFilteredValues = React226.useMemo(() => filteredItems.filter((item) => !item.disabled).map((item) => item.value), [filteredItems]);
|
|
6199
6701
|
const showSelectAll = mode === "multi" && Boolean(selectAllLabel) && selectableFilteredValues.length > 0;
|
|
6200
6702
|
const allFilteredSelected = showSelectAll && selectableFilteredValues.every((itemValue) => selectedValues.includes(itemValue));
|
|
6201
6703
|
const someFilteredSelected = showSelectAll && !allFilteredSelected && selectableFilteredValues.some((itemValue) => selectedValues.includes(itemValue));
|
|
6202
|
-
const handleSelectAllClick =
|
|
6704
|
+
const handleSelectAllClick = React226.useCallback(() => {
|
|
6203
6705
|
if (!showSelectAll) return;
|
|
6204
6706
|
const nextValues = allFilteredSelected ? selectedValues.filter((itemValue) => !selectableFilteredValues.includes(itemValue)) : Array.from(/* @__PURE__ */ new Set([...selectedValues, ...selectableFilteredValues]));
|
|
6205
6707
|
onChange?.(nextValues);
|
|
6206
6708
|
}, [allFilteredSelected, onChange, selectableFilteredValues, selectedValues, showSelectAll]);
|
|
6207
|
-
const displayItems =
|
|
6709
|
+
const displayItems = React226.useMemo(() => {
|
|
6208
6710
|
if (!showSelectAll || !selectAllLabel) return filteredItems;
|
|
6209
6711
|
return [
|
|
6210
6712
|
{ value: "__phx_select_all__", label: selectAllLabel, __selectAll: true },
|
|
@@ -6227,10 +6729,10 @@ var DropdownList = React220.forwardRef(
|
|
|
6227
6729
|
const isSelected = (itemValue) => {
|
|
6228
6730
|
return selectedValues.includes(itemValue);
|
|
6229
6731
|
};
|
|
6230
|
-
const [showTopGradient, setShowTopGradient] =
|
|
6231
|
-
const [showBottomGradient, setShowBottomGradient] =
|
|
6232
|
-
const listRef =
|
|
6233
|
-
const handleScroll =
|
|
6732
|
+
const [showTopGradient, setShowTopGradient] = React226.useState(false);
|
|
6733
|
+
const [showBottomGradient, setShowBottomGradient] = React226.useState(false);
|
|
6734
|
+
const listRef = React226.useRef(null);
|
|
6735
|
+
const handleScroll = React226.useCallback(() => {
|
|
6234
6736
|
const el = listRef.current;
|
|
6235
6737
|
if (!el) return;
|
|
6236
6738
|
const scrollTop = el.scrollTop;
|
|
@@ -6239,7 +6741,7 @@ var DropdownList = React220.forwardRef(
|
|
|
6239
6741
|
setShowTopGradient(scrollTop > 10);
|
|
6240
6742
|
setShowBottomGradient(scrollTop + clientHeight < scrollHeight - 10);
|
|
6241
6743
|
}, []);
|
|
6242
|
-
|
|
6744
|
+
React226.useEffect(() => {
|
|
6243
6745
|
handleScroll();
|
|
6244
6746
|
}, [displayItems, handleScroll]);
|
|
6245
6747
|
const ITEM_HEIGHT = size === "sm" ? 32 : 48;
|
|
@@ -6249,9 +6751,9 @@ var DropdownList = React220.forwardRef(
|
|
|
6249
6751
|
itemHeight: ITEM_HEIGHT,
|
|
6250
6752
|
containerHeight: parsedMaxHeight
|
|
6251
6753
|
});
|
|
6252
|
-
const [focusedIndex, setFocusedIndex] =
|
|
6253
|
-
const [isKeyboardMode, setIsKeyboardMode] =
|
|
6254
|
-
|
|
6754
|
+
const [focusedIndex, setFocusedIndex] = React226.useState(-1);
|
|
6755
|
+
const [isKeyboardMode, setIsKeyboardMode] = React226.useState(false);
|
|
6756
|
+
React226.useEffect(() => {
|
|
6255
6757
|
if (displayItems.length === 0) {
|
|
6256
6758
|
setFocusedIndex(-1);
|
|
6257
6759
|
return;
|
|
@@ -6268,7 +6770,7 @@ var DropdownList = React220.forwardRef(
|
|
|
6268
6770
|
return prev;
|
|
6269
6771
|
});
|
|
6270
6772
|
}, [displayItems, value, mode]);
|
|
6271
|
-
|
|
6773
|
+
React226.useEffect(() => {
|
|
6272
6774
|
if (focusedIndex !== -1 && listRef.current) {
|
|
6273
6775
|
const itemTop = focusedIndex * ITEM_HEIGHT;
|
|
6274
6776
|
const itemBottom = itemTop + ITEM_HEIGHT;
|
|
@@ -6282,22 +6784,34 @@ var DropdownList = React220.forwardRef(
|
|
|
6282
6784
|
}
|
|
6283
6785
|
}
|
|
6284
6786
|
}, [focusedIndex, ITEM_HEIGHT]);
|
|
6285
|
-
const handleListScroll =
|
|
6787
|
+
const handleListScroll = React226.useCallback((e) => {
|
|
6286
6788
|
handleScroll();
|
|
6287
6789
|
if (isVirtual) onVirtualScroll(e);
|
|
6288
6790
|
}, [handleScroll, isVirtual, onVirtualScroll]);
|
|
6289
6791
|
const handleKeyDown = (e) => {
|
|
6290
|
-
if (displayItems.length === 0) return;
|
|
6792
|
+
if (e.nativeEvent.isComposing || e.defaultPrevented || displayItems.length === 0) return;
|
|
6291
6793
|
if (["ArrowDown", "ArrowUp", "Home", "End", "Enter", " "].includes(e.key)) {
|
|
6292
6794
|
setIsKeyboardMode(true);
|
|
6293
6795
|
}
|
|
6294
6796
|
const isSearchFocus = e.target.tagName === "INPUT";
|
|
6295
6797
|
if (e.key === "ArrowDown") {
|
|
6296
6798
|
e.preventDefault();
|
|
6297
|
-
setFocusedIndex((prev) =>
|
|
6799
|
+
setFocusedIndex((prev) => {
|
|
6800
|
+
for (let offset = 1; offset <= displayItems.length; offset++) {
|
|
6801
|
+
const next = (prev + offset + displayItems.length) % displayItems.length;
|
|
6802
|
+
if (displayItems[next] && !displayItems[next].disabled) return next;
|
|
6803
|
+
}
|
|
6804
|
+
return -1;
|
|
6805
|
+
});
|
|
6298
6806
|
} else if (e.key === "ArrowUp") {
|
|
6299
6807
|
e.preventDefault();
|
|
6300
|
-
setFocusedIndex((prev) =>
|
|
6808
|
+
setFocusedIndex((prev) => {
|
|
6809
|
+
for (let offset = 1; offset <= displayItems.length; offset++) {
|
|
6810
|
+
const next = ((prev < 0 ? 0 : prev) - offset + displayItems.length) % displayItems.length;
|
|
6811
|
+
if (displayItems[next] && !displayItems[next].disabled) return next;
|
|
6812
|
+
}
|
|
6813
|
+
return -1;
|
|
6814
|
+
});
|
|
6301
6815
|
} else if (e.key === "Enter") {
|
|
6302
6816
|
e.preventDefault();
|
|
6303
6817
|
if (focusedIndex !== -1) {
|
|
@@ -6319,16 +6833,32 @@ var DropdownList = React220.forwardRef(
|
|
|
6319
6833
|
} else if (e.key === "Home") {
|
|
6320
6834
|
if (!isSearchFocus) {
|
|
6321
6835
|
e.preventDefault();
|
|
6322
|
-
setFocusedIndex(
|
|
6836
|
+
setFocusedIndex(displayItems.findIndex((item) => !item.disabled));
|
|
6323
6837
|
}
|
|
6324
6838
|
} else if (e.key === "End") {
|
|
6325
6839
|
if (!isSearchFocus) {
|
|
6326
6840
|
e.preventDefault();
|
|
6327
|
-
setFocusedIndex(displayItems.
|
|
6841
|
+
setFocusedIndex(displayItems.map((item) => !item.disabled).lastIndexOf(true));
|
|
6842
|
+
}
|
|
6843
|
+
} else if (!isSearchFocus && e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {
|
|
6844
|
+
const now = Date.now();
|
|
6845
|
+
const previous = typeaheadRef.current;
|
|
6846
|
+
const text = `${now - previous.time < 600 ? previous.text : ""}${e.key.toLocaleLowerCase()}`;
|
|
6847
|
+
typeaheadRef.current = { text, time: now };
|
|
6848
|
+
const query = [...text].every((character) => character === text[0]) ? text[0] : text;
|
|
6849
|
+
for (let offset = 1; offset <= displayItems.length; offset++) {
|
|
6850
|
+
const next = (focusedIndex + offset + displayItems.length) % displayItems.length;
|
|
6851
|
+
const item = displayItems[next];
|
|
6852
|
+
if (item && !item.disabled && item.label.toLocaleLowerCase().startsWith(query)) {
|
|
6853
|
+
e.preventDefault();
|
|
6854
|
+
setIsKeyboardMode(true);
|
|
6855
|
+
setFocusedIndex(next);
|
|
6856
|
+
break;
|
|
6857
|
+
}
|
|
6328
6858
|
}
|
|
6329
6859
|
}
|
|
6330
6860
|
};
|
|
6331
|
-
return /* @__PURE__ */
|
|
6861
|
+
return /* @__PURE__ */ jsxs13(
|
|
6332
6862
|
"div",
|
|
6333
6863
|
{
|
|
6334
6864
|
ref,
|
|
@@ -6337,38 +6867,43 @@ var DropdownList = React220.forwardRef(
|
|
|
6337
6867
|
onKeyDown: handleKeyDown,
|
|
6338
6868
|
onMouseMove: () => setIsKeyboardMode(false),
|
|
6339
6869
|
children: [
|
|
6340
|
-
showSearch && /* @__PURE__ */
|
|
6870
|
+
showSearch && /* @__PURE__ */ jsx218("div", { className: DropdownList_default.dropdownListSearchWrapper, children: /* @__PURE__ */ jsx218(
|
|
6341
6871
|
SearchField,
|
|
6342
6872
|
{
|
|
6343
6873
|
placeholder: searchPlaceholder,
|
|
6344
6874
|
value: searchQuery,
|
|
6345
6875
|
onChange: setSearchQuery,
|
|
6346
|
-
shortcutHint: "Ctrl + /"
|
|
6876
|
+
shortcutHint: "Ctrl + /",
|
|
6877
|
+
onKeyDown: () => {
|
|
6878
|
+
}
|
|
6347
6879
|
}
|
|
6348
6880
|
) }),
|
|
6349
|
-
/* @__PURE__ */
|
|
6350
|
-
/* @__PURE__ */
|
|
6881
|
+
/* @__PURE__ */ jsxs13("div", { className: DropdownList_default.dropdownListItemsListContainer, children: [
|
|
6882
|
+
/* @__PURE__ */ jsx218("div", { className: [
|
|
6351
6883
|
DropdownList_default.dropdownListGradient,
|
|
6352
6884
|
DropdownList_default.dropdownListGradientTop,
|
|
6353
6885
|
showTopGradient && DropdownList_default.dropdownListGradientVisible
|
|
6354
6886
|
].filter(Boolean).join(" ") }),
|
|
6355
|
-
/* @__PURE__ */
|
|
6887
|
+
/* @__PURE__ */ jsx218(
|
|
6356
6888
|
"div",
|
|
6357
6889
|
{
|
|
6358
6890
|
ref: listRef,
|
|
6359
6891
|
className: `${DropdownList_default.dropdownListItemsList} scrollbarSm`,
|
|
6360
6892
|
style: { maxHeight },
|
|
6361
|
-
role
|
|
6893
|
+
role,
|
|
6894
|
+
id,
|
|
6895
|
+
"aria-label": ariaLabel,
|
|
6896
|
+
"aria-labelledby": ariaLabelledBy,
|
|
6362
6897
|
tabIndex: 0,
|
|
6363
|
-
"aria-multiselectable": mode === "multi" ? true : void 0,
|
|
6364
|
-
"aria-activedescendant": focusedIndex !== -1 ?
|
|
6898
|
+
"aria-multiselectable": role === "listbox" && mode === "multi" ? true : void 0,
|
|
6899
|
+
"aria-activedescendant": focusedIndex !== -1 ? itemId(displayItems[focusedIndex]?.value) : void 0,
|
|
6365
6900
|
onScroll: handleListScroll,
|
|
6366
|
-
children: displayItems.length === 0 ? /* @__PURE__ */
|
|
6901
|
+
children: displayItems.length === 0 ? /* @__PURE__ */ jsx218("div", { className: DropdownList_default.dropdownListEmptyState, children: "No results found" }) : isVirtual ? /* @__PURE__ */ jsx218("div", { style: { height: totalHeight, position: "relative" }, children: virtualItems.map(({ index, style: style2 }) => {
|
|
6367
6902
|
const item = displayItems[index];
|
|
6368
6903
|
if (!item) return null;
|
|
6369
6904
|
const isFocused = index === focusedIndex;
|
|
6370
6905
|
const isSelectAllItem = Boolean(item.__selectAll);
|
|
6371
|
-
return /* @__PURE__ */
|
|
6906
|
+
return /* @__PURE__ */ jsx218("div", { style: style2, children: /* @__PURE__ */ jsx218(
|
|
6372
6907
|
"div",
|
|
6373
6908
|
{
|
|
6374
6909
|
className: [
|
|
@@ -6376,10 +6911,10 @@ var DropdownList = React220.forwardRef(
|
|
|
6376
6911
|
showDividers && DropdownList_default.dropdownListItemWrapperWithDivider,
|
|
6377
6912
|
item.divider && DropdownList_default.dropdownListItemWrapperWithBottomDivider
|
|
6378
6913
|
].filter(Boolean).join(" "),
|
|
6379
|
-
children: /* @__PURE__ */
|
|
6914
|
+
children: /* @__PURE__ */ jsxs13(
|
|
6380
6915
|
"div",
|
|
6381
6916
|
{
|
|
6382
|
-
id:
|
|
6917
|
+
id: itemId(item.value),
|
|
6383
6918
|
className: [
|
|
6384
6919
|
DropdownList_default.dropdownListItem,
|
|
6385
6920
|
size === "sm" && DropdownList_default.dropdownListItemSm,
|
|
@@ -6388,11 +6923,11 @@ var DropdownList = React220.forwardRef(
|
|
|
6388
6923
|
item.disabled && DropdownList_default.dropdownListItemDisabled
|
|
6389
6924
|
].filter(Boolean).join(" "),
|
|
6390
6925
|
onClick: () => handleItemClick(item.value, item.disabled, isSelectAllItem),
|
|
6391
|
-
role: "option",
|
|
6392
|
-
"aria-selected": isSelectAllItem ? allFilteredSelected : isSelected(item.value),
|
|
6926
|
+
role: role === "menu" ? "menuitem" : "option",
|
|
6927
|
+
"aria-selected": role === "listbox" ? isSelectAllItem ? allFilteredSelected : isSelected(item.value) : void 0,
|
|
6393
6928
|
"aria-disabled": item.disabled,
|
|
6394
6929
|
children: [
|
|
6395
|
-
mode === "multi" && /* @__PURE__ */
|
|
6930
|
+
mode === "multi" && /* @__PURE__ */ jsx218(
|
|
6396
6931
|
Checkbox,
|
|
6397
6932
|
{
|
|
6398
6933
|
checked: isSelectAllItem ? allFilteredSelected : isSelected(item.value),
|
|
@@ -6404,9 +6939,9 @@ var DropdownList = React220.forwardRef(
|
|
|
6404
6939
|
tabIndex: -1
|
|
6405
6940
|
}
|
|
6406
6941
|
),
|
|
6407
|
-
item.icon && /* @__PURE__ */
|
|
6408
|
-
/* @__PURE__ */
|
|
6409
|
-
mode === "single" && isSelected(item.value) && /* @__PURE__ */
|
|
6942
|
+
item.icon && /* @__PURE__ */ jsx218("span", { className: DropdownList_default.dropdownListItemIcon, children: React226.isValidElement(item.icon) ? React226.cloneElement(item.icon, { size: size === "sm" ? 20 : 24 }) : item.icon }),
|
|
6943
|
+
/* @__PURE__ */ jsx218("span", { className: DropdownList_default.dropdownListItemLabel, children: item.label }),
|
|
6944
|
+
mode === "single" && isSelected(item.value) && /* @__PURE__ */ jsx218("span", { className: DropdownList_default.dropdownListCheckmark, children: /* @__PURE__ */ jsx218(CheckSmallOutline, { size: size === "sm" ? 20 : 24 }) })
|
|
6410
6945
|
]
|
|
6411
6946
|
}
|
|
6412
6947
|
)
|
|
@@ -6415,7 +6950,7 @@ var DropdownList = React220.forwardRef(
|
|
|
6415
6950
|
}) }) : displayItems.map((item, index) => {
|
|
6416
6951
|
const isFocused = index === focusedIndex;
|
|
6417
6952
|
const isSelectAllItem = Boolean(item.__selectAll);
|
|
6418
|
-
return /* @__PURE__ */
|
|
6953
|
+
return /* @__PURE__ */ jsx218(
|
|
6419
6954
|
"div",
|
|
6420
6955
|
{
|
|
6421
6956
|
className: [
|
|
@@ -6423,10 +6958,10 @@ var DropdownList = React220.forwardRef(
|
|
|
6423
6958
|
showDividers && DropdownList_default.dropdownListItemWrapperWithDivider,
|
|
6424
6959
|
item.divider && DropdownList_default.dropdownListItemWrapperWithBottomDivider
|
|
6425
6960
|
].filter(Boolean).join(" "),
|
|
6426
|
-
children: /* @__PURE__ */
|
|
6961
|
+
children: /* @__PURE__ */ jsxs13(
|
|
6427
6962
|
"div",
|
|
6428
6963
|
{
|
|
6429
|
-
id:
|
|
6964
|
+
id: itemId(item.value),
|
|
6430
6965
|
className: [
|
|
6431
6966
|
DropdownList_default.dropdownListItem,
|
|
6432
6967
|
size === "sm" && DropdownList_default.dropdownListItemSm,
|
|
@@ -6435,11 +6970,11 @@ var DropdownList = React220.forwardRef(
|
|
|
6435
6970
|
item.disabled && DropdownList_default.dropdownListItemDisabled
|
|
6436
6971
|
].filter(Boolean).join(" "),
|
|
6437
6972
|
onClick: () => handleItemClick(item.value, item.disabled, isSelectAllItem),
|
|
6438
|
-
role: "option",
|
|
6439
|
-
"aria-selected": isSelectAllItem ? allFilteredSelected : isSelected(item.value),
|
|
6973
|
+
role: role === "menu" ? "menuitem" : "option",
|
|
6974
|
+
"aria-selected": role === "listbox" ? isSelectAllItem ? allFilteredSelected : isSelected(item.value) : void 0,
|
|
6440
6975
|
"aria-disabled": item.disabled,
|
|
6441
6976
|
children: [
|
|
6442
|
-
mode === "multi" && /* @__PURE__ */
|
|
6977
|
+
mode === "multi" && /* @__PURE__ */ jsx218(
|
|
6443
6978
|
Checkbox,
|
|
6444
6979
|
{
|
|
6445
6980
|
checked: isSelectAllItem ? allFilteredSelected : isSelected(item.value),
|
|
@@ -6451,9 +6986,9 @@ var DropdownList = React220.forwardRef(
|
|
|
6451
6986
|
tabIndex: -1
|
|
6452
6987
|
}
|
|
6453
6988
|
),
|
|
6454
|
-
item.icon && /* @__PURE__ */
|
|
6455
|
-
/* @__PURE__ */
|
|
6456
|
-
mode === "single" && isSelected(item.value) && /* @__PURE__ */
|
|
6989
|
+
item.icon && /* @__PURE__ */ jsx218("span", { className: DropdownList_default.dropdownListItemIcon, children: React226.isValidElement(item.icon) ? React226.cloneElement(item.icon, { size: size === "sm" ? 20 : 24 }) : item.icon }),
|
|
6990
|
+
/* @__PURE__ */ jsx218("span", { className: DropdownList_default.dropdownListItemLabel, children: item.label }),
|
|
6991
|
+
mode === "single" && isSelected(item.value) && /* @__PURE__ */ jsx218("span", { className: DropdownList_default.dropdownListCheckmark, children: /* @__PURE__ */ jsx218(CheckSmallOutline, { size: size === "sm" ? 20 : 24 }) })
|
|
6457
6992
|
]
|
|
6458
6993
|
}
|
|
6459
6994
|
)
|
|
@@ -6463,7 +6998,7 @@ var DropdownList = React220.forwardRef(
|
|
|
6463
6998
|
})
|
|
6464
6999
|
}
|
|
6465
7000
|
),
|
|
6466
|
-
/* @__PURE__ */
|
|
7001
|
+
/* @__PURE__ */ jsx218("div", { className: [
|
|
6467
7002
|
DropdownList_default.dropdownListGradient,
|
|
6468
7003
|
DropdownList_default.dropdownListGradientBottom,
|
|
6469
7004
|
showBottomGradient && DropdownList_default.dropdownListGradientVisible
|
|
@@ -6536,9 +7071,26 @@ var calculateCursorPosition = (prevValue, nextValue, prevCursorPos) => {
|
|
|
6536
7071
|
// ../ultimate/src/components/text-field/TextField.module.css
|
|
6537
7072
|
var TextField_default = {};
|
|
6538
7073
|
|
|
7074
|
+
// ../ultimate/src/internal/form/useNativeFieldReset.ts
|
|
7075
|
+
import * as React227 from "react";
|
|
7076
|
+
function useNativeFieldReset(ref, resetState, resetValue, formId) {
|
|
7077
|
+
const reset = useCallbackRef((event) => {
|
|
7078
|
+
queueMicrotask(() => {
|
|
7079
|
+
if (event.defaultPrevented || !ref.current) return;
|
|
7080
|
+
resetState();
|
|
7081
|
+
ref.current.value = resetValue;
|
|
7082
|
+
});
|
|
7083
|
+
});
|
|
7084
|
+
React227.useEffect(() => {
|
|
7085
|
+
const form = ref.current?.form;
|
|
7086
|
+
form?.addEventListener("reset", reset);
|
|
7087
|
+
return () => form?.removeEventListener("reset", reset);
|
|
7088
|
+
}, [formId, ref, reset]);
|
|
7089
|
+
}
|
|
7090
|
+
|
|
6539
7091
|
// ../ultimate/src/components/text-field/TextField.tsx
|
|
6540
|
-
import { jsx as
|
|
6541
|
-
var TextField =
|
|
7092
|
+
import { jsx as jsx219, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
7093
|
+
var TextField = React228.forwardRef(
|
|
6542
7094
|
({
|
|
6543
7095
|
label,
|
|
6544
7096
|
labelStyle = "outside",
|
|
@@ -6565,6 +7117,7 @@ var TextField = React221.forwardRef(
|
|
|
6565
7117
|
readOnly,
|
|
6566
7118
|
className,
|
|
6567
7119
|
style,
|
|
7120
|
+
inputStyle,
|
|
6568
7121
|
onFocus,
|
|
6569
7122
|
onBlur,
|
|
6570
7123
|
onChange,
|
|
@@ -6579,23 +7132,32 @@ var TextField = React221.forwardRef(
|
|
|
6579
7132
|
selectOnFocus = false,
|
|
6580
7133
|
...props
|
|
6581
7134
|
}, ref) => {
|
|
6582
|
-
const
|
|
6583
|
-
const
|
|
6584
|
-
const
|
|
6585
|
-
const
|
|
6586
|
-
const [
|
|
7135
|
+
const generatedId = React228.useId();
|
|
7136
|
+
const inputId = props.id ?? generatedId;
|
|
7137
|
+
const helperId = `${inputId}-help`;
|
|
7138
|
+
const [focused, setFocused] = React228.useState(false);
|
|
7139
|
+
const [isDropdownOpen, setIsDropdownOpen] = React228.useState(false);
|
|
7140
|
+
const [passwordVisible, setPasswordVisible] = React228.useState(false);
|
|
7141
|
+
const inputRef = React228.useRef(null);
|
|
7142
|
+
const [valueState, setValueState, resetValueState] = useControllableState({
|
|
6587
7143
|
value,
|
|
6588
7144
|
defaultValue: defaultValue || "",
|
|
6589
7145
|
onChange
|
|
6590
7146
|
});
|
|
6591
7147
|
const currentValue = valueState;
|
|
7148
|
+
useNativeFieldReset(
|
|
7149
|
+
inputRef,
|
|
7150
|
+
resetValueState,
|
|
7151
|
+
String(value === void 0 ? defaultValue ?? "" : currentValue ?? ""),
|
|
7152
|
+
props.form
|
|
7153
|
+
);
|
|
6592
7154
|
const [dropdownValueState, setDropdownValueState] = useControllableState({
|
|
6593
7155
|
value: trailingDropdownValue,
|
|
6594
7156
|
defaultValue: defaultTrailingDropdownValue || "",
|
|
6595
7157
|
onChange: onTrailingDropdownChange
|
|
6596
7158
|
});
|
|
6597
|
-
const triggerWrapperRef =
|
|
6598
|
-
const popoverRef =
|
|
7159
|
+
const triggerWrapperRef = React228.useRef(null);
|
|
7160
|
+
const popoverRef = React228.useRef(null);
|
|
6599
7161
|
const { style: popoverStyle } = usePopoverPosition(triggerWrapperRef, popoverRef, isDropdownOpen, {
|
|
6600
7162
|
margin: 8,
|
|
6601
7163
|
strategy: portal ? "fixed" : "absolute",
|
|
@@ -6608,7 +7170,7 @@ var TextField = React221.forwardRef(
|
|
|
6608
7170
|
[triggerWrapperRef]
|
|
6609
7171
|
);
|
|
6610
7172
|
useEscapeKeydown(() => setIsDropdownOpen(false), isDropdownOpen);
|
|
6611
|
-
const keepSelectionOnMouseUpRef =
|
|
7173
|
+
const keepSelectionOnMouseUpRef = React228.useRef(false);
|
|
6612
7174
|
const handleFocus = (e) => {
|
|
6613
7175
|
setFocused(true);
|
|
6614
7176
|
if (selectOnFocus) e.currentTarget.select();
|
|
@@ -6625,7 +7187,7 @@ var TextField = React221.forwardRef(
|
|
|
6625
7187
|
}
|
|
6626
7188
|
props.onMouseUp?.(e);
|
|
6627
7189
|
};
|
|
6628
|
-
const isPhoneFormat =
|
|
7190
|
+
const isPhoneFormat = React228.useMemo(() => {
|
|
6629
7191
|
if (inputFormat) return false;
|
|
6630
7192
|
if (!leadingText) return false;
|
|
6631
7193
|
return (leadingText.startsWith("+") || /^\d+$/.test(leadingText.replace(/[\s()]/g, ""))) && !leadingText.includes("://");
|
|
@@ -6635,7 +7197,7 @@ var TextField = React221.forwardRef(
|
|
|
6635
7197
|
const separator = formatOptions?.separator ?? ",";
|
|
6636
7198
|
const allowDecimal = formatOptions?.allowDecimal ?? true;
|
|
6637
7199
|
const maxDigits = formatOptions?.maxDigits;
|
|
6638
|
-
const applyFormat =
|
|
7200
|
+
const applyFormat = React228.useCallback((raw) => {
|
|
6639
7201
|
switch (activeFormat) {
|
|
6640
7202
|
case "currency": {
|
|
6641
7203
|
let cleaned = raw;
|
|
@@ -6671,7 +7233,7 @@ var TextField = React221.forwardRef(
|
|
|
6671
7233
|
}
|
|
6672
7234
|
onBlur?.(e);
|
|
6673
7235
|
};
|
|
6674
|
-
|
|
7236
|
+
React228.useEffect(() => {
|
|
6675
7237
|
if (activeFormat && currentValue) {
|
|
6676
7238
|
const formatted = applyFormat(String(currentValue));
|
|
6677
7239
|
if (currentValue !== formatted) {
|
|
@@ -6770,7 +7332,7 @@ var TextField = React221.forwardRef(
|
|
|
6770
7332
|
displayedDropdownLabel = selectedOption.label;
|
|
6771
7333
|
}
|
|
6772
7334
|
}
|
|
6773
|
-
const dropdownMenu = isDropdownOpen && dropdownListItems && /* @__PURE__ */
|
|
7335
|
+
const dropdownMenu = isDropdownOpen && dropdownListItems && /* @__PURE__ */ jsx219(
|
|
6774
7336
|
"div",
|
|
6775
7337
|
{
|
|
6776
7338
|
ref: popoverRef,
|
|
@@ -6779,7 +7341,7 @@ var TextField = React221.forwardRef(
|
|
|
6779
7341
|
...popoverStyle,
|
|
6780
7342
|
minWidth: triggerWrapperRef.current?.offsetWidth || 120
|
|
6781
7343
|
},
|
|
6782
|
-
children: /* @__PURE__ */
|
|
7344
|
+
children: /* @__PURE__ */ jsx219(
|
|
6783
7345
|
DropdownList,
|
|
6784
7346
|
{
|
|
6785
7347
|
items: dropdownListItems,
|
|
@@ -6792,7 +7354,7 @@ var TextField = React221.forwardRef(
|
|
|
6792
7354
|
)
|
|
6793
7355
|
}
|
|
6794
7356
|
);
|
|
6795
|
-
return /* @__PURE__ */
|
|
7357
|
+
return /* @__PURE__ */ jsxs14(
|
|
6796
7358
|
"div",
|
|
6797
7359
|
{
|
|
6798
7360
|
className: [
|
|
@@ -6804,16 +7366,16 @@ var TextField = React221.forwardRef(
|
|
|
6804
7366
|
].filter(Boolean).join(" "),
|
|
6805
7367
|
style: { ...style, width },
|
|
6806
7368
|
children: [
|
|
6807
|
-
shouldShowLabelOutside && /* @__PURE__ */
|
|
7369
|
+
shouldShowLabelOutside && /* @__PURE__ */ jsxs14("label", { htmlFor: inputId, className: [
|
|
6808
7370
|
TextField_default.textFieldLabel,
|
|
6809
7371
|
TextField_default.outsideLabel,
|
|
6810
7372
|
size === "medium" && TextField_default.outsideLabelMedium,
|
|
6811
7373
|
size === "small" && TextField_default.outsideLabelSmall
|
|
6812
7374
|
].filter(Boolean).join(" "), children: [
|
|
6813
7375
|
label,
|
|
6814
|
-
required && /* @__PURE__ */
|
|
7376
|
+
required && /* @__PURE__ */ jsx219("span", { "aria-hidden": "true", className: TextField_default.textFieldRequiredIndicator, children: " *" })
|
|
6815
7377
|
] }),
|
|
6816
|
-
/* @__PURE__ */
|
|
7378
|
+
/* @__PURE__ */ jsxs14(
|
|
6817
7379
|
"div",
|
|
6818
7380
|
{
|
|
6819
7381
|
className: [
|
|
@@ -6829,26 +7391,32 @@ var TextField = React221.forwardRef(
|
|
|
6829
7391
|
].filter(Boolean).join(" "),
|
|
6830
7392
|
onClick: () => !disabled && !readOnly && !focused && inputRef.current?.focus(),
|
|
6831
7393
|
children: [
|
|
6832
|
-
!shouldShowLabelInside && leadingIcon && /* @__PURE__ */
|
|
6833
|
-
!shouldShowLabelInside && leadingText && /* @__PURE__ */
|
|
6834
|
-
/* @__PURE__ */
|
|
6835
|
-
shouldShowLabelInside && /* @__PURE__ */
|
|
6836
|
-
"
|
|
7394
|
+
!shouldShowLabelInside && leadingIcon && /* @__PURE__ */ jsx219("span", { className: TextField_default.textFieldLeadingIcon, children: leadingIcon }),
|
|
7395
|
+
!shouldShowLabelInside && leadingText && /* @__PURE__ */ jsx219("span", { className: TextField_default.textFieldLeadingText, children: leadingText }),
|
|
7396
|
+
/* @__PURE__ */ jsxs14("div", { className: TextField_default.textFieldInputWrapper, children: [
|
|
7397
|
+
shouldShowLabelInside && /* @__PURE__ */ jsxs14(
|
|
7398
|
+
"label",
|
|
6837
7399
|
{
|
|
7400
|
+
htmlFor: inputId,
|
|
6838
7401
|
className: [
|
|
6839
7402
|
TextField_default.textFieldInlineLabel,
|
|
6840
7403
|
(focused || currentValue) && TextField_default.shrunk
|
|
6841
7404
|
].filter(Boolean).join(" "),
|
|
6842
7405
|
children: [
|
|
6843
7406
|
label,
|
|
6844
|
-
required && /* @__PURE__ */
|
|
7407
|
+
required && /* @__PURE__ */ jsx219("span", { "aria-hidden": "true", className: TextField_default.textFieldRequiredIndicator, children: " *" })
|
|
6845
7408
|
]
|
|
6846
7409
|
}
|
|
6847
7410
|
),
|
|
6848
|
-
/* @__PURE__ */
|
|
7411
|
+
/* @__PURE__ */ jsx219(
|
|
6849
7412
|
"input",
|
|
6850
7413
|
{
|
|
7414
|
+
style: inputStyle,
|
|
6851
7415
|
...props,
|
|
7416
|
+
id: inputId,
|
|
7417
|
+
required,
|
|
7418
|
+
"aria-invalid": error || props["aria-invalid"],
|
|
7419
|
+
"aria-describedby": mergeAriaIds(props["aria-describedby"], helperText ? helperId : void 0),
|
|
6852
7420
|
ref: (node) => {
|
|
6853
7421
|
inputRef.current = node;
|
|
6854
7422
|
if (typeof ref === "function") ref(node);
|
|
@@ -6879,8 +7447,8 @@ var TextField = React221.forwardRef(
|
|
|
6879
7447
|
}
|
|
6880
7448
|
)
|
|
6881
7449
|
] }),
|
|
6882
|
-
/* @__PURE__ */
|
|
6883
|
-
shortcutHint && !focused && /* @__PURE__ */
|
|
7450
|
+
/* @__PURE__ */ jsxs14("div", { className: TextField_default.textFieldTrailingGroup, children: [
|
|
7451
|
+
shortcutHint && !focused && /* @__PURE__ */ jsx219(
|
|
6884
7452
|
Badge,
|
|
6885
7453
|
{
|
|
6886
7454
|
variant: "secondary",
|
|
@@ -6889,12 +7457,12 @@ var TextField = React221.forwardRef(
|
|
|
6889
7457
|
label: shortcutHint
|
|
6890
7458
|
}
|
|
6891
7459
|
),
|
|
6892
|
-
showClear && focused && currentValue && !disabled && !readOnly && /* @__PURE__ */
|
|
7460
|
+
showClear && focused && currentValue && !disabled && !readOnly && /* @__PURE__ */ jsx219(
|
|
6893
7461
|
IconButton,
|
|
6894
7462
|
{
|
|
6895
7463
|
variant: "primary",
|
|
6896
7464
|
shape: "pill",
|
|
6897
|
-
icon: /* @__PURE__ */
|
|
7465
|
+
icon: /* @__PURE__ */ jsx219(CloseSmallOutline, {}),
|
|
6898
7466
|
onMouseDown: (e) => e.preventDefault(),
|
|
6899
7467
|
onClick: handleClear,
|
|
6900
7468
|
tabIndex: -1,
|
|
@@ -6902,13 +7470,13 @@ var TextField = React221.forwardRef(
|
|
|
6902
7470
|
className: TextField_default.textFieldClearButton
|
|
6903
7471
|
}
|
|
6904
7472
|
),
|
|
6905
|
-
(trailingDropdownLabel || trailingDropdownOptions) && /* @__PURE__ */
|
|
7473
|
+
(trailingDropdownLabel || trailingDropdownOptions) && /* @__PURE__ */ jsxs14(
|
|
6906
7474
|
"div",
|
|
6907
7475
|
{
|
|
6908
7476
|
ref: triggerWrapperRef,
|
|
6909
7477
|
className: TextField_default.textFieldTrailingDropdownWrapper,
|
|
6910
7478
|
children: [
|
|
6911
|
-
/* @__PURE__ */
|
|
7479
|
+
/* @__PURE__ */ jsxs14(
|
|
6912
7480
|
"div",
|
|
6913
7481
|
{
|
|
6914
7482
|
className: [
|
|
@@ -6917,12 +7485,12 @@ var TextField = React221.forwardRef(
|
|
|
6917
7485
|
].filter(Boolean).join(" "),
|
|
6918
7486
|
onClick: handleDropdownClick,
|
|
6919
7487
|
children: [
|
|
6920
|
-
/* @__PURE__ */
|
|
6921
|
-
/* @__PURE__ */
|
|
6922
|
-
/* @__PURE__ */
|
|
7488
|
+
/* @__PURE__ */ jsx219(Divider, { orientation: "vertical", className: TextField_default.textFieldSuffixDivider }),
|
|
7489
|
+
/* @__PURE__ */ jsx219("span", { children: displayedDropdownLabel }),
|
|
7490
|
+
/* @__PURE__ */ jsx219("span", { className: [
|
|
6923
7491
|
TextField_default.textFieldChevronIcon,
|
|
6924
7492
|
isDropdownOpen && TextField_default.rotated
|
|
6925
|
-
].filter(Boolean).join(" "), children: /* @__PURE__ */
|
|
7493
|
+
].filter(Boolean).join(" "), children: /* @__PURE__ */ jsx219(ChevronDownSmallOutline, { size: 20 }) })
|
|
6926
7494
|
]
|
|
6927
7495
|
}
|
|
6928
7496
|
),
|
|
@@ -6930,7 +7498,7 @@ var TextField = React221.forwardRef(
|
|
|
6930
7498
|
]
|
|
6931
7499
|
}
|
|
6932
7500
|
),
|
|
6933
|
-
activeFormat === "password" && /* @__PURE__ */
|
|
7501
|
+
activeFormat === "password" && /* @__PURE__ */ jsx219(
|
|
6934
7502
|
"div",
|
|
6935
7503
|
{
|
|
6936
7504
|
className: [TextField_default.textFieldTrailingIconWrapper, TextField_default.textFieldPasswordToggleButton].join(" "),
|
|
@@ -6941,12 +7509,20 @@ var TextField = React221.forwardRef(
|
|
|
6941
7509
|
}
|
|
6942
7510
|
},
|
|
6943
7511
|
role: "button",
|
|
6944
|
-
tabIndex: -1,
|
|
7512
|
+
tabIndex: disabled ? -1 : 0,
|
|
7513
|
+
"aria-disabled": disabled || void 0,
|
|
7514
|
+
onKeyDown: (e) => {
|
|
7515
|
+
if (!disabled && (e.key === "Enter" || e.key === " ")) {
|
|
7516
|
+
e.preventDefault();
|
|
7517
|
+
e.stopPropagation();
|
|
7518
|
+
togglePasswordVisibility(e);
|
|
7519
|
+
}
|
|
7520
|
+
},
|
|
6945
7521
|
"aria-label": passwordVisible ? "Hide password" : "Show password",
|
|
6946
|
-
children: /* @__PURE__ */
|
|
7522
|
+
children: /* @__PURE__ */ jsx219("span", { className: TextField_default.textFieldPasswordToggle, children: passwordVisible ? /* @__PURE__ */ jsx219(EyeOffOutline, {}) : /* @__PURE__ */ jsx219(EyeOutline, {}) })
|
|
6947
7523
|
}
|
|
6948
7524
|
),
|
|
6949
|
-
trailingIcon && activeFormat !== "password" && /* @__PURE__ */
|
|
7525
|
+
trailingIcon && activeFormat !== "password" && /* @__PURE__ */ jsxs14(
|
|
6950
7526
|
"div",
|
|
6951
7527
|
{
|
|
6952
7528
|
className: TextField_default.textFieldTrailingIconWrapper,
|
|
@@ -6957,7 +7533,7 @@ var TextField = React221.forwardRef(
|
|
|
6957
7533
|
}
|
|
6958
7534
|
},
|
|
6959
7535
|
children: [
|
|
6960
|
-
/* @__PURE__ */
|
|
7536
|
+
/* @__PURE__ */ jsx219(Divider, { orientation: "vertical", className: TextField_default.textFieldSuffixDivider }),
|
|
6961
7537
|
trailingIcon
|
|
6962
7538
|
]
|
|
6963
7539
|
}
|
|
@@ -6966,12 +7542,12 @@ var TextField = React221.forwardRef(
|
|
|
6966
7542
|
]
|
|
6967
7543
|
}
|
|
6968
7544
|
),
|
|
6969
|
-
(helperText || showCharacterCount && maxLength) && /* @__PURE__ */
|
|
6970
|
-
helperText && /* @__PURE__ */
|
|
7545
|
+
(helperText || showCharacterCount && maxLength) && /* @__PURE__ */ jsxs14("div", { className: TextField_default.textFieldFooter, children: [
|
|
7546
|
+
helperText && /* @__PURE__ */ jsx219("span", { id: helperId, className: [
|
|
6971
7547
|
TextField_default.textFieldHelperText,
|
|
6972
7548
|
error && TextField_default.errorText
|
|
6973
7549
|
].filter(Boolean).join(" "), children: helperText }),
|
|
6974
|
-
showCharacterCount && maxLength && /* @__PURE__ */
|
|
7550
|
+
showCharacterCount && maxLength && /* @__PURE__ */ jsxs14("span", { className: TextField_default.textFieldCharacterCount, children: [
|
|
6975
7551
|
String(currentValue || "").length,
|
|
6976
7552
|
"/",
|
|
6977
7553
|
maxLength
|
|
@@ -6985,14 +7561,14 @@ var TextField = React221.forwardRef(
|
|
|
6985
7561
|
TextField.displayName = "TextField";
|
|
6986
7562
|
|
|
6987
7563
|
// ../ultimate/src/components/text-area/TextArea.tsx
|
|
6988
|
-
import * as
|
|
7564
|
+
import * as React229 from "react";
|
|
6989
7565
|
|
|
6990
7566
|
// ../ultimate/src/components/text-area/TextArea.module.css
|
|
6991
7567
|
var TextArea_default = {};
|
|
6992
7568
|
|
|
6993
7569
|
// ../ultimate/src/components/text-area/TextArea.tsx
|
|
6994
|
-
import { jsx as
|
|
6995
|
-
var TextArea =
|
|
7570
|
+
import { jsx as jsx220, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
7571
|
+
var TextArea = React229.forwardRef(
|
|
6996
7572
|
({
|
|
6997
7573
|
label,
|
|
6998
7574
|
labelStyle = "outside",
|
|
@@ -7018,13 +7594,20 @@ var TextArea = React222.forwardRef(
|
|
|
7018
7594
|
fullWidth = true,
|
|
7019
7595
|
...props
|
|
7020
7596
|
}, ref) => {
|
|
7021
|
-
const [focused, setFocused] =
|
|
7022
|
-
const
|
|
7597
|
+
const [focused, setFocused] = React229.useState(false);
|
|
7598
|
+
const textareaRef = React229.useRef(null);
|
|
7599
|
+
const [valueState, setValueState, resetValueState] = useControllableState({
|
|
7023
7600
|
value,
|
|
7024
7601
|
defaultValue: defaultValue || "",
|
|
7025
7602
|
onChange
|
|
7026
7603
|
});
|
|
7027
7604
|
const currentValue = valueState;
|
|
7605
|
+
useNativeFieldReset(
|
|
7606
|
+
textareaRef,
|
|
7607
|
+
resetValueState,
|
|
7608
|
+
String(value === void 0 ? defaultValue ?? "" : currentValue ?? ""),
|
|
7609
|
+
props.form
|
|
7610
|
+
);
|
|
7028
7611
|
const charCount = currentValue?.length || 0;
|
|
7029
7612
|
const shouldShowCount = showCount ?? maxLength !== void 0;
|
|
7030
7613
|
const handleFocus = (e) => {
|
|
@@ -7042,11 +7625,12 @@ var TextArea = React222.forwardRef(
|
|
|
7042
7625
|
}
|
|
7043
7626
|
setValueState(newValue);
|
|
7044
7627
|
};
|
|
7045
|
-
const generatedId =
|
|
7628
|
+
const generatedId = React229.useId();
|
|
7046
7629
|
const shouldShowLabelOutside = label && labelStyle === "outside";
|
|
7047
7630
|
const shouldShowLabelInside = label && labelStyle === "inside";
|
|
7048
7631
|
const textareaId = id ?? generatedId;
|
|
7049
|
-
|
|
7632
|
+
const helperId = `${textareaId}-help`;
|
|
7633
|
+
return /* @__PURE__ */ jsxs15(
|
|
7050
7634
|
"div",
|
|
7051
7635
|
{
|
|
7052
7636
|
className: [
|
|
@@ -7058,12 +7642,12 @@ var TextArea = React222.forwardRef(
|
|
|
7058
7642
|
].filter(Boolean).join(" "),
|
|
7059
7643
|
style: { ...style, width },
|
|
7060
7644
|
children: [
|
|
7061
|
-
shouldShowLabelOutside && /* @__PURE__ */
|
|
7645
|
+
shouldShowLabelOutside && /* @__PURE__ */ jsxs15("label", { htmlFor: textareaId, className: TextArea_default.textAreaOutsideLabel, children: [
|
|
7062
7646
|
label,
|
|
7063
|
-
required && /* @__PURE__ */
|
|
7647
|
+
required && /* @__PURE__ */ jsx220("span", { "aria-hidden": "true", className: TextArea_default.textAreaRequiredIndicator, children: " *" })
|
|
7064
7648
|
] }),
|
|
7065
|
-
/* @__PURE__ */
|
|
7066
|
-
shouldShowLabelInside && /* @__PURE__ */
|
|
7649
|
+
/* @__PURE__ */ jsxs15("div", { className: TextArea_default.textAreaInputWrapper, children: [
|
|
7650
|
+
shouldShowLabelInside && /* @__PURE__ */ jsxs15(
|
|
7067
7651
|
"label",
|
|
7068
7652
|
{
|
|
7069
7653
|
className: [
|
|
@@ -7073,14 +7657,18 @@ var TextArea = React222.forwardRef(
|
|
|
7073
7657
|
htmlFor: textareaId,
|
|
7074
7658
|
children: [
|
|
7075
7659
|
label,
|
|
7076
|
-
required && /* @__PURE__ */
|
|
7660
|
+
required && /* @__PURE__ */ jsx220("span", { "aria-hidden": "true", className: TextArea_default.textAreaRequiredIndicator, children: " *" })
|
|
7077
7661
|
]
|
|
7078
7662
|
}
|
|
7079
7663
|
),
|
|
7080
|
-
/* @__PURE__ */
|
|
7664
|
+
/* @__PURE__ */ jsx220(
|
|
7081
7665
|
"textarea",
|
|
7082
7666
|
{
|
|
7083
|
-
ref
|
|
7667
|
+
ref: (node) => {
|
|
7668
|
+
textareaRef.current = node;
|
|
7669
|
+
if (typeof ref === "function") ref(node);
|
|
7670
|
+
else if (ref) ref.current = node;
|
|
7671
|
+
},
|
|
7084
7672
|
id: textareaId,
|
|
7085
7673
|
className: [
|
|
7086
7674
|
TextArea_default.textAreaInput,
|
|
@@ -7100,16 +7688,19 @@ var TextArea = React222.forwardRef(
|
|
|
7100
7688
|
rows,
|
|
7101
7689
|
style: { resize },
|
|
7102
7690
|
maxLength: maxLength ?? void 0,
|
|
7103
|
-
...props
|
|
7691
|
+
...props,
|
|
7692
|
+
required,
|
|
7693
|
+
"aria-invalid": error || props["aria-invalid"],
|
|
7694
|
+
"aria-describedby": mergeAriaIds(props["aria-describedby"], helperText ? helperId : void 0)
|
|
7104
7695
|
}
|
|
7105
7696
|
)
|
|
7106
7697
|
] }),
|
|
7107
|
-
(helperText || shouldShowCount) && /* @__PURE__ */
|
|
7108
|
-
helperText && /* @__PURE__ */
|
|
7698
|
+
(helperText || shouldShowCount) && /* @__PURE__ */ jsxs15("div", { className: TextArea_default.textAreaFooter, children: [
|
|
7699
|
+
helperText && /* @__PURE__ */ jsx220("span", { id: helperId, className: [
|
|
7109
7700
|
TextArea_default.textAreaHelperText,
|
|
7110
7701
|
error && TextArea_default.textAreaErrorText
|
|
7111
7702
|
].filter(Boolean).join(" "), children: helperText }),
|
|
7112
|
-
shouldShowCount && /* @__PURE__ */
|
|
7703
|
+
shouldShowCount && /* @__PURE__ */ jsxs15("span", { className: TextArea_default.textAreaCharCount, children: [
|
|
7113
7704
|
charCount,
|
|
7114
7705
|
maxLength !== void 0 ? `/${maxLength}` : ""
|
|
7115
7706
|
] })
|
|
@@ -7122,16 +7713,16 @@ var TextArea = React222.forwardRef(
|
|
|
7122
7713
|
TextArea.displayName = "TextArea";
|
|
7123
7714
|
|
|
7124
7715
|
// ../ultimate/src/components/avatar/Avatar.tsx
|
|
7125
|
-
import * as
|
|
7716
|
+
import * as React230 from "react";
|
|
7126
7717
|
|
|
7127
7718
|
// ../ultimate/src/components/avatar/Avatar.module.css
|
|
7128
7719
|
var Avatar_default = {};
|
|
7129
7720
|
|
|
7130
7721
|
// ../ultimate/src/components/avatar/Avatar.tsx
|
|
7131
|
-
import { jsx as
|
|
7132
|
-
var Avatar =
|
|
7722
|
+
import { jsx as jsx221, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
7723
|
+
var Avatar = React230.forwardRef(
|
|
7133
7724
|
({ src, alt, name, icon, size = "40", status, stroke, className, onClick, ...rest }, ref) => {
|
|
7134
|
-
const [hasError, setHasError] =
|
|
7725
|
+
const [hasError, setHasError] = React230.useState(false);
|
|
7135
7726
|
const isInteractive = !!onClick;
|
|
7136
7727
|
const Component = isInteractive ? "button" : "div";
|
|
7137
7728
|
const getInitials = (userName) => {
|
|
@@ -7140,7 +7731,7 @@ var Avatar = React223.forwardRef(
|
|
|
7140
7731
|
};
|
|
7141
7732
|
const renderContent = () => {
|
|
7142
7733
|
if (src && !hasError) {
|
|
7143
|
-
return /* @__PURE__ */
|
|
7734
|
+
return /* @__PURE__ */ jsx221(
|
|
7144
7735
|
"img",
|
|
7145
7736
|
{
|
|
7146
7737
|
src,
|
|
@@ -7151,9 +7742,9 @@ var Avatar = React223.forwardRef(
|
|
|
7151
7742
|
);
|
|
7152
7743
|
}
|
|
7153
7744
|
if (name) {
|
|
7154
|
-
return /* @__PURE__ */
|
|
7745
|
+
return /* @__PURE__ */ jsx221("span", { className: Avatar_default.avatarInitials, children: getInitials(name) });
|
|
7155
7746
|
}
|
|
7156
|
-
return /* @__PURE__ */
|
|
7747
|
+
return /* @__PURE__ */ jsx221("span", { className: Avatar_default.avatarIcon, children: icon || /* @__PURE__ */ jsx221(UserOutline, {}) });
|
|
7157
7748
|
};
|
|
7158
7749
|
const avatarClasses = [
|
|
7159
7750
|
"phx-avatar",
|
|
@@ -7163,7 +7754,7 @@ var Avatar = React223.forwardRef(
|
|
|
7163
7754
|
isInteractive && Avatar_default.interactive,
|
|
7164
7755
|
className
|
|
7165
7756
|
].filter(Boolean).join(" ");
|
|
7166
|
-
return /* @__PURE__ */
|
|
7757
|
+
return /* @__PURE__ */ jsxs16(
|
|
7167
7758
|
Component,
|
|
7168
7759
|
{
|
|
7169
7760
|
ref,
|
|
@@ -7172,8 +7763,8 @@ var Avatar = React223.forwardRef(
|
|
|
7172
7763
|
...isInteractive ? { type: "button" } : {},
|
|
7173
7764
|
...rest,
|
|
7174
7765
|
children: [
|
|
7175
|
-
/* @__PURE__ */
|
|
7176
|
-
status && /* @__PURE__ */
|
|
7766
|
+
/* @__PURE__ */ jsx221("div", { className: Avatar_default.avatarContent, children: renderContent() }),
|
|
7767
|
+
status && /* @__PURE__ */ jsx221(
|
|
7177
7768
|
Badge,
|
|
7178
7769
|
{
|
|
7179
7770
|
className: ["phx-avatar-status", Avatar_default.avatarStatus].filter(Boolean).join(" "),
|
|
@@ -7189,16 +7780,16 @@ var Avatar = React223.forwardRef(
|
|
|
7189
7780
|
Avatar.displayName = "Avatar";
|
|
7190
7781
|
|
|
7191
7782
|
// ../ultimate/src/components/avatar/AvatarGroup.tsx
|
|
7192
|
-
import * as
|
|
7783
|
+
import * as React231 from "react";
|
|
7193
7784
|
|
|
7194
7785
|
// ../ultimate/src/components/avatar/AvatarGroup.module.css
|
|
7195
7786
|
var AvatarGroup_default = {};
|
|
7196
7787
|
|
|
7197
7788
|
// ../ultimate/src/components/avatar/AvatarGroup.tsx
|
|
7198
|
-
import { jsx as
|
|
7199
|
-
var AvatarGroup =
|
|
7789
|
+
import { jsx as jsx222, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
7790
|
+
var AvatarGroup = React231.forwardRef(
|
|
7200
7791
|
({ children, size = "40", max = 5, showStatus = false, className, ...rest }, ref) => {
|
|
7201
|
-
const childrenArray =
|
|
7792
|
+
const childrenArray = React231.Children.toArray(children);
|
|
7202
7793
|
const hasOverflow = childrenArray.length > max;
|
|
7203
7794
|
const visibleCount = hasOverflow ? max - 1 : childrenArray.length;
|
|
7204
7795
|
const visibleChildren = childrenArray.slice(0, visibleCount);
|
|
@@ -7209,10 +7800,10 @@ var AvatarGroup = React224.forwardRef(
|
|
|
7209
7800
|
AvatarGroup_default[`size${size}`],
|
|
7210
7801
|
className
|
|
7211
7802
|
].filter(Boolean).join(" ");
|
|
7212
|
-
return /* @__PURE__ */
|
|
7803
|
+
return /* @__PURE__ */ jsxs17("div", { ref, className: groupClasses, ...rest, children: [
|
|
7213
7804
|
visibleChildren.map((child, index) => {
|
|
7214
|
-
if (
|
|
7215
|
-
return
|
|
7805
|
+
if (React231.isValidElement(child)) {
|
|
7806
|
+
return React231.cloneElement(child, {
|
|
7216
7807
|
size,
|
|
7217
7808
|
stroke: true,
|
|
7218
7809
|
key: index,
|
|
@@ -7226,7 +7817,7 @@ var AvatarGroup = React224.forwardRef(
|
|
|
7226
7817
|
}
|
|
7227
7818
|
return child;
|
|
7228
7819
|
}),
|
|
7229
|
-
hasOverflow && /* @__PURE__ */
|
|
7820
|
+
hasOverflow && /* @__PURE__ */ jsx222(
|
|
7230
7821
|
Avatar,
|
|
7231
7822
|
{
|
|
7232
7823
|
size,
|
|
@@ -7242,7 +7833,7 @@ var AvatarGroup = React224.forwardRef(
|
|
|
7242
7833
|
AvatarGroup.displayName = "AvatarGroup";
|
|
7243
7834
|
|
|
7244
7835
|
// ../ultimate/src/components/avatar/AvatarTemplate.tsx
|
|
7245
|
-
import * as
|
|
7836
|
+
import * as React232 from "react";
|
|
7246
7837
|
|
|
7247
7838
|
// ../ultimate/src/img/Image=1.png
|
|
7248
7839
|
var Image_1_default = "./Image=1-LTDZFXMH.png";
|
|
@@ -7263,7 +7854,7 @@ var Image_5_default = "./Image=5-7WFTKF52.png";
|
|
|
7263
7854
|
var Image_6_default = "./Image=6-U5HZ7K2N.png";
|
|
7264
7855
|
|
|
7265
7856
|
// ../ultimate/src/components/avatar/AvatarTemplate.tsx
|
|
7266
|
-
import { jsx as
|
|
7857
|
+
import { jsx as jsx223 } from "react/jsx-runtime";
|
|
7267
7858
|
var toImageSrc = (image) => {
|
|
7268
7859
|
if (typeof image === "string") {
|
|
7269
7860
|
return image;
|
|
@@ -7274,10 +7865,10 @@ var toImageSrc = (image) => {
|
|
|
7274
7865
|
return image.default;
|
|
7275
7866
|
};
|
|
7276
7867
|
var AVATAR_IMAGES = [Image_1_default, Image_2_default, Image_3_default, Image_4_default, Image_5_default, Image_6_default].map(toImageSrc);
|
|
7277
|
-
var AvatarTemplate =
|
|
7868
|
+
var AvatarTemplate = React232.forwardRef(
|
|
7278
7869
|
({ templateId = 1, ...rest }, ref) => {
|
|
7279
7870
|
const src = AVATAR_IMAGES[templateId - 1];
|
|
7280
|
-
return /* @__PURE__ */
|
|
7871
|
+
return /* @__PURE__ */ jsx223(Avatar, { ref, src, className: ["phx-avatar-template", rest.className].filter(Boolean).join(" "), ...rest });
|
|
7281
7872
|
}
|
|
7282
7873
|
);
|
|
7283
7874
|
AvatarTemplate.displayName = "AvatarTemplate";
|
|
@@ -7286,7 +7877,7 @@ AvatarTemplate.displayName = "AvatarTemplate";
|
|
|
7286
7877
|
var Image_default = {};
|
|
7287
7878
|
|
|
7288
7879
|
// ../ultimate/src/components/image/Image.tsx
|
|
7289
|
-
import { jsx as
|
|
7880
|
+
import { jsx as jsx224 } from "react/jsx-runtime";
|
|
7290
7881
|
var Image = ({
|
|
7291
7882
|
src,
|
|
7292
7883
|
alt,
|
|
@@ -7296,7 +7887,7 @@ var Image = ({
|
|
|
7296
7887
|
style
|
|
7297
7888
|
}) => {
|
|
7298
7889
|
const ratioClass = aspectRatio.replace(":", "");
|
|
7299
|
-
return /* @__PURE__ */
|
|
7890
|
+
return /* @__PURE__ */ jsx224(
|
|
7300
7891
|
"div",
|
|
7301
7892
|
{
|
|
7302
7893
|
className: [
|
|
@@ -7306,7 +7897,7 @@ var Image = ({
|
|
|
7306
7897
|
className
|
|
7307
7898
|
].filter(Boolean).join(" "),
|
|
7308
7899
|
style,
|
|
7309
|
-
children: /* @__PURE__ */
|
|
7900
|
+
children: /* @__PURE__ */ jsx224(
|
|
7310
7901
|
"img",
|
|
7311
7902
|
{
|
|
7312
7903
|
src,
|
|
@@ -7320,14 +7911,14 @@ var Image = ({
|
|
|
7320
7911
|
};
|
|
7321
7912
|
|
|
7322
7913
|
// ../ultimate/src/components/skeleton/Skeleton.tsx
|
|
7323
|
-
import * as
|
|
7914
|
+
import * as React233 from "react";
|
|
7324
7915
|
|
|
7325
7916
|
// ../ultimate/src/components/skeleton/Skeleton.module.css
|
|
7326
7917
|
var Skeleton_default = {};
|
|
7327
7918
|
|
|
7328
7919
|
// ../ultimate/src/components/skeleton/Skeleton.tsx
|
|
7329
|
-
import { jsx as
|
|
7330
|
-
var Skeleton =
|
|
7920
|
+
import { jsx as jsx225 } from "react/jsx-runtime";
|
|
7921
|
+
var Skeleton = React233.forwardRef(
|
|
7331
7922
|
({ variant = "text", width, height, rounded, className, style, ...rest }, ref) => {
|
|
7332
7923
|
const skeletonClasses = [
|
|
7333
7924
|
"phx-skeleton",
|
|
@@ -7341,7 +7932,7 @@ var Skeleton = React226.forwardRef(
|
|
|
7341
7932
|
...height !== void 0 && { height: typeof height === "number" ? `${height}px` : height },
|
|
7342
7933
|
...style
|
|
7343
7934
|
};
|
|
7344
|
-
return /* @__PURE__ */
|
|
7935
|
+
return /* @__PURE__ */ jsx225(
|
|
7345
7936
|
"div",
|
|
7346
7937
|
{
|
|
7347
7938
|
ref,
|
|
@@ -7357,14 +7948,14 @@ var Skeleton = React226.forwardRef(
|
|
|
7357
7948
|
Skeleton.displayName = "Skeleton";
|
|
7358
7949
|
|
|
7359
7950
|
// ../ultimate/src/components/chip/Chip.tsx
|
|
7360
|
-
import * as
|
|
7951
|
+
import * as React234 from "react";
|
|
7361
7952
|
|
|
7362
7953
|
// ../ultimate/src/components/chip/Chip.module.css
|
|
7363
7954
|
var Chip_default = {};
|
|
7364
7955
|
|
|
7365
7956
|
// ../ultimate/src/components/chip/Chip.tsx
|
|
7366
|
-
import { jsx as
|
|
7367
|
-
var Chip =
|
|
7957
|
+
import { jsx as jsx226, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
7958
|
+
var Chip = React234.forwardRef(
|
|
7368
7959
|
({
|
|
7369
7960
|
label,
|
|
7370
7961
|
icon,
|
|
@@ -7372,9 +7963,12 @@ var Chip = React227.forwardRef(
|
|
|
7372
7963
|
badge,
|
|
7373
7964
|
variant = "outline",
|
|
7374
7965
|
size = "large",
|
|
7966
|
+
shape = "pill",
|
|
7375
7967
|
disabled,
|
|
7376
7968
|
hasDropdown,
|
|
7377
7969
|
onClear,
|
|
7970
|
+
onRemove,
|
|
7971
|
+
removeLabel,
|
|
7378
7972
|
actionIcon,
|
|
7379
7973
|
onAction,
|
|
7380
7974
|
actionLabel,
|
|
@@ -7390,6 +7984,7 @@ var Chip = React227.forwardRef(
|
|
|
7390
7984
|
Chip_default.chipRoot,
|
|
7391
7985
|
Chip_default[variant],
|
|
7392
7986
|
Chip_default[size],
|
|
7987
|
+
shape === "rounded" && Chip_default.rounded,
|
|
7393
7988
|
disabled && Chip_default.disabled,
|
|
7394
7989
|
isClickable && Chip_default.clickable,
|
|
7395
7990
|
avatar && Chip_default.hasAvatar,
|
|
@@ -7398,28 +7993,30 @@ var Chip = React227.forwardRef(
|
|
|
7398
7993
|
].filter(Boolean).join(" ");
|
|
7399
7994
|
const badgeColor = variant === "filled" ? "white" : "black";
|
|
7400
7995
|
const trailingIconSize = size === "large" ? 20 : 16;
|
|
7996
|
+
const renderCloseButton = (onPress, ariaLabel) => /* @__PURE__ */ jsx226(
|
|
7997
|
+
"button",
|
|
7998
|
+
{
|
|
7999
|
+
type: "button",
|
|
8000
|
+
className: Chip_default.chipDelete,
|
|
8001
|
+
onClick: (e) => {
|
|
8002
|
+
e.stopPropagation();
|
|
8003
|
+
if (!disabled) onPress?.(e);
|
|
8004
|
+
},
|
|
8005
|
+
disabled,
|
|
8006
|
+
"aria-label": ariaLabel,
|
|
8007
|
+
children: /* @__PURE__ */ jsx226(CancelFilled, { size: trailingIconSize })
|
|
8008
|
+
}
|
|
8009
|
+
);
|
|
7401
8010
|
const renderTrailing = () => {
|
|
8011
|
+
if (onRemove) return renderCloseButton(onRemove, removeLabel ?? `Remove ${label}`);
|
|
7402
8012
|
const hasAction = Boolean(actionIcon && onAction);
|
|
7403
8013
|
if (!hasDropdown && !hasAction) return null;
|
|
7404
8014
|
if (variant === "filled" && hasDropdown && !hasAction) {
|
|
7405
|
-
return
|
|
7406
|
-
"button",
|
|
7407
|
-
{
|
|
7408
|
-
type: "button",
|
|
7409
|
-
className: Chip_default.chipDelete,
|
|
7410
|
-
onClick: (e) => {
|
|
7411
|
-
e.stopPropagation();
|
|
7412
|
-
if (!disabled && onClear) onClear(e);
|
|
7413
|
-
},
|
|
7414
|
-
disabled,
|
|
7415
|
-
"aria-label": `Clear ${label}`,
|
|
7416
|
-
children: /* @__PURE__ */ jsx220(CancelFilled, { size: trailingIconSize })
|
|
7417
|
-
}
|
|
7418
|
-
);
|
|
8015
|
+
return renderCloseButton(onClear, `Clear ${label}`);
|
|
7419
8016
|
}
|
|
7420
|
-
return /* @__PURE__ */
|
|
7421
|
-
hasDropdown && /* @__PURE__ */
|
|
7422
|
-
hasAction && /* @__PURE__ */
|
|
8017
|
+
return /* @__PURE__ */ jsxs18("span", { className: Chip_default.chipTrailing, children: [
|
|
8018
|
+
hasDropdown && /* @__PURE__ */ jsx226("span", { className: Chip_default.chipTrailingIcon, children: /* @__PURE__ */ jsx226(ChevronDownSmallOutline, { size: trailingIconSize }) }),
|
|
8019
|
+
hasAction && /* @__PURE__ */ jsx226(
|
|
7423
8020
|
"button",
|
|
7424
8021
|
{
|
|
7425
8022
|
type: "button",
|
|
@@ -7435,7 +8032,7 @@ var Chip = React227.forwardRef(
|
|
|
7435
8032
|
)
|
|
7436
8033
|
] });
|
|
7437
8034
|
};
|
|
7438
|
-
return /* @__PURE__ */
|
|
8035
|
+
return /* @__PURE__ */ jsx226(
|
|
7439
8036
|
"div",
|
|
7440
8037
|
{
|
|
7441
8038
|
ref,
|
|
@@ -7444,15 +8041,22 @@ var Chip = React227.forwardRef(
|
|
|
7444
8041
|
role: isClickable ? "button" : void 0,
|
|
7445
8042
|
tabIndex: isClickable ? 0 : void 0,
|
|
7446
8043
|
...rest,
|
|
7447
|
-
|
|
7448
|
-
|
|
8044
|
+
onKeyDown: (event) => {
|
|
8045
|
+
rest.onKeyDown?.(event);
|
|
8046
|
+
if (!event.defaultPrevented && event.target === event.currentTarget && isClickable && (event.key === "Enter" || event.key === " ")) {
|
|
8047
|
+
event.preventDefault();
|
|
8048
|
+
event.currentTarget.click();
|
|
8049
|
+
}
|
|
8050
|
+
},
|
|
8051
|
+
children: /* @__PURE__ */ jsxs18("div", { className: Chip_default.chipContainer, children: [
|
|
8052
|
+
avatar && /* @__PURE__ */ jsx226("div", { className: Chip_default.chipAvatar, children: React234.isValidElement(avatar) ? React234.cloneElement(avatar, {
|
|
7449
8053
|
size: size === "large" ? "32" : "24",
|
|
7450
8054
|
stroke: variant === "filled" || avatar.props.stroke
|
|
7451
8055
|
}) : avatar }),
|
|
7452
|
-
!avatar && icon && /* @__PURE__ */
|
|
7453
|
-
/* @__PURE__ */
|
|
7454
|
-
/* @__PURE__ */
|
|
7455
|
-
shouldShowBadge && /* @__PURE__ */
|
|
8056
|
+
!avatar && icon && /* @__PURE__ */ jsx226("span", { className: Chip_default.chipIcon, children: icon }),
|
|
8057
|
+
/* @__PURE__ */ jsxs18("span", { className: Chip_default.chipContent, children: [
|
|
8058
|
+
/* @__PURE__ */ jsx226("span", { className: Chip_default.chipLabel, children: label }),
|
|
8059
|
+
shouldShowBadge && /* @__PURE__ */ jsx226(
|
|
7456
8060
|
Badge,
|
|
7457
8061
|
{
|
|
7458
8062
|
count: typeof badge === "number" ? badge : void 0,
|
|
@@ -7472,16 +8076,16 @@ var Chip = React227.forwardRef(
|
|
|
7472
8076
|
Chip.displayName = "Chip";
|
|
7473
8077
|
|
|
7474
8078
|
// ../ultimate/src/components/chip-bar/ChipBar.tsx
|
|
7475
|
-
import * as
|
|
8079
|
+
import * as React235 from "react";
|
|
7476
8080
|
|
|
7477
8081
|
// ../ultimate/src/components/chip-bar/ChipBar.module.css
|
|
7478
8082
|
var ChipBar_default = {};
|
|
7479
8083
|
|
|
7480
8084
|
// ../ultimate/src/components/chip-bar/ChipBar.tsx
|
|
7481
|
-
import { jsx as
|
|
8085
|
+
import { jsx as jsx227, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
7482
8086
|
var OVERFLOW_BUTTON_SIZE = 32;
|
|
7483
8087
|
var MASK_FADE_SIZE = 44;
|
|
7484
|
-
var ChipBar =
|
|
8088
|
+
var ChipBar = React235.forwardRef(
|
|
7485
8089
|
({
|
|
7486
8090
|
leading,
|
|
7487
8091
|
children,
|
|
@@ -7493,13 +8097,13 @@ var ChipBar = React228.forwardRef(
|
|
|
7493
8097
|
className,
|
|
7494
8098
|
...rest
|
|
7495
8099
|
}, ref) => {
|
|
7496
|
-
const [showLeftGradient, setShowLeftGradient] =
|
|
7497
|
-
const [showRightGradient, setShowRightGradient] =
|
|
7498
|
-
const [internalIsStuck, setInternalIsStuck] =
|
|
8100
|
+
const [showLeftGradient, setShowLeftGradient] = React235.useState(false);
|
|
8101
|
+
const [showRightGradient, setShowRightGradient] = React235.useState(false);
|
|
8102
|
+
const [internalIsStuck, setInternalIsStuck] = React235.useState(false);
|
|
7499
8103
|
const isStuck = stuck !== void 0 ? stuck : internalIsStuck;
|
|
7500
|
-
const listRef =
|
|
7501
|
-
const containerRef =
|
|
7502
|
-
const updateScrollGradients =
|
|
8104
|
+
const listRef = React235.useRef(null);
|
|
8105
|
+
const containerRef = React235.useRef(null);
|
|
8106
|
+
const updateScrollGradients = React235.useCallback(() => {
|
|
7503
8107
|
const el = listRef.current;
|
|
7504
8108
|
if (el) {
|
|
7505
8109
|
const { scrollLeft, scrollWidth, clientWidth } = el;
|
|
@@ -7507,7 +8111,7 @@ var ChipBar = React228.forwardRef(
|
|
|
7507
8111
|
setShowRightGradient(Math.ceil(scrollLeft + clientWidth) < scrollWidth);
|
|
7508
8112
|
}
|
|
7509
8113
|
}, []);
|
|
7510
|
-
|
|
8114
|
+
React235.useEffect(() => {
|
|
7511
8115
|
const el = listRef.current;
|
|
7512
8116
|
if (el) {
|
|
7513
8117
|
updateScrollGradients();
|
|
@@ -7534,7 +8138,7 @@ var ChipBar = React228.forwardRef(
|
|
|
7534
8138
|
});
|
|
7535
8139
|
}
|
|
7536
8140
|
};
|
|
7537
|
-
|
|
8141
|
+
React235.useEffect(() => {
|
|
7538
8142
|
if (!sticky) return;
|
|
7539
8143
|
const container = containerRef.current;
|
|
7540
8144
|
if (!container) return;
|
|
@@ -7566,7 +8170,7 @@ var ChipBar = React228.forwardRef(
|
|
|
7566
8170
|
window.removeEventListener("resize", checkStuck);
|
|
7567
8171
|
};
|
|
7568
8172
|
}, [sticky]);
|
|
7569
|
-
const setRefs =
|
|
8173
|
+
const setRefs = React235.useCallback((node) => {
|
|
7570
8174
|
containerRef.current = node;
|
|
7571
8175
|
if (typeof ref === "function") {
|
|
7572
8176
|
ref(node);
|
|
@@ -7580,7 +8184,7 @@ var ChipBar = React228.forwardRef(
|
|
|
7580
8184
|
"--chip-bar-left-button-offset": showLeftGradient ? `${OVERFLOW_BUTTON_SIZE}px` : "0px",
|
|
7581
8185
|
"--chip-bar-right-button-offset": showRightGradient ? `${OVERFLOW_BUTTON_SIZE}px` : "0px"
|
|
7582
8186
|
};
|
|
7583
|
-
return /* @__PURE__ */
|
|
8187
|
+
return /* @__PURE__ */ jsxs19(
|
|
7584
8188
|
"div",
|
|
7585
8189
|
{
|
|
7586
8190
|
ref: setRefs,
|
|
@@ -7599,14 +8203,14 @@ var ChipBar = React228.forwardRef(
|
|
|
7599
8203
|
},
|
|
7600
8204
|
...rest,
|
|
7601
8205
|
children: [
|
|
7602
|
-
leading && /* @__PURE__ */
|
|
7603
|
-
|
|
8206
|
+
leading && /* @__PURE__ */ jsxs19("div", { className: ChipBar_default.chipBarLeading, children: [
|
|
8207
|
+
React235.isValidElement(leading) ? React235.cloneElement(leading, {
|
|
7604
8208
|
size: size === "large" ? "large" : "medium"
|
|
7605
8209
|
}) : leading,
|
|
7606
|
-
showDivider && /* @__PURE__ */
|
|
8210
|
+
showDivider && /* @__PURE__ */ jsx227("div", { className: ChipBar_default.chipBarDivider })
|
|
7607
8211
|
] }),
|
|
7608
|
-
/* @__PURE__ */
|
|
7609
|
-
/* @__PURE__ */
|
|
8212
|
+
/* @__PURE__ */ jsxs19("div", { className: ChipBar_default.chipBarScrollOuter, children: [
|
|
8213
|
+
/* @__PURE__ */ jsx227(
|
|
7610
8214
|
"div",
|
|
7611
8215
|
{
|
|
7612
8216
|
className: [
|
|
@@ -7615,7 +8219,7 @@ var ChipBar = React228.forwardRef(
|
|
|
7615
8219
|
showLeftGradient && ChipBar_default.chipBarGradientVisible,
|
|
7616
8220
|
"phx-nav-slot-left"
|
|
7617
8221
|
].filter(Boolean).join(" "),
|
|
7618
|
-
children: /* @__PURE__ */
|
|
8222
|
+
children: /* @__PURE__ */ jsx227(
|
|
7619
8223
|
IconButton,
|
|
7620
8224
|
{
|
|
7621
8225
|
type: "button",
|
|
@@ -7625,12 +8229,12 @@ var ChipBar = React228.forwardRef(
|
|
|
7625
8229
|
className: ChipBar_default.chipBarNavButton,
|
|
7626
8230
|
onClick: () => handleScrollAction("left"),
|
|
7627
8231
|
"aria-label": "Scroll left",
|
|
7628
|
-
icon: /* @__PURE__ */
|
|
8232
|
+
icon: /* @__PURE__ */ jsx227(ChevronLeftOutline, {})
|
|
7629
8233
|
}
|
|
7630
8234
|
)
|
|
7631
8235
|
}
|
|
7632
8236
|
),
|
|
7633
|
-
/* @__PURE__ */
|
|
8237
|
+
/* @__PURE__ */ jsx227("div", { className: ChipBar_default.chipBarScrollArea, style: chipBarMaskStyle, children: /* @__PURE__ */ jsx227("div", { className: ChipBar_default.chipBarMaskWrapper, children: /* @__PURE__ */ jsx227(
|
|
7634
8238
|
"div",
|
|
7635
8239
|
{
|
|
7636
8240
|
ref: listRef,
|
|
@@ -7640,9 +8244,9 @@ var ChipBar = React228.forwardRef(
|
|
|
7640
8244
|
"scrollbarHidden",
|
|
7641
8245
|
"phx-chip-bar-list"
|
|
7642
8246
|
].filter(Boolean).join(" "),
|
|
7643
|
-
children:
|
|
7644
|
-
if (
|
|
7645
|
-
return
|
|
8247
|
+
children: React235.Children.map(children, (child) => {
|
|
8248
|
+
if (React235.isValidElement(child)) {
|
|
8249
|
+
return React235.cloneElement(child, {
|
|
7646
8250
|
size: size === "large" ? "large" : "medium"
|
|
7647
8251
|
});
|
|
7648
8252
|
}
|
|
@@ -7650,7 +8254,7 @@ var ChipBar = React228.forwardRef(
|
|
|
7650
8254
|
})
|
|
7651
8255
|
}
|
|
7652
8256
|
) }) }),
|
|
7653
|
-
/* @__PURE__ */
|
|
8257
|
+
/* @__PURE__ */ jsx227(
|
|
7654
8258
|
"div",
|
|
7655
8259
|
{
|
|
7656
8260
|
className: [
|
|
@@ -7659,7 +8263,7 @@ var ChipBar = React228.forwardRef(
|
|
|
7659
8263
|
showRightGradient && ChipBar_default.chipBarGradientVisible,
|
|
7660
8264
|
"phx-nav-slot-right"
|
|
7661
8265
|
].filter(Boolean).join(" "),
|
|
7662
|
-
children: /* @__PURE__ */
|
|
8266
|
+
children: /* @__PURE__ */ jsx227(
|
|
7663
8267
|
IconButton,
|
|
7664
8268
|
{
|
|
7665
8269
|
type: "button",
|
|
@@ -7669,7 +8273,7 @@ var ChipBar = React228.forwardRef(
|
|
|
7669
8273
|
className: ChipBar_default.chipBarNavButton,
|
|
7670
8274
|
onClick: () => handleScrollAction("right"),
|
|
7671
8275
|
"aria-label": "Scroll right",
|
|
7672
|
-
icon: /* @__PURE__ */
|
|
8276
|
+
icon: /* @__PURE__ */ jsx227(ChevronRightOutline, {})
|
|
7673
8277
|
}
|
|
7674
8278
|
)
|
|
7675
8279
|
}
|
|
@@ -7683,12 +8287,12 @@ var ChipBar = React228.forwardRef(
|
|
|
7683
8287
|
ChipBar.displayName = "ChipBar";
|
|
7684
8288
|
|
|
7685
8289
|
// ../ultimate/src/components/visually-hidden/VisuallyHidden.tsx
|
|
7686
|
-
import * as
|
|
7687
|
-
import { jsx as
|
|
7688
|
-
var VisuallyHidden =
|
|
8290
|
+
import * as React236 from "react";
|
|
8291
|
+
import { jsx as jsx228 } from "react/jsx-runtime";
|
|
8292
|
+
var VisuallyHidden = React236.forwardRef(
|
|
7689
8293
|
({ as, children, className, style, ...props }, ref) => {
|
|
7690
8294
|
const Component = as || "span";
|
|
7691
|
-
return /* @__PURE__ */
|
|
8295
|
+
return /* @__PURE__ */ jsx228(
|
|
7692
8296
|
Component,
|
|
7693
8297
|
{
|
|
7694
8298
|
ref,
|
|
@@ -7715,21 +8319,923 @@ var VisuallyHidden = React229.forwardRef(
|
|
|
7715
8319
|
VisuallyHidden.displayName = "VisuallyHidden";
|
|
7716
8320
|
|
|
7717
8321
|
// ../ultimate/src/components/layout-context/LayoutContext.tsx
|
|
7718
|
-
import * as
|
|
7719
|
-
import { jsx as
|
|
7720
|
-
var LayoutContext =
|
|
8322
|
+
import * as React237 from "react";
|
|
8323
|
+
import { jsx as jsx229 } from "react/jsx-runtime";
|
|
8324
|
+
var LayoutContext = React237.createContext(null);
|
|
7721
8325
|
var LayoutProvider = ({ children }) => {
|
|
7722
|
-
const [drawerCount, setDrawerCount] =
|
|
7723
|
-
const
|
|
8326
|
+
const [drawerCount, setDrawerCount] = React237.useState(0);
|
|
8327
|
+
const registerDrawer = React237.useCallback(() => setDrawerCount((count) => count + 1), []);
|
|
8328
|
+
const unregisterDrawer = React237.useCallback(() => setDrawerCount((count) => Math.max(0, count - 1)), []);
|
|
8329
|
+
const value = React237.useMemo(() => ({
|
|
7724
8330
|
hasDrawer: drawerCount > 0,
|
|
7725
|
-
registerDrawer
|
|
7726
|
-
unregisterDrawer
|
|
7727
|
-
}), [drawerCount]);
|
|
7728
|
-
return /* @__PURE__ */
|
|
8331
|
+
registerDrawer,
|
|
8332
|
+
unregisterDrawer
|
|
8333
|
+
}), [drawerCount, registerDrawer, unregisterDrawer]);
|
|
8334
|
+
return /* @__PURE__ */ jsx229(LayoutContext.Provider, { value, children });
|
|
7729
8335
|
};
|
|
7730
8336
|
var useLayout = () => {
|
|
7731
|
-
return
|
|
8337
|
+
return React237.useContext(LayoutContext);
|
|
8338
|
+
};
|
|
8339
|
+
|
|
8340
|
+
// ../ultimate/src/components/number-field/NumberField.tsx
|
|
8341
|
+
import * as React238 from "react";
|
|
8342
|
+
import { jsx as jsx230, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
8343
|
+
var parseNumber = (text) => {
|
|
8344
|
+
const normalized = text.trim().replace(",", ".");
|
|
8345
|
+
if (normalized === "") return null;
|
|
8346
|
+
if (!/^-?\d*\.?\d*$/.test(normalized) || !/\d/.test(normalized)) return void 0;
|
|
8347
|
+
return Number(normalized);
|
|
7732
8348
|
};
|
|
8349
|
+
function NumberField({
|
|
8350
|
+
label,
|
|
8351
|
+
size = "large",
|
|
8352
|
+
inputWidth = 64,
|
|
8353
|
+
value,
|
|
8354
|
+
defaultValue = null,
|
|
8355
|
+
onChange,
|
|
8356
|
+
min = -Infinity,
|
|
8357
|
+
max = Infinity,
|
|
8358
|
+
step = 1,
|
|
8359
|
+
error,
|
|
8360
|
+
description,
|
|
8361
|
+
disabled,
|
|
8362
|
+
readOnly,
|
|
8363
|
+
name,
|
|
8364
|
+
decreaseLabel = `Decrease ${label}`,
|
|
8365
|
+
increaseLabel = `Increase ${label}`,
|
|
8366
|
+
...props
|
|
8367
|
+
}) {
|
|
8368
|
+
const [current, setCurrent, reset] = useControllableState({
|
|
8369
|
+
value,
|
|
8370
|
+
defaultValue,
|
|
8371
|
+
onChange
|
|
8372
|
+
});
|
|
8373
|
+
const ref = React238.useRef(null);
|
|
8374
|
+
const [draft, setDraft] = React238.useState(null);
|
|
8375
|
+
const display = draft ?? (current == null ? "" : String(current));
|
|
8376
|
+
const resetValue = String((value !== void 0 ? current : defaultValue) ?? "");
|
|
8377
|
+
useNativeFieldReset(
|
|
8378
|
+
ref,
|
|
8379
|
+
() => {
|
|
8380
|
+
reset();
|
|
8381
|
+
setDraft(null);
|
|
8382
|
+
},
|
|
8383
|
+
resetValue,
|
|
8384
|
+
props.form
|
|
8385
|
+
);
|
|
8386
|
+
const bounded = (number) => Math.min(Math.max(min, max), Math.max(min, number));
|
|
8387
|
+
const stepSize = Math.abs(step || 1);
|
|
8388
|
+
const editable = !disabled && !readOnly;
|
|
8389
|
+
const commit = (next) => {
|
|
8390
|
+
setDraft(null);
|
|
8391
|
+
if (next !== current) setCurrent(next);
|
|
8392
|
+
};
|
|
8393
|
+
const increment = (direction) => {
|
|
8394
|
+
if (!editable) return;
|
|
8395
|
+
const base = parseNumber(display) ?? current;
|
|
8396
|
+
commit(
|
|
8397
|
+
bounded(
|
|
8398
|
+
Number(
|
|
8399
|
+
((base ?? (Number.isFinite(min) ? min : 0)) + direction * stepSize).toFixed(10)
|
|
8400
|
+
)
|
|
8401
|
+
)
|
|
8402
|
+
);
|
|
8403
|
+
};
|
|
8404
|
+
const generatedId = React238.useId();
|
|
8405
|
+
const inputId = props.id ?? generatedId;
|
|
8406
|
+
const descriptionId = description ? `${inputId}-description` : void 0;
|
|
8407
|
+
const errorId = error ? `${inputId}-error` : void 0;
|
|
8408
|
+
const buttonSize = size === "large" ? "medium" : "small";
|
|
8409
|
+
const allowNegative = min < 0;
|
|
8410
|
+
const integerOnly = Number.isInteger(stepSize) && (!Number.isFinite(min) || Number.isInteger(min));
|
|
8411
|
+
return /* @__PURE__ */ jsx230(Box, { w: "fit-content", maxW: "100%", children: /* @__PURE__ */ jsxs20(VStack, { gap: "5xs", children: [
|
|
8412
|
+
/* @__PURE__ */ jsxs20(Text, { as: "label", variant: "title-md", htmlFor: inputId, children: [
|
|
8413
|
+
label,
|
|
8414
|
+
props.required && /* @__PURE__ */ jsx230("span", { "aria-hidden": "true", children: " *" })
|
|
8415
|
+
] }),
|
|
8416
|
+
/* @__PURE__ */ jsxs20(HStack, { gap: "2xs", align: "center", wrap: false, children: [
|
|
8417
|
+
/* @__PURE__ */ jsx230(
|
|
8418
|
+
IconButton,
|
|
8419
|
+
{
|
|
8420
|
+
variant: "secondary",
|
|
8421
|
+
size: buttonSize,
|
|
8422
|
+
icon: /* @__PURE__ */ jsx230(IndeterminateSmallOutline, {}),
|
|
8423
|
+
"aria-label": decreaseLabel,
|
|
8424
|
+
"aria-controls": inputId,
|
|
8425
|
+
disabled: disabled || readOnly || current != null && current <= min,
|
|
8426
|
+
onClick: () => increment(-1)
|
|
8427
|
+
}
|
|
8428
|
+
),
|
|
8429
|
+
/* @__PURE__ */ jsx230(
|
|
8430
|
+
TextField,
|
|
8431
|
+
{
|
|
8432
|
+
...props,
|
|
8433
|
+
id: inputId,
|
|
8434
|
+
showClear: false,
|
|
8435
|
+
size,
|
|
8436
|
+
width: inputWidth,
|
|
8437
|
+
fullWidth: false,
|
|
8438
|
+
ref,
|
|
8439
|
+
type: "text",
|
|
8440
|
+
role: "spinbutton",
|
|
8441
|
+
inputMode: integerOnly && !allowNegative ? "numeric" : "decimal",
|
|
8442
|
+
autoComplete: "off",
|
|
8443
|
+
"aria-valuenow": current ?? void 0,
|
|
8444
|
+
"aria-valuemin": Number.isFinite(min) ? min : void 0,
|
|
8445
|
+
"aria-valuemax": Number.isFinite(max) ? max : void 0,
|
|
8446
|
+
disabled,
|
|
8447
|
+
error: !!error,
|
|
8448
|
+
"aria-describedby": mergeAriaIds(props["aria-describedby"], descriptionId, errorId),
|
|
8449
|
+
inputStyle: {
|
|
8450
|
+
textAlign: "center",
|
|
8451
|
+
fontVariantNumeric: "tabular-nums"
|
|
8452
|
+
},
|
|
8453
|
+
value: display,
|
|
8454
|
+
readOnly,
|
|
8455
|
+
onChange: (next) => {
|
|
8456
|
+
const text = next.trim();
|
|
8457
|
+
if (!/^-?\d*[.,]?\d*$/.test(text)) return;
|
|
8458
|
+
setDraft(text);
|
|
8459
|
+
const parsed = parseNumber(text);
|
|
8460
|
+
if (parsed !== void 0 && parsed !== current) setCurrent(parsed);
|
|
8461
|
+
},
|
|
8462
|
+
onKeyDown: (event) => {
|
|
8463
|
+
props.onKeyDown?.(event);
|
|
8464
|
+
if (event.defaultPrevented || event.nativeEvent.isComposing) return;
|
|
8465
|
+
let direction = 0;
|
|
8466
|
+
if (event.key === "ArrowUp") direction = 1;
|
|
8467
|
+
else if (event.key === "ArrowDown") direction = -1;
|
|
8468
|
+
else if (event.key === "PageUp") direction = 10;
|
|
8469
|
+
else if (event.key === "PageDown") direction = -10;
|
|
8470
|
+
if (direction) {
|
|
8471
|
+
event.preventDefault();
|
|
8472
|
+
increment(direction);
|
|
8473
|
+
} else if (event.key === "Home" && Number.isFinite(min)) {
|
|
8474
|
+
event.preventDefault();
|
|
8475
|
+
if (editable) commit(min);
|
|
8476
|
+
} else if (event.key === "End" && Number.isFinite(max)) {
|
|
8477
|
+
event.preventDefault();
|
|
8478
|
+
if (editable) commit(max);
|
|
8479
|
+
}
|
|
8480
|
+
},
|
|
8481
|
+
onBlur: (event) => {
|
|
8482
|
+
if (editable) {
|
|
8483
|
+
const parsed = parseNumber(display);
|
|
8484
|
+
commit(parsed === void 0 ? current ?? null : parsed === null ? null : bounded(parsed));
|
|
8485
|
+
}
|
|
8486
|
+
props.onBlur?.(event);
|
|
8487
|
+
}
|
|
8488
|
+
}
|
|
8489
|
+
),
|
|
8490
|
+
/* @__PURE__ */ jsx230(
|
|
8491
|
+
IconButton,
|
|
8492
|
+
{
|
|
8493
|
+
variant: "secondary",
|
|
8494
|
+
size: buttonSize,
|
|
8495
|
+
icon: /* @__PURE__ */ jsx230(AddOutline, {}),
|
|
8496
|
+
"aria-label": increaseLabel,
|
|
8497
|
+
"aria-controls": inputId,
|
|
8498
|
+
disabled: disabled || readOnly || current != null && current >= max,
|
|
8499
|
+
onClick: () => increment(1)
|
|
8500
|
+
}
|
|
8501
|
+
)
|
|
8502
|
+
] }),
|
|
8503
|
+
name && /* @__PURE__ */ jsx230(
|
|
8504
|
+
"input",
|
|
8505
|
+
{
|
|
8506
|
+
type: "hidden",
|
|
8507
|
+
name,
|
|
8508
|
+
form: props.form,
|
|
8509
|
+
value: current == null ? "" : String(current),
|
|
8510
|
+
disabled
|
|
8511
|
+
}
|
|
8512
|
+
),
|
|
8513
|
+
description && /* @__PURE__ */ jsx230(Text, { as: "div", variant: "body-md", color: "secondary", id: descriptionId, children: description }),
|
|
8514
|
+
error && /* @__PURE__ */ jsx230(Text, { as: "div", variant: "body-md", color: "red", id: errorId, children: error })
|
|
8515
|
+
] }) });
|
|
8516
|
+
}
|
|
8517
|
+
|
|
8518
|
+
// ../ultimate/src/components/rating/Rating.tsx
|
|
8519
|
+
import * as React240 from "react";
|
|
8520
|
+
|
|
8521
|
+
// ../ultimate/src/components/star/Star.tsx
|
|
8522
|
+
import * as React239 from "react";
|
|
8523
|
+
|
|
8524
|
+
// ../ultimate/src/components/star/Star.module.css
|
|
8525
|
+
var Star_default = {};
|
|
8526
|
+
|
|
8527
|
+
// ../ultimate/src/components/star/Star.tsx
|
|
8528
|
+
import { jsx as jsx231 } from "react/jsx-runtime";
|
|
8529
|
+
var Star = React239.forwardRef(
|
|
8530
|
+
({
|
|
8531
|
+
className,
|
|
8532
|
+
checked = false,
|
|
8533
|
+
size = "medium",
|
|
8534
|
+
variant = "default",
|
|
8535
|
+
disabled,
|
|
8536
|
+
onChange,
|
|
8537
|
+
onClick,
|
|
8538
|
+
...rest
|
|
8539
|
+
}, ref) => {
|
|
8540
|
+
const [pressed, setPressed] = React239.useState(false);
|
|
8541
|
+
const timeoutRef = React239.useRef(null);
|
|
8542
|
+
const iconSize = size === "small" ? 20 : 24;
|
|
8543
|
+
const handleClick = (e) => {
|
|
8544
|
+
if (disabled) return;
|
|
8545
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
8546
|
+
setPressed(true);
|
|
8547
|
+
timeoutRef.current = setTimeout(() => setPressed(false), 350);
|
|
8548
|
+
if (onChange) {
|
|
8549
|
+
onChange(!checked);
|
|
8550
|
+
}
|
|
8551
|
+
if (onClick) {
|
|
8552
|
+
onClick(e);
|
|
8553
|
+
}
|
|
8554
|
+
};
|
|
8555
|
+
React239.useEffect(() => {
|
|
8556
|
+
return () => {
|
|
8557
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
8558
|
+
};
|
|
8559
|
+
}, []);
|
|
8560
|
+
const starClasses = [
|
|
8561
|
+
"phx-star",
|
|
8562
|
+
Star_default.starRoot,
|
|
8563
|
+
Star_default[`starSize${size.charAt(0).toUpperCase() + size.slice(1)}`],
|
|
8564
|
+
Star_default[`starVariant${variant.charAt(0).toUpperCase() + variant.slice(1)}`],
|
|
8565
|
+
checked && Star_default.starStateChecked,
|
|
8566
|
+
pressed && Star_default.starStatePressed,
|
|
8567
|
+
className
|
|
8568
|
+
].filter(Boolean).join(" ");
|
|
8569
|
+
return /* @__PURE__ */ jsx231(
|
|
8570
|
+
"button",
|
|
8571
|
+
{
|
|
8572
|
+
ref,
|
|
8573
|
+
type: "button",
|
|
8574
|
+
className: starClasses,
|
|
8575
|
+
disabled,
|
|
8576
|
+
onClick: handleClick,
|
|
8577
|
+
"aria-pressed": checked,
|
|
8578
|
+
"aria-label": "Favorite",
|
|
8579
|
+
...rest,
|
|
8580
|
+
children: /* @__PURE__ */ jsx231("span", { className: Star_default.starIconWrapper, children: checked ? /* @__PURE__ */ jsx231(StarFilled, { size: iconSize }) : /* @__PURE__ */ jsx231(StarOutline, { size: iconSize }) })
|
|
8581
|
+
}
|
|
8582
|
+
);
|
|
8583
|
+
}
|
|
8584
|
+
);
|
|
8585
|
+
Star.displayName = "Star";
|
|
8586
|
+
|
|
8587
|
+
// ../ultimate/src/components/rating/Rating.tsx
|
|
8588
|
+
import { jsx as jsx232, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
8589
|
+
function Rating({
|
|
8590
|
+
label,
|
|
8591
|
+
value,
|
|
8592
|
+
defaultValue = 0,
|
|
8593
|
+
max = 5,
|
|
8594
|
+
onChange,
|
|
8595
|
+
disabled,
|
|
8596
|
+
readOnly,
|
|
8597
|
+
name,
|
|
8598
|
+
form,
|
|
8599
|
+
clearable = false,
|
|
8600
|
+
clearText = "Clear",
|
|
8601
|
+
clearLabel = `Clear ${label}`,
|
|
8602
|
+
getStarLabel = (star, total) => `${star} of ${total} stars`
|
|
8603
|
+
}) {
|
|
8604
|
+
const count = Math.max(1, Math.min(100, Math.floor(max) || 5));
|
|
8605
|
+
const [current = 0, setCurrent, reset] = useControllableState({
|
|
8606
|
+
value,
|
|
8607
|
+
defaultValue,
|
|
8608
|
+
onChange
|
|
8609
|
+
});
|
|
8610
|
+
const hidden = React240.useRef(null);
|
|
8611
|
+
const normalize = (rating) => Number.isFinite(rating) ? Math.max(0, Math.min(count, Math.round(rating))) : 0;
|
|
8612
|
+
const selected = normalize(current);
|
|
8613
|
+
useNativeFieldReset(
|
|
8614
|
+
hidden,
|
|
8615
|
+
reset,
|
|
8616
|
+
String(value !== void 0 ? selected : normalize(defaultValue)),
|
|
8617
|
+
form
|
|
8618
|
+
);
|
|
8619
|
+
return /* @__PURE__ */ jsxs21(HStack, { gap: "2xs", align: "center", wrap: true, children: [
|
|
8620
|
+
/* @__PURE__ */ jsx232(
|
|
8621
|
+
HStack,
|
|
8622
|
+
{
|
|
8623
|
+
gap: "none",
|
|
8624
|
+
align: "center",
|
|
8625
|
+
role: "radiogroup",
|
|
8626
|
+
"aria-label": label,
|
|
8627
|
+
"aria-readonly": readOnly || void 0,
|
|
8628
|
+
onKeyDown: (event) => {
|
|
8629
|
+
if (disabled || readOnly || event.nativeEvent.isComposing) return;
|
|
8630
|
+
const rtl = getComputedStyle(event.currentTarget).direction === "rtl";
|
|
8631
|
+
const forward = rtl ? "ArrowLeft" : "ArrowRight";
|
|
8632
|
+
const backward = rtl ? "ArrowRight" : "ArrowLeft";
|
|
8633
|
+
let next;
|
|
8634
|
+
if (event.key === forward || event.key === "ArrowUp")
|
|
8635
|
+
next = selected >= count ? 1 : selected + 1;
|
|
8636
|
+
else if (event.key === backward || event.key === "ArrowDown")
|
|
8637
|
+
next = selected <= 1 ? count : selected - 1;
|
|
8638
|
+
else if (event.key === "Home") next = 1;
|
|
8639
|
+
else if (event.key === "End") next = count;
|
|
8640
|
+
else return;
|
|
8641
|
+
event.preventDefault();
|
|
8642
|
+
setCurrent(next);
|
|
8643
|
+
event.currentTarget.querySelectorAll('[role="radio"]')[next - 1]?.focus();
|
|
8644
|
+
},
|
|
8645
|
+
children: Array.from({ length: count }, (_, index) => /* @__PURE__ */ jsx232(
|
|
8646
|
+
Star,
|
|
8647
|
+
{
|
|
8648
|
+
checked: index < selected,
|
|
8649
|
+
"aria-pressed": void 0,
|
|
8650
|
+
type: "button",
|
|
8651
|
+
role: "radio",
|
|
8652
|
+
"aria-label": getStarLabel(index + 1, count),
|
|
8653
|
+
"aria-checked": selected === index + 1,
|
|
8654
|
+
disabled,
|
|
8655
|
+
tabIndex: selected === index + 1 || !selected && index === 0 ? 0 : -1,
|
|
8656
|
+
onClick: () => {
|
|
8657
|
+
if (!disabled && !readOnly) setCurrent(index + 1);
|
|
8658
|
+
}
|
|
8659
|
+
},
|
|
8660
|
+
index
|
|
8661
|
+
))
|
|
8662
|
+
}
|
|
8663
|
+
),
|
|
8664
|
+
clearable && /* @__PURE__ */ jsx232(
|
|
8665
|
+
Button,
|
|
8666
|
+
{
|
|
8667
|
+
variant: "secondary",
|
|
8668
|
+
size: "small",
|
|
8669
|
+
type: "button",
|
|
8670
|
+
"aria-label": clearLabel,
|
|
8671
|
+
disabled: disabled || readOnly || !selected,
|
|
8672
|
+
onClick: () => setCurrent(0),
|
|
8673
|
+
children: clearText
|
|
8674
|
+
}
|
|
8675
|
+
),
|
|
8676
|
+
/* @__PURE__ */ jsx232(
|
|
8677
|
+
"input",
|
|
8678
|
+
{
|
|
8679
|
+
ref: hidden,
|
|
8680
|
+
type: "hidden",
|
|
8681
|
+
name,
|
|
8682
|
+
form,
|
|
8683
|
+
value: selected,
|
|
8684
|
+
disabled
|
|
8685
|
+
}
|
|
8686
|
+
)
|
|
8687
|
+
] });
|
|
8688
|
+
}
|
|
8689
|
+
|
|
8690
|
+
// ../ultimate/src/components/otp/OTP.tsx
|
|
8691
|
+
import * as React241 from "react";
|
|
8692
|
+
import { flushSync } from "react-dom";
|
|
8693
|
+
|
|
8694
|
+
// ../ultimate/src/components/otp/OTP.module.css
|
|
8695
|
+
var OTP_default = {};
|
|
8696
|
+
|
|
8697
|
+
// ../ultimate/src/components/otp/OTP.tsx
|
|
8698
|
+
import { jsx as jsx233, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
8699
|
+
function OTP({
|
|
8700
|
+
label,
|
|
8701
|
+
length = 6,
|
|
8702
|
+
groupSize,
|
|
8703
|
+
masked = false,
|
|
8704
|
+
hideLabel = false,
|
|
8705
|
+
dotFields = false,
|
|
8706
|
+
size = "large",
|
|
8707
|
+
value,
|
|
8708
|
+
defaultValue = "",
|
|
8709
|
+
onChange,
|
|
8710
|
+
onComplete,
|
|
8711
|
+
disabled,
|
|
8712
|
+
readOnly,
|
|
8713
|
+
required,
|
|
8714
|
+
name,
|
|
8715
|
+
form,
|
|
8716
|
+
helperText,
|
|
8717
|
+
error,
|
|
8718
|
+
getCellLabel = (name2, position, total) => `${name2}, digit ${position} of ${total}`,
|
|
8719
|
+
sequential = false,
|
|
8720
|
+
autoFocus = false
|
|
8721
|
+
}) {
|
|
8722
|
+
const count = Number.isFinite(length) ? Math.max(1, Math.min(32, Math.floor(length))) : 6;
|
|
8723
|
+
const normalize = (text) => text.replace(/\D/g, "").slice(0, count);
|
|
8724
|
+
const split = (text) => Array.from({ length: count }, (_, index) => normalize(text)[index] ?? "");
|
|
8725
|
+
const [code = "", setCode, reset] = useControllableState({
|
|
8726
|
+
value,
|
|
8727
|
+
defaultValue: normalize(defaultValue),
|
|
8728
|
+
onChange
|
|
8729
|
+
});
|
|
8730
|
+
const [local, setLocal] = React241.useState(() => split(value ?? defaultValue));
|
|
8731
|
+
const pending = React241.useRef(null);
|
|
8732
|
+
const digits = value === void 0 ? Array.from({ length: count }, (_, index) => local[index] ?? "") : pending.current?.code === normalize(code) ? Array.from(
|
|
8733
|
+
{ length: count },
|
|
8734
|
+
(_, index) => pending.current.digits[index] ?? ""
|
|
8735
|
+
) : split(code);
|
|
8736
|
+
const currentDigits = React241.useRef(digits);
|
|
8737
|
+
currentDigits.current = digits;
|
|
8738
|
+
const composing = React241.useRef(null);
|
|
8739
|
+
const inputs = React241.useRef([]);
|
|
8740
|
+
const first = React241.useRef(null);
|
|
8741
|
+
const previousReadOnly = React241.useRef(readOnly);
|
|
8742
|
+
React241.useEffect(() => {
|
|
8743
|
+
if (readOnly && !previousReadOnly.current) {
|
|
8744
|
+
const active = inputs.current.find((input) => input === document.activeElement);
|
|
8745
|
+
active?.blur();
|
|
8746
|
+
}
|
|
8747
|
+
previousReadOnly.current = readOnly;
|
|
8748
|
+
}, [readOnly]);
|
|
8749
|
+
const id = React241.useId();
|
|
8750
|
+
const supportingText = error || helperText;
|
|
8751
|
+
const supportingId = error ? `${id}-error` : helperText ? `${id}-helper` : void 0;
|
|
8752
|
+
const focus = (index) => inputs.current[index]?.focus({ preventScroll: true });
|
|
8753
|
+
const nextCell = (from) => {
|
|
8754
|
+
const empty = from.findIndex((digit) => !digit);
|
|
8755
|
+
return empty === -1 ? count - 1 : empty;
|
|
8756
|
+
};
|
|
8757
|
+
const commit = (next) => {
|
|
8758
|
+
const nextCode = next.join("");
|
|
8759
|
+
pending.current = { code: nextCode, digits: next };
|
|
8760
|
+
currentDigits.current = next;
|
|
8761
|
+
setLocal(next);
|
|
8762
|
+
setCode(nextCode);
|
|
8763
|
+
if (next.every(Boolean) && nextCode !== normalize(code))
|
|
8764
|
+
onComplete?.(nextCode);
|
|
8765
|
+
};
|
|
8766
|
+
const enter = (cell, raw) => {
|
|
8767
|
+
if (disabled || readOnly) return;
|
|
8768
|
+
if (sequential && raw && currentDigits.current.every(Boolean)) return;
|
|
8769
|
+
const index = sequential ? nextCell(currentDigits.current) : cell;
|
|
8770
|
+
const text = normalize(raw);
|
|
8771
|
+
if (raw && !text) return;
|
|
8772
|
+
const start = text.length === count ? 0 : index;
|
|
8773
|
+
const next = [...currentDigits.current];
|
|
8774
|
+
if (!text) next[index] = "";
|
|
8775
|
+
else
|
|
8776
|
+
[...text].forEach((digit, offset) => {
|
|
8777
|
+
if (start + offset < count) next[start + offset] = digit;
|
|
8778
|
+
});
|
|
8779
|
+
flushSync(() => commit(next));
|
|
8780
|
+
const nextIndex = sequential ? nextCell(next) : Math.min(count - 1, start + text.length);
|
|
8781
|
+
if (text && !inputs.current[nextIndex]?.readOnly) focus(nextIndex);
|
|
8782
|
+
};
|
|
8783
|
+
React241.useEffect(() => {
|
|
8784
|
+
if (autoFocus && !disabled && !readOnly) focus(sequential ? nextCell(currentDigits.current) : 0);
|
|
8785
|
+
}, []);
|
|
8786
|
+
React241.useEffect(() => {
|
|
8787
|
+
const cleanups = inputs.current.slice(0, count).map((input, index) => {
|
|
8788
|
+
if (!input) return () => {
|
|
8789
|
+
};
|
|
8790
|
+
const beforeInput = (event) => {
|
|
8791
|
+
if (disabled || readOnly || !event.cancelable || !event.data) return;
|
|
8792
|
+
if (!event.inputType.startsWith("insert") || !/^[0-9]+$/.test(event.data)) return;
|
|
8793
|
+
event.preventDefault();
|
|
8794
|
+
composing.current = null;
|
|
8795
|
+
enter(index, event.data);
|
|
8796
|
+
};
|
|
8797
|
+
input.addEventListener("beforeinput", beforeInput);
|
|
8798
|
+
return () => input.removeEventListener("beforeinput", beforeInput);
|
|
8799
|
+
});
|
|
8800
|
+
return () => cleanups.forEach((cleanup) => cleanup());
|
|
8801
|
+
});
|
|
8802
|
+
const resetCode = value === void 0 ? normalize(defaultValue) : normalize(code);
|
|
8803
|
+
useNativeFieldReset(
|
|
8804
|
+
first,
|
|
8805
|
+
() => {
|
|
8806
|
+
reset();
|
|
8807
|
+
const next = split(resetCode);
|
|
8808
|
+
pending.current = { code: resetCode, digits: next };
|
|
8809
|
+
setLocal(next);
|
|
8810
|
+
composing.current = null;
|
|
8811
|
+
inputs.current.forEach((input, index) => {
|
|
8812
|
+
if (input) input.value = next[index] ?? "";
|
|
8813
|
+
});
|
|
8814
|
+
},
|
|
8815
|
+
resetCode[0] ?? "",
|
|
8816
|
+
form
|
|
8817
|
+
);
|
|
8818
|
+
const columns = Math.min(count, 6);
|
|
8819
|
+
const cellWidth = dotFields ? 16 : size === "large" ? 44 : size === "medium" ? 36 : 28;
|
|
8820
|
+
const grouping = groupSize !== void 0 && Number.isFinite(groupSize) && groupSize >= 1 ? Math.floor(groupSize) : 0;
|
|
8821
|
+
const separates = (index) => grouping > 0 && index > 0 && index % grouping === 0 && index % columns !== 0;
|
|
8822
|
+
const tracks = Array.from(
|
|
8823
|
+
{ length: columns },
|
|
8824
|
+
(_, index) => `${separates(index) ? "var(--dimensions-12) " : ""}minmax(0, 1fr)`
|
|
8825
|
+
).join(" ");
|
|
8826
|
+
const separatorCount = Array.from({ length: columns }, (_, index) => separates(index)).filter(Boolean).length;
|
|
8827
|
+
return /* @__PURE__ */ jsxs22(VStack, { gap: "5xs", align: "start", maxW: "100%", children: [
|
|
8828
|
+
!hideLabel && /* @__PURE__ */ jsxs22(Text, { as: "span", id: `${id}-label`, variant: size === "large" ? "title-md" : size === "medium" ? "title-sm" : "label-md", children: [
|
|
8829
|
+
label,
|
|
8830
|
+
required && /* @__PURE__ */ jsx233("span", { "aria-hidden": "true", children: " *" })
|
|
8831
|
+
] }),
|
|
8832
|
+
/* @__PURE__ */ jsx233(
|
|
8833
|
+
Grid,
|
|
8834
|
+
{
|
|
8835
|
+
role: "group",
|
|
8836
|
+
dir: "ltr",
|
|
8837
|
+
"aria-labelledby": hideLabel ? void 0 : `${id}-label`,
|
|
8838
|
+
"aria-label": hideLabel ? label : void 0,
|
|
8839
|
+
"aria-describedby": supportingId,
|
|
8840
|
+
templateColumns: tracks,
|
|
8841
|
+
gap: dotFields ? "md" : "4xs",
|
|
8842
|
+
maxW: "100%",
|
|
8843
|
+
w: `calc(${columns} * ${cellWidth}px + ${columns - 1 + separatorCount} * var(${dotFields ? "--space-md" : "--space-4xs"}) + ${separatorCount} * var(--dimensions-12))`,
|
|
8844
|
+
children: Array.from({ length: count }, (_, index) => /* @__PURE__ */ jsxs22(React241.Fragment, { children: [
|
|
8845
|
+
separates(index % columns) && /* @__PURE__ */ jsx233(Text, { as: "span", "aria-hidden": "true", className: OTP_default.separator, children: "-" }),
|
|
8846
|
+
/* @__PURE__ */ jsxs22(Text, { as: "span", className: `${OTP_default.cellSlot} ${OTP_default[size]} ${dotFields ? OTP_default.dotField : ""}`, variant: size === "large" ? "headline-sm" : size === "medium" ? "title-lg" : "title-md", weight: "medium", children: [
|
|
8847
|
+
/* @__PURE__ */ jsx233(
|
|
8848
|
+
"input",
|
|
8849
|
+
{
|
|
8850
|
+
id: `${id}-${index}`,
|
|
8851
|
+
className: `${OTP_default.cell} ${masked ? OTP_default.masked : ""} ${dotFields ? OTP_default.dotFieldInput : ""}`,
|
|
8852
|
+
"data-filled": dotFields ? !!digits[index] : void 0,
|
|
8853
|
+
ref: (node) => {
|
|
8854
|
+
inputs.current[index] = node;
|
|
8855
|
+
if (index === 0) first.current = node;
|
|
8856
|
+
},
|
|
8857
|
+
"aria-label": getCellLabel(label, index + 1, count),
|
|
8858
|
+
"aria-describedby": supportingId,
|
|
8859
|
+
"aria-invalid": error ? true : void 0,
|
|
8860
|
+
type: masked ? "password" : "text",
|
|
8861
|
+
inputMode: "numeric",
|
|
8862
|
+
autoComplete: masked ? "off" : index === 0 ? "one-time-code" : "off",
|
|
8863
|
+
pattern: "[0-9]",
|
|
8864
|
+
maxLength: 1,
|
|
8865
|
+
required: required || digits.some(Boolean),
|
|
8866
|
+
disabled,
|
|
8867
|
+
readOnly,
|
|
8868
|
+
form,
|
|
8869
|
+
value: digits[index] ?? "",
|
|
8870
|
+
tabIndex: sequential && index !== nextCell(digits) ? -1 : void 0,
|
|
8871
|
+
onMouseDown: (event) => {
|
|
8872
|
+
if (!sequential || disabled || readOnly) return;
|
|
8873
|
+
event.preventDefault();
|
|
8874
|
+
focus(nextCell(currentDigits.current));
|
|
8875
|
+
},
|
|
8876
|
+
onFocus: (event) => {
|
|
8877
|
+
const target = nextCell(currentDigits.current);
|
|
8878
|
+
if (sequential && index !== target && !readOnly) {
|
|
8879
|
+
focus(target);
|
|
8880
|
+
return;
|
|
8881
|
+
}
|
|
8882
|
+
event.currentTarget.setSelectionRange(0, event.currentTarget.value.length);
|
|
8883
|
+
},
|
|
8884
|
+
onCopy: (event) => {
|
|
8885
|
+
if (masked) {
|
|
8886
|
+
event.preventDefault();
|
|
8887
|
+
return;
|
|
8888
|
+
}
|
|
8889
|
+
if (!readOnly) return;
|
|
8890
|
+
event.preventDefault();
|
|
8891
|
+
event.clipboardData.setData("text/plain", normalize(code));
|
|
8892
|
+
},
|
|
8893
|
+
onChange: () => {
|
|
8894
|
+
},
|
|
8895
|
+
onInput: (event) => {
|
|
8896
|
+
if (disabled || readOnly) return;
|
|
8897
|
+
const next = event.currentTarget.value;
|
|
8898
|
+
event.currentTarget.value = normalize(next).slice(0, 1) || (digits[index] ?? "");
|
|
8899
|
+
if (composing.current === index && next && !/^[0-9]+$/.test(next)) return;
|
|
8900
|
+
composing.current = null;
|
|
8901
|
+
enter(index, next);
|
|
8902
|
+
},
|
|
8903
|
+
onPaste: (event) => {
|
|
8904
|
+
event.preventDefault();
|
|
8905
|
+
enter(index, event.clipboardData.getData("text"));
|
|
8906
|
+
},
|
|
8907
|
+
onCompositionStart: () => {
|
|
8908
|
+
if (disabled || readOnly) return;
|
|
8909
|
+
composing.current = index;
|
|
8910
|
+
},
|
|
8911
|
+
onCompositionEnd: (event) => {
|
|
8912
|
+
if (disabled || readOnly) return;
|
|
8913
|
+
const text = event.data || event.currentTarget.value;
|
|
8914
|
+
event.currentTarget.value = currentDigits.current[index] ?? "";
|
|
8915
|
+
if (composing.current !== index) return;
|
|
8916
|
+
composing.current = null;
|
|
8917
|
+
enter(index, text);
|
|
8918
|
+
},
|
|
8919
|
+
onKeyDown: (event) => {
|
|
8920
|
+
if (event.nativeEvent.isComposing || composing.current !== null || disabled)
|
|
8921
|
+
return;
|
|
8922
|
+
if (event.key === "Backspace" || event.key === "Delete") {
|
|
8923
|
+
event.preventDefault();
|
|
8924
|
+
if (readOnly) return;
|
|
8925
|
+
if (sequential) {
|
|
8926
|
+
const next2 = [...currentDigits.current];
|
|
8927
|
+
const last = next2.map(Boolean).lastIndexOf(true);
|
|
8928
|
+
if (last >= 0) next2[last] = "";
|
|
8929
|
+
flushSync(() => commit(next2));
|
|
8930
|
+
focus(nextCell(next2));
|
|
8931
|
+
return;
|
|
8932
|
+
}
|
|
8933
|
+
const target = event.key === "Backspace" && !digits[index] ? Math.max(0, index - 1) : index;
|
|
8934
|
+
const next = [...currentDigits.current];
|
|
8935
|
+
next[target] = "";
|
|
8936
|
+
commit(next);
|
|
8937
|
+
focus(target);
|
|
8938
|
+
} else if (["ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key)) {
|
|
8939
|
+
event.preventDefault();
|
|
8940
|
+
if (sequential) return;
|
|
8941
|
+
focus(
|
|
8942
|
+
event.key === "Home" ? 0 : event.key === "End" ? count - 1 : Math.max(
|
|
8943
|
+
0,
|
|
8944
|
+
Math.min(
|
|
8945
|
+
count - 1,
|
|
8946
|
+
index + (event.key === "ArrowRight" ? 1 : -1)
|
|
8947
|
+
)
|
|
8948
|
+
)
|
|
8949
|
+
);
|
|
8950
|
+
}
|
|
8951
|
+
}
|
|
8952
|
+
}
|
|
8953
|
+
),
|
|
8954
|
+
masked && !dotFields && digits[index] && /* @__PURE__ */ jsx233("span", { className: OTP_default.dot, "aria-hidden": "true" })
|
|
8955
|
+
] })
|
|
8956
|
+
] }, index))
|
|
8957
|
+
}
|
|
8958
|
+
),
|
|
8959
|
+
name && /* @__PURE__ */ jsx233(
|
|
8960
|
+
"input",
|
|
8961
|
+
{
|
|
8962
|
+
type: "hidden",
|
|
8963
|
+
name,
|
|
8964
|
+
form,
|
|
8965
|
+
value: normalize(code),
|
|
8966
|
+
disabled
|
|
8967
|
+
}
|
|
8968
|
+
),
|
|
8969
|
+
supportingText && /* @__PURE__ */ jsx233(Text, { as: "div", id: supportingId, variant: "body-md", color: error ? "red" : "secondary", role: error ? "alert" : void 0, children: supportingText })
|
|
8970
|
+
] });
|
|
8971
|
+
}
|
|
8972
|
+
|
|
8973
|
+
// ../ultimate/src/components/pin/PIN.tsx
|
|
8974
|
+
import { jsx as jsx234 } from "react/jsx-runtime";
|
|
8975
|
+
function PIN({ length = 4, "aria-label": accessibleLabel = "PIN", autoFocus = true, ...props }) {
|
|
8976
|
+
return /* @__PURE__ */ jsx234(OTP, { ...props, label: accessibleLabel, length, size: "large", masked: true, hideLabel: true, dotFields: true, readOnly: false, sequential: true, autoFocus });
|
|
8977
|
+
}
|
|
8978
|
+
|
|
8979
|
+
// ../ultimate/src/components/empty/Empty.tsx
|
|
8980
|
+
import * as React242 from "react";
|
|
8981
|
+
import { jsx as jsx235, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
8982
|
+
function Empty({
|
|
8983
|
+
title = "No results",
|
|
8984
|
+
description,
|
|
8985
|
+
icon,
|
|
8986
|
+
action
|
|
8987
|
+
}) {
|
|
8988
|
+
const titleId = React242.useId();
|
|
8989
|
+
return /* @__PURE__ */ jsxs23(
|
|
8990
|
+
VStack,
|
|
8991
|
+
{
|
|
8992
|
+
as: "section",
|
|
8993
|
+
gap: "sm",
|
|
8994
|
+
p: "xl",
|
|
8995
|
+
align: "center",
|
|
8996
|
+
textAlign: "center",
|
|
8997
|
+
"aria-labelledby": titleId,
|
|
8998
|
+
children: [
|
|
8999
|
+
icon && /* @__PURE__ */ jsx235("span", { "aria-hidden": "true", children: icon }),
|
|
9000
|
+
/* @__PURE__ */ jsxs23(VStack, { gap: "4xs", align: "center", children: [
|
|
9001
|
+
/* @__PURE__ */ jsx235(Heading, { as: "h3", size: "title-lg", id: titleId, children: title }),
|
|
9002
|
+
description && /* @__PURE__ */ jsx235(Text, { as: "div", color: "secondary", children: description })
|
|
9003
|
+
] }),
|
|
9004
|
+
action
|
|
9005
|
+
]
|
|
9006
|
+
}
|
|
9007
|
+
);
|
|
9008
|
+
}
|
|
9009
|
+
|
|
9010
|
+
// ../ultimate/src/components/result/Result.tsx
|
|
9011
|
+
import * as React243 from "react";
|
|
9012
|
+
import { CheckCircle, Cancel, Warning, Information } from "@photonix/illustrations";
|
|
9013
|
+
import { jsx as jsx236, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
9014
|
+
var STATUS_ILLUSTRATION = {
|
|
9015
|
+
success: CheckCircle,
|
|
9016
|
+
error: Cancel,
|
|
9017
|
+
warning: Warning,
|
|
9018
|
+
info: Information
|
|
9019
|
+
};
|
|
9020
|
+
function Result({ status, title, description, action }) {
|
|
9021
|
+
const titleId = React243.useId();
|
|
9022
|
+
const StatusIllustration = STATUS_ILLUSTRATION[status];
|
|
9023
|
+
return /* @__PURE__ */ jsxs24(
|
|
9024
|
+
VStack,
|
|
9025
|
+
{
|
|
9026
|
+
as: "section",
|
|
9027
|
+
gap: "sm",
|
|
9028
|
+
p: "xl",
|
|
9029
|
+
align: "center",
|
|
9030
|
+
textAlign: "center",
|
|
9031
|
+
"aria-labelledby": titleId,
|
|
9032
|
+
"data-status": status,
|
|
9033
|
+
children: [
|
|
9034
|
+
/* @__PURE__ */ jsx236("span", { "aria-hidden": "true", children: /* @__PURE__ */ jsx236(StatusIllustration, { tone: "accent" }) }),
|
|
9035
|
+
/* @__PURE__ */ jsxs24(
|
|
9036
|
+
VStack,
|
|
9037
|
+
{
|
|
9038
|
+
gap: "4xs",
|
|
9039
|
+
align: "center",
|
|
9040
|
+
role: status === "error" ? "alert" : "status",
|
|
9041
|
+
children: [
|
|
9042
|
+
/* @__PURE__ */ jsx236(Heading, { as: "h3", size: "title-lg", id: titleId, children: title }),
|
|
9043
|
+
description && /* @__PURE__ */ jsx236(Text, { as: "div", color: "secondary", children: description })
|
|
9044
|
+
]
|
|
9045
|
+
}
|
|
9046
|
+
),
|
|
9047
|
+
action
|
|
9048
|
+
]
|
|
9049
|
+
}
|
|
9050
|
+
);
|
|
9051
|
+
}
|
|
9052
|
+
|
|
9053
|
+
// ../ultimate/src/components/data-list/DataList.tsx
|
|
9054
|
+
import { jsx as jsx237, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
9055
|
+
var DOTS = [0, 1, 2, 3, 4, 5];
|
|
9056
|
+
function Action({ children, slot }) {
|
|
9057
|
+
return /* @__PURE__ */ jsx237(
|
|
9058
|
+
Box,
|
|
9059
|
+
{
|
|
9060
|
+
display: "flex",
|
|
9061
|
+
alignItems: "center",
|
|
9062
|
+
justifyContent: "center",
|
|
9063
|
+
flexShrink: 0,
|
|
9064
|
+
h: slot ? "var(--body-lg-line-height)" : void 0,
|
|
9065
|
+
w: slot ? "var(--dimensions-20)" : void 0,
|
|
9066
|
+
children
|
|
9067
|
+
}
|
|
9068
|
+
);
|
|
9069
|
+
}
|
|
9070
|
+
function DataList({
|
|
9071
|
+
items,
|
|
9072
|
+
label = "Details",
|
|
9073
|
+
layout,
|
|
9074
|
+
labelSize,
|
|
9075
|
+
orientation = "horizontal"
|
|
9076
|
+
}) {
|
|
9077
|
+
const resolvedLayout = layout ?? (orientation === "vertical" ? "stack" : "inline");
|
|
9078
|
+
const resolvedLabelSize = labelSize ?? (resolvedLayout === "stack" ? "sm" : "lg");
|
|
9079
|
+
return /* @__PURE__ */ jsx237(VStack, { as: "dl", "aria-label": label, gap: "md", m: "none", children: items.map((item) => /* @__PURE__ */ jsx237(
|
|
9080
|
+
DataListRow,
|
|
9081
|
+
{
|
|
9082
|
+
item,
|
|
9083
|
+
layout: resolvedLayout,
|
|
9084
|
+
labelSize: resolvedLabelSize
|
|
9085
|
+
},
|
|
9086
|
+
item.id
|
|
9087
|
+
)) });
|
|
9088
|
+
}
|
|
9089
|
+
function DataListRow({
|
|
9090
|
+
item,
|
|
9091
|
+
layout,
|
|
9092
|
+
labelSize
|
|
9093
|
+
}) {
|
|
9094
|
+
const variant = item.variant ?? "normal";
|
|
9095
|
+
const isStack = layout === "stack";
|
|
9096
|
+
const isInline = layout === "inline";
|
|
9097
|
+
const isTotal = variant === "total";
|
|
9098
|
+
const isHero = isStack && variant === "hero";
|
|
9099
|
+
const isComplex = isStack && variant === "complex";
|
|
9100
|
+
const isFlexible = !isStack && variant === "flexible";
|
|
9101
|
+
const emphasizeValue = variant === "emphasize" || isTotal || isStack && variant === "normal";
|
|
9102
|
+
const labelEmphasized = item.labelEmphasized ?? isTotal;
|
|
9103
|
+
const labelVariant = labelSize === "lg" ? "title-md" : "title-sm";
|
|
9104
|
+
const labelWeight = labelEmphasized ? "medium" : "regular";
|
|
9105
|
+
const badgeBelow = item.badgePlacement === "below";
|
|
9106
|
+
const description = isHero ? void 0 : item.description;
|
|
9107
|
+
const term = /* @__PURE__ */ jsxs25(Box, { as: "dt", display: "flex", alignItems: "baseline", gap: "4xs", minW: 0, children: [
|
|
9108
|
+
/* @__PURE__ */ jsxs25(Box, { display: "flex", alignItems: "center", gap: "4xs", flex: "1 1 0", minW: 0, children: [
|
|
9109
|
+
item.labelIcon && /* @__PURE__ */ jsx237(Box, { display: "flex", flexShrink: 0, children: item.labelIcon }),
|
|
9110
|
+
/* @__PURE__ */ jsxs25(
|
|
9111
|
+
Text,
|
|
9112
|
+
{
|
|
9113
|
+
as: "div",
|
|
9114
|
+
variant: labelVariant,
|
|
9115
|
+
color: item.labelLead || !labelEmphasized ? "secondary" : "primary",
|
|
9116
|
+
weight: labelWeight,
|
|
9117
|
+
children: [
|
|
9118
|
+
item.labelLead && /* @__PURE__ */ jsxs25(Text, { as: "span", variant: labelVariant, color: "primary", weight: labelWeight, children: [
|
|
9119
|
+
item.labelLead,
|
|
9120
|
+
" "
|
|
9121
|
+
] }),
|
|
9122
|
+
item.label
|
|
9123
|
+
]
|
|
9124
|
+
}
|
|
9125
|
+
)
|
|
9126
|
+
] }),
|
|
9127
|
+
item.labelTrailing && /* @__PURE__ */ jsx237(Box, { flexShrink: 0, children: /* @__PURE__ */ jsx237(Text, { as: "div", variant: "body-md", color: "secondary", align: "right", children: item.labelTrailing }) })
|
|
9128
|
+
] });
|
|
9129
|
+
const figure = isHero && item.masked ? /* @__PURE__ */ jsx237(
|
|
9130
|
+
Box,
|
|
9131
|
+
{
|
|
9132
|
+
display: "flex",
|
|
9133
|
+
alignItems: "center",
|
|
9134
|
+
gap: "2xs",
|
|
9135
|
+
h: "var(--headline-lg-line-height)",
|
|
9136
|
+
role: "img",
|
|
9137
|
+
"aria-label": "Hidden",
|
|
9138
|
+
children: DOTS.map((dot) => /* @__PURE__ */ jsx237(
|
|
9139
|
+
Box,
|
|
9140
|
+
{
|
|
9141
|
+
w: "10px",
|
|
9142
|
+
h: "10px",
|
|
9143
|
+
borderRadius: "full",
|
|
9144
|
+
flexShrink: 0,
|
|
9145
|
+
style: { backgroundColor: "var(--foreground-neutral-primary)" }
|
|
9146
|
+
},
|
|
9147
|
+
dot
|
|
9148
|
+
))
|
|
9149
|
+
}
|
|
9150
|
+
) : /* @__PURE__ */ jsx237(
|
|
9151
|
+
Text,
|
|
9152
|
+
{
|
|
9153
|
+
as: "div",
|
|
9154
|
+
variant: isHero ? "headline-lg" : "body-lg",
|
|
9155
|
+
weight: emphasizeValue && !isHero ? "medium" : void 0,
|
|
9156
|
+
align: isInline ? "right" : void 0,
|
|
9157
|
+
children: item.value
|
|
9158
|
+
}
|
|
9159
|
+
);
|
|
9160
|
+
const valueRow = isComplex ? /* @__PURE__ */ jsxs25(Box, { display: "flex", alignItems: "center", gap: "xs", w: "100%", minW: 0, children: [
|
|
9161
|
+
/* @__PURE__ */ jsx237(Box, { flex: "1 1 0", minW: 0, children: item.value }),
|
|
9162
|
+
item.action && /* @__PURE__ */ jsx237(Action, { slot: false, children: item.action })
|
|
9163
|
+
] }) : /* @__PURE__ */ jsxs25(
|
|
9164
|
+
Box,
|
|
9165
|
+
{
|
|
9166
|
+
display: "flex",
|
|
9167
|
+
alignItems: "center",
|
|
9168
|
+
gap: "4xs",
|
|
9169
|
+
minW: 0,
|
|
9170
|
+
justifyContent: isInline ? "end" : void 0,
|
|
9171
|
+
children: [
|
|
9172
|
+
item.icon && /* @__PURE__ */ jsx237(Box, { display: "flex", flexShrink: 0, children: item.icon }),
|
|
9173
|
+
item.valuePrefix && /* @__PURE__ */ jsx237(Box, { alignSelf: "baseline", flexShrink: 0, children: /* @__PURE__ */ jsx237(Text, { as: "span", variant: isHero ? "headline-lg" : "body-lg", color: "secondary", children: item.valuePrefix }) }),
|
|
9174
|
+
/* @__PURE__ */ jsx237(Box, { alignSelf: "baseline", minW: 0, children: figure }),
|
|
9175
|
+
item.action && /* @__PURE__ */ jsx237(Action, { slot: !isHero, children: item.action })
|
|
9176
|
+
]
|
|
9177
|
+
}
|
|
9178
|
+
);
|
|
9179
|
+
const badge = item.badge ? /* @__PURE__ */ jsx237(Box, { display: "flex", flexShrink: 0, children: item.badge }) : null;
|
|
9180
|
+
const firstLine = badge && !badgeBelow ? /* @__PURE__ */ jsxs25(
|
|
9181
|
+
Box,
|
|
9182
|
+
{
|
|
9183
|
+
display: "flex",
|
|
9184
|
+
alignItems: "center",
|
|
9185
|
+
gap: "2xs",
|
|
9186
|
+
w: "100%",
|
|
9187
|
+
minW: 0,
|
|
9188
|
+
justifyContent: isInline ? "end" : void 0,
|
|
9189
|
+
children: [
|
|
9190
|
+
valueRow,
|
|
9191
|
+
badge
|
|
9192
|
+
]
|
|
9193
|
+
}
|
|
9194
|
+
) : valueRow;
|
|
9195
|
+
const definition = /* @__PURE__ */ jsxs25(
|
|
9196
|
+
Box,
|
|
9197
|
+
{
|
|
9198
|
+
as: "dd",
|
|
9199
|
+
m: "none",
|
|
9200
|
+
display: "flex",
|
|
9201
|
+
flexDirection: "column",
|
|
9202
|
+
alignItems: isInline ? "end" : "stretch",
|
|
9203
|
+
gap: badge && badgeBelow && !description ? "4xs" : "5xs",
|
|
9204
|
+
minW: 0,
|
|
9205
|
+
children: [
|
|
9206
|
+
firstLine,
|
|
9207
|
+
description && /* @__PURE__ */ jsx237(Text, { as: "div", variant: "body-md", color: "secondary", align: isInline ? "right" : void 0, children: description }),
|
|
9208
|
+
badgeBelow && badge
|
|
9209
|
+
]
|
|
9210
|
+
}
|
|
9211
|
+
);
|
|
9212
|
+
if (isStack) {
|
|
9213
|
+
return /* @__PURE__ */ jsxs25(VStack, { gap: "4xs", align: "stretch", children: [
|
|
9214
|
+
term,
|
|
9215
|
+
definition,
|
|
9216
|
+
isHero && item.description && /* @__PURE__ */ jsx237(Text, { as: "div", variant: "body-md", color: "secondary", children: item.description })
|
|
9217
|
+
] });
|
|
9218
|
+
}
|
|
9219
|
+
if (layout === "column") {
|
|
9220
|
+
return /* @__PURE__ */ jsxs25(
|
|
9221
|
+
Grid,
|
|
9222
|
+
{
|
|
9223
|
+
columns: isFlexible ? void 0 : 5,
|
|
9224
|
+
templateColumns: isFlexible ? "auto minmax(0, 1fr)" : void 0,
|
|
9225
|
+
columnGap: "2xs",
|
|
9226
|
+
alignItems: "baseline",
|
|
9227
|
+
children: [
|
|
9228
|
+
/* @__PURE__ */ jsx237(GridItem, { colSpan: isFlexible ? void 0 : 2, minW: 0, children: term }),
|
|
9229
|
+
/* @__PURE__ */ jsx237(GridItem, { colSpan: isFlexible ? void 0 : 3, minW: 0, children: definition })
|
|
9230
|
+
]
|
|
9231
|
+
}
|
|
9232
|
+
);
|
|
9233
|
+
}
|
|
9234
|
+
return /* @__PURE__ */ jsxs25(HStack, { gap: "2xs", align: "baseline", children: [
|
|
9235
|
+
/* @__PURE__ */ jsx237(Box, { flex: isFlexible ? "0 1 auto" : "1 1 0", minW: 0, children: term }),
|
|
9236
|
+
/* @__PURE__ */ jsx237(Box, { flex: "1 1 0", minW: 0, children: definition })
|
|
9237
|
+
] });
|
|
9238
|
+
}
|
|
7733
9239
|
export {
|
|
7734
9240
|
AVATAR_IMAGES,
|
|
7735
9241
|
AddFilled,
|
|
@@ -7781,6 +9287,8 @@ export {
|
|
|
7781
9287
|
CheckSmallFilled,
|
|
7782
9288
|
CheckSmallOutline,
|
|
7783
9289
|
Checkbox,
|
|
9290
|
+
CheckboxGroup,
|
|
9291
|
+
CheckboxGroupContext,
|
|
7784
9292
|
ChevronDownFilled,
|
|
7785
9293
|
ChevronDownOutline,
|
|
7786
9294
|
ChevronDownSmallFilled,
|
|
@@ -7824,6 +9332,7 @@ export {
|
|
|
7824
9332
|
CreditCardFilled,
|
|
7825
9333
|
CreditCardOutline,
|
|
7826
9334
|
CustomScrollbar,
|
|
9335
|
+
DataList,
|
|
7827
9336
|
DayFilled,
|
|
7828
9337
|
DayOutline,
|
|
7829
9338
|
Divider,
|
|
@@ -7835,6 +9344,7 @@ export {
|
|
|
7835
9344
|
DraftOutline,
|
|
7836
9345
|
DuplicateFilled,
|
|
7837
9346
|
DuplicateOutline,
|
|
9347
|
+
Empty,
|
|
7838
9348
|
ExitFilled,
|
|
7839
9349
|
ExitOutline,
|
|
7840
9350
|
EyeDropperFilled,
|
|
@@ -7843,6 +9353,7 @@ export {
|
|
|
7843
9353
|
EyeOffFilled,
|
|
7844
9354
|
EyeOffOutline,
|
|
7845
9355
|
EyeOutline,
|
|
9356
|
+
Fieldset,
|
|
7846
9357
|
Flex,
|
|
7847
9358
|
FolderFilled,
|
|
7848
9359
|
FolderOutline,
|
|
@@ -7884,10 +9395,13 @@ export {
|
|
|
7884
9395
|
MoreVerticalOutline,
|
|
7885
9396
|
MusicNoteFilled,
|
|
7886
9397
|
MusicNoteOutline,
|
|
9398
|
+
NumberField,
|
|
9399
|
+
OTP,
|
|
7887
9400
|
OpenWithFilled,
|
|
7888
9401
|
OpenWithOutline,
|
|
7889
9402
|
OptionFilled,
|
|
7890
9403
|
OptionOutline,
|
|
9404
|
+
PIN,
|
|
7891
9405
|
PenFilled,
|
|
7892
9406
|
PenOutline,
|
|
7893
9407
|
PersonalBookFilled,
|
|
@@ -7899,11 +9413,14 @@ export {
|
|
|
7899
9413
|
Portal,
|
|
7900
9414
|
Radio,
|
|
7901
9415
|
RadioFilled,
|
|
9416
|
+
RadioGroup,
|
|
7902
9417
|
RadioOutline,
|
|
7903
9418
|
RainFilled,
|
|
7904
9419
|
RainOutline,
|
|
9420
|
+
Rating,
|
|
7905
9421
|
RectangleFilled,
|
|
7906
9422
|
RectangleOutline,
|
|
9423
|
+
Result,
|
|
7907
9424
|
RouterFilled,
|
|
7908
9425
|
RouterOutline,
|
|
7909
9426
|
ScheduleFilled,
|