@payfit/unity-components 0.0.0-alpha.12 → 0.0.0-alpha.13
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/cjs/components/button/Button.d.cts +5 -2
- package/dist/cjs/components/checkbox/Checkbox.variants.cjs +1 -1
- package/dist/cjs/components/data-table/DataTable.cjs +1 -1
- package/dist/cjs/components/data-table/DataTable.d.cts +3 -6
- package/dist/cjs/components/date-calendar/DateCalendar.cjs +1 -0
- package/dist/cjs/components/date-calendar/DateCalendar.d.cts +23 -0
- package/dist/cjs/components/date-calendar/hooks/useMonthsList.d.cts +4 -0
- package/dist/cjs/components/date-calendar/hooks/useYearsList.d.cts +10 -0
- package/dist/cjs/components/date-picker/DatePicker.cjs +1 -1
- package/dist/cjs/components/date-picker/DatePicker.d.cts +3 -3
- package/dist/cjs/components/definition-tooltip/DefinitionTooltip.cjs +1 -0
- package/dist/cjs/components/definition-tooltip/DefinitionTooltip.d.cts +23 -0
- package/dist/cjs/components/dialog/parts/DialogActions/DialogButton.cjs +1 -1
- package/dist/cjs/components/dialog/parts/DialogActions/DialogButton.d.cts +2 -2
- package/dist/cjs/components/icon-button/CircularIconButton.cjs +1 -1
- package/dist/cjs/components/icon-button/CircularIconButton.d.cts +0 -21
- package/dist/cjs/components/icon-button/IconButton.d.cts +1 -1
- package/dist/cjs/components/number-field/NumberField.cjs +1 -0
- package/dist/cjs/components/number-field/NumberField.d.cts +47 -0
- package/dist/cjs/components/number-input/NumberInput.cjs +1 -0
- package/dist/cjs/components/number-input/NumberInput.d.cts +216 -0
- package/dist/cjs/components/pagination/Pagination.cjs +1 -1
- package/dist/cjs/components/pagination/hooks/use-pagination.cjs +1 -1
- package/dist/cjs/components/pagination/hooks/use-pagination.d.cts +2 -1
- package/dist/cjs/components/popover/Popover.cjs +1 -1
- package/dist/cjs/components/popover/parts/PopoverHeader.cjs +1 -1
- package/dist/cjs/components/radio-button-group/parts/RadioButton.cjs +1 -1
- package/dist/cjs/components/select-field/test-utils.cjs +1 -0
- package/dist/cjs/components/selectable-button-group/SelectableButtonGroup.cjs +1 -1
- package/dist/cjs/components/selectable-button-group/SelectableButtonGroup.context.d.cts +5 -1
- package/dist/cjs/components/selectable-button-group/SelectableButtonGroup.d.cts +7 -1
- package/dist/cjs/components/selectable-button-group/parts/SelectableButton.cjs +1 -1
- package/dist/cjs/components/selectable-button-group/parts/SelectableButton.d.cts +35 -0
- package/dist/cjs/components/selectable-button-group-field/SelectableButtonGroupField.cjs +1 -0
- package/dist/cjs/components/selectable-button-group-field/SelectableButtonGroupField.d.cts +59 -0
- package/dist/cjs/components/side-panel/SidePanel.cjs +1 -1
- package/dist/cjs/components/side-panel/SidePanel.d.cts +6 -0
- package/dist/cjs/components/table/Table.cjs +1 -1
- package/dist/cjs/components/table/Table.d.cts +4 -0
- package/dist/cjs/components/table/parts/TableCell.cjs +1 -1
- package/dist/cjs/components/tabs/parts/NavigationButton.cjs +1 -1
- package/dist/cjs/components/tabs/parts/TabList.cjs +1 -1
- package/dist/cjs/components/text/Text.cjs +1 -1
- package/dist/cjs/components/text/Text.d.cts +1 -1
- package/dist/cjs/components/text/Text.variants.cjs +1 -1
- package/dist/cjs/components/text/Text.variants.d.cts +7 -0
- package/dist/cjs/components/tooltip/Tooltip.cjs +1 -1
- package/dist/cjs/components/tooltip/Tooltip.d.cts +4 -3
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.d.cts +5 -0
- package/dist/cjs/index.storybook-testing.d.cts +1 -0
- package/dist/cjs/storybook-testing.cjs +1 -1
- package/dist/esm/components/button/Button.d.ts +5 -2
- package/dist/esm/components/checkbox/Checkbox.variants.js +4 -4
- package/dist/esm/components/data-table/DataTable.d.ts +3 -6
- package/dist/esm/components/data-table/DataTable.js +61 -56
- package/dist/esm/components/date-calendar/DateCalendar.d.ts +23 -0
- package/dist/esm/components/{date-picker/parts → date-calendar}/DateCalendar.js +62 -60
- package/dist/esm/components/date-calendar/hooks/useMonthsList.d.ts +4 -0
- package/dist/esm/components/date-calendar/hooks/useYearsList.d.ts +10 -0
- package/dist/esm/components/date-picker/DatePicker.d.ts +3 -3
- package/dist/esm/components/date-picker/DatePicker.js +22 -22
- package/dist/esm/components/definition-tooltip/DefinitionTooltip.d.ts +23 -0
- package/dist/esm/components/definition-tooltip/DefinitionTooltip.js +29 -0
- package/dist/esm/components/dialog/parts/DialogActions/DialogButton.d.ts +2 -2
- package/dist/esm/components/dialog/parts/DialogActions/DialogButton.js +31 -27
- package/dist/esm/components/icon-button/CircularIconButton.d.ts +0 -21
- package/dist/esm/components/icon-button/CircularIconButton.js +23 -26
- package/dist/esm/components/icon-button/IconButton.d.ts +1 -1
- package/dist/esm/components/number-field/NumberField.d.ts +47 -0
- package/dist/esm/components/number-field/NumberField.js +71 -0
- package/dist/esm/components/number-input/NumberInput.d.ts +216 -0
- package/dist/esm/components/number-input/NumberInput.js +214 -0
- package/dist/esm/components/pagination/Pagination.js +17 -16
- package/dist/esm/components/pagination/hooks/use-pagination.d.ts +2 -1
- package/dist/esm/components/pagination/hooks/use-pagination.js +12 -11
- package/dist/esm/components/popover/Popover.js +25 -21
- package/dist/esm/components/popover/parts/PopoverHeader.js +17 -15
- package/dist/esm/components/radio-button-group/parts/RadioButton.js +1 -1
- package/dist/esm/components/select-field/test-utils.js +25 -0
- package/dist/esm/components/selectable-button-group/SelectableButtonGroup.context.d.ts +5 -1
- package/dist/esm/components/selectable-button-group/SelectableButtonGroup.d.ts +7 -1
- package/dist/esm/components/selectable-button-group/SelectableButtonGroup.js +23 -16
- package/dist/esm/components/selectable-button-group/parts/SelectableButton.d.ts +35 -0
- package/dist/esm/components/selectable-button-group/parts/SelectableButton.js +44 -36
- package/dist/esm/components/selectable-button-group-field/SelectableButtonGroupField.d.ts +59 -0
- package/dist/esm/components/selectable-button-group-field/SelectableButtonGroupField.js +45 -0
- package/dist/esm/components/side-panel/SidePanel.d.ts +6 -0
- package/dist/esm/components/side-panel/SidePanel.js +38 -35
- package/dist/esm/components/table/Table.d.ts +4 -0
- package/dist/esm/components/table/Table.js +96 -71
- package/dist/esm/components/table/parts/TableCell.js +5 -5
- package/dist/esm/components/tabs/parts/NavigationButton.js +4 -4
- package/dist/esm/components/tabs/parts/TabList.js +44 -35
- package/dist/esm/components/text/Text.d.ts +1 -1
- package/dist/esm/components/text/Text.js +6 -5
- package/dist/esm/components/text/Text.variants.d.ts +7 -0
- package/dist/esm/components/text/Text.variants.js +2 -1
- package/dist/esm/components/tooltip/Tooltip.d.ts +4 -3
- package/dist/esm/components/tooltip/Tooltip.js +13 -12
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.js +237 -225
- package/dist/esm/index.storybook-testing.d.ts +1 -0
- package/dist/esm/storybook-testing.js +3 -1
- package/i18n/en-GB.json +2 -0
- package/i18n/es-ES.json +2 -0
- package/i18n/fr-FR.json +2 -0
- package/package.json +7 -6
- package/dist/cjs/components/date-picker/parts/DateCalendar.cjs +0 -1
- package/dist/cjs/components/date-picker/parts/DateCalendar.d.cts +0 -9
- package/dist/cjs/components/popover/parts/PopoverContent.cjs +0 -1
- package/dist/esm/components/date-picker/parts/DateCalendar.d.ts +0 -9
- package/dist/esm/components/popover/parts/PopoverContent.js +0 -9
- /package/dist/cjs/components/{date-picker → date-calendar}/hooks/useMonthsList.cjs +0 -0
- /package/dist/cjs/components/{date-picker → date-calendar}/hooks/useYearsList.cjs +0 -0
- /package/dist/cjs/components/{date-picker → date-calendar}/parts/DateSegmentSelect.cjs +0 -0
- /package/dist/cjs/components/{date-picker → date-calendar}/parts/DateSegmentSelect.d.cts +0 -0
- /package/dist/esm/components/{date-picker → date-calendar}/hooks/useMonthsList.js +0 -0
- /package/dist/esm/components/{date-picker → date-calendar}/hooks/useYearsList.js +0 -0
- /package/dist/esm/components/{date-picker → date-calendar}/parts/DateSegmentSelect.d.ts +0 -0
- /package/dist/esm/components/{date-picker → date-calendar}/parts/DateSegmentSelect.js +0 -0
|
@@ -10,6 +10,11 @@ export declare const selectableButton: import('tailwind-variants').TVReturnType<
|
|
|
10
10
|
base: string;
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
|
+
isInvalid: {
|
|
14
|
+
true: {
|
|
15
|
+
base: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
13
18
|
}, {
|
|
14
19
|
base: string[];
|
|
15
20
|
icon: string[];
|
|
@@ -23,6 +28,11 @@ export declare const selectableButton: import('tailwind-variants').TVReturnType<
|
|
|
23
28
|
base: string;
|
|
24
29
|
};
|
|
25
30
|
};
|
|
31
|
+
isInvalid: {
|
|
32
|
+
true: {
|
|
33
|
+
base: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
26
36
|
}, {
|
|
27
37
|
hasIcon: {
|
|
28
38
|
true: {
|
|
@@ -32,6 +42,11 @@ export declare const selectableButton: import('tailwind-variants').TVReturnType<
|
|
|
32
42
|
base: string;
|
|
33
43
|
};
|
|
34
44
|
};
|
|
45
|
+
isInvalid: {
|
|
46
|
+
true: {
|
|
47
|
+
base: string;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
35
50
|
}>, {
|
|
36
51
|
hasIcon: {
|
|
37
52
|
true: {
|
|
@@ -41,6 +56,11 @@ export declare const selectableButton: import('tailwind-variants').TVReturnType<
|
|
|
41
56
|
base: string;
|
|
42
57
|
};
|
|
43
58
|
};
|
|
59
|
+
isInvalid: {
|
|
60
|
+
true: {
|
|
61
|
+
base: string;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
44
64
|
}, {
|
|
45
65
|
base: string[];
|
|
46
66
|
icon: string[];
|
|
@@ -54,6 +74,11 @@ export declare const selectableButton: import('tailwind-variants').TVReturnType<
|
|
|
54
74
|
base: string;
|
|
55
75
|
};
|
|
56
76
|
};
|
|
77
|
+
isInvalid: {
|
|
78
|
+
true: {
|
|
79
|
+
base: string;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
57
82
|
}, {
|
|
58
83
|
base: string[];
|
|
59
84
|
icon: string[];
|
|
@@ -67,6 +92,11 @@ export declare const selectableButton: import('tailwind-variants').TVReturnType<
|
|
|
67
92
|
base: string;
|
|
68
93
|
};
|
|
69
94
|
};
|
|
95
|
+
isInvalid: {
|
|
96
|
+
true: {
|
|
97
|
+
base: string;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
70
100
|
}, {
|
|
71
101
|
hasIcon: {
|
|
72
102
|
true: {
|
|
@@ -76,6 +106,11 @@ export declare const selectableButton: import('tailwind-variants').TVReturnType<
|
|
|
76
106
|
base: string;
|
|
77
107
|
};
|
|
78
108
|
};
|
|
109
|
+
isInvalid: {
|
|
110
|
+
true: {
|
|
111
|
+
base: string;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
79
114
|
}>, unknown, unknown, undefined>>;
|
|
80
115
|
type IconName<T extends string> = T extends `${infer Base}${'Filled' | 'Outlined'}` ? Base : T;
|
|
81
116
|
export interface SelectableButtonProps extends Omit<AriaToggleButtonProps, 'id' | 'className' | 'style'> {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { useToggleButtonGroupItem as
|
|
4
|
-
import { tv as
|
|
5
|
-
import { Icon as
|
|
6
|
-
import { Spinner as
|
|
7
|
-
import { SelectableButtonGroupContext as
|
|
8
|
-
const
|
|
1
|
+
import { jsxs as n, jsx as o, Fragment as h } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as x, useRef as I, useContext as w } from "react";
|
|
3
|
+
import { useToggleButtonGroupItem as B, mergeProps as S } from "react-aria";
|
|
4
|
+
import { tv as N } from "tailwind-variants";
|
|
5
|
+
import { Icon as G } from "../../icon/Icon.js";
|
|
6
|
+
import { Spinner as P } from "../../spinner/Spinner.js";
|
|
7
|
+
import { SelectableButtonGroupContext as R } from "../SelectableButtonGroup.context.js";
|
|
8
|
+
const j = N({
|
|
9
9
|
// add the component styles
|
|
10
10
|
slots: {
|
|
11
11
|
base: [
|
|
@@ -37,63 +37,71 @@ const P = I({
|
|
|
37
37
|
false: {
|
|
38
38
|
base: "uy-px-200"
|
|
39
39
|
}
|
|
40
|
+
},
|
|
41
|
+
isInvalid: {
|
|
42
|
+
true: {
|
|
43
|
+
base: "uy-bg-surface-form-error uy-border-border-form-error"
|
|
44
|
+
}
|
|
40
45
|
}
|
|
41
46
|
},
|
|
42
47
|
defaultVariants: {
|
|
43
|
-
hasIcon: !1
|
|
48
|
+
hasIcon: !1,
|
|
49
|
+
isInvalid: !1
|
|
44
50
|
}
|
|
45
|
-
}),
|
|
46
|
-
(t,
|
|
47
|
-
const s =
|
|
51
|
+
}), z = x(
|
|
52
|
+
(t, c) => {
|
|
53
|
+
const s = I(null), a = w(R);
|
|
48
54
|
if (!a)
|
|
49
55
|
throw new Error(
|
|
50
56
|
"SelectableButton must be used within a ToggleButtonGroup component"
|
|
51
57
|
);
|
|
52
|
-
const {
|
|
58
|
+
const { state: b, isInvalid: d } = a, { buttonProps: u, isPressed: f, isSelected: l } = B(
|
|
53
59
|
{ id: t.value, ...t },
|
|
54
|
-
|
|
60
|
+
b,
|
|
55
61
|
s
|
|
56
|
-
), { ref:
|
|
57
|
-
isDisabled:
|
|
62
|
+
), { ref: y } = S({ ref: s }, { ref: c }), {
|
|
63
|
+
isDisabled: m = !1,
|
|
58
64
|
isLoading: e = !1,
|
|
59
65
|
prefixIcon: r,
|
|
60
|
-
children:
|
|
61
|
-
} = t, { base:
|
|
62
|
-
hasIcon: !!r && !e
|
|
66
|
+
children: i
|
|
67
|
+
} = t, { base: p, icon: g, label: v } = j({
|
|
68
|
+
hasIcon: !!r && !e,
|
|
69
|
+
isInvalid: !!d
|
|
63
70
|
});
|
|
64
|
-
return /* @__PURE__ */
|
|
71
|
+
return /* @__PURE__ */ n(
|
|
65
72
|
"button",
|
|
66
73
|
{
|
|
67
74
|
"data-dd-privacy": "allow",
|
|
68
|
-
...
|
|
69
|
-
ref:
|
|
70
|
-
className:
|
|
71
|
-
disabled:
|
|
75
|
+
...u,
|
|
76
|
+
ref: y,
|
|
77
|
+
className: p(),
|
|
78
|
+
disabled: u.disabled || m || e,
|
|
72
79
|
"data-loading": e ? !0 : void 0,
|
|
73
|
-
"data-pressed":
|
|
74
|
-
"data-selected":
|
|
80
|
+
"data-pressed": f,
|
|
81
|
+
"data-selected": l,
|
|
82
|
+
"data-invalid": d,
|
|
75
83
|
"aria-busy": e,
|
|
76
84
|
children: [
|
|
77
85
|
r && !e && /* @__PURE__ */ o(
|
|
78
|
-
|
|
86
|
+
G,
|
|
79
87
|
{
|
|
80
|
-
src:
|
|
88
|
+
src: l ? `${r}Filled` : `${r}Outlined`,
|
|
81
89
|
role: "presentation",
|
|
82
|
-
className:
|
|
90
|
+
className: g(),
|
|
83
91
|
size: 20
|
|
84
92
|
}
|
|
85
93
|
),
|
|
86
|
-
e ? /* @__PURE__ */
|
|
87
|
-
/* @__PURE__ */ o(
|
|
88
|
-
/* @__PURE__ */ o("span", { className: "uy-sr-only", children:
|
|
89
|
-
] }) : /* @__PURE__ */ o("span", { className:
|
|
94
|
+
e ? /* @__PURE__ */ n(h, { children: [
|
|
95
|
+
/* @__PURE__ */ o(P, { label: "Loading", size: "small", color: "inherit" }),
|
|
96
|
+
/* @__PURE__ */ o("span", { className: "uy-sr-only", children: i })
|
|
97
|
+
] }) : /* @__PURE__ */ o("span", { className: v(), children: i })
|
|
90
98
|
]
|
|
91
99
|
}
|
|
92
100
|
);
|
|
93
101
|
}
|
|
94
102
|
);
|
|
95
|
-
|
|
103
|
+
z.displayName = "SelectableButton";
|
|
96
104
|
export {
|
|
97
|
-
|
|
98
|
-
|
|
105
|
+
z as SelectableButton,
|
|
106
|
+
j as selectableButton
|
|
99
107
|
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ForwardedRef, JSX, ReactNode } from 'react';
|
|
2
|
+
import { FieldPath, FieldValues } from 'react-hook-form';
|
|
3
|
+
import { infer as ZodInfer } from 'zod';
|
|
4
|
+
import { Schema } from '../../hooks/use-form.types.js';
|
|
5
|
+
import { SelectableButtonGroupProps } from '../selectable-button-group/SelectableButtonGroup.js';
|
|
6
|
+
import { LabelProps } from '../label/Label.js';
|
|
7
|
+
interface FieldProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> {
|
|
8
|
+
/** The name of the field, which should match the form schema. */
|
|
9
|
+
name: TName;
|
|
10
|
+
/** The label for the field. */
|
|
11
|
+
label: string;
|
|
12
|
+
/** The required variant for the label. */
|
|
13
|
+
requiredVariant?: LabelProps['requiredVariant'];
|
|
14
|
+
/** Helper text to display below the field. */
|
|
15
|
+
helperText?: ReactNode;
|
|
16
|
+
/** A contextual link to display below the field. */
|
|
17
|
+
contextualLink?: ReactNode;
|
|
18
|
+
/** Whether the checkbox group is disabled. */
|
|
19
|
+
isDisabled?: boolean;
|
|
20
|
+
/** Whether the checkbox group is invalid. */
|
|
21
|
+
isInvalid?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export type SelectableButtonGroupFieldProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = FieldProps<TFieldValues, TName> & Omit<SelectableButtonGroupProps, 'isDisabled' | 'children'> & {
|
|
24
|
+
/** The options to render as SelectableButton children. */
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
};
|
|
27
|
+
type SelectableButtonGroupFieldComponent = (<TSchema extends Schema>(props: SelectableButtonGroupFieldProps<ZodInfer<TSchema>> & {
|
|
28
|
+
ref?: ForwardedRef<HTMLInputElement | HTMLTextAreaElement>;
|
|
29
|
+
}) => JSX.Element) & {
|
|
30
|
+
displayName?: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* The `SelectableButtonGroupField` component integrates the SelectableButtonGroup with Unity's form system, providing validation, accessibility, and helper/feedback text.
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* const schema = z.object({
|
|
37
|
+
* choice: z.string()
|
|
38
|
+
* })
|
|
39
|
+
*
|
|
40
|
+
* function MyForm() {
|
|
41
|
+
* const { Form } = useUnityForm(schema)
|
|
42
|
+
*
|
|
43
|
+
* return (
|
|
44
|
+
* <Form action={handleSubmit}>
|
|
45
|
+
* <SelectableButtonGroupField<typeof schema>
|
|
46
|
+
* name="choice"
|
|
47
|
+
* label="Choose an option"
|
|
48
|
+
* >
|
|
49
|
+
* <SelectableButton value="a">A</SelectableButton>
|
|
50
|
+
* <SelectableButton value="b">B</SelectableButton>
|
|
51
|
+
* </SelectableButtonGroupField>
|
|
52
|
+
* </Form>
|
|
53
|
+
* )
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
* @note The schema type parameter is needed to ensure type safety with the form's schema. If you omit it, the `name` prop will not be type-safe.
|
|
57
|
+
*/
|
|
58
|
+
declare const SelectableButtonGroupField: SelectableButtonGroupFieldComponent;
|
|
59
|
+
export { SelectableButtonGroupField };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsxs as d, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as F } from "react";
|
|
3
|
+
import { useFormContext as s } from "react-hook-form";
|
|
4
|
+
import { FormField as b } from "../form-field/FormField.js";
|
|
5
|
+
import { FormControl as x } from "../form-field/parts/FormControl.js";
|
|
6
|
+
import { FormFeedbackText as B } from "../form-field/parts/FormFeedbackText.js";
|
|
7
|
+
import { FormHelperText as G } from "../form-field/parts/FormHelperText.js";
|
|
8
|
+
import { FormLabel as S } from "../form-field/parts/FormLabel.js";
|
|
9
|
+
import { SelectableButtonGroup as h } from "../selectable-button-group/SelectableButtonGroup.js";
|
|
10
|
+
function y({
|
|
11
|
+
name: t,
|
|
12
|
+
label: e,
|
|
13
|
+
helperText: r,
|
|
14
|
+
contextualLink: m,
|
|
15
|
+
isDisabled: l,
|
|
16
|
+
requiredVariant: i,
|
|
17
|
+
children: n,
|
|
18
|
+
...c
|
|
19
|
+
}, p) {
|
|
20
|
+
const { control: u, watch: a } = s(), f = a(t);
|
|
21
|
+
return /* @__PURE__ */ d(b, { control: u, name: t, ref: p, children: [
|
|
22
|
+
/* @__PURE__ */ o(S, { requiredVariant: i, children: e }),
|
|
23
|
+
r && /* @__PURE__ */ o(G, { children: r }),
|
|
24
|
+
/* @__PURE__ */ o(x, { className: "uy-my-50", children: /* @__PURE__ */ o(
|
|
25
|
+
h,
|
|
26
|
+
{
|
|
27
|
+
value: f,
|
|
28
|
+
isDisabled: l,
|
|
29
|
+
...c,
|
|
30
|
+
children: n
|
|
31
|
+
}
|
|
32
|
+
) }),
|
|
33
|
+
/* @__PURE__ */ o(B, {}),
|
|
34
|
+
m
|
|
35
|
+
] });
|
|
36
|
+
}
|
|
37
|
+
const j = F(
|
|
38
|
+
function(e, r) {
|
|
39
|
+
return y(e, r);
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
j.displayName = "SelectableButtonGroupField";
|
|
43
|
+
export {
|
|
44
|
+
j as SelectableButtonGroupField
|
|
45
|
+
};
|
|
@@ -80,6 +80,12 @@ export interface SidePanelProps extends PropsWithChildren<VariantProps<typeof si
|
|
|
80
80
|
* Required when using controlled mode with `isOpen`.
|
|
81
81
|
*/
|
|
82
82
|
onOpenChange?: (isOpen: boolean) => void;
|
|
83
|
+
/**
|
|
84
|
+
* If true, scroll locking will be disabled, allowing background scrolling while the panel is open.
|
|
85
|
+
* **Requires** controlled mode with `isOpen`/`onOpenChange`.
|
|
86
|
+
* @default false
|
|
87
|
+
*/
|
|
88
|
+
disableScrollLocking?: boolean;
|
|
83
89
|
}
|
|
84
90
|
/**
|
|
85
91
|
* The SidePanel component provides contextual space for supplementary content without fully
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { ModalOverlay as
|
|
4
|
-
import { tv as
|
|
5
|
-
import { SidePanelDragIndicator as
|
|
6
|
-
const
|
|
1
|
+
import { jsx as t, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as c, useEffect as g } from "react";
|
|
3
|
+
import { ModalOverlay as x, Modal as h, Dialog as v } from "react-aria-components";
|
|
4
|
+
import { tv as w } from "tailwind-variants";
|
|
5
|
+
import { SidePanelDragIndicator as p } from "./parts/SidePanelDragIndicator.js";
|
|
6
|
+
const N = w({
|
|
7
7
|
slots: {
|
|
8
8
|
overlay: [
|
|
9
9
|
"md:uy-bg-gradient-to-r md:uy-from-grayscale-L12/0 md:uy-to-grayscale-L12/10 md:uy-from-70% md:uy-via-100%",
|
|
10
|
-
"uy-fixed uy-inset-0 uy-isolate",
|
|
10
|
+
"uy-fixed uy-inset-0 uy-isolate uy-z-10",
|
|
11
11
|
"data-[entering]:uy-animate-fade-in data-[exiting]:uy-animate-fade-out"
|
|
12
12
|
],
|
|
13
13
|
wrapper: [
|
|
14
14
|
"uy-w-full md:uy-w-[400px]",
|
|
15
|
-
"uy-fixed uy-bottom-0 md:uy-inset-y-200 md:uy-right-200
|
|
15
|
+
"uy-fixed uy-bottom-0 md:uy-inset-y-200 md:uy-right-200",
|
|
16
16
|
"uy-bg-surface-neutral uy-rounded-t-200 md:uy-rounded-200 uy-shadow-flying",
|
|
17
17
|
"uy-flex uy-flex-col uy-h-[95svh] md:uy-max-h-[calc(100vh-2rem)]",
|
|
18
18
|
"uy-overflow-hidden",
|
|
@@ -22,37 +22,40 @@ const v = x({
|
|
|
22
22
|
"uy-flex uy-flex-col uy-h-full uy-overflow-hidden uy-outline-none"
|
|
23
23
|
]
|
|
24
24
|
}
|
|
25
|
-
}),
|
|
25
|
+
}), P = c(
|
|
26
26
|
({
|
|
27
|
-
children:
|
|
28
|
-
isOpen:
|
|
29
|
-
onOpenChange:
|
|
30
|
-
defaultOpen:
|
|
31
|
-
isDismissable:
|
|
32
|
-
isKeyboardDismissDisabled:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
children: o,
|
|
28
|
+
isOpen: e,
|
|
29
|
+
onOpenChange: u,
|
|
30
|
+
defaultOpen: a,
|
|
31
|
+
isDismissable: i = !0,
|
|
32
|
+
isKeyboardDismissDisabled: r = !1,
|
|
33
|
+
disableScrollLocking: d = !1,
|
|
34
|
+
...y
|
|
35
|
+
}, n) => {
|
|
36
|
+
const { overlay: l, wrapper: m, content: f } = N();
|
|
37
|
+
return g(() => {
|
|
38
|
+
d && (e ?? a) && (document.documentElement.style.overflow = "", document.body.style.overflow = "");
|
|
39
|
+
}, [d, e, a]), /* @__PURE__ */ t(
|
|
40
|
+
x,
|
|
38
41
|
{
|
|
39
|
-
className:
|
|
40
|
-
isOpen:
|
|
41
|
-
onOpenChange:
|
|
42
|
-
defaultOpen:
|
|
43
|
-
isDismissable:
|
|
44
|
-
isKeyboardDismissDisabled:
|
|
42
|
+
className: l(),
|
|
43
|
+
isOpen: e,
|
|
44
|
+
onOpenChange: u,
|
|
45
|
+
defaultOpen: a,
|
|
46
|
+
isDismissable: i,
|
|
47
|
+
isKeyboardDismissDisabled: r,
|
|
45
48
|
children: /* @__PURE__ */ s(
|
|
46
|
-
|
|
49
|
+
h,
|
|
47
50
|
{
|
|
48
51
|
"data-dd-privacy": "allow",
|
|
49
|
-
...
|
|
50
|
-
ref:
|
|
51
|
-
className:
|
|
52
|
+
...y,
|
|
53
|
+
ref: n,
|
|
54
|
+
className: m(),
|
|
52
55
|
"data-unity-side-panel": !0,
|
|
53
56
|
children: [
|
|
54
|
-
/* @__PURE__ */
|
|
55
|
-
/* @__PURE__ */
|
|
57
|
+
/* @__PURE__ */ t(p, {}),
|
|
58
|
+
/* @__PURE__ */ t(v, { className: f(), children: o })
|
|
56
59
|
]
|
|
57
60
|
}
|
|
58
61
|
)
|
|
@@ -60,8 +63,8 @@ const v = x({
|
|
|
60
63
|
);
|
|
61
64
|
}
|
|
62
65
|
);
|
|
63
|
-
|
|
66
|
+
P.displayName = "SidePanel";
|
|
64
67
|
export {
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
P as SidePanel,
|
|
69
|
+
N as sidePanel
|
|
67
70
|
};
|
|
@@ -44,6 +44,10 @@ export interface TableProps extends React.HTMLAttributes<HTMLTableElement> {
|
|
|
44
44
|
* ```
|
|
45
45
|
*/
|
|
46
46
|
description?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Enables horizontal scrolling if the table overflows its container. Enabled by default.
|
|
49
|
+
*/
|
|
50
|
+
isHorizontalScrollEnabled?: boolean;
|
|
47
51
|
}
|
|
48
52
|
export interface TableImperativeHandler {
|
|
49
53
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
2
|
-
import r, { forwardRef as
|
|
3
|
-
import { tv as
|
|
4
|
-
import { useResizeObserver as
|
|
5
|
-
import { TableContextProvider as
|
|
6
|
-
const
|
|
1
|
+
import { jsx as i, jsxs as R } from "react/jsx-runtime";
|
|
2
|
+
import r, { forwardRef as N, useRef as k, useMemo as z, useImperativeHandle as S, useCallback as V } from "react";
|
|
3
|
+
import { tv as E } from "tailwind-variants";
|
|
4
|
+
import { useResizeObserver as $ } from "usehooks-ts";
|
|
5
|
+
import { TableContextProvider as D, useTableContext as M } from "./Table.context.js";
|
|
6
|
+
const P = E({
|
|
7
7
|
slots: {
|
|
8
8
|
root: "uy-w-full uy-border uy-border-solid uy-border-border-neutral-enabled uy-rounded-100 uy-overflow-hidden",
|
|
9
9
|
scroller: [
|
|
@@ -13,10 +13,10 @@ const j = N({
|
|
|
13
13
|
// Ensure full width
|
|
14
14
|
]
|
|
15
15
|
}
|
|
16
|
-
}),
|
|
17
|
-
({ minRows: u = 10, maxRows: c = 50, children: e },
|
|
18
|
-
const { root:
|
|
19
|
-
return /* @__PURE__ */ i("div", { ref:
|
|
16
|
+
}), j = N(
|
|
17
|
+
({ minRows: u = 10, maxRows: c = 50, children: e }, l) => {
|
|
18
|
+
const { root: t, scroller: d } = P();
|
|
19
|
+
return /* @__PURE__ */ i("div", { ref: l, className: t(), "data-unity-slot": "table-root", children: /* @__PURE__ */ i(
|
|
20
20
|
"div",
|
|
21
21
|
{
|
|
22
22
|
className: d(),
|
|
@@ -30,107 +30,132 @@ const j = N({
|
|
|
30
30
|
) });
|
|
31
31
|
}
|
|
32
32
|
);
|
|
33
|
-
|
|
34
|
-
const
|
|
33
|
+
j.displayName = "TableRoot";
|
|
34
|
+
const A = E({
|
|
35
35
|
slots: {
|
|
36
36
|
wrapper: [
|
|
37
37
|
"uy-flex-1 uy-h-full uy-bg-surface-neutral",
|
|
38
|
-
"uy-overflow-auto",
|
|
38
|
+
"uy-overflow-y-auto",
|
|
39
|
+
// Always enable vertical scrolling
|
|
39
40
|
"uy-w-full"
|
|
40
41
|
],
|
|
41
42
|
table: [
|
|
42
43
|
"uy-min-w-full",
|
|
43
|
-
"uy-w-max",
|
|
44
44
|
"uy-text-left uy-typography-body uy-text-content-neutral uy-border-collapse",
|
|
45
45
|
"focus:uy-outline-2 focus:uy-outline-utility-focus-ring focus:uy-outline-offset-[-2px]"
|
|
46
46
|
]
|
|
47
|
+
},
|
|
48
|
+
variants: {
|
|
49
|
+
horizontalScroll: {
|
|
50
|
+
true: {
|
|
51
|
+
wrapper: "uy-overflow-x-auto",
|
|
52
|
+
table: "uy-w-max"
|
|
53
|
+
},
|
|
54
|
+
false: {
|
|
55
|
+
wrapper: "uy-overflow-x-hidden",
|
|
56
|
+
table: "uy-w-fit"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
defaultVariants: {
|
|
61
|
+
horizontalScroll: !0
|
|
47
62
|
}
|
|
48
|
-
}),
|
|
49
|
-
const {
|
|
50
|
-
|
|
63
|
+
}), K = N((u, c) => {
|
|
64
|
+
const {
|
|
65
|
+
children: e,
|
|
66
|
+
label: l,
|
|
67
|
+
description: t,
|
|
68
|
+
isHorizontalScrollEnabled: d = !0,
|
|
69
|
+
...p
|
|
70
|
+
} = u, a = k(null), { height: n = 0 } = $({
|
|
71
|
+
ref: a,
|
|
51
72
|
box: "border-box"
|
|
52
|
-
}), { rowCount:
|
|
53
|
-
let y = 0,
|
|
54
|
-
return r.Children.forEach(e, (
|
|
55
|
-
if (!r.isValidElement(
|
|
73
|
+
}), { rowCount: b, columnCount: f } = z(() => {
|
|
74
|
+
let y = 0, m = 0;
|
|
75
|
+
return r.Children.forEach(e, (h) => {
|
|
76
|
+
if (!r.isValidElement(h)) return;
|
|
56
77
|
const s = r.Children.toArray(
|
|
57
|
-
|
|
58
|
-
).filter((
|
|
59
|
-
|
|
60
|
-
if (!r.isValidElement(
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
).filter((
|
|
64
|
-
y = Math.max(y,
|
|
78
|
+
h.props.children
|
|
79
|
+
).filter((o) => r.isValidElement(o));
|
|
80
|
+
m += s.length, s.forEach((o) => {
|
|
81
|
+
if (!r.isValidElement(o)) return;
|
|
82
|
+
const w = r.Children.toArray(
|
|
83
|
+
o.props.children
|
|
84
|
+
).filter((v) => r.isValidElement(v));
|
|
85
|
+
y = Math.max(y, w.length);
|
|
65
86
|
});
|
|
66
|
-
}), { rowCount:
|
|
87
|
+
}), { rowCount: m, columnCount: y };
|
|
67
88
|
}, [e]);
|
|
68
|
-
return
|
|
89
|
+
return S(c, () => ({
|
|
69
90
|
scrollToTop: () => {
|
|
70
|
-
|
|
91
|
+
a.current && a.current.scrollTo({ top: 0, behavior: "smooth" });
|
|
71
92
|
}
|
|
72
|
-
})), /* @__PURE__ */ i(
|
|
73
|
-
|
|
93
|
+
})), /* @__PURE__ */ i(D, { rowCount: b, columnCount: f, children: /* @__PURE__ */ i(
|
|
94
|
+
H,
|
|
74
95
|
{
|
|
75
|
-
scrollContainerRef:
|
|
76
|
-
containerHeight:
|
|
77
|
-
rowCount:
|
|
78
|
-
columnCount:
|
|
79
|
-
label:
|
|
80
|
-
description:
|
|
81
|
-
|
|
96
|
+
scrollContainerRef: a,
|
|
97
|
+
containerHeight: n,
|
|
98
|
+
rowCount: b,
|
|
99
|
+
columnCount: f,
|
|
100
|
+
label: l,
|
|
101
|
+
description: t,
|
|
102
|
+
isHorizontalScrollEnabled: d,
|
|
103
|
+
...p,
|
|
82
104
|
children: e
|
|
83
105
|
}
|
|
84
106
|
) });
|
|
85
107
|
});
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
var
|
|
108
|
+
K.displayName = "Table";
|
|
109
|
+
const H = (u) => {
|
|
110
|
+
var g, C, T;
|
|
89
111
|
const {
|
|
90
112
|
children: c,
|
|
91
113
|
label: e,
|
|
92
|
-
description:
|
|
93
|
-
scrollContainerRef:
|
|
114
|
+
description: l,
|
|
115
|
+
scrollContainerRef: t,
|
|
94
116
|
containerHeight: d,
|
|
95
|
-
rowCount:
|
|
96
|
-
columnCount:
|
|
97
|
-
onKeyDown:
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
117
|
+
rowCount: p,
|
|
118
|
+
columnCount: a,
|
|
119
|
+
onKeyDown: n,
|
|
120
|
+
isHorizontalScrollEnabled: b = !0,
|
|
121
|
+
...f
|
|
122
|
+
} = u, { wrapper: y, table: m } = A({
|
|
123
|
+
horizontalScroll: b
|
|
124
|
+
}), { keyboardNavigation: h } = M(), { tableRef: s, handleTableKeyDown: o } = h, w = V(
|
|
125
|
+
(x) => {
|
|
126
|
+
x.key !== "Tab" && (o(x), n == null || n(x));
|
|
102
127
|
},
|
|
103
|
-
[
|
|
104
|
-
),
|
|
105
|
-
return /* @__PURE__ */
|
|
128
|
+
[o, n]
|
|
129
|
+
), v = (((g = t.current) == null ? void 0 : g.scrollHeight) ?? 0) > Math.floor(d);
|
|
130
|
+
return /* @__PURE__ */ R(
|
|
106
131
|
"div",
|
|
107
132
|
{
|
|
108
133
|
className: y(),
|
|
109
|
-
ref:
|
|
134
|
+
ref: t,
|
|
110
135
|
style: {
|
|
111
|
-
"--uy-table-is-scrollable":
|
|
136
|
+
"--uy-table-is-scrollable": v ? "1" : "0"
|
|
112
137
|
},
|
|
113
138
|
children: [
|
|
114
|
-
/* @__PURE__ */
|
|
139
|
+
/* @__PURE__ */ R(
|
|
115
140
|
"table",
|
|
116
141
|
{
|
|
117
142
|
ref: s,
|
|
118
|
-
className:
|
|
143
|
+
className: m(),
|
|
119
144
|
role: "grid",
|
|
120
|
-
"aria-rowcount":
|
|
121
|
-
"aria-colcount":
|
|
145
|
+
"aria-rowcount": p,
|
|
146
|
+
"aria-colcount": a,
|
|
122
147
|
"aria-label": e,
|
|
123
|
-
"aria-describedby":
|
|
124
|
-
onKeyDown:
|
|
125
|
-
...
|
|
148
|
+
"aria-describedby": l ? `table-desc-${(C = s.current) == null ? void 0 : C.id}` : void 0,
|
|
149
|
+
onKeyDown: w,
|
|
150
|
+
...f,
|
|
126
151
|
children: [
|
|
127
152
|
c,
|
|
128
|
-
|
|
153
|
+
l && /* @__PURE__ */ i(
|
|
129
154
|
"caption",
|
|
130
155
|
{
|
|
131
|
-
id: `table-desc-${(
|
|
156
|
+
id: `table-desc-${(T = s.current) == null ? void 0 : T.id}`,
|
|
132
157
|
className: "uy-sr-only",
|
|
133
|
-
children:
|
|
158
|
+
children: l
|
|
134
159
|
}
|
|
135
160
|
)
|
|
136
161
|
]
|
|
@@ -141,8 +166,8 @@ const E = (u) => {
|
|
|
141
166
|
}
|
|
142
167
|
);
|
|
143
168
|
};
|
|
144
|
-
|
|
169
|
+
H.displayName = "TableContent";
|
|
145
170
|
export {
|
|
146
|
-
|
|
147
|
-
|
|
171
|
+
K as Table,
|
|
172
|
+
j as TableRoot
|
|
148
173
|
};
|