@payfit/unity-components 1.1.0 → 1.2.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 +62 -64
- package/dist/esm/components/actionable/Actionable.d.ts +50 -3
- package/dist/esm/components/actionable/Actionable.js +49 -39
- package/dist/esm/components/app-menu/parts/AppMenuFooter.js +63 -63
- 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/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/code/Code.d.ts +37 -0
- package/dist/esm/components/code/Code.js +39 -0
- package/dist/esm/components/code/copyToClipboard.d.ts +1 -0
- package/dist/esm/components/code/copyToClipboard.js +10 -0
- package/dist/esm/components/collapsible/Collapsible.d.ts +1 -1
- package/dist/esm/components/collapsible/Collapsible.js +14 -13
- 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/ColumnSortHeader.js +13 -13
- 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 +196 -0
- package/dist/esm/components/error-state/ErrorState.js +153 -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/form/Form.d.ts +15 -9
- package/dist/esm/components/form/Form.js +53 -50
- package/dist/esm/components/form-field/FormField.js +24 -23
- 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/FunnelLayout.d.ts +1 -1
- package/dist/esm/components/funnel-layout/FunnelLayout.js +61 -110
- package/dist/esm/components/funnel-layout/parts/FunnelPage.js +8 -9
- package/dist/esm/components/funnel-layout/parts/FunnelPageActions.js +24 -24
- package/dist/esm/components/funnel-layout/parts/FunnelPageFooter.js +6 -7
- package/dist/esm/components/funnel-layout/parts/FunnelPageHeader.d.ts +2 -2
- package/dist/esm/components/funnel-layout/parts/FunnelSidebar.d.ts +2 -2
- package/dist/esm/components/funnel-layout/parts/FunnelSidebar.js +9 -10
- package/dist/esm/components/funnel-layout/parts/FunnelTopBar.js +0 -1
- package/dist/esm/components/input/Input.js +28 -28
- package/dist/esm/components/label/Label.js +19 -19
- 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.js +21 -21
- 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/pagination/Pagination.js +97 -101
- package/dist/esm/components/pagination/parts/PaginationJumpDialog.js +39 -40
- 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-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 +50 -43
- package/dist/esm/components/table/Table.js +79 -76
- package/dist/esm/components/table/parts/TableBody.js +6 -6
- package/dist/esm/components/table/parts/TableCell.js +25 -25
- package/dist/esm/components/table/parts/TableColumnHeader.js +38 -38
- package/dist/esm/components/table/parts/TablePagination.js +61 -59
- package/dist/esm/components/table/parts/TableRow.js +16 -16
- package/dist/esm/components/tabs/parts/TabList.js +50 -54
- 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.js +74 -74
- package/dist/esm/components/task-menu/parts/Task.js +69 -69
- package/dist/esm/components/task-menu/parts/TaskGroup.js +45 -45
- 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-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 +1 -0
- package/dist/esm/index.js +22 -19
- 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 +25 -19
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsxs as s, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as r } from "react";
|
|
3
|
+
import { uyTv as u } from "@payfit/unity-themes";
|
|
4
|
+
import { Disclosure as c, DisclosurePanel as d, DisclosureStateContext as y, Heading as f, Button as p } from "react-aria-components";
|
|
5
|
+
import { FormattedMessage as m } from "react-intl";
|
|
6
|
+
import { Icon as h } from "../../icon/Icon.js";
|
|
7
|
+
import { Text as b } from "../../text/Text.js";
|
|
8
|
+
const n = u({
|
|
9
|
+
slots: {
|
|
10
|
+
base: [
|
|
11
|
+
"uy:w-full uy:rounded-50",
|
|
12
|
+
"uy:data-[focus-visible-within=true]:not-has-data-[focus-visible-within=true]:outline-2",
|
|
13
|
+
"uy:data-[focus-visible-within=true]:not-has-data-[focus-visible-within=true]:outline-solid",
|
|
14
|
+
"uy:data-[focus-visible-within=true]:not-has-data-[focus-visible-within=true]:outline-offset-2",
|
|
15
|
+
"uy:data-[focus-visible-within=true]:not-has-data-[focus-visible-within=true]:outline-utility-focus-ring"
|
|
16
|
+
],
|
|
17
|
+
heading: "uy:w-full",
|
|
18
|
+
button: [
|
|
19
|
+
"uy:flex uy:pb-100 uy:pt-100 uy:w-full uy:cursor-pointer",
|
|
20
|
+
"uy:hover:text-content-neutral-hover uy:focus-visible:outline-none"
|
|
21
|
+
],
|
|
22
|
+
title: "uy:flex uy:grow uy:text-left uy:items-center uy:justify-center",
|
|
23
|
+
icon: "uy:mr-100 uy:transition-transform uy:duration-150 uy:ease-linear uy:origin-center",
|
|
24
|
+
content: "uy:transition-all uy:transition-discrete uy:duration-200 uy:origin-top-left uy:aria-hidden:opacity-0 uy:aria-hidden:scale-y-0"
|
|
25
|
+
},
|
|
26
|
+
variants: {
|
|
27
|
+
isExpanded: {
|
|
28
|
+
true: {
|
|
29
|
+
icon: "uy:rotate-180"
|
|
30
|
+
},
|
|
31
|
+
false: {
|
|
32
|
+
icon: "uy:rotate-0"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}), v = () => {
|
|
37
|
+
const e = r(y), { button: i, title: o, icon: a, heading: l } = n({
|
|
38
|
+
isExpanded: e?.isExpanded
|
|
39
|
+
});
|
|
40
|
+
return /* @__PURE__ */ t(f, { "data-dd-privacy": "allow", className: l(), children: /* @__PURE__ */ t(p, { className: i(), slot: "trigger", children: /* @__PURE__ */ s(b, { variant: "bodyStrong", className: o(), children: [
|
|
41
|
+
/* @__PURE__ */ t(
|
|
42
|
+
h,
|
|
43
|
+
{
|
|
44
|
+
src: "CaretDownOutlined",
|
|
45
|
+
className: a(),
|
|
46
|
+
role: "presentation"
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
/* @__PURE__ */ t(
|
|
50
|
+
m,
|
|
51
|
+
{
|
|
52
|
+
id: "unity:component:error-state:collapsible:title",
|
|
53
|
+
defaultMessage: "Show details"
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
] }) }) });
|
|
57
|
+
}, w = ({ children: e, ...i }) => {
|
|
58
|
+
const { base: o, content: a } = n();
|
|
59
|
+
return /* @__PURE__ */ s(c, { "data-dd-privacy": "allow", ...i, className: o(), children: [
|
|
60
|
+
/* @__PURE__ */ t(v, {}),
|
|
61
|
+
/* @__PURE__ */ t(d, { "data-dd-privacy": "allow", className: a(), children: /* @__PURE__ */ t("div", { className: "uy:ml-400 uy:typography-body", children: e }) })
|
|
62
|
+
] });
|
|
63
|
+
};
|
|
64
|
+
w.displayName = "Collapsible";
|
|
65
|
+
export {
|
|
66
|
+
w as Collapsible
|
|
67
|
+
};
|
|
@@ -1,25 +1,31 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
1
|
+
import { default as React, PropsWithChildren, Ref } from 'react';
|
|
2
|
+
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
3
|
import { FormProps as AriaFormProps } from 'react-aria-components';
|
|
3
4
|
import { FieldErrors, UseFormReturn } from 'react-hook-form';
|
|
4
|
-
import { infer as ZodInfer } from 'zod';
|
|
5
5
|
import { Schema, TFormValues } from '../../hooks/use-form.types.js';
|
|
6
6
|
type AllowedAriaFormProps = Omit<AriaFormProps, 'action' | 'onSubmit' | 'method' | 'target' | 'validationErrors' | 'onInvalid'>;
|
|
7
|
-
export interface FormProps<TSchema extends Schema,
|
|
7
|
+
export interface FormProps<TSchema extends Schema, TFormInputValues extends TFormValues = StandardSchemaV1.InferInput<TSchema>, TFormOutputs extends TFormValues = StandardSchemaV1.InferOutput<TSchema>, TActionResult = unknown> extends PropsWithChildren<AllowedAriaFormProps> {
|
|
8
8
|
/** The form instance from react-hook-form */
|
|
9
|
-
form: UseFormReturn<
|
|
9
|
+
form: UseFormReturn<TFormInputValues, any, TFormOutputs>;
|
|
10
10
|
/** The schema to validate the form data */
|
|
11
11
|
schema: TSchema;
|
|
12
12
|
/** The operations to execute when the form is submitted and the input data is valid */
|
|
13
|
-
action: (values:
|
|
13
|
+
action: (values: TFormOutputs) => Promise<TActionResult> | TActionResult;
|
|
14
14
|
/** Handle successful form submission (when the `action` callback resolves its promise or does not throw an error) */
|
|
15
|
-
onSuccess?: (result: TActionResult, data:
|
|
15
|
+
onSuccess?: (result: TActionResult, data: TFormOutputs) => void;
|
|
16
16
|
/** Handle form submission errors (when the `action` callback rejects its promise or throws an error) */
|
|
17
|
-
onError?: (error: unknown, data:
|
|
17
|
+
onError?: (error: unknown, data: TFormOutputs) => void;
|
|
18
18
|
/** Handle form validation errors (when form data is invalid) */
|
|
19
|
-
onInvalid?: (errors: FieldErrors) => void;
|
|
19
|
+
onInvalid?: (errors: FieldErrors<TFormInputValues>) => void;
|
|
20
20
|
/** Enable or disable `react-hook-form`'s devtools (only in development mode) */
|
|
21
21
|
debug?: boolean;
|
|
22
22
|
}
|
|
23
|
+
type FormComponent = {
|
|
24
|
+
<TSchema extends Schema, TFormInputValues extends TFormValues = StandardSchemaV1.InferInput<TSchema>, TFormOutputs extends TFormValues = StandardSchemaV1.InferOutput<TSchema>, TActionResult = unknown>(props: FormProps<TSchema, TFormInputValues, TFormOutputs, TActionResult> & {
|
|
25
|
+
ref?: Ref<HTMLFormElement>;
|
|
26
|
+
}): React.JSX.Element;
|
|
27
|
+
displayName?: string;
|
|
28
|
+
};
|
|
23
29
|
/**
|
|
24
30
|
* The `Form` component provides full state management for complex forms with validation by following a schema-based approach.
|
|
25
31
|
*
|
|
@@ -31,5 +37,5 @@ export interface FormProps<TSchema extends Schema, TForm extends TFormValues = Z
|
|
|
31
37
|
* $ yarn add zod react-hook-form
|
|
32
38
|
* ```
|
|
33
39
|
*/
|
|
34
|
-
declare const Form:
|
|
40
|
+
declare const Form: FormComponent;
|
|
35
41
|
export { Form };
|
|
@@ -1,54 +1,57 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as F, Suspense as
|
|
3
|
-
import { FormProvider as
|
|
4
|
-
import { UnityFormProvider as
|
|
5
|
-
const
|
|
6
|
-
() => import("@hookform/devtools").then((
|
|
7
|
-
),
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
(
|
|
30
|
-
|
|
1
|
+
import { jsx as e, jsxs as v, Fragment as y } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as F, Suspense as b, lazy as S } from "react";
|
|
3
|
+
import { FormProvider as x } from "react-hook-form";
|
|
4
|
+
import { UnityFormProvider as P } from "./Form.context.js";
|
|
5
|
+
const j = S(
|
|
6
|
+
() => import("@hookform/devtools").then((o) => ({ default: o.DevTool }))
|
|
7
|
+
), D = ({
|
|
8
|
+
form: o,
|
|
9
|
+
schema: t,
|
|
10
|
+
onSuccess: m,
|
|
11
|
+
onError: i,
|
|
12
|
+
onInvalid: l,
|
|
13
|
+
action: c,
|
|
14
|
+
children: s,
|
|
15
|
+
className: a,
|
|
16
|
+
onReset: d,
|
|
17
|
+
debug: f = !1,
|
|
18
|
+
...p
|
|
19
|
+
}, u) => {
|
|
20
|
+
const h = o.handleSubmit(
|
|
21
|
+
(r) => {
|
|
22
|
+
Promise.resolve().then(() => c(r)).then((n) => {
|
|
23
|
+
m?.(n, r);
|
|
24
|
+
}).catch((n) => {
|
|
25
|
+
i?.(n, r);
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
(r) => {
|
|
29
|
+
l?.(r);
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
return /* @__PURE__ */ e(P, { schema: t, children: /* @__PURE__ */ v(x, { ...o, children: [
|
|
33
|
+
f && /* @__PURE__ */ e(b, { fallback: /* @__PURE__ */ e(y, {}), children: /* @__PURE__ */ e(j, { control: o.control }) }),
|
|
34
|
+
/* @__PURE__ */ e(
|
|
35
|
+
"form",
|
|
36
|
+
{
|
|
37
|
+
...p,
|
|
38
|
+
ref: u,
|
|
39
|
+
onSubmit: (r) => {
|
|
40
|
+
h(r);
|
|
41
|
+
},
|
|
42
|
+
className: a,
|
|
43
|
+
onReset: d,
|
|
44
|
+
"data-dd-privacy": "mask",
|
|
45
|
+
children: s
|
|
31
46
|
}
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
onSubmit: (t) => {
|
|
41
|
-
y(t);
|
|
42
|
-
},
|
|
43
|
-
className: d,
|
|
44
|
-
onReset: h,
|
|
45
|
-
"data-dd-privacy": "mask",
|
|
46
|
-
children: a
|
|
47
|
-
}
|
|
48
|
-
)
|
|
49
|
-
] }) });
|
|
50
|
-
}
|
|
51
|
-
);
|
|
47
|
+
)
|
|
48
|
+
] }) });
|
|
49
|
+
}, T = F(function(t, m) {
|
|
50
|
+
return D(
|
|
51
|
+
t,
|
|
52
|
+
m
|
|
53
|
+
);
|
|
54
|
+
});
|
|
52
55
|
T.displayName = "Form";
|
|
53
56
|
export {
|
|
54
57
|
T as Form
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import n, { forwardRef as H, useMemo as d } from "react";
|
|
3
3
|
import { uyTv as L } from "@payfit/unity-themes";
|
|
4
|
-
import { useController as
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
4
|
+
import { useController as S } from "react-hook-form";
|
|
5
|
+
import P from "../../hooks/use-id.js";
|
|
6
|
+
import { createSchemaAdapter as g } from "../../utils/createSchemaAdapter.js";
|
|
7
|
+
import { useUnityFormProvider as j } from "../form/Form.context.js";
|
|
8
|
+
import { FormFieldProvider as D } from "./FormField.context.js";
|
|
9
|
+
import { FormContextualLink as E } from "./parts/FormContextualLink.js";
|
|
10
|
+
import { FormHelperText as I } from "./parts/FormHelperText.js";
|
|
11
|
+
import { isFieldRequired as N } from "./utils/isFieldRequired.js";
|
|
12
|
+
const _ = L({
|
|
12
13
|
slots: {
|
|
13
14
|
base: "uy:flex uy:flex-col uy:gap-100"
|
|
14
15
|
}
|
|
15
|
-
}),
|
|
16
|
+
}), w = H(
|
|
16
17
|
({
|
|
17
18
|
children: o,
|
|
18
19
|
control: f,
|
|
@@ -23,19 +24,19 @@ const N = L({
|
|
|
23
24
|
isRequired: F,
|
|
24
25
|
isDisabled: h
|
|
25
26
|
}, y) => {
|
|
26
|
-
const b =
|
|
27
|
-
() =>
|
|
27
|
+
const b = P(), { schema: t } = j(), { formState: i } = S({ name: r, control: f }), C = d(
|
|
28
|
+
() => N(g(t), r),
|
|
28
29
|
[t, r]
|
|
29
30
|
), { hasHelperText: R, hasContextualLink: T } = d(() => {
|
|
30
|
-
let s = !1,
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
if (!
|
|
34
|
-
const e =
|
|
35
|
-
e.type ===
|
|
31
|
+
let s = !1, m = !1;
|
|
32
|
+
const l = (v) => {
|
|
33
|
+
n.Children.forEach(v, (a) => {
|
|
34
|
+
if (!n.isValidElement(a)) return;
|
|
35
|
+
const e = a;
|
|
36
|
+
e.type === I ? s = !0 : e.type === E && (m = !0), e.props && typeof e.props == "object" && "children" in e.props && l(e.props.children);
|
|
36
37
|
});
|
|
37
38
|
};
|
|
38
|
-
return
|
|
39
|
+
return l(o), { hasHelperText: s, hasContextualLink: m };
|
|
39
40
|
}, [o]), k = {
|
|
40
41
|
name: r,
|
|
41
42
|
isLoading: u,
|
|
@@ -45,11 +46,11 @@ const N = L({
|
|
|
45
46
|
id: b,
|
|
46
47
|
isRequired: F ?? C,
|
|
47
48
|
isDisabled: h ?? (i.isSubmitting || i.disabled)
|
|
48
|
-
}, { base: q } =
|
|
49
|
-
return /* @__PURE__ */ p("div", { ref: y, className: q({ className: x }), children: /* @__PURE__ */ p(
|
|
49
|
+
}, { base: q } = _();
|
|
50
|
+
return /* @__PURE__ */ p("div", { ref: y, className: q({ className: x }), children: /* @__PURE__ */ p(D, { ...k, children: o }) });
|
|
50
51
|
}
|
|
51
52
|
);
|
|
52
|
-
|
|
53
|
+
w.displayName = "FormField";
|
|
53
54
|
export {
|
|
54
|
-
|
|
55
|
+
w as FormField
|
|
55
56
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StandardSchema } from '../../../types/schema.js';
|
|
2
2
|
/**
|
|
3
|
-
* Determines if a field is required based on its path in a
|
|
4
|
-
* @param schema - The
|
|
3
|
+
* Determines if a field is required based on its path in a schema
|
|
4
|
+
* @param schema - The schema adapter object
|
|
5
5
|
* @param fieldPath - The path to the field (e.g., "preferences.marketing")
|
|
6
6
|
* @returns true if the field is required, false if optional or not found
|
|
7
7
|
*/
|
|
8
|
-
export declare function isFieldRequired(schema:
|
|
8
|
+
export declare function isFieldRequired(schema: StandardSchema | null | undefined, fieldPath: string): boolean;
|
|
@@ -1,23 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const n = s.split(".");
|
|
6
|
-
let a = r.shape, e;
|
|
7
|
-
for (let t = 0; t < n.length; t++) {
|
|
8
|
-
const l = n[t];
|
|
9
|
-
if (e = a[l], !e) return !1;
|
|
10
|
-
if (t < n.length - 1) {
|
|
11
|
-
const i = e instanceof f.ZodOptional ? e._def.innerType.shape : e.shape;
|
|
12
|
-
if (!i) return !1;
|
|
13
|
-
a = i;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return e ? !(e instanceof f.ZodOptional) : !1;
|
|
17
|
-
} catch {
|
|
18
|
-
return !1;
|
|
19
|
-
}
|
|
1
|
+
function l(e, t) {
|
|
2
|
+
if (!e) return !1;
|
|
3
|
+
const i = e.getField(t);
|
|
4
|
+
return i ? !i.isOptional : !1;
|
|
20
5
|
}
|
|
21
6
|
export {
|
|
22
|
-
|
|
7
|
+
l as isFieldRequired
|
|
23
8
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as React, PropsWithChildren } from 'react';
|
|
2
2
|
import { VariantProps } from '@payfit/unity-themes';
|
|
3
|
-
export declare const funnelLayout: import('tailwind-variants').TVReturnType<{} | {} | {}, undefined, "uy:relative uy:h-dvh uy:flex uy:flex-col uy:bg-canvas", {} | {}, undefined, import('tailwind-variants').TVReturnType<unknown, undefined, "uy:relative uy:h-dvh uy:flex uy:flex-col uy:bg-canvas", unknown, unknown, undefined>>;
|
|
3
|
+
export declare const funnelLayout: import('tailwind-variants').TVReturnType<{} | {} | {}, undefined, "uy:relative uy:h-dvh uy:flex uy:flex-col uy:bg-canvas uy:overflow-auto", {} | {}, undefined, import('tailwind-variants').TVReturnType<unknown, undefined, "uy:relative uy:h-dvh uy:flex uy:flex-col uy:bg-canvas uy:overflow-auto", unknown, unknown, undefined>>;
|
|
4
4
|
export interface FunnelLayoutProps extends PropsWithChildren<VariantProps<typeof funnelLayout>> {
|
|
5
5
|
/** The header content for the funnel layout, typically a FunnelTopBar component */
|
|
6
6
|
header: React.JSX.Element;
|
|
@@ -1,128 +1,79 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { uyTv as
|
|
4
|
-
import { useId as
|
|
5
|
-
import { FormattedMessage as
|
|
6
|
-
import {
|
|
1
|
+
import { jsx as e, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as s, useMemo as f } from "react";
|
|
3
|
+
import { uyTv as y } from "@payfit/unity-themes";
|
|
4
|
+
import { useId as p } from "react-aria";
|
|
5
|
+
import { FormattedMessage as o } from "react-intl";
|
|
6
|
+
import { SkipLinks as c, SkipLink as a } from "../skip-links/SkipLinks.js";
|
|
7
7
|
import { FunnelLayoutProvider as m } from "./FunnelLayout.context.js";
|
|
8
|
-
const
|
|
9
|
-
base: "uy:relative uy:h-dvh uy:flex uy:flex-col uy:bg-canvas"
|
|
10
|
-
}),
|
|
11
|
-
({ children:
|
|
12
|
-
const
|
|
8
|
+
const I = y({
|
|
9
|
+
base: "uy:relative uy:h-dvh uy:flex uy:flex-col uy:bg-canvas uy:overflow-auto"
|
|
10
|
+
}), k = s(
|
|
11
|
+
({ children: u, header: l, ...r }, d) => {
|
|
12
|
+
const n = p(), t = f(
|
|
13
13
|
() => ({
|
|
14
|
-
mainContentId: `funnel-main-content-${
|
|
15
|
-
topbarId: `funnel-top-bar-${
|
|
16
|
-
asideId: `funnel-complementary-left-content-${
|
|
17
|
-
funnelTitleId: `funnel-title-${
|
|
18
|
-
funnelDescriptionId: `funnel-description-${
|
|
19
|
-
funnelStatusId: `funnel-status-${
|
|
20
|
-
footerId: `funnel-footer-${
|
|
14
|
+
mainContentId: `funnel-main-content-${n}`,
|
|
15
|
+
topbarId: `funnel-top-bar-${n}`,
|
|
16
|
+
asideId: `funnel-complementary-left-content-${n}`,
|
|
17
|
+
funnelTitleId: `funnel-title-${n}`,
|
|
18
|
+
funnelDescriptionId: `funnel-description-${n}`,
|
|
19
|
+
funnelStatusId: `funnel-status-${n}`,
|
|
20
|
+
footerId: `funnel-footer-${n}`
|
|
21
21
|
}),
|
|
22
|
-
[
|
|
22
|
+
[n]
|
|
23
23
|
);
|
|
24
|
-
return /* @__PURE__ */
|
|
24
|
+
return /* @__PURE__ */ e(m, { ids: t, children: /* @__PURE__ */ i(
|
|
25
25
|
"div",
|
|
26
26
|
{
|
|
27
27
|
"data-dd-privacy": "mask-user-input",
|
|
28
|
-
...
|
|
29
|
-
ref:
|
|
30
|
-
className:
|
|
28
|
+
...r,
|
|
29
|
+
ref: d,
|
|
30
|
+
className: I(),
|
|
31
31
|
"data-unity-component": "FunnelLayout",
|
|
32
32
|
children: [
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"a",
|
|
65
|
-
{
|
|
66
|
-
href: `#${t.mainContentId}`,
|
|
67
|
-
tabIndex: 0,
|
|
68
|
-
className: i(),
|
|
69
|
-
children: /* @__PURE__ */ n(
|
|
70
|
-
a,
|
|
71
|
-
{
|
|
72
|
-
id: "unity:layout:funnel:skip-links:main-content",
|
|
73
|
-
defaultMessage: "Main content"
|
|
74
|
-
}
|
|
75
|
-
)
|
|
76
|
-
}
|
|
77
|
-
) }),
|
|
78
|
-
/* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
|
|
79
|
-
"a",
|
|
80
|
-
{
|
|
81
|
-
href: `#${t.asideId}`,
|
|
82
|
-
tabIndex: 0,
|
|
83
|
-
className: i(),
|
|
84
|
-
children: /* @__PURE__ */ n(
|
|
85
|
-
a,
|
|
86
|
-
{
|
|
87
|
-
id: "unity:layout:funnel:skip-links:sidebar",
|
|
88
|
-
defaultMessage: "Sidebar"
|
|
89
|
-
}
|
|
90
|
-
)
|
|
91
|
-
}
|
|
92
|
-
) }),
|
|
93
|
-
/* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
|
|
94
|
-
"a",
|
|
95
|
-
{
|
|
96
|
-
href: `#${t.footerId}`,
|
|
97
|
-
tabIndex: 0,
|
|
98
|
-
className: i(),
|
|
99
|
-
children: /* @__PURE__ */ n(
|
|
100
|
-
a,
|
|
101
|
-
{
|
|
102
|
-
id: "unity:layout:funnel:skip-links:footer",
|
|
103
|
-
defaultMessage: "Footer"
|
|
104
|
-
}
|
|
105
|
-
)
|
|
106
|
-
}
|
|
107
|
-
) })
|
|
108
|
-
] })
|
|
109
|
-
]
|
|
110
|
-
}
|
|
111
|
-
),
|
|
112
|
-
/* @__PURE__ */ n(
|
|
33
|
+
/* @__PURE__ */ i(c, { children: [
|
|
34
|
+
/* @__PURE__ */ e(a, { targetId: t.topbarId, children: /* @__PURE__ */ e(
|
|
35
|
+
o,
|
|
36
|
+
{
|
|
37
|
+
id: "unity:layout:funnel:skip-links:top-bar",
|
|
38
|
+
defaultMessage: "Top bar"
|
|
39
|
+
}
|
|
40
|
+
) }),
|
|
41
|
+
/* @__PURE__ */ e(a, { targetId: t.mainContentId, children: /* @__PURE__ */ e(
|
|
42
|
+
o,
|
|
43
|
+
{
|
|
44
|
+
id: "unity:layout:funnel:skip-links:main-content",
|
|
45
|
+
defaultMessage: "Main content"
|
|
46
|
+
}
|
|
47
|
+
) }),
|
|
48
|
+
/* @__PURE__ */ e(a, { targetId: t.asideId, children: /* @__PURE__ */ e(
|
|
49
|
+
o,
|
|
50
|
+
{
|
|
51
|
+
id: "unity:layout:funnel:skip-links:sidebar",
|
|
52
|
+
defaultMessage: "Sidebar"
|
|
53
|
+
}
|
|
54
|
+
) }),
|
|
55
|
+
/* @__PURE__ */ e(a, { targetId: t.footerId, children: /* @__PURE__ */ e(
|
|
56
|
+
o,
|
|
57
|
+
{
|
|
58
|
+
id: "unity:layout:funnel:skip-links:footer",
|
|
59
|
+
defaultMessage: "Footer"
|
|
60
|
+
}
|
|
61
|
+
) })
|
|
62
|
+
] }),
|
|
63
|
+
/* @__PURE__ */ e(
|
|
113
64
|
"div",
|
|
114
65
|
{
|
|
115
66
|
"data-unity-component": "FunnelTopBar",
|
|
116
67
|
className: "uy:sticky uy:top-0 uy:z-10",
|
|
117
|
-
children:
|
|
68
|
+
children: l
|
|
118
69
|
}
|
|
119
70
|
),
|
|
120
|
-
/* @__PURE__ */
|
|
71
|
+
/* @__PURE__ */ e(
|
|
121
72
|
"div",
|
|
122
73
|
{
|
|
123
|
-
className: "uy:flex-1 uy:flex uy:md:block uy:overflow-
|
|
74
|
+
className: "uy:flex-1 uy:flex uy:md:block uy:overflow-visible",
|
|
124
75
|
"data-unity-slot": "funnel-layout-content-wrapper",
|
|
125
|
-
children:
|
|
76
|
+
children: u
|
|
126
77
|
}
|
|
127
78
|
)
|
|
128
79
|
]
|
|
@@ -130,8 +81,8 @@ const h = f({
|
|
|
130
81
|
) });
|
|
131
82
|
}
|
|
132
83
|
);
|
|
133
|
-
|
|
84
|
+
k.displayName = "FunnelLayout";
|
|
134
85
|
export {
|
|
135
|
-
|
|
136
|
-
|
|
86
|
+
k as FunnelLayout,
|
|
87
|
+
I as funnelLayout
|
|
137
88
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { uyTv as
|
|
2
|
+
import { forwardRef as o } from "react";
|
|
3
|
+
import { uyTv as d } from "@payfit/unity-themes";
|
|
4
4
|
import { useFunnelLayoutContext as i } from "../FunnelLayout.context.js";
|
|
5
|
-
const
|
|
5
|
+
const l = d({
|
|
6
6
|
base: [
|
|
7
7
|
"uy:group/funnelpage uy:bg-surface-neutral uy:p-100 uy:pb-500 uy:md:shadow-raising uy:md:border-border-neutral uy:md:border uy:md:border-solid uy:md:rounded-400",
|
|
8
8
|
"uy:basis-full uy:shrink-0 uy:grow-1 uy:md:shrink",
|
|
9
9
|
"uy:flex uy:flex-col",
|
|
10
10
|
"uy:md:max-w-container-lg uy:lg:max-w-container-xl"
|
|
11
11
|
]
|
|
12
|
-
}),
|
|
12
|
+
}), t = o(
|
|
13
13
|
({ children: n, ...r }, u) => {
|
|
14
14
|
const { ids: e } = i();
|
|
15
15
|
return /* @__PURE__ */ a(
|
|
@@ -21,16 +21,15 @@ const t = o({
|
|
|
21
21
|
id: e.mainContentId,
|
|
22
22
|
"aria-labelledby": e.funnelTitleId,
|
|
23
23
|
"aria-describedby": e.funnelDescriptionId,
|
|
24
|
-
|
|
25
|
-
className: t(),
|
|
24
|
+
className: l(),
|
|
26
25
|
"data-unity-component": "FunnelPage",
|
|
27
26
|
children: n
|
|
28
27
|
}
|
|
29
28
|
);
|
|
30
29
|
}
|
|
31
30
|
);
|
|
32
|
-
|
|
31
|
+
t.displayName = "FunnelPage";
|
|
33
32
|
export {
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
t as FunnelPage,
|
|
34
|
+
l as funnelPage
|
|
36
35
|
};
|