pixelize-native-library 1.2.0 → 1.2.1
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/lib/module/core/MODULE.md +2 -1
- package/lib/module/core/gradient/AccentGradientFill.js +80 -0
- package/lib/module/core/gradient/darkenHex.js +13 -0
- package/lib/module/core/gradient/gradientStops.js +27 -0
- package/lib/module/core/gradient/index.js +7 -0
- package/lib/module/core/gradient/withAlpha.js +19 -0
- package/lib/module/core/haptics/MODULE.md +4 -0
- package/lib/module/core/haptics/context.js +7 -0
- package/lib/module/core/haptics/haptics.js +17 -0
- package/lib/module/core/haptics/index.js +6 -0
- package/lib/module/core/haptics/useHaptics.js +73 -0
- package/lib/module/core/icon/MODULE.md +16 -9
- package/lib/module/core/icon/icons/trending-up.js +10 -0
- package/lib/module/core/icon/resolve.js +2 -0
- package/lib/module/core/media/expoImage.js +6 -0
- package/lib/module/core/motion/MODULE.md +12 -12
- package/lib/module/core/motion/config.js +4 -1
- package/lib/module/core/motion/index.js +2 -1
- package/lib/module/core/motion/usePressState.js +145 -0
- package/lib/module/core/style/index.js +1 -0
- package/lib/module/core/style/radius.js +4 -0
- package/lib/module/index.js +1 -0
- package/lib/module/modules/accordion/Accordion.js +69 -49
- package/lib/module/modules/accordion/Accordion.variants.js +4 -3
- package/lib/module/modules/accordion/MODULE.md +2 -1
- package/lib/module/modules/alert-dialog/AlertDialog.js +6 -5
- package/lib/module/modules/alert-dialog/AlertDialog.variants.js +4 -0
- package/lib/module/modules/app-bar/AppBar.js +6 -4
- package/lib/module/modules/app-bar/AppBar.variants.js +1 -2
- package/lib/module/modules/avatar/Avatar.js +7 -1
- package/lib/module/modules/avatar/Avatar.variants.js +1 -1
- package/lib/module/modules/avatar/MODULE.md +2 -2
- package/lib/module/modules/avatar-group/AvatarGroup.js +10 -6
- package/lib/module/modules/avatar-group/AvatarGroup.variants.js +23 -0
- package/lib/module/modules/avatar-group/MODULE.md +16 -0
- package/lib/module/modules/badge/Badge.js +11 -5
- package/lib/module/modules/badge/Badge.variants.js +2 -1
- package/lib/module/modules/badge/MODULE.md +5 -5
- package/lib/module/modules/banner/Banner.js +106 -60
- package/lib/module/modules/banner/Banner.variants.js +2 -2
- package/lib/module/modules/banner/MODULE.md +7 -2
- package/lib/module/modules/bottom-nav/BottomNav.js +6 -3
- package/lib/module/modules/bottom-nav/BottomNav.variants.js +9 -10
- package/lib/module/modules/bottom-nav/BottomNavOverflowSheet.js +28 -4
- package/lib/module/modules/bottom-nav/BottomNavTab.js +28 -4
- package/lib/module/modules/bottom-nav/MODULE.md +10 -1
- package/lib/module/modules/bottom-sheet/BottomSheet.js +20 -7
- package/lib/module/modules/bottom-sheet/BottomSheet.variants.js +15 -5
- package/lib/module/modules/bottom-sheet/MODULE.md +13 -2
- package/lib/module/modules/button/Button.js +87 -101
- package/lib/module/modules/button/Button.variants.js +8 -7
- package/lib/module/modules/button/MODULE.md +6 -0
- package/lib/module/modules/button-group/ButtonGroup.js +36 -37
- package/lib/module/modules/button-group/ButtonGroup.variants.js +21 -46
- package/lib/module/modules/button-group/MODULE.md +25 -30
- package/lib/module/modules/card/Card.js +117 -19
- package/lib/module/modules/card/Card.variants.js +1 -0
- package/lib/module/modules/card/MODULE.md +13 -10
- package/lib/module/modules/charts/BarChart.js +29 -14
- package/lib/module/modules/charts/BarList.js +31 -18
- package/lib/module/modules/charts/Charts.variants.js +66 -2
- package/lib/module/modules/charts/DonutChart.js +9 -4
- package/lib/module/modules/charts/LineChart.js +5 -3
- package/lib/module/modules/charts/MODULE.md +24 -11
- package/lib/module/modules/charts/PieChart.js +13 -4
- package/lib/module/modules/charts/Sparkline.js +4 -2
- package/lib/module/modules/checkbox/Checkbox.js +10 -2
- package/lib/module/modules/checkbox/MODULE.md +5 -0
- package/lib/module/modules/chip/Chip.js +83 -38
- package/lib/module/modules/chip/Chip.variants.js +15 -3
- package/lib/module/modules/chip/MODULE.md +6 -4
- package/lib/module/modules/combobox/Combobox.js +93 -57
- package/lib/module/modules/combobox/Combobox.variants.js +22 -7
- package/lib/module/modules/combobox/MODULE.md +14 -4
- package/lib/module/modules/composer/Composer.js +9 -2
- package/lib/module/modules/composer/Composer.variants.js +2 -0
- package/lib/module/modules/composer/MODULE.md +5 -0
- package/lib/module/modules/copy-button/CopyButton.js +22 -4
- package/lib/module/modules/copy-button/CopyButton.variants.js +4 -2
- package/lib/module/modules/copy-button/MODULE.md +5 -0
- package/lib/module/modules/data-table/DataTable.js +28 -9
- package/lib/module/modules/data-table/DataTable.variants.js +3 -2
- package/lib/module/modules/data-table/MODULE.md +1 -0
- package/lib/module/modules/date-picker/Calendar.js +75 -29
- package/lib/module/modules/date-picker/DatePicker.variants.js +24 -9
- package/lib/module/modules/date-picker/MODULE.md +25 -4
- package/lib/module/modules/date-picker/PickerField.js +13 -4
- package/lib/module/modules/date-picker/PickerShell.js +2 -0
- package/lib/module/modules/date-picker/TimePicker.js +13 -18
- package/lib/module/modules/divider/Divider.variants.js +6 -5
- package/lib/module/modules/divider/MODULE.md +2 -0
- package/lib/module/modules/drawer/Drawer.js +20 -8
- package/lib/module/modules/drawer/Drawer.variants.js +4 -4
- package/lib/module/modules/drawer/MODULE.md +3 -0
- package/lib/module/modules/empty-state/EmptyState.js +18 -29
- package/lib/module/modules/empty-state/EmptyState.variants.js +7 -0
- package/lib/module/modules/empty-state/MODULE.md +1 -0
- package/lib/module/modules/fab/Fab.js +41 -61
- package/lib/module/modules/fab/Fab.variants.js +15 -1
- package/lib/module/modules/fab/FabGroup.js +84 -57
- package/lib/module/modules/fab/MODULE.md +19 -6
- package/lib/module/modules/file-grid/FileGrid.js +30 -16
- package/lib/module/modules/file-grid/FileGrid.variants.js +2 -2
- package/lib/module/modules/file-grid/MODULE.md +3 -1
- package/lib/module/modules/file-upload/FileUpload.variants.js +3 -1
- package/lib/module/modules/file-upload/MODULE.md +2 -0
- package/lib/module/modules/filter-sheet/FilterChip.js +11 -3
- package/lib/module/modules/filter-sheet/FilterSheetBody.js +15 -3
- package/lib/module/modules/filter-sheet/MODULE.md +9 -0
- package/lib/module/modules/folder-row/FolderRow.js +29 -17
- package/lib/module/modules/folder-row/FolderRow.variants.js +4 -2
- package/lib/module/modules/folder-row/MODULE.md +2 -1
- package/lib/module/modules/gantt/Gantt.js +30 -9
- package/lib/module/modules/gantt/Gantt.variants.js +36 -0
- package/lib/module/modules/gantt/MODULE.md +11 -1
- package/lib/module/modules/image-viewer/ImageViewer.js +35 -5
- package/lib/module/modules/image-viewer/MODULE.md +6 -0
- package/lib/module/modules/input/Input.js +20 -7
- package/lib/module/modules/input/Input.variants.js +8 -7
- package/lib/module/modules/input/MODULE.md +2 -0
- package/lib/module/modules/list-item/ListItem.js +48 -26
- package/lib/module/modules/list-item/ListItem.variants.js +11 -2
- package/lib/module/modules/list-item/MODULE.md +2 -3
- package/lib/module/modules/markdown/MODULE.md +8 -1
- package/lib/module/modules/markdown/Markdown.js +57 -22
- package/lib/module/modules/markdown/Markdown.variants.js +2 -1
- package/lib/module/modules/menu/MODULE.md +11 -0
- package/lib/module/modules/menu/Menu.js +99 -40
- package/lib/module/modules/menu/Menu.variants.js +3 -3
- package/lib/module/modules/message-bubble/MODULE.md +4 -1
- package/lib/module/modules/message-bubble/MessageBubble.js +4 -5
- package/lib/module/modules/message-bubble/MessageBubble.variants.js +5 -5
- package/lib/module/modules/modal/MODULE.md +11 -0
- package/lib/module/modules/modal/Modal.js +87 -35
- package/lib/module/modules/modal/Modal.variants.js +2 -2
- package/lib/module/modules/more-items/MODULE.md +5 -0
- package/lib/module/modules/more-items/MoreItems.js +7 -1
- package/lib/module/modules/more-items/MoreItems.variants.js +4 -1
- package/lib/module/modules/multi-select/MODULE.md +5 -0
- package/lib/module/modules/multi-select/MultiSelect.js +23 -1
- package/lib/module/modules/multi-select/MultiSelect.variants.js +4 -2
- package/lib/module/modules/number-input/MODULE.md +2 -1
- package/lib/module/modules/number-input/NumberInput.js +97 -84
- package/lib/module/modules/number-input/NumberInput.variants.js +9 -6
- package/lib/module/modules/org-switcher/MODULE.md +13 -1
- package/lib/module/modules/org-switcher/OrgSwitcher.js +13 -2
- package/lib/module/modules/org-switcher/OrgSwitcher.variants.js +4 -2
- package/lib/module/modules/pagination/MODULE.md +2 -2
- package/lib/module/modules/pagination/Pagination.js +76 -37
- package/lib/module/modules/pagination/Pagination.variants.js +4 -2
- package/lib/module/modules/pagination/PaginationControls.js +55 -35
- package/lib/module/modules/pin-input/MODULE.md +5 -1
- package/lib/module/modules/pin-input/PinInput.js +9 -2
- package/lib/module/modules/pin-input/PinInput.variants.js +2 -1
- package/lib/module/modules/radio-group/MODULE.md +2 -2
- package/lib/module/modules/radio-group/RadioGroup.js +122 -63
- package/lib/module/modules/radio-group/RadioGroup.variants.js +2 -1
- package/lib/module/modules/reorder/MODULE.md +2 -0
- package/lib/module/modules/reorder/Reorder.js +4 -3
- package/lib/module/modules/reorder/Reorder.variants.js +4 -2
- package/lib/module/modules/rich-text/MODULE.md +3 -1
- package/lib/module/modules/rich-text/RichText.js +42 -22
- package/lib/module/modules/rich-text-editor/MODULE.md +4 -1
- package/lib/module/modules/rich-text-editor/RichTextEditor.js +8 -1
- package/lib/module/modules/rich-text-editor/RichTextEditor.variants.js +9 -6
- package/lib/module/modules/screen/MODULE.md +7 -0
- package/lib/module/modules/screen/Screen.js +50 -17
- package/lib/module/modules/screen/Screen.variants.js +18 -0
- package/lib/module/modules/search-bar/MODULE.md +1 -0
- package/lib/module/modules/search-bar/SearchBar.js +46 -26
- package/lib/module/modules/search-bar/SearchBar.variants.js +11 -8
- package/lib/module/modules/section/MODULE.md +2 -0
- package/lib/module/modules/section/Section.js +8 -15
- package/lib/module/modules/section/Section.variants.js +1 -6
- package/lib/module/modules/segmented-control/MODULE.md +3 -1
- package/lib/module/modules/segmented-control/SegmentedControl.js +110 -46
- package/lib/module/modules/segmented-control/SegmentedControl.variants.js +3 -2
- package/lib/module/modules/select/MODULE.md +26 -5
- package/lib/module/modules/select/Select.js +39 -12
- package/lib/module/modules/select/Select.variants.js +36 -12
- package/lib/module/modules/skeleton/MODULE.md +23 -27
- package/lib/module/modules/skeleton/Skeleton.js +46 -51
- package/lib/module/modules/skeleton/Skeleton.variants.js +17 -75
- package/lib/module/modules/slider/MODULE.md +2 -0
- package/lib/module/modules/slider/Slider.js +2 -1
- package/lib/module/modules/stage-progress/MODULE.md +12 -8
- package/lib/module/modules/stage-progress/StageProgress.js +94 -47
- package/lib/module/modules/stage-progress/StageProgress.variants.js +17 -12
- package/lib/module/modules/stat-tile/MODULE.md +2 -0
- package/lib/module/modules/stat-tile/StatTile.js +15 -10
- package/lib/module/modules/stat-tile/StatTile.variants.js +2 -0
- package/lib/module/modules/state-block/MODULE.md +3 -0
- package/lib/module/modules/state-block/StateBlock.js +11 -6
- package/lib/module/modules/state-block/StateBlock.variants.js +7 -0
- package/lib/module/modules/surface/MODULE.md +59 -0
- package/lib/module/modules/surface/Surface.js +42 -0
- package/lib/module/modules/surface/Surface.variants.js +33 -0
- package/lib/module/modules/surface/index.js +4 -0
- package/lib/module/modules/swipeable-row/MODULE.md +9 -0
- package/lib/module/modules/swipeable-row/SwipeableRow.js +28 -7
- package/lib/module/modules/switch/MODULE.md +2 -0
- package/lib/module/modules/switch/Switch.js +8 -2
- package/lib/module/modules/tabs/MODULE.md +2 -1
- package/lib/module/modules/tabs/Tabs.js +37 -18
- package/lib/module/modules/tabs/Tabs.variants.js +4 -2
- package/lib/module/modules/text/MODULE.md +5 -2
- package/lib/module/modules/text/Text.js +18 -6
- package/lib/module/modules/text/Text.variants.js +108 -44
- package/lib/module/modules/textarea/MODULE.md +2 -0
- package/lib/module/modules/textarea/Textarea.js +3 -2
- package/lib/module/modules/textarea/Textarea.variants.js +2 -1
- package/lib/module/modules/toast/MODULE.md +8 -4
- package/lib/module/modules/toast/Toast.js +31 -13
- package/lib/module/modules/toast/Toast.variants.js +5 -0
- package/lib/module/modules/tooltip/MODULE.md +15 -11
- package/lib/module/modules/tooltip/Tooltip.js +41 -9
- package/lib/module/modules/tooltip/Tooltip.variants.js +8 -1
- package/lib/module/theme/MODULE.md +3 -1
- package/lib/module/theme/platform/MODULE.md +14 -2
- package/lib/module/theme/platform/elevation.native.js +0 -44
- package/lib/module/theme/platform/floatingSurface.native.js +75 -0
- package/lib/module/theme/platform/highlight.native.js +59 -0
- package/lib/module/theme/platform/index.js +5 -0
- package/lib/module/theme/platform/motion.native.js +31 -11
- package/lib/module/theme/platform/stateLayer.native.js +14 -0
- package/lib/module/theme/platform/surfaces.native.js +11 -0
- package/lib/module/theme/provider/PixelizeProvider.js +12 -5
- package/lib/module/theme/tokens/MODULE.md +32 -28
- package/lib/module/theme/tokens/THEME-CONTRACT.md +137 -0
- package/lib/module/theme/tokens/assertPalette.js +29 -0
- package/lib/module/theme/tokens/brands/emerald/palette.light.js +7 -6
- package/lib/module/theme/tokens/brands/lavender/palette.light.js +3 -2
- package/lib/module/theme/tokens/brands/meadow/palette.light.js +7 -6
- package/lib/module/theme/tokens/brands/radiant/palette.light.js +7 -6
- package/lib/module/theme/tokens/brands/rosewood/palette.light.js +7 -6
- package/lib/module/theme/tokens/brands/skyline/palette.light.js +7 -6
- package/lib/module/theme/tokens/brands/slate/palette.light.js +8 -10
- package/lib/module/theme/tokens/brands/storefront/palette.light.js +7 -6
- package/lib/module/theme/tokens/brands/zinc/palette.dark.js +3 -2
- package/lib/module/theme/tokens/brands/zinc/palette.light.js +3 -2
- package/lib/module/theme/tokens/builders/buildDarkPalette.js +3 -2
- package/lib/module/theme/tokens/builders/finalizePalette.js +34 -0
- package/lib/module/theme/tokens/builders/liftToContrast.js +44 -0
- package/lib/module/theme/tokens/builders/placeholderInk.js +22 -0
- package/lib/module/theme/tokens/builders/semanticText.js +14 -0
- package/lib/module/theme/tokens/builders/surfaceRungs.js +44 -0
- package/lib/module/theme/tokens/index.js +5 -0
- package/lib/module/theme/tokens/roles/index.js +5 -0
- package/lib/typescript/core/gradient/AccentGradientFill.d.ts +7 -0
- package/lib/typescript/core/gradient/darkenHex.d.ts +2 -0
- package/lib/typescript/core/gradient/gradientStops.d.ts +10 -0
- package/lib/typescript/core/gradient/index.d.ts +5 -0
- package/lib/typescript/core/gradient/withAlpha.d.ts +2 -0
- package/lib/typescript/core/haptics/context.d.ts +3 -0
- package/lib/typescript/core/haptics/haptics.d.ts +33 -0
- package/lib/typescript/core/haptics/index.d.ts +6 -0
- package/lib/typescript/core/haptics/useHaptics.d.ts +12 -0
- package/lib/typescript/core/icon/icons/trending-up.d.ts +3 -0
- package/lib/typescript/core/icon/names.d.ts +1 -1
- package/lib/typescript/core/media/expoImage.d.ts +15 -6
- package/lib/typescript/core/media/pickers.d.ts +5 -5
- package/lib/typescript/core/motion/config.d.ts +2 -1
- package/lib/typescript/core/motion/index.d.ts +3 -1
- package/lib/typescript/core/motion/usePressState.d.ts +21 -0
- package/lib/typescript/core/style/index.d.ts +1 -0
- package/lib/typescript/core/style/radius.d.ts +2 -0
- package/lib/typescript/index.d.ts +4 -2
- package/lib/typescript/modules/accordion/Accordion.variants.d.ts +2 -2
- package/lib/typescript/modules/alert-dialog/AlertDialog.variants.d.ts +1 -0
- package/lib/typescript/modules/avatar/Avatar.variants.d.ts +1 -1
- package/lib/typescript/modules/avatar-group/AvatarGroup.d.ts +4 -2
- package/lib/typescript/modules/avatar-group/AvatarGroup.variants.d.ts +19 -0
- package/lib/typescript/modules/banner/Banner.d.ts +2 -0
- package/lib/typescript/modules/bottom-nav/BottomNav.variants.d.ts +1 -3
- package/lib/typescript/modules/bottom-sheet/BottomSheet.variants.d.ts +3 -1
- package/lib/typescript/modules/button/Button.d.ts +0 -25
- package/lib/typescript/modules/button/Button.variants.d.ts +6 -6
- package/lib/typescript/modules/button-group/ButtonGroup.d.ts +0 -19
- package/lib/typescript/modules/button-group/ButtonGroup.variants.d.ts +22 -56
- package/lib/typescript/modules/card/Card.d.ts +7 -5
- package/lib/typescript/modules/charts/Charts.variants.d.ts +29 -1
- package/lib/typescript/modules/chip/Chip.d.ts +3 -1
- package/lib/typescript/modules/chip/Chip.variants.d.ts +6 -2
- package/lib/typescript/modules/chip/index.d.ts +1 -1
- package/lib/typescript/modules/combobox/Combobox.variants.d.ts +17 -4
- package/lib/typescript/modules/data-table/DataTable.variants.d.ts +1 -1
- package/lib/typescript/modules/date-picker/DatePicker.variants.d.ts +15 -3
- package/lib/typescript/modules/date-picker/TimePicker.d.ts +1 -7
- package/lib/typescript/modules/divider/Divider.variants.d.ts +4 -4
- package/lib/typescript/modules/empty-state/EmptyState.d.ts +2 -0
- package/lib/typescript/modules/empty-state/EmptyState.variants.d.ts +1 -0
- package/lib/typescript/modules/fab/Fab.variants.d.ts +2 -0
- package/lib/typescript/modules/folder-row/FolderRow.d.ts +0 -8
- package/lib/typescript/modules/gantt/Gantt.variants.d.ts +21 -0
- package/lib/typescript/modules/input/Input.variants.d.ts +6 -6
- package/lib/typescript/modules/list-item/ListItem.d.ts +1 -5
- package/lib/typescript/modules/list-item/ListItem.variants.d.ts +137 -1
- package/lib/typescript/modules/markdown/Markdown.d.ts +7 -0
- package/lib/typescript/modules/message-bubble/MessageBubble.d.ts +2 -2
- package/lib/typescript/modules/message-bubble/MessageBubble.variants.d.ts +1 -2
- package/lib/typescript/modules/number-input/NumberInput.variants.d.ts +7 -5
- package/lib/typescript/modules/pagination/PaginationControls.d.ts +1 -4
- package/lib/typescript/modules/reorder/Reorder.d.ts +1 -1
- package/lib/typescript/modules/screen/Screen.d.ts +3 -9
- package/lib/typescript/modules/screen/Screen.variants.d.ts +4 -0
- package/lib/typescript/modules/search-bar/SearchBar.variants.d.ts +6 -6
- package/lib/typescript/modules/section/Section.variants.d.ts +0 -3
- package/lib/typescript/modules/segmented-control/SegmentedControl.variants.d.ts +1 -1
- package/lib/typescript/modules/select/Select.d.ts +4 -1
- package/lib/typescript/modules/select/Select.variants.d.ts +22 -8
- package/lib/typescript/modules/select/index.d.ts +1 -1
- package/lib/typescript/modules/skeleton/Skeleton.d.ts +3 -18
- package/lib/typescript/modules/skeleton/Skeleton.variants.d.ts +12 -68
- package/lib/typescript/modules/stage-progress/StageProgress.variants.d.ts +15 -6
- package/lib/typescript/modules/state-block/StateBlock.d.ts +4 -0
- package/lib/typescript/modules/state-block/StateBlock.variants.d.ts +1 -0
- package/lib/typescript/modules/surface/Surface.d.ts +19 -0
- package/lib/typescript/modules/surface/Surface.variants.d.ts +15 -0
- package/lib/typescript/modules/surface/index.d.ts +4 -0
- package/lib/typescript/modules/text/Text.d.ts +8 -4
- package/lib/typescript/modules/text/Text.variants.d.ts +14 -11
- package/lib/typescript/modules/toast/Toast.variants.d.ts +2 -0
- package/lib/typescript/modules/tooltip/Tooltip.variants.d.ts +7 -0
- package/lib/typescript/theme/index.d.ts +1 -1
- package/lib/typescript/theme/platform/elevation.native.d.ts +0 -30
- package/lib/typescript/theme/platform/floatingSurface.native.d.ts +10 -0
- package/lib/typescript/theme/platform/highlight.native.d.ts +17 -0
- package/lib/typescript/theme/platform/index.d.ts +9 -0
- package/lib/typescript/theme/platform/motion.native.d.ts +33 -13
- package/lib/typescript/theme/platform/stateLayer.native.d.ts +11 -0
- package/lib/typescript/theme/platform/surfaces.native.d.ts +8 -0
- package/lib/typescript/theme/provider/PixelizeProvider.d.ts +1 -1
- package/lib/typescript/theme/provider/types.d.ts +8 -0
- package/lib/typescript/theme/tokens/assertPalette.d.ts +10 -0
- package/lib/typescript/theme/tokens/brands/emerald/palette.light.d.ts +4 -3
- package/lib/typescript/theme/tokens/brands/lavender/palette.light.d.ts +4 -3
- package/lib/typescript/theme/tokens/brands/meadow/palette.light.d.ts +4 -3
- package/lib/typescript/theme/tokens/brands/radiant/palette.light.d.ts +4 -3
- package/lib/typescript/theme/tokens/brands/rosewood/palette.light.d.ts +4 -3
- package/lib/typescript/theme/tokens/brands/skyline/palette.light.d.ts +4 -3
- package/lib/typescript/theme/tokens/brands/slate/palette.light.d.ts +4 -3
- package/lib/typescript/theme/tokens/brands/storefront/palette.light.d.ts +4 -3
- package/lib/typescript/theme/tokens/brands/zinc/palette.light.d.ts +4 -3
- package/lib/typescript/theme/tokens/builders/finalizePalette.d.ts +4 -0
- package/lib/typescript/theme/tokens/builders/liftToContrast.d.ts +9 -0
- package/lib/typescript/theme/tokens/builders/placeholderInk.d.ts +13 -0
- package/lib/typescript/theme/tokens/builders/semanticText.d.ts +4 -0
- package/lib/typescript/theme/tokens/builders/surfaceRungs.d.ts +12 -0
- package/lib/typescript/theme/tokens/index.d.ts +5 -0
- package/lib/typescript/theme/tokens/roles/index.d.ts +1 -0
- package/lib/typescript/theme/tokens/types.d.ts +8 -7
- package/package.json +10 -2
- package/registry.json +5 -0
|
@@ -10,9 +10,12 @@
|
|
|
10
10
|
|
|
11
11
|
import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
12
12
|
import { Animated, Pressable, StyleSheet, Text, View } from "react-native";
|
|
13
|
+
import Reanimated, { FadeInDown, ReduceMotion } from "react-native-reanimated";
|
|
13
14
|
import { useAnimatedValue, useMotion } from "../../core/motion/index.js";
|
|
15
|
+
import { usePressState } from "../../core/motion/usePressState.js";
|
|
14
16
|
import { Icon } from "../../core/icon/index.js";
|
|
15
17
|
import { useThemedStyles } from "../../core/style/index.js";
|
|
18
|
+
import { stateLayerScrim } from "../../theme/platform/stateLayer.native.js";
|
|
16
19
|
import { VirtualList } from "../../core/list/index.js";
|
|
17
20
|
import { useTheme } from "../../theme/hooks.js";
|
|
18
21
|
import { Badge } from "../badge/index.js";
|
|
@@ -22,6 +25,7 @@ const VIRTUALIZE_THRESHOLD = 20;
|
|
|
22
25
|
const ICON_STROKE = 2;
|
|
23
26
|
const FOCUS_RING_WIDTH = 2;
|
|
24
27
|
const FOCUS_RING_GAP = 2;
|
|
28
|
+
const AnimatedPressable = Reanimated.createAnimatedComponent(Pressable);
|
|
25
29
|
const toArray = v => v === undefined ? [] : Array.isArray(v) ? v : [v];
|
|
26
30
|
let reanimatedModule;
|
|
27
31
|
function getReanimated() {
|
|
@@ -119,6 +123,7 @@ const AccordionRow = /*#__PURE__*/memo(function AccordionRow({
|
|
|
119
123
|
testID
|
|
120
124
|
}) {
|
|
121
125
|
const spec = ACCORDION_SIZES[size];
|
|
126
|
+
const press = usePressState(rowDisabled);
|
|
122
127
|
const [focused, setFocused] = useState(false);
|
|
123
128
|
const a11y = useMemo(() => resolveAccordionHeaderAccessibility({
|
|
124
129
|
expanded,
|
|
@@ -134,58 +139,18 @@ const AccordionRow = /*#__PURE__*/memo(function AccordionRow({
|
|
|
134
139
|
size
|
|
135
140
|
}), theme, [size]);
|
|
136
141
|
const itemBody = item.renderContent?.() ?? item.content;
|
|
137
|
-
|
|
142
|
+
const overlayStaticStyle = useMemo(() => ({
|
|
143
|
+
backgroundColor: stateLayerScrim(theme.mode),
|
|
144
|
+
borderRadius: theme.radii.sm
|
|
145
|
+
}), [theme.mode, theme.radii.sm]);
|
|
146
|
+
return /*#__PURE__*/_jsxs(Reanimated.View, {
|
|
147
|
+
entering: FadeInDown.springify().reduceMotion(ReduceMotion.System),
|
|
138
148
|
style: [accordionItemStructure(theme), {
|
|
139
149
|
borderBottomColor: colors.divider
|
|
140
150
|
}],
|
|
141
|
-
children: [/*#__PURE__*/_jsxs(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
"aria-expanded": a11y["aria-expanded"],
|
|
145
|
-
"aria-disabled": a11y["aria-disabled"],
|
|
146
|
-
accessibilityLabel: item.subtitle ? `${item.title}, ${item.subtitle}` : item.title,
|
|
147
|
-
disabled: a11y.disabled,
|
|
148
|
-
onPress: a11y.disabled ? undefined : handlePress,
|
|
149
|
-
onFocus: handleFocus,
|
|
150
|
-
onBlur: handleBlur,
|
|
151
|
-
hitSlop: spec.hitSlop,
|
|
152
|
-
style: ({
|
|
153
|
-
pressed
|
|
154
|
-
}) => [headerPressedStyle, pressed && !rowDisabled && {
|
|
155
|
-
backgroundColor: colors.pressedHeaderBg
|
|
156
|
-
}, rowDisabled && styles.dimmed],
|
|
157
|
-
children: [item.icon !== undefined && /*#__PURE__*/_jsx(Icon, {
|
|
158
|
-
name: item.icon,
|
|
159
|
-
size: spec.iconSize,
|
|
160
|
-
color: colors.icon,
|
|
161
|
-
strokeWidth: ICON_STROKE
|
|
162
|
-
}), /*#__PURE__*/_jsxs(View, {
|
|
163
|
-
style: styles.headerText,
|
|
164
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
165
|
-
style: [theme.fontStyleForWeight(theme.fontWeights.medium), {
|
|
166
|
-
fontSize: spec.fontSize,
|
|
167
|
-
color: colors.title
|
|
168
|
-
}],
|
|
169
|
-
children: item.title
|
|
170
|
-
}), item.subtitle !== undefined && /*#__PURE__*/_jsx(Text, {
|
|
171
|
-
numberOfLines: 1,
|
|
172
|
-
style: [theme.fontStyleForWeight(theme.fontWeights.regular), {
|
|
173
|
-
fontSize: theme.fontSizes.sm,
|
|
174
|
-
color: colors.icon,
|
|
175
|
-
marginTop: theme.space[1]
|
|
176
|
-
}],
|
|
177
|
-
children: item.subtitle
|
|
178
|
-
})]
|
|
179
|
-
}), item.badge !== undefined && /*#__PURE__*/_jsx(Badge, {
|
|
180
|
-
label: item.badge,
|
|
181
|
-
size: "sm",
|
|
182
|
-
tone: "neutral"
|
|
183
|
-
}), /*#__PURE__*/_jsx(AccordionChevron, {
|
|
184
|
-
expanded: expanded,
|
|
185
|
-
disabled: rowDisabled,
|
|
186
|
-
size: size,
|
|
187
|
-
colors: colors
|
|
188
|
-
}), focused && /*#__PURE__*/_jsx(View, {
|
|
151
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
152
|
+
style: styles.headerHost,
|
|
153
|
+
children: [focused && /*#__PURE__*/_jsx(View, {
|
|
189
154
|
pointerEvents: "none",
|
|
190
155
|
testID: testID ? `${testID}-focus-ring` : undefined,
|
|
191
156
|
style: {
|
|
@@ -198,6 +163,58 @@ const AccordionRow = /*#__PURE__*/memo(function AccordionRow({
|
|
|
198
163
|
borderColor: colors.focusRing,
|
|
199
164
|
borderRadius: theme.radii.sm + FOCUS_RING_GAP + FOCUS_RING_WIDTH
|
|
200
165
|
}
|
|
166
|
+
}), /*#__PURE__*/_jsxs(AnimatedPressable, {
|
|
167
|
+
testID: testID,
|
|
168
|
+
accessibilityRole: a11y.accessibilityRole,
|
|
169
|
+
"aria-expanded": a11y["aria-expanded"],
|
|
170
|
+
"aria-disabled": a11y["aria-disabled"],
|
|
171
|
+
accessibilityLabel: item.subtitle ? `${item.title}, ${item.subtitle}` : item.title,
|
|
172
|
+
disabled: a11y.disabled,
|
|
173
|
+
onPress: a11y.disabled ? undefined : handlePress,
|
|
174
|
+
onPressIn: press.handlers.onPressIn,
|
|
175
|
+
onPressOut: press.handlers.onPressOut,
|
|
176
|
+
onLayout: press.onLayout,
|
|
177
|
+
onFocus: handleFocus,
|
|
178
|
+
onBlur: handleBlur,
|
|
179
|
+
hitSlop: spec.hitSlop,
|
|
180
|
+
style: [headerPressedStyle, {
|
|
181
|
+
overflow: "hidden"
|
|
182
|
+
}, press.animatedStyle, rowDisabled && styles.dimmed],
|
|
183
|
+
children: [/*#__PURE__*/_jsx(Reanimated.View, {
|
|
184
|
+
pointerEvents: "none",
|
|
185
|
+
style: [StyleSheet.absoluteFill, overlayStaticStyle, press.overlayStyle]
|
|
186
|
+
}), item.icon !== undefined && /*#__PURE__*/_jsx(Icon, {
|
|
187
|
+
name: item.icon,
|
|
188
|
+
size: spec.iconSize,
|
|
189
|
+
color: colors.icon,
|
|
190
|
+
strokeWidth: ICON_STROKE
|
|
191
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
192
|
+
style: styles.headerText,
|
|
193
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
194
|
+
style: [theme.fontStyleForWeight(theme.fontWeights.medium), {
|
|
195
|
+
fontSize: spec.fontSize,
|
|
196
|
+
color: colors.title
|
|
197
|
+
}],
|
|
198
|
+
children: item.title
|
|
199
|
+
}), item.subtitle !== undefined && /*#__PURE__*/_jsx(Text, {
|
|
200
|
+
numberOfLines: 1,
|
|
201
|
+
style: [theme.fontStyleForWeight(theme.fontWeights.regular), {
|
|
202
|
+
fontSize: theme.fontSizes.sm,
|
|
203
|
+
color: colors.icon,
|
|
204
|
+
marginTop: theme.space[1]
|
|
205
|
+
}],
|
|
206
|
+
children: item.subtitle
|
|
207
|
+
})]
|
|
208
|
+
}), item.badge !== undefined && /*#__PURE__*/_jsx(Badge, {
|
|
209
|
+
label: item.badge,
|
|
210
|
+
size: "sm",
|
|
211
|
+
tone: "neutral"
|
|
212
|
+
}), /*#__PURE__*/_jsx(AccordionChevron, {
|
|
213
|
+
expanded: expanded,
|
|
214
|
+
disabled: rowDisabled,
|
|
215
|
+
size: size,
|
|
216
|
+
colors: colors
|
|
217
|
+
})]
|
|
201
218
|
})]
|
|
202
219
|
}), itemBody !== null && itemBody !== undefined && /*#__PURE__*/_jsx(AccordionAnimatedContent, {
|
|
203
220
|
expanded: expanded,
|
|
@@ -358,6 +375,9 @@ const styles = StyleSheet.create({
|
|
|
358
375
|
},
|
|
359
376
|
headerText: {
|
|
360
377
|
flex: 1
|
|
378
|
+
},
|
|
379
|
+
headerHost: {
|
|
380
|
+
position: "relative"
|
|
361
381
|
}
|
|
362
382
|
});
|
|
363
383
|
//# sourceMappingURL=Accordion.js.map
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* rendering React Native.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
import { StyleSheet } from "react-native";
|
|
17
18
|
import { createThemedVariants } from "../../core/style/index.js";
|
|
18
19
|
/** Same floor as Button/Tabs/Select — 44dp (WCAG 2.5.5 AAA / HIG). Duplicated, not imported: modules
|
|
19
20
|
* stay isolated. */
|
|
@@ -77,12 +78,12 @@ export function resolveAccordionHeaderAccessibility(input) {
|
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
/**
|
|
80
|
-
* One item's separator — a
|
|
81
|
+
* One item's separator — a StyleSheet.hairlineWidth on the bottom edge, theme-scaled border WIDTH. Colour
|
|
81
82
|
* (`divider`) is resolved separately and applied inline over this.
|
|
82
83
|
*/
|
|
83
|
-
export const accordionItemStructure = createThemedVariants(
|
|
84
|
+
export const accordionItemStructure = createThemedVariants(_theme => ({
|
|
84
85
|
base: {
|
|
85
|
-
borderBottomWidth:
|
|
86
|
+
borderBottomWidth: StyleSheet.hairlineWidth
|
|
86
87
|
}
|
|
87
88
|
}));
|
|
88
89
|
|
|
@@ -67,7 +67,8 @@ Everything routes through **`useMotion()`** — no module-local timing constant,
|
|
|
67
67
|
reveal and the chevron now pick up the device tier's `durationScale` and the global `MOTION_SCALE` /
|
|
68
68
|
`MOTION_ENABLED` switches, which a module-scope read of `MOTION_DURATION.normal` never could. The
|
|
69
69
|
slide distance is `MOTION_TRANSFORM.offsetY`; reduce-motion is `motion.enabled`, never a second
|
|
70
|
-
`useReducedMotion()` call (`core/motion/MODULE.md` rule 6).
|
|
70
|
+
`useReducedMotion()` call (`core/motion/MODULE.md` rule 6). Header presses use `usePressState`
|
|
71
|
+
(scale + state-layer overlay).
|
|
71
72
|
|
|
72
73
|
## Why content is not height-animated
|
|
73
74
|
|
|
@@ -9,10 +9,11 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { memo } from "react";
|
|
12
|
-
import {
|
|
12
|
+
import { View } from "react-native";
|
|
13
13
|
import { useTheme } from "../../theme/hooks.js";
|
|
14
14
|
import { Button } from "../button/index.js";
|
|
15
15
|
import { Modal } from "../modal/index.js";
|
|
16
|
+
import { Text } from "../text/index.js";
|
|
16
17
|
import { alertDialogActionsStructure, resolveAlertDialogConfirmTone } from "./AlertDialog.variants.js";
|
|
17
18
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
19
|
export const AlertDialog = /*#__PURE__*/memo(function AlertDialog({
|
|
@@ -36,11 +37,11 @@ export const AlertDialog = /*#__PURE__*/memo(function AlertDialog({
|
|
|
36
37
|
title: title,
|
|
37
38
|
testID: testID,
|
|
38
39
|
children: [description !== undefined && /*#__PURE__*/_jsx(Text, {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
variant: "body",
|
|
41
|
+
color: "muted",
|
|
42
|
+
style: {
|
|
42
43
|
marginBottom: theme.space[5]
|
|
43
|
-
}
|
|
44
|
+
},
|
|
44
45
|
children: description
|
|
45
46
|
}), /*#__PURE__*/_jsxs(View, {
|
|
46
47
|
style: alertDialogActionsStructure(theme),
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { createThemedVariants } from "../../core/style/index.js";
|
|
18
|
+
import { floatingSurfaceStyle } from "../../theme/platform/floatingSurface.native.js";
|
|
18
19
|
/**
|
|
19
20
|
* Maps AlertDialog's own closed `tone` union onto the confirm action's `ButtonTone`. `"default"`
|
|
20
21
|
* resolves to Button's own default tone (`"accent"`) rather than inventing a fourth tone value;
|
|
@@ -41,4 +42,7 @@ export const alertDialogActionsStructure = createThemedVariants(theme => ({
|
|
|
41
42
|
columnGap: theme.space[3]
|
|
42
43
|
}
|
|
43
44
|
}));
|
|
45
|
+
export function alertDialogPanelDepth(theme) {
|
|
46
|
+
return floatingSurfaceStyle(theme, "lg");
|
|
47
|
+
}
|
|
44
48
|
//# sourceMappingURL=AlertDialog.variants.js.map
|
|
@@ -21,6 +21,7 @@ import { Animated, Text, View } from "react-native";
|
|
|
21
21
|
import { HEADING_LEVEL, HeadingText } from "../../core/heading/index.js";
|
|
22
22
|
import { useAnimatedValue, useMotion } from "../../core/motion/index.js";
|
|
23
23
|
import { useTheme } from "../../theme/hooks.js";
|
|
24
|
+
import { floatingBackground, floatingSurfaceStyle } from "../../theme/platform/index.js";
|
|
24
25
|
import { Button } from "../button/index.js";
|
|
25
26
|
import { appBarActionsRowStructure, appBarSideStructure, appBarSideTrailingStructure, appBarStructure, appBarTitleBoxStructure, resolveAppBarColors } from "./AppBar.variants.js";
|
|
26
27
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -112,12 +113,13 @@ export const AppBar = /*#__PURE__*/memo(function AppBar({
|
|
|
112
113
|
const titleBoxStyle = useMemo(() => [appBarTitleBoxStructure(theme), {
|
|
113
114
|
opacity
|
|
114
115
|
}], [theme, opacity]);
|
|
116
|
+
const barDepth = useMemo(() => ({
|
|
117
|
+
backgroundColor: floatingBackground(theme, "sm"),
|
|
118
|
+
...floatingSurfaceStyle(theme, "sm")
|
|
119
|
+
}), [theme]);
|
|
115
120
|
return /*#__PURE__*/_jsxs(View, {
|
|
116
121
|
testID: testID,
|
|
117
|
-
style: [appBarStructure(theme),
|
|
118
|
-
backgroundColor: colors.background,
|
|
119
|
-
borderBottomColor: colors.border
|
|
120
|
-
}, style],
|
|
122
|
+
style: [appBarStructure(theme), barDepth, style],
|
|
121
123
|
children: [/*#__PURE__*/_jsx(View, {
|
|
122
124
|
style: appBarSideStructure(theme),
|
|
123
125
|
children: onBack !== undefined ? /*#__PURE__*/_jsx(Button, {
|
|
@@ -39,8 +39,7 @@ export const appBarStructure = createThemedVariants(theme => ({
|
|
|
39
39
|
alignItems: "center",
|
|
40
40
|
paddingHorizontal: theme.space[2],
|
|
41
41
|
paddingVertical: theme.space[2],
|
|
42
|
-
columnGap: theme.space[1]
|
|
43
|
-
borderBottomWidth: theme.borderWidths.thin
|
|
42
|
+
columnGap: theme.space[1]
|
|
44
43
|
}
|
|
45
44
|
}));
|
|
46
45
|
export const appBarSideStructure = createThemedVariants(_theme => ({
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
import { memo, useMemo } from "react";
|
|
20
20
|
import { StyleSheet, Text, View } from "react-native";
|
|
21
21
|
import { MediaImage } from "../../core/media/index.js";
|
|
22
|
+
import { Icon } from "../../core/icon/index.js";
|
|
22
23
|
import { useMotion } from "../../core/motion/index.js";
|
|
23
24
|
import { useTheme } from "../../theme/hooks.js";
|
|
24
25
|
import { AVATAR_SIZES, avatarStructure, resolveAvatarAccessibility, resolveAvatarColors, resolveAvatarIdentityColors } from "./Avatar.variants.js";
|
|
@@ -71,7 +72,12 @@ export const Avatar = /*#__PURE__*/memo(function Avatar({
|
|
|
71
72
|
numberOfLines: 1,
|
|
72
73
|
style: initialsStyle,
|
|
73
74
|
children: initials.slice(0, 2)
|
|
74
|
-
}) :
|
|
75
|
+
}) : /*#__PURE__*/_jsx(Icon, {
|
|
76
|
+
name: "user",
|
|
77
|
+
size: Math.round(spec.box * 0.45),
|
|
78
|
+
color: colors.initialsText,
|
|
79
|
+
strokeWidth: 2
|
|
80
|
+
})
|
|
75
81
|
});
|
|
76
82
|
});
|
|
77
83
|
//# sourceMappingURL=Avatar.js.map
|
|
@@ -20,7 +20,7 @@ which is exactly why its accessibility default is the one place it deliberately
|
|
|
20
20
|
| Prop | Type | Default | Notes |
|
|
21
21
|
|------|------|---------|-------|
|
|
22
22
|
| `size` | `xs \| sm \| md \| lg \| xl` | `md` | Diameters 24 / 32 / 40 / 56 / 72 dp. |
|
|
23
|
-
| `shape` | `circle \| rounded` | `circle` | `rounded`
|
|
23
|
+
| `shape` | `circle \| rounded` | `circle` | `rounded` uses `radii.full` for an org/product; a person stays circular. |
|
|
24
24
|
| `source` | `{ uri: string }` | — | A remote image. Wins over `initials` when present. |
|
|
25
25
|
| `initials` | `string` | — | Shown when there is no `source`. Clipped to the first two characters. |
|
|
26
26
|
| `identity` | `string` | — | Seeds a stable hashed fill for the initials/placeholder state. Absent → the neutral fill. |
|
|
@@ -72,7 +72,7 @@ fewer place to special-case the optional-peer fallback.
|
|
|
72
72
|
contract is unit-tested by measuring real palettes — never eyeballed.
|
|
73
73
|
3. **`radii.full` clips a circle for any diameter.** One token (a finite `9999`, not `Infinity` —
|
|
74
74
|
RN rejects non-finite style values) covers every size instead of each variant computing its own
|
|
75
|
-
`box / 2`; `shape="rounded"` swaps it for `radii.
|
|
75
|
+
`box / 2`; `shape="rounded"` swaps it for `radii.full`.
|
|
76
76
|
4. **`style: LayoutStyle` last and once, no `{...rest}`** — internals never receive consumer style.
|
|
77
77
|
|
|
78
78
|
## Testing note — hidden elements and React Native Testing Library
|
|
@@ -5,15 +5,17 @@
|
|
|
5
5
|
* `avatars.length` exceeds `max`. Each face is this library's own `Avatar` module — never a hand-rolled
|
|
6
6
|
* image/initials pair — so list recycling, identity hashing, and shape defaults stay consistent.
|
|
7
7
|
*
|
|
8
|
-
* No `accessibilityRole` of its own
|
|
9
|
-
*
|
|
8
|
+
* No `accessibilityRole` of its own. Each composed `Avatar` gets a label — the consumer's, or (since
|
|
9
|
+
* a grouped face has no adjacent visible name to lean on, unlike a standalone `Avatar`) a generic
|
|
10
|
+
* `resolveAvatarGroupFaceFallbackLabel` fallback. The overflow pill carries its own `"text"`-role
|
|
11
|
+
* label so a screen reader hears how many faces are hidden, not just the ones on screen.
|
|
10
12
|
*/
|
|
11
13
|
|
|
12
14
|
import { memo, useMemo } from "react";
|
|
13
15
|
import { Text, View } from "react-native";
|
|
14
16
|
import { useTheme } from "../../theme/hooks.js";
|
|
15
17
|
import { Avatar } from "../avatar/index.js";
|
|
16
|
-
import { AVATAR_GROUP_DEFAULT_MAX, avatarGroupItemStructure, avatarGroupOverflowLabelStructure, avatarGroupOverflowStructure, avatarGroupStructure, resolveAvatarGroupColors, resolveAvatarGroupOverflowCount, resolveAvatarGroupOverlap, resolveAvatarGroupVisibleCount } from "./AvatarGroup.variants.js";
|
|
18
|
+
import { AVATAR_GROUP_DEFAULT_MAX, avatarGroupItemStructure, avatarGroupOverflowLabelStructure, avatarGroupOverflowStructure, avatarGroupStructure, resolveAvatarGroupColors, resolveAvatarGroupFaceFallbackLabel, resolveAvatarGroupOverflowAccessibility, resolveAvatarGroupOverflowCount, resolveAvatarGroupOverlap, resolveAvatarGroupVisibleCount } from "./AvatarGroup.variants.js";
|
|
17
19
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
20
|
export const AvatarGroup = /*#__PURE__*/memo(function AvatarGroup({
|
|
19
21
|
avatars,
|
|
@@ -27,6 +29,7 @@ export const AvatarGroup = /*#__PURE__*/memo(function AvatarGroup({
|
|
|
27
29
|
const overlap = resolveAvatarGroupOverlap(size);
|
|
28
30
|
const visibleCount = resolveAvatarGroupVisibleCount(avatars.length, max);
|
|
29
31
|
const overflowCount = resolveAvatarGroupOverflowCount(avatars.length, visibleCount);
|
|
32
|
+
const overflowAccessibility = resolveAvatarGroupOverflowAccessibility(overflowCount);
|
|
30
33
|
const visibleAvatars = useMemo(() => avatars.slice(0, visibleCount), [avatars, visibleCount]);
|
|
31
34
|
const rootStyle = useMemo(() => [avatarGroupStructure(theme), style], [theme, style]);
|
|
32
35
|
const faces = useMemo(() => visibleAvatars.map((item, index) => /*#__PURE__*/_jsx(View, {
|
|
@@ -40,7 +43,7 @@ export const AvatarGroup = /*#__PURE__*/memo(function AvatarGroup({
|
|
|
40
43
|
source: item.source,
|
|
41
44
|
initials: item.initials,
|
|
42
45
|
identity: item.identity,
|
|
43
|
-
accessibilityLabel: item.accessibilityLabel,
|
|
46
|
+
accessibilityLabel: item.accessibilityLabel ?? resolveAvatarGroupFaceFallbackLabel(index),
|
|
44
47
|
testID: testID === undefined ? undefined : `${testID}-avatar-${index}`
|
|
45
48
|
})
|
|
46
49
|
}, `${item.source?.uri ?? item.initials ?? item.identity ?? "avatar"}-${index}`)), [visibleAvatars, theme, colors, overlap, size, testID]);
|
|
@@ -64,8 +67,9 @@ export const AvatarGroup = /*#__PURE__*/memo(function AvatarGroup({
|
|
|
64
67
|
style: rootStyle,
|
|
65
68
|
children: [faces, overflowCount > 0 ? /*#__PURE__*/_jsx(View, {
|
|
66
69
|
testID: testID === undefined ? undefined : `${testID}-overflow`,
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
accessible: overflowAccessibility.accessible,
|
|
71
|
+
accessibilityRole: overflowAccessibility.accessibilityRole,
|
|
72
|
+
accessibilityLabel: overflowAccessibility.accessibilityLabel,
|
|
69
73
|
style: overflowStyle,
|
|
70
74
|
children: /*#__PURE__*/_jsx(Text, {
|
|
71
75
|
style: overflowLabelStyle,
|
|
@@ -37,6 +37,29 @@ export function resolveAvatarGroupVisibleCount(total, max) {
|
|
|
37
37
|
export function resolveAvatarGroupOverflowCount(total, visible) {
|
|
38
38
|
return Math.max(0, total - visible);
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* WCAG 2.5.3: the accessible name must CONTAIN the visible "+N" text (same contract as
|
|
42
|
+
* `MoreItems`'s trigger), so a voice-control user saying what they read still lands on this pill.
|
|
43
|
+
* `"text"`, not `"button"` — the pill is informational chrome, not interactive (same as `Badge`).
|
|
44
|
+
*/
|
|
45
|
+
export function resolveAvatarGroupOverflowAccessibility(count) {
|
|
46
|
+
return {
|
|
47
|
+
accessible: true,
|
|
48
|
+
accessibilityRole: "text",
|
|
49
|
+
accessibilityLabel: `+${count} more`
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* A face's honest-but-generic name when its consumer never set `accessibilityLabel`. Unlike a
|
|
55
|
+
* standalone `Avatar` (usually sits beside a visible name, so undecorated is a fair default —
|
|
56
|
+
* see `resolveAvatarAccessibility`), a grouped face has no adjacent name: falling through to
|
|
57
|
+
* `Avatar`'s decorative default would leave a screen reader user unable to tell how many distinct
|
|
58
|
+
* people the stack represents.
|
|
59
|
+
*/
|
|
60
|
+
export function resolveAvatarGroupFaceFallbackLabel(index) {
|
|
61
|
+
return `Avatar ${index + 1}`;
|
|
62
|
+
}
|
|
40
63
|
export const avatarGroupStructure = createThemedVariants(_theme => ({
|
|
41
64
|
base: {
|
|
42
65
|
flexDirection: "row",
|
|
@@ -23,6 +23,22 @@ overflow pill when `avatars.length` exceeds `max`.
|
|
|
23
23
|
| `style` | `LayoutStyle` | — | Layout-only, outermost, last. |
|
|
24
24
|
| `testID` | `string` | — | Forwarded to the outermost `View`; faces get `${testID}-avatar-{i}`. |
|
|
25
25
|
|
|
26
|
+
## Accessibility
|
|
27
|
+
|
|
28
|
+
- **Overflow pill** carries `accessible` + `accessibilityRole="text"` + an accessibility label
|
|
29
|
+
(`"+N more"`, containing the visible `"+N"` per WCAG 2.5.3, same contract as `MoreItems`) instead
|
|
30
|
+
of being hidden from assistive tech — a screen reader user now hears how many faces are hidden.
|
|
31
|
+
- **Per-face labels** fall back to `resolveAvatarGroupFaceFallbackLabel` (`"Avatar {n}"`) when a
|
|
32
|
+
consumer doesn't set `AvatarGroupItem.accessibilityLabel` — a grouped face has no adjacent visible
|
|
33
|
+
name to lean on, unlike a standalone `Avatar`, so leaving it unlabeled would leave it silent.
|
|
34
|
+
|
|
35
|
+
## Borders (Wave 5 tonal restyle)
|
|
36
|
+
|
|
37
|
+
The `AVATAR_GROUP_RING_WIDTH` ring (`avatarGroupItemStructure`) is deliberately KEPT, unlike other
|
|
38
|
+
modules' container hairlines: it is drawn in `colors.ring` (`bg.canvas`, not a visible stroke
|
|
39
|
+
colour) purely to cut a gap between overlapping circular faces — a divider BETWEEN adjacent avatars,
|
|
40
|
+
not decorative container chrome. Removing it would let overlapping faces visually merge.
|
|
41
|
+
|
|
26
42
|
## Performance
|
|
27
43
|
|
|
28
44
|
Wrapped in `React.memo`. Visible slice is `useMemo`'d on `avatars` and `max`.
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import { memo } from "react";
|
|
10
10
|
import { Text, View } from "react-native";
|
|
11
11
|
import { Icon } from "../../core/icon/index.js";
|
|
12
|
+
import { AccentGradientFill } from "../../core/gradient/index.js";
|
|
12
13
|
import { useTheme } from "../../theme/hooks.js";
|
|
13
14
|
import { BADGE_SIZES, badgeStructure, resolveBadgeAccessibility, resolveBadgeTone } from "./Badge.variants.js";
|
|
14
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -28,6 +29,7 @@ export const Badge = /*#__PURE__*/memo(function Badge({
|
|
|
28
29
|
const a11y = resolveBadgeAccessibility({
|
|
29
30
|
label
|
|
30
31
|
});
|
|
32
|
+
const useGradient = tone === "accent";
|
|
31
33
|
return /*#__PURE__*/_jsxs(View, {
|
|
32
34
|
testID: testID,
|
|
33
35
|
accessible: a11y.accessible,
|
|
@@ -36,19 +38,23 @@ export const Badge = /*#__PURE__*/memo(function Badge({
|
|
|
36
38
|
style: [badgeStructure(theme, {
|
|
37
39
|
size
|
|
38
40
|
}), {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
borderColor: toneColors.border,
|
|
42
|
+
overflow: "hidden"
|
|
43
|
+
}, !useGradient && {
|
|
44
|
+
backgroundColor: toneColors.fill
|
|
41
45
|
}, style],
|
|
42
|
-
children: [
|
|
46
|
+
children: [useGradient && /*#__PURE__*/_jsx(AccentGradientFill, {
|
|
47
|
+
color: theme.colors.accent.solid
|
|
48
|
+
}), icon && /*#__PURE__*/_jsx(Icon, {
|
|
43
49
|
name: icon,
|
|
44
50
|
size: spec.iconSize,
|
|
45
|
-
color: toneColors.text,
|
|
51
|
+
color: useGradient ? theme.colors.accent.onSolid : toneColors.text,
|
|
46
52
|
strokeWidth: ICON_STROKE
|
|
47
53
|
}), /*#__PURE__*/_jsx(Text, {
|
|
48
54
|
numberOfLines: 1,
|
|
49
55
|
style: [theme.fontStyleForWeight(theme.fontWeights.semibold), {
|
|
50
56
|
fontSize: spec.fontSize,
|
|
51
|
-
color: toneColors.text
|
|
57
|
+
color: useGradient ? theme.colors.accent.onSolid : toneColors.text
|
|
52
58
|
}],
|
|
53
59
|
children: label
|
|
54
60
|
})]
|
|
@@ -112,7 +112,8 @@ export const badgeStructure = createThemedVariants(theme => ({
|
|
|
112
112
|
alignItems: "center",
|
|
113
113
|
justifyContent: "center",
|
|
114
114
|
columnGap: theme.space[1],
|
|
115
|
-
borderRadius: theme.radii.
|
|
115
|
+
borderRadius: theme.radii.md,
|
|
116
|
+
borderCurve: "continuous",
|
|
116
117
|
borderWidth: theme.borderWidths.thin
|
|
117
118
|
},
|
|
118
119
|
variants: {
|
|
@@ -18,7 +18,8 @@ or disabled state.
|
|
|
18
18
|
|
|
19
19
|
| Prop | Type | Default | Notes |
|
|
20
20
|
|------|------|---------|-------|
|
|
21
|
-
| `tone` | `accent \| neutral \| success \| warning \| danger \| info` | `accent` | Closed union — see below. |
|
|
21
|
+
| `tone` | `accent \| neutral \| success \| warning \| danger \| info \| custom` | `accent` | Closed union — see below. |
|
|
22
|
+
| `customColors` | `{ bg, fg }` | — | Required when `tone="custom"`. Server-driven hex escape hatch. |
|
|
22
23
|
| `size` | `sm \| md` | `md` | 20 / 24 dp. No touch-target floor — not interactive. |
|
|
23
24
|
| `label` | `string` | — | Always required; a Badge is never icon-only. |
|
|
24
25
|
| `icon` | `IconName` | — | A NAME, never a `ReactNode`. Optional, leading only. |
|
|
@@ -40,10 +41,9 @@ or disabled state.
|
|
|
40
41
|
## Why `tone` is a union, not a `color`
|
|
41
42
|
|
|
42
43
|
Same reasoning as Button/Input: every colour a Badge can show is a role lookup
|
|
43
|
-
(`resolveBadgeTone`), guaranteed legible in both modes, never an app-invented hex
|
|
44
|
-
`
|
|
45
|
-
|
|
46
|
-
`colors.status.<role>`.
|
|
44
|
+
(`resolveBadgeTone`), guaranteed legible in both modes, never an app-invented hex — except
|
|
45
|
+
`tone="custom"`, which requires `customColors={{ bg, fg }}` and maps fill/text/border from those
|
|
46
|
+
values (the same escape hatch `Chip` and `SelectOption` share for workflow-driven colours).
|
|
47
47
|
|
|
48
48
|
## A real gap this module found: `StatusColors.border` is not a badge border
|
|
49
49
|
|