@payfit/unity-components 0.0.0-alpha.11 → 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.cjs +1 -1
- package/dist/cjs/components/checkbox/Checkbox.variants.cjs +1 -1
- package/dist/cjs/components/checkbox/parts/CheckboxIndicator.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/date-picker-field/test-utils.cjs +1 -0
- package/dist/cjs/components/date-picker-field/test-utils.d.cts +12 -0
- 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/select-field/test-utils.d.cts +11 -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/toggle-switch/ToggleSwitch.cjs +1 -1
- package/dist/cjs/components/toggle-switch/ToggleSwitch.d.cts +71 -49
- package/dist/cjs/components/toggle-switch-field/ToggleSwitchField.cjs +1 -1
- package/dist/cjs/components/toggle-switch-field/ToggleSwitchField.d.cts +2 -7
- 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 +2 -0
- package/dist/cjs/storybook-testing.cjs +1 -0
- package/dist/cjs/storybook-utilities/breadcrumbs/transform.d.cts +2 -0
- package/dist/cjs/storybook-utilities/previewTransform.d.cts +1 -0
- package/dist/cjs/types/testing.d.cts +2 -0
- package/dist/esm/components/button/Button.d.ts +5 -2
- package/dist/esm/components/checkbox/Checkbox.js +21 -29
- package/dist/esm/components/checkbox/Checkbox.variants.js +4 -4
- package/dist/esm/components/checkbox/parts/CheckboxIndicator.js +1 -1
- 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/date-picker-field/test-utils.d.ts +12 -0
- package/dist/esm/components/date-picker-field/test-utils.js +35 -0
- 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.d.ts +11 -0
- 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/toggle-switch/ToggleSwitch.d.ts +71 -49
- package/dist/esm/components/toggle-switch/ToggleSwitch.js +50 -29
- package/dist/esm/components/toggle-switch-field/ToggleSwitchField.d.ts +2 -7
- package/dist/esm/components/toggle-switch-field/ToggleSwitchField.js +41 -55
- 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 +2 -0
- package/dist/esm/storybook-testing.js +6 -0
- package/dist/esm/storybook-utilities/breadcrumbs/transform.d.ts +2 -0
- package/dist/esm/storybook-utilities/previewTransform.d.ts +1 -0
- package/dist/esm/types/testing.d.ts +2 -0
- package/i18n/en-GB.json +2 -0
- package/i18n/es-ES.json +2 -0
- package/i18n/fr-FR.json +2 -0
- package/package.json +44 -20
- 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
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsx as h } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as x } from "react";
|
|
3
3
|
import { tv as g } from "tailwind-variants";
|
|
4
4
|
import { useTableContext as v } from "../Table.context.js";
|
|
5
5
|
const C = g({
|
|
6
6
|
base: [
|
|
7
|
-
"uy-px-200 uy-py-150 uy-
|
|
7
|
+
"uy-px-200 uy-py-150 uy-text-content-neutral uy-typography-body",
|
|
8
8
|
"focus-visible:uy-outline-2 focus-visible:-uy-outline-offset-2 focus-visible:uy-outline-utility-focus-ring"
|
|
9
9
|
],
|
|
10
10
|
variants: {
|
|
@@ -14,7 +14,7 @@ const C = g({
|
|
|
14
14
|
right: "uy-text-right"
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
}), T =
|
|
17
|
+
}), T = x(
|
|
18
18
|
({
|
|
19
19
|
children: i,
|
|
20
20
|
colIndex: a = 0,
|
|
@@ -29,7 +29,7 @@ const C = g({
|
|
|
29
29
|
const { keyboardNavigation: c } = v(), { isCellFocused: f, handleCellKeyDown: b, handleCellFocus: d } = c, m = f(o, a), p = (e) => {
|
|
30
30
|
e.key !== "Tab" && (b(e), t == null || t(e));
|
|
31
31
|
};
|
|
32
|
-
return /* @__PURE__ */
|
|
32
|
+
return /* @__PURE__ */ h(
|
|
33
33
|
r ? "th" : "td",
|
|
34
34
|
{
|
|
35
35
|
ref: y,
|
|
@@ -11,14 +11,14 @@ const s = n({
|
|
|
11
11
|
variants: {
|
|
12
12
|
direction: {
|
|
13
13
|
left: {
|
|
14
|
-
base: "uy-top-0 uy-left-0 uy-z-10 uy-bg-gradient-to-r uy-from-surface-inverted/
|
|
14
|
+
base: "uy-top-0 uy-left-0 uy-z-10 uy-bg-gradient-to-r uy-from-surface-inverted/100 uy-to-surface-inverted/0 uy-pl-50 uy-pr-200"
|
|
15
15
|
},
|
|
16
16
|
right: {
|
|
17
|
-
base: "uy-right-0 uy-top-0 uy-z-10 uy-bg-gradient-to-l uy-from-surface-inverted/100 uy-
|
|
17
|
+
base: "uy-right-0 uy-top-0 uy-z-10 uy-bg-gradient-to-l uy-from-surface-inverted/100 uy-to-surface-inverted/0 uy-pl-200 uy-pr-50"
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
}),
|
|
21
|
+
}), v = ({ direction: t, onPress: u }) => {
|
|
22
22
|
const { base: o, button: r, icon: l } = s({ direction: t });
|
|
23
23
|
return /* @__PURE__ */ e("div", { className: o(), children: /* @__PURE__ */ e(
|
|
24
24
|
i,
|
|
@@ -39,5 +39,5 @@ const s = n({
|
|
|
39
39
|
) });
|
|
40
40
|
};
|
|
41
41
|
export {
|
|
42
|
-
|
|
42
|
+
v as NavigationButton
|
|
43
43
|
};
|
|
@@ -1,47 +1,56 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { TabList as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { jsxs as w, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as A, useRef as C, useState as L, useCallback as B } from "react";
|
|
3
|
+
import { TabList as y } from "react-aria-components";
|
|
4
|
+
import { useResizeObserver as j } from "usehooks-ts";
|
|
5
|
+
import { useTabsContext as q } from "../Tabs.context.js";
|
|
6
|
+
import { tabsVariant as z } from "../Tabs.variant.js";
|
|
7
|
+
import { NavigationButton as p } from "./NavigationButton.js";
|
|
8
|
+
const P = A(
|
|
9
|
+
({ children: f }, u) => {
|
|
10
|
+
const r = C(null), [g, S] = L(!1), [v, R] = L(!1), { variant: W, scrollable: b } = q(), { tabList: d } = z({ variant: W, scrollable: b }), m = B(() => {
|
|
11
|
+
if (!r.current) return;
|
|
12
|
+
const { scrollLeft: t, scrollWidth: s, clientWidth: e } = r.current;
|
|
13
|
+
S(t > 0), R(t + e < s);
|
|
14
|
+
}, []);
|
|
15
|
+
j({
|
|
16
|
+
ref: r,
|
|
17
|
+
onResize: m
|
|
18
|
+
});
|
|
19
|
+
const x = (t) => {
|
|
20
|
+
m();
|
|
21
|
+
}, N = () => {
|
|
22
|
+
var l;
|
|
23
|
+
const t = (l = r.current) == null ? void 0 : l.querySelectorAll("[role=tab]");
|
|
15
24
|
if (!r.current || !t) return 0;
|
|
16
|
-
const { scrollLeft:
|
|
17
|
-
for (let
|
|
18
|
-
const n =
|
|
19
|
-
if (n.offsetLeft <
|
|
25
|
+
const { scrollLeft: s } = r.current, e = Array.from(t);
|
|
26
|
+
for (let o = e.length - 1; o >= 0; o--) {
|
|
27
|
+
const n = e[o];
|
|
28
|
+
if (n.offsetLeft < s)
|
|
20
29
|
return -n.offsetWidth;
|
|
21
30
|
}
|
|
22
31
|
return 0;
|
|
23
|
-
},
|
|
32
|
+
}, T = () => {
|
|
24
33
|
var n;
|
|
25
|
-
const t = (n = r.current) == null ? void 0 : n.querySelectorAll("
|
|
34
|
+
const t = (n = r.current) == null ? void 0 : n.querySelectorAll("[role=tab]");
|
|
26
35
|
if (!r.current || !t) return 0;
|
|
27
|
-
const { scrollLeft:
|
|
28
|
-
for (let a = 0; a <
|
|
29
|
-
const i =
|
|
30
|
-
if (
|
|
36
|
+
const { scrollLeft: s, clientWidth: e } = r.current, l = Array.from(t), o = s + e;
|
|
37
|
+
for (let a = 0; a < l.length - 1; a++) {
|
|
38
|
+
const i = l[a], h = i.offsetLeft + i.offsetWidth;
|
|
39
|
+
if (h > o || h < o)
|
|
31
40
|
return i.offsetWidth;
|
|
32
41
|
}
|
|
33
42
|
return 0;
|
|
34
43
|
};
|
|
35
|
-
return
|
|
44
|
+
return b ? /* @__PURE__ */ w("div", { className: "uy-relative", children: [
|
|
36
45
|
g && /* @__PURE__ */ c(
|
|
37
|
-
|
|
46
|
+
p,
|
|
38
47
|
{
|
|
39
48
|
direction: "left",
|
|
40
49
|
onPress: () => {
|
|
41
50
|
var t;
|
|
42
51
|
(t = r.current) == null || t.scrollBy({
|
|
43
52
|
behavior: "smooth",
|
|
44
|
-
left:
|
|
53
|
+
left: N()
|
|
45
54
|
});
|
|
46
55
|
}
|
|
47
56
|
}
|
|
@@ -52,27 +61,27 @@ const C = T(
|
|
|
52
61
|
ref: r,
|
|
53
62
|
"data-testid": "scrollable-tab-list",
|
|
54
63
|
className: "uy-overflow-x-auto uy-overflow-y-hidden uy-border-b-[1.25px] uy-border-solid uy-border-b-border-form-enabled",
|
|
55
|
-
onScroll:
|
|
56
|
-
children: /* @__PURE__ */ c(
|
|
64
|
+
onScroll: x,
|
|
65
|
+
children: /* @__PURE__ */ c(y, { ref: u, className: d(), children: f })
|
|
57
66
|
}
|
|
58
67
|
),
|
|
59
|
-
|
|
60
|
-
|
|
68
|
+
v && /* @__PURE__ */ c(
|
|
69
|
+
p,
|
|
61
70
|
{
|
|
62
71
|
direction: "right",
|
|
63
72
|
onPress: () => {
|
|
64
73
|
var t;
|
|
65
74
|
(t = r.current) == null || t.scrollBy({
|
|
66
75
|
behavior: "smooth",
|
|
67
|
-
left:
|
|
76
|
+
left: T()
|
|
68
77
|
});
|
|
69
78
|
}
|
|
70
79
|
}
|
|
71
80
|
)
|
|
72
|
-
] }) : /* @__PURE__ */ c(
|
|
81
|
+
] }) : /* @__PURE__ */ c(y, { ref: u, className: d(), children: f });
|
|
73
82
|
}
|
|
74
83
|
);
|
|
75
|
-
|
|
84
|
+
P.displayName = "TabList";
|
|
76
85
|
export {
|
|
77
|
-
|
|
86
|
+
P as TabList
|
|
78
87
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HTMLAttributes, PropsWithChildren } from 'react';
|
|
2
2
|
import { VariantProps } from 'tailwind-variants';
|
|
3
3
|
import { text } from './Text.variants.js';
|
|
4
|
-
type ValidTextElements = 'p' | 'span' | 'div' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'em' | 'strong' | 'small';
|
|
4
|
+
export type ValidTextElements = 'p' | 'span' | 'div' | 'abbr' | 'dfn' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'em' | 'strong' | 'small';
|
|
5
5
|
export type TextProps = PropsWithChildren<HTMLAttributes<HTMLSpanElement> & {
|
|
6
6
|
/**
|
|
7
7
|
* The HTML element to render the text as. Defaults to a recommended element based on the variant.
|
|
@@ -19,27 +19,28 @@ const y = {
|
|
|
19
19
|
bodyLargeStrong: "strong",
|
|
20
20
|
action: "span",
|
|
21
21
|
actionLarge: "span",
|
|
22
|
-
actionSmall: "span"
|
|
22
|
+
actionSmall: "span",
|
|
23
|
+
actionInfo: "span"
|
|
23
24
|
}, g = c(
|
|
24
25
|
({
|
|
25
26
|
children: e,
|
|
26
27
|
variant: o,
|
|
27
|
-
color:
|
|
28
|
+
color: n,
|
|
28
29
|
isTruncated: a,
|
|
29
30
|
lineClamp: t,
|
|
30
|
-
asElement:
|
|
31
|
+
asElement: s,
|
|
31
32
|
className: r,
|
|
32
33
|
...l
|
|
33
34
|
}, i) => {
|
|
34
35
|
const m = h({
|
|
35
36
|
variant: o,
|
|
36
|
-
color:
|
|
37
|
+
color: n,
|
|
37
38
|
isTruncated: a,
|
|
38
39
|
isLineClamped: t !== void 0,
|
|
39
40
|
className: r
|
|
40
41
|
}), p = y[o ?? "inherit"];
|
|
41
42
|
return /* @__PURE__ */ d(
|
|
42
|
-
|
|
43
|
+
s ?? p,
|
|
43
44
|
{
|
|
44
45
|
"data-dd-privacy": "mask",
|
|
45
46
|
...l,
|
|
@@ -18,6 +18,7 @@ export declare const text: import('tailwind-variants').TVReturnType<{
|
|
|
18
18
|
action: string;
|
|
19
19
|
actionLarge: string;
|
|
20
20
|
actionSmall: string;
|
|
21
|
+
actionInfo: string;
|
|
21
22
|
};
|
|
22
23
|
color: {
|
|
23
24
|
inherit: string;
|
|
@@ -114,6 +115,7 @@ export declare const text: import('tailwind-variants').TVReturnType<{
|
|
|
114
115
|
action: string;
|
|
115
116
|
actionLarge: string;
|
|
116
117
|
actionSmall: string;
|
|
118
|
+
actionInfo: string;
|
|
117
119
|
};
|
|
118
120
|
color: {
|
|
119
121
|
inherit: string;
|
|
@@ -210,6 +212,7 @@ export declare const text: import('tailwind-variants').TVReturnType<{
|
|
|
210
212
|
action: string;
|
|
211
213
|
actionLarge: string;
|
|
212
214
|
actionSmall: string;
|
|
215
|
+
actionInfo: string;
|
|
213
216
|
};
|
|
214
217
|
color: {
|
|
215
218
|
inherit: string;
|
|
@@ -306,6 +309,7 @@ export declare const text: import('tailwind-variants').TVReturnType<{
|
|
|
306
309
|
action: string;
|
|
307
310
|
actionLarge: string;
|
|
308
311
|
actionSmall: string;
|
|
312
|
+
actionInfo: string;
|
|
309
313
|
};
|
|
310
314
|
color: {
|
|
311
315
|
inherit: string;
|
|
@@ -402,6 +406,7 @@ export declare const text: import('tailwind-variants').TVReturnType<{
|
|
|
402
406
|
action: string;
|
|
403
407
|
actionLarge: string;
|
|
404
408
|
actionSmall: string;
|
|
409
|
+
actionInfo: string;
|
|
405
410
|
};
|
|
406
411
|
color: {
|
|
407
412
|
inherit: string;
|
|
@@ -498,6 +503,7 @@ export declare const text: import('tailwind-variants').TVReturnType<{
|
|
|
498
503
|
action: string;
|
|
499
504
|
actionLarge: string;
|
|
500
505
|
actionSmall: string;
|
|
506
|
+
actionInfo: string;
|
|
501
507
|
};
|
|
502
508
|
color: {
|
|
503
509
|
inherit: string;
|
|
@@ -594,6 +600,7 @@ export declare const text: import('tailwind-variants').TVReturnType<{
|
|
|
594
600
|
action: string;
|
|
595
601
|
actionLarge: string;
|
|
596
602
|
actionSmall: string;
|
|
603
|
+
actionInfo: string;
|
|
597
604
|
};
|
|
598
605
|
color: {
|
|
599
606
|
inherit: string;
|
|
@@ -20,7 +20,8 @@ const n = t({
|
|
|
20
20
|
bodyLargeStrong: "uy-typography-body-large-strong",
|
|
21
21
|
action: "uy-typography-action",
|
|
22
22
|
actionLarge: "uy-typography-body-large",
|
|
23
|
-
actionSmall: "uy-typography-body-small"
|
|
23
|
+
actionSmall: "uy-typography-body-small",
|
|
24
|
+
actionInfo: "uy-typography-action uy-underline uy-decoration-dotted uy-decoration-[10%] uy-underline-offset-[25%]"
|
|
24
25
|
},
|
|
25
26
|
color: {
|
|
26
27
|
inherit: "uy-text-inherit",
|
|
@@ -1,82 +1,104 @@
|
|
|
1
1
|
import { SwitchProps as AriaSwitchProps } from 'react-aria-components';
|
|
2
2
|
import { VariantProps } from 'tailwind-variants';
|
|
3
3
|
export declare const toggleSwitch: import('tailwind-variants').TVReturnType<{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
indicator
|
|
7
|
-
|
|
8
|
-
container?: import('tailwind-merge').ClassNameValue;
|
|
9
|
-
textWrapper?: import('tailwind-merge').ClassNameValue;
|
|
10
|
-
hintText?: import('tailwind-merge').ClassNameValue;
|
|
11
|
-
knob?: import('tailwind-merge').ClassNameValue;
|
|
4
|
+
isDisabled: {
|
|
5
|
+
false: {
|
|
6
|
+
indicator: string;
|
|
7
|
+
knob: string;
|
|
12
8
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
[x: string]: import('tailwind-merge').ClassNameValue | {
|
|
17
|
-
indicator?: import('tailwind-merge').ClassNameValue;
|
|
18
|
-
label?: import('tailwind-merge').ClassNameValue;
|
|
19
|
-
container?: import('tailwind-merge').ClassNameValue;
|
|
20
|
-
textWrapper?: import('tailwind-merge').ClassNameValue;
|
|
21
|
-
hintText?: import('tailwind-merge').ClassNameValue;
|
|
22
|
-
knob?: import('tailwind-merge').ClassNameValue;
|
|
9
|
+
true: {
|
|
10
|
+
indicator: string;
|
|
11
|
+
knob: string;
|
|
23
12
|
};
|
|
24
13
|
};
|
|
25
|
-
}
|
|
14
|
+
}, {
|
|
26
15
|
container: string[];
|
|
27
16
|
textWrapper: string[];
|
|
28
17
|
label: string[];
|
|
29
18
|
hintText: string[];
|
|
30
19
|
indicator: string[];
|
|
31
20
|
knob: string[];
|
|
32
|
-
}, undefined, import('tailwind-variants/dist/config.js').TVConfig<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
indicator
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
knob
|
|
21
|
+
}, undefined, import('tailwind-variants/dist/config.js').TVConfig<{
|
|
22
|
+
isDisabled: {
|
|
23
|
+
false: {
|
|
24
|
+
indicator: string;
|
|
25
|
+
knob: string;
|
|
26
|
+
};
|
|
27
|
+
true: {
|
|
28
|
+
indicator: string;
|
|
29
|
+
knob: string;
|
|
41
30
|
};
|
|
42
31
|
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
indicator
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
knob
|
|
32
|
+
}, {
|
|
33
|
+
isDisabled: {
|
|
34
|
+
false: {
|
|
35
|
+
indicator: string;
|
|
36
|
+
knob: string;
|
|
37
|
+
};
|
|
38
|
+
true: {
|
|
39
|
+
indicator: string;
|
|
40
|
+
knob: string;
|
|
52
41
|
};
|
|
53
42
|
};
|
|
54
|
-
}
|
|
43
|
+
}>, {
|
|
44
|
+
isDisabled: {
|
|
45
|
+
false: {
|
|
46
|
+
indicator: string;
|
|
47
|
+
knob: string;
|
|
48
|
+
};
|
|
49
|
+
true: {
|
|
50
|
+
indicator: string;
|
|
51
|
+
knob: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
}, {
|
|
55
55
|
container: string[];
|
|
56
56
|
textWrapper: string[];
|
|
57
57
|
label: string[];
|
|
58
58
|
hintText: string[];
|
|
59
59
|
indicator: string[];
|
|
60
60
|
knob: string[];
|
|
61
|
-
}, import('tailwind-variants').TVReturnType<
|
|
61
|
+
}, import('tailwind-variants').TVReturnType<{
|
|
62
|
+
isDisabled: {
|
|
63
|
+
false: {
|
|
64
|
+
indicator: string;
|
|
65
|
+
knob: string;
|
|
66
|
+
};
|
|
67
|
+
true: {
|
|
68
|
+
indicator: string;
|
|
69
|
+
knob: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
}, {
|
|
62
73
|
container: string[];
|
|
63
74
|
textWrapper: string[];
|
|
64
75
|
label: string[];
|
|
65
76
|
hintText: string[];
|
|
66
77
|
indicator: string[];
|
|
67
78
|
knob: string[];
|
|
68
|
-
}, undefined, import('tailwind-variants/dist/config.js').TVConfig<
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
indicator
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
knob
|
|
79
|
+
}, undefined, import('tailwind-variants/dist/config.js').TVConfig<{
|
|
80
|
+
isDisabled: {
|
|
81
|
+
false: {
|
|
82
|
+
indicator: string;
|
|
83
|
+
knob: string;
|
|
84
|
+
};
|
|
85
|
+
true: {
|
|
86
|
+
indicator: string;
|
|
87
|
+
knob: string;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
}, {
|
|
91
|
+
isDisabled: {
|
|
92
|
+
false: {
|
|
93
|
+
indicator: string;
|
|
94
|
+
knob: string;
|
|
95
|
+
};
|
|
96
|
+
true: {
|
|
97
|
+
indicator: string;
|
|
98
|
+
knob: string;
|
|
77
99
|
};
|
|
78
100
|
};
|
|
79
|
-
}
|
|
101
|
+
}>, unknown, unknown, undefined>>;
|
|
80
102
|
interface ToggleSwitchProps extends Omit<AriaSwitchProps, 'children' | 'className' | 'style'>, VariantProps<typeof toggleSwitch> {
|
|
81
103
|
/** The label for the toggle switch. */
|
|
82
104
|
label: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as f } from "react";
|
|
3
3
|
import { Switch as g } from "react-aria-components";
|
|
4
|
-
import { tv as
|
|
5
|
-
const
|
|
4
|
+
import { tv as m } from "tailwind-variants";
|
|
5
|
+
const v = m({
|
|
6
6
|
slots: {
|
|
7
7
|
container: ["uy-flex uy-gap-100 uy-group"],
|
|
8
8
|
textWrapper: ["uy-flex uy-flex-col uy-gap-50"],
|
|
@@ -14,7 +14,6 @@ const m = f({
|
|
|
14
14
|
"uy-border uy-border-solid uy-border-border-form-disabled uy-bg-surface-form-disabled",
|
|
15
15
|
"uy-cursor-pointer uy-transition-colors uy-duration-200 uy-ease-in-out",
|
|
16
16
|
"group-data-[pressed]:uy-bg-surface-form-pressed group-data-[pressed]:uy-border-border-form-pressed",
|
|
17
|
-
'group-data-[selected="true"]:uy-bg-surface-form-active group-data-[selected="true"]:uy-border-border-form-active group-data-[selected="true"]:group-data-[pressed]:uy-bg-surface-form-active group-data-[selected="true"]:group-data-[pressed]:uy-border-border-form-active',
|
|
18
17
|
"group-data-[disabled]:uy-bg-surface-form-disabled group-data-[disabled]:uy-border-border-form-disabled group-data-[disabled]:uy-cursor-not-allowed",
|
|
19
18
|
"group-data-[focus-visible]:uy-outline-2 group-data-[focus-visible]:uy-outline group-data-[focus-visible]:uy-outline-offset-2 group-data-[focus-visible]:uy-outline-utility-focus-ring"
|
|
20
19
|
],
|
|
@@ -22,39 +21,61 @@ const m = f({
|
|
|
22
21
|
"uy-w-200 uy-h-200 uy-rounded-circle",
|
|
23
22
|
"uy-border uy-border-solid uy-border-border-form-enabled uy-bg-surface-form-enabled",
|
|
24
23
|
"uy-transition-all uy-duration-200 uy-ease-in-out",
|
|
24
|
+
'group-data-[selected="true"]:uy-translate-x-[90%]',
|
|
25
25
|
"group-data-[pressed]:uy-bg-surface-form-pressed group-data-[pressed]:uy-border-border-form-pressed",
|
|
26
|
-
'group-data-[selected="true"]:uy-translate-x-[90%] group-data-[selected="true"]:uy-border-border-inverted-enabled group-data-[selected="true"]:group-data-[pressed]:uy-bg-surface-form-pressed group-data-[selected="true"]:group-data-[pressed]:uy-border-border-inverted-pressed',
|
|
27
26
|
"group-data-[disabled]:uy-bg-surface-form-disabled group-data-[disabled]:uy-border-border-form-disabled"
|
|
28
27
|
]
|
|
28
|
+
},
|
|
29
|
+
variants: {
|
|
30
|
+
isDisabled: {
|
|
31
|
+
false: {
|
|
32
|
+
indicator: 'group-data-[selected="true"]:uy-bg-surface-form-active group-data-[selected="true"]:uy-border-border-form-active group-data-[selected="true"]:group-data-[pressed]:uy-bg-surface-form-active group-data-[selected="true"]:group-data-[pressed]:uy-border-border-form-active',
|
|
33
|
+
knob: 'group-data-[selected="true"]:uy-border-border-inverted-enabled group-data-[selected="true"]:group-data-[pressed]:uy-bg-surface-form-pressed group-data-[selected="true"]:group-data-[pressed]:uy-border-border-inverted-pressed'
|
|
34
|
+
},
|
|
35
|
+
true: {
|
|
36
|
+
indicator: "",
|
|
37
|
+
knob: ""
|
|
38
|
+
}
|
|
39
|
+
}
|
|
29
40
|
}
|
|
30
|
-
}), h =
|
|
41
|
+
}), h = f(
|
|
31
42
|
({
|
|
32
|
-
label:
|
|
43
|
+
label: d,
|
|
33
44
|
helperText: r,
|
|
34
|
-
isLabelSrOnly:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
children:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
isLabelSrOnly: u = !1,
|
|
46
|
+
isDisabled: a,
|
|
47
|
+
...t
|
|
48
|
+
}, s) => {
|
|
49
|
+
const { container: l, indicator: i, knob: y, textWrapper: c, label: p, hintText: b } = v({ isDisabled: a }), n = { ...t, role: "switch" };
|
|
50
|
+
return /* @__PURE__ */ o(
|
|
51
|
+
g,
|
|
52
|
+
{
|
|
53
|
+
...n,
|
|
54
|
+
ref: s,
|
|
55
|
+
className: l(),
|
|
56
|
+
isDisabled: a,
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ e("div", { className: i(), "data-dd-privacy": "mask", children: /* @__PURE__ */ e("div", { className: y() }) }),
|
|
59
|
+
/* @__PURE__ */ o(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
className: c({
|
|
63
|
+
className: u ? "uy-sr-only" : ""
|
|
64
|
+
}),
|
|
65
|
+
"data-dd-privacy": "allow",
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ e("span", { className: p(), children: d }),
|
|
68
|
+
r && /* @__PURE__ */ e("span", { className: b(), children: r })
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
);
|
|
54
75
|
}
|
|
55
76
|
);
|
|
56
77
|
h.displayName = "ToggleSwitch";
|
|
57
78
|
export {
|
|
58
79
|
h as ToggleSwitch,
|
|
59
|
-
|
|
80
|
+
v as toggleSwitch
|
|
60
81
|
};
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
import { ForwardedRef, JSX
|
|
1
|
+
import { ForwardedRef, JSX } from 'react';
|
|
2
2
|
import { FieldPath, FieldValues } from 'react-hook-form';
|
|
3
3
|
import { infer as ZodInfer } from 'zod';
|
|
4
4
|
import { Schema } from '../../hooks/use-form.types.js';
|
|
5
|
-
|
|
6
|
-
interface FieldProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends Pick<LabelProps, 'isRequired' | 'requiredVariant'> {
|
|
5
|
+
interface FieldProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> {
|
|
7
6
|
/** The name of the field, which should match the form schema. */
|
|
8
7
|
name: TName;
|
|
9
8
|
/** The label for the toggle switch. */
|
|
10
9
|
label: string;
|
|
11
|
-
/** Helper text to display below form field. */
|
|
12
|
-
helperText?: ReactNode;
|
|
13
10
|
/** Helper text to display below the toggle switch. */
|
|
14
11
|
switchHelperText?: string;
|
|
15
|
-
/** A contextual link to display below the toggle switch. */
|
|
16
|
-
contextualLink?: ReactNode;
|
|
17
12
|
/** The default selected value of the toggle switch. */
|
|
18
13
|
defaultSelected?: boolean;
|
|
19
14
|
/** Whether the toggle switch is disabled. */
|