@cerberus-design/react 0.13.2-next-46f23d2 → 0.13.2-next-b5a889e
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 +297 -1
- package/build/legacy/components/Accordion.cjs.map +1 -1
- package/build/legacy/components/AccordionItemGroup.cjs.map +1 -1
- package/build/legacy/components/Admonition.cjs +3 -0
- package/build/legacy/components/Admonition.cjs.map +1 -1
- package/build/legacy/components/Avatar.cjs +3 -0
- package/build/legacy/components/Avatar.cjs.map +1 -1
- package/build/legacy/components/Checkbox.cjs +3 -0
- package/build/legacy/components/Checkbox.cjs.map +1 -1
- package/build/legacy/components/DatePicker.client.cjs +525 -0
- package/build/legacy/components/DatePicker.client.cjs.map +1 -0
- package/build/legacy/components/DatePicker.server.cjs +364 -0
- package/build/legacy/components/DatePicker.server.cjs.map +1 -0
- package/build/legacy/components/FileStatus.cjs +3 -0
- package/build/legacy/components/FileStatus.cjs.map +1 -1
- package/build/legacy/components/FileUploader.cjs +3 -0
- package/build/legacy/components/FileUploader.cjs.map +1 -1
- package/build/legacy/components/Input.cjs +3 -0
- package/build/legacy/components/Input.cjs.map +1 -1
- package/build/legacy/components/Notification.cjs +3 -0
- package/build/legacy/components/Notification.cjs.map +1 -1
- package/build/legacy/components/Select.cjs +3 -0
- package/build/legacy/components/Select.cjs.map +1 -1
- package/build/legacy/components/Tag.cjs +3 -0
- package/build/legacy/components/Tag.cjs.map +1 -1
- package/build/legacy/components/Toggle.cjs +3 -0
- package/build/legacy/components/Toggle.cjs.map +1 -1
- package/build/legacy/config/cerbIcons.cjs +3 -0
- package/build/legacy/config/cerbIcons.cjs.map +1 -1
- package/build/legacy/config/defineIcons.cjs +3 -0
- package/build/legacy/config/defineIcons.cjs.map +1 -1
- package/build/legacy/context/confirm-modal.cjs +3 -0
- package/build/legacy/context/confirm-modal.cjs.map +1 -1
- package/build/legacy/context/cta-modal.cjs +3 -0
- package/build/legacy/context/cta-modal.cjs.map +1 -1
- package/build/legacy/context/notification-center.cjs +3 -0
- package/build/legacy/context/notification-center.cjs.map +1 -1
- package/build/legacy/context/prompt-modal.cjs +3 -0
- package/build/legacy/context/prompt-modal.cjs.map +1 -1
- package/build/legacy/hooks/useDate.cjs +8 -0
- package/build/legacy/hooks/useDate.cjs.map +1 -1
- package/build/legacy/index.cjs +909 -613
- package/build/legacy/index.cjs.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.ts +297 -1
- package/build/modern/{chunk-ZTYKIWYQ.js → chunk-34E3UFFB.js} +1 -1
- package/build/modern/chunk-34E3UFFB.js.map +1 -0
- package/build/modern/{chunk-CZND26FC.js → chunk-3BM6MZ4A.js} +8 -1
- package/build/modern/{chunk-CZND26FC.js.map → chunk-3BM6MZ4A.js.map} +1 -1
- package/build/modern/{chunk-67KLFLNR.js → chunk-4IMOKN2D.js} +3 -3
- package/build/modern/{chunk-XNX3OTJK.js → chunk-5KHU6MM5.js} +7 -1
- package/build/modern/chunk-5KHU6MM5.js.map +1 -0
- package/build/modern/{chunk-C3HYHH3H.js → chunk-BU5JK37R.js} +2 -2
- package/build/modern/{chunk-UBN2CZLV.js → chunk-DDOTCGGA.js} +2 -2
- package/build/modern/{chunk-CMDPTXHB.js → chunk-ECKJGCNH.js} +6 -6
- package/build/modern/{chunk-W3YI64C5.js → chunk-F4LTOZAN.js} +2 -2
- package/build/modern/{chunk-SVFZJYLV.js → chunk-F7EWTOML.js} +2 -2
- package/build/modern/{chunk-CSMPRYNC.js → chunk-F7XWOSN3.js} +2 -2
- package/build/modern/{chunk-NF5WV3OW.js → chunk-FRWNAVDM.js} +6 -6
- package/build/modern/{chunk-42RVVWGM.js → chunk-G7AGKII3.js} +11 -11
- package/build/modern/{chunk-RET4YOBV.js → chunk-GI6CSUU4.js} +6 -6
- package/build/modern/{chunk-35L6DOHE.js → chunk-HP4ZN473.js} +2 -2
- package/build/modern/chunk-IP5VFOPZ.js +132 -0
- package/build/modern/chunk-IP5VFOPZ.js.map +1 -0
- package/build/modern/{chunk-RHHFH6JJ.js → chunk-M73ECA25.js} +2 -2
- package/build/modern/{chunk-OFAATLPF.js → chunk-O7QVCF3H.js} +3 -3
- package/build/modern/chunk-QX4V5V74.js +169 -0
- package/build/modern/chunk-QX4V5V74.js.map +1 -0
- package/build/modern/{chunk-3DGV4ESI.js → chunk-S25RHYZV.js} +2 -2
- package/build/modern/{chunk-PGXJJDPH.js → chunk-W2LSPRQ3.js} +2 -2
- package/build/modern/{chunk-MRH2EO3L.js → chunk-XVU2NQCW.js} +2 -2
- package/build/modern/components/Accordion.js +1 -1
- package/build/modern/components/AccordionItemGroup.js +2 -2
- package/build/modern/components/Admonition.js +4 -4
- package/build/modern/components/Avatar.js +3 -3
- package/build/modern/components/Checkbox.js +3 -3
- package/build/modern/components/DatePicker.client.js +32 -0
- package/build/modern/components/DatePicker.client.js.map +1 -0
- package/build/modern/components/DatePicker.server.js +31 -0
- package/build/modern/components/DatePicker.server.js.map +1 -0
- package/build/modern/components/FileStatus.js +5 -5
- package/build/modern/components/FileUploader.js +4 -4
- package/build/modern/components/Input.js +3 -3
- package/build/modern/components/Notification.js +3 -3
- package/build/modern/components/Select.js +3 -3
- package/build/modern/components/Tag.js +3 -3
- package/build/modern/components/Toggle.js +3 -3
- package/build/modern/config/cerbIcons.js +1 -1
- package/build/modern/config/defineIcons.js +2 -2
- package/build/modern/context/confirm-modal.js +5 -5
- package/build/modern/context/cta-modal.js +5 -5
- package/build/modern/context/notification-center.js +4 -4
- package/build/modern/context/prompt-modal.js +8 -8
- package/build/modern/hooks/useDate.js +3 -1
- package/build/modern/index.js +110 -68
- package/build/modern/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Accordion.tsx +0 -1
- package/src/components/DatePicker.client.tsx +364 -0
- package/src/components/DatePicker.server.tsx +229 -0
- package/src/config/cerbIcons.ts +9 -0
- package/src/hooks/useDate.ts +12 -0
- package/src/index.ts +2 -0
- package/build/modern/chunk-XNX3OTJK.js.map +0 -1
- package/build/modern/chunk-ZTYKIWYQ.js.map +0 -1
- /package/build/modern/{chunk-67KLFLNR.js.map → chunk-4IMOKN2D.js.map} +0 -0
- /package/build/modern/{chunk-C3HYHH3H.js.map → chunk-BU5JK37R.js.map} +0 -0
- /package/build/modern/{chunk-UBN2CZLV.js.map → chunk-DDOTCGGA.js.map} +0 -0
- /package/build/modern/{chunk-CMDPTXHB.js.map → chunk-ECKJGCNH.js.map} +0 -0
- /package/build/modern/{chunk-W3YI64C5.js.map → chunk-F4LTOZAN.js.map} +0 -0
- /package/build/modern/{chunk-SVFZJYLV.js.map → chunk-F7EWTOML.js.map} +0 -0
- /package/build/modern/{chunk-CSMPRYNC.js.map → chunk-F7XWOSN3.js.map} +0 -0
- /package/build/modern/{chunk-NF5WV3OW.js.map → chunk-FRWNAVDM.js.map} +0 -0
- /package/build/modern/{chunk-42RVVWGM.js.map → chunk-G7AGKII3.js.map} +0 -0
- /package/build/modern/{chunk-RET4YOBV.js.map → chunk-GI6CSUU4.js.map} +0 -0
- /package/build/modern/{chunk-35L6DOHE.js.map → chunk-HP4ZN473.js.map} +0 -0
- /package/build/modern/{chunk-RHHFH6JJ.js.map → chunk-M73ECA25.js.map} +0 -0
- /package/build/modern/{chunk-OFAATLPF.js.map → chunk-O7QVCF3H.js.map} +0 -0
- /package/build/modern/{chunk-3DGV4ESI.js.map → chunk-S25RHYZV.js.map} +0 -0
- /package/build/modern/{chunk-PGXJJDPH.js.map → chunk-W2LSPRQ3.js.map} +0 -0
- /package/build/modern/{chunk-MRH2EO3L.js.map → chunk-XVU2NQCW.js.map} +0 -0
|
@@ -190,6 +190,9 @@ function AnimatingUploadIcon(props) {
|
|
|
190
190
|
// src/config/cerbIcons.ts
|
|
191
191
|
var defaultIcons = {
|
|
192
192
|
avatar: import_icons.UserFilled,
|
|
193
|
+
calendar: import_icons.Calendar,
|
|
194
|
+
calendarPrev: import_icons.ChevronLeft,
|
|
195
|
+
calendarNext: import_icons.ChevronRight,
|
|
193
196
|
checkbox: CheckmarkIcon,
|
|
194
197
|
close: import_icons.Close,
|
|
195
198
|
confirmModal: import_icons.Information,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Checkbox.tsx","../../../src/components/Show.tsx","../../../src/context/field.tsx","../../../src/config/cerbIcons.ts","../../../src/config/icons/checkbox.icons.tsx","../../../src/components/AnimatingUploadIcon.tsx","../../../src/config/defineIcons.ts"],"sourcesContent":["'use client'\n\nimport {\n checkbox,\n type CheckboxVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport { vstack } from '@cerberus/styled-system/patterns'\nimport { cx } from '@cerberus/styled-system/css'\nimport type { InputHTMLAttributes } from 'react'\nimport { Show } from './Show'\nimport { useFieldContext } from '../context/field'\nimport { $cerberusIcons } from '../config/defineIcons'\n\n/**\n * This module contains the Checkbox component.\n * @module\n */\n\nexport type CheckboxProps = CheckboxVariantProps &\n Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'id'> & {\n /**\n * The id of the FieldMessage element describing the Checkbox.\n */\n describedBy?: string\n /**\n * The unique identifier for the checkbox. Required for accessibility.\n */\n id: string\n /**\n * Used to display a mixed checked state.\n * @description [ARIA Mixed State](https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/examples/checkbox-mixed/)\n */\n mixed?: boolean\n }\n\n/**\n * Checkbox component\n * @definition [ARIA Target Size](https://www.w3.org/WAI/WCAG21/Understanding/target-size.html#:~:text=Understanding%20SC%202.5.,%3ATarget%20Size%20(Level%20AAA)&text=The%20size%20of%20the%20target,Equivalent)\n * @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)\n * @see https://cerberus.digitalu.design/react/checkbox\n * @example\n * ```tsx\n * <Field>\n * <Checkbox id=\"legal\" checked={checked.legal} onChange={handleChange} />\n * </Field>\n * ```\n */\nexport function Checkbox(props: CheckboxProps) {\n const { describedBy, size, checked, mixed, ...nativeProps } = props\n const { invalid, ...fieldStates } = useFieldContext()\n const styles = checkbox({ size })\n const { checkbox: CheckIcon, indeterminate: IndeterminateIcon } =\n $cerberusIcons\n\n return (\n <div\n className={cx(\n styles.root,\n vstack({\n gap: '0',\n justify: 'center',\n }),\n )}\n >\n <input\n {...nativeProps}\n {...fieldStates}\n {...(describedBy && { 'aria-describedby': describedBy })}\n {...(invalid && { 'aria-invalid': true })}\n {...(mixed && { 'aria-checked': 'mixed' })}\n className={cx('peer', nativeProps.className, styles.input)}\n type=\"checkbox\"\n />\n <Show when={checked && !mixed}>\n <span className={styles.icon}>\n <CheckIcon />\n </span>\n </Show>\n <Show when={mixed}>\n <span className={styles.icon}>\n <IndeterminateIcon />\n </span>\n </Show>\n </div>\n )\n}\n","'use client'\n\nimport { useMemo, type PropsWithChildren, type ReactNode } from 'react'\n\n/**\n * This module contains the Show component.\n * @module\n */\n\nexport interface ShowProps {\n /**\n * The condition to render memoized children or the fallback content.\n */\n when: boolean | null | undefined\n /**\n * The children to render when the condition is false.\n */\n fallback?: ReactNode\n}\n\n/**\n * Conditionally render a memoized version of the children or optional fallback\n * content.\n * @see https://cerberus.digitalu.design/react/show\n * @example\n * ```tsx\n * <Show when={isLoggedIn} fallback={<Navigate to=\"/login\" />}>\n * <Dashboard />\n * </Show>\n */\nexport function Show(props: PropsWithChildren<ShowProps>): ReactNode {\n const { when, children, fallback } = props\n const condition = useMemo(() => when ?? false, [when])\n\n return useMemo(() => {\n if (condition) return children\n return fallback ?? null\n }, [condition, children, fallback])\n}\n","'use client'\n\nimport {\n createContext,\n useContext,\n useMemo,\n type PropsWithChildren,\n} from 'react'\n\n/**\n * This module provides a context and hook for the field.\n * @module Field\n */\n\nexport interface FieldContextValue {\n /**\n * Whether the field is disabled.\n * @description [Moz Input Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attributes)\n */\n disabled?: boolean\n /**\n * Whether the field is read-only.\n */\n readOnly?: boolean\n /**\n * Whether the field is required.\n */\n required?: boolean\n /**\n * Whether the field is invalid.\n */\n invalid?: boolean\n}\n\nconst FieldContext = createContext<FieldContextValue | null>(null)\n\n/**\n * Provides the field state for a all related components used within a group.\n * @see https://cerberus.digitalu.design/react/input\n */\nexport function Field(\n props: PropsWithChildren<FieldContextValue>,\n): JSX.Element {\n const value = useMemo(\n () => ({\n disabled: props.disabled,\n readOnly: props.readOnly,\n required: props.required,\n invalid: props.invalid,\n }),\n [props.disabled, props.readOnly, props.required, props.invalid],\n )\n\n return (\n <FieldContext.Provider value={value}>\n {props.children}\n </FieldContext.Provider>\n )\n}\n\n/**\n * Used to access the field context.\n * @returns The field context.\n */\nexport function useFieldContext(): FieldContextValue {\n const context = useContext(FieldContext)\n if (!context) {\n throw new Error('useFieldContext must be used within a Field Provider.')\n }\n return context\n}\n","import {\n Checkmark,\n CheckmarkOutline,\n ChevronDown,\n Close,\n CloudUpload,\n Information,\n Restart,\n TrashCan,\n UserFilled,\n Warning,\n WarningAlt,\n WarningFilled,\n type CarbonIconType,\n} from '@cerberus/icons'\nimport type { ElementType } from 'react'\nimport { CheckmarkIcon, IndeterminateIcon } from './icons/checkbox.icons'\nimport { AnimatingUploadIcon } from '../components/AnimatingUploadIcon'\n\nexport type IconType = CarbonIconType | ElementType\n\nexport interface DefinedIcons {\n avatar?: IconType\n checkbox?: IconType\n close?: IconType\n confirmModal?: IconType\n delete?: IconType\n promptModal?: IconType\n waitingFileUploader?: IconType\n fileUploader?: IconType\n indeterminate?: IconType\n infoNotification?: IconType\n successNotification?: IconType\n warningNotification?: IconType\n dangerNotification?: IconType\n invalid: IconType\n invalidAlt?: IconType\n redo?: IconType\n selectArrow?: IconType\n toggleChecked?: IconType\n}\n\nexport const defaultIcons: DefinedIcons = {\n avatar: UserFilled,\n checkbox: CheckmarkIcon,\n close: Close,\n confirmModal: Information,\n delete: TrashCan,\n promptModal: Information,\n waitingFileUploader: CloudUpload,\n fileUploader: AnimatingUploadIcon,\n indeterminate: IndeterminateIcon,\n infoNotification: Information,\n successNotification: CheckmarkOutline,\n warningNotification: WarningAlt,\n dangerNotification: WarningFilled,\n invalid: WarningFilled,\n invalidAlt: Warning,\n redo: Restart,\n selectArrow: ChevronDown,\n toggleChecked: Checkmark,\n}\n","import type { SVGProps } from 'react'\n\n/**\n * This module contains substitute icons for the Checkbox component.\n * @module\n */\n\nexport type CheckboxIconProps = SVGProps<SVGSVGElement>\n\n/**\n * Checkmark icon for Checkbox component\n */\nexport function CheckmarkIcon(props: CheckboxIconProps) {\n return (\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n role=\"img\"\n viewBox=\"0 0 24 24\"\n {...props}\n >\n <path\n fill=\"currentColor\"\n d=\"M9.714 18 4 12.335l1.818-1.764 3.896 3.824L18.181 6 20 7.803 9.714 18Z\"\n />\n </svg>\n )\n}\n\nexport type IndeterminateIconProps = SVGProps<SVGSVGElement>\n\n/**\n * Indeterminate icon for Checkbox component\n */\nexport function IndeterminateIcon(props: IndeterminateIconProps) {\n return (\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n role=\"img\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n {...props}\n >\n <path fill=\"currentColor\" d=\"M4 11h16v2.667H4z\" />\n </svg>\n )\n}\n","import { type CarbonIconProps } from '@cerberus/icons'\n\n/**\n * This module contains an animating icon to use for the FileStatus component.\n * @module\n */\n\nexport type AnimatingUploadIconProps = CarbonIconProps\n\nexport function AnimatingUploadIcon(props: AnimatingUploadIconProps) {\n return (\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width={props.size ?? '1em'}\n height={props.size ?? '1em'}\n viewBox=\"0 0 24 24\"\n >\n <g\n fill=\"none\"\n stroke=\"currentColor\"\n strokeLinecap=\"square\"\n strokeLinejoin=\"round\"\n strokeWidth={1.5}\n >\n <path\n data-name=\"animating-trail\"\n strokeDasharray=\"2 4\"\n strokeDashoffset={6}\n d=\"M12 21c-4.97 0 -9 -4.03 -9 -9c0 -4.97 4.03 -9 9 -9\"\n >\n <animate\n attributeName=\"stroke-dashoffset\"\n dur=\"0.45s\"\n repeatCount=\"indefinite\"\n values=\"6;0\"\n ></animate>\n </path>\n\n <path\n data-name=\"half-circle\"\n strokeDasharray={32}\n strokeDashoffset={32}\n d=\"M12 3c4.97 0 9 4.03 9 9c0 4.97 -4.03 9 -9 9\"\n >\n <animate\n fill=\"freeze\"\n attributeName=\"stroke-dashoffset\"\n begin=\"0.075s\"\n dur=\"0.3s\"\n values=\"32;0\"\n ></animate>\n </path>\n\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"0.8em\"\n height=\"0.8em\"\n x=\"27%\"\n y=\"27%\"\n viewBox=\"0 0 24 24\"\n >\n <polygon\n fill=\"currentColor\"\n stroke=\"currentColor\"\n strokeWidth={0.8}\n opacity=\"1\"\n points=\"3.7,6.7 7.5,2.9 7.5,15 8.5,15 8.5,2.9 12.3,6.7 13,6 8,1 3,6 \"\n >\n <animate\n fill=\"freeze\"\n attributeName=\"opacity\"\n values=\"1;0;1\"\n dur=\"2s\"\n repeatCount=\"indefinite\"\n ></animate>\n </polygon>\n </svg>\n </g>\n </svg>\n )\n}\n","import { defaultIcons, type DefinedIcons } from './cerbIcons'\n\nfunction _validateIconsProperties(icons: DefinedIcons) {\n if (!icons.invalid) {\n throw new Error(\n 'The an invalid property must be defined in your custom icons library.',\n )\n }\n}\n\nexport function defineIcons(icons: DefinedIcons): Required<DefinedIcons> {\n _validateIconsProperties(icons)\n $cerberusIcons = {\n ...defaultIcons,\n ...icons,\n } as Required<DefinedIcons>\n return $cerberusIcons\n}\n\n// Default icons\n\nexport let $cerberusIcons = defaultIcons as Required<DefinedIcons>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,qBAGO;AACP,sBAAuB;AACvB,iBAAmB;;;ACLnB,mBAAgE;AA4BzD,SAAS,KAAK,OAAgD;AACnE,QAAM,EAAE,M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Ac;AAAA,EACd,eAAe;AAAA,EACf,kBAAkB;AAAA,EAClB,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EACrB,oBAAoB;AAAA,EACpB,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,aAAa;AAAA,EACb,eAAe;AACjB;;;AGxCO,IAAI,iBAAiB;;;ANkCxB,IAAAC,sBAAA;AARG,SAAS,SAAS,OAAsB;AAC7C,QAAM,EAAE,aAAa,MAAM,SAAS,OAAO,GAAG,YAAY,IAAI;AAC9D,QAAM,EAAE,SAAS,GAAG,YAAY,IAAI,gBAAgB;AACpD,QAAM,aAAS,yBAAS,EAAE,KAAK,CAAC;AAChC,QAAM,EAAE,UAAU,WAAW,eAAeC,mBAAkB,IAC5D;AAEF,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW;AAAA,QACT,OAAO;AAAA,YACP,wBAAO;AAAA,UACL,KAAK;AAAA,UACL,SAAS;AAAA,QACX,CAAC;AAAA,MACH;AAAA,MAEA;AAAA;AAAA,UAAC;AAAA;AAAA,YACE,GAAG;AAAA,YACH,GAAG;AAAA,YACH,GAAI,eAAe,EAAE,oBAAoB,YAAY;AAAA,YACrD,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,YACtC,GAAI,SAAS,EAAE,gBAAgB,QAAQ;AAAA,YACxC,eAAW,eAAG,QAAQ,YAAY,WAAW,OAAO,KAAK;AAAA,YACzD,MAAK;AAAA;AAAA,QACP;AAAA,QACA,6CAAC,QAAK,MAAM,WAAW,CAAC,OACtB,uDAAC,UAAK,WAAW,OAAO,MACtB,uDAAC,aAAU,GACb,GACF;AAAA,QACA,6CAAC,QAAK,MAAM,OACV,uDAAC,UAAK,WAAW,OAAO,MACtB,uDAACA,oBAAA,EAAkB,GACrB,GACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":["import_react","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","IndeterminateIcon"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Checkbox.tsx","../../../src/components/Show.tsx","../../../src/context/field.tsx","../../../src/config/cerbIcons.ts","../../../src/config/icons/checkbox.icons.tsx","../../../src/components/AnimatingUploadIcon.tsx","../../../src/config/defineIcons.ts"],"sourcesContent":["'use client'\n\nimport {\n checkbox,\n type CheckboxVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport { vstack } from '@cerberus/styled-system/patterns'\nimport { cx } from '@cerberus/styled-system/css'\nimport type { InputHTMLAttributes } from 'react'\nimport { Show } from './Show'\nimport { useFieldContext } from '../context/field'\nimport { $cerberusIcons } from '../config/defineIcons'\n\n/**\n * This module contains the Checkbox component.\n * @module\n */\n\nexport type CheckboxProps = CheckboxVariantProps &\n Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'id'> & {\n /**\n * The id of the FieldMessage element describing the Checkbox.\n */\n describedBy?: string\n /**\n * The unique identifier for the checkbox. Required for accessibility.\n */\n id: string\n /**\n * Used to display a mixed checked state.\n * @description [ARIA Mixed State](https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/examples/checkbox-mixed/)\n */\n mixed?: boolean\n }\n\n/**\n * Checkbox component\n * @definition [ARIA Target Size](https://www.w3.org/WAI/WCAG21/Understanding/target-size.html#:~:text=Understanding%20SC%202.5.,%3ATarget%20Size%20(Level%20AAA)&text=The%20size%20of%20the%20target,Equivalent)\n * @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)\n * @see https://cerberus.digitalu.design/react/checkbox\n * @example\n * ```tsx\n * <Field>\n * <Checkbox id=\"legal\" checked={checked.legal} onChange={handleChange} />\n * </Field>\n * ```\n */\nexport function Checkbox(props: CheckboxProps) {\n const { describedBy, size, checked, mixed, ...nativeProps } = props\n const { invalid, ...fieldStates } = useFieldContext()\n const styles = checkbox({ size })\n const { checkbox: CheckIcon, indeterminate: IndeterminateIcon } =\n $cerberusIcons\n\n return (\n <div\n className={cx(\n styles.root,\n vstack({\n gap: '0',\n justify: 'center',\n }),\n )}\n >\n <input\n {...nativeProps}\n {...fieldStates}\n {...(describedBy && { 'aria-describedby': describedBy })}\n {...(invalid && { 'aria-invalid': true })}\n {...(mixed && { 'aria-checked': 'mixed' })}\n className={cx('peer', nativeProps.className, styles.input)}\n type=\"checkbox\"\n />\n <Show when={checked && !mixed}>\n <span className={styles.icon}>\n <CheckIcon />\n </span>\n </Show>\n <Show when={mixed}>\n <span className={styles.icon}>\n <IndeterminateIcon />\n </span>\n </Show>\n </div>\n )\n}\n","'use client'\n\nimport { useMemo, type PropsWithChildren, type ReactNode } from 'react'\n\n/**\n * This module contains the Show component.\n * @module\n */\n\nexport interface ShowProps {\n /**\n * The condition to render memoized children or the fallback content.\n */\n when: boolean | null | undefined\n /**\n * The children to render when the condition is false.\n */\n fallback?: ReactNode\n}\n\n/**\n * Conditionally render a memoized version of the children or optional fallback\n * content.\n * @see https://cerberus.digitalu.design/react/show\n * @example\n * ```tsx\n * <Show when={isLoggedIn} fallback={<Navigate to=\"/login\" />}>\n * <Dashboard />\n * </Show>\n */\nexport function Show(props: PropsWithChildren<ShowProps>): ReactNode {\n const { when, children, fallback } = props\n const condition = useMemo(() => when ?? false, [when])\n\n return useMemo(() => {\n if (condition) return children\n return fallback ?? null\n }, [condition, children, fallback])\n}\n","'use client'\n\nimport {\n createContext,\n useContext,\n useMemo,\n type PropsWithChildren,\n} from 'react'\n\n/**\n * This module provides a context and hook for the field.\n * @module Field\n */\n\nexport interface FieldContextValue {\n /**\n * Whether the field is disabled.\n * @description [Moz Input Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attributes)\n */\n disabled?: boolean\n /**\n * Whether the field is read-only.\n */\n readOnly?: boolean\n /**\n * Whether the field is required.\n */\n required?: boolean\n /**\n * Whether the field is invalid.\n */\n invalid?: boolean\n}\n\nconst FieldContext = createContext<FieldContextValue | null>(null)\n\n/**\n * Provides the field state for a all related components used within a group.\n * @see https://cerberus.digitalu.design/react/input\n */\nexport function Field(\n props: PropsWithChildren<FieldContextValue>,\n): JSX.Element {\n const value = useMemo(\n () => ({\n disabled: props.disabled,\n readOnly: props.readOnly,\n required: props.required,\n invalid: props.invalid,\n }),\n [props.disabled, props.readOnly, props.required, props.invalid],\n )\n\n return (\n <FieldContext.Provider value={value}>\n {props.children}\n </FieldContext.Provider>\n )\n}\n\n/**\n * Used to access the field context.\n * @returns The field context.\n */\nexport function useFieldContext(): FieldContextValue {\n const context = useContext(FieldContext)\n if (!context) {\n throw new Error('useFieldContext must be used within a Field Provider.')\n }\n return context\n}\n","import {\n Calendar,\n Checkmark,\n CheckmarkOutline,\n ChevronDown,\n ChevronLeft,\n ChevronRight,\n Close,\n CloudUpload,\n Information,\n Restart,\n TrashCan,\n UserFilled,\n Warning,\n WarningAlt,\n WarningFilled,\n type CarbonIconType,\n} from '@cerberus/icons'\nimport type { ElementType } from 'react'\nimport { CheckmarkIcon, IndeterminateIcon } from './icons/checkbox.icons'\nimport { AnimatingUploadIcon } from '../components/AnimatingUploadIcon'\n\nexport type IconType = CarbonIconType | ElementType\n\nexport interface DefinedIcons {\n avatar?: IconType\n calendar?: IconType\n calendarPrev?: IconType\n calendarNext?: IconType\n checkbox?: IconType\n close?: IconType\n confirmModal?: IconType\n delete?: IconType\n promptModal?: IconType\n waitingFileUploader?: IconType\n fileUploader?: IconType\n indeterminate?: IconType\n infoNotification?: IconType\n successNotification?: IconType\n warningNotification?: IconType\n dangerNotification?: IconType\n invalid: IconType\n invalidAlt?: IconType\n redo?: IconType\n selectArrow?: IconType\n toggleChecked?: IconType\n}\n\nexport const defaultIcons: DefinedIcons = {\n avatar: UserFilled,\n calendar: Calendar,\n calendarPrev: ChevronLeft,\n calendarNext: ChevronRight,\n checkbox: CheckmarkIcon,\n close: Close,\n confirmModal: Information,\n delete: TrashCan,\n promptModal: Information,\n waitingFileUploader: CloudUpload,\n fileUploader: AnimatingUploadIcon,\n indeterminate: IndeterminateIcon,\n infoNotification: Information,\n successNotification: CheckmarkOutline,\n warningNotification: WarningAlt,\n dangerNotification: WarningFilled,\n invalid: WarningFilled,\n invalidAlt: Warning,\n redo: Restart,\n selectArrow: ChevronDown,\n toggleChecked: Checkmark,\n}\n","import type { SVGProps } from 'react'\n\n/**\n * This module contains substitute icons for the Checkbox component.\n * @module\n */\n\nexport type CheckboxIconProps = SVGProps<SVGSVGElement>\n\n/**\n * Checkmark icon for Checkbox component\n */\nexport function CheckmarkIcon(props: CheckboxIconProps) {\n return (\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n role=\"img\"\n viewBox=\"0 0 24 24\"\n {...props}\n >\n <path\n fill=\"currentColor\"\n d=\"M9.714 18 4 12.335l1.818-1.764 3.896 3.824L18.181 6 20 7.803 9.714 18Z\"\n />\n </svg>\n )\n}\n\nexport type IndeterminateIconProps = SVGProps<SVGSVGElement>\n\n/**\n * Indeterminate icon for Checkbox component\n */\nexport function IndeterminateIcon(props: IndeterminateIconProps) {\n return (\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n role=\"img\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n {...props}\n >\n <path fill=\"currentColor\" d=\"M4 11h16v2.667H4z\" />\n </svg>\n )\n}\n","import { type CarbonIconProps } from '@cerberus/icons'\n\n/**\n * This module contains an animating icon to use for the FileStatus component.\n * @module\n */\n\nexport type AnimatingUploadIconProps = CarbonIconProps\n\nexport function AnimatingUploadIcon(props: AnimatingUploadIconProps) {\n return (\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width={props.size ?? '1em'}\n height={props.size ?? '1em'}\n viewBox=\"0 0 24 24\"\n >\n <g\n fill=\"none\"\n stroke=\"currentColor\"\n strokeLinecap=\"square\"\n strokeLinejoin=\"round\"\n strokeWidth={1.5}\n >\n <path\n data-name=\"animating-trail\"\n strokeDasharray=\"2 4\"\n strokeDashoffset={6}\n d=\"M12 21c-4.97 0 -9 -4.03 -9 -9c0 -4.97 4.03 -9 9 -9\"\n >\n <animate\n attributeName=\"stroke-dashoffset\"\n dur=\"0.45s\"\n repeatCount=\"indefinite\"\n values=\"6;0\"\n ></animate>\n </path>\n\n <path\n data-name=\"half-circle\"\n strokeDasharray={32}\n strokeDashoffset={32}\n d=\"M12 3c4.97 0 9 4.03 9 9c0 4.97 -4.03 9 -9 9\"\n >\n <animate\n fill=\"freeze\"\n attributeName=\"stroke-dashoffset\"\n begin=\"0.075s\"\n dur=\"0.3s\"\n values=\"32;0\"\n ></animate>\n </path>\n\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"0.8em\"\n height=\"0.8em\"\n x=\"27%\"\n y=\"27%\"\n viewBox=\"0 0 24 24\"\n >\n <polygon\n fill=\"currentColor\"\n stroke=\"currentColor\"\n strokeWidth={0.8}\n opacity=\"1\"\n points=\"3.7,6.7 7.5,2.9 7.5,15 8.5,15 8.5,2.9 12.3,6.7 13,6 8,1 3,6 \"\n >\n <animate\n fill=\"freeze\"\n attributeName=\"opacity\"\n values=\"1;0;1\"\n dur=\"2s\"\n repeatCount=\"indefinite\"\n ></animate>\n </polygon>\n </svg>\n </g>\n </svg>\n )\n}\n","import { defaultIcons, type DefinedIcons } from './cerbIcons'\n\nfunction _validateIconsProperties(icons: DefinedIcons) {\n if (!icons.invalid) {\n throw new Error(\n 'The an invalid property must be defined in your custom icons library.',\n )\n }\n}\n\nexport function defineIcons(icons: DefinedIcons): Required<DefinedIcons> {\n _validateIconsProperties(icons)\n $cerberusIcons = {\n ...defaultIcons,\n ...icons,\n } as Required<DefinedIcons>\n return $cerberusIcons\n}\n\n// Default icons\n\nexport let $cerberusIcons = defaultIcons as Required<DefinedIcons>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,qBAGO;AACP,sBAAuB;AACvB,iBAAmB;;;ACLnB,mBAAgE;AA4BzD,SAAS,KAAK,OAAgD;AACnE,QAAM,EAAE,MAAM,UAAU,SAAS,I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on"]}
|
|
@@ -0,0 +1,525 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/components/DatePicker.client.tsx
|
|
22
|
+
var DatePicker_client_exports = {};
|
|
23
|
+
__export(DatePicker_client_exports, {
|
|
24
|
+
DatePicker: () => DatePicker,
|
|
25
|
+
DatePickerCalendar: () => DatePickerCalendar,
|
|
26
|
+
DatePickerContent: () => DatePickerContent,
|
|
27
|
+
DatePickerDayView: () => DatePickerDayView,
|
|
28
|
+
DatePickerInput: () => DatePickerInput,
|
|
29
|
+
DatePickerMonthView: () => DatePickerMonthView,
|
|
30
|
+
DatePickerYearView: () => DatePickerYearView,
|
|
31
|
+
RangePickerInput: () => RangePickerInput
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(DatePicker_client_exports);
|
|
34
|
+
var import_react5 = require("@ark-ui/react");
|
|
35
|
+
|
|
36
|
+
// src/components/Portal.tsx
|
|
37
|
+
var import_react = require("@ark-ui/react");
|
|
38
|
+
var Portal = import_react.Portal;
|
|
39
|
+
|
|
40
|
+
// src/components/DatePicker.client.tsx
|
|
41
|
+
var import_react6 = require("react");
|
|
42
|
+
var import_recipes4 = require("@cerberus/styled-system/recipes");
|
|
43
|
+
var import_css4 = require("@cerberus/styled-system/css");
|
|
44
|
+
|
|
45
|
+
// src/context/field.tsx
|
|
46
|
+
var import_react2 = require("react");
|
|
47
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
48
|
+
var FieldContext = (0, import_react2.createContext)(null);
|
|
49
|
+
function useFieldContext() {
|
|
50
|
+
const context = (0, import_react2.useContext)(FieldContext);
|
|
51
|
+
if (!context) {
|
|
52
|
+
throw new Error("useFieldContext must be used within a Field Provider.");
|
|
53
|
+
}
|
|
54
|
+
return context;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// src/components/DatePicker.server.tsx
|
|
58
|
+
var import_react3 = require("@ark-ui/react");
|
|
59
|
+
var import_css3 = require("@cerberus/styled-system/css");
|
|
60
|
+
var import_recipes3 = require("@cerberus/styled-system/recipes");
|
|
61
|
+
|
|
62
|
+
// src/config/cerbIcons.ts
|
|
63
|
+
var import_icons = require("@cerberus/icons");
|
|
64
|
+
|
|
65
|
+
// src/config/icons/checkbox.icons.tsx
|
|
66
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
67
|
+
function CheckmarkIcon(props) {
|
|
68
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
69
|
+
"svg",
|
|
70
|
+
{
|
|
71
|
+
"aria-hidden": "true",
|
|
72
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
73
|
+
fill: "none",
|
|
74
|
+
role: "img",
|
|
75
|
+
viewBox: "0 0 24 24",
|
|
76
|
+
...props,
|
|
77
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
78
|
+
"path",
|
|
79
|
+
{
|
|
80
|
+
fill: "currentColor",
|
|
81
|
+
d: "M9.714 18 4 12.335l1.818-1.764 3.896 3.824L18.181 6 20 7.803 9.714 18Z"
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
function IndeterminateIcon(props) {
|
|
88
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
89
|
+
"svg",
|
|
90
|
+
{
|
|
91
|
+
"aria-hidden": "true",
|
|
92
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
93
|
+
role: "img",
|
|
94
|
+
fill: "none",
|
|
95
|
+
viewBox: "0 0 24 24",
|
|
96
|
+
...props,
|
|
97
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { fill: "currentColor", d: "M4 11h16v2.667H4z" })
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// src/components/AnimatingUploadIcon.tsx
|
|
103
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
104
|
+
function AnimatingUploadIcon(props) {
|
|
105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
106
|
+
"svg",
|
|
107
|
+
{
|
|
108
|
+
"aria-hidden": "true",
|
|
109
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
110
|
+
width: props.size ?? "1em",
|
|
111
|
+
height: props.size ?? "1em",
|
|
112
|
+
viewBox: "0 0 24 24",
|
|
113
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
114
|
+
"g",
|
|
115
|
+
{
|
|
116
|
+
fill: "none",
|
|
117
|
+
stroke: "currentColor",
|
|
118
|
+
strokeLinecap: "square",
|
|
119
|
+
strokeLinejoin: "round",
|
|
120
|
+
strokeWidth: 1.5,
|
|
121
|
+
children: [
|
|
122
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
123
|
+
"path",
|
|
124
|
+
{
|
|
125
|
+
"data-name": "animating-trail",
|
|
126
|
+
strokeDasharray: "2 4",
|
|
127
|
+
strokeDashoffset: 6,
|
|
128
|
+
d: "M12 21c-4.97 0 -9 -4.03 -9 -9c0 -4.97 4.03 -9 9 -9",
|
|
129
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
130
|
+
"animate",
|
|
131
|
+
{
|
|
132
|
+
attributeName: "stroke-dashoffset",
|
|
133
|
+
dur: "0.45s",
|
|
134
|
+
repeatCount: "indefinite",
|
|
135
|
+
values: "6;0"
|
|
136
|
+
}
|
|
137
|
+
)
|
|
138
|
+
}
|
|
139
|
+
),
|
|
140
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
141
|
+
"path",
|
|
142
|
+
{
|
|
143
|
+
"data-name": "half-circle",
|
|
144
|
+
strokeDasharray: 32,
|
|
145
|
+
strokeDashoffset: 32,
|
|
146
|
+
d: "M12 3c4.97 0 9 4.03 9 9c0 4.97 -4.03 9 -9 9",
|
|
147
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
148
|
+
"animate",
|
|
149
|
+
{
|
|
150
|
+
fill: "freeze",
|
|
151
|
+
attributeName: "stroke-dashoffset",
|
|
152
|
+
begin: "0.075s",
|
|
153
|
+
dur: "0.3s",
|
|
154
|
+
values: "32;0"
|
|
155
|
+
}
|
|
156
|
+
)
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
160
|
+
"svg",
|
|
161
|
+
{
|
|
162
|
+
"aria-hidden": "true",
|
|
163
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
164
|
+
width: "0.8em",
|
|
165
|
+
height: "0.8em",
|
|
166
|
+
x: "27%",
|
|
167
|
+
y: "27%",
|
|
168
|
+
viewBox: "0 0 24 24",
|
|
169
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
170
|
+
"polygon",
|
|
171
|
+
{
|
|
172
|
+
fill: "currentColor",
|
|
173
|
+
stroke: "currentColor",
|
|
174
|
+
strokeWidth: 0.8,
|
|
175
|
+
opacity: "1",
|
|
176
|
+
points: "3.7,6.7 7.5,2.9 7.5,15 8.5,15 8.5,2.9 12.3,6.7 13,6 8,1 3,6 ",
|
|
177
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
178
|
+
"animate",
|
|
179
|
+
{
|
|
180
|
+
fill: "freeze",
|
|
181
|
+
attributeName: "opacity",
|
|
182
|
+
values: "1;0;1",
|
|
183
|
+
dur: "2s",
|
|
184
|
+
repeatCount: "indefinite"
|
|
185
|
+
}
|
|
186
|
+
)
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
}
|
|
190
|
+
)
|
|
191
|
+
]
|
|
192
|
+
}
|
|
193
|
+
)
|
|
194
|
+
}
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// src/config/cerbIcons.ts
|
|
199
|
+
var defaultIcons = {
|
|
200
|
+
avatar: import_icons.UserFilled,
|
|
201
|
+
calendar: import_icons.Calendar,
|
|
202
|
+
calendarPrev: import_icons.ChevronLeft,
|
|
203
|
+
calendarNext: import_icons.ChevronRight,
|
|
204
|
+
checkbox: CheckmarkIcon,
|
|
205
|
+
close: import_icons.Close,
|
|
206
|
+
confirmModal: import_icons.Information,
|
|
207
|
+
delete: import_icons.TrashCan,
|
|
208
|
+
promptModal: import_icons.Information,
|
|
209
|
+
waitingFileUploader: import_icons.CloudUpload,
|
|
210
|
+
fileUploader: AnimatingUploadIcon,
|
|
211
|
+
indeterminate: IndeterminateIcon,
|
|
212
|
+
infoNotification: import_icons.Information,
|
|
213
|
+
successNotification: import_icons.CheckmarkOutline,
|
|
214
|
+
warningNotification: import_icons.WarningAlt,
|
|
215
|
+
dangerNotification: import_icons.WarningFilled,
|
|
216
|
+
invalid: import_icons.WarningFilled,
|
|
217
|
+
invalidAlt: import_icons.Warning,
|
|
218
|
+
redo: import_icons.Restart,
|
|
219
|
+
selectArrow: import_icons.ChevronDown,
|
|
220
|
+
toggleChecked: import_icons.Checkmark
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
// src/config/defineIcons.ts
|
|
224
|
+
var $cerberusIcons = defaultIcons;
|
|
225
|
+
|
|
226
|
+
// src/components/IconButton.tsx
|
|
227
|
+
var import_css = require("@cerberus/styled-system/css");
|
|
228
|
+
var import_recipes = require("@cerberus/styled-system/recipes");
|
|
229
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
230
|
+
function IconButton(props) {
|
|
231
|
+
const { ariaLabel, palette, usage, size, ...nativeProps } = props;
|
|
232
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
233
|
+
"button",
|
|
234
|
+
{
|
|
235
|
+
...nativeProps,
|
|
236
|
+
"aria-label": ariaLabel ?? "Icon Button",
|
|
237
|
+
className: (0, import_css.cx)(
|
|
238
|
+
nativeProps.className,
|
|
239
|
+
(0, import_recipes.iconButton)({
|
|
240
|
+
palette,
|
|
241
|
+
usage,
|
|
242
|
+
size
|
|
243
|
+
})
|
|
244
|
+
)
|
|
245
|
+
}
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// src/components/Button.tsx
|
|
250
|
+
var import_css2 = require("@cerberus/styled-system/css");
|
|
251
|
+
var import_recipes2 = require("@cerberus/styled-system/recipes");
|
|
252
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
253
|
+
function Button(props) {
|
|
254
|
+
const { palette, usage, shape, ...nativeProps } = props;
|
|
255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
256
|
+
"button",
|
|
257
|
+
{
|
|
258
|
+
...nativeProps,
|
|
259
|
+
className: (0, import_css2.cx)(
|
|
260
|
+
nativeProps.className,
|
|
261
|
+
(0, import_recipes2.button)({
|
|
262
|
+
palette,
|
|
263
|
+
usage,
|
|
264
|
+
shape
|
|
265
|
+
})
|
|
266
|
+
)
|
|
267
|
+
}
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// src/components/DatePicker.server.tsx
|
|
272
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
273
|
+
var datePickerStyles = (0, import_recipes3.datePicker)();
|
|
274
|
+
function DatePickerTrigger(props) {
|
|
275
|
+
const { calendar: CalendarIcon } = $cerberusIcons;
|
|
276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
277
|
+
import_react3.DatePicker.Trigger,
|
|
278
|
+
{
|
|
279
|
+
...props,
|
|
280
|
+
className: (0, import_css3.cx)(
|
|
281
|
+
props.className,
|
|
282
|
+
(0, import_recipes3.iconButton)({
|
|
283
|
+
size: "sm",
|
|
284
|
+
usage: "ghost"
|
|
285
|
+
}),
|
|
286
|
+
datePickerStyles.trigger
|
|
287
|
+
),
|
|
288
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CalendarIcon, {})
|
|
289
|
+
}
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
function DatePickerViewControl(props) {
|
|
293
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
294
|
+
import_react3.DatePicker.Control,
|
|
295
|
+
{
|
|
296
|
+
...props,
|
|
297
|
+
className: (0, import_css3.cx)(props.className, datePickerStyles.viewControl)
|
|
298
|
+
}
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
function DatePickerViewControlGroup(props) {
|
|
302
|
+
const { calendarPrev: PrevIcon, calendarNext: NextIcon } = $cerberusIcons;
|
|
303
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(DatePickerViewControl, { ...props, children: [
|
|
304
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react3.DatePicker.PrevTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IconButton, { ariaLabel: "Previous", size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PrevIcon, {}) }) }),
|
|
305
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react3.DatePicker.ViewTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
306
|
+
Button,
|
|
307
|
+
{
|
|
308
|
+
className: (0, import_css3.css)({
|
|
309
|
+
h: "2rem",
|
|
310
|
+
paddingInline: "md"
|
|
311
|
+
}),
|
|
312
|
+
shape: "rounded",
|
|
313
|
+
size: "sm",
|
|
314
|
+
usage: "ghost",
|
|
315
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react3.DatePicker.RangeText, {})
|
|
316
|
+
}
|
|
317
|
+
) }),
|
|
318
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react3.DatePicker.NextTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IconButton, { ariaLabel: "Next", size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(NextIcon, {}) }) })
|
|
319
|
+
] });
|
|
320
|
+
}
|
|
321
|
+
function DatePickerTable(props) {
|
|
322
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
323
|
+
import_react3.DatePicker.Table,
|
|
324
|
+
{
|
|
325
|
+
...props,
|
|
326
|
+
className: (0, import_css3.cx)(props.className, datePickerStyles.table)
|
|
327
|
+
}
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
|
+
function DatePickerTableHeader(props) {
|
|
331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
332
|
+
import_react3.DatePicker.TableHeader,
|
|
333
|
+
{
|
|
334
|
+
...props,
|
|
335
|
+
className: (0, import_css3.cx)(props.className, datePickerStyles.tableHeader)
|
|
336
|
+
}
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
function DatePickerTableCell(props) {
|
|
340
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
341
|
+
import_react3.DatePicker.TableCell,
|
|
342
|
+
{
|
|
343
|
+
...props,
|
|
344
|
+
className: (0, import_css3.cx)(props.className, datePickerStyles.tableCell)
|
|
345
|
+
}
|
|
346
|
+
);
|
|
347
|
+
}
|
|
348
|
+
function DatePickerTableCellTrigger(props) {
|
|
349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
350
|
+
import_react3.DatePicker.TableCellTrigger,
|
|
351
|
+
{
|
|
352
|
+
...props,
|
|
353
|
+
className: (0, import_css3.cx)(props.className, datePickerStyles.tableCellTrigger)
|
|
354
|
+
}
|
|
355
|
+
);
|
|
356
|
+
}
|
|
357
|
+
var DatePickerView = import_react3.DatePicker.View;
|
|
358
|
+
var DatePickerContext = import_react3.DatePicker.Context;
|
|
359
|
+
|
|
360
|
+
// src/hooks/useDate.ts
|
|
361
|
+
var import_react4 = require("react");
|
|
362
|
+
function formatISOToMilitary(date) {
|
|
363
|
+
const [year, month, day] = date.split("-");
|
|
364
|
+
const monthIndex = parseInt(month, 10) - 1;
|
|
365
|
+
const monthStr = MONTHS[monthIndex];
|
|
366
|
+
return `${day} ${monthStr} ${year}`;
|
|
367
|
+
}
|
|
368
|
+
var MONTHS = [
|
|
369
|
+
"JAN",
|
|
370
|
+
"FEB",
|
|
371
|
+
"MAR",
|
|
372
|
+
"APR",
|
|
373
|
+
"MAY",
|
|
374
|
+
"JUN",
|
|
375
|
+
"JUL",
|
|
376
|
+
"AUG",
|
|
377
|
+
"SEP",
|
|
378
|
+
"OCT",
|
|
379
|
+
"NOV",
|
|
380
|
+
"DEC"
|
|
381
|
+
];
|
|
382
|
+
|
|
383
|
+
// src/components/DatePicker.client.tsx
|
|
384
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
385
|
+
var datePickerStyles2 = (0, import_recipes4.datePicker)();
|
|
386
|
+
function DatePicker(props) {
|
|
387
|
+
const states = useFieldContext();
|
|
388
|
+
const handleFormat = (0, import_react6.useCallback)((value) => {
|
|
389
|
+
return formatISOToMilitary(value.toString());
|
|
390
|
+
}, []);
|
|
391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
392
|
+
import_react5.DatePicker.Root,
|
|
393
|
+
{
|
|
394
|
+
...props,
|
|
395
|
+
...states,
|
|
396
|
+
format: handleFormat,
|
|
397
|
+
positioning: {
|
|
398
|
+
placement: "bottom-start"
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
);
|
|
402
|
+
}
|
|
403
|
+
function DatePickerInput(props) {
|
|
404
|
+
const { invalid, ...fieldStates } = useFieldContext();
|
|
405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react5.DatePicker.Control, { className: datePickerStyles2.control, children: [
|
|
406
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DatePickerTrigger, {}),
|
|
407
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
408
|
+
import_react5.DatePicker.Input,
|
|
409
|
+
{
|
|
410
|
+
...props,
|
|
411
|
+
...fieldStates,
|
|
412
|
+
...invalid && { "aria-invalid": true },
|
|
413
|
+
className: (0, import_css4.cx)(props.className, datePickerStyles2.input),
|
|
414
|
+
placeholder: props.placeholder ?? "DD MMM YYYY",
|
|
415
|
+
maxLength: 11
|
|
416
|
+
}
|
|
417
|
+
)
|
|
418
|
+
] });
|
|
419
|
+
}
|
|
420
|
+
function RangePickerInput(props) {
|
|
421
|
+
const { invalid, ...fieldStates } = useFieldContext();
|
|
422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react5.DatePicker.Control, { "data-range": true, className: datePickerStyles2.control, children: [
|
|
423
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DatePickerTrigger, {}),
|
|
424
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
425
|
+
import_react5.DatePicker.Input,
|
|
426
|
+
{
|
|
427
|
+
...props,
|
|
428
|
+
...fieldStates,
|
|
429
|
+
...invalid && { "aria-invalid": true },
|
|
430
|
+
"data-range-input": true,
|
|
431
|
+
className: (0, import_css4.cx)(props.className, datePickerStyles2.input),
|
|
432
|
+
placeholder: props.placeholder ?? "DD MMM YYYY",
|
|
433
|
+
maxLength: 11,
|
|
434
|
+
index: 0
|
|
435
|
+
}
|
|
436
|
+
),
|
|
437
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
438
|
+
import_react5.DatePicker.Input,
|
|
439
|
+
{
|
|
440
|
+
...props,
|
|
441
|
+
...fieldStates,
|
|
442
|
+
...invalid && { "aria-invalid": true },
|
|
443
|
+
"data-range-input": true,
|
|
444
|
+
"data-range-end-input": true,
|
|
445
|
+
className: (0, import_css4.cx)(props.className, datePickerStyles2.input),
|
|
446
|
+
placeholder: props.placeholder ?? "DD MMM YYYY",
|
|
447
|
+
maxLength: 11,
|
|
448
|
+
index: 1
|
|
449
|
+
}
|
|
450
|
+
)
|
|
451
|
+
] });
|
|
452
|
+
}
|
|
453
|
+
function DatePickerContent(props) {
|
|
454
|
+
const { children, ...contentProps } = props;
|
|
455
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react5.DatePicker.Positioner, { className: datePickerStyles2.positioner, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
456
|
+
import_react5.DatePicker.Content,
|
|
457
|
+
{
|
|
458
|
+
...contentProps,
|
|
459
|
+
className: (0, import_css4.cx)(contentProps.className, datePickerStyles2.content),
|
|
460
|
+
children
|
|
461
|
+
}
|
|
462
|
+
) }) });
|
|
463
|
+
}
|
|
464
|
+
function DatePickerDayView(props) {
|
|
465
|
+
function isToday(date) {
|
|
466
|
+
const today = /* @__PURE__ */ new Date();
|
|
467
|
+
const formatted = today.toISOString().split("T")[0];
|
|
468
|
+
const arkDate = `${date.year}-${String(date.month).padStart(2, "0")}-${String(date.day).padStart(2, "0")}`;
|
|
469
|
+
return formatted === arkDate;
|
|
470
|
+
}
|
|
471
|
+
function isPastDay(date) {
|
|
472
|
+
const today = /* @__PURE__ */ new Date();
|
|
473
|
+
const arkDate = `${date.year}-${String(date.month).padStart(2, "0")}-${String(date.day).padStart(2, "0")}`;
|
|
474
|
+
return new Date(arkDate) < today;
|
|
475
|
+
}
|
|
476
|
+
function getDayValue(date) {
|
|
477
|
+
if (isToday(date)) return "today";
|
|
478
|
+
if (isPastDay(date)) return "past";
|
|
479
|
+
return "future";
|
|
480
|
+
}
|
|
481
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DatePickerView, { ...props, view: "day", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DatePickerContext, { children: (datePicker3) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
482
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DatePickerViewControlGroup, {}),
|
|
483
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(DatePickerTable, { children: [
|
|
484
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react5.DatePicker.TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react5.DatePicker.TableRow, { children: datePicker3.weekDays.map((weekDay, id) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DatePickerTableHeader, { children: weekDay.narrow }, id)) }) }),
|
|
485
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react5.DatePicker.TableBody, { children: datePicker3.weeks.map((week, id) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react5.DatePicker.TableRow, { children: week.map((day, id2) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DatePickerTableCell, { value: day, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
486
|
+
DatePickerTableCellTrigger,
|
|
487
|
+
{
|
|
488
|
+
"data-date": getDayValue(day),
|
|
489
|
+
children: day.day
|
|
490
|
+
}
|
|
491
|
+
) }, id2)) }, id)) })
|
|
492
|
+
] })
|
|
493
|
+
] }) }) });
|
|
494
|
+
}
|
|
495
|
+
function DatePickerMonthView(props) {
|
|
496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react5.DatePicker.View, { ...props, view: "month", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react5.DatePicker.Context, { children: (datePicker3) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
497
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DatePickerViewControlGroup, {}),
|
|
498
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DatePickerTable, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react5.DatePicker.TableBody, { children: datePicker3.getMonthsGrid({ columns: 4, format: "short" }).map((months, id) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react5.DatePicker.TableRow, { children: months.map((month, id2) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DatePickerTableCell, { value: month.value, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DatePickerTableCellTrigger, { children: month.label }) }, id2)) }, id)) }) })
|
|
499
|
+
] }) }) });
|
|
500
|
+
}
|
|
501
|
+
function DatePickerYearView(props) {
|
|
502
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react5.DatePicker.View, { ...props, view: "year", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react5.DatePicker.Context, { children: (datePicker3) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
503
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DatePickerViewControlGroup, {}),
|
|
504
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DatePickerTable, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react5.DatePicker.TableBody, { children: datePicker3.getYearsGrid({ columns: 4 }).map((years, id) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react5.DatePicker.TableRow, { children: years.map((year, id2) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DatePickerTableCell, { value: year.value, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DatePickerTableCellTrigger, { children: year.label }) }, id2)) }, id)) }) })
|
|
505
|
+
] }) }) });
|
|
506
|
+
}
|
|
507
|
+
function DatePickerCalendar() {
|
|
508
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(DatePickerContent, { children: [
|
|
509
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DatePickerDayView, {}),
|
|
510
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DatePickerMonthView, {}),
|
|
511
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DatePickerYearView, {})
|
|
512
|
+
] });
|
|
513
|
+
}
|
|
514
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
515
|
+
0 && (module.exports = {
|
|
516
|
+
DatePicker,
|
|
517
|
+
DatePickerCalendar,
|
|
518
|
+
DatePickerContent,
|
|
519
|
+
DatePickerDayView,
|
|
520
|
+
DatePickerInput,
|
|
521
|
+
DatePickerMonthView,
|
|
522
|
+
DatePickerYearView,
|
|
523
|
+
RangePickerInput
|
|
524
|
+
});
|
|
525
|
+
//# sourceMappingURL=DatePicker.client.cjs.map
|