@cerberus-design/react 0.18.3 → 0.18.4
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/build/legacy/_tsup-dts-rollup.d.cts +87 -25
- package/build/legacy/components/FileStatus.cjs +34 -26
- package/build/legacy/components/FileStatus.cjs.map +1 -1
- package/build/legacy/components/Text.cjs +17 -23
- package/build/legacy/components/Text.cjs.map +1 -1
- package/build/legacy/components/checkbox/checkbox.cjs +17 -23
- package/build/legacy/components/checkbox/checkbox.cjs.map +1 -1
- package/build/legacy/components/checkbox/index.cjs +17 -23
- package/build/legacy/components/checkbox/index.cjs.map +1 -1
- package/build/legacy/components/cta-dialog/index.cjs +44 -35
- package/build/legacy/components/cta-dialog/index.cjs.map +1 -1
- package/build/legacy/components/cta-dialog/provider.cjs +44 -35
- package/build/legacy/components/cta-dialog/provider.cjs.map +1 -1
- package/build/legacy/components/date-picker/date-picker.cjs.map +1 -1
- package/build/legacy/components/date-picker/day-view.d.cts +1 -1
- package/build/legacy/components/date-picker/index.cjs +29 -21
- package/build/legacy/components/date-picker/index.cjs.map +1 -1
- package/build/legacy/components/date-picker/index.d.cts +6 -0
- package/build/legacy/components/date-picker/input.cjs +2 -2
- package/build/legacy/components/date-picker/input.cjs.map +1 -1
- package/build/legacy/components/date-picker/range-input.cjs +2 -9
- package/build/legacy/components/date-picker/range-input.cjs.map +1 -1
- package/build/legacy/components/deprecated/Label.cjs.map +1 -1
- package/build/legacy/components/dialog/close-icon-trigger.cjs.map +1 -1
- package/build/legacy/components/dialog/dialog.cjs +2 -2
- package/build/legacy/components/dialog/dialog.cjs.map +1 -1
- package/build/legacy/components/dialog/index.cjs +2 -2
- package/build/legacy/components/dialog/index.cjs.map +1 -1
- package/build/legacy/components/dialog/index.d.cts +1 -0
- package/build/legacy/components/dialog/parts.cjs +2 -2
- package/build/legacy/components/dialog/parts.cjs.map +1 -1
- package/build/legacy/components/dialog/primitives.cjs +2 -2
- package/build/legacy/components/dialog/primitives.cjs.map +1 -1
- package/build/legacy/components/field/field.cjs +15 -9
- package/build/legacy/components/field/field.cjs.map +1 -1
- package/build/legacy/components/field/helper-text.cjs +53 -0
- package/build/legacy/components/field/helper-text.cjs.map +1 -0
- package/build/legacy/components/field/helper-text.d.cts +1 -0
- package/build/legacy/components/field/index.cjs +15 -9
- package/build/legacy/components/field/index.cjs.map +1 -1
- package/build/legacy/components/field/parts.cjs +0 -1
- package/build/legacy/components/field/parts.cjs.map +1 -1
- package/build/legacy/components/field/primitives.cjs +0 -1
- package/build/legacy/components/field/primitives.cjs.map +1 -1
- package/build/legacy/context/confirm-modal.cjs +85 -58
- package/build/legacy/context/confirm-modal.cjs.map +1 -1
- package/build/legacy/context/field.cjs.map +1 -1
- package/build/legacy/context/prompt-modal.cjs +120 -118
- package/build/legacy/context/prompt-modal.cjs.map +1 -1
- package/build/legacy/index.cjs +767 -715
- package/build/legacy/index.cjs.map +1 -1
- package/build/legacy/index.d.cts +11 -0
- package/build/legacy/types.cjs.map +1 -1
- package/build/legacy/types.d.cts +1 -0
- package/build/modern/_tsup-dts-rollup.d.ts +87 -25
- package/build/modern/chunk-2U2JYN3D.js +15 -0
- package/build/modern/chunk-2U2JYN3D.js.map +1 -0
- package/build/modern/chunk-ADI4DOEW.js +17 -0
- package/build/modern/chunk-ADI4DOEW.js.map +1 -0
- package/build/modern/{chunk-GBCF6DOS.js → chunk-AN65HXHS.js} +2 -2
- package/build/modern/{chunk-Z2KBUTCO.js → chunk-BMDNCJUB.js} +2 -2
- package/build/modern/chunk-BMDNCJUB.js.map +1 -0
- package/build/modern/{chunk-F3XFJHGR.js → chunk-D7PY357P.js} +2 -2
- package/build/modern/{chunk-ILROS7ST.js → chunk-DVCTN3GN.js} +2 -2
- package/build/modern/{chunk-NP73HOHI.js → chunk-GJBUGESH.js} +3 -3
- package/build/modern/{chunk-NP73HOHI.js.map → chunk-GJBUGESH.js.map} +1 -1
- package/build/modern/{chunk-KABRV6TB.js → chunk-JXWNDJJW.js} +3 -3
- package/build/modern/{chunk-SSR3CWJZ.js → chunk-LUGOJGMO.js} +4 -4
- package/build/modern/chunk-LUGOJGMO.js.map +1 -0
- package/build/modern/{chunk-3IT3V3YA.js → chunk-M3TZCQ7J.js} +4 -4
- package/build/modern/{chunk-WEL43I6Y.js → chunk-OK3VJFQL.js} +1 -2
- package/build/modern/{chunk-WEL43I6Y.js.map → chunk-OK3VJFQL.js.map} +1 -1
- package/build/modern/{chunk-ADZRQNW3.js → chunk-P7FPAUWN.js} +3 -9
- package/build/modern/chunk-P7FPAUWN.js.map +1 -0
- package/build/modern/{chunk-OY7BOKWW.js → chunk-QBA6KLL7.js} +2 -2
- package/build/modern/chunk-RMSM3XPV.js +218 -0
- package/build/modern/chunk-RMSM3XPV.js.map +1 -0
- package/build/modern/{chunk-LEBDLXJE.js → chunk-RTLS6K4E.js} +9 -6
- package/build/modern/chunk-RTLS6K4E.js.map +1 -0
- package/build/modern/{chunk-A5UXCB4L.js → chunk-SHBKM6EW.js} +43 -34
- package/build/modern/chunk-SHBKM6EW.js.map +1 -0
- package/build/modern/{chunk-CEJIKL6N.js → chunk-T44C3KQO.js} +1 -1
- package/build/modern/chunk-T44C3KQO.js.map +1 -0
- package/build/modern/{chunk-V6EAWUCQ.js → chunk-TRT6OCHJ.js} +2 -2
- package/build/modern/chunk-WSOITM7D.js +182 -0
- package/build/modern/chunk-WSOITM7D.js.map +1 -0
- package/build/modern/chunk-ZPHPCKAG.js +41 -0
- package/build/modern/chunk-ZPHPCKAG.js.map +1 -0
- package/build/modern/components/FileStatus.js +5 -4
- package/build/modern/components/Text.js +1 -1
- package/build/modern/components/admonition/admonition.js +2 -2
- package/build/modern/components/admonition/index.js +2 -2
- package/build/modern/components/checkbox/checkbox.js +2 -2
- package/build/modern/components/checkbox/index.js +2 -2
- package/build/modern/components/cta-dialog/index.js +5 -5
- package/build/modern/components/cta-dialog/provider.js +5 -5
- package/build/modern/components/date-picker/date-picker.js +1 -1
- package/build/modern/components/date-picker/day-view.d.ts +1 -1
- package/build/modern/components/date-picker/index.d.ts +6 -0
- package/build/modern/components/date-picker/index.js +16 -5
- package/build/modern/components/date-picker/input.js +1 -1
- package/build/modern/components/date-picker/range-input.js +1 -2
- package/build/modern/components/deprecated/Label.js +5 -4
- package/build/modern/components/dialog/close-icon-trigger.js +2 -2
- package/build/modern/components/dialog/dialog.js +2 -2
- package/build/modern/components/dialog/index.d.ts +1 -0
- package/build/modern/components/dialog/index.js +4 -4
- package/build/modern/components/dialog/parts.js +2 -2
- package/build/modern/components/dialog/primitives.js +1 -1
- package/build/modern/components/field/field.js +3 -2
- package/build/modern/components/field/helper-text.d.ts +1 -0
- package/build/modern/components/field/helper-text.js +11 -0
- package/build/modern/components/field/index.js +4 -3
- package/build/modern/components/field/parts.js +2 -2
- package/build/modern/components/field/primitives.js +1 -1
- package/build/modern/components/notifications/index.js +1 -1
- package/build/modern/context/confirm-modal.js +5 -5
- package/build/modern/context/field.js +1 -1
- package/build/modern/context/prompt-modal.js +10 -9
- package/build/modern/index.d.ts +11 -0
- package/build/modern/index.js +52 -40
- package/build/modern/index.js.map +1 -1
- package/build/modern/types.d.ts +1 -0
- package/package.json +10 -9
- package/src/components/Text.tsx +20 -23
- package/src/components/cta-dialog/provider.tsx +6 -1
- package/src/components/date-picker/date-picker.tsx +8 -5
- package/src/components/date-picker/index.ts +10 -0
- package/src/components/date-picker/input.tsx +1 -1
- package/src/components/date-picker/range-input.tsx +9 -24
- package/src/components/dialog/dialog.tsx +4 -2
- package/src/components/dialog/index.ts +4 -0
- package/src/components/dialog/primitives.tsx +7 -4
- package/src/components/field/field.tsx +11 -9
- package/src/components/field/helper-text.tsx +20 -0
- package/src/components/field/primitives.tsx +0 -3
- package/src/context/confirm-modal.tsx +52 -30
- package/src/context/prompt-modal.tsx +36 -31
- package/src/types.ts +21 -0
- package/build/modern/chunk-A5UXCB4L.js.map +0 -1
- package/build/modern/chunk-ADZRQNW3.js.map +0 -1
- package/build/modern/chunk-CEJIKL6N.js.map +0 -1
- package/build/modern/chunk-DHKSNGQX.js +0 -156
- package/build/modern/chunk-DHKSNGQX.js.map +0 -1
- package/build/modern/chunk-L64HQGLQ.js +0 -47
- package/build/modern/chunk-L64HQGLQ.js.map +0 -1
- package/build/modern/chunk-LEBDLXJE.js.map +0 -1
- package/build/modern/chunk-P7DWMM56.js +0 -210
- package/build/modern/chunk-P7DWMM56.js.map +0 -1
- package/build/modern/chunk-SSR3CWJZ.js.map +0 -1
- package/build/modern/chunk-U3ISYEUF.js +0 -1
- package/build/modern/chunk-Z2KBUTCO.js.map +0 -1
- /package/build/modern/{chunk-GBCF6DOS.js.map → chunk-AN65HXHS.js.map} +0 -0
- /package/build/modern/{chunk-F3XFJHGR.js.map → chunk-D7PY357P.js.map} +0 -0
- /package/build/modern/{chunk-ILROS7ST.js.map → chunk-DVCTN3GN.js.map} +0 -0
- /package/build/modern/{chunk-KABRV6TB.js.map → chunk-JXWNDJJW.js.map} +0 -0
- /package/build/modern/{chunk-3IT3V3YA.js.map → chunk-M3TZCQ7J.js.map} +0 -0
- /package/build/modern/{chunk-OY7BOKWW.js.map → chunk-QBA6KLL7.js.map} +0 -0
- /package/build/modern/{chunk-V6EAWUCQ.js.map → chunk-TRT6OCHJ.js.map} +0 -0
- /package/build/modern/{chunk-U3ISYEUF.js.map → components/field/helper-text.js.map} +0 -0
|
@@ -6,15 +6,15 @@ import {
|
|
|
6
6
|
} from "./chunk-QD3WAARV.js";
|
|
7
7
|
import {
|
|
8
8
|
DialogCloseIconTrigger
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-D7PY357P.js";
|
|
10
10
|
import {
|
|
11
11
|
Dialog
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-BMDNCJUB.js";
|
|
13
13
|
import {
|
|
14
14
|
DialogDescription,
|
|
15
15
|
DialogHeading,
|
|
16
16
|
DialogProvider
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-LUGOJGMO.js";
|
|
18
18
|
import {
|
|
19
19
|
Avatar
|
|
20
20
|
} from "./chunk-CF4TCMJI.js";
|
|
@@ -68,38 +68,47 @@ function CTAModal(props) {
|
|
|
68
68
|
);
|
|
69
69
|
return /* @__PURE__ */ jsxs(CTAModalContext.Provider, { value, children: [
|
|
70
70
|
props.children,
|
|
71
|
-
/* @__PURE__ */ jsx(DialogProvider, { open, onOpenChange: (e) => setOpen(e.open), children: /* @__PURE__ */ jsxs(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
71
|
+
/* @__PURE__ */ jsx(DialogProvider, { open, onOpenChange: (e) => setOpen(e.open), children: /* @__PURE__ */ jsxs(
|
|
72
|
+
Dialog,
|
|
73
|
+
{
|
|
74
|
+
size: "sm",
|
|
75
|
+
style: {
|
|
76
|
+
"--dialog-content-min-h": "auto"
|
|
77
|
+
},
|
|
78
|
+
children: [
|
|
79
|
+
/* @__PURE__ */ jsx(DialogCloseIconTrigger, {}),
|
|
80
|
+
/* @__PURE__ */ jsxs(VStack, { gap: "xl", w: "full", children: [
|
|
81
|
+
/* @__PURE__ */ jsx(VStack, { alignItems: "flex-start", gap: "md", w: "full", children: /* @__PURE__ */ jsxs(VStack, { gap: "lg", w: "full", children: [
|
|
82
|
+
/* @__PURE__ */ jsx(
|
|
83
|
+
Avatar,
|
|
81
84
|
{
|
|
82
|
-
|
|
83
|
-
fallback: /* @__PURE__ */ jsx(
|
|
84
|
-
|
|
85
|
+
gradient: "charon-light",
|
|
86
|
+
fallback: /* @__PURE__ */ jsx(
|
|
87
|
+
Show,
|
|
88
|
+
{
|
|
89
|
+
when: confirmIcon,
|
|
90
|
+
fallback: /* @__PURE__ */ jsx(FallbackIcon, { size: 24 }),
|
|
91
|
+
children: confirmIcon
|
|
92
|
+
}
|
|
93
|
+
)
|
|
85
94
|
}
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
95
|
+
),
|
|
96
|
+
/* @__PURE__ */ jsx(DialogHeading, { children: content?.heading }),
|
|
97
|
+
/* @__PURE__ */ jsx(DialogDescription, { children: content?.description })
|
|
98
|
+
] }) }),
|
|
99
|
+
/* @__PURE__ */ jsx(HStack, { gap: "md", w: "full", children: /* @__PURE__ */ jsx(For, { each: content?.actions._actions, children: (action, index) => /* @__PURE__ */ jsx(
|
|
100
|
+
Show,
|
|
101
|
+
{
|
|
102
|
+
when: content?.actions?.type === "btnAction",
|
|
103
|
+
fallback: /* @__PURE__ */ jsx(TriggerItem, { asChild: true, children: action }),
|
|
104
|
+
children: /* @__PURE__ */ jsx(TriggerItem, { "data-index": index, onClick: handleActionClick, children: action?.text })
|
|
105
|
+
},
|
|
106
|
+
index
|
|
107
|
+
) }) })
|
|
108
|
+
] })
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
) })
|
|
103
112
|
] });
|
|
104
113
|
}
|
|
105
114
|
function useCTAModal() {
|
|
@@ -114,4 +123,4 @@ export {
|
|
|
114
123
|
CTAModal,
|
|
115
124
|
useCTAModal
|
|
116
125
|
};
|
|
117
|
-
//# sourceMappingURL=chunk-
|
|
126
|
+
//# sourceMappingURL=chunk-SHBKM6EW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/cta-dialog/provider.tsx"],"sourcesContent":["'use client'\n\nimport {\n useCallback,\n useContext,\n useMemo,\n useState,\n type MouseEvent,\n type PropsWithChildren,\n type ReactNode,\n} from 'react'\nimport { HStack, VStack } from 'styled-system/jsx'\nimport { useCerberusContext } from '../../context/cerberus'\nimport { Show } from '../Show'\nimport { For } from '../for'\nimport { Avatar } from '../avatar/avatar'\nimport {\n Dialog,\n DialogDescription,\n DialogHeading,\n DialogProvider,\n} from '../dialog'\nimport { DialogCloseIconTrigger } from '../dialog/close-icon-trigger'\nimport type { CTAButtonAction, CTAModalActionReturn } from './utils'\nimport {\n CTAModalContext,\n type CTAModalValue,\n type ShowCTAModalOptions,\n} from './context'\nimport { TriggerItem } from './trigger-item'\n\n/**\n * This module provides the provider and hook for the cta modal.\n * @module 'react/cta-modal/provider'\n */\n\n/**\n * Provides a CTA modal to the app.\n * @see https://cerberus.digitalu.design/react/cta-modal\n * @example\n * ```tsx\n * // Wrap the Provider around the root of the feature.\n * <CTAModal>\n * <SomeFeatureSection />\n * </CTAModal>\n *\n * // Use the hook to show the cta modal.\n * const cta = useCTAModal()\n *\n * const handleClick = useCallback(async () => {\n * const userConsent = await cta.show({\n * heading: 'Create or copy a Cohort',\n * description:\n * 'Create a new cohort or copy and existing one.',\n * icon: <Copy size={24} />,\n * actions: [\n * {\n * text: 'Create Cohort',\n * onClick: () => {},\n * {\n * text: 'Copy Cohort',\n * onClick: () => {}\n * }\n * })\n * setConsent(userConsent)\n * }, [cta])\n * ```\n */\nexport function CTAModal(props: PropsWithChildren<object>) {\n const [open, setOpen] = useState<boolean>(false)\n const [content, setContent] = useState<ShowCTAModalOptions | null>(null)\n const confirmIcon = content?.icon\n\n const { icons } = useCerberusContext()\n const { confirmModal: FallbackIcon } = icons\n\n const handleShow = useCallback(\n (options: ShowCTAModalOptions) => {\n setContent({ ...options })\n setOpen(true)\n },\n [setOpen],\n )\n\n const handleActionClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n const index = Number(event.currentTarget.getAttribute('data-index'))\n const contentActions = content?.actions as CTAModalActionReturn\n const action = contentActions._actions[index] as CTAButtonAction\n action?.handleClick?.(event)\n setOpen(false)\n },\n [content, setOpen],\n )\n\n const value = useMemo(\n () => ({\n show: handleShow,\n }),\n [handleShow],\n )\n\n return (\n <CTAModalContext.Provider value={value}>\n {props.children}\n\n <DialogProvider open={open} onOpenChange={(e) => setOpen(e.open)}>\n <Dialog\n size=\"sm\"\n style={{\n '--dialog-content-min-h': 'auto',\n }}\n >\n <DialogCloseIconTrigger />\n\n <VStack gap=\"xl\" w=\"full\">\n <VStack alignItems=\"flex-start\" gap=\"md\" w=\"full\">\n <VStack gap=\"lg\" w=\"full\">\n <Avatar\n gradient=\"charon-light\"\n fallback={\n <Show\n when={confirmIcon}\n fallback={<FallbackIcon size={24} />}\n >\n {confirmIcon}\n </Show>\n }\n />\n <DialogHeading>{content?.heading}</DialogHeading>\n <DialogDescription>{content?.description}</DialogDescription>\n </VStack>\n </VStack>\n\n <HStack gap=\"md\" w=\"full\">\n <For each={content?.actions._actions}>\n {(action, index) => (\n <Show\n key={index}\n when={content?.actions?.type === 'btnAction'}\n fallback={\n <TriggerItem asChild>{action as ReactNode}</TriggerItem>\n }\n >\n <TriggerItem data-index={index} onClick={handleActionClick}>\n {(action as CTAButtonAction)?.text}\n </TriggerItem>\n </Show>\n )}\n </For>\n </HStack>\n </VStack>\n </Dialog>\n </DialogProvider>\n </CTAModalContext.Provider>\n )\n}\n\nexport function useCTAModal(): CTAModalValue {\n const context = useContext(CTAModalContext)\n if (context === null) {\n throw new Error('useCTAModal must be used within a CTAModal Provider')\n }\n return context\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP,SAAS,QAAQ,cAAc;AAsGrB,cAII,YAJJ;AA7CH,SAAS,SAAS,OAAkC;AACzD,QAAM,CAAC,MAAM,OAAO,IAAI,SAAkB,KAAK;AAC/C,QAAM,CAAC,SAAS,UAAU,IAAI,SAAqC,IAAI;AACvE,QAAM,cAAc,SAAS;AAE7B,QAAM,EAAE,MAAM,IAAI,mBAAmB;AACrC,QAAM,EAAE,cAAc,aAAa,IAAI;AAEvC,QAAM,aAAa;AAAA,IACjB,CAAC,YAAiC;AAChC,i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WAAC,QAAQ,UACR;AAAA,cAAC;AAAA;AAAA,gBAEC,MAAM,SAAS,SAAS,SAAS;AAAA,gBACjC,UACE,oBAAC,eAAY,SAAO,MAAE,kBAAoB;AAAA,gBAG5C,8BAAC,eAAY,cAAY,OAAO,SAAS,mBACrC,kBAA4B,MAChC;AAAA;AAAA,cARK;AAAA,YASP,GAEJ,GACF;AAAA,aACF;AAAA;AAAA;AAAA,IACF,GACF;AAAA,KACF;AAEJ;AAEO,SAAS,cAA6B;AAC3C,QAAM,UAAU,WAAW,eAAe;AAC1C,MAAI,YAAY,MAAM;AACpB,UAAM,IAAI,MAAM,qDAAqD;AAAA,EACvE;AACA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/date-picker/date-picker.tsx"],"sourcesContent":["import type { DatePickerRootProps } from '@ark-ui/react/date-picker'\nimport { DatePickerParts } from './parts'\n\n/**\n * This module contains an abstraction of the DatePicker.Root primitive.\n * @module 'date-picker/root'\n */\n\n/**\n * DatePicker component is an abstraction of the DatePickerRoot primitive which\n * is the context provider to the DatePicker.\n * @description [Cerberus Docs](https://cerberus.digitalu.design/react/date-picker)\n * @description [Ark Docs](https://ark-ui.com/react/docs/components/date-picker)\n */\nexport function DatePicker(props: DatePickerRootProps) {\n // const handleFormat = useCallback((date: DateValue) => {\n // const day = date.day.toString().padStart(2, '0')\n // const year = date.year.toString()\n // const formattedMonth = new DateFormatter('en-US', {\n // month: 'short',\n // }).format(date.toDate(getLocalTimeZone()))\n\n // // Format the date as \"DD MMM YYYY\"\n // return `${day} ${formattedMonth} ${year}`\n // }, [])\n\n return (\n <DatePickerParts.Root\n {...props}\n positioning={{\n placement: 'bottom-start',\n }}\n />\n )\n}\n"],"mappings":";;;;;AA2BI;AAbG,SAAS,WAAW,OAA4B;AAYrD,SACE;AAAA,IAAC,gBAAgB;AAAA,IAAhB;AAAA,MACE,GAAG;AAAA,MACJ,aAAa;AAAA,QACX,WAAW;AAAA,MACb;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
DialogPositioner,
|
|
8
8
|
DialogRoot,
|
|
9
9
|
DialogTrigger
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-LUGOJGMO.js";
|
|
11
11
|
|
|
12
12
|
// src/components/dialog/parts.ts
|
|
13
13
|
var DialogParts = {
|
|
@@ -24,4 +24,4 @@ var DialogParts = {
|
|
|
24
24
|
export {
|
|
25
25
|
DialogParts
|
|
26
26
|
};
|
|
27
|
-
//# sourceMappingURL=chunk-
|
|
27
|
+
//# sourceMappingURL=chunk-TRT6OCHJ.js.map
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Dialog
|
|
3
|
+
} from "./chunk-BMDNCJUB.js";
|
|
4
|
+
import {
|
|
5
|
+
DialogCloseTrigger,
|
|
6
|
+
DialogDescription,
|
|
7
|
+
DialogHeading,
|
|
8
|
+
DialogProvider
|
|
9
|
+
} from "./chunk-LUGOJGMO.js";
|
|
10
|
+
import {
|
|
11
|
+
Button
|
|
12
|
+
} from "./chunk-GB7W3YNU.js";
|
|
13
|
+
import {
|
|
14
|
+
Avatar
|
|
15
|
+
} from "./chunk-CF4TCMJI.js";
|
|
16
|
+
import {
|
|
17
|
+
useCerberusContext
|
|
18
|
+
} from "./chunk-GITT5645.js";
|
|
19
|
+
import {
|
|
20
|
+
Show
|
|
21
|
+
} from "./chunk-VEAC4I3F.js";
|
|
22
|
+
|
|
23
|
+
// src/context/confirm-modal.tsx
|
|
24
|
+
import {
|
|
25
|
+
createContext,
|
|
26
|
+
useCallback,
|
|
27
|
+
useContext,
|
|
28
|
+
useMemo,
|
|
29
|
+
useRef,
|
|
30
|
+
useState
|
|
31
|
+
} from "react";
|
|
32
|
+
import { css } from "styled-system/css";
|
|
33
|
+
import { HStack, VStack } from "styled-system/jsx";
|
|
34
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
35
|
+
var ConfirmModalContext = createContext(null);
|
|
36
|
+
function ConfirmModal(props) {
|
|
37
|
+
const [open, setOpen] = useState(false);
|
|
38
|
+
const [content, setContent] = useState(null);
|
|
39
|
+
const resolveRef = useRef(null);
|
|
40
|
+
const kind = content?.kind ?? "non-destructive";
|
|
41
|
+
const { icons } = useCerberusContext();
|
|
42
|
+
const { confirmModal: ConfirmIcon } = icons;
|
|
43
|
+
const palette = useMemo(
|
|
44
|
+
() => kind === "destructive" ? "danger" : "action",
|
|
45
|
+
[kind]
|
|
46
|
+
);
|
|
47
|
+
const handleChoice = useCallback(
|
|
48
|
+
(e) => {
|
|
49
|
+
const target = e.currentTarget;
|
|
50
|
+
if (target.value === "true") {
|
|
51
|
+
resolveRef.current?.(true);
|
|
52
|
+
}
|
|
53
|
+
resolveRef.current?.(false);
|
|
54
|
+
setOpen(false);
|
|
55
|
+
},
|
|
56
|
+
[setOpen]
|
|
57
|
+
);
|
|
58
|
+
const handleShow = useCallback(
|
|
59
|
+
(options) => {
|
|
60
|
+
return new Promise((resolve) => {
|
|
61
|
+
setContent({ ...options });
|
|
62
|
+
setOpen(true);
|
|
63
|
+
resolveRef.current = resolve;
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
[setOpen, setContent]
|
|
67
|
+
);
|
|
68
|
+
const handleOpenChange = useCallback(
|
|
69
|
+
({ open: open2 }) => {
|
|
70
|
+
setOpen(open2);
|
|
71
|
+
if (!open2) {
|
|
72
|
+
resolveRef.current?.(null);
|
|
73
|
+
resolveRef.current = null;
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
[setOpen]
|
|
77
|
+
);
|
|
78
|
+
const value = useMemo(
|
|
79
|
+
() => ({
|
|
80
|
+
show: handleShow
|
|
81
|
+
}),
|
|
82
|
+
[handleShow]
|
|
83
|
+
);
|
|
84
|
+
return /* @__PURE__ */ jsxs(ConfirmModalContext.Provider, { value, children: [
|
|
85
|
+
props.children,
|
|
86
|
+
/* @__PURE__ */ jsx(DialogProvider, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsx(
|
|
87
|
+
Dialog,
|
|
88
|
+
{
|
|
89
|
+
size: "sm",
|
|
90
|
+
style: {
|
|
91
|
+
"--dialog-content-min-h": "auto"
|
|
92
|
+
},
|
|
93
|
+
children: /* @__PURE__ */ jsxs(
|
|
94
|
+
VStack,
|
|
95
|
+
{
|
|
96
|
+
alignItems: "flex-start",
|
|
97
|
+
gap: "md",
|
|
98
|
+
justify: "space-between",
|
|
99
|
+
w: "full",
|
|
100
|
+
children: [
|
|
101
|
+
/* @__PURE__ */ jsx(
|
|
102
|
+
HStack,
|
|
103
|
+
{
|
|
104
|
+
alignSelf: "center",
|
|
105
|
+
justify: "center",
|
|
106
|
+
paddingBlockEnd: "md",
|
|
107
|
+
w: "full",
|
|
108
|
+
children: /* @__PURE__ */ jsx(
|
|
109
|
+
Show,
|
|
110
|
+
{
|
|
111
|
+
when: palette === "danger",
|
|
112
|
+
fallback: /* @__PURE__ */ jsx(
|
|
113
|
+
Avatar,
|
|
114
|
+
{
|
|
115
|
+
gradient: "charon-light",
|
|
116
|
+
fallback: /* @__PURE__ */ jsx(ConfirmIcon, { size: 24 })
|
|
117
|
+
}
|
|
118
|
+
),
|
|
119
|
+
children: /* @__PURE__ */ jsx(
|
|
120
|
+
Avatar,
|
|
121
|
+
{
|
|
122
|
+
gradient: "hades-dark",
|
|
123
|
+
fallback: /* @__PURE__ */ jsx(ConfirmIcon, { size: 24 })
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
),
|
|
130
|
+
/* @__PURE__ */ jsx(DialogHeading, { children: content?.heading }),
|
|
131
|
+
/* @__PURE__ */ jsx(Show, { when: content?.description, children: /* @__PURE__ */ jsx(DialogDescription, { children: content?.description }) }),
|
|
132
|
+
/* @__PURE__ */ jsxs(HStack, { gap: "md", pt: "md", w: "full", children: [
|
|
133
|
+
/* @__PURE__ */ jsx(
|
|
134
|
+
Button,
|
|
135
|
+
{
|
|
136
|
+
autoFocus: true,
|
|
137
|
+
className: css({
|
|
138
|
+
w: "1/2"
|
|
139
|
+
}),
|
|
140
|
+
name: "confirm",
|
|
141
|
+
onClick: handleChoice,
|
|
142
|
+
palette,
|
|
143
|
+
value: "true",
|
|
144
|
+
children: content?.actionText
|
|
145
|
+
}
|
|
146
|
+
),
|
|
147
|
+
/* @__PURE__ */ jsx(DialogCloseTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
148
|
+
Button,
|
|
149
|
+
{
|
|
150
|
+
className: css({
|
|
151
|
+
w: "1/2"
|
|
152
|
+
}),
|
|
153
|
+
name: "cancel",
|
|
154
|
+
onClick: handleChoice,
|
|
155
|
+
usage: "outlined",
|
|
156
|
+
value: "false",
|
|
157
|
+
children: content?.cancelText
|
|
158
|
+
}
|
|
159
|
+
) })
|
|
160
|
+
] })
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
)
|
|
164
|
+
}
|
|
165
|
+
) })
|
|
166
|
+
] });
|
|
167
|
+
}
|
|
168
|
+
function useConfirmModal() {
|
|
169
|
+
const context = useContext(ConfirmModalContext);
|
|
170
|
+
if (context === null) {
|
|
171
|
+
throw new Error(
|
|
172
|
+
"useConfirmModal must be used within a ConfirmModal Provider"
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
return context;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export {
|
|
179
|
+
ConfirmModal,
|
|
180
|
+
useConfirmModal
|
|
181
|
+
};
|
|
182
|
+
//# sourceMappingURL=chunk-WSOITM7D.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/context/confirm-modal.tsx"],"sourcesContent":["'use client'\n\nimport {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState,\n type MouseEvent,\n type PropsWithChildren,\n type ReactNode,\n} from 'react'\nimport { css } from 'styled-system/css'\nimport { HStack, VStack } from 'styled-system/jsx'\nimport { Button } from '../components/button/button'\nimport { Show } from '../components/Show'\nimport { Avatar } from '../components/avatar/avatar'\nimport {\n Dialog,\n DialogCloseTrigger,\n DialogDescription,\n DialogHeading,\n DialogProvider,\n type OpenChangeDetails,\n} from '../components/dialog'\nimport { useCerberusContext } from './cerberus'\n\n/**\n * This module provides a context and hook for the confirm modal.\n * @module\n */\n\nexport interface BaseConfirmOptions {\n /**\n * The heading of the confirm modal.\n */\n heading: string\n /**\n * The text for the action button.\n */\n actionText: string\n /**\n * The text for the cancel button.\n */\n cancelText: string\n}\n\nexport interface DestructiveConfirmOptions extends BaseConfirmOptions {\n /**\n * The kind of confirm modal to show.\n */\n kind?: 'destructive'\n /**\n * The description of the confirm modal. Can only be a string for destructive confirm modals.\n */\n description?: string\n}\n\nexport interface NonDestructiveConfirmModalOptions extends BaseConfirmOptions {\n /**\n * The kind of confirm modal to show.\n * @default 'non-destructive'\n */\n kind?: 'non-destructive'\n /**\n * The description of the confirm modal. Can be a ReactNode for non-destructive kind if you need to display text links.\n * @example\n * ```tsx\n * description: <>Use a Fragment because we put the content within a Paragraph tag.</>\n */\n description?: ReactNode\n}\n\nexport type ShowConfirmModalOptions =\n | NonDestructiveConfirmModalOptions\n | DestructiveConfirmOptions\n\nexport type ShowResult = ((value: boolean | null) => void) | null\n\nexport interface ConfirmModalValue {\n show: (options: ShowConfirmModalOptions) => Promise<boolean | null>\n}\n\nconst ConfirmModalContext = createContext<ConfirmModalValue | null>(null)\n\nexport type ConfirmModalProviderProps = PropsWithChildren<unknown>\n\n/**\n * Provides a confirm modal to the app.\n * @see https://cerberus.digitalu.design/react/confirm-modal\n * @example\n * ```tsx\n * // Wrap the Provider around the root of the feature.\n * <ConfirmModal>\n * <SomeFeatureSection />\n * </ConfirmModal>\n *\n * // Use the hook to show the confirm modal.\n * const confirm = useConfirmModal()\n *\n * const handleClick = useCallback(async () => {\n * const userConsent = await confirm.show({\n * heading: 'Add new payment method?',\n * description:\n * 'This will add a new payment method to your account to be billed for future purchases.',\n * actionText: 'Yes, add payment method',\n * cancelText: 'No, cancel',\n * })\n * setConsent(userConsent)\n * }, [confirm])\n * ```\n */\nexport function ConfirmModal(\n props: PropsWithChildren<ConfirmModalProviderProps>,\n) {\n const [open, setOpen] = useState<boolean>(false)\n const [content, setContent] = useState<ShowConfirmModalOptions | null>(null)\n const resolveRef = useRef<ShowResult>(null)\n const kind = content?.kind ?? 'non-destructive'\n\n const { icons } = useCerberusContext()\n const { confirmModal: ConfirmIcon } = icons\n\n const palette = useMemo(\n () => (kind === 'destructive' ? 'danger' : 'action'),\n [kind],\n )\n\n const handleChoice = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n const target = e.currentTarget as HTMLButtonElement\n if (target.value === 'true') {\n resolveRef.current?.(true)\n }\n resolveRef.current?.(false)\n setOpen(false)\n },\n [setOpen],\n )\n\n const handleShow = useCallback(\n (options: ShowConfirmModalOptions) => {\n return new Promise<boolean | null>((resolve) => {\n setContent({ ...options })\n setOpen(true)\n resolveRef.current = resolve\n })\n },\n [setOpen, setContent],\n )\n\n const handleOpenChange = useCallback(\n ({ open }: OpenChangeDetails) => {\n setOpen(open)\n if (!open) {\n resolveRef.current?.(null)\n resolveRef.current = null\n }\n },\n [setOpen],\n )\n\n const value = useMemo(\n () => ({\n show: handleShow,\n }),\n [handleShow],\n )\n\n return (\n <ConfirmModalContext.Provider value={value}>\n {props.children}\n\n <DialogProvider open={open} onOpenChange={handleOpenChange}>\n <Dialog\n size=\"sm\"\n style={{\n '--dialog-content-min-h': 'auto',\n }}\n >\n <VStack\n alignItems=\"flex-start\"\n gap=\"md\"\n justify=\"space-between\"\n w=\"full\"\n >\n <HStack\n alignSelf=\"center\"\n justify=\"center\"\n paddingBlockEnd=\"md\"\n w=\"full\"\n >\n <Show\n when={palette === 'danger'}\n fallback={\n <Avatar\n gradient=\"charon-light\"\n fallback={<ConfirmIcon size={24} />}\n />\n }\n >\n <Avatar\n gradient=\"hades-dark\"\n fallback={<ConfirmIcon size={24} />}\n />\n </Show>\n </HStack>\n\n <DialogHeading>{content?.heading}</DialogHeading>\n\n <Show when={content?.description}>\n <DialogDescription>{content?.description}</DialogDescription>\n </Show>\n\n <HStack gap=\"md\" pt=\"md\" w=\"full\">\n <Button\n autoFocus\n className={css({\n w: '1/2',\n })}\n name=\"confirm\"\n onClick={handleChoice}\n palette={palette}\n value=\"true\"\n >\n {content?.actionText}\n </Button>\n <DialogCloseTrigger asChild>\n <Button\n className={css({\n w: '1/2',\n })}\n name=\"cancel\"\n onClick={handleChoice}\n usage=\"outlined\"\n value=\"false\"\n >\n {content?.cancelText}\n </Button>\n </DialogCloseTrigger>\n </HStack>\n </VStack>\n </Dialog>\n </DialogProvider>\n </ConfirmModalContext.Provider>\n )\n}\n\nexport function useConfirmModal(): ConfirmModalValue {\n const context = useContext(ConfirmModalContext)\n if (context === null) {\n throw new Error(\n 'useConfirmModal must be used within a ConfirmModal Provider',\n )\n }\n return context\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP,SAAS,WAAW;AACpB,SAAS,QAAQ,cAAc;AAwLD,cAiBlB,YAjBkB;AAlH9B,IAAM,sBAAsB,cAAwC,IAAI;AA6BjE,SAAS,aACd,OACA;AACA,QAAM,CAAC,MAAM,OAAO,IAAI,SAAkB,KAAK;AAC/C,QAAM,CAAC,SAAS,UAAU,IAAI,SAAyC,IAAI;AAC3E,QAAM,aAAa,OAAmB,IAAI;AAC1C,QAAM,OAAO,SAAS,QAAQ;AAE9B,QAAM,EAAE,MAAM,IAAI,mBAAmB;AACrC,QAAM,EAAE,cAAc,YAAY,IAAI;AAEtC,QAAM,UAAU;AAAA,IACd,MAAO,SAAS,gBAAgB,WAAW;AAAA,IAC3C,CAAC,IAAI;AAAA,EACP;AAEA,QAAM,eAAe;AAAA,IACnB,CAAC,MA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
|
8
|
+
H5,
|
|
9
|
+
H6,
|
|
10
|
+
P,
|
|
11
|
+
Small,
|
|
12
|
+
Span,
|
|
13
|
+
Strong
|
|
14
|
+
} from "styled-system/jsx";
|
|
15
|
+
import { jsx } from "react/jsx-runtime";
|
|
16
|
+
function Text(props) {
|
|
17
|
+
const { as = "p", ...pandaJSXProps } = props;
|
|
18
|
+
const cache = {
|
|
19
|
+
h1: H1,
|
|
20
|
+
h2: H2,
|
|
21
|
+
h3: H3,
|
|
22
|
+
h4: H4,
|
|
23
|
+
h5: H5,
|
|
24
|
+
h6: H6,
|
|
25
|
+
strong: Strong,
|
|
26
|
+
em: Em,
|
|
27
|
+
small: Small,
|
|
28
|
+
span: Span,
|
|
29
|
+
p: P
|
|
30
|
+
};
|
|
31
|
+
if (as in cache) {
|
|
32
|
+
const Component = cache[as];
|
|
33
|
+
return /* @__PURE__ */ jsx(Component, { ...pandaJSXProps });
|
|
34
|
+
}
|
|
35
|
+
return /* @__PURE__ */ jsx(P, { ...pandaJSXProps });
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export {
|
|
39
|
+
Text
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=chunk-ZPHPCKAG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/Text.tsx"],"sourcesContent":["import {\n Em,\n H1,\n H2,\n H3,\n H4,\n H5,\n H6,\n P,\n Small,\n Span,\n Strong,\n type PProps,\n} from 'styled-system/jsx'\n\n/**\n * This module exports a component for rendering text utilizing the styled-system JSX utility.\n * @module @cerberus/react/Text\n */\n\nexport type Headings = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'\nexport type TextElements = 'p' | 'strong' | 'em' | 'small' | 'span'\n\n// For some reason we have to use the HTMLParagraphElement type here\n// or else TS will fail for non-style props like 'id' or 'className'\nexport interface TextProps extends PProps {\n /**\n * The element to render as. Defaults to 'p'.\n */\n as?: TextElements | Headings\n}\n\n/**\n * A component for rendering text utilizing the styled-system JSX utility.\n * @definition [Text docs](https://cerberus.digitalu.design/react/text)\n * @example\n * ```tsx\n * <Text as=\"h1\" color=\"page.text.100\" textStyle={{\n * base: 'heading-md',\n * md: 'heading-lg',\n * }}>\n * Hello, world!\n * </Text>\n */\nexport function Text(props: TextProps) {\n const { as = 'p', ...pandaJSXProps } = props\n\n const cache = {\n h1: H1,\n h2: H2,\n h3: H3,\n h4: H4,\n h5: H5,\n h6: H6,\n strong: Strong,\n em: Em,\n small: Small,\n span: Span,\n p: P,\n }\n\n if (as in cache) {\n const Component = cache[as as keyof typeof cache]\n return <Component {...pandaJSXProps} />\n }\n\n return <P {...pandaJSXProps} />\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAkDI;AAnBJ,SAAS,KAAK,OAAkB;AACrC,QAAM,EAAE,KAAK,KAAK,GAAG,cAAc,IAAI;AAEvC,QAAM,QAAQ;AAAA,IACZ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,QAAQ;AAAA,IACR,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,MAAM;AAAA,IACN,GAAG;AAAA,EACL;AAEA,MAAI,MAAM,OAAO;AACf,UAAM,YAAY,MAAM,EAAwB;AAChD,WAAO,oBAAC,aAAW,GAAG,eAAe;AAAA,EACvC;AAEA,SAAO,oBAAC,KAAG,GAAG,eAAe;AAC/B;","names":[]}
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
FileStatus,
|
|
4
4
|
processStatus
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-JXWNDJJW.js";
|
|
6
6
|
import "../chunk-TYPULJMJ.js";
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-DVCTN3GN.js";
|
|
8
|
+
import "../chunk-RTLS6K4E.js";
|
|
9
|
+
import "../chunk-2U2JYN3D.js";
|
|
10
|
+
import "../chunk-OK3VJFQL.js";
|
|
10
11
|
import "../chunk-EMDNETC7.js";
|
|
11
12
|
import "../chunk-VIKVLJGG.js";
|
|
12
13
|
import "../chunk-CF4TCMJI.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Admonition
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-NJ37QRAI.js";
|
|
3
|
+
} from "../../chunk-M3TZCQ7J.js";
|
|
5
4
|
import "../../chunk-JQYW4IOC.js";
|
|
6
5
|
import "../../chunk-OY33UHBG.js";
|
|
6
|
+
import "../../chunk-NJ37QRAI.js";
|
|
7
7
|
import "../../chunk-CF4TCMJI.js";
|
|
8
8
|
import "../../chunk-IUF74GEL.js";
|
|
9
9
|
import "../../chunk-UGFSACHC.js";
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import "../../chunk-UR2NYAQC.js";
|
|
2
2
|
import {
|
|
3
3
|
Admonition
|
|
4
|
-
} from "../../chunk-
|
|
5
|
-
import "../../chunk-NJ37QRAI.js";
|
|
4
|
+
} from "../../chunk-M3TZCQ7J.js";
|
|
6
5
|
import {
|
|
7
6
|
AdmonitionParts
|
|
8
7
|
} from "../../chunk-JQYW4IOC.js";
|
|
@@ -13,6 +12,7 @@ import {
|
|
|
13
12
|
AdmonitionIndicator,
|
|
14
13
|
AdmonitionRoot
|
|
15
14
|
} from "../../chunk-OY33UHBG.js";
|
|
15
|
+
import "../../chunk-NJ37QRAI.js";
|
|
16
16
|
import "../../chunk-CF4TCMJI.js";
|
|
17
17
|
import "../../chunk-IUF74GEL.js";
|
|
18
18
|
import "../../chunk-UGFSACHC.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Checkbox
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-QBA6KLL7.js";
|
|
4
4
|
import "../../chunk-NYEUNVKR.js";
|
|
5
5
|
import "../../chunk-52ZQ26IV.js";
|
|
6
6
|
import "../../chunk-ENJUQNVT.js";
|
|
7
|
-
import "../../chunk-
|
|
7
|
+
import "../../chunk-ZPHPCKAG.js";
|
|
8
8
|
import "../../chunk-GITT5645.js";
|
|
9
9
|
import "../../chunk-VEAC4I3F.js";
|
|
10
10
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../../chunk-TIJAFPHQ.js";
|
|
2
2
|
import {
|
|
3
3
|
Checkbox
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-QBA6KLL7.js";
|
|
5
5
|
import "../../chunk-NYEUNVKR.js";
|
|
6
6
|
import {
|
|
7
7
|
CheckboxParts
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
CheckboxLabel,
|
|
15
15
|
CheckboxRoot
|
|
16
16
|
} from "../../chunk-ENJUQNVT.js";
|
|
17
|
-
import "../../chunk-
|
|
17
|
+
import "../../chunk-ZPHPCKAG.js";
|
|
18
18
|
import "../../chunk-GITT5645.js";
|
|
19
19
|
import "../../chunk-VEAC4I3F.js";
|
|
20
20
|
export {
|
|
@@ -2,17 +2,17 @@ import "../../chunk-IKDXADLX.js";
|
|
|
2
2
|
import {
|
|
3
3
|
CTAModal,
|
|
4
4
|
useCTAModal
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-SHBKM6EW.js";
|
|
6
6
|
import "../../chunk-4LSTU6WU.js";
|
|
7
7
|
import "../../chunk-QD3WAARV.js";
|
|
8
8
|
import {
|
|
9
9
|
createCTAModalActions
|
|
10
10
|
} from "../../chunk-PLHYOCY3.js";
|
|
11
11
|
import "../../chunk-DJOYRUNT.js";
|
|
12
|
-
import "../../chunk-
|
|
13
|
-
import "../../chunk-
|
|
14
|
-
import "../../chunk-
|
|
15
|
-
import "../../chunk-
|
|
12
|
+
import "../../chunk-D7PY357P.js";
|
|
13
|
+
import "../../chunk-BMDNCJUB.js";
|
|
14
|
+
import "../../chunk-TRT6OCHJ.js";
|
|
15
|
+
import "../../chunk-LUGOJGMO.js";
|
|
16
16
|
import "../../chunk-GB7W3YNU.js";
|
|
17
17
|
import "../../chunk-CF4TCMJI.js";
|
|
18
18
|
import "../../chunk-IUF74GEL.js";
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import {
|
|
3
3
|
CTAModal,
|
|
4
4
|
useCTAModal
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-SHBKM6EW.js";
|
|
6
6
|
import "../../chunk-4LSTU6WU.js";
|
|
7
7
|
import "../../chunk-QD3WAARV.js";
|
|
8
8
|
import "../../chunk-DJOYRUNT.js";
|
|
9
|
-
import "../../chunk-
|
|
10
|
-
import "../../chunk-
|
|
11
|
-
import "../../chunk-
|
|
12
|
-
import "../../chunk-
|
|
9
|
+
import "../../chunk-D7PY357P.js";
|
|
10
|
+
import "../../chunk-BMDNCJUB.js";
|
|
11
|
+
import "../../chunk-TRT6OCHJ.js";
|
|
12
|
+
import "../../chunk-LUGOJGMO.js";
|
|
13
13
|
import "../../chunk-GB7W3YNU.js";
|
|
14
14
|
import "../../chunk-CF4TCMJI.js";
|
|
15
15
|
import "../../chunk-IUF74GEL.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { DatePickerDayView } from '../../_tsup-dts-rollup.js';
|
|
2
|
-
export { DateValue } from '../../_tsup-dts-rollup.js';
|
|
2
|
+
export { DateValue_alias_1 as DateValue } from '../../_tsup-dts-rollup.js';
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
export { parseDate_alias_1 as parseDate } from '../../_tsup-dts-rollup.js';
|
|
2
|
+
export { DateValue_alias_2 as DateValue } from '../../_tsup-dts-rollup.js';
|
|
3
|
+
export { CalendarDate_alias_1 as CalendarDate } from '../../_tsup-dts-rollup.js';
|
|
4
|
+
export { today_alias_1 as today } from '../../_tsup-dts-rollup.js';
|
|
5
|
+
export { getLocalTimeZone_alias_1 as getLocalTimeZone } from '../../_tsup-dts-rollup.js';
|
|
6
|
+
export { DateFormatter_alias_1 as DateFormatter } from '../../_tsup-dts-rollup.js';
|
|
1
7
|
export { DatePickerParts_alias_1 as DatePickerParts } from '../../_tsup-dts-rollup.js';
|
|
2
8
|
export { DatePickerLabel_alias_1 as DatePickerLabel } from '../../_tsup-dts-rollup.js';
|
|
3
9
|
export { DatePickerControl_alias_1 as DatePickerControl } from '../../_tsup-dts-rollup.js';
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
CalendarDate,
|
|
3
|
+
DateFormatter,
|
|
4
|
+
getLocalTimeZone,
|
|
5
|
+
parseDate,
|
|
6
|
+
today
|
|
7
|
+
} from "../../chunk-ADI4DOEW.js";
|
|
2
8
|
import {
|
|
3
9
|
RangePickerInput
|
|
4
|
-
} from "../../chunk-
|
|
10
|
+
} from "../../chunk-P7FPAUWN.js";
|
|
5
11
|
import {
|
|
6
12
|
DatePicker
|
|
7
|
-
} from "../../chunk-
|
|
13
|
+
} from "../../chunk-T44C3KQO.js";
|
|
8
14
|
import {
|
|
9
15
|
DatePickerInput
|
|
10
|
-
} from "../../chunk-
|
|
16
|
+
} from "../../chunk-GJBUGESH.js";
|
|
11
17
|
import "../../chunk-ZL7AX5EM.js";
|
|
12
18
|
import {
|
|
13
19
|
DatePickerCalendar
|
|
@@ -53,6 +59,8 @@ import "../../chunk-53YVHIGJ.js";
|
|
|
53
59
|
import "../../chunk-AUI74W7J.js";
|
|
54
60
|
import "../../chunk-VEAC4I3F.js";
|
|
55
61
|
export {
|
|
62
|
+
CalendarDate,
|
|
63
|
+
DateFormatter,
|
|
56
64
|
DatePicker,
|
|
57
65
|
DatePickerCalendar,
|
|
58
66
|
DatePickerClearTrigger,
|
|
@@ -81,6 +89,9 @@ export {
|
|
|
81
89
|
DatePickerViewControl,
|
|
82
90
|
DatePickerViewTrigger,
|
|
83
91
|
DatePickerYearSelect,
|
|
84
|
-
RangePickerInput
|
|
92
|
+
RangePickerInput,
|
|
93
|
+
getLocalTimeZone,
|
|
94
|
+
parseDate,
|
|
95
|
+
today
|
|
85
96
|
};
|
|
86
97
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Label
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-AN65HXHS.js";
|
|
4
4
|
import "../../chunk-TYPULJMJ.js";
|
|
5
|
-
import "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
5
|
+
import "../../chunk-DVCTN3GN.js";
|
|
6
|
+
import "../../chunk-RTLS6K4E.js";
|
|
7
|
+
import "../../chunk-2U2JYN3D.js";
|
|
8
|
+
import "../../chunk-OK3VJFQL.js";
|
|
8
9
|
import "../../chunk-EMDNETC7.js";
|
|
9
10
|
import "../../chunk-VIKVLJGG.js";
|
|
10
11
|
import "../../chunk-BL7G3577.js";
|