@tribepad/themis 1.0.17 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/elements/Accordion/Accordion.d.ts +3 -1
- package/dist/elements/Accordion/Accordion.d.ts.map +1 -1
- package/dist/elements/Accordion/index.js +1 -1
- package/dist/elements/Accordion/index.js.map +1 -1
- package/dist/elements/Accordion/index.mjs +1 -1
- package/dist/elements/Accordion/index.mjs.map +1 -1
- package/dist/elements/AlertDialog/index.js +1 -1
- package/dist/elements/AlertDialog/index.js.map +1 -1
- package/dist/elements/AlertDialog/index.mjs +1 -1
- package/dist/elements/AlertDialog/index.mjs.map +1 -1
- package/dist/elements/Breadcrumbs/index.js +1 -1
- package/dist/elements/Breadcrumbs/index.js.map +1 -1
- package/dist/elements/Breadcrumbs/index.mjs +1 -1
- package/dist/elements/Breadcrumbs/index.mjs.map +1 -1
- package/dist/elements/Button/Button.d.ts.map +1 -1
- package/dist/elements/Button/index.js +1 -1
- package/dist/elements/Button/index.js.map +1 -1
- package/dist/elements/Button/index.mjs +1 -1
- package/dist/elements/Button/index.mjs.map +1 -1
- package/dist/elements/Card/Card.d.ts +21 -1
- package/dist/elements/Card/Card.d.ts.map +1 -1
- package/dist/elements/Card/Card.types.d.ts +36 -0
- package/dist/elements/Card/Card.types.d.ts.map +1 -1
- package/dist/elements/Card/index.d.ts +10 -3
- package/dist/elements/Card/index.d.ts.map +1 -1
- package/dist/elements/Card/index.js +1 -1
- package/dist/elements/Card/index.js.map +1 -1
- package/dist/elements/Card/index.mjs +1 -1
- package/dist/elements/Card/index.mjs.map +1 -1
- package/dist/elements/Carousel/Carousel.d.ts.map +1 -1
- package/dist/elements/Carousel/index.js +1 -1
- package/dist/elements/Carousel/index.js.map +1 -1
- package/dist/elements/Carousel/index.mjs +1 -1
- package/dist/elements/Carousel/index.mjs.map +1 -1
- package/dist/elements/Chart/Chart.d.ts.map +1 -1
- package/dist/elements/Chart/Chart.types.d.ts +21 -4
- package/dist/elements/Chart/Chart.types.d.ts.map +1 -1
- package/dist/elements/Chart/ChartAreaSeries.d.ts +32 -0
- package/dist/elements/Chart/ChartAreaSeries.d.ts.map +1 -0
- package/dist/elements/Chart/ChartContext.d.ts +4 -1
- package/dist/elements/Chart/ChartContext.d.ts.map +1 -1
- package/dist/elements/Chart/ChartLegend.d.ts +2 -2
- package/dist/elements/Chart/ChartLegend.d.ts.map +1 -1
- package/dist/elements/Chart/ChartPieSeries.d.ts +28 -0
- package/dist/elements/Chart/ChartPieSeries.d.ts.map +1 -0
- package/dist/elements/Chart/ChartRadarSeries.d.ts +28 -0
- package/dist/elements/Chart/ChartRadarSeries.d.ts.map +1 -0
- package/dist/elements/Chart/ChartSVG.d.ts +7 -1
- package/dist/elements/Chart/ChartSVG.d.ts.map +1 -1
- package/dist/elements/Chart/ChartScatterSeries.d.ts +31 -0
- package/dist/elements/Chart/ChartScatterSeries.d.ts.map +1 -0
- package/dist/elements/Chart/index.js +1 -1
- package/dist/elements/Chart/index.js.map +1 -1
- package/dist/elements/Chart/index.mjs +1 -1
- package/dist/elements/Chart/index.mjs.map +1 -1
- package/dist/elements/Checkbox/index.js +1 -1
- package/dist/elements/Checkbox/index.js.map +1 -1
- package/dist/elements/Checkbox/index.mjs +1 -1
- package/dist/elements/Checkbox/index.mjs.map +1 -1
- package/dist/elements/ColorPicker/ColorPicker.d.ts.map +1 -1
- package/dist/elements/ColorPicker/ColorPicker.styles.d.ts +3 -1
- package/dist/elements/ColorPicker/ColorPicker.styles.d.ts.map +1 -1
- package/dist/elements/ColorPicker/index.js +1 -1
- package/dist/elements/ColorPicker/index.js.map +1 -1
- package/dist/elements/ColorPicker/index.mjs +1 -1
- package/dist/elements/ColorPicker/index.mjs.map +1 -1
- package/dist/elements/Combobox/Combobox.d.ts +1 -1
- package/dist/elements/Combobox/Combobox.d.ts.map +1 -1
- package/dist/elements/Combobox/Combobox.styles.d.ts.map +1 -1
- package/dist/elements/Combobox/index.js +1 -1
- package/dist/elements/Combobox/index.js.map +1 -1
- package/dist/elements/Combobox/index.mjs +1 -1
- package/dist/elements/Combobox/index.mjs.map +1 -1
- package/dist/elements/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/elements/DatePicker/index.js +1 -1
- package/dist/elements/DatePicker/index.js.map +1 -1
- package/dist/elements/DatePicker/index.mjs +1 -1
- package/dist/elements/DatePicker/index.mjs.map +1 -1
- package/dist/elements/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/elements/Dropdown/index.js +1 -1
- package/dist/elements/Dropdown/index.js.map +1 -1
- package/dist/elements/Dropdown/index.mjs +1 -1
- package/dist/elements/Dropdown/index.mjs.map +1 -1
- package/dist/elements/FileField/index.js +1 -1
- package/dist/elements/FileField/index.js.map +1 -1
- package/dist/elements/FileField/index.mjs +1 -1
- package/dist/elements/FileField/index.mjs.map +1 -1
- package/dist/elements/Modal/Modal.d.ts +2 -1
- package/dist/elements/Modal/Modal.d.ts.map +1 -1
- package/dist/elements/Modal/index.js +1 -1
- package/dist/elements/Modal/index.js.map +1 -1
- package/dist/elements/Modal/index.mjs +1 -1
- package/dist/elements/Modal/index.mjs.map +1 -1
- package/dist/elements/NumberField/NumberField.d.ts.map +1 -1
- package/dist/elements/NumberField/NumberField.types.d.ts +1 -1
- package/dist/elements/NumberField/NumberField.variants.d.ts.map +1 -1
- package/dist/elements/NumberField/index.js +1 -1
- package/dist/elements/NumberField/index.js.map +1 -1
- package/dist/elements/NumberField/index.mjs +1 -1
- package/dist/elements/NumberField/index.mjs.map +1 -1
- package/dist/elements/OTPInput/index.js +1 -1
- package/dist/elements/OTPInput/index.js.map +1 -1
- package/dist/elements/OTPInput/index.mjs +1 -1
- package/dist/elements/OTPInput/index.mjs.map +1 -1
- package/dist/elements/Pagination/index.js +1 -1
- package/dist/elements/Pagination/index.js.map +1 -1
- package/dist/elements/Pagination/index.mjs +1 -1
- package/dist/elements/Pagination/index.mjs.map +1 -1
- package/dist/elements/Panel/index.js +1 -1
- package/dist/elements/Panel/index.js.map +1 -1
- package/dist/elements/Panel/index.mjs +1 -1
- package/dist/elements/Panel/index.mjs.map +1 -1
- package/dist/elements/PasswordField/index.js +1 -1
- package/dist/elements/PasswordField/index.js.map +1 -1
- package/dist/elements/PasswordField/index.mjs +1 -1
- package/dist/elements/PasswordField/index.mjs.map +1 -1
- package/dist/elements/Progress/index.js +1 -1
- package/dist/elements/Progress/index.js.map +1 -1
- package/dist/elements/Progress/index.mjs +1 -1
- package/dist/elements/Progress/index.mjs.map +1 -1
- package/dist/elements/RatingScale/index.js +1 -1
- package/dist/elements/RatingScale/index.js.map +1 -1
- package/dist/elements/RatingScale/index.mjs +1 -1
- package/dist/elements/RatingScale/index.mjs.map +1 -1
- package/dist/elements/Resizable/index.js +1 -1
- package/dist/elements/Resizable/index.js.map +1 -1
- package/dist/elements/Resizable/index.mjs +1 -1
- package/dist/elements/Resizable/index.mjs.map +1 -1
- package/dist/elements/SearchField/index.js +1 -1
- package/dist/elements/SearchField/index.js.map +1 -1
- package/dist/elements/SearchField/index.mjs +1 -1
- package/dist/elements/SearchField/index.mjs.map +1 -1
- package/dist/elements/Select/Select.d.ts.map +1 -1
- package/dist/elements/Select/Select.styles.d.ts.map +1 -1
- package/dist/elements/Select/index.js +1 -1
- package/dist/elements/Select/index.js.map +1 -1
- package/dist/elements/Select/index.mjs +1 -1
- package/dist/elements/Select/index.mjs.map +1 -1
- package/dist/elements/Sidebar/Sidebar.styles.d.ts +41 -0
- package/dist/elements/Sidebar/Sidebar.styles.d.ts.map +1 -0
- package/dist/elements/Sidebar/Sidebar.types.d.ts +224 -0
- package/dist/elements/Sidebar/Sidebar.types.d.ts.map +1 -0
- package/dist/elements/Sidebar/SidebarCompound.d.ts +39 -0
- package/dist/elements/Sidebar/SidebarCompound.d.ts.map +1 -0
- package/dist/elements/Sidebar/SidebarMobileDrawer.d.ts +7 -0
- package/dist/elements/Sidebar/SidebarMobileDrawer.d.ts.map +1 -0
- package/dist/elements/Sidebar/SidebarPanel.d.ts +21 -0
- package/dist/elements/Sidebar/SidebarPanel.d.ts.map +1 -0
- package/dist/elements/Sidebar/SidebarPopover.d.ts +13 -0
- package/dist/elements/Sidebar/SidebarPopover.d.ts.map +1 -0
- package/dist/elements/Sidebar/SidebarRail.d.ts +10 -0
- package/dist/elements/Sidebar/SidebarRail.d.ts.map +1 -0
- package/dist/elements/Sidebar/SidebarRoot.d.ts +24 -0
- package/dist/elements/Sidebar/SidebarRoot.d.ts.map +1 -0
- package/dist/elements/Sidebar/index.d.ts +5 -0
- package/dist/elements/Sidebar/index.d.ts.map +1 -0
- package/dist/elements/Sidebar/index.js +3 -0
- package/dist/elements/Sidebar/index.js.map +1 -0
- package/dist/elements/Sidebar/index.mjs +3 -0
- package/dist/elements/Sidebar/index.mjs.map +1 -0
- package/dist/elements/SituationalJudgement/index.js +1 -1
- package/dist/elements/SituationalJudgement/index.js.map +1 -1
- package/dist/elements/SituationalJudgement/index.mjs +1 -1
- package/dist/elements/SituationalJudgement/index.mjs.map +1 -1
- package/dist/elements/Table/index.js +1 -1
- package/dist/elements/Table/index.js.map +1 -1
- package/dist/elements/Table/index.mjs +1 -1
- package/dist/elements/Table/index.mjs.map +1 -1
- package/dist/elements/Tabs/index.js +1 -1
- package/dist/elements/Tabs/index.js.map +1 -1
- package/dist/elements/Tabs/index.mjs +1 -1
- package/dist/elements/Tabs/index.mjs.map +1 -1
- package/dist/elements/TextField/TextField.d.ts.map +1 -1
- package/dist/elements/TextField/TextField.styles.d.ts.map +1 -1
- package/dist/elements/TextField/index.js +1 -1
- package/dist/elements/TextField/index.js.map +1 -1
- package/dist/elements/TextField/index.mjs +1 -1
- package/dist/elements/TextField/index.mjs.map +1 -1
- package/dist/elements/TimeField/TimeField.d.ts.map +1 -1
- package/dist/elements/TimeField/TimeField.types.d.ts.map +1 -1
- package/dist/elements/TimeField/index.js +1 -1
- package/dist/elements/TimeField/index.js.map +1 -1
- package/dist/elements/TimeField/index.mjs +1 -1
- package/dist/elements/TimeField/index.mjs.map +1 -1
- package/dist/elements/Toast/Toast.d.ts +21 -43
- package/dist/elements/Toast/Toast.d.ts.map +1 -1
- package/dist/elements/Toast/Toast.types.d.ts +27 -1
- package/dist/elements/Toast/Toast.types.d.ts.map +1 -1
- package/dist/elements/Toast/Toaster.d.ts +0 -12
- package/dist/elements/Toast/Toaster.d.ts.map +1 -1
- package/dist/elements/Toast/index.d.ts +1 -1
- package/dist/elements/Toast/index.d.ts.map +1 -1
- package/dist/elements/Toast/index.js +1 -1
- package/dist/elements/Toast/index.js.map +1 -1
- package/dist/elements/Toast/index.mjs +1 -1
- package/dist/elements/Toast/index.mjs.map +1 -1
- package/dist/elements/Tooltip/index.js +1 -1
- package/dist/elements/Tooltip/index.js.map +1 -1
- package/dist/elements/Tooltip/index.mjs +1 -1
- package/dist/elements/Tooltip/index.mjs.map +1 -1
- package/dist/elements/index.d.ts +5 -1
- package/dist/elements/index.d.ts.map +1 -1
- package/dist/elements/index.js +1 -1
- package/dist/elements/index.js.map +1 -1
- package/dist/elements/index.mjs +1 -1
- package/dist/elements/index.mjs.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/hooks/useMediaQuery.d.ts +12 -0
- package/dist/hooks/useMediaQuery.d.ts.map +1 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/styles/animations.css +110 -0
- package/dist/styles/defaults.css +32 -0
- package/dist/styles/index.d.ts +1 -1
- package/dist/styles/index.d.ts.map +1 -1
- package/dist/styles/index.js +1 -1
- package/dist/styles/index.js.map +1 -1
- package/dist/styles/index.mjs +1 -1
- package/dist/styles/index.mjs.map +1 -1
- package/dist/styles/shared-variants.d.ts +21 -2
- package/dist/styles/shared-variants.d.ts.map +1 -1
- package/package.json +40 -34
- package/src/elements/Chart/Chart.stories.tsx +186 -2
- package/src/elements/Modal/Modal.stories.tsx +6 -9
- package/src/elements/Sidebar/Sidebar.stories.tsx +514 -0
- package/src/elements/Toast/Toast.stories.tsx +745 -648
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
'use strict';var react=require('react'),reactAriaComponents=require('react-aria-components'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),zod=require('zod'),classVarianceAuthority=require('class-variance-authority'),jsxRuntime=require('react/jsx-runtime'),date=require('@internationalized/date');function
|
|
2
|
+
'use strict';var react=require('react'),reactAriaComponents=require('react-aria-components'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),zod=require('zod'),classVarianceAuthority=require('class-variance-authority'),jsxRuntime=require('react/jsx-runtime'),date=require('@internationalized/date');function e(...s){return tailwindMerge.twMerge(clsx.clsx(s))}var i={sm:"text-xs",default:"text-sm",lg:"text-base"};var l={sm:"h-9",default:"h-10",lg:"h-11"},o={sm:`${l.sm} px-2 text-xs`,default:`${l.default} px-3 text-sm`,lg:`${l.lg} px-4 text-base`},m="min-h-[44px] flex items-center";var N=zod.z.object({value:zod.z.custom().optional(),defaultValue:zod.z.custom().optional(),placeholderValue:zod.z.custom().optional(),granularity:zod.z.enum(["hour","minute","second"]).default("minute"),hourCycle:zod.z.union([zod.z.literal(12),zod.z.literal(24)]).optional(),hideTimeZone:zod.z.boolean().optional(),shouldForceLeadingZeros:zod.z.boolean().optional(),minValue:zod.z.custom().optional(),maxValue:zod.z.custom().optional(),isDisabled:zod.z.boolean().optional(),isReadOnly:zod.z.boolean().optional(),isRequired:zod.z.boolean().optional(),isInvalid:zod.z.boolean().optional(),validate:zod.z.function().optional(),validationBehavior:zod.z.enum(["native","aria"]).default("native"),label:zod.z.string(),description:zod.z.string().optional(),errorMessage:zod.z.union([zod.z.string(),zod.z.function()]).optional(),name:zod.z.string().optional(),size:zod.z.enum(["sm","default","lg"]).default("default"),onChange:zod.z.function().optional(),onFocus:zod.z.function().optional(),onBlur:zod.z.function().optional(),onFocusChange:zod.z.function().optional(),className:zod.z.string().optional(),autoFocus:zod.z.boolean().optional()}),c=classVarianceAuthority.cva(["inline-flex items-center rounded-md border","bg-[var(--content-background)] text-[var(--content-foreground)]","transition-colors duration-200","focus-within:ring-2 focus-within:ring-[var(--ring)] focus-within:ring-offset-2","data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50"],{variants:{size:{sm:`${o.sm} gap-0.5`,default:`${o.default} gap-0.5`,lg:`${o.lg} gap-1`},isInvalid:{true:"border-[var(--destructive-background)] focus-within:ring-[var(--destructive-background)]",false:"border-[var(--input-border)] hover:border-[var(--input-border)]/80"}},defaultVariants:{size:"default",isInvalid:false}}),u=classVarianceAuthority.cva(["tabular-nums rounded px-0.5","focus:outline-none focus:bg-[var(--accent)] focus:text-[var(--accent-foreground)]","data-[placeholder]:text-[var(--menu-muted)]","data-[type=literal]:text-[var(--menu-muted)]","data-[disabled]:opacity-50"],{variants:{size:{sm:`${i.sm} min-w-[1.5ch]`,default:`${i.default} min-w-[2ch]`,lg:`${i.lg} min-w-[2ch]`}},defaultVariants:{size:"default"}}),p=classVarianceAuthority.cva(["block font-medium text-[var(--content-foreground)]","mb-1.5",'data-[required]:after:content-["*"] data-[required]:after:ml-0.5',"data-[required]:after:text-[var(--destructive-background)]"],{variants:{size:{sm:"text-sm",default:"text-sm",lg:"text-base"}},defaultVariants:{size:"default"}}),T=classVarianceAuthority.cva(["text-[var(--menu-muted)]","mt-1"],{variants:{size:{sm:"text-xs",default:"text-sm",lg:"text-base"}},defaultVariants:{size:"default"}}),f=classVarianceAuthority.cva(["flex items-center gap-1","text-[var(--destructive-background)]","mt-1"],{variants:{size:{sm:"text-xs",default:"text-sm",lg:"text-base"}},defaultVariants:{size:"default"}});var E=react.forwardRef(({label:s,description:x,errorMessage:S,size:a="default",className:g,...d},_)=>jsxRuntime.jsxs(reactAriaComponents.TimeField,{ref:_,className:e("group flex flex-col gap-1",g),...d,children:[s&&jsxRuntime.jsx(reactAriaComponents.Label,{className:e(p({size:a})),"data-required":d.isRequired||void 0,children:s}),jsxRuntime.jsx(reactAriaComponents.DateInput,{className:e(m,c({size:a,isInvalid:d.isInvalid}),"w-fit"),children:I=>jsxRuntime.jsx(reactAriaComponents.DateSegment,{segment:I,className:e(u({size:a}))})}),x&&jsxRuntime.jsx(reactAriaComponents.Text,{slot:"description",className:e(T({size:a})),children:x}),jsxRuntime.jsx(reactAriaComponents.FieldError,{className:e(f({size:a})),children:S})]}));E.displayName="TimeField";Object.defineProperty(exports,"Time",{enumerable:true,get:function(){return date.Time}});Object.defineProperty(exports,"parseTime",{enumerable:true,get:function(){return date.parseTime}});exports.TimeField=E;exports.TimeFieldPropsSchema=N;exports.timeFieldDescriptionVariants=T;exports.timeFieldErrorVariants=f;exports.timeFieldLabelVariants=p;exports.timeFieldVariants=c;exports.timeSegmentVariants=u;//# sourceMappingURL=index.js.map
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/cn.ts","../../../src/elements/TimeField/TimeField.types.ts","../../../src/elements/TimeField/TimeField.tsx"],"names":["cn","inputs","twMerge","clsx","TimeFieldPropsSchema","z","timeFieldVariants","cva","timeSegmentVariants","timeFieldLabelVariants","timeFieldDescriptionVariants","timeFieldErrorVariants","TimeField","forwardRef","label","description","errorMessage","size","className","props","ref","jsxs","AriaTimeField","jsx","AriaLabel","AriaDateInput","segment","AriaDateSegment","AriaText","AriaFieldError"],"mappings":"wTAcO,SAASA,CAAAA,CAAAA,GAAMC,CAAAA,CAA8B,CAClD,OAAOC,qBAAAA,CAAQC,SAAAA,CAAKF,CAAM,CAAC,CAC7B,CC4DO,IAAMG,CAAAA,CAAuBC,KAAAA,CAAE,MAAA,CAAO,CAE3C,KAAA,CAAOA,KAAAA,CAAE,MAAA,EAAkB,CAAE,QAAA,EAAS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AAA,CAAAL,CAAAA,EACCS,cAAAA,CAACC,yBAAAA,CAAA,CACC,SAAA,CAAWxB,CAAAA,CAAGS,CAAAA,CAAuB,CAAE,IAAA,CAAAQ,CAAK,CAAC,CAAC,CAAA,CAC9C,eAAA,CAAeE,CAAAA,CAAM,UAAA,EAAc,MAAA,CAElC,QAAA,CAAAL,CAAAA,CACH,CAAA,CAIFS,cAAAA,CAACE,6BAAAA,CAAA,CACC,SAAA,CAAWzB,CAAAA,CACTM,CAAAA,CAAkB,CAChB,IAAA,CAAAW,CAAAA,CACA,UAAWE,CAAAA,CAAM,SACnB,CAAC,CAAA,CACD,OACF,CAAA,CAEC,QAAA,CAACO,CAAAA,EACAH,cAAAA,CAACI,+BAAAA,CAAA,CACC,OAAA,CAASD,CAAAA,CACT,SAAA,CAAW1B,CAAAA,CAAGQ,CAAAA,CAAoB,CAAE,IAAA,CAAAS,CAAK,CAAC,CAAC,CAAA,CAC7C,CAAA,CAEJ,CAAA,CAGCF,CAAAA,EACCQ,cAAAA,CAACK,wBAAAA,CAAA,CACC,IAAA,CAAK,aAAA,CACL,SAAA,CAAW5B,CAAAA,CAAGU,EAA6B,CAAE,IAAA,CAAAO,CAAK,CAAC,CAAC,CAAA,CAEnD,QAAA,CAAAF,CAAAA,CACH,CAAA,CAIFQ,cAAAA,CAACM,8BAAAA,CAAA,CAAe,SAAA,CAAW7B,CAAAA,CAAGW,CAAAA,CAAuB,CAAE,IAAA,CAAAM,CAAK,CAAC,CAAC,CAAA,CAC3D,QAAA,CAAAD,CAAAA,CACH,CAAA,CAAA,CACF,CAGN,EAEAJ,CAAAA,CAAU,WAAA,CAAc,WAAA","file":"index.js","sourcesContent":["/**\n * Class Name Utility\n * Merges Tailwind CSS classes with conflict resolution\n *\n * Combines clsx for conditional classes and tailwind-merge for deduplication\n *\n * @example\n * cn('px-2 py-1', 'px-4') // => 'py-1 px-4' (px-4 overrides px-2)\n * cn('text-red-500', condition && 'text-blue-500') // => conditional application\n */\n\nimport { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","/**\n * TimeField Component Types\n *\n * Zod schemas and TypeScript types for the TimeField component.\n * Includes CVA variant definitions for styling.\n *\n * Note: Zod schemas are used for contract tests and developer guardrails,\n * not runtime validation. This follows the established Themis pattern.\n *\n * @see {@link ../../docs/prd/timefield-prd.md} for full requirements\n */\n\nimport { z } from 'zod';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport type {\n TimeFieldProps as AriaTimeFieldProps,\n TimeValue,\n} from 'react-aria-components';\n\n// ============================================================================\n// Time Value Types (re-exported for convenience)\n// ============================================================================\n\n/**\n * Union type for all time values supported by the TimeField.\n * - Time: Time only (no date, no timezone)\n * - CalendarDateTime: Date and time (no timezone)\n * - ZonedDateTime: Date, time, and timezone\n */\nexport type { TimeValue } from 'react-aria-components';\n\n// ============================================================================\n// Granularity Type\n// ============================================================================\n\n/**\n * Controls which time segments are displayed.\n * - 'hour': Hour only (+ AM/PM in 12-hour mode)\n * - 'minute': Hour + minute (default)\n * - 'second': Hour + minute + second\n *\n * Note: Millisecond granularity is intentionally excluded - no common UI use case.\n */\nexport type TimeGranularity = 'hour' | 'minute' | 'second';\n\n// ============================================================================\n// Size Variant Type\n// ============================================================================\n\n/**\n * Size variants for TimeField component.\n * - 'sm': Compact size (36px height) - AA compliant only, not AAA\n * - 'default': Standard size (44px height) - AAA compliant\n * - 'lg': Large size (56px height) - AAA compliant\n */\nexport type TimeFieldSize = 'sm' | 'default' | 'lg';\n\n// ============================================================================\n// Hour Cycle Type\n// ============================================================================\n\n/**\n * Hour cycle format.\n * - 12: 12-hour format with AM/PM\n * - 24: 24-hour format\n */\nexport type HourCycle = 12 | 24;\n\n// ============================================================================\n// Zod Schemas\n// ============================================================================\n\n/**\n * Zod schema for TimeField props validation.\n * Used for contract tests and developer guardrails, not runtime validation.\n */\nexport const TimeFieldPropsSchema = z.object({\n // Value props\n value: z.custom<TimeValue>().optional(),\n defaultValue: z.custom<TimeValue>().optional(),\n placeholderValue: z.custom<TimeValue>().optional(),\n\n // Granularity props\n granularity: z.enum(['hour', 'minute', 'second']).default('minute'),\n hourCycle: z.union([z.literal(12), z.literal(24)]).optional(),\n hideTimeZone: z.boolean().optional(),\n shouldForceLeadingZeros: z.boolean().optional(),\n\n // Constraint props\n minValue: z.custom<TimeValue>().optional(),\n maxValue: z.custom<TimeValue>().optional(),\n\n // State props\n isDisabled: z.boolean().optional(),\n isReadOnly: z.boolean().optional(),\n isRequired: z.boolean().optional(),\n isInvalid: z.boolean().optional(),\n\n // Validation props\n /** Custom validation function that returns an error message or null */\n validate: z.function().optional(),\n validationBehavior: z.enum(['native', 'aria']).default('native'),\n\n // Display props\n label: z.string(),\n description: z.string().optional(),\n /** Error message string or render function */\n errorMessage: z.union([z.string(), z.function()]).optional(),\n\n // Form props\n name: z.string().optional(),\n\n // Variant props\n size: z.enum(['sm', 'default', 'lg']).default('default'),\n\n // Event props\n /** Called when the time value changes */\n onChange: z.function().optional(),\n /** Called when the field gains focus */\n onFocus: z.function().optional(),\n /** Called when the field loses focus */\n onBlur: z.function().optional(),\n /** Called when focus state changes */\n onFocusChange: z.function().optional(),\n\n // Standard props\n className: z.string().optional(),\n autoFocus: z.boolean().optional(),\n});\n\n// ============================================================================\n// TypeScript Types\n// ============================================================================\n\n/**\n * Custom props added to TimeField (not from React Aria).\n */\nexport interface ThemisTimeFieldCustomProps {\n /** Size variant: 'sm', 'default', or 'lg' */\n size?: TimeFieldSize;\n /** Field label */\n label?: string;\n /** Description text below the field */\n description?: string;\n /** Error message when field is invalid */\n errorMessage?: string;\n}\n\n/**\n * Props for the TimeField component.\n * Uses React Aria's TimeFieldProps directly to ensure correct function types.\n */\nexport type TimeFieldProps = AriaTimeFieldProps<TimeValue> &\n ThemisTimeFieldCustomProps;\n\n// ============================================================================\n// CVA Variants\n// ============================================================================\n\n/**\n * Variants for the TimeField input container.\n * Applies to the DateInput element wrapping time segments.\n *\n * Size notes:\n * - sm (36px): Desktop-only, AA compliant only (not AAA touch target)\n * - default (44px): AAA compliant, recommended for most use cases\n * - lg (56px): AAA compliant, enhanced touch targets\n */\nexport const timeFieldVariants = cva(\n [\n // Base styles\n 'inline-flex items-center rounded-md border',\n 'bg-[var(--content-background)] text-[var(--content-foreground)]',\n 'transition-colors duration-200',\n // Focus within\n 'focus-within:ring-2 focus-within:ring-[var(--ring)] focus-within:ring-offset-2',\n // Disabled\n 'data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50',\n ],\n {\n variants: {\n size: {\n sm: 'h-9 px-3 text-sm gap-0.5', // 36px - AA only\n default: 'h-11 px-4 text-base gap-1', // 44px - AAA\n lg: 'h-14 px-5 text-lg gap-1.5', // 56px - AAA\n },\n isInvalid: {\n true: 'border-[var(--destructive-background)] focus-within:ring-[var(--destructive-background)]',\n false: 'border-[var(--input-border)] hover:border-[var(--input-border)]/80',\n },\n },\n defaultVariants: {\n size: 'default',\n isInvalid: false,\n },\n }\n);\n\n/**\n * Variants for individual time segment elements.\n * Each segment (hour, minute, second, dayPeriod) uses these styles.\n */\nexport const timeSegmentVariants = cva(\n [\n // Base styles\n 'tabular-nums rounded px-0.5',\n // Focus\n 'focus:outline-none focus:bg-[var(--accent)] focus:text-[var(--accent-foreground)]',\n // Placeholder\n 'data-[placeholder]:text-[var(--menu-muted)]',\n // Literal segments (colons, spaces)\n 'data-[type=literal]:text-[var(--menu-muted)]',\n // Disabled\n 'data-[disabled]:opacity-50',\n ],\n {\n variants: {\n size: {\n sm: 'text-sm min-w-[1.5ch]',\n default: 'text-base min-w-[2ch]',\n lg: 'text-lg min-w-[2ch]',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n }\n);\n\n/**\n * Variants for the TimeField label.\n */\nexport const timeFieldLabelVariants = cva(\n [\n 'block font-medium text-[var(--content-foreground)]',\n 'mb-1.5',\n // Required indicator\n 'data-[required]:after:content-[\"*\"] data-[required]:after:ml-0.5',\n 'data-[required]:after:text-[var(--destructive-background)]',\n ],\n {\n variants: {\n size: {\n sm: 'text-sm',\n default: 'text-sm',\n lg: 'text-base',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n }\n);\n\n/**\n * Variants for the description text below the field.\n */\nexport const timeFieldDescriptionVariants = cva(\n [\n 'text-[var(--menu-muted)]',\n 'mt-1',\n ],\n {\n variants: {\n size: {\n sm: 'text-xs',\n default: 'text-sm',\n lg: 'text-base',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n }\n);\n\n/**\n * Variants for the error message display.\n */\nexport const timeFieldErrorVariants = cva(\n [\n 'flex items-center gap-1',\n 'text-[var(--destructive-background)]',\n 'mt-1',\n ],\n {\n variants: {\n size: {\n sm: 'text-xs',\n default: 'text-sm',\n lg: 'text-base',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n }\n);\n\n// ============================================================================\n// Variant Types (from CVA)\n// ============================================================================\n\n/**\n * Variant props for timeFieldVariants CVA function.\n */\nexport type TimeFieldVariantProps = VariantProps<typeof timeFieldVariants>;\n\n/**\n * Variant props for timeSegmentVariants CVA function.\n */\nexport type TimeSegmentVariantProps = VariantProps<typeof timeSegmentVariants>;\n","'use client';\n\n/**\n * TimeField Component\n *\n * A fully accessible time input component built on React Aria's TimeField primitive.\n * Provides keyboard-editable time segments for entering hours, minutes, and seconds.\n *\n * Features:\n * - WCAG 2.2 AAA compliant (default/lg sizes) / AA compliant (sm size)\n * - Configurable granularity (hour, minute, second)\n * - 12-hour and 24-hour format support\n * - Step increment support\n * - Min/max constraints with validation\n * - Form integration with hidden input\n * - Full keyboard navigation\n * - Screen reader accessible\n *\n * @see {@link ../../docs/prd/timefield-prd.md} for full requirements\n */\n\nimport { forwardRef, type ReactElement } from 'react';\nimport {\n TimeField as AriaTimeField,\n DateInput as AriaDateInput,\n DateSegment as AriaDateSegment,\n Label as AriaLabel,\n Text as AriaText,\n FieldError as AriaFieldError,\n} from 'react-aria-components';\nimport { cn } from '../../utils/cn';\nimport type { TimeFieldProps } from './TimeField.types';\nimport {\n timeFieldVariants,\n timeSegmentVariants,\n timeFieldLabelVariants,\n timeFieldDescriptionVariants,\n timeFieldErrorVariants,\n} from './TimeField.types';\n\n// =============================================================================\n// TimeField Component\n// =============================================================================\n\n/**\n * TimeField component for time input with keyboard-editable segments.\n *\n * @example\n * ```tsx\n * import { TimeField, Time } from '@tribepad/themis/elements/TimeField';\n *\n * // Basic usage\n * <TimeField label=\"Meeting Time\" />\n *\n * // With default value\n * <TimeField\n * label=\"Start Time\"\n * defaultValue={new Time(14, 30)}\n * />\n *\n * // 12-hour format with step\n * <TimeField\n * label=\"Appointment\"\n * hourCycle={12}\n * step={15}\n * />\n *\n * // With validation\n * <TimeField\n * label=\"Office Hours\"\n * minValue={new Time(9, 0)}\n * maxValue={new Time(17, 0)}\n * errorMessage=\"Please select a time within office hours\"\n * />\n * ```\n */\nexport const TimeField = forwardRef<HTMLDivElement, TimeFieldProps>(\n (\n {\n // Display props\n label,\n description,\n errorMessage,\n // Variant props\n size = 'default',\n // Standard props\n className,\n // All other props go to AriaTimeField\n ...props\n },\n ref\n ): ReactElement => {\n return (\n <AriaTimeField\n ref={ref}\n className={cn('group flex flex-col gap-1', className)}\n {...props}\n >\n {/* Label */}\n {label && (\n <AriaLabel\n className={cn(timeFieldLabelVariants({ size }))}\n data-required={props.isRequired || undefined}\n >\n {label}\n </AriaLabel>\n )}\n\n {/* Time Input */}\n <AriaDateInput\n className={cn(\n timeFieldVariants({\n size,\n isInvalid: props.isInvalid,\n }),\n 'w-fit'\n )}\n >\n {(segment) => (\n <AriaDateSegment\n segment={segment}\n className={cn(timeSegmentVariants({ size }))}\n />\n )}\n </AriaDateInput>\n\n {/* Description */}\n {description && (\n <AriaText\n slot=\"description\"\n className={cn(timeFieldDescriptionVariants({ size }))}\n >\n {description}\n </AriaText>\n )}\n\n {/* Error Message */}\n <AriaFieldError className={cn(timeFieldErrorVariants({ size }))}>\n {errorMessage}\n </AriaFieldError>\n </AriaTimeField>\n );\n }\n);\n\nTimeField.displayName = 'TimeField';\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/cn.ts","../../../src/styles/shared-variants.ts","../../../src/elements/TimeField/TimeField.types.ts","../../../src/elements/TimeField/TimeField.tsx"],"names":["cn","inputs","twMerge","clsx","TEXT_SIZE_SMALL_SCALE","FIELD_HEIGHTS","FIELD_INPUT_SIZES","FIELD_TOUCH_TARGET","TimeFieldPropsSchema","z","timeFieldVariants","cva","timeSegmentVariants","timeFieldLabelVariants","timeFieldDescriptionVariants","timeFieldErrorVariants","TimeField","forwardRef","label","description","errorMessage","size","className","props","ref","jsxs","AriaTimeField","jsx","AriaLabel","AriaDateInput","segment","AriaDateSegment","AriaText","AriaFieldError"],"mappings":"wTAcO,SAASA,CAAAA,CAAAA,GAAMC,CAAAA,CAA8B,CAClD,OAAOC,qBAAAA,CAAQC,UAAKF,CAAM,CAAC,CAC7B,CCkEO,IAAMG,CAAAA,CAAwB,CACnC,EAAA,CAAI,UACJ,OAAA,CAAS,SAAA,CACT,EAAA,CAAI,WACN,CAAA,CAmCO,IAAMC,CAAAA,CAAgB,CAC3B,GAAI,KAAA,CACJ,OAAA,CAAS,MAAA,CACT,EAAA,CAAI,MACN,CAAA,CAQaC,CAAAA,CAAoB,CAC/B,GAAI,CAAA,EAAGD,CAAAA,CAAc,EAAE,CAAA,aAAA,CAAA,CACvB,QAAS,CAAA,EAAGA,CAAAA,CAAc,OAAO,CAAA,aAAA,CAAA,CACjC,GAAI,CAAA,EAAGA,CAAAA,CAAc,EAAE,CAAA,eAAA,CACzB,CAAA,CASaE,CAAAA,CAAqB,gCAAA,CCrE3B,IAAMC,CAAAA,CAAuBC,MAAE,MAAA,CAAO,CAE3C,KAAA,CAAOA,KAAAA,CAAE,MAAA,EAAkB,CAAE,QAAA,EAAS,CACtC,aAAcA,KAAAA,CAAE,MAAA,EAAkB,CAAE,QAAA,EAAS,CAC7C,gBAAA,CAAkBA,KAAAA,CAAE,MAA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AA,CAGH,QAAA,CAAA,CAAAL,CAAAA,EACCS,cAAAA,CAACC,yBAAAA,CAAA,CACC,SAAA,CAAW5B,CAAAA,CAAGa,CAAAA,CAAuB,CAAE,IAAA,CAAAQ,CAAK,CAAC,CAAC,EAC9C,eAAA,CAAeE,CAAAA,CAAM,UAAA,EAAc,MAAA,CAElC,SAAAL,CAAAA,CACH,CAAA,CAIFS,cAAAA,CAACE,6BAAAA,CAAA,CACC,SAAA,CAAW7B,CAAAA,CACTO,CAAAA,CACAG,CAAAA,CAAkB,CAChB,IAAA,CAAAW,CAAAA,CACA,SAAA,CAAWE,EAAM,SACnB,CAAC,CAAA,CACD,OACF,CAAA,CAEC,QAAA,CAACO,CAAAA,EACAH,cAAAA,CAACI,gCAAA,CACC,OAAA,CAASD,CAAAA,CACT,SAAA,CAAW9B,CAAAA,CAAGY,CAAAA,CAAoB,CAAE,IAAA,CAAAS,CAAK,CAAC,CAAC,CAAA,CAC7C,CAAA,CAEJ,EAGCF,CAAAA,EACCQ,cAAAA,CAACK,wBAAAA,CAAA,CACC,KAAK,aAAA,CACL,SAAA,CAAWhC,CAAAA,CAAGc,CAAAA,CAA6B,CAAE,IAAA,CAAAO,CAAK,CAAC,CAAC,CAAA,CAEnD,QAAA,CAAAF,CAAAA,CACH,CAAA,CAIFQ,cAAAA,CAACM,8BAAAA,CAAA,CAAe,SAAA,CAAWjC,EAAGe,CAAAA,CAAuB,CAAE,IAAA,CAAAM,CAAK,CAAC,CAAC,CAAA,CAC3D,QAAA,CAAAD,EACH,CAAA,CAAA,CACF,CAGN,EAEAJ,CAAAA,CAAU,YAAc,WAAA","file":"index.js","sourcesContent":["/**\n * Class Name Utility\n * Merges Tailwind CSS classes with conflict resolution\n *\n * Combines clsx for conditional classes and tailwind-merge for deduplication\n *\n * @example\n * cn('px-2 py-1', 'px-4') // => 'py-1 px-4' (px-4 overrides px-2)\n * cn('text-red-500', condition && 'text-blue-500') // => conditional application\n */\n\nimport { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","/**\n * Shared CVA Variant Utilities\n *\n * Common patterns extracted from component variants for consistency and reduced bundle size.\n * Use these constants in CVA definitions to ensure consistent styling across Themis.\n *\n * @see interaction-states.ts for interaction-specific styles (focus, hover, pressed)\n */\n\n// =============================================================================\n// Focus Ring Patterns\n// =============================================================================\n\n/**\n * Focus-within ring (for container elements with focusable children)\n * Use when the container should show focus when any child is focused\n */\nexport const FOCUS_WITHIN_RING = [\n 'focus-within:outline-none',\n 'focus-within:ring-2',\n 'focus-within:ring-[var(--ring)]',\n 'focus-within:ring-offset-2',\n] as const;\n\n/**\n * Focus-visible ring (for directly focusable elements)\n * Use for buttons, inputs, and other interactive elements\n */\nexport const FOCUS_VISIBLE_RING = [\n 'focus-visible:outline-none',\n 'focus-visible:ring-2',\n 'focus-visible:ring-[var(--ring)]',\n 'focus-visible:ring-offset-2',\n] as const;\n\n/**\n * Standard focus ring (for elements using :focus pseudo-class)\n * Prefer focus-visible when possible for better UX\n */\nexport const FOCUS_RING = [\n 'focus:outline-none',\n 'focus:ring-2',\n 'focus:ring-[var(--ring)]',\n] as const;\n\n/**\n * Focus with background change (for segments, cells, menu items)\n */\nexport const FOCUS_HIGHLIGHT = [\n 'focus:outline-none',\n 'focus:bg-[var(--accent)]',\n 'focus:text-[var(--accent-foreground)]',\n] as const;\n\n// =============================================================================\n// Disabled State Patterns\n// =============================================================================\n\n/**\n * Standard disabled state using disabled attribute\n */\nexport const DISABLED_STANDARD = [\n 'disabled:pointer-events-none',\n 'disabled:opacity-50',\n] as const;\n\n/**\n * Disabled state using data attribute (React Aria pattern)\n */\nexport const DISABLED_DATA_ATTR = [\n 'data-[disabled]:pointer-events-none',\n 'data-[disabled]:opacity-50',\n 'data-[disabled]:cursor-not-allowed',\n] as const;\n\n// =============================================================================\n// Size-Based Text Variants\n// =============================================================================\n\n/**\n * Small text size scale (xs -> sm -> base)\n */\nexport const TEXT_SIZE_SMALL_SCALE = {\n sm: 'text-xs',\n default: 'text-sm',\n lg: 'text-base',\n} as const;\n\n/**\n * Medium text size scale (sm -> base -> lg)\n */\nexport const TEXT_SIZE_MEDIUM_SCALE = {\n sm: 'text-sm',\n default: 'text-base',\n lg: 'text-lg',\n} as const;\n\n// =============================================================================\n// Touch Target Utilities\n// =============================================================================\n\n/**\n * WCAG 2.2 AAA minimum touch target (44x44px)\n */\nexport const TOUCH_TARGET_MIN = [\n 'min-h-[44px]',\n 'min-w-[44px]',\n] as const;\n\n/**\n * Common button/cell sizes with touch target compliance\n */\nexport const INTERACTIVE_SIZES = {\n sm: 'h-9 w-9', // 36px - desktop only, NOT AAA compliant\n default: 'h-11 w-11', // 44px - AAA compliant\n lg: 'h-14 w-14', // 56px - AAA compliant, enhanced\n} as const;\n\n/**\n * Height-only sizes for fields and inputs\n */\nexport const FIELD_HEIGHTS = {\n sm: 'h-9', // 36px\n default: 'h-10', // 40px\n lg: 'h-11', // 44px\n} as const;\n\n/**\n * Layer 2: Visual sizing for form field inputs (height + padding + font).\n * Use on the <input>, <select>, or trigger element itself.\n *\n * Components may append additional classes (e.g. gap-* for segmented fields, py-* for text inputs).\n */\nexport const FIELD_INPUT_SIZES = {\n sm: `${FIELD_HEIGHTS.sm} px-2 text-xs`,\n default: `${FIELD_HEIGHTS.default} px-3 text-sm`,\n lg: `${FIELD_HEIGHTS.lg} px-4 text-base`,\n} as const;\n\n/**\n * Layer 1: Invisible touch target wrapper for form fields.\n * Apply to a <label> (or wrapper div) around the input element.\n * The <label> natively routes clicks/taps to the contained input\n * without JavaScript — achieving a 44px touch target while the\n * input stays at its visual height (h-9/h-10/h-11).\n */\nexport const FIELD_TOUCH_TARGET = 'min-h-[44px] flex items-center' as const;\n\n// =============================================================================\n// Message/Feedback Patterns\n// =============================================================================\n\n/**\n * Error message styling\n */\nexport const ERROR_MESSAGE_BASE = [\n 'flex',\n 'items-center',\n 'gap-1.5',\n 'text-[var(--destructive-background)]',\n] as const;\n\n/**\n * Success message styling\n */\nexport const SUCCESS_MESSAGE_BASE = [\n 'flex',\n 'items-center',\n 'gap-1.5',\n 'text-[var(--success-background)]',\n] as const;\n\n/**\n * Description/helper text styling\n */\nexport const DESCRIPTION_BASE = [\n 'text-[var(--menu-muted)]',\n] as const;\n\n/**\n * Label base styling\n */\nexport const LABEL_BASE = [\n 'font-medium',\n 'text-[var(--content-foreground)]',\n] as const;\n\n/**\n * Required indicator pattern\n */\nexport const REQUIRED_INDICATOR = \"after:content-['*'] after:ml-0.5 after:text-[var(--destructive-background)]\";\n\n// =============================================================================\n// Animation Patterns\n// =============================================================================\n\n/**\n * Popover/dropdown entry animation\n */\nexport const POPOVER_ANIMATION_IN = [\n 'data-[entering]:animate-in',\n 'data-[entering]:fade-in-0',\n 'data-[entering]:zoom-in-95',\n] as const;\n\n/**\n * Popover/dropdown exit animation\n */\nexport const POPOVER_ANIMATION_OUT = [\n 'data-[exiting]:animate-out',\n 'data-[exiting]:fade-out-0',\n 'data-[exiting]:zoom-out-95',\n] as const;\n\n/**\n * Modal content enter animation (fade + zoom)\n * Uses React Aria data-[entering]/data-[exiting] attributes\n */\nexport const MODAL_ANIMATION_IN = [\n 'data-[entering]:animate-in',\n 'data-[entering]:fade-in-0',\n 'data-[entering]:zoom-in-95',\n 'data-[entering]:duration-200',\n 'data-[entering]:ease-out',\n] as const;\n\n/**\n * Modal content exit animation (fade + zoom)\n * Uses React Aria data-[entering]/data-[exiting] attributes\n */\nexport const MODAL_ANIMATION_OUT = [\n 'data-[exiting]:animate-out',\n 'data-[exiting]:fade-out-0',\n 'data-[exiting]:zoom-out-95',\n 'data-[exiting]:duration-150',\n 'data-[exiting]:ease-in',\n] as const;\n\n/**\n * Modal slide enter animation (fade + slide up)\n */\nexport const MODAL_SLIDE_IN = [\n 'data-[entering]:animate-in',\n 'data-[entering]:fade-in-0',\n 'data-[entering]:slide-in-from-bottom-4',\n 'data-[entering]:duration-200',\n 'data-[entering]:ease-out',\n] as const;\n\n/**\n * Modal slide exit animation (fade + slide down)\n */\nexport const MODAL_SLIDE_OUT = [\n 'data-[exiting]:animate-out',\n 'data-[exiting]:fade-out-0',\n 'data-[exiting]:slide-out-to-bottom-4',\n 'data-[exiting]:duration-150',\n 'data-[exiting]:ease-in',\n] as const;\n\n/**\n * Modal overlay enter/exit animation (fade only)\n */\nexport const MODAL_OVERLAY_IN = [\n 'data-[entering]:animate-in',\n 'data-[entering]:fade-in-0',\n 'data-[entering]:duration-200',\n] as const;\n\nexport const MODAL_OVERLAY_OUT = [\n 'data-[exiting]:animate-out',\n 'data-[exiting]:fade-out-0',\n 'data-[exiting]:duration-150',\n] as const;\n\n/**\n * Reduced motion support (WCAG 2.2)\n */\nexport const REDUCED_MOTION = [\n 'motion-reduce:transition-none',\n 'motion-reduce:animate-none',\n] as const;\n\n/**\n * Standard transition for colors\n */\nexport const TRANSITION_COLORS = [\n 'transition-colors',\n 'duration-200',\n] as const;\n\n/**\n * Fast transition for interactions\n */\nexport const TRANSITION_FAST = [\n 'transition-colors',\n 'duration-150',\n] as const;\n\n// =============================================================================\n// Hover State Patterns\n// =============================================================================\n\n/**\n * Accent background on hover (for interactive items)\n */\nexport const HOVER_ACCENT = [\n 'hover:bg-[var(--accent)]',\n 'hover:text-[var(--accent-foreground)]',\n] as const;\n\n// =============================================================================\n// Helper Functions\n// =============================================================================\n\n/**\n * Combines multiple style arrays into a flat array for CVA base styles\n */\nexport function combineStyles(...styles: (readonly string[] | string)[]): string[] {\n return styles.flatMap(s => Array.isArray(s) ? [...s] : [s]);\n}\n","/**\n * TimeField Component Types\n *\n * Zod schemas and TypeScript types for the TimeField component.\n * Includes CVA variant definitions for styling.\n *\n * Note: Zod schemas are used for contract tests and developer guardrails,\n * not runtime validation. This follows the established Themis pattern.\n *\n * @see {@link ../../docs/prd/timefield-prd.md} for full requirements\n */\n\nimport { z } from 'zod';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { FIELD_INPUT_SIZES, TEXT_SIZE_SMALL_SCALE } from '../../styles';\nimport type {\n TimeFieldProps as AriaTimeFieldProps,\n TimeValue,\n} from 'react-aria-components';\n\n// ============================================================================\n// Time Value Types (re-exported for convenience)\n// ============================================================================\n\n/**\n * Union type for all time values supported by the TimeField.\n * - Time: Time only (no date, no timezone)\n * - CalendarDateTime: Date and time (no timezone)\n * - ZonedDateTime: Date, time, and timezone\n */\nexport type { TimeValue } from 'react-aria-components';\n\n// ============================================================================\n// Granularity Type\n// ============================================================================\n\n/**\n * Controls which time segments are displayed.\n * - 'hour': Hour only (+ AM/PM in 12-hour mode)\n * - 'minute': Hour + minute (default)\n * - 'second': Hour + minute + second\n *\n * Note: Millisecond granularity is intentionally excluded - no common UI use case.\n */\nexport type TimeGranularity = 'hour' | 'minute' | 'second';\n\n// ============================================================================\n// Size Variant Type\n// ============================================================================\n\n/**\n * Size variants for TimeField component.\n * - 'sm': Compact size (36px height) - AA compliant only, not AAA\n * - 'default': Standard size (44px height) - AAA compliant\n * - 'lg': Large size (56px height) - AAA compliant\n */\nexport type TimeFieldSize = 'sm' | 'default' | 'lg';\n\n// ============================================================================\n// Hour Cycle Type\n// ============================================================================\n\n/**\n * Hour cycle format.\n * - 12: 12-hour format with AM/PM\n * - 24: 24-hour format\n */\nexport type HourCycle = 12 | 24;\n\n// ============================================================================\n// Zod Schemas\n// ============================================================================\n\n/**\n * Zod schema for TimeField props validation.\n * Used for contract tests and developer guardrails, not runtime validation.\n */\nexport const TimeFieldPropsSchema = z.object({\n // Value props\n value: z.custom<TimeValue>().optional(),\n defaultValue: z.custom<TimeValue>().optional(),\n placeholderValue: z.custom<TimeValue>().optional(),\n\n // Granularity props\n granularity: z.enum(['hour', 'minute', 'second']).default('minute'),\n hourCycle: z.union([z.literal(12), z.literal(24)]).optional(),\n hideTimeZone: z.boolean().optional(),\n shouldForceLeadingZeros: z.boolean().optional(),\n\n // Constraint props\n minValue: z.custom<TimeValue>().optional(),\n maxValue: z.custom<TimeValue>().optional(),\n\n // State props\n isDisabled: z.boolean().optional(),\n isReadOnly: z.boolean().optional(),\n isRequired: z.boolean().optional(),\n isInvalid: z.boolean().optional(),\n\n // Validation props\n /** Custom validation function that returns an error message or null */\n validate: z.function().optional(),\n validationBehavior: z.enum(['native', 'aria']).default('native'),\n\n // Display props\n label: z.string(),\n description: z.string().optional(),\n /** Error message string or render function */\n errorMessage: z.union([z.string(), z.function()]).optional(),\n\n // Form props\n name: z.string().optional(),\n\n // Variant props\n size: z.enum(['sm', 'default', 'lg']).default('default'),\n\n // Event props\n /** Called when the time value changes */\n onChange: z.function().optional(),\n /** Called when the field gains focus */\n onFocus: z.function().optional(),\n /** Called when the field loses focus */\n onBlur: z.function().optional(),\n /** Called when focus state changes */\n onFocusChange: z.function().optional(),\n\n // Standard props\n className: z.string().optional(),\n autoFocus: z.boolean().optional(),\n});\n\n// ============================================================================\n// TypeScript Types\n// ============================================================================\n\n/**\n * Custom props added to TimeField (not from React Aria).\n */\nexport interface ThemisTimeFieldCustomProps {\n /** Size variant: 'sm', 'default', or 'lg' */\n size?: TimeFieldSize;\n /** Field label */\n label?: string;\n /** Description text below the field */\n description?: string;\n /** Error message when field is invalid */\n errorMessage?: string;\n}\n\n/**\n * Props for the TimeField component.\n * Uses React Aria's TimeFieldProps directly to ensure correct function types.\n */\nexport type TimeFieldProps = AriaTimeFieldProps<TimeValue> &\n ThemisTimeFieldCustomProps;\n\n// ============================================================================\n// CVA Variants\n// ============================================================================\n\n/**\n * Variants for the TimeField input container.\n * Applies to the DateInput element wrapping time segments.\n *\n * Size notes:\n * - sm (36px): Desktop-only, AA compliant only (not AAA touch target)\n * - default (44px): AAA compliant, recommended for most use cases\n * - lg (56px): AAA compliant, enhanced touch targets\n */\nexport const timeFieldVariants = cva(\n [\n // Base styles\n 'inline-flex items-center rounded-md border',\n 'bg-[var(--content-background)] text-[var(--content-foreground)]',\n 'transition-colors duration-200',\n // Focus within\n 'focus-within:ring-2 focus-within:ring-[var(--ring)] focus-within:ring-offset-2',\n // Disabled\n 'data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50',\n ],\n {\n variants: {\n size: {\n sm: `${FIELD_INPUT_SIZES.sm} gap-0.5`,\n default: `${FIELD_INPUT_SIZES.default} gap-0.5`,\n lg: `${FIELD_INPUT_SIZES.lg} gap-1`,\n },\n isInvalid: {\n true: 'border-[var(--destructive-background)] focus-within:ring-[var(--destructive-background)]',\n false: 'border-[var(--input-border)] hover:border-[var(--input-border)]/80',\n },\n },\n defaultVariants: {\n size: 'default',\n isInvalid: false,\n },\n }\n);\n\n/**\n * Variants for individual time segment elements.\n * Each segment (hour, minute, second, dayPeriod) uses these styles.\n */\nexport const timeSegmentVariants = cva(\n [\n // Base styles\n 'tabular-nums rounded px-0.5',\n // Focus\n 'focus:outline-none focus:bg-[var(--accent)] focus:text-[var(--accent-foreground)]',\n // Placeholder\n 'data-[placeholder]:text-[var(--menu-muted)]',\n // Literal segments (colons, spaces)\n 'data-[type=literal]:text-[var(--menu-muted)]',\n // Disabled\n 'data-[disabled]:opacity-50',\n ],\n {\n variants: {\n size: {\n sm: `${TEXT_SIZE_SMALL_SCALE.sm} min-w-[1.5ch]`,\n default: `${TEXT_SIZE_SMALL_SCALE.default} min-w-[2ch]`,\n lg: `${TEXT_SIZE_SMALL_SCALE.lg} min-w-[2ch]`,\n },\n },\n defaultVariants: {\n size: 'default',\n },\n }\n);\n\n/**\n * Variants for the TimeField label.\n */\nexport const timeFieldLabelVariants = cva(\n [\n 'block font-medium text-[var(--content-foreground)]',\n 'mb-1.5',\n // Required indicator\n 'data-[required]:after:content-[\"*\"] data-[required]:after:ml-0.5',\n 'data-[required]:after:text-[var(--destructive-background)]',\n ],\n {\n variants: {\n size: {\n sm: 'text-sm',\n default: 'text-sm',\n lg: 'text-base',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n }\n);\n\n/**\n * Variants for the description text below the field.\n */\nexport const timeFieldDescriptionVariants = cva(\n [\n 'text-[var(--menu-muted)]',\n 'mt-1',\n ],\n {\n variants: {\n size: {\n sm: 'text-xs',\n default: 'text-sm',\n lg: 'text-base',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n }\n);\n\n/**\n * Variants for the error message display.\n */\nexport const timeFieldErrorVariants = cva(\n [\n 'flex items-center gap-1',\n 'text-[var(--destructive-background)]',\n 'mt-1',\n ],\n {\n variants: {\n size: {\n sm: 'text-xs',\n default: 'text-sm',\n lg: 'text-base',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n }\n);\n\n// ============================================================================\n// Variant Types (from CVA)\n// ============================================================================\n\n/**\n * Variant props for timeFieldVariants CVA function.\n */\nexport type TimeFieldVariantProps = VariantProps<typeof timeFieldVariants>;\n\n/**\n * Variant props for timeSegmentVariants CVA function.\n */\nexport type TimeSegmentVariantProps = VariantProps<typeof timeSegmentVariants>;\n","'use client';\n\n/**\n * TimeField Component\n *\n * A fully accessible time input component built on React Aria's TimeField primitive.\n * Provides keyboard-editable time segments for entering hours, minutes, and seconds.\n *\n * Features:\n * - WCAG 2.2 AAA compliant (default/lg sizes) / AA compliant (sm size)\n * - Configurable granularity (hour, minute, second)\n * - 12-hour and 24-hour format support\n * - Step increment support\n * - Min/max constraints with validation\n * - Form integration with hidden input\n * - Full keyboard navigation\n * - Screen reader accessible\n *\n * @see {@link ../../docs/prd/timefield-prd.md} for full requirements\n */\n\nimport { forwardRef, type ReactElement } from 'react';\nimport {\n TimeField as AriaTimeField,\n DateInput as AriaDateInput,\n DateSegment as AriaDateSegment,\n Label as AriaLabel,\n Text as AriaText,\n FieldError as AriaFieldError,\n} from 'react-aria-components';\nimport { cn } from '../../utils/cn';\nimport { FIELD_TOUCH_TARGET } from '../../styles';\nimport type { TimeFieldProps } from './TimeField.types';\nimport {\n timeFieldVariants,\n timeSegmentVariants,\n timeFieldLabelVariants,\n timeFieldDescriptionVariants,\n timeFieldErrorVariants,\n} from './TimeField.types';\n\n// =============================================================================\n// TimeField Component\n// =============================================================================\n\n/**\n * TimeField component for time input with keyboard-editable segments.\n *\n * @example\n * ```tsx\n * import { TimeField, Time } from '@tribepad/themis/elements/TimeField';\n *\n * // Basic usage\n * <TimeField label=\"Meeting Time\" />\n *\n * // With default value\n * <TimeField\n * label=\"Start Time\"\n * defaultValue={new Time(14, 30)}\n * />\n *\n * // 12-hour format with step\n * <TimeField\n * label=\"Appointment\"\n * hourCycle={12}\n * step={15}\n * />\n *\n * // With validation\n * <TimeField\n * label=\"Office Hours\"\n * minValue={new Time(9, 0)}\n * maxValue={new Time(17, 0)}\n * errorMessage=\"Please select a time within office hours\"\n * />\n * ```\n */\nexport const TimeField = forwardRef<HTMLDivElement, TimeFieldProps>(\n (\n {\n // Display props\n label,\n description,\n errorMessage,\n // Variant props\n size = 'default',\n // Standard props\n className,\n // All other props go to AriaTimeField\n ...props\n },\n ref\n ): ReactElement => {\n return (\n <AriaTimeField\n ref={ref}\n className={cn('group flex flex-col gap-1', className)}\n {...props}\n >\n {/* Label */}\n {label && (\n <AriaLabel\n className={cn(timeFieldLabelVariants({ size }))}\n data-required={props.isRequired || undefined}\n >\n {label}\n </AriaLabel>\n )}\n\n {/* Time Input */}\n <AriaDateInput\n className={cn(\n FIELD_TOUCH_TARGET,\n timeFieldVariants({\n size,\n isInvalid: props.isInvalid,\n }),\n 'w-fit'\n )}\n >\n {(segment) => (\n <AriaDateSegment\n segment={segment}\n className={cn(timeSegmentVariants({ size }))}\n />\n )}\n </AriaDateInput>\n\n {/* Description */}\n {description && (\n <AriaText\n slot=\"description\"\n className={cn(timeFieldDescriptionVariants({ size }))}\n >\n {description}\n </AriaText>\n )}\n\n {/* Error Message */}\n <AriaFieldError className={cn(timeFieldErrorVariants({ size }))}>\n {errorMessage}\n </AriaFieldError>\n </AriaTimeField>\n );\n }\n);\n\nTimeField.displayName = 'TimeField';\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {forwardRef}from'react';import {TimeField,Label,DateInput,DateSegment,Text,FieldError}from'react-aria-components';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {z}from'zod';import {cva}from'class-variance-authority';import {jsxs,jsx}from'react/jsx-runtime';export{Time,parseTime}from'@internationalized/date';function
|
|
2
|
+
import {forwardRef}from'react';import {TimeField,Label,DateInput,DateSegment,Text,FieldError}from'react-aria-components';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {z}from'zod';import {cva}from'class-variance-authority';import {jsxs,jsx}from'react/jsx-runtime';export{Time,parseTime}from'@internationalized/date';function e(...s){return twMerge(clsx(s))}var i={sm:"text-xs",default:"text-sm",lg:"text-base"};var l={sm:"h-9",default:"h-10",lg:"h-11"},o={sm:`${l.sm} px-2 text-xs`,default:`${l.default} px-3 text-sm`,lg:`${l.lg} px-4 text-base`},m="min-h-[44px] flex items-center";var N=z.object({value:z.custom().optional(),defaultValue:z.custom().optional(),placeholderValue:z.custom().optional(),granularity:z.enum(["hour","minute","second"]).default("minute"),hourCycle:z.union([z.literal(12),z.literal(24)]).optional(),hideTimeZone:z.boolean().optional(),shouldForceLeadingZeros:z.boolean().optional(),minValue:z.custom().optional(),maxValue:z.custom().optional(),isDisabled:z.boolean().optional(),isReadOnly:z.boolean().optional(),isRequired:z.boolean().optional(),isInvalid:z.boolean().optional(),validate:z.function().optional(),validationBehavior:z.enum(["native","aria"]).default("native"),label:z.string(),description:z.string().optional(),errorMessage:z.union([z.string(),z.function()]).optional(),name:z.string().optional(),size:z.enum(["sm","default","lg"]).default("default"),onChange:z.function().optional(),onFocus:z.function().optional(),onBlur:z.function().optional(),onFocusChange:z.function().optional(),className:z.string().optional(),autoFocus:z.boolean().optional()}),c=cva(["inline-flex items-center rounded-md border","bg-[var(--content-background)] text-[var(--content-foreground)]","transition-colors duration-200","focus-within:ring-2 focus-within:ring-[var(--ring)] focus-within:ring-offset-2","data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50"],{variants:{size:{sm:`${o.sm} gap-0.5`,default:`${o.default} gap-0.5`,lg:`${o.lg} gap-1`},isInvalid:{true:"border-[var(--destructive-background)] focus-within:ring-[var(--destructive-background)]",false:"border-[var(--input-border)] hover:border-[var(--input-border)]/80"}},defaultVariants:{size:"default",isInvalid:false}}),u=cva(["tabular-nums rounded px-0.5","focus:outline-none focus:bg-[var(--accent)] focus:text-[var(--accent-foreground)]","data-[placeholder]:text-[var(--menu-muted)]","data-[type=literal]:text-[var(--menu-muted)]","data-[disabled]:opacity-50"],{variants:{size:{sm:`${i.sm} min-w-[1.5ch]`,default:`${i.default} min-w-[2ch]`,lg:`${i.lg} min-w-[2ch]`}},defaultVariants:{size:"default"}}),p=cva(["block font-medium text-[var(--content-foreground)]","mb-1.5",'data-[required]:after:content-["*"] data-[required]:after:ml-0.5',"data-[required]:after:text-[var(--destructive-background)]"],{variants:{size:{sm:"text-sm",default:"text-sm",lg:"text-base"}},defaultVariants:{size:"default"}}),T=cva(["text-[var(--menu-muted)]","mt-1"],{variants:{size:{sm:"text-xs",default:"text-sm",lg:"text-base"}},defaultVariants:{size:"default"}}),f=cva(["flex items-center gap-1","text-[var(--destructive-background)]","mt-1"],{variants:{size:{sm:"text-xs",default:"text-sm",lg:"text-base"}},defaultVariants:{size:"default"}});var E=forwardRef(({label:s,description:x,errorMessage:S,size:a="default",className:g,...d},_)=>jsxs(TimeField,{ref:_,className:e("group flex flex-col gap-1",g),...d,children:[s&&jsx(Label,{className:e(p({size:a})),"data-required":d.isRequired||void 0,children:s}),jsx(DateInput,{className:e(m,c({size:a,isInvalid:d.isInvalid}),"w-fit"),children:I=>jsx(DateSegment,{segment:I,className:e(u({size:a}))})}),x&&jsx(Text,{slot:"description",className:e(T({size:a})),children:x}),jsx(FieldError,{className:e(f({size:a})),children:S})]}));E.displayName="TimeField";export{E as TimeField,N as TimeFieldPropsSchema,T as timeFieldDescriptionVariants,f as timeFieldErrorVariants,p as timeFieldLabelVariants,c as timeFieldVariants,u as timeSegmentVariants};//# sourceMappingURL=index.mjs.map
|
|
3
3
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/cn.ts","../../../src/elements/TimeField/TimeField.types.ts","../../../src/elements/TimeField/TimeField.tsx"],"names":["cn","inputs","twMerge","clsx","TimeFieldPropsSchema","z","timeFieldVariants","cva","timeSegmentVariants","timeFieldLabelVariants","timeFieldDescriptionVariants","timeFieldErrorVariants","TimeField","forwardRef","label","description","errorMessage","size","className","props","ref","jsxs","AriaTimeField","jsx","AriaLabel","AriaDateInput","segment","AriaDateSegment","AriaText","AriaFieldError"],"mappings":"kVAcO,SAASA,CAAAA,CAAAA,GAAMC,CAAAA,CAA8B,CAClD,OAAOC,OAAAA,CAAQC,IAAAA,CAAKF,CAAM,CAAC,CAC7B,CC4DO,IAAMG,CAAAA,CAAuBC,CAAAA,CAAE,MAAA,CAAO,CAE3C,KAAA,CAAOA,CAAAA,CAAE,MAAA,EAAkB,CAAE,QAAA,EAAS,CACtC,YAAA,CAAcA,CAAAA,CAAE,MAAA,EAAkB,CAAE,QAAA,GACpC,gBAAA,CAAkBA,CAAAA,CAAE,MAAA,EAAkB,CAAE,QAAA,EAAS,CAGjD,WAAA,CAAaA,CAAAA,CAAE,IAAA,CAAK,CAAC,MAAA,CAAQ,QAAA,CAAU,QAAQ,CAAC,CAAA,CAAE,OAAA,CAAQ,QAAQ,CAAA,CAClE,SAAA,CAAWA,CAAAA,CAAE,KAAA,CAAM,CAACA,CAAAA,CAAE,OAAA,CAAQ,EAAE,CAAA,CAAGA,CAAAA,CAAE,OAAA,CAAQ,EAAE,CAAC,CAAC,CAAA,CAAE,UAAS,CAC5D,YAAA,CAAcA,CAAAA,CAAE,OAAA,EAAQ,CAAE,QAAA,EAAS,CACnC,uBAAA,CAAyBA,CAAAA,CAAE,OAAA,EAAQ,CAAE,QAAA,EAAS,CAG9C,QAAA,CAAUA,CAAAA,CAAE,MAAA,EAAkB,CAAE,QAAA,EAAS,CACzC,QAAA,CAAUA,CAAAA,CAAE,MAAA,EAAkB,CAAE,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A,CACL,SAAA,CAAW5B,CAAAA,CAAGU,EAA6B,CAAE,IAAA,CAAAO,CAAK,CAAC,CAAC,CAAA,CAEnD,QAAA,CAAAF,CAAAA,CACH,CAAA,CAIFQ,GAAAA,CAACM,UAAAA,CAAA,CAAe,SAAA,CAAW7B,CAAAA,CAAGW,CAAAA,CAAuB,CAAE,IAAA,CAAAM,CAAK,CAAC,CAAC,CAAA,CAC3D,QAAA,CAAAD,CAAAA,CACH,CAAA,CAAA,CACF,CAGN,EAEAJ,CAAAA,CAAU,WAAA,CAAc,WAAA","file":"index.mjs","sourcesContent":["/**\n * Class Name Utility\n * Merges Tailwind CSS classes with conflict resolution\n *\n * Combines clsx for conditional classes and tailwind-merge for deduplication\n *\n * @example\n * cn('px-2 py-1', 'px-4') // => 'py-1 px-4' (px-4 overrides px-2)\n * cn('text-red-500', condition && 'text-blue-500') // => conditional application\n */\n\nimport { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","/**\n * TimeField Component Types\n *\n * Zod schemas and TypeScript types for the TimeField component.\n * Includes CVA variant definitions for styling.\n *\n * Note: Zod schemas are used for contract tests and developer guardrails,\n * not runtime validation. This follows the established Themis pattern.\n *\n * @see {@link ../../docs/prd/timefield-prd.md} for full requirements\n */\n\nimport { z } from 'zod';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport type {\n TimeFieldProps as AriaTimeFieldProps,\n TimeValue,\n} from 'react-aria-components';\n\n// ============================================================================\n// Time Value Types (re-exported for convenience)\n// ============================================================================\n\n/**\n * Union type for all time values supported by the TimeField.\n * - Time: Time only (no date, no timezone)\n * - CalendarDateTime: Date and time (no timezone)\n * - ZonedDateTime: Date, time, and timezone\n */\nexport type { TimeValue } from 'react-aria-components';\n\n// ============================================================================\n// Granularity Type\n// ============================================================================\n\n/**\n * Controls which time segments are displayed.\n * - 'hour': Hour only (+ AM/PM in 12-hour mode)\n * - 'minute': Hour + minute (default)\n * - 'second': Hour + minute + second\n *\n * Note: Millisecond granularity is intentionally excluded - no common UI use case.\n */\nexport type TimeGranularity = 'hour' | 'minute' | 'second';\n\n// ============================================================================\n// Size Variant Type\n// ============================================================================\n\n/**\n * Size variants for TimeField component.\n * - 'sm': Compact size (36px height) - AA compliant only, not AAA\n * - 'default': Standard size (44px height) - AAA compliant\n * - 'lg': Large size (56px height) - AAA compliant\n */\nexport type TimeFieldSize = 'sm' | 'default' | 'lg';\n\n// ============================================================================\n// Hour Cycle Type\n// ============================================================================\n\n/**\n * Hour cycle format.\n * - 12: 12-hour format with AM/PM\n * - 24: 24-hour format\n */\nexport type HourCycle = 12 | 24;\n\n// ============================================================================\n// Zod Schemas\n// ============================================================================\n\n/**\n * Zod schema for TimeField props validation.\n * Used for contract tests and developer guardrails, not runtime validation.\n */\nexport const TimeFieldPropsSchema = z.object({\n // Value props\n value: z.custom<TimeValue>().optional(),\n defaultValue: z.custom<TimeValue>().optional(),\n placeholderValue: z.custom<TimeValue>().optional(),\n\n // Granularity props\n granularity: z.enum(['hour', 'minute', 'second']).default('minute'),\n hourCycle: z.union([z.literal(12), z.literal(24)]).optional(),\n hideTimeZone: z.boolean().optional(),\n shouldForceLeadingZeros: z.boolean().optional(),\n\n // Constraint props\n minValue: z.custom<TimeValue>().optional(),\n maxValue: z.custom<TimeValue>().optional(),\n\n // State props\n isDisabled: z.boolean().optional(),\n isReadOnly: z.boolean().optional(),\n isRequired: z.boolean().optional(),\n isInvalid: z.boolean().optional(),\n\n // Validation props\n /** Custom validation function that returns an error message or null */\n validate: z.function().optional(),\n validationBehavior: z.enum(['native', 'aria']).default('native'),\n\n // Display props\n label: z.string(),\n description: z.string().optional(),\n /** Error message string or render function */\n errorMessage: z.union([z.string(), z.function()]).optional(),\n\n // Form props\n name: z.string().optional(),\n\n // Variant props\n size: z.enum(['sm', 'default', 'lg']).default('default'),\n\n // Event props\n /** Called when the time value changes */\n onChange: z.function().optional(),\n /** Called when the field gains focus */\n onFocus: z.function().optional(),\n /** Called when the field loses focus */\n onBlur: z.function().optional(),\n /** Called when focus state changes */\n onFocusChange: z.function().optional(),\n\n // Standard props\n className: z.string().optional(),\n autoFocus: z.boolean().optional(),\n});\n\n// ============================================================================\n// TypeScript Types\n// ============================================================================\n\n/**\n * Custom props added to TimeField (not from React Aria).\n */\nexport interface ThemisTimeFieldCustomProps {\n /** Size variant: 'sm', 'default', or 'lg' */\n size?: TimeFieldSize;\n /** Field label */\n label?: string;\n /** Description text below the field */\n description?: string;\n /** Error message when field is invalid */\n errorMessage?: string;\n}\n\n/**\n * Props for the TimeField component.\n * Uses React Aria's TimeFieldProps directly to ensure correct function types.\n */\nexport type TimeFieldProps = AriaTimeFieldProps<TimeValue> &\n ThemisTimeFieldCustomProps;\n\n// ============================================================================\n// CVA Variants\n// ============================================================================\n\n/**\n * Variants for the TimeField input container.\n * Applies to the DateInput element wrapping time segments.\n *\n * Size notes:\n * - sm (36px): Desktop-only, AA compliant only (not AAA touch target)\n * - default (44px): AAA compliant, recommended for most use cases\n * - lg (56px): AAA compliant, enhanced touch targets\n */\nexport const timeFieldVariants = cva(\n [\n // Base styles\n 'inline-flex items-center rounded-md border',\n 'bg-[var(--content-background)] text-[var(--content-foreground)]',\n 'transition-colors duration-200',\n // Focus within\n 'focus-within:ring-2 focus-within:ring-[var(--ring)] focus-within:ring-offset-2',\n // Disabled\n 'data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50',\n ],\n {\n variants: {\n size: {\n sm: 'h-9 px-3 text-sm gap-0.5', // 36px - AA only\n default: 'h-11 px-4 text-base gap-1', // 44px - AAA\n lg: 'h-14 px-5 text-lg gap-1.5', // 56px - AAA\n },\n isInvalid: {\n true: 'border-[var(--destructive-background)] focus-within:ring-[var(--destructive-background)]',\n false: 'border-[var(--input-border)] hover:border-[var(--input-border)]/80',\n },\n },\n defaultVariants: {\n size: 'default',\n isInvalid: false,\n },\n }\n);\n\n/**\n * Variants for individual time segment elements.\n * Each segment (hour, minute, second, dayPeriod) uses these styles.\n */\nexport const timeSegmentVariants = cva(\n [\n // Base styles\n 'tabular-nums rounded px-0.5',\n // Focus\n 'focus:outline-none focus:bg-[var(--accent)] focus:text-[var(--accent-foreground)]',\n // Placeholder\n 'data-[placeholder]:text-[var(--menu-muted)]',\n // Literal segments (colons, spaces)\n 'data-[type=literal]:text-[var(--menu-muted)]',\n // Disabled\n 'data-[disabled]:opacity-50',\n ],\n {\n variants: {\n size: {\n sm: 'text-sm min-w-[1.5ch]',\n default: 'text-base min-w-[2ch]',\n lg: 'text-lg min-w-[2ch]',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n }\n);\n\n/**\n * Variants for the TimeField label.\n */\nexport const timeFieldLabelVariants = cva(\n [\n 'block font-medium text-[var(--content-foreground)]',\n 'mb-1.5',\n // Required indicator\n 'data-[required]:after:content-[\"*\"] data-[required]:after:ml-0.5',\n 'data-[required]:after:text-[var(--destructive-background)]',\n ],\n {\n variants: {\n size: {\n sm: 'text-sm',\n default: 'text-sm',\n lg: 'text-base',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n }\n);\n\n/**\n * Variants for the description text below the field.\n */\nexport const timeFieldDescriptionVariants = cva(\n [\n 'text-[var(--menu-muted)]',\n 'mt-1',\n ],\n {\n variants: {\n size: {\n sm: 'text-xs',\n default: 'text-sm',\n lg: 'text-base',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n }\n);\n\n/**\n * Variants for the error message display.\n */\nexport const timeFieldErrorVariants = cva(\n [\n 'flex items-center gap-1',\n 'text-[var(--destructive-background)]',\n 'mt-1',\n ],\n {\n variants: {\n size: {\n sm: 'text-xs',\n default: 'text-sm',\n lg: 'text-base',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n }\n);\n\n// ============================================================================\n// Variant Types (from CVA)\n// ============================================================================\n\n/**\n * Variant props for timeFieldVariants CVA function.\n */\nexport type TimeFieldVariantProps = VariantProps<typeof timeFieldVariants>;\n\n/**\n * Variant props for timeSegmentVariants CVA function.\n */\nexport type TimeSegmentVariantProps = VariantProps<typeof timeSegmentVariants>;\n","'use client';\n\n/**\n * TimeField Component\n *\n * A fully accessible time input component built on React Aria's TimeField primitive.\n * Provides keyboard-editable time segments for entering hours, minutes, and seconds.\n *\n * Features:\n * - WCAG 2.2 AAA compliant (default/lg sizes) / AA compliant (sm size)\n * - Configurable granularity (hour, minute, second)\n * - 12-hour and 24-hour format support\n * - Step increment support\n * - Min/max constraints with validation\n * - Form integration with hidden input\n * - Full keyboard navigation\n * - Screen reader accessible\n *\n * @see {@link ../../docs/prd/timefield-prd.md} for full requirements\n */\n\nimport { forwardRef, type ReactElement } from 'react';\nimport {\n TimeField as AriaTimeField,\n DateInput as AriaDateInput,\n DateSegment as AriaDateSegment,\n Label as AriaLabel,\n Text as AriaText,\n FieldError as AriaFieldError,\n} from 'react-aria-components';\nimport { cn } from '../../utils/cn';\nimport type { TimeFieldProps } from './TimeField.types';\nimport {\n timeFieldVariants,\n timeSegmentVariants,\n timeFieldLabelVariants,\n timeFieldDescriptionVariants,\n timeFieldErrorVariants,\n} from './TimeField.types';\n\n// =============================================================================\n// TimeField Component\n// =============================================================================\n\n/**\n * TimeField component for time input with keyboard-editable segments.\n *\n * @example\n * ```tsx\n * import { TimeField, Time } from '@tribepad/themis/elements/TimeField';\n *\n * // Basic usage\n * <TimeField label=\"Meeting Time\" />\n *\n * // With default value\n * <TimeField\n * label=\"Start Time\"\n * defaultValue={new Time(14, 30)}\n * />\n *\n * // 12-hour format with step\n * <TimeField\n * label=\"Appointment\"\n * hourCycle={12}\n * step={15}\n * />\n *\n * // With validation\n * <TimeField\n * label=\"Office Hours\"\n * minValue={new Time(9, 0)}\n * maxValue={new Time(17, 0)}\n * errorMessage=\"Please select a time within office hours\"\n * />\n * ```\n */\nexport const TimeField = forwardRef<HTMLDivElement, TimeFieldProps>(\n (\n {\n // Display props\n label,\n description,\n errorMessage,\n // Variant props\n size = 'default',\n // Standard props\n className,\n // All other props go to AriaTimeField\n ...props\n },\n ref\n ): ReactElement => {\n return (\n <AriaTimeField\n ref={ref}\n className={cn('group flex flex-col gap-1', className)}\n {...props}\n >\n {/* Label */}\n {label && (\n <AriaLabel\n className={cn(timeFieldLabelVariants({ size }))}\n data-required={props.isRequired || undefined}\n >\n {label}\n </AriaLabel>\n )}\n\n {/* Time Input */}\n <AriaDateInput\n className={cn(\n timeFieldVariants({\n size,\n isInvalid: props.isInvalid,\n }),\n 'w-fit'\n )}\n >\n {(segment) => (\n <AriaDateSegment\n segment={segment}\n className={cn(timeSegmentVariants({ size }))}\n />\n )}\n </AriaDateInput>\n\n {/* Description */}\n {description && (\n <AriaText\n slot=\"description\"\n className={cn(timeFieldDescriptionVariants({ size }))}\n >\n {description}\n </AriaText>\n )}\n\n {/* Error Message */}\n <AriaFieldError className={cn(timeFieldErrorVariants({ size }))}>\n {errorMessage}\n </AriaFieldError>\n </AriaTimeField>\n );\n }\n);\n\nTimeField.displayName = 'TimeField';\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/cn.ts","../../../src/styles/shared-variants.ts","../../../src/elements/TimeField/TimeField.types.ts","../../../src/elements/TimeField/TimeField.tsx"],"names":["cn","inputs","twMerge","clsx","TEXT_SIZE_SMALL_SCALE","FIELD_HEIGHTS","FIELD_INPUT_SIZES","FIELD_TOUCH_TARGET","TimeFieldPropsSchema","z","timeFieldVariants","cva","timeSegmentVariants","timeFieldLabelVariants","timeFieldDescriptionVariants","timeFieldErrorVariants","TimeField","forwardRef","label","description","errorMessage","size","className","props","ref","jsxs","AriaTimeField","jsx","AriaLabel","AriaDateInput","segment","AriaDateSegment","AriaText","AriaFieldError"],"mappings":"kVAcO,SAASA,CAAAA,CAAAA,GAAMC,CAAAA,CAA8B,CAClD,OAAOC,OAAAA,CAAQC,KAAKF,CAAM,CAAC,CAC7B,CCkEO,IAAMG,CAAAA,CAAwB,CACnC,EAAA,CAAI,UACJ,OAAA,CAAS,SAAA,CACT,EAAA,CAAI,WACN,CAA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WhC,CAAAA,CAAGc,CAAAA,CAA6B,CAAE,IAAA,CAAAO,CAAK,CAAC,CAAC,CAAA,CAEnD,QAAA,CAAAF,CAAAA,CACH,CAAA,CAIFQ,GAAAA,CAACM,UAAAA,CAAA,CAAe,SAAA,CAAWjC,EAAGe,CAAAA,CAAuB,CAAE,IAAA,CAAAM,CAAK,CAAC,CAAC,CAAA,CAC3D,QAAA,CAAAD,EACH,CAAA,CAAA,CACF,CAGN,EAEAJ,CAAAA,CAAU,YAAc,WAAA","file":"index.mjs","sourcesContent":["/**\n * Class Name Utility\n * Merges Tailwind CSS classes with conflict resolution\n *\n * Combines clsx for conditional classes and tailwind-merge for deduplication\n *\n * @example\n * cn('px-2 py-1', 'px-4') // => 'py-1 px-4' (px-4 overrides px-2)\n * cn('text-red-500', condition && 'text-blue-500') // => conditional application\n */\n\nimport { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","/**\n * Shared CVA Variant Utilities\n *\n * Common patterns extracted from component variants for consistency and reduced bundle size.\n * Use these constants in CVA definitions to ensure consistent styling across Themis.\n *\n * @see interaction-states.ts for interaction-specific styles (focus, hover, pressed)\n */\n\n// =============================================================================\n// Focus Ring Patterns\n// =============================================================================\n\n/**\n * Focus-within ring (for container elements with focusable children)\n * Use when the container should show focus when any child is focused\n */\nexport const FOCUS_WITHIN_RING = [\n 'focus-within:outline-none',\n 'focus-within:ring-2',\n 'focus-within:ring-[var(--ring)]',\n 'focus-within:ring-offset-2',\n] as const;\n\n/**\n * Focus-visible ring (for directly focusable elements)\n * Use for buttons, inputs, and other interactive elements\n */\nexport const FOCUS_VISIBLE_RING = [\n 'focus-visible:outline-none',\n 'focus-visible:ring-2',\n 'focus-visible:ring-[var(--ring)]',\n 'focus-visible:ring-offset-2',\n] as const;\n\n/**\n * Standard focus ring (for elements using :focus pseudo-class)\n * Prefer focus-visible when possible for better UX\n */\nexport const FOCUS_RING = [\n 'focus:outline-none',\n 'focus:ring-2',\n 'focus:ring-[var(--ring)]',\n] as const;\n\n/**\n * Focus with background change (for segments, cells, menu items)\n */\nexport const FOCUS_HIGHLIGHT = [\n 'focus:outline-none',\n 'focus:bg-[var(--accent)]',\n 'focus:text-[var(--accent-foreground)]',\n] as const;\n\n// =============================================================================\n// Disabled State Patterns\n// =============================================================================\n\n/**\n * Standard disabled state using disabled attribute\n */\nexport const DISABLED_STANDARD = [\n 'disabled:pointer-events-none',\n 'disabled:opacity-50',\n] as const;\n\n/**\n * Disabled state using data attribute (React Aria pattern)\n */\nexport const DISABLED_DATA_ATTR = [\n 'data-[disabled]:pointer-events-none',\n 'data-[disabled]:opacity-50',\n 'data-[disabled]:cursor-not-allowed',\n] as const;\n\n// =============================================================================\n// Size-Based Text Variants\n// =============================================================================\n\n/**\n * Small text size scale (xs -> sm -> base)\n */\nexport const TEXT_SIZE_SMALL_SCALE = {\n sm: 'text-xs',\n default: 'text-sm',\n lg: 'text-base',\n} as const;\n\n/**\n * Medium text size scale (sm -> base -> lg)\n */\nexport const TEXT_SIZE_MEDIUM_SCALE = {\n sm: 'text-sm',\n default: 'text-base',\n lg: 'text-lg',\n} as const;\n\n// =============================================================================\n// Touch Target Utilities\n// =============================================================================\n\n/**\n * WCAG 2.2 AAA minimum touch target (44x44px)\n */\nexport const TOUCH_TARGET_MIN = [\n 'min-h-[44px]',\n 'min-w-[44px]',\n] as const;\n\n/**\n * Common button/cell sizes with touch target compliance\n */\nexport const INTERACTIVE_SIZES = {\n sm: 'h-9 w-9', // 36px - desktop only, NOT AAA compliant\n default: 'h-11 w-11', // 44px - AAA compliant\n lg: 'h-14 w-14', // 56px - AAA compliant, enhanced\n} as const;\n\n/**\n * Height-only sizes for fields and inputs\n */\nexport const FIELD_HEIGHTS = {\n sm: 'h-9', // 36px\n default: 'h-10', // 40px\n lg: 'h-11', // 44px\n} as const;\n\n/**\n * Layer 2: Visual sizing for form field inputs (height + padding + font).\n * Use on the <input>, <select>, or trigger element itself.\n *\n * Components may append additional classes (e.g. gap-* for segmented fields, py-* for text inputs).\n */\nexport const FIELD_INPUT_SIZES = {\n sm: `${FIELD_HEIGHTS.sm} px-2 text-xs`,\n default: `${FIELD_HEIGHTS.default} px-3 text-sm`,\n lg: `${FIELD_HEIGHTS.lg} px-4 text-base`,\n} as const;\n\n/**\n * Layer 1: Invisible touch target wrapper for form fields.\n * Apply to a <label> (or wrapper div) around the input element.\n * The <label> natively routes clicks/taps to the contained input\n * without JavaScript — achieving a 44px touch target while the\n * input stays at its visual height (h-9/h-10/h-11).\n */\nexport const FIELD_TOUCH_TARGET = 'min-h-[44px] flex items-center' as const;\n\n// =============================================================================\n// Message/Feedback Patterns\n// =============================================================================\n\n/**\n * Error message styling\n */\nexport const ERROR_MESSAGE_BASE = [\n 'flex',\n 'items-center',\n 'gap-1.5',\n 'text-[var(--destructive-background)]',\n] as const;\n\n/**\n * Success message styling\n */\nexport const SUCCESS_MESSAGE_BASE = [\n 'flex',\n 'items-center',\n 'gap-1.5',\n 'text-[var(--success-background)]',\n] as const;\n\n/**\n * Description/helper text styling\n */\nexport const DESCRIPTION_BASE = [\n 'text-[var(--menu-muted)]',\n] as const;\n\n/**\n * Label base styling\n */\nexport const LABEL_BASE = [\n 'font-medium',\n 'text-[var(--content-foreground)]',\n] as const;\n\n/**\n * Required indicator pattern\n */\nexport const REQUIRED_INDICATOR = \"after:content-['*'] after:ml-0.5 after:text-[var(--destructive-background)]\";\n\n// =============================================================================\n// Animation Patterns\n// =============================================================================\n\n/**\n * Popover/dropdown entry animation\n */\nexport const POPOVER_ANIMATION_IN = [\n 'data-[entering]:animate-in',\n 'data-[entering]:fade-in-0',\n 'data-[entering]:zoom-in-95',\n] as const;\n\n/**\n * Popover/dropdown exit animation\n */\nexport const POPOVER_ANIMATION_OUT = [\n 'data-[exiting]:animate-out',\n 'data-[exiting]:fade-out-0',\n 'data-[exiting]:zoom-out-95',\n] as const;\n\n/**\n * Modal content enter animation (fade + zoom)\n * Uses React Aria data-[entering]/data-[exiting] attributes\n */\nexport const MODAL_ANIMATION_IN = [\n 'data-[entering]:animate-in',\n 'data-[entering]:fade-in-0',\n 'data-[entering]:zoom-in-95',\n 'data-[entering]:duration-200',\n 'data-[entering]:ease-out',\n] as const;\n\n/**\n * Modal content exit animation (fade + zoom)\n * Uses React Aria data-[entering]/data-[exiting] attributes\n */\nexport const MODAL_ANIMATION_OUT = [\n 'data-[exiting]:animate-out',\n 'data-[exiting]:fade-out-0',\n 'data-[exiting]:zoom-out-95',\n 'data-[exiting]:duration-150',\n 'data-[exiting]:ease-in',\n] as const;\n\n/**\n * Modal slide enter animation (fade + slide up)\n */\nexport const MODAL_SLIDE_IN = [\n 'data-[entering]:animate-in',\n 'data-[entering]:fade-in-0',\n 'data-[entering]:slide-in-from-bottom-4',\n 'data-[entering]:duration-200',\n 'data-[entering]:ease-out',\n] as const;\n\n/**\n * Modal slide exit animation (fade + slide down)\n */\nexport const MODAL_SLIDE_OUT = [\n 'data-[exiting]:animate-out',\n 'data-[exiting]:fade-out-0',\n 'data-[exiting]:slide-out-to-bottom-4',\n 'data-[exiting]:duration-150',\n 'data-[exiting]:ease-in',\n] as const;\n\n/**\n * Modal overlay enter/exit animation (fade only)\n */\nexport const MODAL_OVERLAY_IN = [\n 'data-[entering]:animate-in',\n 'data-[entering]:fade-in-0',\n 'data-[entering]:duration-200',\n] as const;\n\nexport const MODAL_OVERLAY_OUT = [\n 'data-[exiting]:animate-out',\n 'data-[exiting]:fade-out-0',\n 'data-[exiting]:duration-150',\n] as const;\n\n/**\n * Reduced motion support (WCAG 2.2)\n */\nexport const REDUCED_MOTION = [\n 'motion-reduce:transition-none',\n 'motion-reduce:animate-none',\n] as const;\n\n/**\n * Standard transition for colors\n */\nexport const TRANSITION_COLORS = [\n 'transition-colors',\n 'duration-200',\n] as const;\n\n/**\n * Fast transition for interactions\n */\nexport const TRANSITION_FAST = [\n 'transition-colors',\n 'duration-150',\n] as const;\n\n// =============================================================================\n// Hover State Patterns\n// =============================================================================\n\n/**\n * Accent background on hover (for interactive items)\n */\nexport const HOVER_ACCENT = [\n 'hover:bg-[var(--accent)]',\n 'hover:text-[var(--accent-foreground)]',\n] as const;\n\n// =============================================================================\n// Helper Functions\n// =============================================================================\n\n/**\n * Combines multiple style arrays into a flat array for CVA base styles\n */\nexport function combineStyles(...styles: (readonly string[] | string)[]): string[] {\n return styles.flatMap(s => Array.isArray(s) ? [...s] : [s]);\n}\n","/**\n * TimeField Component Types\n *\n * Zod schemas and TypeScript types for the TimeField component.\n * Includes CVA variant definitions for styling.\n *\n * Note: Zod schemas are used for contract tests and developer guardrails,\n * not runtime validation. This follows the established Themis pattern.\n *\n * @see {@link ../../docs/prd/timefield-prd.md} for full requirements\n */\n\nimport { z } from 'zod';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { FIELD_INPUT_SIZES, TEXT_SIZE_SMALL_SCALE } from '../../styles';\nimport type {\n TimeFieldProps as AriaTimeFieldProps,\n TimeValue,\n} from 'react-aria-components';\n\n// ============================================================================\n// Time Value Types (re-exported for convenience)\n// ============================================================================\n\n/**\n * Union type for all time values supported by the TimeField.\n * - Time: Time only (no date, no timezone)\n * - CalendarDateTime: Date and time (no timezone)\n * - ZonedDateTime: Date, time, and timezone\n */\nexport type { TimeValue } from 'react-aria-components';\n\n// ============================================================================\n// Granularity Type\n// ============================================================================\n\n/**\n * Controls which time segments are displayed.\n * - 'hour': Hour only (+ AM/PM in 12-hour mode)\n * - 'minute': Hour + minute (default)\n * - 'second': Hour + minute + second\n *\n * Note: Millisecond granularity is intentionally excluded - no common UI use case.\n */\nexport type TimeGranularity = 'hour' | 'minute' | 'second';\n\n// ============================================================================\n// Size Variant Type\n// ============================================================================\n\n/**\n * Size variants for TimeField component.\n * - 'sm': Compact size (36px height) - AA compliant only, not AAA\n * - 'default': Standard size (44px height) - AAA compliant\n * - 'lg': Large size (56px height) - AAA compliant\n */\nexport type TimeFieldSize = 'sm' | 'default' | 'lg';\n\n// ============================================================================\n// Hour Cycle Type\n// ============================================================================\n\n/**\n * Hour cycle format.\n * - 12: 12-hour format with AM/PM\n * - 24: 24-hour format\n */\nexport type HourCycle = 12 | 24;\n\n// ============================================================================\n// Zod Schemas\n// ============================================================================\n\n/**\n * Zod schema for TimeField props validation.\n * Used for contract tests and developer guardrails, not runtime validation.\n */\nexport const TimeFieldPropsSchema = z.object({\n // Value props\n value: z.custom<TimeValue>().optional(),\n defaultValue: z.custom<TimeValue>().optional(),\n placeholderValue: z.custom<TimeValue>().optional(),\n\n // Granularity props\n granularity: z.enum(['hour', 'minute', 'second']).default('minute'),\n hourCycle: z.union([z.literal(12), z.literal(24)]).optional(),\n hideTimeZone: z.boolean().optional(),\n shouldForceLeadingZeros: z.boolean().optional(),\n\n // Constraint props\n minValue: z.custom<TimeValue>().optional(),\n maxValue: z.custom<TimeValue>().optional(),\n\n // State props\n isDisabled: z.boolean().optional(),\n isReadOnly: z.boolean().optional(),\n isRequired: z.boolean().optional(),\n isInvalid: z.boolean().optional(),\n\n // Validation props\n /** Custom validation function that returns an error message or null */\n validate: z.function().optional(),\n validationBehavior: z.enum(['native', 'aria']).default('native'),\n\n // Display props\n label: z.string(),\n description: z.string().optional(),\n /** Error message string or render function */\n errorMessage: z.union([z.string(), z.function()]).optional(),\n\n // Form props\n name: z.string().optional(),\n\n // Variant props\n size: z.enum(['sm', 'default', 'lg']).default('default'),\n\n // Event props\n /** Called when the time value changes */\n onChange: z.function().optional(),\n /** Called when the field gains focus */\n onFocus: z.function().optional(),\n /** Called when the field loses focus */\n onBlur: z.function().optional(),\n /** Called when focus state changes */\n onFocusChange: z.function().optional(),\n\n // Standard props\n className: z.string().optional(),\n autoFocus: z.boolean().optional(),\n});\n\n// ============================================================================\n// TypeScript Types\n// ============================================================================\n\n/**\n * Custom props added to TimeField (not from React Aria).\n */\nexport interface ThemisTimeFieldCustomProps {\n /** Size variant: 'sm', 'default', or 'lg' */\n size?: TimeFieldSize;\n /** Field label */\n label?: string;\n /** Description text below the field */\n description?: string;\n /** Error message when field is invalid */\n errorMessage?: string;\n}\n\n/**\n * Props for the TimeField component.\n * Uses React Aria's TimeFieldProps directly to ensure correct function types.\n */\nexport type TimeFieldProps = AriaTimeFieldProps<TimeValue> &\n ThemisTimeFieldCustomProps;\n\n// ============================================================================\n// CVA Variants\n// ============================================================================\n\n/**\n * Variants for the TimeField input container.\n * Applies to the DateInput element wrapping time segments.\n *\n * Size notes:\n * - sm (36px): Desktop-only, AA compliant only (not AAA touch target)\n * - default (44px): AAA compliant, recommended for most use cases\n * - lg (56px): AAA compliant, enhanced touch targets\n */\nexport const timeFieldVariants = cva(\n [\n // Base styles\n 'inline-flex items-center rounded-md border',\n 'bg-[var(--content-background)] text-[var(--content-foreground)]',\n 'transition-colors duration-200',\n // Focus within\n 'focus-within:ring-2 focus-within:ring-[var(--ring)] focus-within:ring-offset-2',\n // Disabled\n 'data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50',\n ],\n {\n variants: {\n size: {\n sm: `${FIELD_INPUT_SIZES.sm} gap-0.5`,\n default: `${FIELD_INPUT_SIZES.default} gap-0.5`,\n lg: `${FIELD_INPUT_SIZES.lg} gap-1`,\n },\n isInvalid: {\n true: 'border-[var(--destructive-background)] focus-within:ring-[var(--destructive-background)]',\n false: 'border-[var(--input-border)] hover:border-[var(--input-border)]/80',\n },\n },\n defaultVariants: {\n size: 'default',\n isInvalid: false,\n },\n }\n);\n\n/**\n * Variants for individual time segment elements.\n * Each segment (hour, minute, second, dayPeriod) uses these styles.\n */\nexport const timeSegmentVariants = cva(\n [\n // Base styles\n 'tabular-nums rounded px-0.5',\n // Focus\n 'focus:outline-none focus:bg-[var(--accent)] focus:text-[var(--accent-foreground)]',\n // Placeholder\n 'data-[placeholder]:text-[var(--menu-muted)]',\n // Literal segments (colons, spaces)\n 'data-[type=literal]:text-[var(--menu-muted)]',\n // Disabled\n 'data-[disabled]:opacity-50',\n ],\n {\n variants: {\n size: {\n sm: `${TEXT_SIZE_SMALL_SCALE.sm} min-w-[1.5ch]`,\n default: `${TEXT_SIZE_SMALL_SCALE.default} min-w-[2ch]`,\n lg: `${TEXT_SIZE_SMALL_SCALE.lg} min-w-[2ch]`,\n },\n },\n defaultVariants: {\n size: 'default',\n },\n }\n);\n\n/**\n * Variants for the TimeField label.\n */\nexport const timeFieldLabelVariants = cva(\n [\n 'block font-medium text-[var(--content-foreground)]',\n 'mb-1.5',\n // Required indicator\n 'data-[required]:after:content-[\"*\"] data-[required]:after:ml-0.5',\n 'data-[required]:after:text-[var(--destructive-background)]',\n ],\n {\n variants: {\n size: {\n sm: 'text-sm',\n default: 'text-sm',\n lg: 'text-base',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n }\n);\n\n/**\n * Variants for the description text below the field.\n */\nexport const timeFieldDescriptionVariants = cva(\n [\n 'text-[var(--menu-muted)]',\n 'mt-1',\n ],\n {\n variants: {\n size: {\n sm: 'text-xs',\n default: 'text-sm',\n lg: 'text-base',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n }\n);\n\n/**\n * Variants for the error message display.\n */\nexport const timeFieldErrorVariants = cva(\n [\n 'flex items-center gap-1',\n 'text-[var(--destructive-background)]',\n 'mt-1',\n ],\n {\n variants: {\n size: {\n sm: 'text-xs',\n default: 'text-sm',\n lg: 'text-base',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n }\n);\n\n// ============================================================================\n// Variant Types (from CVA)\n// ============================================================================\n\n/**\n * Variant props for timeFieldVariants CVA function.\n */\nexport type TimeFieldVariantProps = VariantProps<typeof timeFieldVariants>;\n\n/**\n * Variant props for timeSegmentVariants CVA function.\n */\nexport type TimeSegmentVariantProps = VariantProps<typeof timeSegmentVariants>;\n","'use client';\n\n/**\n * TimeField Component\n *\n * A fully accessible time input component built on React Aria's TimeField primitive.\n * Provides keyboard-editable time segments for entering hours, minutes, and seconds.\n *\n * Features:\n * - WCAG 2.2 AAA compliant (default/lg sizes) / AA compliant (sm size)\n * - Configurable granularity (hour, minute, second)\n * - 12-hour and 24-hour format support\n * - Step increment support\n * - Min/max constraints with validation\n * - Form integration with hidden input\n * - Full keyboard navigation\n * - Screen reader accessible\n *\n * @see {@link ../../docs/prd/timefield-prd.md} for full requirements\n */\n\nimport { forwardRef, type ReactElement } from 'react';\nimport {\n TimeField as AriaTimeField,\n DateInput as AriaDateInput,\n DateSegment as AriaDateSegment,\n Label as AriaLabel,\n Text as AriaText,\n FieldError as AriaFieldError,\n} from 'react-aria-components';\nimport { cn } from '../../utils/cn';\nimport { FIELD_TOUCH_TARGET } from '../../styles';\nimport type { TimeFieldProps } from './TimeField.types';\nimport {\n timeFieldVariants,\n timeSegmentVariants,\n timeFieldLabelVariants,\n timeFieldDescriptionVariants,\n timeFieldErrorVariants,\n} from './TimeField.types';\n\n// =============================================================================\n// TimeField Component\n// =============================================================================\n\n/**\n * TimeField component for time input with keyboard-editable segments.\n *\n * @example\n * ```tsx\n * import { TimeField, Time } from '@tribepad/themis/elements/TimeField';\n *\n * // Basic usage\n * <TimeField label=\"Meeting Time\" />\n *\n * // With default value\n * <TimeField\n * label=\"Start Time\"\n * defaultValue={new Time(14, 30)}\n * />\n *\n * // 12-hour format with step\n * <TimeField\n * label=\"Appointment\"\n * hourCycle={12}\n * step={15}\n * />\n *\n * // With validation\n * <TimeField\n * label=\"Office Hours\"\n * minValue={new Time(9, 0)}\n * maxValue={new Time(17, 0)}\n * errorMessage=\"Please select a time within office hours\"\n * />\n * ```\n */\nexport const TimeField = forwardRef<HTMLDivElement, TimeFieldProps>(\n (\n {\n // Display props\n label,\n description,\n errorMessage,\n // Variant props\n size = 'default',\n // Standard props\n className,\n // All other props go to AriaTimeField\n ...props\n },\n ref\n ): ReactElement => {\n return (\n <AriaTimeField\n ref={ref}\n className={cn('group flex flex-col gap-1', className)}\n {...props}\n >\n {/* Label */}\n {label && (\n <AriaLabel\n className={cn(timeFieldLabelVariants({ size }))}\n data-required={props.isRequired || undefined}\n >\n {label}\n </AriaLabel>\n )}\n\n {/* Time Input */}\n <AriaDateInput\n className={cn(\n FIELD_TOUCH_TARGET,\n timeFieldVariants({\n size,\n isInvalid: props.isInvalid,\n }),\n 'w-fit'\n )}\n >\n {(segment) => (\n <AriaDateSegment\n segment={segment}\n className={cn(timeSegmentVariants({ size }))}\n />\n )}\n </AriaDateInput>\n\n {/* Description */}\n {description && (\n <AriaText\n slot=\"description\"\n className={cn(timeFieldDescriptionVariants({ size }))}\n >\n {description}\n </AriaText>\n )}\n\n {/* Error Message */}\n <AriaFieldError className={cn(timeFieldErrorVariants({ size }))}>\n {errorMessage}\n </AriaFieldError>\n </AriaTimeField>\n );\n }\n);\n\nTimeField.displayName = 'TimeField';\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ToastQueue, type QueuedToast, type ToastState as AriaToastState } from 'react-stately';
|
|
2
2
|
import { type VariantProps } from 'class-variance-authority';
|
|
3
|
-
import type { ToastContent, ToastState, ToastConfig } from './Toast.types';
|
|
3
|
+
import type { ToastContent, ToastState, ToastConfig, ToastConvenienceOptions } from './Toast.types';
|
|
4
4
|
/**
|
|
5
|
-
* Toast container variants with
|
|
6
|
-
*
|
|
5
|
+
* Toast container variants with goey-inspired blob styling
|
|
6
|
+
* Uses asymmetric border-radius for organic shape and scale animations
|
|
7
7
|
*/
|
|
8
8
|
export declare const toastVariants: (props?: ({
|
|
9
|
-
variant?: "default" | "primary" | "accent" | "destructive" | null | undefined;
|
|
9
|
+
variant?: "success" | "default" | "primary" | "accent" | "destructive" | "warning" | "info" | null | undefined;
|
|
10
10
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
11
|
/**
|
|
12
12
|
* Toaster position variants for the toast region container
|
|
@@ -14,68 +14,46 @@ export declare const toastVariants: (props?: ({
|
|
|
14
14
|
export declare const toasterVariants: (props?: ({
|
|
15
15
|
position?: "top-right" | "top-left" | "bottom-right" | "bottom-left" | "top-center" | "bottom-center" | null | undefined;
|
|
16
16
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
17
|
-
/**
|
|
18
|
-
* Get the total number of active toasts (visible + queued)
|
|
19
|
-
*/
|
|
20
17
|
export declare function getTotalActiveToasts(): number;
|
|
21
|
-
/**
|
|
22
|
-
* Subscribe to total toast count changes
|
|
23
|
-
*/
|
|
24
18
|
export declare function subscribeToTotalCount(fn: () => void): () => void;
|
|
25
|
-
/**
|
|
26
|
-
* Enhanced toast queue API with additional methods
|
|
27
|
-
* Provides closeAll, pauseAll, resumeAll on top of base ToastQueue
|
|
28
|
-
*/
|
|
29
19
|
export declare const toastQueue: {
|
|
30
|
-
/**
|
|
31
|
-
* Add a toast to the queue
|
|
32
|
-
*/
|
|
33
20
|
add: (content: ToastState, options?: {
|
|
34
21
|
timeout?: number;
|
|
35
22
|
onClose?: () => void;
|
|
36
23
|
}) => string;
|
|
37
|
-
/**
|
|
38
|
-
* Close a specific toast by key
|
|
39
|
-
*/
|
|
40
24
|
close: (key: string) => void;
|
|
41
|
-
/**
|
|
42
|
-
* Close all toasts (visible and queued)
|
|
43
|
-
*/
|
|
44
25
|
closeAll: () => void;
|
|
45
|
-
/**
|
|
46
|
-
* Pause all toast timers
|
|
47
|
-
*/
|
|
48
26
|
pauseAll: () => void;
|
|
49
|
-
/**
|
|
50
|
-
* Resume all toast timers
|
|
51
|
-
*/
|
|
52
27
|
resumeAll: () => void;
|
|
53
|
-
/**
|
|
54
|
-
* Get the visible toasts
|
|
55
|
-
*/
|
|
56
28
|
readonly visibleToasts: QueuedToast<ToastState>[];
|
|
57
|
-
/**
|
|
58
|
-
* Subscribe to queue changes
|
|
59
|
-
*/
|
|
60
29
|
subscribe: (fn: () => void) => () => void;
|
|
61
|
-
/**
|
|
62
|
-
* Get total active toasts (visible + queued)
|
|
63
|
-
*/
|
|
64
30
|
readonly totalCount: number;
|
|
65
31
|
};
|
|
32
|
+
export declare function getInternalQueue(): ToastQueue<ToastState>;
|
|
66
33
|
/**
|
|
67
|
-
*
|
|
34
|
+
* Add a toast notification programmatically
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```tsx
|
|
38
|
+
* toast("Message saved!");
|
|
39
|
+
* toast("Error occurred", { variant: "destructive" });
|
|
40
|
+
* toast.success("Saved!", { description: "Your changes were saved." });
|
|
41
|
+
* toast.error("Failed", { title: "Upload Error" });
|
|
42
|
+
* ```
|
|
68
43
|
*/
|
|
69
|
-
export declare function getInternalQueue(): ToastQueue<ToastState>;
|
|
70
44
|
export declare function toast(content: ToastContent, options?: ToastConfig): string;
|
|
45
|
+
export declare namespace toast {
|
|
46
|
+
var success: (content: ToastContent, options?: ToastConvenienceOptions) => string;
|
|
47
|
+
var error: (content: ToastContent, options?: ToastConvenienceOptions) => string;
|
|
48
|
+
var warning: (content: ToastContent, options?: ToastConvenienceOptions) => string;
|
|
49
|
+
var info: (content: ToastContent, options?: ToastConvenienceOptions) => string;
|
|
50
|
+
}
|
|
71
51
|
export interface ToastItemProps {
|
|
72
|
-
/** Toast from the queue */
|
|
73
52
|
toast: QueuedToast<ToastState>;
|
|
74
|
-
/** Toast state for managing dismissal */
|
|
75
53
|
state: AriaToastState<ToastState>;
|
|
76
54
|
}
|
|
77
55
|
/**
|
|
78
|
-
* Individual toast notification component
|
|
56
|
+
* Individual toast notification component with goey-inspired morphing design
|
|
79
57
|
* Uses React Aria useToast hook for accessibility
|
|
80
58
|
*/
|
|
81
59
|
export declare const ToastItem: import("react").NamedExoticComponent<ToastItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../src/elements/Toast/Toast.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../src/elements/Toast/Toast.tsx"],"names":[],"mappings":"AAqBA,OAAO,EAAE,UAAU,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,IAAI,cAAc,EAAE,MAAM,eAAe,CAAC;AAChG,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, ReactNode } from 'react';
|
|
3
3
|
/**
|
|
4
4
|
* Toast Component Type Definitions
|
|
5
5
|
*
|
|
@@ -26,10 +26,13 @@ export type DismissReason = z.infer<typeof DismissReasonSchema>;
|
|
|
26
26
|
* @see toast-prd.md Variant Token Mapping table
|
|
27
27
|
*/
|
|
28
28
|
export declare const ToastVariantSchema: z.ZodEnum<{
|
|
29
|
+
success: "success";
|
|
29
30
|
default: "default";
|
|
30
31
|
primary: "primary";
|
|
31
32
|
accent: "accent";
|
|
32
33
|
destructive: "destructive";
|
|
34
|
+
warning: "warning";
|
|
35
|
+
info: "info";
|
|
33
36
|
}>;
|
|
34
37
|
export type ToastVariant = z.infer<typeof ToastVariantSchema>;
|
|
35
38
|
/**
|
|
@@ -59,19 +62,34 @@ export type ToasterPosition = z.infer<typeof ToasterPositionSchema>;
|
|
|
59
62
|
*/
|
|
60
63
|
export declare const ToastOptionsSchema: z.ZodObject<{
|
|
61
64
|
variant: z.ZodDefault<z.ZodEnum<{
|
|
65
|
+
success: "success";
|
|
62
66
|
default: "default";
|
|
63
67
|
primary: "primary";
|
|
64
68
|
accent: "accent";
|
|
65
69
|
destructive: "destructive";
|
|
70
|
+
warning: "warning";
|
|
71
|
+
info: "info";
|
|
66
72
|
}>>;
|
|
67
73
|
timeout: z.ZodDefault<z.ZodNumber>;
|
|
68
74
|
onClose: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
75
|
+
title: z.ZodOptional<z.ZodString>;
|
|
76
|
+
description: z.ZodOptional<z.ZodString>;
|
|
77
|
+
showProgress: z.ZodOptional<z.ZodBoolean>;
|
|
69
78
|
}, z.core.$strip>;
|
|
70
79
|
export interface ToastOptions {
|
|
71
80
|
variant?: ToastVariant;
|
|
72
81
|
timeout?: number;
|
|
73
82
|
onClose?: (key: string, reason: DismissReason) => void;
|
|
83
|
+
title?: string;
|
|
84
|
+
description?: string;
|
|
85
|
+
icon?: ReactElement;
|
|
86
|
+
showProgress?: boolean;
|
|
74
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Options for convenience methods (toast.success, toast.error, etc.)
|
|
90
|
+
* Same as ToastOptions but without variant (set by the method)
|
|
91
|
+
*/
|
|
92
|
+
export type ToastConvenienceOptions = Omit<ToastOptions, 'variant'>;
|
|
75
93
|
/**
|
|
76
94
|
* Props for the ToastProvider component
|
|
77
95
|
* Wraps the application to provide toast queue context
|
|
@@ -136,6 +154,14 @@ export interface ToastState {
|
|
|
136
154
|
timeout: number;
|
|
137
155
|
/** Callback fired when toast is dismissed */
|
|
138
156
|
onClose?: (key: string, reason: DismissReason) => void;
|
|
157
|
+
/** Bold title text */
|
|
158
|
+
title?: string;
|
|
159
|
+
/** Secondary description text */
|
|
160
|
+
description?: string;
|
|
161
|
+
/** Custom icon override */
|
|
162
|
+
icon?: ReactElement;
|
|
163
|
+
/** Show countdown progress bar */
|
|
164
|
+
showProgress?: boolean;
|
|
139
165
|
}
|
|
140
166
|
/**
|
|
141
167
|
* Toast content type - fully customizable by developer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.types.d.ts","sourceRoot":"","sources":["../../../src/elements/Toast/Toast.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Toast.types.d.ts","sourceRoot":"","sources":["../../../src/elements/Toast/Toast.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAErD;;;;;;GAMG;AAMH;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB;;;;EAA8C,CAAC;AAC/E,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEh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H,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB;AAMD;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAEhD;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC"}
|
|
@@ -1,15 +1,3 @@
|
|
|
1
1
|
import type { ToasterProps } from './Toast.types';
|
|
2
|
-
/**
|
|
3
|
-
* Toaster - Toast region container
|
|
4
|
-
* Renders the toast notification area with proper ARIA attributes
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```tsx
|
|
8
|
-
* <ToastProvider>
|
|
9
|
-
* <App />
|
|
10
|
-
* <Toaster position="bottom-right" aria-label="Notifications" />
|
|
11
|
-
* </ToastProvider>
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
2
|
export declare const Toaster: import("react").NamedExoticComponent<ToasterProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
15
3
|
//# sourceMappingURL=Toaster.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toaster.d.ts","sourceRoot":"","sources":["../../../src/elements/Toast/Toaster.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Toaster.d.ts","sourceRoot":"","sources":["../../../src/elements/Toast/Toaster.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAkElD,eAAO,MAAM,OAAO,oGAiEnB,CAAC"}
|
|
@@ -22,6 +22,6 @@
|
|
|
22
22
|
export { toast, toastQueue, toastVariants, toasterVariants } from './Toast';
|
|
23
23
|
export { ToastProvider } from './ToastProvider';
|
|
24
24
|
export { Toaster } from './Toaster';
|
|
25
|
-
export type { ToastOptions, ToastContent, ToasterProps, ToastProviderProps, ToastVariant, ToasterPosition, DismissReason, ToastKey, ToastConfig, ToastQueueAPI, } from './Toast.types';
|
|
25
|
+
export type { ToastOptions, ToastConvenienceOptions, ToastContent, ToasterProps, ToastProviderProps, ToastVariant, ToasterPosition, DismissReason, ToastKey, ToastConfig, ToastQueueAPI, } from './Toast.types';
|
|
26
26
|
export { ToastOptionsSchema, ToasterPropsSchema, ToastProviderPropsSchema, ToastVariantSchema, ToasterPositionSchema, DismissReasonSchema, } from './Toast.types';
|
|
27
27
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/Toast/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG5E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,YAAY,EACV,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,aAAa,EACb,QAAQ,EACR,WAAW,EACX,aAAa,GACd,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,EACxB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/Toast/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG5E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,YAAY,EACV,YAAY,EACZ,uBAAuB,EACvB,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,aAAa,EACb,QAAQ,EACR,WAAW,EACX,aAAa,GACd,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,EACxB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,eAAe,CAAC"}
|