@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,235 @@
|
|
|
1
|
+
# Badge (https://design.candescent.com/docs/components/badge)
|
|
2
|
+
|
|
3
|
+
Resources: [Figma](https://www.figma.com/design/0lEVMVlLj8ZS4fgItr3pmd/%E2%AD%90-Forge-DS--Components?node-id=6894-409), [Storybook](https://victorious-wave-0daadf00f.6.azurestaticapps.net/?path=/story/content-badge--default)
|
|
4
|
+
|
|
5
|
+
Wraps a host element (Avatar, Button, IconButton, etc.) and overlays a corner indicator for counts, status dots, or icons.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Badge } from '@cdx-ui/components';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { Avatar, Badge, Box, Button } from '@cdx-ui/components';
|
|
15
|
+
|
|
16
|
+
export default function BadgeBasicDemo() {
|
|
17
|
+
return (
|
|
18
|
+
<Box className="flex-row flex-wrap items-center gap-6">
|
|
19
|
+
<Badge
|
|
20
|
+
label={5}
|
|
21
|
+
color="danger"
|
|
22
|
+
overlap="circular"
|
|
23
|
+
accessibilityLabel="5 unread notifications"
|
|
24
|
+
>
|
|
25
|
+
<Avatar size="xl" accessibilityLabel="Sofia Rivera">
|
|
26
|
+
<Avatar.Image src="https://www.loremfaces.net/128/id/4.jpg" />
|
|
27
|
+
<Avatar.Text>Sofia Rivera</Avatar.Text>
|
|
28
|
+
</Avatar>
|
|
29
|
+
</Badge>
|
|
30
|
+
<Badge label="New" color="info" overlap="rectangular">
|
|
31
|
+
<Button variant="outline" color="action">
|
|
32
|
+
<Button.Label>Inbox</Button.Label>
|
|
33
|
+
</Button>
|
|
34
|
+
</Badge>
|
|
35
|
+
</Box>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Colors
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
import { Avatar, Badge, Box } from '@cdx-ui/components';
|
|
44
|
+
|
|
45
|
+
const COLORS = ['action', 'danger', 'warning', 'success', 'info'] as const;
|
|
46
|
+
|
|
47
|
+
export default function BadgeColorsDemo() {
|
|
48
|
+
return (
|
|
49
|
+
<Box className="flex-row flex-wrap items-center gap-6">
|
|
50
|
+
{COLORS.map((color) => (
|
|
51
|
+
<Badge
|
|
52
|
+
key={color}
|
|
53
|
+
label={3}
|
|
54
|
+
color={color}
|
|
55
|
+
overlap="circular"
|
|
56
|
+
accessibilityLabel="3 notifications"
|
|
57
|
+
>
|
|
58
|
+
<Avatar size="lg" accessibilityLabel="User">
|
|
59
|
+
<Avatar.Text>User</Avatar.Text>
|
|
60
|
+
</Avatar>
|
|
61
|
+
</Badge>
|
|
62
|
+
))}
|
|
63
|
+
</Box>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Dot
|
|
69
|
+
|
|
70
|
+
Use `variant="dot"` for a contentless status indicator.
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
import { Avatar, Badge, Box } from '@cdx-ui/components';
|
|
74
|
+
|
|
75
|
+
const COLORS = ['action', 'danger', 'warning', 'success', 'info'] as const;
|
|
76
|
+
|
|
77
|
+
export default function BadgeDotDemo() {
|
|
78
|
+
return (
|
|
79
|
+
<Box className="flex-row flex-wrap items-center gap-6">
|
|
80
|
+
{COLORS.map((color) => (
|
|
81
|
+
<Badge key={color} variant="dot" color={color} overlap="circular">
|
|
82
|
+
<Avatar size="lg" accessibilityLabel="User">
|
|
83
|
+
<Avatar.Text>User</Avatar.Text>
|
|
84
|
+
</Avatar>
|
|
85
|
+
</Badge>
|
|
86
|
+
))}
|
|
87
|
+
</Box>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## With icon
|
|
93
|
+
|
|
94
|
+
Pass a Forge icon via `icon`. When both `icon` and `label` are set, `icon` wins.
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
import { Avatar, Badge, Box, IconButton } from '@cdx-ui/components';
|
|
98
|
+
import { Check, Error, Notifications } from '@cdx-ui/icons';
|
|
99
|
+
|
|
100
|
+
export default function BadgeWithIconDemo() {
|
|
101
|
+
return (
|
|
102
|
+
<Box className="flex-row flex-wrap items-center gap-6">
|
|
103
|
+
<Badge icon={Check} color="success" overlap="circular">
|
|
104
|
+
<Avatar size="lg" accessibilityLabel="Verified user">
|
|
105
|
+
<Avatar.Image src="https://www.loremfaces.net/128/id/1.jpg" />
|
|
106
|
+
<Avatar.Text>Verified</Avatar.Text>
|
|
107
|
+
</Avatar>
|
|
108
|
+
</Badge>
|
|
109
|
+
<Badge icon={Error} color="danger" overlap="circular">
|
|
110
|
+
<Avatar size="lg" accessibilityLabel="Error status">
|
|
111
|
+
<Avatar.Image src="https://www.loremfaces.net/128/id/2.jpg" />
|
|
112
|
+
<Avatar.Text>Error</Avatar.Text>
|
|
113
|
+
</Avatar>
|
|
114
|
+
</Badge>
|
|
115
|
+
<Badge icon={Check} color="action" overlap="circular">
|
|
116
|
+
<IconButton
|
|
117
|
+
as={Notifications}
|
|
118
|
+
variant="subtle"
|
|
119
|
+
color="neutral"
|
|
120
|
+
accessibilityLabel="Notifications"
|
|
121
|
+
/>
|
|
122
|
+
</Badge>
|
|
123
|
+
</Box>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Placements
|
|
129
|
+
|
|
130
|
+
Placement values are logical and RTL-aware (`end` is right in LTR).
|
|
131
|
+
|
|
132
|
+
```tsx
|
|
133
|
+
import { Avatar, Badge, Box } from '@cdx-ui/components';
|
|
134
|
+
|
|
135
|
+
const PLACEMENTS = ['top-start', 'top-end', 'bottom-start', 'bottom-end'] as const;
|
|
136
|
+
|
|
137
|
+
export default function BadgePlacementsDemo() {
|
|
138
|
+
return (
|
|
139
|
+
<Box className="flex-row flex-wrap items-center gap-6">
|
|
140
|
+
{PLACEMENTS.map((placement) => (
|
|
141
|
+
<Badge
|
|
142
|
+
key={placement}
|
|
143
|
+
label={1}
|
|
144
|
+
color="danger"
|
|
145
|
+
placement={placement}
|
|
146
|
+
overlap="circular"
|
|
147
|
+
accessibilityLabel="1 notification"
|
|
148
|
+
>
|
|
149
|
+
<Avatar size="lg" accessibilityLabel="User">
|
|
150
|
+
<Avatar.Image src="https://www.loremfaces.net/128/id/5.jpg" />
|
|
151
|
+
<Avatar.Text>User</Avatar.Text>
|
|
152
|
+
</Avatar>
|
|
153
|
+
</Badge>
|
|
154
|
+
))}
|
|
155
|
+
</Box>
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Overlap
|
|
161
|
+
|
|
162
|
+
Use `overlap="circular"` for round hosts (Avatar, IconButton) and `overlap="rectangular"` for box hosts (Button).
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
import { Avatar, Badge, Box, Button, IconButton } from '@cdx-ui/components';
|
|
166
|
+
import { Notifications } from '@cdx-ui/icons';
|
|
167
|
+
|
|
168
|
+
export default function BadgeOverlapDemo() {
|
|
169
|
+
return (
|
|
170
|
+
<Box className="gap-6">
|
|
171
|
+
<Box className="flex-row flex-wrap items-center gap-6">
|
|
172
|
+
<Badge label={5} color="danger" overlap="circular" accessibilityLabel="5 notifications">
|
|
173
|
+
<Avatar size="lg" accessibilityLabel="User">
|
|
174
|
+
<Avatar.Image src="https://www.loremfaces.net/128/id/1.jpg" />
|
|
175
|
+
<Avatar.Text>User</Avatar.Text>
|
|
176
|
+
</Avatar>
|
|
177
|
+
</Badge>
|
|
178
|
+
<Badge label={5} color="danger" overlap="circular" accessibilityLabel="5 notifications">
|
|
179
|
+
<IconButton
|
|
180
|
+
as={Notifications}
|
|
181
|
+
variant="subtle"
|
|
182
|
+
color="neutral"
|
|
183
|
+
accessibilityLabel="Notifications"
|
|
184
|
+
/>
|
|
185
|
+
</Badge>
|
|
186
|
+
</Box>
|
|
187
|
+
<Box className="flex-row flex-wrap items-center gap-6">
|
|
188
|
+
<Badge label={5} color="danger" overlap="rectangular" accessibilityLabel="5 notifications">
|
|
189
|
+
<Button variant="outline" color="action">
|
|
190
|
+
<Button.Label>Inbox</Button.Label>
|
|
191
|
+
</Button>
|
|
192
|
+
</Badge>
|
|
193
|
+
<Badge label="New" color="info" overlap="rectangular">
|
|
194
|
+
<Button variant="solid" color="action">
|
|
195
|
+
<Button.Label>Updates</Button.Label>
|
|
196
|
+
</Button>
|
|
197
|
+
</Badge>
|
|
198
|
+
</Box>
|
|
199
|
+
</Box>
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## API
|
|
205
|
+
|
|
206
|
+
### Badge
|
|
207
|
+
|
|
208
|
+
| Prop | Type | Default | Description |
|
|
209
|
+
| --- | --- | --- | --- |
|
|
210
|
+
| `className?` | `string` | — | — |
|
|
211
|
+
| `children?` | `ReactNode` | — | — |
|
|
212
|
+
| `variant?` | `'default' \| 'dot'` | `'default'` | `default` shows icon or label content. `dot` is a contentless circle and ignores `icon` and `label`. |
|
|
213
|
+
| `color?` | `'action' \| 'danger' \| 'warning' \| 'success' \| 'info'` | `'action'` | Semantic color of the indicator background and its content. |
|
|
214
|
+
| `placement?` | `'top-start' \| 'top-end' \| 'bottom-start' \| 'bottom-end'` | `'top-end'` | Corner of the host. Logical and RTL-aware: `end` is the right edge in LTR. |
|
|
215
|
+
| `overlap?` | `'circular' \| 'rectangular'` | `'rectangular'` | `circular` sits the indicator on a round host (Avatar, IconButton). `rectangular` centers it on a box corner (Button). |
|
|
216
|
+
| `label?` | `ReactNode` | — | Indicator content for `variant="default"`. A string or number is styled as text; any other node renders as-is. Ignored when `variant` is `dot` or when `icon` is set. |
|
|
217
|
+
| `icon?` | `ForgeIcon` | — | Forge icon for `variant="default"`. Takes precedence over `label`. Ignored when `variant` is `dot`. |
|
|
218
|
+
|
|
219
|
+
Inherits all [`ViewProps`](https://reactnative.dev/docs/view#props).
|
|
220
|
+
|
|
221
|
+
## Anatomy
|
|
222
|
+
|
|
223
|
+
| `data-slot` | Element |
|
|
224
|
+
| ----------------- | ---------------------------------------------- |
|
|
225
|
+
| `badge` | Root wrapper |
|
|
226
|
+
| `badge-indicator` | Corner indicator |
|
|
227
|
+
| `badge-label` | Text label, when `label` is a string or number |
|
|
228
|
+
|
|
229
|
+
## Accessibility
|
|
230
|
+
|
|
231
|
+
`Badge` is non-interactive and has no implicit role. The indicator sets `pointerEvents` to `none`, so it does not intercept presses meant for the host.
|
|
232
|
+
|
|
233
|
+
Set `accessibilityLabel` for a meaningful announcement (for example, `"5 unread notifications"`). The label is placed on the indicator, so it does not replace the host's accessible name. A `dot`, and any indicator without `accessibilityLabel`, is hidden from assistive technology — a string or number `label` is not announced on its own.
|
|
234
|
+
|
|
235
|
+
`Badge` is not a live region. A count that changes is not announced automatically. Put the meaning on the host's `accessibilityLabel`, or announce the change elsewhere, when the update needs to be heard.
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
# Bottom Sheet (https://design.candescent.com/docs/components/bottom-sheet)
|
|
2
|
+
|
|
3
|
+
Resources: [Figma](https://www.figma.com/design/0lEVMVlLj8ZS4fgItr3pmd/%E2%AD%90-Forge-DS--Components?node-id=3187-706), [Storybook](https://victorious-wave-0daadf00f.6.azurestaticapps.net/?path=/story/overlays-bottomsheet--default)
|
|
4
|
+
|
|
5
|
+
A compound component controlled imperatively via `useBottomSheet()`.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { BottomSheet, useBottomSheet } from '@cdx-ui/components';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
> [!WARNING]
|
|
12
|
+
>
|
|
13
|
+
> **Provider required**
|
|
14
|
+
>
|
|
15
|
+
> Wrap your app root with `BottomSheet.Provider` to enable modal presentation.
|
|
16
|
+
|
|
17
|
+
## Basic
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import { BottomSheet, useBottomSheet, Button, Text } from '@cdx-ui/components';
|
|
21
|
+
import { BottomSheetDemoFrame } from './_frame';
|
|
22
|
+
|
|
23
|
+
export default function BottomSheetBasicDemo() {
|
|
24
|
+
const { ref, present, dismiss } = useBottomSheet();
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<BottomSheetDemoFrame>
|
|
28
|
+
<Button variant="solid" color="action" onPress={present}>
|
|
29
|
+
<Button.Label>Open sheet</Button.Label>
|
|
30
|
+
</Button>
|
|
31
|
+
<BottomSheet.Modal ref={ref}>
|
|
32
|
+
<BottomSheet.View>
|
|
33
|
+
<BottomSheet.Header title="Sheet Title" onClose={dismiss} />
|
|
34
|
+
<BottomSheet.Content>
|
|
35
|
+
<Text>
|
|
36
|
+
A bottom sheet presents focused content without leaving the current context.
|
|
37
|
+
</Text>
|
|
38
|
+
</BottomSheet.Content>
|
|
39
|
+
</BottomSheet.View>
|
|
40
|
+
</BottomSheet.Modal>
|
|
41
|
+
</BottomSheetDemoFrame>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## With footer
|
|
47
|
+
|
|
48
|
+
Pass `BottomSheet.Footer` through the `footer` prop on `BottomSheet.Modal` so it stays pinned and animates with the sheet.
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
import { BottomSheet, useBottomSheet, Button, Text } from '@cdx-ui/components';
|
|
52
|
+
import { BottomSheetDemoFrame } from './_frame';
|
|
53
|
+
|
|
54
|
+
export default function BottomSheetWithFooterDemo() {
|
|
55
|
+
const { ref, present, dismiss } = useBottomSheet();
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<BottomSheetDemoFrame>
|
|
59
|
+
<Button variant="solid" color="action" onPress={present}>
|
|
60
|
+
<Button.Label>Open sheet</Button.Label>
|
|
61
|
+
</Button>
|
|
62
|
+
<BottomSheet.Modal
|
|
63
|
+
ref={ref}
|
|
64
|
+
footer={
|
|
65
|
+
<BottomSheet.Footer>
|
|
66
|
+
<Button variant="solid" color="action" onPress={dismiss}>
|
|
67
|
+
<Button.Label>Confirm</Button.Label>
|
|
68
|
+
</Button>
|
|
69
|
+
</BottomSheet.Footer>
|
|
70
|
+
}
|
|
71
|
+
>
|
|
72
|
+
<BottomSheet.View>
|
|
73
|
+
<BottomSheet.Header title="Confirm Action" onClose={dismiss} />
|
|
74
|
+
<BottomSheet.Content>
|
|
75
|
+
<Text>
|
|
76
|
+
The footer stays pinned at the bottom and handles safe-area insets automatically.
|
|
77
|
+
</Text>
|
|
78
|
+
</BottomSheet.Content>
|
|
79
|
+
</BottomSheet.View>
|
|
80
|
+
</BottomSheet.Modal>
|
|
81
|
+
</BottomSheetDemoFrame>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Header variants
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
import { BottomSheet, useBottomSheet, Box, Button, Text } from '@cdx-ui/components';
|
|
90
|
+
import { BottomSheetDemoFrame } from './_frame';
|
|
91
|
+
|
|
92
|
+
export default function BottomSheetHeaderVariantsDemo() {
|
|
93
|
+
const { ref: refBasic, present: presentBasic, dismiss: dismissBasic } = useBottomSheet();
|
|
94
|
+
const { ref: refFull, present: presentFull, dismiss: dismissFull } = useBottomSheet();
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<BottomSheetDemoFrame>
|
|
98
|
+
<Box className="flex-row gap-3">
|
|
99
|
+
<Button variant="outline" color="action" onPress={presentBasic}>
|
|
100
|
+
<Button.Label>Title + close</Button.Label>
|
|
101
|
+
</Button>
|
|
102
|
+
<Button variant="outline" color="action" onPress={presentFull}>
|
|
103
|
+
<Button.Label>Back + subtitle</Button.Label>
|
|
104
|
+
</Button>
|
|
105
|
+
</Box>
|
|
106
|
+
|
|
107
|
+
<BottomSheet.Modal ref={refBasic}>
|
|
108
|
+
<BottomSheet.View>
|
|
109
|
+
<BottomSheet.Header title="Account Options" onClose={dismissBasic} />
|
|
110
|
+
<BottomSheet.Content>
|
|
111
|
+
<Text>Header with title and close button.</Text>
|
|
112
|
+
</BottomSheet.Content>
|
|
113
|
+
</BottomSheet.View>
|
|
114
|
+
</BottomSheet.Modal>
|
|
115
|
+
|
|
116
|
+
<BottomSheet.Modal ref={refFull} handleVisible={false}>
|
|
117
|
+
<BottomSheet.View>
|
|
118
|
+
<BottomSheet.Header
|
|
119
|
+
title="Transfer"
|
|
120
|
+
subtitle="Step 2 of 3"
|
|
121
|
+
onBack={dismissFull}
|
|
122
|
+
onClose={dismissFull}
|
|
123
|
+
/>
|
|
124
|
+
<BottomSheet.Content>
|
|
125
|
+
<Text>Full header with back button, title, subtitle, and close.</Text>
|
|
126
|
+
</BottomSheet.Content>
|
|
127
|
+
</BottomSheet.View>
|
|
128
|
+
</BottomSheet.Modal>
|
|
129
|
+
</BottomSheetDemoFrame>
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Scrollable content
|
|
135
|
+
|
|
136
|
+
```tsx
|
|
137
|
+
import { BottomSheet, useBottomSheet, Box, Button, Text } from '@cdx-ui/components';
|
|
138
|
+
import { BottomSheetDemoFrame } from './_frame';
|
|
139
|
+
|
|
140
|
+
const ITEMS = Array.from({ length: 12 }, (_, i) => ({
|
|
141
|
+
id: String(i + 1),
|
|
142
|
+
label: `List item ${i + 1}`,
|
|
143
|
+
}));
|
|
144
|
+
|
|
145
|
+
export default function BottomSheetScrollableDemo() {
|
|
146
|
+
const { ref, present, dismiss } = useBottomSheet();
|
|
147
|
+
|
|
148
|
+
return (
|
|
149
|
+
<BottomSheetDemoFrame>
|
|
150
|
+
<Button variant="solid" color="action" onPress={present}>
|
|
151
|
+
<Button.Label>Scrollable content</Button.Label>
|
|
152
|
+
</Button>
|
|
153
|
+
<BottomSheet.Modal
|
|
154
|
+
ref={ref}
|
|
155
|
+
snapPoints={['70%']}
|
|
156
|
+
enableDynamicSizing={false}
|
|
157
|
+
footer={
|
|
158
|
+
<BottomSheet.Footer>
|
|
159
|
+
<Button variant="solid" color="action" onPress={dismiss}>
|
|
160
|
+
<Button.Label>Done</Button.Label>
|
|
161
|
+
</Button>
|
|
162
|
+
</BottomSheet.Footer>
|
|
163
|
+
}
|
|
164
|
+
>
|
|
165
|
+
<BottomSheet.Header title="Scrollable Sheet" onClose={dismiss} />
|
|
166
|
+
<BottomSheet.ScrollView style={{ flex: 1 }} contentContainerStyle={{ flexGrow: 1 }}>
|
|
167
|
+
<BottomSheet.Content>
|
|
168
|
+
{ITEMS.map((item) => (
|
|
169
|
+
<Box key={item.id} className="border-b border-stroke-secondary py-3">
|
|
170
|
+
<Text>{item.label}</Text>
|
|
171
|
+
</Box>
|
|
172
|
+
))}
|
|
173
|
+
</BottomSheet.Content>
|
|
174
|
+
</BottomSheet.ScrollView>
|
|
175
|
+
</BottomSheet.Modal>
|
|
176
|
+
</BottomSheetDemoFrame>
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Snap points
|
|
182
|
+
|
|
183
|
+
By default, dynamic sizing caps the sheet at 90% of the screen height. Pass `snapPoints` with `enableDynamicSizing={false}` for fixed heights.
|
|
184
|
+
|
|
185
|
+
```tsx
|
|
186
|
+
import { BottomSheet, useBottomSheet, Button, Text } from '@cdx-ui/components';
|
|
187
|
+
import { BottomSheetDemoFrame } from './_frame';
|
|
188
|
+
|
|
189
|
+
export default function BottomSheetSnapPointsDemo() {
|
|
190
|
+
const { ref, present, dismiss } = useBottomSheet();
|
|
191
|
+
|
|
192
|
+
return (
|
|
193
|
+
<BottomSheetDemoFrame>
|
|
194
|
+
<Button variant="solid" color="action" onPress={present}>
|
|
195
|
+
<Button.Label>Fixed snap points</Button.Label>
|
|
196
|
+
</Button>
|
|
197
|
+
<BottomSheet.Modal
|
|
198
|
+
ref={ref}
|
|
199
|
+
snapPoints={['40%', '75%']}
|
|
200
|
+
enableDynamicSizing={false}
|
|
201
|
+
footer={
|
|
202
|
+
<BottomSheet.Footer>
|
|
203
|
+
<Button variant="solid" color="action" onPress={dismiss}>
|
|
204
|
+
<Button.Label>Close</Button.Label>
|
|
205
|
+
</Button>
|
|
206
|
+
</BottomSheet.Footer>
|
|
207
|
+
}
|
|
208
|
+
>
|
|
209
|
+
<BottomSheet.View>
|
|
210
|
+
<BottomSheet.Header title="Snap Points" onClose={dismiss} />
|
|
211
|
+
<BottomSheet.Content>
|
|
212
|
+
<Text>
|
|
213
|
+
This sheet snaps between 40% and 75% of the container. Drag up or down to snap between
|
|
214
|
+
positions.
|
|
215
|
+
</Text>
|
|
216
|
+
</BottomSheet.Content>
|
|
217
|
+
</BottomSheet.View>
|
|
218
|
+
</BottomSheet.Modal>
|
|
219
|
+
</BottomSheetDemoFrame>
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Handle hidden
|
|
225
|
+
|
|
226
|
+
```tsx
|
|
227
|
+
import { BottomSheet, useBottomSheet, Button, Text } from '@cdx-ui/components';
|
|
228
|
+
import { BottomSheetDemoFrame } from './_frame';
|
|
229
|
+
|
|
230
|
+
export default function BottomSheetHandleHiddenDemo() {
|
|
231
|
+
const { ref, present, dismiss } = useBottomSheet();
|
|
232
|
+
|
|
233
|
+
return (
|
|
234
|
+
<BottomSheetDemoFrame>
|
|
235
|
+
<Button variant="solid" color="action" onPress={present}>
|
|
236
|
+
<Button.Label>No drag handle</Button.Label>
|
|
237
|
+
</Button>
|
|
238
|
+
<BottomSheet.Modal ref={ref} handleVisible={false}>
|
|
239
|
+
<BottomSheet.View>
|
|
240
|
+
<BottomSheet.Header title="No Handle" onClose={dismiss} />
|
|
241
|
+
<BottomSheet.Content>
|
|
242
|
+
<Text>
|
|
243
|
+
Set handleVisible to false when the header provides sufficient visual anchoring. The
|
|
244
|
+
sheet can still be dismissed by tapping the backdrop or using the close button.
|
|
245
|
+
</Text>
|
|
246
|
+
</BottomSheet.Content>
|
|
247
|
+
</BottomSheet.View>
|
|
248
|
+
</BottomSheet.Modal>
|
|
249
|
+
</BottomSheetDemoFrame>
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
## API
|
|
255
|
+
|
|
256
|
+
### BottomSheet.Modal
|
|
257
|
+
|
|
258
|
+
| Prop | Type | Default | Description |
|
|
259
|
+
| --- | --- | --- | --- |
|
|
260
|
+
| `handleVisible?` | `boolean` | `true` | Show the drag handle indicator. When false, `handleComponent` is set to null. |
|
|
261
|
+
| `footer?` | `React.ReactNode` | — | Footer content rendered via gorhom's BottomSheetFooter for animated positioning and safe-area handling. Pass it through this prop; a footer placed as a child does not animate with the sheet. |
|
|
262
|
+
|
|
263
|
+
Also accepts all props from `@gorhom/bottom-sheet`'s `BottomSheetModal` including `snapPoints`, `enableDynamicSizing`, `onDismiss`, and `onChange`.
|
|
264
|
+
|
|
265
|
+
### BottomSheet.Header
|
|
266
|
+
|
|
267
|
+
| Prop | Type | Default | Description |
|
|
268
|
+
| --- | --- | --- | --- |
|
|
269
|
+
| `title?` | `string` | — | Title text. Ignored when `children` is set. |
|
|
270
|
+
| `subtitle?` | `string` | — | Secondary line under the title. Has no effect without `title`, or when `children` is set. |
|
|
271
|
+
| `children?` | `React.ReactNode` | — | Custom header content. Replaces `title` and `subtitle`. |
|
|
272
|
+
| `className?` | `string` | — | — |
|
|
273
|
+
| `onClose?` | `(() => void)` | — | Shows the close button when set. |
|
|
274
|
+
| `closeAccessibilityLabel?` | `string` | `Close` | Accessible name for the close button. |
|
|
275
|
+
| `onBack?` | `(() => void)` | — | Shows the back button when set. |
|
|
276
|
+
| `backAccessibilityLabel?` | `string` | `Go back` | Accessible name for the back button. |
|
|
277
|
+
|
|
278
|
+
### BottomSheet.Content
|
|
279
|
+
|
|
280
|
+
| Prop | Type | Default | Description |
|
|
281
|
+
| --- | --- | --- | --- |
|
|
282
|
+
| `children?` | `React.ReactNode` | — | — |
|
|
283
|
+
| `className?` | `string` | — | — |
|
|
284
|
+
| `hasSafeAreaInset?` | `boolean` | — | Adds bottom padding equal to the safe-area inset. |
|
|
285
|
+
| `style?` | `ViewStyle` | — | — |
|
|
286
|
+
|
|
287
|
+
### BottomSheet.Footer
|
|
288
|
+
|
|
289
|
+
| Prop | Type | Default | Description |
|
|
290
|
+
| --- | --- | --- | --- |
|
|
291
|
+
| `children?` | `React.ReactNode` | — | — |
|
|
292
|
+
| `className?` | `string` | — | — |
|
|
293
|
+
| `style?` | `ViewStyle` | — | — |
|
|
294
|
+
|
|
295
|
+
## Sub-components
|
|
296
|
+
|
|
297
|
+
### BottomSheet.Provider
|
|
298
|
+
|
|
299
|
+
Required once at the app root. Wraps the tree to enable modal presentation.
|
|
300
|
+
|
|
301
|
+
```tsx
|
|
302
|
+
<BottomSheet.Provider>
|
|
303
|
+
<App />
|
|
304
|
+
</BottomSheet.Provider>
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### BottomSheet.ScrollView
|
|
308
|
+
|
|
309
|
+
Scrollable content wrapper for sheets with long content. Enables footer margin adjustment by default.
|
|
310
|
+
|
|
311
|
+
### BottomSheet.View
|
|
312
|
+
|
|
313
|
+
Non-scrollable content wrapper for fit-to-content sheets. Enables footer margin adjustment by default.
|
|
314
|
+
|
|
315
|
+
## Hook
|
|
316
|
+
|
|
317
|
+
### useBottomSheet
|
|
318
|
+
|
|
319
|
+
Returns an imperative handle to present and dismiss a sheet.
|
|
320
|
+
|
|
321
|
+
```tsx
|
|
322
|
+
const { ref, present, dismiss } = useBottomSheet();
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
| Return | Type | Description |
|
|
326
|
+
| --------- | -------------------------------- | ---------------------------------- |
|
|
327
|
+
| `ref` | `RefObject<BottomSheetModalRef>` | Ref to pass to `BottomSheet.Modal` |
|
|
328
|
+
| `present` | `() => void` | Opens the sheet |
|
|
329
|
+
| `dismiss` | `() => void` | Closes the sheet |
|
|
330
|
+
|
|
331
|
+
For advanced control (e.g. `snapToIndex`, `minimize`, `restore`), access `ref.current` directly.
|
|
332
|
+
|
|
333
|
+
### useBottomSheetScrollable
|
|
334
|
+
|
|
335
|
+
Pass the result to `VirtualizedList`'s `renderScrollComponent` when the list is inside a sheet. A plain list uses React Native's `ScrollView`, which Android cannot scroll against the sheet's pan gesture.
|
|
336
|
+
|
|
337
|
+
```tsx
|
|
338
|
+
const renderScrollComponent = useBottomSheetScrollable();
|
|
339
|
+
|
|
340
|
+
<VirtualizedList
|
|
341
|
+
data={accounts}
|
|
342
|
+
renderItem={renderItem}
|
|
343
|
+
renderScrollComponent={renderScrollComponent}
|
|
344
|
+
/>
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
## Accessibility
|
|
348
|
+
|
|
349
|
+
- Pressing the backdrop closes the sheet.
|
|
350
|
+
- Swiping down dismisses the sheet.
|
|
351
|
+
- The close button's accessible name defaults to "Close", and the back button's defaults to "Go back".
|