@payfit/unity-components 1.1.1-beta.1 → 2.0.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/esm/adapters/standardSchemaAdapter.d.ts +7 -0
- package/dist/esm/adapters/standardSchemaAdapter.js +20 -0
- package/dist/esm/adapters/zodAdapter.d.ts +13 -0
- package/dist/esm/adapters/zodAdapter.js +74 -0
- package/dist/esm/components/action-bar/ActionBar.js +60 -62
- package/dist/esm/components/actionable/Actionable.d.ts +50 -3
- package/dist/esm/components/actionable/Actionable.js +58 -45
- package/dist/esm/components/app-layout/AppLayout.js +17 -17
- package/dist/esm/components/app-menu/parts/AppMenuFooter.js +63 -63
- package/dist/esm/components/app-menu/parts/AppMenuHeader.d.ts +86 -4
- package/dist/esm/components/app-menu/parts/AppMenuHeader.js +25 -25
- package/dist/esm/components/autocomplete/parts/AutocompleteClearButton.js +5 -5
- package/dist/esm/components/bottom-sheet/parts/BottomSheetDragIndicator.js +30 -31
- package/dist/esm/components/breadcrumbs/Breadcrumbs.context.js +3 -3
- package/dist/esm/components/breadcrumbs/Breadcrumbs.d.ts +19 -11
- package/dist/esm/components/breadcrumbs/Breadcrumbs.js +29 -18
- package/dist/esm/components/breadcrumbs/parts/Breadcrumb.d.ts +30 -5
- package/dist/esm/components/breadcrumbs/parts/Breadcrumb.js +35 -27
- package/dist/esm/components/breadcrumbs/parts/RawBreadcrumbLink.d.ts +37 -0
- package/dist/esm/components/breadcrumbs/parts/RawBreadcrumbLink.js +36 -0
- package/dist/esm/components/checkbox-field/CheckboxField.d.ts +2 -2
- package/dist/esm/components/checkbox-field/CheckboxField.js +18 -17
- package/dist/esm/components/checkbox-group-field/CheckboxGroupField.d.ts +2 -2
- package/dist/esm/components/checkbox-group-field/CheckboxGroupField.js +4 -1
- package/dist/esm/components/client-side-pagination/ClientSidePagination.d.ts +103 -0
- package/dist/esm/components/client-side-pagination/ClientSidePagination.js +177 -0
- package/dist/esm/components/client-side-pagination/parts/PaginationEllipsis.d.ts +11 -0
- package/dist/esm/components/client-side-pagination/parts/PaginationEllipsis.js +30 -0
- package/dist/esm/components/client-side-pagination/parts/PaginationJumpDialog.d.ts +8 -0
- package/dist/esm/components/{pagination → client-side-pagination}/parts/PaginationJumpDialog.js +39 -40
- package/dist/esm/components/{pagination/parts/PaginationLink.d.ts → client-side-pagination/parts/RawPaginationLink.d.ts} +2 -2
- package/dist/esm/components/{pagination/parts/PaginationLink.js → client-side-pagination/parts/RawPaginationLink.js} +2 -2
- package/dist/esm/components/client-side-pagination/utils/pagination-window.d.ts +8 -0
- package/dist/esm/components/client-side-pagination/utils/pagination-window.js +33 -0
- package/dist/esm/components/code/Code.d.ts +31 -1
- package/dist/esm/components/code/Code.js +39 -0
- package/dist/esm/components/code/copyToClipboard.js +10 -0
- package/dist/esm/components/collapsible/parts/CollapsibleTitle.js +7 -7
- package/dist/esm/components/data-table/DataTable.d.ts +76 -10
- package/dist/esm/components/data-table/DataTable.js +81 -78
- package/dist/esm/components/data-table/parts/DataTableBulkActions.js +20 -20
- package/dist/esm/components/date-calendar/DateCalendar.js +52 -52
- package/dist/esm/components/date-calendar/parts/DateSegmentSelect.js +30 -33
- package/dist/esm/components/date-picker/DatePicker.js +64 -64
- package/dist/esm/components/date-picker/parts/DateInput.js +33 -33
- package/dist/esm/components/date-picker-field/DatePickerField.d.ts +2 -2
- package/dist/esm/components/dialog/parts/DialogActions/DialogButton.js +12 -12
- package/dist/esm/components/error-state/ErrorState.d.ts +208 -0
- package/dist/esm/components/error-state/ErrorState.js +194 -0
- package/dist/esm/components/error-state/initConfig.d.ts +16 -0
- package/dist/esm/components/error-state/initConfig.js +149 -0
- package/dist/esm/components/error-state/parts/Collapsible.d.ts +59 -0
- package/dist/esm/components/error-state/parts/Collapsible.js +67 -0
- package/dist/esm/components/fieldset/Fieldset.d.ts +19 -0
- package/dist/esm/components/fieldset/Fieldset.js +32 -26
- package/dist/esm/components/flex/Flex.js +52 -37
- package/dist/esm/components/form/Form.d.ts +15 -9
- package/dist/esm/components/form/Form.js +53 -50
- package/dist/esm/components/form-field/FormField.js +18 -17
- package/dist/esm/components/form-field/parts/{FormContextualLink.d.ts → RawFormContextualLink.d.ts} +2 -2
- package/dist/esm/components/form-field/parts/RawFormContextualLink.js +39 -0
- package/dist/esm/components/form-field/utils/isFieldRequired.d.ts +4 -4
- package/dist/esm/components/form-field/utils/isFieldRequired.js +5 -20
- package/dist/esm/components/funnel-layout/parts/FunnelPageActions.js +24 -24
- package/dist/esm/components/funnel-layout/parts/FunnelSidebar.d.ts +2 -2
- package/dist/esm/components/icon/Icon.js +23 -19
- package/dist/esm/components/input/Input.js +28 -28
- package/dist/esm/components/label/Label.js +19 -19
- package/dist/esm/components/link/{Link.variants.d.ts → RawLink.d.ts} +92 -0
- package/dist/esm/components/link/{Link.variants.js → RawLink.js} +70 -4
- package/dist/esm/components/menu/parts/{MenuItem.d.ts → RawMenuItem.d.ts} +3 -4
- package/dist/esm/components/menu/parts/{MenuItem.js → RawMenuItem.js} +9 -9
- package/dist/esm/components/multi-select/MultiSelect.js +94 -94
- package/dist/esm/components/multi-select/hooks/use-multiselection-state.js +32 -32
- package/dist/esm/components/multi-select/parts/MultiSelectButton.js +38 -38
- package/dist/esm/components/multi-select/parts/MultiSelectPopover.js +16 -16
- package/dist/esm/components/multi-select-field/MultiSelectField.d.ts +2 -2
- package/dist/esm/components/multi-select-field/MultiSelectField.js +53 -53
- package/dist/esm/components/nav/parts/NavGroup.d.ts +3 -3
- package/dist/esm/components/nav/parts/NavGroup.js +63 -52
- package/dist/esm/components/nav/parts/{NavItem.d.ts → RawNavItem.d.ts} +102 -5
- package/dist/esm/components/nav/parts/RawNavItem.js +106 -0
- package/dist/esm/components/number-field/NumberField.d.ts +3 -3
- package/dist/esm/components/number-input/NumberInput.js +58 -58
- package/dist/esm/components/page/Page.js +1 -1
- package/dist/esm/components/page/parts/PageHeader.d.ts +79 -9
- package/dist/esm/components/page/parts/PageHeader.js +22 -20
- package/dist/esm/components/pagination/Pagination.d.ts +23 -44
- package/dist/esm/components/pagination/Pagination.js +89 -167
- package/dist/esm/components/pagination/PaginationContext.d.ts +11 -0
- package/dist/esm/components/pagination/PaginationContext.js +15 -0
- package/dist/esm/components/pagination/hooks/use-pagination-state.d.ts +63 -0
- package/dist/esm/components/pagination/hooks/use-pagination-state.js +27 -0
- package/dist/esm/components/pagination/hooks/use-pagination-window.d.ts +64 -0
- package/dist/esm/components/pagination/hooks/use-pagination-window.js +15 -0
- package/dist/esm/components/pagination/parts/PaginationContent.d.ts +30 -0
- package/dist/esm/components/pagination/parts/PaginationContent.js +37 -0
- package/dist/esm/components/pagination/parts/PaginationEllipsis.d.ts +23 -4
- package/dist/esm/components/pagination/parts/PaginationEllipsis.js +20 -16
- package/dist/esm/components/pagination/parts/PaginationItem.d.ts +38 -0
- package/dist/esm/components/pagination/parts/PaginationItem.js +22 -0
- package/dist/esm/components/pagination/parts/RawPaginationLink.d.ts +11 -0
- package/dist/esm/components/pagination/parts/RawPaginationLink.js +60 -0
- package/dist/esm/components/pagination/parts/RawPaginationNext.d.ts +22 -0
- package/dist/esm/components/pagination/parts/RawPaginationNext.js +70 -0
- package/dist/esm/components/pagination/parts/RawPaginationPrevious.d.ts +22 -0
- package/dist/esm/components/pagination/parts/RawPaginationPrevious.js +67 -0
- package/dist/esm/components/pagination/utils/pagination-window.js +29 -20
- package/dist/esm/components/popover/parts/PopoverHeader.js +8 -8
- package/dist/esm/components/radio-button-group/parts/RadioButton.js +11 -11
- package/dist/esm/components/select/Select.js +63 -45
- package/dist/esm/components/select/parts/SelectOption.js +9 -9
- package/dist/esm/components/select-field/SelectField.d.ts +2 -2
- package/dist/esm/components/select-field/SelectField.js +4 -1
- package/dist/esm/components/selectable-button-group/SelectableButtonGroup.js +22 -23
- package/dist/esm/components/selectable-button-group-field/SelectableButtonGroupField.d.ts +2 -2
- package/dist/esm/components/side-panel/parts/SidePanelDragIndicator.js +30 -31
- package/dist/esm/components/skip-links/SkipLinks.js +1 -1
- package/dist/esm/components/table/Table.d.ts +1 -0
- package/dist/esm/components/table/Table.js +110 -98
- package/dist/esm/components/table/hooks/useTableKeyboardNavigation.js +6 -6
- package/dist/esm/components/table/parts/TableBody.js +6 -6
- package/dist/esm/components/table/parts/TableCell.js +34 -31
- package/dist/esm/components/table/parts/TableColumnHeader.js +38 -38
- package/dist/esm/components/table/parts/TablePagination.d.ts +5 -5
- package/dist/esm/components/table/parts/TablePagination.js +61 -59
- package/dist/esm/components/table/parts/TableRow.js +21 -18
- package/dist/esm/components/tabs/parts/{Tab.d.ts → RawTab.d.ts} +2 -2
- package/dist/esm/components/tabs/parts/{Tab.js → RawTab.js} +6 -6
- package/dist/esm/components/tabs/parts/TabList.js +50 -54
- package/dist/esm/components/task-menu/TaskMenu.d.ts +4 -4
- package/dist/esm/components/task-menu/parts/Content.js +24 -24
- package/dist/esm/components/task-menu/parts/Header.js +24 -24
- package/dist/esm/components/task-menu/parts/{SubTask.d.ts → RawSubTask.d.ts} +7 -7
- package/dist/esm/components/task-menu/parts/{SubTask.js → RawSubTask.js} +74 -74
- package/dist/esm/components/task-menu/parts/{Task.d.ts → RawTask.d.ts} +7 -7
- package/dist/esm/components/task-menu/parts/{Task.js → RawTask.js} +69 -69
- package/dist/esm/components/task-menu/parts/TaskGroup.d.ts +5 -5
- package/dist/esm/components/task-menu/parts/TaskGroup.js +45 -45
- package/dist/esm/components/text/Text.js +30 -27
- package/dist/esm/components/text-area/TextArea.js +30 -31
- package/dist/esm/components/text-field/TextField.d.ts +2 -2
- package/dist/esm/components/toggle-switch-field/ToggleSwitchField.d.ts +2 -2
- package/dist/esm/components/toggle-switch-field/ToggleSwitchField.js +4 -1
- package/dist/esm/components/toggle-switch-group/ToggleSwitchGroup.js +74 -74
- package/dist/esm/components/toggle-switch-group-field/ToggleSwitchGroupField.d.ts +2 -2
- package/dist/esm/components/toggle-switch-group-field/ToggleSwitchGroupField.js +36 -32
- package/dist/esm/hooks/use-container-query-level.d.ts +42 -0
- package/dist/esm/hooks/use-container-query-level.js +33 -0
- package/dist/esm/hooks/use-form.d.ts +5 -5
- package/dist/esm/hooks/use-form.types.d.ts +2 -2
- package/dist/esm/hooks/use-resizable.js +13 -14
- package/dist/esm/index.d.ts +21 -10
- package/dist/esm/index.js +424 -396
- package/dist/esm/integrations/tanstack-router/components/breadcrumbs/Breadcrumb.d.ts +23 -0
- package/dist/esm/integrations/tanstack-router/components/breadcrumbs/BreadcrumbLink.d.ts +38 -0
- package/dist/esm/integrations/tanstack-router/components/breadcrumbs/BreadcrumbLink.js +7 -0
- package/dist/esm/integrations/tanstack-router/components/breadcrumbs/Breadcrumbs.d.ts +23 -0
- package/dist/esm/integrations/tanstack-router/components/breadcrumbs/use-route-breadcrumb.d.ts +53 -0
- package/dist/esm/integrations/tanstack-router/components/form-contextual-link/FormContextualLink.d.ts +40 -0
- package/dist/esm/integrations/tanstack-router/components/form-contextual-link/FormContextualLink.js +7 -0
- package/dist/esm/integrations/tanstack-router/components/link/Link.d.ts +33 -0
- package/dist/esm/integrations/tanstack-router/components/link/Link.js +7 -0
- package/dist/esm/integrations/tanstack-router/components/menu-item/MenuItem.d.ts +49 -0
- package/dist/esm/integrations/tanstack-router/components/menu-item/MenuItem.js +16 -0
- package/dist/esm/integrations/tanstack-router/components/nav-item/NavItem.d.ts +52 -0
- package/dist/esm/integrations/tanstack-router/components/nav-item/NavItem.js +29 -0
- package/dist/esm/integrations/tanstack-router/components/pagination/PaginationLink.d.ts +54 -0
- package/dist/esm/integrations/tanstack-router/components/pagination/PaginationLink.js +21 -0
- package/dist/esm/integrations/tanstack-router/components/pagination/PaginationNext.d.ts +52 -0
- package/dist/esm/integrations/tanstack-router/components/pagination/PaginationNext.js +22 -0
- package/dist/esm/integrations/tanstack-router/components/pagination/PaginationPrevious.d.ts +51 -0
- package/dist/esm/integrations/tanstack-router/components/pagination/PaginationPrevious.js +22 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/Tabs.d.ts +82 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/Tabs.js +41 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/parts/Tab.d.ts +52 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/parts/Tab.js +15 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/parts/TabList.d.ts +5 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/parts/TabPanel.d.ts +77 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/parts/TabPanel.js +16 -0
- package/dist/esm/integrations/tanstack-router/components/task-menu/SubTask.d.ts +69 -0
- package/dist/esm/integrations/tanstack-router/components/task-menu/SubTask.js +14 -0
- package/dist/esm/integrations/tanstack-router/components/task-menu/Task.d.ts +64 -0
- package/dist/esm/integrations/tanstack-router/components/task-menu/Task.js +14 -0
- package/dist/esm/integrations/tanstack-router/index.d.ts +16 -0
- package/dist/esm/integrations/tanstack-router/utils/decorators.d.ts +23 -0
- package/dist/esm/integrations/tanstack-router.js +34 -0
- package/dist/esm/providers/router/RouterProvider.d.ts +7 -2
- package/dist/esm/providers/router/RouterProvider.js +14 -10
- package/dist/esm/types/DataAttributes.d.ts +1 -1
- package/dist/esm/types/schema.d.ts +8 -0
- package/dist/esm/utils/createSchemaAdapter.d.ts +7 -0
- package/dist/esm/utils/createSchemaAdapter.js +13 -0
- package/dist/esm/utils/platform.js +2 -3
- package/i18n/en-GB.json +16 -0
- package/i18n/es-ES.json +16 -0
- package/i18n/fr-FR.json +16 -0
- package/package.json +56 -31
- package/dist/esm/components/form-field/parts/FormContextualLink.js +0 -37
- package/dist/esm/components/link/Link.d.ts +0 -93
- package/dist/esm/components/link/Link.js +0 -68
- package/dist/esm/components/nav/parts/NavItem.js +0 -95
- /package/dist/esm/components/{pagination → client-side-pagination}/hooks/use-pagination.d.ts +0 -0
- /package/dist/esm/components/{pagination → client-side-pagination}/hooks/use-pagination.js +0 -0
- /package/dist/esm/components/{pagination → client-side-pagination}/parts/PaginationNavButton.d.ts +0 -0
- /package/dist/esm/components/{pagination → client-side-pagination}/parts/PaginationNavButton.js +0 -0
|
@@ -1,59 +1,63 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as T, jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as x, useMemo as G } from "react";
|
|
3
3
|
import { useFormContext as R } from "react-hook-form";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
4
|
+
import { createSchemaAdapter as q } from "../../utils/createSchemaAdapter.js";
|
|
5
|
+
import { FormField as y } from "../form-field/FormField.js";
|
|
6
|
+
import { FormControl as P } from "../form-field/parts/FormControl.js";
|
|
7
|
+
import { FormFeedbackText as j } from "../form-field/parts/FormFeedbackText.js";
|
|
8
|
+
import { isFieldRequired as v } from "../form-field/utils/isFieldRequired.js";
|
|
9
|
+
import { useUnityFormProvider as C } from "../form/Form.context.js";
|
|
10
|
+
import { ToggleSwitchGroup as U } from "../toggle-switch-group/ToggleSwitchGroup.js";
|
|
11
|
+
function b({
|
|
11
12
|
name: o,
|
|
12
13
|
label: r,
|
|
13
|
-
defaultValue:
|
|
14
|
+
defaultValue: e,
|
|
14
15
|
helperText: m,
|
|
15
16
|
contextualLink: c,
|
|
16
|
-
isRequired:
|
|
17
|
-
isInvalid:
|
|
17
|
+
isRequired: p,
|
|
18
|
+
isInvalid: s,
|
|
18
19
|
isLoading: l,
|
|
19
20
|
isDisabled: n,
|
|
20
|
-
isReadOnly:
|
|
21
|
-
requiredVariant:
|
|
21
|
+
isReadOnly: d,
|
|
22
|
+
requiredVariant: u,
|
|
22
23
|
children: f,
|
|
23
24
|
...F
|
|
24
|
-
},
|
|
25
|
-
const { control:
|
|
26
|
-
() =>
|
|
25
|
+
}, h) {
|
|
26
|
+
const { control: g, watch: a } = R(), { schema: t } = C(), w = G(
|
|
27
|
+
() => v(q(t), o),
|
|
27
28
|
[t, o]
|
|
28
|
-
),
|
|
29
|
-
return /* @__PURE__ */
|
|
30
|
-
isInvalid:
|
|
29
|
+
), S = a(o);
|
|
30
|
+
return /* @__PURE__ */ T(y, { control: g, name: o, ...{
|
|
31
|
+
isInvalid: s,
|
|
31
32
|
isLoading: l,
|
|
32
33
|
isDisabled: n,
|
|
33
|
-
isReadOnly:
|
|
34
|
+
isReadOnly: d
|
|
34
35
|
}, children: [
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
-
|
|
36
|
+
/* @__PURE__ */ i(P, { children: /* @__PURE__ */ i(
|
|
37
|
+
U,
|
|
37
38
|
{
|
|
38
|
-
ref:
|
|
39
|
+
ref: h,
|
|
39
40
|
label: r,
|
|
40
|
-
defaultValue:
|
|
41
|
-
value:
|
|
41
|
+
defaultValue: e,
|
|
42
|
+
value: S,
|
|
42
43
|
helperText: m,
|
|
43
|
-
requiredVariant:
|
|
44
|
+
requiredVariant: u,
|
|
44
45
|
...F,
|
|
45
|
-
isRequired:
|
|
46
|
+
isRequired: w ?? p,
|
|
46
47
|
children: f
|
|
47
48
|
}
|
|
48
49
|
) }),
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
+
/* @__PURE__ */ i(j, {}),
|
|
50
51
|
c
|
|
51
52
|
] });
|
|
52
53
|
}
|
|
53
|
-
const
|
|
54
|
-
return
|
|
54
|
+
const k = x(function(r, e) {
|
|
55
|
+
return b(
|
|
56
|
+
r,
|
|
57
|
+
e
|
|
58
|
+
);
|
|
55
59
|
});
|
|
56
|
-
|
|
60
|
+
k.displayName = "ToggleSwitchGroupField";
|
|
57
61
|
export {
|
|
58
|
-
|
|
62
|
+
k as ToggleSwitchGroupField
|
|
59
63
|
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type ContainerQueryLevel = 'component' | 'section' | 'page' | 'app';
|
|
2
|
+
interface UseContainerQueryLevelOptions {
|
|
3
|
+
/**
|
|
4
|
+
* The ref to the container element to observe
|
|
5
|
+
*/
|
|
6
|
+
ref: React.RefObject<HTMLElement | null>;
|
|
7
|
+
}
|
|
8
|
+
interface UseContainerQueryLevelReturn {
|
|
9
|
+
/**
|
|
10
|
+
* The current container query level based on the container width
|
|
11
|
+
*/
|
|
12
|
+
level: ContainerQueryLevel;
|
|
13
|
+
/**
|
|
14
|
+
* The current width of the observed container
|
|
15
|
+
*/
|
|
16
|
+
width: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Hook that determines the current container query level based on container width.
|
|
20
|
+
*
|
|
21
|
+
* This hook uses ResizeObserver to monitor the width of a container element and
|
|
22
|
+
* determines which container query level it falls into based on Unity's container
|
|
23
|
+
* breakpoints from design tokens. Breakpoints are automatically synced with Unity's
|
|
24
|
+
* design system: component (< 703px), section (703-1062px), page (1063-1438px), app (≥ 1439px).
|
|
25
|
+
* @param options Configuration options containing the ref to observe
|
|
26
|
+
* @returns Object containing the current level and width
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* function MyComponent() {
|
|
30
|
+
* const containerRef = useRef<HTMLDivElement>(null)
|
|
31
|
+
* const { level, width } = useContainerQueryLevel({ ref: containerRef })
|
|
32
|
+
*
|
|
33
|
+
* return (
|
|
34
|
+
* <div ref={containerRef}>
|
|
35
|
+
* Current level: {level} (width: {width}px)
|
|
36
|
+
* </div>
|
|
37
|
+
* )
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function useContainerQueryLevel(options: UseContainerQueryLevelOptions): UseContainerQueryLevelReturn;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import s from "@payfit/unity-themes/tokens/sizes.json";
|
|
2
|
+
import { useResizeObserver as c } from "usehooks-ts";
|
|
3
|
+
const i = () => {
|
|
4
|
+
const n = s.container, o = {
|
|
5
|
+
section: parseInt(n.section.$value.replace("px", ""), 10),
|
|
6
|
+
page: parseInt(n.page.$value.replace("px", ""), 10),
|
|
7
|
+
app: parseInt(n.app.$value.replace("px", ""), 10)
|
|
8
|
+
};
|
|
9
|
+
if (typeof window > "u")
|
|
10
|
+
return o;
|
|
11
|
+
const r = getComputedStyle(document.documentElement), e = (t) => {
|
|
12
|
+
const p = r.getPropertyValue(`--uy-container-${t}`), a = parseInt(p.replace("px", ""), 10);
|
|
13
|
+
return isNaN(a) ? o[t] : a;
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
section: e("section"),
|
|
17
|
+
page: e("page"),
|
|
18
|
+
app: e("app")
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
function d(n) {
|
|
22
|
+
const { ref: o } = n, e = c({
|
|
23
|
+
ref: o,
|
|
24
|
+
box: "border-box"
|
|
25
|
+
}).width ?? 0, t = i();
|
|
26
|
+
return {
|
|
27
|
+
level: e >= t.app ? "app" : e >= t.page ? "page" : e >= t.section ? "section" : "component",
|
|
28
|
+
width: e
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
d as useContainerQueryLevel
|
|
33
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
1
2
|
import { JSX, PropsWithChildren } from 'react';
|
|
2
3
|
import { UseFormProps as UseHookFormProps, UseFormReturn as UseHookFormReturn } from 'react-hook-form';
|
|
3
|
-
import { infer as ZodInfer } from 'zod';
|
|
4
4
|
import { FormFieldProps } from '../components/form-field/FormField.js';
|
|
5
5
|
import { FormProps } from '../components/form/Form.js';
|
|
6
6
|
import { Schema } from './use-form.types.js';
|
|
7
7
|
export type UseUnityFormReturn<TSchema extends Schema> = {
|
|
8
|
-
methods: UseHookFormReturn<
|
|
9
|
-
Form: (props: Omit<FormProps<TSchema>, 'form' | 'schema'>) => JSX.Element;
|
|
10
|
-
FormField: (props: PropsWithChildren<Omit<FormFieldProps<
|
|
8
|
+
methods: UseHookFormReturn<StandardSchemaV1.InferInput<TSchema>, any, StandardSchemaV1.InferOutput<TSchema>>;
|
|
9
|
+
Form: (props: Omit<FormProps<TSchema, StandardSchemaV1.InferInput<TSchema>, StandardSchemaV1.InferOutput<TSchema>>, 'form' | 'schema'>) => JSX.Element;
|
|
10
|
+
FormField: (props: PropsWithChildren<Omit<FormFieldProps<StandardSchemaV1.InferOutput<TSchema>>, 'control'>>) => JSX.Element;
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
13
|
* A hook to create `Form` and `FormField` components that are bound to a specific schema definition and form controller. The resulting components will have full type-safety based on the provided schema type.
|
|
@@ -45,4 +45,4 @@ export type UseUnityFormReturn<TSchema extends Schema> = {
|
|
|
45
45
|
* @remarks
|
|
46
46
|
* [API]() • [Demo]()
|
|
47
47
|
*/
|
|
48
|
-
export declare function useUnityForm<TSchema extends Schema>(schema: TSchema, options?: Omit<UseHookFormProps<
|
|
48
|
+
export declare function useUnityForm<TSchema extends Schema>(schema: TSchema, options?: Omit<UseHookFormProps<StandardSchemaV1.InferInput<TSchema>, any, StandardSchemaV1.InferOutput<TSchema>>, 'resolver'>): UseUnityFormReturn<TSchema>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
2
|
export type TFormValues = Record<string, unknown>;
|
|
3
|
-
export type Schema =
|
|
3
|
+
export type Schema = StandardSchemaV1<TFormValues>;
|
|
@@ -10,35 +10,34 @@ function x({
|
|
|
10
10
|
startY: 0,
|
|
11
11
|
startWidth: 0,
|
|
12
12
|
startHeight: 0
|
|
13
|
-
}), l = (
|
|
14
|
-
var s;
|
|
13
|
+
}), l = (s) => {
|
|
15
14
|
if (c) return;
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
!e.current || !
|
|
15
|
+
s.preventDefault();
|
|
16
|
+
const r = e.current?.querySelector("textarea");
|
|
17
|
+
!e.current || !r || o({
|
|
19
18
|
isResizing: !0,
|
|
20
|
-
startX:
|
|
21
|
-
startY:
|
|
19
|
+
startX: s.clientX,
|
|
20
|
+
startY: s.clientY,
|
|
22
21
|
startWidth: e.current.offsetWidth,
|
|
23
|
-
startHeight:
|
|
22
|
+
startHeight: r.offsetHeight
|
|
24
23
|
});
|
|
25
24
|
};
|
|
26
25
|
return g(() => {
|
|
27
26
|
if (!t.isResizing) return;
|
|
28
|
-
const
|
|
27
|
+
const s = (n) => {
|
|
29
28
|
if (!e.current) return;
|
|
30
29
|
const u = e.current.querySelector("textarea");
|
|
31
30
|
if (!u) return;
|
|
32
|
-
const d =
|
|
31
|
+
const d = n.clientX - t.startX, f = n.clientY - t.startY, h = Math.max(t.startWidth + d, i ?? 0), m = Math.max(
|
|
33
32
|
t.startHeight + f,
|
|
34
33
|
a ?? 0
|
|
35
34
|
);
|
|
36
35
|
e.current.style.width = `${h}px`, u.style.height = `${m}px`;
|
|
37
|
-
},
|
|
38
|
-
o((
|
|
36
|
+
}, r = () => {
|
|
37
|
+
o((n) => ({ ...n, isResizing: !1 }));
|
|
39
38
|
};
|
|
40
|
-
return document.addEventListener("mousemove",
|
|
41
|
-
document.removeEventListener("mousemove",
|
|
39
|
+
return document.addEventListener("mousemove", s), document.addEventListener("mouseup", r), () => {
|
|
40
|
+
document.removeEventListener("mousemove", s), document.removeEventListener("mouseup", r);
|
|
42
41
|
};
|
|
43
42
|
}, [t, i, a]), {
|
|
44
43
|
containerRef: e,
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export * from './components/actionable/Actionable.js';
|
|
2
|
+
export * from './components/action-bar/ActionBar.js';
|
|
3
|
+
export * from './components/action-bar/parts/ActionBarAction.js';
|
|
4
|
+
export * from './components/action-bar/parts/ActionBarRoot.js';
|
|
2
5
|
export * from './components/alert/Alert.js';
|
|
3
6
|
export * from './components/alert/parts/AlertActions.js';
|
|
4
7
|
export * from './components/alert/parts/AlertContent.js';
|
|
@@ -25,6 +28,7 @@ export * from './components/bottom-sheet/parts/BottomSheetFooter.js';
|
|
|
25
28
|
export * from './components/bottom-sheet/parts/BottomSheetHeader.js';
|
|
26
29
|
export * from './components/breadcrumbs/Breadcrumbs.js';
|
|
27
30
|
export * from './components/breadcrumbs/parts/Breadcrumb.js';
|
|
31
|
+
export * from './components/breadcrumbs/parts/RawBreadcrumbLink.js';
|
|
28
32
|
export * from './components/button/Button.js';
|
|
29
33
|
export * from './components/checkbox-field/CheckboxField.js';
|
|
30
34
|
export * from './components/checkbox-group-field/CheckboxGroupField.js';
|
|
@@ -46,13 +50,14 @@ export * from './components/dialog/parts/DialogActions.js';
|
|
|
46
50
|
export * from './components/dialog/parts/DialogActions/DialogButton.js';
|
|
47
51
|
export * from './components/dialog/parts/DialogContent.js';
|
|
48
52
|
export * from './components/dialog/parts/DialogTitle.js';
|
|
53
|
+
export * from './components/error-state/ErrorState.js';
|
|
49
54
|
export * from './components/fieldset/Fieldset.js';
|
|
50
55
|
export * from './components/fieldset/parts/FieldGroup.js';
|
|
51
56
|
export * from './components/flex/Flex.js';
|
|
52
57
|
export * from './components/flex/Flex.variants.js';
|
|
53
58
|
export * from './components/flex/FlexItem.js';
|
|
54
59
|
export * from './components/form-field/FormField.js';
|
|
55
|
-
export * from './components/form-field/parts/
|
|
60
|
+
export * from './components/form-field/parts/RawFormContextualLink.js';
|
|
56
61
|
export * from './components/form-field/parts/FormControl.js';
|
|
57
62
|
export * from './components/form-field/parts/FormFeedbackText.js';
|
|
58
63
|
export * from './components/form-field/parts/FormHelperText.js';
|
|
@@ -76,11 +81,11 @@ export * from './components/icon-button/IconButton.js';
|
|
|
76
81
|
export * from './components/icon/Icon.js';
|
|
77
82
|
export * from './components/input/Input.js';
|
|
78
83
|
export * from './components/label/Label.js';
|
|
79
|
-
export * from './components/link/
|
|
84
|
+
export * from './components/link/RawLink.js';
|
|
80
85
|
export * from './components/menu/Menu.js';
|
|
81
86
|
export * from './components/menu/parts/MenuContent.js';
|
|
82
87
|
export * from './components/menu/parts/MenuHeader.js';
|
|
83
|
-
export * from './components/menu/parts/
|
|
88
|
+
export * from './components/menu/parts/RawMenuItem.js';
|
|
84
89
|
export * from './components/menu/parts/MenuSeparator.js';
|
|
85
90
|
export * from './components/menu/parts/MenuTrigger.js';
|
|
86
91
|
export * from './components/multi-select-field/MultiSelectField.js';
|
|
@@ -89,13 +94,21 @@ export * from './components/multi-select/parts/MultiSelectOptGroup.js';
|
|
|
89
94
|
export * from './components/multi-select/parts/MultiSelectOption.js';
|
|
90
95
|
export * from './components/nav/Nav.js';
|
|
91
96
|
export * from './components/nav/parts/NavGroup.js';
|
|
92
|
-
export * from './components/nav/parts/
|
|
97
|
+
export * from './components/nav/parts/RawNavItem.js';
|
|
93
98
|
export * from './components/number-field/NumberField.js';
|
|
94
99
|
export * from './components/number-input/NumberInput.js';
|
|
95
100
|
export * from './components/page/Page.js';
|
|
96
101
|
export * from './components/page/parts/PageHeader.js';
|
|
97
102
|
export * from './components/page/parts/PageHeading.js';
|
|
98
103
|
export * from './components/pagination/Pagination.js';
|
|
104
|
+
export * from './components/pagination/parts/PaginationContent.js';
|
|
105
|
+
export * from './components/pagination/parts/PaginationItem.js';
|
|
106
|
+
export * from './components/pagination/parts/RawPaginationLink.js';
|
|
107
|
+
export * from './components/pagination/parts/RawPaginationPrevious.js';
|
|
108
|
+
export * from './components/pagination/parts/RawPaginationNext.js';
|
|
109
|
+
export * from './components/pagination/parts/PaginationEllipsis.js';
|
|
110
|
+
export * from './components/pagination/hooks/use-pagination-window.js';
|
|
111
|
+
export * from './components/pagination/hooks/use-pagination-state.js';
|
|
99
112
|
export * from './components/payfit-brand/PayFitBrand.js';
|
|
100
113
|
export * from './components/payfit-brand/PayFitPreprod.js';
|
|
101
114
|
export * from './components/pill/Pill.js';
|
|
@@ -138,12 +151,12 @@ export * from './components/table/parts/TableHeader.js';
|
|
|
138
151
|
export * from './components/table/parts/TablePagination.js';
|
|
139
152
|
export * from './components/table/parts/TableRow.js';
|
|
140
153
|
export * from './components/tabs/Tabs.js';
|
|
141
|
-
export * from './components/tabs/parts/
|
|
154
|
+
export * from './components/tabs/parts/RawTab.js';
|
|
142
155
|
export * from './components/tabs/parts/TabList.js';
|
|
143
156
|
export * from './components/tabs/parts/TabPanel.js';
|
|
144
157
|
export * from './components/task-menu/TaskMenu.js';
|
|
145
|
-
export * from './components/task-menu/parts/
|
|
146
|
-
export * from './components/task-menu/parts/
|
|
158
|
+
export * from './components/task-menu/parts/RawSubTask.js';
|
|
159
|
+
export * from './components/task-menu/parts/RawTask.js';
|
|
147
160
|
export * from './components/task-menu/parts/TaskGroup.js';
|
|
148
161
|
export * from './components/text-area/TextArea.js';
|
|
149
162
|
export * from './components/text-field/TextField.js';
|
|
@@ -158,9 +171,7 @@ export * from './components/toggle-switch/ToggleSwitch.js';
|
|
|
158
171
|
export * from './components/tooltip/Tooltip.js';
|
|
159
172
|
export * from './hooks/use-async-list.js';
|
|
160
173
|
export * from './hooks/use-breakpoint-listener.js';
|
|
174
|
+
export * from './hooks/use-container-query-level.js';
|
|
161
175
|
export * from './hooks/use-form.js';
|
|
162
176
|
export * from './hooks/use-media-query.js';
|
|
163
177
|
export * from './providers/router/RouterProvider.js';
|
|
164
|
-
export * from './components/action-bar/ActionBar.js';
|
|
165
|
-
export * from './components/action-bar/parts/ActionBarAction.js';
|
|
166
|
-
export * from './components/action-bar/parts/ActionBarRoot.js';
|