@cdx-ui/components 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +24 -0
- package/README.md +6 -2
- package/coverage.svg +1 -1
- package/docs/components/accordion/content.md +538 -0
- package/docs/components/alert/content.md +203 -0
- package/docs/components/alert-dialog/content.md +319 -0
- package/docs/components/avatar/content.md +368 -0
- package/docs/components/avatar/design.md +202 -0
- package/docs/components/badge/content.md +235 -0
- package/docs/components/bottom-sheet/content.md +351 -0
- package/docs/components/bottom-sheet/design.md +249 -0
- package/docs/components/breadcrumbs/content.md +169 -0
- package/docs/components/button/content.md +398 -0
- package/docs/components/button/design.md +258 -0
- package/docs/components/calendar/content.md +137 -0
- package/docs/components/card/content.md +283 -0
- package/docs/components/carousel/content.md +416 -0
- package/docs/components/checkbox/content.md +236 -0
- package/docs/components/checkbox/design.md +214 -0
- package/docs/components/chip/content.md +439 -0
- package/docs/components/chip/design.md +418 -0
- package/docs/components/color-area/content.md +86 -0
- package/docs/components/color-field/content.md +134 -0
- package/docs/components/color-picker/content.md +208 -0
- package/docs/components/color-slider/content.md +120 -0
- package/docs/components/color-swatch/content.md +64 -0
- package/docs/components/color-swatch-picker/content.md +126 -0
- package/docs/components/content.md +97 -0
- package/docs/components/currency-input/content.md +205 -0
- package/docs/components/data-grid/content.md +522 -0
- package/docs/components/date-field/content.md +147 -0
- package/docs/components/date-picker/content.md +360 -0
- package/docs/components/date-range-picker/content.md +301 -0
- package/docs/components/date-time-field/content.md +157 -0
- package/docs/components/date-time-list/content.md +105 -0
- package/docs/components/date-time-picker/content.md +272 -0
- package/docs/components/dialog/content.md +436 -0
- package/docs/components/dialog/design.md +192 -0
- package/docs/components/divider/content.md +112 -0
- package/docs/components/drawer/content.md +436 -0
- package/docs/components/field/content.md +277 -0
- package/docs/components/form/content.md +62 -0
- package/docs/components/full-screen-dialog/content.md +881 -0
- package/docs/components/heading/content.md +55 -0
- package/docs/components/icon/content.md +190 -0
- package/docs/components/icon-button/content.md +200 -0
- package/docs/components/icon-button/design.md +165 -0
- package/docs/components/image/content.md +104 -0
- package/docs/components/input/content.md +281 -0
- package/docs/components/input/design.md +389 -0
- package/docs/components/insurance-disclosure/content.md +103 -0
- package/docs/components/link/content.md +180 -0
- package/docs/components/link/design.md +160 -0
- package/docs/components/list-item/content.md +695 -0
- package/docs/components/menu/content.md +1247 -0
- package/docs/components/month-calendar/content.md +84 -0
- package/docs/components/month-picker/content.md +273 -0
- package/docs/components/otp-input/content.md +327 -0
- package/docs/components/progress-bar/content.md +87 -0
- package/docs/components/progress-circle/content.md +176 -0
- package/docs/components/progress-segmented/content.md +119 -0
- package/docs/components/quick-action-button/content.md +154 -0
- package/docs/components/quick-action-button/design.md +170 -0
- package/docs/components/radio/content.md +224 -0
- package/docs/components/range-calendar/content.md +123 -0
- package/docs/components/reorderable-list/content.md +309 -0
- package/docs/components/scoped-theme/content.md +47 -0
- package/docs/components/scroll-shadow/content.md +686 -0
- package/docs/components/select/content.md +400 -0
- package/docs/components/select/design.md +301 -0
- package/docs/components/skeleton/content.md +103 -0
- package/docs/components/slider/content.md +423 -0
- package/docs/components/stack/content.md +161 -0
- package/docs/components/switch/content.md +150 -0
- package/docs/components/switch/design.md +208 -0
- package/docs/components/table/content.md +548 -0
- package/docs/components/table-pagination/content.md +177 -0
- package/docs/components/tabs/content.md +292 -0
- package/docs/components/text/content.md +142 -0
- package/docs/components/textarea/content.md +222 -0
- package/docs/components/tile/content.md +703 -0
- package/docs/components/toast/content.md +456 -0
- package/docs/components/toggle-button/content.md +505 -0
- package/docs/components/tooltip/content.md +350 -0
- package/docs/components/virtualized-list/content.md +250 -0
- package/docs/foundations/content.md +9 -0
- package/docs/foundations/expressions/icons/content.md +19 -0
- package/docs/foundations/styles/tokens/all-tokens/content.md +192 -0
- package/docs/foundations/styles/tokens/what-are-tokens/content.md +33 -0
- package/docs/foundations/styles/tokens/what-are-tokens/design.md +33 -0
- package/docs/getting-started/content.md +4 -0
- package/docs/getting-started/designers/content.md +13 -0
- package/docs/getting-started/designers/design.md +13 -0
- package/docs/getting-started/developers/accessibility/content.md +31 -0
- package/docs/getting-started/developers/content.md +612 -0
- package/docs/getting-started/developers/styling/content.md +193 -0
- package/docs/llms.txt +193 -0
- package/docs/patterns/account-management/content.md +75 -0
- package/docs/patterns/authentication/content.md +52 -0
- package/docs/patterns/content.md +10 -0
- package/docs/patterns/dashboard/content.md +39 -0
- package/docs/patterns/empty-states/content.md +31 -0
- package/docs/patterns/forms/content.md +109 -0
- package/docs/patterns/onboarding/content.md +69 -0
- package/docs/patterns/payments/content.md +35 -0
- package/docs/patterns/settings/content.md +72 -0
- package/docs/resources/content.md +9 -0
- package/docs/resources/figma-libraries/content.md +42 -0
- package/docs/resources/release-notes/0.0.1-beta.118/content.md +27 -0
- package/docs/resources/release-notes/0.0.1-beta.122/content.md +21 -0
- package/docs/resources/release-notes/0.0.1-beta.124/content.md +16 -0
- package/docs/resources/release-notes/0.0.1-beta.126/content.md +10 -0
- package/docs/resources/release-notes/0.0.1-beta.127/content.md +14 -0
- package/docs/resources/release-notes/0.0.1-beta.128/content.md +9 -0
- package/docs/resources/release-notes/0.0.1-beta.129/content.md +18 -0
- package/docs/resources/release-notes/0.0.1-beta.130/content.md +18 -0
- package/docs/resources/release-notes/0.0.1-beta.133/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.134/content.md +17 -0
- package/docs/resources/release-notes/0.0.1-beta.136/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.137/content.md +10 -0
- package/docs/resources/release-notes/0.0.1-beta.138/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.139/content.md +13 -0
- package/docs/resources/release-notes/0.0.1-beta.140/content.md +26 -0
- package/docs/resources/release-notes/0.0.1-beta.141/content.md +63 -0
- package/docs/resources/release-notes/0.0.1-beta.142/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.143/content.md +12 -0
- package/docs/resources/release-notes/0.0.1-beta.144/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.145/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.147/content.md +10 -0
- package/docs/resources/release-notes/0.0.1-beta.149/content.md +10 -0
- package/docs/resources/release-notes/0.0.1-beta.150/content.md +13 -0
- package/docs/resources/release-notes/0.0.1-beta.152/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.154/content.md +15 -0
- package/docs/resources/release-notes/0.0.1-beta.156/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.158/content.md +9 -0
- package/docs/resources/release-notes/0.0.1-beta.159/content.md +11 -0
- package/docs/resources/release-notes/0.0.1-beta.160/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.161/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.163/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.164/content.md +9 -0
- package/docs/resources/release-notes/0.0.1-beta.166/content.md +17 -0
- package/docs/resources/release-notes/0.0.1-beta.167/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.168/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.169/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.171/content.md +16 -0
- package/docs/resources/release-notes/0.0.1-beta.172/content.md +24 -0
- package/docs/resources/release-notes/0.0.1-beta.173/content.md +15 -0
- package/docs/resources/release-notes/0.0.1-beta.174/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.176/content.md +32 -0
- package/docs/resources/release-notes/0.0.1-beta.179/content.md +11 -0
- package/docs/resources/release-notes/0.0.1-beta.182/content.md +13 -0
- package/docs/resources/release-notes/0.0.1-beta.185/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.187/content.md +27 -0
- package/docs/resources/release-notes/0.1.1/content.md +23 -0
- package/docs/resources/release-notes/0.1.2/content.md +7 -0
- package/docs/resources/release-notes/0.1.4/content.md +19 -0
- package/docs/resources/release-notes/0.1.5/content.md +7 -0
- package/docs/resources/release-notes/0.1.6/content.md +7 -0
- package/docs/resources/release-notes/0.2.0/content.md +31 -0
- package/docs/resources/release-notes/0.2.1/content.md +17 -0
- package/docs/resources/release-notes/0.2.2/content.md +11 -0
- package/docs/resources/release-notes/0.2.3/content.md +15 -0
- package/docs/resources/release-notes/content.md +64 -0
- package/lib/commonjs/components/Checkbox/index.js.map +1 -1
- package/lib/commonjs/components/DateTimeList/index.js +11 -26
- package/lib/commonjs/components/DateTimeList/index.js.map +1 -1
- package/lib/commonjs/components/DateTimeList/styles.js +2 -12
- package/lib/commonjs/components/DateTimeList/styles.js.map +1 -1
- package/lib/commonjs/components/Heading/index.js.map +1 -1
- package/lib/commonjs/components/Icon/index.js.map +1 -1
- package/lib/commonjs/components/ListItem/index.js +170 -9
- package/lib/commonjs/components/ListItem/index.js.map +1 -1
- package/lib/commonjs/components/ListItem/styles.js +38 -2
- package/lib/commonjs/components/ListItem/styles.js.map +1 -1
- package/lib/commonjs/components/Menu/index.js +11 -5
- package/lib/commonjs/components/Menu/index.js.map +1 -1
- package/lib/commonjs/components/RangeCalendar/index.js.map +1 -1
- package/lib/commonjs/components/ReorderableList/ReorderableListShared.js +91 -0
- package/lib/commonjs/components/ReorderableList/ReorderableListShared.js.map +1 -0
- package/lib/commonjs/components/ReorderableList/index.js +135 -0
- package/lib/commonjs/components/ReorderableList/index.js.map +1 -0
- package/lib/commonjs/components/ReorderableList/index.web.js +233 -0
- package/lib/commonjs/components/ReorderableList/index.web.js.map +1 -0
- package/lib/commonjs/components/ReorderableList/labels.js +47 -0
- package/lib/commonjs/components/ReorderableList/labels.js.map +1 -0
- package/lib/commonjs/components/ReorderableList/reorderItems.js +16 -0
- package/lib/commonjs/components/ReorderableList/reorderItems.js.map +1 -0
- package/lib/commonjs/components/ReorderableList/rowContext.js +42 -0
- package/lib/commonjs/components/ReorderableList/rowContext.js.map +1 -0
- package/lib/commonjs/components/ReorderableList/types.js +6 -0
- package/lib/commonjs/components/ReorderableList/types.js.map +1 -0
- package/lib/commonjs/components/ReorderableList/useReorder.js +131 -0
- package/lib/commonjs/components/ReorderableList/useReorder.js.map +1 -0
- package/lib/commonjs/components/ReorderableList/webDnd.js +64 -0
- package/lib/commonjs/components/ReorderableList/webDnd.js.map +1 -0
- package/lib/commonjs/components/ScopedTheme/index.js.map +1 -1
- package/lib/commonjs/components/ScrollShadow/gradient.js +29 -0
- package/lib/commonjs/components/ScrollShadow/gradient.js.map +1 -0
- package/lib/commonjs/components/ScrollShadow/index.js +171 -44
- package/lib/commonjs/components/ScrollShadow/index.js.map +1 -1
- package/lib/commonjs/components/ScrollShadow/styles.js +58 -14
- package/lib/commonjs/components/ScrollShadow/styles.js.map +1 -1
- package/lib/commonjs/components/ScrollShadow/useComposedScrollHandler.js +63 -0
- package/lib/commonjs/components/ScrollShadow/useComposedScrollHandler.js.map +1 -0
- package/lib/commonjs/components/ScrollShadow/useScrollShadow.js +48 -8
- package/lib/commonjs/components/ScrollShadow/useScrollShadow.js.map +1 -1
- package/lib/commonjs/components/Skeleton/index.js.map +1 -1
- package/lib/commonjs/components/TablePagination/index.js.map +1 -1
- package/lib/commonjs/components/Tabs/index.js +16 -23
- package/lib/commonjs/components/Tabs/index.js.map +1 -1
- package/lib/commonjs/components/Tabs/styles.js +1 -10
- package/lib/commonjs/components/Tabs/styles.js.map +1 -1
- package/lib/commonjs/components/Text/index.js.map +1 -1
- package/lib/commonjs/components/Tile/styles.js +1 -1
- package/lib/commonjs/components/Tile/styles.js.map +1 -1
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/figma/ListItem.SectionHeader.figma.js +20 -5
- package/lib/commonjs/figma/ListItem.SectionHeader.figma.js.map +1 -1
- package/lib/commonjs/reorderable-list.js +17 -0
- package/lib/commonjs/reorderable-list.js.map +1 -0
- package/lib/module/components/Checkbox/index.js.map +1 -1
- package/lib/module/components/DateTimeList/index.js +12 -27
- package/lib/module/components/DateTimeList/index.js.map +1 -1
- package/lib/module/components/DateTimeList/styles.js +1 -11
- package/lib/module/components/DateTimeList/styles.js.map +1 -1
- package/lib/module/components/Heading/index.js.map +1 -1
- package/lib/module/components/Icon/index.js.map +1 -1
- package/lib/module/components/ListItem/index.js +163 -14
- package/lib/module/components/ListItem/index.js.map +1 -1
- package/lib/module/components/ListItem/styles.js +37 -1
- package/lib/module/components/ListItem/styles.js.map +1 -1
- package/lib/module/components/Menu/index.js +11 -5
- package/lib/module/components/Menu/index.js.map +1 -1
- package/lib/module/components/RangeCalendar/index.js.map +1 -1
- package/lib/module/components/ReorderableList/ReorderableListShared.js +86 -0
- package/lib/module/components/ReorderableList/ReorderableListShared.js.map +1 -0
- package/lib/module/components/ReorderableList/index.js +130 -0
- package/lib/module/components/ReorderableList/index.js.map +1 -0
- package/lib/module/components/ReorderableList/index.web.js +229 -0
- package/lib/module/components/ReorderableList/index.web.js.map +1 -0
- package/lib/module/components/ReorderableList/labels.js +41 -0
- package/lib/module/components/ReorderableList/labels.js.map +1 -0
- package/lib/module/components/ReorderableList/reorderItems.js +12 -0
- package/lib/module/components/ReorderableList/reorderItems.js.map +1 -0
- package/lib/module/components/ReorderableList/rowContext.js +38 -0
- package/lib/module/components/ReorderableList/rowContext.js.map +1 -0
- package/lib/module/components/ReorderableList/types.js +4 -0
- package/lib/module/components/ReorderableList/types.js.map +1 -0
- package/lib/module/components/ReorderableList/useReorder.js +123 -0
- package/lib/module/components/ReorderableList/useReorder.js.map +1 -0
- package/lib/module/components/ReorderableList/webDnd.js +59 -0
- package/lib/module/components/ReorderableList/webDnd.js.map +1 -0
- package/lib/module/components/ScopedTheme/index.js.map +1 -1
- package/lib/module/components/ScrollShadow/gradient.js +24 -0
- package/lib/module/components/ScrollShadow/gradient.js.map +1 -0
- package/lib/module/components/ScrollShadow/index.js +170 -48
- package/lib/module/components/ScrollShadow/index.js.map +1 -1
- package/lib/module/components/ScrollShadow/styles.js +57 -13
- package/lib/module/components/ScrollShadow/styles.js.map +1 -1
- package/lib/module/components/ScrollShadow/useComposedScrollHandler.js +57 -0
- package/lib/module/components/ScrollShadow/useComposedScrollHandler.js.map +1 -0
- package/lib/module/components/ScrollShadow/useScrollShadow.js +46 -8
- package/lib/module/components/ScrollShadow/useScrollShadow.js.map +1 -1
- package/lib/module/components/Skeleton/index.js.map +1 -1
- package/lib/module/components/TablePagination/index.js.map +1 -1
- package/lib/module/components/Tabs/index.js +17 -24
- package/lib/module/components/Tabs/index.js.map +1 -1
- package/lib/module/components/Tabs/styles.js +0 -9
- package/lib/module/components/Tabs/styles.js.map +1 -1
- package/lib/module/components/Text/index.js.map +1 -1
- package/lib/module/components/Tile/styles.js +1 -1
- package/lib/module/components/Tile/styles.js.map +1 -1
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/figma/ListItem.SectionHeader.figma.js +20 -5
- package/lib/module/figma/ListItem.SectionHeader.figma.js.map +1 -1
- package/lib/module/reorderable-list.js +4 -0
- package/lib/module/reorderable-list.js.map +1 -0
- package/lib/typescript/components/Checkbox/index.d.ts +22 -0
- package/lib/typescript/components/Checkbox/index.d.ts.map +1 -1
- package/lib/typescript/components/DateTimeList/index.d.ts.map +1 -1
- package/lib/typescript/components/DateTimeList/styles.d.ts +1 -4
- package/lib/typescript/components/DateTimeList/styles.d.ts.map +1 -1
- package/lib/typescript/components/Heading/index.d.ts +20 -2
- package/lib/typescript/components/Heading/index.d.ts.map +1 -1
- package/lib/typescript/components/Icon/index.d.ts +2 -0
- package/lib/typescript/components/Icon/index.d.ts.map +1 -1
- package/lib/typescript/components/ListItem/index.d.ts +28 -5
- package/lib/typescript/components/ListItem/index.d.ts.map +1 -1
- package/lib/typescript/components/ListItem/styles.d.ts +6 -1
- package/lib/typescript/components/ListItem/styles.d.ts.map +1 -1
- package/lib/typescript/components/Menu/index.d.ts +116 -4
- package/lib/typescript/components/Menu/index.d.ts.map +1 -1
- package/lib/typescript/components/RangeCalendar/index.d.ts +2 -0
- package/lib/typescript/components/RangeCalendar/index.d.ts.map +1 -1
- package/lib/typescript/components/ReorderableList/ReorderableListShared.d.ts +31 -0
- package/lib/typescript/components/ReorderableList/ReorderableListShared.d.ts.map +1 -0
- package/lib/typescript/components/ReorderableList/index.d.ts +8 -0
- package/lib/typescript/components/ReorderableList/index.d.ts.map +1 -0
- package/lib/typescript/components/ReorderableList/index.web.d.ts +8 -0
- package/lib/typescript/components/ReorderableList/index.web.d.ts.map +1 -0
- package/lib/typescript/components/ReorderableList/labels.d.ts +16 -0
- package/lib/typescript/components/ReorderableList/labels.d.ts.map +1 -0
- package/lib/typescript/components/ReorderableList/reorderItems.d.ts +3 -0
- package/lib/typescript/components/ReorderableList/reorderItems.d.ts.map +1 -0
- package/lib/typescript/components/ReorderableList/rowContext.d.ts +57 -0
- package/lib/typescript/components/ReorderableList/rowContext.d.ts.map +1 -0
- package/lib/typescript/components/ReorderableList/types.d.ts +75 -0
- package/lib/typescript/components/ReorderableList/types.d.ts.map +1 -0
- package/lib/typescript/components/ReorderableList/useReorder.d.ts +31 -0
- package/lib/typescript/components/ReorderableList/useReorder.d.ts.map +1 -0
- package/lib/typescript/components/ReorderableList/webDnd.d.ts +27 -0
- package/lib/typescript/components/ReorderableList/webDnd.d.ts.map +1 -0
- package/lib/typescript/components/ScopedTheme/index.d.ts +6 -1
- package/lib/typescript/components/ScopedTheme/index.d.ts.map +1 -1
- package/lib/typescript/components/ScrollShadow/gradient.d.ts +7 -0
- package/lib/typescript/components/ScrollShadow/gradient.d.ts.map +1 -0
- package/lib/typescript/components/ScrollShadow/index.d.ts +57 -15
- package/lib/typescript/components/ScrollShadow/index.d.ts.map +1 -1
- package/lib/typescript/components/ScrollShadow/styles.d.ts +8 -2
- package/lib/typescript/components/ScrollShadow/styles.d.ts.map +1 -1
- package/lib/typescript/components/ScrollShadow/useComposedScrollHandler.d.ts +13 -0
- package/lib/typescript/components/ScrollShadow/useComposedScrollHandler.d.ts.map +1 -0
- package/lib/typescript/components/ScrollShadow/useScrollShadow.d.ts +15 -2
- package/lib/typescript/components/ScrollShadow/useScrollShadow.d.ts.map +1 -1
- package/lib/typescript/components/Skeleton/index.d.ts +3 -0
- package/lib/typescript/components/Skeleton/index.d.ts.map +1 -1
- package/lib/typescript/components/TablePagination/index.d.ts +54 -0
- package/lib/typescript/components/TablePagination/index.d.ts.map +1 -1
- package/lib/typescript/components/Tabs/index.d.ts.map +1 -1
- package/lib/typescript/components/Tabs/styles.d.ts +0 -7
- package/lib/typescript/components/Tabs/styles.d.ts.map +1 -1
- package/lib/typescript/components/Text/index.d.ts +12 -2
- package/lib/typescript/components/Text/index.d.ts.map +1 -1
- package/lib/typescript/components/Tile/styles.d.ts.map +1 -1
- package/lib/typescript/components/ToggleButton/styles.d.ts +1 -1
- package/lib/typescript/components/index.d.ts +1 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/figma/ListItem.SectionHeader.figma.d.ts.map +1 -1
- package/lib/typescript/reorderable-list.d.ts +2 -0
- package/lib/typescript/reorderable-list.d.ts.map +1 -0
- package/package.json +37 -8
- package/src/components/Checkbox/index.tsx +22 -0
- package/src/components/DateTimeList/index.tsx +13 -26
- package/src/components/DateTimeList/styles.ts +1 -10
- package/src/components/Heading/index.tsx +10 -1
- package/src/components/Icon/index.tsx +2 -0
- package/src/components/ListItem/index.tsx +232 -15
- package/src/components/ListItem/styles.ts +41 -0
- package/src/components/Menu/index.tsx +128 -12
- package/src/components/RangeCalendar/index.tsx +2 -0
- package/src/components/ReorderableList/ReorderableListShared.tsx +113 -0
- package/src/components/ReorderableList/index.tsx +162 -0
- package/src/components/ReorderableList/index.web.tsx +254 -0
- package/src/components/ReorderableList/labels.ts +52 -0
- package/src/components/ReorderableList/reorderItems.ts +16 -0
- package/src/components/ReorderableList/rowContext.tsx +72 -0
- package/src/components/ReorderableList/types.ts +80 -0
- package/src/components/ReorderableList/useReorder.ts +159 -0
- package/src/components/ReorderableList/webDnd.ts +60 -0
- package/src/components/ScopedTheme/index.tsx +6 -1
- package/src/components/ScrollShadow/gradient.ts +48 -0
- package/src/components/ScrollShadow/index.tsx +300 -69
- package/src/components/ScrollShadow/styles.ts +45 -28
- package/src/components/ScrollShadow/useComposedScrollHandler.ts +58 -0
- package/src/components/ScrollShadow/useScrollShadow.ts +72 -10
- package/src/components/Skeleton/index.tsx +3 -0
- package/src/components/TablePagination/index.tsx +54 -0
- package/src/components/Tabs/index.tsx +25 -35
- package/src/components/Tabs/styles.ts +0 -9
- package/src/components/Text/index.tsx +6 -1
- package/src/components/Tile/styles.ts +4 -1
- package/src/components/index.ts +5 -0
- package/src/reorderable-list.ts +1 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Month Calendar (https://design.candescent.com/docs/components/month-calendar)
|
|
2
|
+
|
|
3
|
+
Resources: [Figma](https://www.figma.com/design/0lEVMVlLj8ZS4fgItr3pmd/%E2%AD%90-Forge-DS--Components?node-id=12010-27571), [Storybook](https://victorious-wave-0daadf00f.6.azurestaticapps.net/?path=/story/date-time-monthcalendar--default)
|
|
4
|
+
|
|
5
|
+
`MonthCalendar` renders month and year grids for selecting a single month — there are no day cells. Values are `MonthId` strings in `YYYY-MM-01` format.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { MonthCalendar } from '@cdx-ui/components';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic
|
|
12
|
+
|
|
13
|
+
Control the selected month with `value` and `onValueChange`.
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { useState } from 'react';
|
|
17
|
+
import { MonthCalendar } from '@cdx-ui/components';
|
|
18
|
+
import { monthId, type MonthId } from '@cdx-ui/formatters';
|
|
19
|
+
|
|
20
|
+
export default function MonthCalendarBasicDemo() {
|
|
21
|
+
const [value, setValue] = useState<MonthId | undefined>(monthId('2026-07-01'));
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<MonthCalendar
|
|
25
|
+
value={value}
|
|
26
|
+
onValueChange={setValue}
|
|
27
|
+
aria-label="Statement month"
|
|
28
|
+
className="w-full max-w-sm"
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Disabled
|
|
35
|
+
|
|
36
|
+
Set `disabled` to render a read-only grid that ignores month presses.
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
import { MonthCalendar } from '@cdx-ui/components';
|
|
40
|
+
import { monthId } from '@cdx-ui/formatters';
|
|
41
|
+
|
|
42
|
+
export default function MonthCalendarDisabledDemo() {
|
|
43
|
+
return (
|
|
44
|
+
<MonthCalendar
|
|
45
|
+
value={monthId('2026-07-01')}
|
|
46
|
+
disabled
|
|
47
|
+
aria-label="Statement month"
|
|
48
|
+
className="w-full max-w-sm"
|
|
49
|
+
/>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## API
|
|
55
|
+
|
|
56
|
+
### MonthCalendar
|
|
57
|
+
|
|
58
|
+
By default, `MonthCalendar` renders a year header — tap it to switch to the year picker, or use the previous/next controls to shift the visible year — followed by a twelve-month grid. `locale` defaults to `en-US` and controls month formatting.
|
|
59
|
+
|
|
60
|
+
| Prop | Type | Default | Description |
|
|
61
|
+
| --- | --- | --- | --- |
|
|
62
|
+
| `className?` | `string` | — | — |
|
|
63
|
+
| `children?` | `ReactNode` | — | — |
|
|
64
|
+
| `asChild?` | `boolean` | — | — |
|
|
65
|
+
| `value?` | `MonthId` | — | — |
|
|
66
|
+
| `defaultValue?` | `MonthId` | — | — |
|
|
67
|
+
| `onValueChange?` | `((value: MonthId) => void)` | — | Called with the new `MonthId`, or `undefined` when the selection is cleared. |
|
|
68
|
+
| `view?` | `'month' \| 'year'` | — | — |
|
|
69
|
+
| `defaultView?` | `'month' \| 'year'` | — | — |
|
|
70
|
+
| `onViewChange?` | `((view: MonthCalendarView) => void)` | — | — |
|
|
71
|
+
| `visibleYear?` | `number` | — | — |
|
|
72
|
+
| `defaultVisibleYear?` | `number` | — | — |
|
|
73
|
+
| `onVisibleYearChange?` | `((year: number) => void)` | — | — |
|
|
74
|
+
| `disabled?` | `boolean` | — | — |
|
|
75
|
+
| `minValue?` | `MonthId` | — | Earliest selectable month. Build with `monthId(...)` from `@cdx-ui/formatters`. |
|
|
76
|
+
| `maxValue?` | `MonthId` | — | Latest selectable month. Build with `monthId(...)` from `@cdx-ui/formatters`. |
|
|
77
|
+
| `locale?` | `string` | — | — |
|
|
78
|
+
| `labels?` | `Partial<DateComponentLabels>` | — | — |
|
|
79
|
+
|
|
80
|
+
Inherits all [`ViewProps`](https://reactnative.dev/docs/view#props).
|
|
81
|
+
|
|
82
|
+
## Accessibility
|
|
83
|
+
|
|
84
|
+
Pass `accessibilityLabel` to name the calendar for assistive technology; the root carries no landmark role of its own. Every month and year is unselectable while `disabled`.
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
# Month Picker (https://design.candescent.com/docs/components/month-picker)
|
|
2
|
+
|
|
3
|
+
Resources: [Storybook](https://victorious-wave-0daadf00f.6.azurestaticapps.net/?path=/story/date-time-monthpicker--standalone)
|
|
4
|
+
|
|
5
|
+
`MonthPicker` pairs a segmented `DateField` in month mode with a `MonthCalendar` and coordinates the surface that presents it. Values are `MonthId` strings in `YYYY-MM-01` format.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { DateField, Field, MonthPicker } from '@cdx-ui/components';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic
|
|
12
|
+
|
|
13
|
+
Wrap the whole `DateField.Group` — the input plus a decorative `MonthPicker.TriggerIndicator` in a `DateField.Suffix` — in a single `MonthPicker.Trigger` so the entire field is one large tap target. Because month selection is surface-driven, there is no typing to interrupt. `MonthPicker.Popover` anchors to the field and is the preferred surface on web.
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { useState } from 'react';
|
|
17
|
+
import { DateField, Field, MonthPicker } from '@cdx-ui/components';
|
|
18
|
+
import type { MonthId } from '@cdx-ui/formatters';
|
|
19
|
+
|
|
20
|
+
export default function MonthPickerBasicDemo() {
|
|
21
|
+
const [value, setValue] = useState<MonthId | undefined>();
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Field className="w-full max-w-xs">
|
|
25
|
+
<MonthPicker value={value} onValueChange={setValue}>
|
|
26
|
+
<Field.Label>Statement month</Field.Label>
|
|
27
|
+
<MonthPicker.Trigger className="w-full">
|
|
28
|
+
<DateField.Group fullWidth>
|
|
29
|
+
<DateField.Input />
|
|
30
|
+
<DateField.Suffix>
|
|
31
|
+
<MonthPicker.TriggerIndicator />
|
|
32
|
+
</DateField.Suffix>
|
|
33
|
+
</DateField.Group>
|
|
34
|
+
</MonthPicker.Trigger>
|
|
35
|
+
<MonthPicker.Popover>
|
|
36
|
+
<MonthPicker.Calendar aria-label="Statement month" />
|
|
37
|
+
</MonthPicker.Popover>
|
|
38
|
+
</MonthPicker>
|
|
39
|
+
</Field>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Dialog
|
|
45
|
+
|
|
46
|
+
Use `MonthPicker.Dialog` to present the calendar in a modal surface.
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
import { useState } from 'react';
|
|
50
|
+
import { DateField, Field, MonthPicker } from '@cdx-ui/components';
|
|
51
|
+
import type { MonthId } from '@cdx-ui/formatters';
|
|
52
|
+
|
|
53
|
+
export default function MonthPickerDialogDemo() {
|
|
54
|
+
const [value, setValue] = useState<MonthId | undefined>();
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<Field className="w-full max-w-xs">
|
|
58
|
+
<MonthPicker value={value} onValueChange={setValue}>
|
|
59
|
+
<Field.Label>Statement month</Field.Label>
|
|
60
|
+
<MonthPicker.Trigger className="w-full">
|
|
61
|
+
<DateField.Group fullWidth>
|
|
62
|
+
<DateField.Input />
|
|
63
|
+
<DateField.Suffix>
|
|
64
|
+
<MonthPicker.TriggerIndicator />
|
|
65
|
+
</DateField.Suffix>
|
|
66
|
+
</DateField.Group>
|
|
67
|
+
</MonthPicker.Trigger>
|
|
68
|
+
<MonthPicker.Dialog>
|
|
69
|
+
<MonthPicker.Calendar aria-label="Statement month" />
|
|
70
|
+
</MonthPicker.Dialog>
|
|
71
|
+
</MonthPicker>
|
|
72
|
+
</Field>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Bottom sheet
|
|
78
|
+
|
|
79
|
+
Use `MonthPicker.BottomSheet` to present the calendar in a sheet that slides up from the bottom — the preferred surface on native. It wires open state only, so compose `BottomSheet.Header` and `BottomSheet.Content` as its children.
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
import { useState } from 'react';
|
|
83
|
+
import { BottomSheet, DateField, Field, MonthPicker } from '@cdx-ui/components';
|
|
84
|
+
import type { MonthId } from '@cdx-ui/formatters';
|
|
85
|
+
import { PickerBottomSheetFrame } from './_frame';
|
|
86
|
+
|
|
87
|
+
export default function MonthPickerBottomSheetDemo() {
|
|
88
|
+
const [value, setValue] = useState<MonthId | undefined>();
|
|
89
|
+
const [open, setOpen] = useState(false);
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<PickerBottomSheetFrame>
|
|
93
|
+
<Field className="w-full max-w-xs">
|
|
94
|
+
<MonthPicker value={value} onValueChange={setValue} isOpen={open} onOpenChange={setOpen}>
|
|
95
|
+
<Field.Label>Statement month</Field.Label>
|
|
96
|
+
<MonthPicker.Trigger className="w-full">
|
|
97
|
+
<DateField.Group fullWidth>
|
|
98
|
+
<DateField.Input />
|
|
99
|
+
<DateField.Suffix>
|
|
100
|
+
<MonthPicker.TriggerIndicator />
|
|
101
|
+
</DateField.Suffix>
|
|
102
|
+
</DateField.Group>
|
|
103
|
+
</MonthPicker.Trigger>
|
|
104
|
+
<MonthPicker.BottomSheet>
|
|
105
|
+
<BottomSheet.Header title="Select month" onClose={() => setOpen(false)} />
|
|
106
|
+
<BottomSheet.Content>
|
|
107
|
+
<MonthPicker.Calendar aria-label="Statement month" />
|
|
108
|
+
</BottomSheet.Content>
|
|
109
|
+
</MonthPicker.BottomSheet>
|
|
110
|
+
</MonthPicker>
|
|
111
|
+
</Field>
|
|
112
|
+
</PickerBottomSheetFrame>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Standalone
|
|
118
|
+
|
|
119
|
+
Render a `MonthCalendar` inline instead of a presentation surface when the field and calendar share the screen.
|
|
120
|
+
|
|
121
|
+
```tsx
|
|
122
|
+
import { useState } from 'react';
|
|
123
|
+
import { DateField, Field, MonthCalendar, MonthPicker } from '@cdx-ui/components';
|
|
124
|
+
import type { MonthId } from '@cdx-ui/formatters';
|
|
125
|
+
|
|
126
|
+
export default function MonthPickerStandaloneDemo() {
|
|
127
|
+
const [value, setValue] = useState<MonthId | undefined>();
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<Field className="w-full max-w-sm">
|
|
131
|
+
<MonthPicker value={value} onValueChange={setValue}>
|
|
132
|
+
<Field.Label>Statement month</Field.Label>
|
|
133
|
+
<DateField.Group fullWidth>
|
|
134
|
+
<DateField.Input />
|
|
135
|
+
</DateField.Group>
|
|
136
|
+
<MonthCalendar
|
|
137
|
+
className="mt-2"
|
|
138
|
+
aria-label="Statement month"
|
|
139
|
+
value={value}
|
|
140
|
+
onValueChange={setValue}
|
|
141
|
+
/>
|
|
142
|
+
</MonthPicker>
|
|
143
|
+
</Field>
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Custom trigger
|
|
149
|
+
|
|
150
|
+
Set `asChild` on `MonthPicker.Trigger` to drive selection from a custom pressable such as a `Chip`, which suits filter UIs where the whole value is chosen from the surface. The trigger merges its press and expanded-state accessibility props onto the child.
|
|
151
|
+
|
|
152
|
+
```tsx
|
|
153
|
+
import { useState } from 'react';
|
|
154
|
+
import { Chip, Field, MonthPicker } from '@cdx-ui/components';
|
|
155
|
+
import { CalendarMonth } from '@cdx-ui/icons';
|
|
156
|
+
|
|
157
|
+
const monthYear = new Intl.DateTimeFormat('en-US', { month: 'long', year: 'numeric' });
|
|
158
|
+
|
|
159
|
+
function formatMonth(id: string) {
|
|
160
|
+
const [year, month] = id.split('-').map(Number);
|
|
161
|
+
return monthYear.format(new Date(year, month - 1, 1));
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export default function MonthPickerCustomTriggerDemo() {
|
|
165
|
+
const [value, setValue] = useState<string | undefined>();
|
|
166
|
+
|
|
167
|
+
return (
|
|
168
|
+
<Field className="w-full max-w-xs">
|
|
169
|
+
<MonthPicker onValueChange={setValue}>
|
|
170
|
+
<Field.Label>Statement month</Field.Label>
|
|
171
|
+
<MonthPicker.Trigger asChild>
|
|
172
|
+
<Chip variant={value ? 'subtle' : 'outline'} color={value ? 'action' : 'neutral'}>
|
|
173
|
+
<Chip.Icon as={CalendarMonth} position="leading" />
|
|
174
|
+
<Chip.Label>{value ? formatMonth(value) : 'Select month'}</Chip.Label>
|
|
175
|
+
</Chip>
|
|
176
|
+
</MonthPicker.Trigger>
|
|
177
|
+
<MonthPicker.Popover>
|
|
178
|
+
<MonthPicker.Calendar aria-label="Statement month" />
|
|
179
|
+
</MonthPicker.Popover>
|
|
180
|
+
</MonthPicker>
|
|
181
|
+
</Field>
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## API
|
|
187
|
+
|
|
188
|
+
### MonthPicker
|
|
189
|
+
|
|
190
|
+
Root of the compound. Owns the selected value, open state, `locale`, and `labels`, and provides `DateField` styling context to the field. Compose exactly one presentation surface — `MonthPicker.Popover`, `MonthPicker.Dialog`, or `MonthPicker.BottomSheet` — per picker.
|
|
191
|
+
|
|
192
|
+
| Prop | Type | Default | Description |
|
|
193
|
+
| --- | --- | --- | --- |
|
|
194
|
+
| `className?` | `string` | — | — |
|
|
195
|
+
| `children?` | `ReactNode` | — | — |
|
|
196
|
+
| `asChild?` | `boolean` | — | — |
|
|
197
|
+
| `value?` | `MonthId` | — | — |
|
|
198
|
+
| `defaultValue?` | `MonthId` | — | — |
|
|
199
|
+
| `onValueChange?` | `((value: MonthId) => void)` | — | Called with the new `MonthId`, or `undefined` when the selection is cleared. |
|
|
200
|
+
| `isOpen?` | `boolean` | — | Controlled open state. Use `defaultOpen` for the uncontrolled variant. |
|
|
201
|
+
| `defaultOpen?` | `boolean` | — | — |
|
|
202
|
+
| `onOpenChange?` | `((open: boolean) => void)` | — | — |
|
|
203
|
+
| `isDisabled?` | `boolean` | — | — |
|
|
204
|
+
| `isReadOnly?` | `boolean` | — | — |
|
|
205
|
+
| `isInvalid?` | `boolean` | — | — |
|
|
206
|
+
| `isRequired?` | `boolean` | — | — |
|
|
207
|
+
| `minValue?` | `MonthId` | — | Earliest selectable month, applied to the embedded calendar. Build with `monthId(...)`. |
|
|
208
|
+
| `maxValue?` | `MonthId` | — | Latest selectable month, applied to the embedded calendar. Build with `monthId(...)`. |
|
|
209
|
+
| `name?` | `string` | — | — |
|
|
210
|
+
| `locale?` | `string` | — | — |
|
|
211
|
+
| `labels?` | `Partial<DateComponentLabels>` | — | — |
|
|
212
|
+
|
|
213
|
+
Inherits all [`ViewProps`](https://reactnative.dev/docs/view#props).
|
|
214
|
+
|
|
215
|
+
## Sub-components
|
|
216
|
+
|
|
217
|
+
### MonthPicker.Trigger
|
|
218
|
+
|
|
219
|
+
Toggles the presentation surface and announces its expanded state. Because month selection is surface-driven, wrap the entire `DateField.Group` so the whole field is the tap target, with a decorative `MonthPicker.TriggerIndicator` in the `DateField.Suffix`. Its accessible name defaults to the picker's `openMonthPicker` label. Set `asChild` to merge its press and accessibility props onto a custom interactive child — for example an `IconButton` — instead of rendering the default pressable.
|
|
220
|
+
|
|
221
|
+
| Prop | Type | Default | Description |
|
|
222
|
+
| --- | --- | --- | --- |
|
|
223
|
+
| `className?` | `string` | — | — |
|
|
224
|
+
| `children?` | `ReactNode` | — | Either children or a render prop that receives a boolean reflecting whether the component is currently pressed. |
|
|
225
|
+
| `ref?` | `React.Ref<View>` | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). |
|
|
226
|
+
| `asChild?` | `boolean` | — | Merge press / a11y props onto the single child instead of rendering a `Pressable`. Use when the trigger should be another interactive host (e.g. `IconButton`). For a larger field hit target, prefer wrapping `DateField.Group` as children without `asChild` so the outer `Pressable` covers the whole input chrome. |
|
|
227
|
+
| `key?` | `React.Key \| null` | — | — |
|
|
228
|
+
|
|
229
|
+
Inherits all [`PressableProps`](https://reactnative.dev/docs/pressable#props).
|
|
230
|
+
|
|
231
|
+
### MonthPicker.TriggerIndicator
|
|
232
|
+
|
|
233
|
+
Renders the decorative calendar icon, typically inside the `DateField.Suffix` of a full-field `MonthPicker.Trigger`. Takes no props.
|
|
234
|
+
|
|
235
|
+
### MonthPicker.Calendar
|
|
236
|
+
|
|
237
|
+
Renders the picker's `MonthCalendar`, wired to the shared value, `locale`, and `labels`. Accepts all [`MonthCalendar`](https://design.candescent.com/docs/components/month-calendar/content.md) props except `value` and `onValueChange`, which the picker controls.
|
|
238
|
+
|
|
239
|
+
| Prop | Type | Default | Description |
|
|
240
|
+
| --- | --- | --- | --- |
|
|
241
|
+
| `className?` | `string` | — | — |
|
|
242
|
+
| `children?` | `ReactNode` | — | — |
|
|
243
|
+
| `ref?` | `React.Ref<View>` | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). |
|
|
244
|
+
| `asChild?` | `boolean` | — | — |
|
|
245
|
+
| `defaultValue?` | `MonthId` | — | — |
|
|
246
|
+
| `locale?` | `string` | — | — |
|
|
247
|
+
| `labels?` | `Partial<DateComponentLabels>` | — | — |
|
|
248
|
+
| `view?` | `'month' \| 'year'` | — | — |
|
|
249
|
+
| `defaultView?` | `'month' \| 'year'` | — | — |
|
|
250
|
+
| `onViewChange?` | `((view: MonthCalendarView) => void)` | — | — |
|
|
251
|
+
| `visibleYear?` | `number` | — | — |
|
|
252
|
+
| `defaultVisibleYear?` | `number` | — | — |
|
|
253
|
+
| `onVisibleYearChange?` | `((year: number) => void)` | — | — |
|
|
254
|
+
| `disabled?` | `boolean` | — | — |
|
|
255
|
+
| `key?` | `React.Key \| null` | — | — |
|
|
256
|
+
|
|
257
|
+
Inherits all [`ViewProps`](https://reactnative.dev/docs/view#props).
|
|
258
|
+
|
|
259
|
+
### MonthPicker.Popover
|
|
260
|
+
|
|
261
|
+
Presents the calendar in an anchored popover, positioned above or below the field based on available space. Wires the surface's open state and renders its children.
|
|
262
|
+
|
|
263
|
+
### MonthPicker.Dialog
|
|
264
|
+
|
|
265
|
+
Presents the calendar in a modal dialog. Wires the surface's open state and renders its children.
|
|
266
|
+
|
|
267
|
+
### MonthPicker.BottomSheet
|
|
268
|
+
|
|
269
|
+
Presents the calendar in a bottom sheet, the preferred surface on native. It wires open state only — compose `BottomSheet.Header` and `BottomSheet.Content` (or any sheet layout) as its children.
|
|
270
|
+
|
|
271
|
+
## Accessibility
|
|
272
|
+
|
|
273
|
+
Give the picker an accessible name with `Field.Label` or `aria-label`, and pass `aria-label` to `MonthPicker.Calendar` to name the grid. `MonthPicker.Trigger` announces the localized `openMonthPicker` label, which `labels` can override. While `disabled`, the trigger does not open a surface.
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
# OTP Input Field (https://design.candescent.com/docs/components/otp-input)
|
|
2
|
+
|
|
3
|
+
Resources: [Figma](https://www.figma.com/design/0lEVMVlLj8ZS4fgItr3pmd/%E2%AD%90-Forge-DS--Components?node-id=5653-5035), [Storybook](https://victorious-wave-0daadf00f.6.azurestaticapps.net/?path=/story/inputs-otpinput--default)
|
|
4
|
+
|
|
5
|
+
Each cell holds a single character and auto-advances on entry. Cells default to digit-only filtering and `keyboardType="number-pad"`.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { OtpInput } from '@cdx-ui/components';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic
|
|
12
|
+
|
|
13
|
+
`OtpInput` is controlled — pass `value` and `onChangeText`.
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { useState } from 'react';
|
|
17
|
+
import { OtpInput } from '@cdx-ui/components';
|
|
18
|
+
|
|
19
|
+
export default function OtpInputBasicDemo() {
|
|
20
|
+
const [value, setValue] = useState('');
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<OtpInput
|
|
24
|
+
accessibilityLabel="Verification code"
|
|
25
|
+
cellCount={6}
|
|
26
|
+
value={value}
|
|
27
|
+
onChangeText={setValue}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Sizes
|
|
34
|
+
|
|
35
|
+
Use `size="small"` for denser cells. Typography and cell dimensions scale together.
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
import { useState } from 'react';
|
|
39
|
+
import { Box, OtpInput, Text, type OtpInputProps } from '@cdx-ui/components';
|
|
40
|
+
|
|
41
|
+
const sizes = ['default', 'small'] as const satisfies readonly NonNullable<OtpInputProps['size']>[];
|
|
42
|
+
|
|
43
|
+
function SizeRow({ size }: { size: NonNullable<OtpInputProps['size']> }) {
|
|
44
|
+
const [value, setValue] = useState('');
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<Box className="gap-2">
|
|
48
|
+
<Text size="sm" color="secondary">
|
|
49
|
+
{size}
|
|
50
|
+
</Text>
|
|
51
|
+
<OtpInput
|
|
52
|
+
accessibilityLabel={`${size} verification code`}
|
|
53
|
+
cellCount={size === 'small' ? 4 : 6}
|
|
54
|
+
size={size}
|
|
55
|
+
value={value}
|
|
56
|
+
onChangeText={setValue}
|
|
57
|
+
/>
|
|
58
|
+
</Box>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export default function OtpInputSizesDemo() {
|
|
63
|
+
return (
|
|
64
|
+
<Box className="w-full gap-4">
|
|
65
|
+
{sizes.map((size) => (
|
|
66
|
+
<SizeRow key={size} size={size} />
|
|
67
|
+
))}
|
|
68
|
+
</Box>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Cell count
|
|
74
|
+
|
|
75
|
+
Set `cellCount` to match the length of the code you expect (commonly 4 or 6).
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
import { useState } from 'react';
|
|
79
|
+
import { OtpInput } from '@cdx-ui/components';
|
|
80
|
+
|
|
81
|
+
export default function OtpInputCellCountDemo() {
|
|
82
|
+
const [value, setValue] = useState('');
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<OtpInput
|
|
86
|
+
accessibilityLabel="Four-digit verification code"
|
|
87
|
+
cellCount={4}
|
|
88
|
+
value={value}
|
|
89
|
+
onChangeText={setValue}
|
|
90
|
+
/>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## States
|
|
96
|
+
|
|
97
|
+
The root controls disabled, read-only, and invalid state for every cell.
|
|
98
|
+
|
|
99
|
+
```tsx
|
|
100
|
+
import { Box, OtpInput, Text } from '@cdx-ui/components';
|
|
101
|
+
|
|
102
|
+
export default function OtpInputStatesDemo() {
|
|
103
|
+
return (
|
|
104
|
+
<Box className="w-full gap-4">
|
|
105
|
+
<Box className="gap-2">
|
|
106
|
+
<Text size="sm" color="secondary">
|
|
107
|
+
Disabled
|
|
108
|
+
</Text>
|
|
109
|
+
<OtpInput
|
|
110
|
+
accessibilityLabel="Disabled verification code"
|
|
111
|
+
cellCount={6}
|
|
112
|
+
value="123456"
|
|
113
|
+
onChangeText={() => {}}
|
|
114
|
+
isDisabled
|
|
115
|
+
/>
|
|
116
|
+
</Box>
|
|
117
|
+
<Box className="gap-2">
|
|
118
|
+
<Text size="sm" color="secondary">
|
|
119
|
+
Read-only
|
|
120
|
+
</Text>
|
|
121
|
+
<OtpInput
|
|
122
|
+
accessibilityLabel="Read-only verification code"
|
|
123
|
+
cellCount={6}
|
|
124
|
+
value="123456"
|
|
125
|
+
onChangeText={() => {}}
|
|
126
|
+
isReadOnly
|
|
127
|
+
/>
|
|
128
|
+
</Box>
|
|
129
|
+
<Box className="gap-2">
|
|
130
|
+
<Text size="sm" color="secondary">
|
|
131
|
+
Invalid
|
|
132
|
+
</Text>
|
|
133
|
+
<OtpInput
|
|
134
|
+
accessibilityLabel="Invalid verification code"
|
|
135
|
+
cellCount={6}
|
|
136
|
+
value="123456"
|
|
137
|
+
onChangeText={() => {}}
|
|
138
|
+
isInvalid
|
|
139
|
+
/>
|
|
140
|
+
</Box>
|
|
141
|
+
</Box>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Alphanumeric
|
|
147
|
+
|
|
148
|
+
By default only digits are accepted. Use `allowedCharacters`, `characterPattern`, or `filterInput` to allow other characters — and override `keyboardType` via `getCellProps` so the on-screen keyboard matches what you accept.
|
|
149
|
+
|
|
150
|
+
```tsx
|
|
151
|
+
import { useState } from 'react';
|
|
152
|
+
import { OtpInput } from '@cdx-ui/components';
|
|
153
|
+
|
|
154
|
+
export default function OtpInputAlphanumericDemo() {
|
|
155
|
+
const [value, setValue] = useState('');
|
|
156
|
+
|
|
157
|
+
return (
|
|
158
|
+
<OtpInput
|
|
159
|
+
accessibilityLabel="Hex code"
|
|
160
|
+
cellCount={6}
|
|
161
|
+
value={value}
|
|
162
|
+
onChangeText={setValue}
|
|
163
|
+
allowedCharacters="ABCDEFabcdef0123456789"
|
|
164
|
+
getCellProps={() => ({ keyboardType: 'default' })}
|
|
165
|
+
/>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## With field
|
|
171
|
+
|
|
172
|
+
Compose with `Field` to provide a visible label and helper text. OtpInput also reads `isDisabled`, `isInvalid`, and `isReadOnly` from a parent `Field` context.
|
|
173
|
+
|
|
174
|
+
```tsx
|
|
175
|
+
import { useState } from 'react';
|
|
176
|
+
import { Field, OtpInput } from '@cdx-ui/components';
|
|
177
|
+
|
|
178
|
+
export default function OtpInputWithFieldDemo() {
|
|
179
|
+
const [value, setValue] = useState('');
|
|
180
|
+
|
|
181
|
+
return (
|
|
182
|
+
<Field className="w-full" isRequired>
|
|
183
|
+
<Field.Label>One-time code</Field.Label>
|
|
184
|
+
<OtpInput
|
|
185
|
+
accessibilityLabel="One-time code"
|
|
186
|
+
cellCount={6}
|
|
187
|
+
value={value}
|
|
188
|
+
onChangeText={setValue}
|
|
189
|
+
/>
|
|
190
|
+
<Field.Helper>Enter the 6-digit code sent to your device.</Field.Helper>
|
|
191
|
+
</Field>
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## With field and validation
|
|
197
|
+
|
|
198
|
+
Set the invalid state on `Field` so the error message stays in sync with incomplete input.
|
|
199
|
+
|
|
200
|
+
```tsx
|
|
201
|
+
import { useState } from 'react';
|
|
202
|
+
import { Field, OtpInput } from '@cdx-ui/components';
|
|
203
|
+
|
|
204
|
+
export default function OtpInputWithFieldInvalidDemo() {
|
|
205
|
+
const [value, setValue] = useState('');
|
|
206
|
+
const isInvalid = value.length >= 0 && value.length < 6;
|
|
207
|
+
|
|
208
|
+
return (
|
|
209
|
+
<Field className="w-full" isRequired isInvalid={isInvalid}>
|
|
210
|
+
<Field.Label>One-time code</Field.Label>
|
|
211
|
+
<OtpInput
|
|
212
|
+
accessibilityLabel="One-time code"
|
|
213
|
+
cellCount={6}
|
|
214
|
+
value={value}
|
|
215
|
+
onChangeText={setValue}
|
|
216
|
+
/>
|
|
217
|
+
<Field.Error>Enter all 6 digits to continue.</Field.Error>
|
|
218
|
+
</Field>
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## API
|
|
224
|
+
|
|
225
|
+
### OtpInput
|
|
226
|
+
|
|
227
|
+
Controlled multi-cell OTP root. Renders one cell per `cellCount` and manages focus advancement, paste, filtering, and SMS autofill hints.
|
|
228
|
+
|
|
229
|
+
| Prop | Type | Default | Description |
|
|
230
|
+
| --- | --- | --- | --- |
|
|
231
|
+
| `className?` | `string` | — | — |
|
|
232
|
+
| `children?` | `React.ReactNode` | — | — |
|
|
233
|
+
| `size?` | `'default' \| 'small'` | — | — |
|
|
234
|
+
| `cellCount` | `number` | — | Number of OTP cells (fixed). |
|
|
235
|
+
| `value` | `string` | — | Controlled value: characters in order, length 0..`cellCount` (prefix fill). |
|
|
236
|
+
| `onChangeText` | `(value: string) => void` | — | — |
|
|
237
|
+
| `onComplete?` | `(() => void)` | — | Called when the code is ready to verify again: - `value` becomes full (`length === cellCount`) after being shorter, or - `value` stays full but the string changes (user corrected a digit without dropping below full length). Does not fire on mount when `value` is already full and unchanged, nor on re-renders with the same full `value`. |
|
|
238
|
+
| `isDisabled?` | `boolean` | — | — |
|
|
239
|
+
| `isInvalid?` | `boolean` | — | — |
|
|
240
|
+
| `isReadOnly?` | `boolean` | — | — |
|
|
241
|
+
| `smsOtpAutofill?` | `boolean` | `true` | When false, no SMS / Web OTP autofill hints on the first cell. |
|
|
242
|
+
| `filterInput?` | `((input: string) => string)` | — | Override default digit-only filtering. Takes priority over `allowedCharacters` and `characterPattern` when truthy. Does not change the default `keyboardType` (`number-pad`); use `getCellProps` if the allowed character set needs a different keyboard. |
|
|
243
|
+
| `allowedCharacters?` | `string` | — | Keep only characters present in this string (treated as a set of code units). Used when `filterInput` is not provided. Takes priority over `characterPattern`. Default keyboard remains numeric; use `getCellProps` to set `keyboardType` when allowing letters/symbols. |
|
|
244
|
+
| `characterPattern?` | `RegExp` | — | Keep only characters matching this pattern (tested per code unit). Used when neither `filterInput` nor `allowedCharacters` is provided. Default keyboard remains numeric; use `getCellProps` to set `keyboardType` for non-digit input. |
|
|
245
|
+
| `getCellProps?` | `((index: number) => Partial<TextInputProps>)` | — | Spread onto each cell after built-in field props (including `keyboardType="number-pad"`), so consumers can override `keyboardType`, `autoCapitalize`, etc. for non-digit OTPs. |
|
|
246
|
+
| `cellTestIdPrefix?` | `string` | — | Optional prefix for `testID` on each field: `${cellTestIdPrefix}:${index}:...` |
|
|
247
|
+
| `fullWidth?` | `boolean \| null` | — | — |
|
|
248
|
+
| `variant?` | `'outline'` | — | — |
|
|
249
|
+
|
|
250
|
+
Inherits all [`ViewProps`](https://reactnative.dev/docs/view#props).
|
|
251
|
+
|
|
252
|
+
| Attribute | Values | Description |
|
|
253
|
+
| ----------- | ----------- | -------------- |
|
|
254
|
+
| `data-slot` | `otp-input` | Root container |
|
|
255
|
+
|
|
256
|
+
### Input filtering
|
|
257
|
+
|
|
258
|
+
By default only digits (`0-9`) are accepted. Three mechanisms override this, evaluated in priority order:
|
|
259
|
+
|
|
260
|
+
| Mechanism | Type | Behavior |
|
|
261
|
+
| ------------------- | --------------------------- | ------------------------------------------------------------ |
|
|
262
|
+
| `filterInput` | `(input: string) => string` | Full custom filter — takes raw text, returns allowed portion |
|
|
263
|
+
| `allowedCharacters` | `string` | Keeps only characters present in this string |
|
|
264
|
+
| `characterPattern` | `RegExp` | Keeps only characters matching this pattern (per code unit) |
|
|
265
|
+
|
|
266
|
+
None of these change the default `keyboardType` (`number-pad`). When allowing non-digits, pass `getCellProps` to set a matching keyboard.
|
|
267
|
+
|
|
268
|
+
### `onComplete`
|
|
269
|
+
|
|
270
|
+
Fires when the code is ready to verify again:
|
|
271
|
+
|
|
272
|
+
- `value` reaches `cellCount` length after being shorter
|
|
273
|
+
- `value` stays full length but the string changes (correction without deleting first)
|
|
274
|
+
|
|
275
|
+
It does **not** fire on mount when `value` is already full, nor on re-renders with the same full value.
|
|
276
|
+
|
|
277
|
+
### SMS autofill
|
|
278
|
+
|
|
279
|
+
When `smsOtpAutofill` is `true` (default), the first cell receives platform autofill hints:
|
|
280
|
+
|
|
281
|
+
| Platform | Hint |
|
|
282
|
+
| -------- | ------------------------------- |
|
|
283
|
+
| iOS | `textContentType="oneTimeCode"` |
|
|
284
|
+
| Android | `autoComplete="sms-otp"` |
|
|
285
|
+
| Web | `autoComplete="one-time-code"` |
|
|
286
|
+
|
|
287
|
+
Set `smsOtpAutofill={false}` to disable.
|
|
288
|
+
|
|
289
|
+
## Sub-components
|
|
290
|
+
|
|
291
|
+
`OtpInput` renders `OtpInput.Cell` and `OtpInput.Field` internally. Most consumers only need the root; the sub-components are available for advanced composition.
|
|
292
|
+
|
|
293
|
+
### OtpInput.Cell
|
|
294
|
+
|
|
295
|
+
Styled cell chrome built on `Input`. Inherits variant and size from the parent `OtpInput` context.
|
|
296
|
+
|
|
297
|
+
| Prop | Type | Default | Description |
|
|
298
|
+
| --- | --- | --- | --- |
|
|
299
|
+
| `className?` | `string` | — | — |
|
|
300
|
+
| `children?` | `React.ReactNode` | — | — |
|
|
301
|
+
| `variant?` | `'outline' \| null` | — | — |
|
|
302
|
+
| `size?` | `'default' \| 'small' \| null` | — | — |
|
|
303
|
+
| `isInvalid?` | `boolean` | — | — |
|
|
304
|
+
| `isReadOnly?` | `boolean` | — | — |
|
|
305
|
+
| `isDisabled?` | `boolean` | — | — |
|
|
306
|
+
|
|
307
|
+
Inherits all [`ViewProps`](https://reactnative.dev/docs/view#props).
|
|
308
|
+
|
|
309
|
+
### OtpInput.Field
|
|
310
|
+
|
|
311
|
+
Per-cell text entry. Bridges focus/blur to the parent cell's `Input` context so focus styles activate.
|
|
312
|
+
|
|
313
|
+
| Prop | Type | Default | Description |
|
|
314
|
+
| --- | --- | --- | --- |
|
|
315
|
+
| `className?` | `string` | — | — |
|
|
316
|
+
| `children?` | `React.ReactNode` | — | — |
|
|
317
|
+
| `asChild?` | `boolean` | — | — |
|
|
318
|
+
|
|
319
|
+
Inherits all [`TextInputProps`](https://reactnative.dev/docs/textinput#props).
|
|
320
|
+
|
|
321
|
+
## Accessibility
|
|
322
|
+
|
|
323
|
+
| Attribute | Behavior |
|
|
324
|
+
| ---------------- | ------------------------------------------------------------------------------------- |
|
|
325
|
+
| **Label** | Pass `accessibilityLabel` on the root. Each cell reads `"{label}, N of {cellCount}"`. |
|
|
326
|
+
| **Disabled** | Sets `editable={false}` on every cell. |
|
|
327
|
+
| **SMS autofill** | Applied to the first cell when `smsOtpAutofill` is enabled. |
|