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
|
@@ -8,7 +8,8 @@ Cross-cutting mechanism every module imports. No feature logic, no components.
|
|
|
8
8
|
| `icon/` | shared lucide icon registry (`IconName`, `Icon`; 56 glyphs) — hoisted out of `modules/button/` so every one of the 39 shipped modules reuses one registry instead of re-declaring its own | `icon/MODULE.md` |
|
|
9
9
|
| `a11y/` | shared accessibility hooks (`useReducedMotion`) — hoisted out of `modules/button/` for the same reason | `a11y/MODULE.md` |
|
|
10
10
|
| `device/` | the `low \| mid \| high` device tier every motion and list-window decision reads | `device/MODULE.md` |
|
|
11
|
-
| `motion/` | the single global animation gate (`useMotion`, `config.ts`,
|
|
11
|
+
| `motion/` | the single global animation gate (`useMotion`, `config.ts`, `usePressState`, presets) | `motion/MODULE.md` |
|
|
12
|
+
| `haptics/` | optional `expo-haptics` seam (`setHapticsModule`, `useHaptics`) | `haptics/MODULE.md` |
|
|
12
13
|
| `list/` | `VirtualList` / `VirtualSectionList` — the one windowed list every list-bearing module renders through (FlashList when the peer is installed, FlatList otherwise) | this file |
|
|
13
14
|
| `heading/` | `HeadingText`/`HeadingView` (typed `aria-level`) + `HEADING_LEVEL` — the fixed level every `accessibilityRole="header"` site needs so `react-native-web` doesn't render it as `<h1>` | `heading/MODULE.md` |
|
|
14
15
|
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { memo, useId } from 'react';
|
|
4
|
+
import { StyleSheet, View } from 'react-native';
|
|
5
|
+
import { accentGradientStops, shouldRenderGradient } from "./gradientStops.js";
|
|
6
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
let svgModule;
|
|
8
|
+
function loadSvg() {
|
|
9
|
+
if (svgModule !== undefined) return svgModule;
|
|
10
|
+
try {
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports -- optional peer fallback
|
|
12
|
+
svgModule = require('react-native-svg');
|
|
13
|
+
} catch {
|
|
14
|
+
svgModule = null;
|
|
15
|
+
}
|
|
16
|
+
return svgModule;
|
|
17
|
+
}
|
|
18
|
+
export const AccentGradientFill = /*#__PURE__*/memo(function AccentGradientFill({
|
|
19
|
+
color,
|
|
20
|
+
style
|
|
21
|
+
}) {
|
|
22
|
+
const stops = accentGradientStops(color);
|
|
23
|
+
const gradId = `accentGrad-${useId().replace(/:/g, '')}`;
|
|
24
|
+
if (!shouldRenderGradient(stops)) {
|
|
25
|
+
return /*#__PURE__*/_jsx(View, {
|
|
26
|
+
pointerEvents: "none",
|
|
27
|
+
style: [StyleSheet.absoluteFill, {
|
|
28
|
+
backgroundColor: color
|
|
29
|
+
}, style]
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
const svg = loadSvg();
|
|
33
|
+
if (!svg) {
|
|
34
|
+
return /*#__PURE__*/_jsx(View, {
|
|
35
|
+
pointerEvents: "none",
|
|
36
|
+
style: [StyleSheet.absoluteFill, {
|
|
37
|
+
backgroundColor: color
|
|
38
|
+
}, style]
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
const {
|
|
42
|
+
Svg,
|
|
43
|
+
Defs,
|
|
44
|
+
LinearGradient,
|
|
45
|
+
Stop,
|
|
46
|
+
Rect
|
|
47
|
+
} = svg;
|
|
48
|
+
return /*#__PURE__*/_jsx(View, {
|
|
49
|
+
pointerEvents: "none",
|
|
50
|
+
style: [StyleSheet.absoluteFill, style],
|
|
51
|
+
children: /*#__PURE__*/_jsxs(Svg, {
|
|
52
|
+
width: "100%",
|
|
53
|
+
height: "100%",
|
|
54
|
+
style: StyleSheet.absoluteFill,
|
|
55
|
+
children: [/*#__PURE__*/_jsx(Defs, {
|
|
56
|
+
children: /*#__PURE__*/_jsxs(LinearGradient, {
|
|
57
|
+
id: gradId,
|
|
58
|
+
x1: "0",
|
|
59
|
+
y1: "0",
|
|
60
|
+
x2: "0",
|
|
61
|
+
y2: "1",
|
|
62
|
+
children: [/*#__PURE__*/_jsx(Stop, {
|
|
63
|
+
offset: "0",
|
|
64
|
+
stopColor: stops.top
|
|
65
|
+
}), /*#__PURE__*/_jsx(Stop, {
|
|
66
|
+
offset: "1",
|
|
67
|
+
stopColor: stops.bottom
|
|
68
|
+
})]
|
|
69
|
+
})
|
|
70
|
+
}), /*#__PURE__*/_jsx(Rect, {
|
|
71
|
+
x: "0",
|
|
72
|
+
y: "0",
|
|
73
|
+
width: "100%",
|
|
74
|
+
height: "100%",
|
|
75
|
+
fill: `url(#${gradId})`
|
|
76
|
+
})]
|
|
77
|
+
})
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
//# sourceMappingURL=AccentGradientFill.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export function darkenHex(hex, amount) {
|
|
4
|
+
const normalized = hex.replace('#', '');
|
|
5
|
+
const full = normalized.length === 3 ? normalized.split('').map(c => c + c).join('') : normalized;
|
|
6
|
+
const r = parseInt(full.slice(0, 2), 16);
|
|
7
|
+
const g = parseInt(full.slice(2, 4), 16);
|
|
8
|
+
const b = parseInt(full.slice(4, 6), 16);
|
|
9
|
+
const factor = 1 - amount;
|
|
10
|
+
const toHex = n => Math.round(Math.max(0, Math.min(255, n * factor))).toString(16).padStart(2, '0');
|
|
11
|
+
return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=darkenHex.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { hexToHsl, withLightness } from "../../theme/tokens/builders/color.js";
|
|
4
|
+
import { darkenHex } from "./darkenHex.js";
|
|
5
|
+
export function accentGradientStops(color) {
|
|
6
|
+
const {
|
|
7
|
+
l: lightness
|
|
8
|
+
} = hexToHsl(color);
|
|
9
|
+
if (lightness > 30) {
|
|
10
|
+
return {
|
|
11
|
+
top: color,
|
|
12
|
+
bottom: withLightness(color, lightness - 10)
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
top: withLightness(color, lightness + 7),
|
|
17
|
+
bottom: color
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export function gradientStopDelta(stops) {
|
|
21
|
+
return Math.abs(hexToHsl(stops.top).l - hexToHsl(stops.bottom).l);
|
|
22
|
+
}
|
|
23
|
+
export function shouldRenderGradient(stops) {
|
|
24
|
+
return gradientStopDelta(stops) >= 3;
|
|
25
|
+
}
|
|
26
|
+
export { darkenHex };
|
|
27
|
+
//# sourceMappingURL=gradientStops.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export { AccentGradientFill } from "./AccentGradientFill.js";
|
|
4
|
+
export { accentGradientStops, gradientStopDelta, shouldRenderGradient } from "./gradientStops.js";
|
|
5
|
+
export { darkenHex } from "./darkenHex.js";
|
|
6
|
+
export { withAlpha } from "./withAlpha.js";
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function expandHex(hex) {
|
|
4
|
+
const normalized = hex.replace('#', '');
|
|
5
|
+
if (normalized.length === 3) {
|
|
6
|
+
return normalized.split('').map(c => c + c).join('');
|
|
7
|
+
}
|
|
8
|
+
if (normalized.length === 8) return normalized.slice(0, 6);
|
|
9
|
+
return normalized;
|
|
10
|
+
}
|
|
11
|
+
export function withAlpha(hex, alpha) {
|
|
12
|
+
const full = expandHex(hex);
|
|
13
|
+
const r = parseInt(full.slice(0, 2), 16);
|
|
14
|
+
const g = parseInt(full.slice(2, 4), 16);
|
|
15
|
+
const b = parseInt(full.slice(4, 6), 16);
|
|
16
|
+
const a = Math.max(0, Math.min(1, alpha));
|
|
17
|
+
return `rgba(${r}, ${g}, ${b}, ${a})`;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=withAlpha.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/** Optional peer — injected at app startup, never imported at module scope. */
|
|
4
|
+
|
|
5
|
+
let hapticsModule = null;
|
|
6
|
+
|
|
7
|
+
/** Injects expo-haptics at runtime — never imports the package at module scope. */
|
|
8
|
+
export function setHapticsModule(module) {
|
|
9
|
+
hapticsModule = module;
|
|
10
|
+
}
|
|
11
|
+
export function hasHapticsModule() {
|
|
12
|
+
return hapticsModule !== null;
|
|
13
|
+
}
|
|
14
|
+
export function getHapticsModule() {
|
|
15
|
+
return hapticsModule;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=haptics.js.map
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useContext, useMemo } from 'react';
|
|
4
|
+
import { Platform } from 'react-native';
|
|
5
|
+
import { HapticsContext } from "./context.js";
|
|
6
|
+
import { getHapticsModule } from "./haptics.js";
|
|
7
|
+
const IMPACT_STYLE = {
|
|
8
|
+
light: 'Light',
|
|
9
|
+
medium: 'Medium',
|
|
10
|
+
heavy: 'Heavy',
|
|
11
|
+
soft: 'Soft',
|
|
12
|
+
rigid: 'Rigid'
|
|
13
|
+
};
|
|
14
|
+
const NOTIFICATION_TYPE = {
|
|
15
|
+
success: 'Success',
|
|
16
|
+
warning: 'Warning',
|
|
17
|
+
error: 'Error'
|
|
18
|
+
};
|
|
19
|
+
function runSafe(task) {
|
|
20
|
+
try {
|
|
21
|
+
void task().catch(() => {});
|
|
22
|
+
} catch {
|
|
23
|
+
// Unconfigured or unsupported — silent no-op.
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const NOOP_HAPTICS = {
|
|
27
|
+
selection: () => undefined,
|
|
28
|
+
impact: () => undefined,
|
|
29
|
+
notification: () => undefined
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Fires haptic feedback when a module is registered and the provider has not disabled it.
|
|
34
|
+
* No-ops on web, when unset, or when `haptics={false}`.
|
|
35
|
+
*/
|
|
36
|
+
export function useHaptics() {
|
|
37
|
+
const enabled = useContext(HapticsContext);
|
|
38
|
+
const module = getHapticsModule();
|
|
39
|
+
const selection = useCallback(() => {
|
|
40
|
+
if (!enabled || Platform.OS === 'web' || module === null) return;
|
|
41
|
+
if (Platform.OS === 'android') {
|
|
42
|
+
runSafe(() => module.performAndroidHapticsAsync(module.AndroidHaptics.Context_Click));
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
runSafe(() => module.selectionAsync());
|
|
46
|
+
}, [enabled, module]);
|
|
47
|
+
const impact = useCallback((style = 'light') => {
|
|
48
|
+
if (!enabled || Platform.OS === 'web' || module === null) return;
|
|
49
|
+
if (Platform.OS === 'android') {
|
|
50
|
+
// Bluesky downgrade — Android simulated impacts feel too strong; use the lightest constant.
|
|
51
|
+
runSafe(() => module.performAndroidHapticsAsync(module.AndroidHaptics.Virtual_Key));
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const key = IMPACT_STYLE[style];
|
|
55
|
+
runSafe(() => module.impactAsync(module.ImpactFeedbackStyle[key]));
|
|
56
|
+
}, [enabled, module]);
|
|
57
|
+
const notification = useCallback(type => {
|
|
58
|
+
if (!enabled || Platform.OS === 'web' || module === null) return;
|
|
59
|
+
if (Platform.OS === 'android') {
|
|
60
|
+
const androidType = type === 'success' ? module.AndroidHaptics.Confirm : type === 'error' ? module.AndroidHaptics.Reject : module.AndroidHaptics.Context_Click;
|
|
61
|
+
runSafe(() => module.performAndroidHapticsAsync(androidType));
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const key = NOTIFICATION_TYPE[type];
|
|
65
|
+
runSafe(() => module.notificationAsync(module.NotificationFeedbackType[key]));
|
|
66
|
+
}, [enabled, module]);
|
|
67
|
+
return useMemo(() => enabled && module !== null && Platform.OS !== 'web' ? {
|
|
68
|
+
selection,
|
|
69
|
+
impact,
|
|
70
|
+
notification
|
|
71
|
+
} : NOOP_HAPTICS, [enabled, module, selection, impact, notification]);
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=useHaptics.js.map
|
|
@@ -8,7 +8,11 @@ every one of the 39 shipped modules imports one registry instead of each re-copy
|
|
|
8
8
|
|
|
9
9
|
| File | Role |
|
|
10
10
|
|------|------|
|
|
11
|
-
| `index.tsx` |
|
|
11
|
+
| `index.tsx` | Barrel re-exporting `Icon`, `IconName`, `resolveIcon`. |
|
|
12
|
+
| `Icon.tsx` | The `Icon` component (resolves `name` via `resolveIcon`, applies the a11y contract below). |
|
|
13
|
+
| `names.ts` | The `IconName` union — one string literal per glyph. |
|
|
14
|
+
| `resolve.ts` | `resolveIcon(name)` — a `switch` over `IconName`, one `case` per glyph, each `require`-ing its own file under `icons/`. |
|
|
15
|
+
| `icons/<kebab-name>.tsx` | One file per glyph, each deep-importing its own `lucide-react-native/icons/<kebab-name>`. |
|
|
12
16
|
|
|
13
17
|
## Accessibility contract (WCAG 1.3.1 / 1.1.1)
|
|
14
18
|
|
|
@@ -39,9 +43,10 @@ Pass `label` (optional) for the rare icon that carries information no neighbouri
|
|
|
39
43
|
- Icons are DEEP-IMPORTED from `lucide-react-native/icons/<kebab-name>`, never the barrel
|
|
40
44
|
`lucide-react-native` — the barrel is ~233 KB and defeats per-icon tree-shaking; a deep import is
|
|
41
45
|
~656 B.
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
|
|
46
|
+
- Each glyph's deep import lives in its own `icons/<kebab-name>.tsx` file, kept statically
|
|
47
|
+
analysable per-glyph rather than one shared object literal.
|
|
48
|
+
- Adding a glyph: add `icons/<kebab-name>.tsx` (deep import, mirrors any existing file), one
|
|
49
|
+
`IconName` union member in `names.ts`, one `case` in `resolve.ts`. Never add a per-module icon map.
|
|
45
50
|
|
|
46
51
|
## Dependencies
|
|
47
52
|
|
|
@@ -52,11 +57,13 @@ devDependencies here for local build/typecheck/test only.
|
|
|
52
57
|
## Known gaps
|
|
53
58
|
|
|
54
59
|
- Catalogue started as a starter set (the icons Button needed) and has grown one batch at a time —
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
74 glyphs as of the 2026-08 addition of `trending-up` (the example app's dashboard demo referenced
|
|
61
|
+
it before it existed — `resolveIcon` throws on an unresolved `IconName` case, which is how this
|
|
62
|
+
surfaced), on top of the 2026-07 `rich-text-editor` toolbar set (`bold`, `italic`, `underline`,
|
|
63
|
+
`strikethrough`, `code`, `square-code`, `heading-1/2/3`, `quote`, `list-ordered`, `list-checks`,
|
|
64
|
+
`at-sign`) and the earlier navigation + ticket-detail names for the tickets-native consumer
|
|
65
|
+
(`layout-dashboard`, `kanban`, `calendar`, `tag`, `flag`, …). Add names as later components need
|
|
66
|
+
them — see `names.ts` for the full current list.
|
|
60
67
|
- `filter` deep-imports from lucide's `funnel` module: lucide renamed the `filter` icon to `funnel`
|
|
61
68
|
and only left a `.d.ts` type alias at the old path (no runtime file there) — confirmed by
|
|
62
69
|
resolving `lucide-react-native/icons/funnel` before adding this entry, the same trap
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import TrendingUp from "lucide-react-native/icons/trending-up";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
export function IconTrendingUp(props) {
|
|
6
|
+
return /*#__PURE__*/_jsx(TrendingUp, {
|
|
7
|
+
...props
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=trending-up.js.map
|
|
@@ -136,6 +136,8 @@ export function resolveIcon(name) {
|
|
|
136
136
|
return require("./icons/tag").IconTag;
|
|
137
137
|
case "trash":
|
|
138
138
|
return require("./icons/trash").IconTrash;
|
|
139
|
+
case "trending-up":
|
|
140
|
+
return require("./icons/trending-up").IconTrendingUp;
|
|
139
141
|
case "triangle-alert":
|
|
140
142
|
return require("./icons/triangle-alert").IconTriangleAlert;
|
|
141
143
|
case "underline":
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* expo-image's real `Image` component does NOT extend RN's `ImageProps` (its `source`, `style` and
|
|
5
|
+
* `tintColor` shapes all diverge) — this is a minimal structural subset covering only what
|
|
6
|
+
* `MediaImage.tsx` actually passes, not a copy of RN's own image props.
|
|
7
|
+
*/
|
|
8
|
+
|
|
3
9
|
let imageComponent = null;
|
|
4
10
|
|
|
5
11
|
/** Injects expo-image at runtime — never imports the package at module scope. */
|
|
@@ -41,15 +41,13 @@ Allocate the value itself with **`useAnimatedValue(initial)`**, never
|
|
|
41
41
|
hands `useRef` one it immediately discards. `initial` is read on the first render only, exactly like
|
|
42
42
|
`useRef`, so the two are interchangeable.
|
|
43
43
|
|
|
44
|
-
Three ready-made patterns cover most needs:
|
|
45
|
-
|
|
46
|
-
- **`
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
at all (5000 rows used to build 10,000 that never moved). `style.opacity` and `style.transform[0]
|
|
52
|
-
.scale` are therefore `Animated.Value | number`.
|
|
44
|
+
- Three ready-made patterns cover most needs:
|
|
45
|
+
|
|
46
|
+
- **`usePressState(disabled?)`** — asymmetric press choreography (tween-in scale, spring-out scale
|
|
47
|
+
+ state-layer overlay), width-aware via `onLayout` + `pressScaleFor`. Preferred for pressable
|
|
48
|
+
modules.
|
|
49
|
+
- **`usePressMotion(disabled?)`** — legacy scale + opacity dip on press (Animated API). Spread
|
|
50
|
+
`onPressIn`/`onPressOut` onto the `Pressable` and `style` onto an `Animated.View`.
|
|
53
51
|
- **`useEnterExit(visible, offsetY?)`** — fade + slide a subtree in, and unmount it once the exit
|
|
54
52
|
settles. Returns `{ mounted, style }`.
|
|
55
53
|
- **`useReveal(visible, offsetY?)`** — the same fade + slide for a subtree whose mounting the caller
|
|
@@ -63,9 +61,11 @@ null`, or an RN `<Modal>`); use `useEnterExit` only when you actually render its
|
|
|
63
61
|
|
|
64
62
|
## The rules any new motion must follow
|
|
65
63
|
|
|
66
|
-
1. **Animate only `opacity
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
1. **Animate paint-only properties — never layout.** `opacity`, `transform`, and (via Reanimated
|
|
65
|
+
effects springs) `backgroundColor`, `borderColor`, `color`, `shadowColor` are allowed. Never
|
|
66
|
+
`width`, `height`, `margin`, `padding`, `top`/`left`, or `flex` — those force a layout pass
|
|
67
|
+
every frame. Spatial motion uses spatial springs; colour/opacity uses effects springs (critically
|
|
68
|
+
damped, no bounce).
|
|
69
69
|
2. **Always `useNativeDriver: true`.** One documented exception exists library-wide: `Drawer`'s
|
|
70
70
|
keyboard-avoidance `paddingBottom` (see `Drawer.tsx:115,122`, and its eslint override).
|
|
71
71
|
3. **Never gate an unmount on the animation reporting `finished`.** An interrupted animation then
|
|
@@ -35,7 +35,9 @@ export const MOTION_EASING_CURVE = {
|
|
|
35
35
|
decelerate: [0, 0, 0, 1],
|
|
36
36
|
/** Leaving the screen — soft start, quick exit. */
|
|
37
37
|
accelerate: [0.3, 0, 1, 1],
|
|
38
|
-
emphasized: [0.
|
|
38
|
+
emphasized: [0.05, 0.7, 0.1, 1],
|
|
39
|
+
emphasizedDecelerate: [0.05, 0.7, 0.1, 1],
|
|
40
|
+
emphasizedAccelerate: [0.3, 0, 0.8, 0.15]
|
|
39
41
|
};
|
|
40
42
|
let easingCache = {};
|
|
41
43
|
|
|
@@ -72,6 +74,7 @@ export const MOTION_SPRING = {
|
|
|
72
74
|
};
|
|
73
75
|
|
|
74
76
|
/** Shared magnitudes so every component's motion reads as one system. */
|
|
77
|
+
export const pressScaleFor = width => 1 - 4 / Math.max(width, 24);
|
|
75
78
|
export const MOTION_TRANSFORM = {
|
|
76
79
|
/** Press scale for buttons, cards, list rows. */
|
|
77
80
|
pressScale: 0.97,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
export { MOTION_DURATION, MOTION_EASING_CURVE, MOTION_ENABLED, MOTION_SCALE, MOTION_SPRING, MOTION_TIER, MOTION_TRANSFORM, motionEasing, resetMotionEasingCache, resolveDuration } from "./config.js";
|
|
3
|
+
export { MOTION_DURATION, MOTION_EASING_CURVE, MOTION_ENABLED, MOTION_SCALE, MOTION_SPRING, MOTION_TIER, MOTION_TRANSFORM, motionEasing, pressScaleFor, resetMotionEasingCache, resolveDuration } from "./config.js";
|
|
4
4
|
export { useAnimatedValue } from "./useAnimatedValue.js";
|
|
5
5
|
export { useMotion } from "./useMotion.js";
|
|
6
|
+
export { usePressState, useFocusRing } from "./usePressState.js";
|
|
6
7
|
export { useEnterExit, usePressMotion, useReveal } from "./presets.js";
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
4
|
+
import { Easing } from 'react-native';
|
|
5
|
+
import { ReduceMotion, useAnimatedStyle, useSharedValue, withSpring, withTiming } from 'react-native-reanimated';
|
|
6
|
+
import { springs } from "../../theme/platform/motion.native.js";
|
|
7
|
+
import { STATE_LAYER_OPACITY } from "../../theme/platform/stateLayer.native.js";
|
|
8
|
+
import { pressScaleFor, MOTION_TRANSFORM } from "./config.js";
|
|
9
|
+
import { useMotion } from "./useMotion.js";
|
|
10
|
+
const DEFAULT_WIDTH = 100;
|
|
11
|
+
const PRESS_IN_MS = 100;
|
|
12
|
+
export function usePressState(disabled = false) {
|
|
13
|
+
const motion = useMotion();
|
|
14
|
+
const [pressed, setPressed] = useState(false);
|
|
15
|
+
const [layoutWidth, setLayoutWidth] = useState(DEFAULT_WIDTH);
|
|
16
|
+
const measuredWidth = useSharedValue(DEFAULT_WIDTH);
|
|
17
|
+
const scale = useSharedValue(1);
|
|
18
|
+
const opacity = useSharedValue(1);
|
|
19
|
+
const overlayOpacity = useSharedValue(0);
|
|
20
|
+
const focusOpacity = useSharedValue(0);
|
|
21
|
+
const onLayout = useCallback(event => {
|
|
22
|
+
const width = event.nativeEvent.layout.width;
|
|
23
|
+
if (width > 0) {
|
|
24
|
+
measuredWidth.value = width;
|
|
25
|
+
setLayoutWidth(width);
|
|
26
|
+
}
|
|
27
|
+
}, [measuredWidth]);
|
|
28
|
+
const snapPressIn = useCallback(() => {
|
|
29
|
+
const targetScale = pressScaleFor(measuredWidth.value);
|
|
30
|
+
scale.value = targetScale;
|
|
31
|
+
opacity.value = MOTION_TRANSFORM.pressOpacity;
|
|
32
|
+
overlayOpacity.value = STATE_LAYER_OPACITY.pressed;
|
|
33
|
+
}, [measuredWidth, opacity, overlayOpacity, scale]);
|
|
34
|
+
const snapPressOut = useCallback(() => {
|
|
35
|
+
scale.value = 1;
|
|
36
|
+
opacity.value = 1;
|
|
37
|
+
overlayOpacity.value = 0;
|
|
38
|
+
}, [opacity, overlayOpacity, scale]);
|
|
39
|
+
const onPressIn = useCallback(() => {
|
|
40
|
+
if (disabled) return;
|
|
41
|
+
setPressed(true);
|
|
42
|
+
if (!motion.enabled) {
|
|
43
|
+
snapPressIn();
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const targetScale = pressScaleFor(measuredWidth.value);
|
|
47
|
+
scale.value = withTiming(targetScale, {
|
|
48
|
+
duration: PRESS_IN_MS,
|
|
49
|
+
easing: Easing.out(Easing.quad),
|
|
50
|
+
reduceMotion: ReduceMotion.System
|
|
51
|
+
});
|
|
52
|
+
opacity.value = withTiming(MOTION_TRANSFORM.pressOpacity, {
|
|
53
|
+
duration: PRESS_IN_MS,
|
|
54
|
+
easing: Easing.out(Easing.quad),
|
|
55
|
+
reduceMotion: ReduceMotion.System
|
|
56
|
+
});
|
|
57
|
+
overlayOpacity.value = withSpring(STATE_LAYER_OPACITY.pressed, {
|
|
58
|
+
...springs.effectsFast,
|
|
59
|
+
reduceMotion: ReduceMotion.System
|
|
60
|
+
});
|
|
61
|
+
}, [disabled, motion.enabled, measuredWidth, opacity, overlayOpacity, scale, snapPressIn]);
|
|
62
|
+
const onPressOut = useCallback(() => {
|
|
63
|
+
if (disabled) return;
|
|
64
|
+
setPressed(false);
|
|
65
|
+
if (!motion.enabled) {
|
|
66
|
+
snapPressOut();
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
scale.value = withSpring(1, {
|
|
70
|
+
...springs.spatialFast,
|
|
71
|
+
reduceMotion: ReduceMotion.System
|
|
72
|
+
});
|
|
73
|
+
opacity.value = withSpring(1, {
|
|
74
|
+
...springs.spatialFast,
|
|
75
|
+
reduceMotion: ReduceMotion.System
|
|
76
|
+
});
|
|
77
|
+
overlayOpacity.value = withSpring(0, {
|
|
78
|
+
...springs.effectsFast,
|
|
79
|
+
reduceMotion: ReduceMotion.System
|
|
80
|
+
});
|
|
81
|
+
}, [disabled, motion.enabled, opacity, overlayOpacity, scale, snapPressOut]);
|
|
82
|
+
const reanimatedPressStyle = useAnimatedStyle(() => ({
|
|
83
|
+
transform: [{
|
|
84
|
+
scale: scale.value
|
|
85
|
+
}],
|
|
86
|
+
opacity: opacity.value
|
|
87
|
+
}));
|
|
88
|
+
const reanimatedOverlayStyle = useAnimatedStyle(() => ({
|
|
89
|
+
opacity: overlayOpacity.value
|
|
90
|
+
}));
|
|
91
|
+
const staticPressStyle = useMemo(() => ({
|
|
92
|
+
transform: [{
|
|
93
|
+
scale: pressed ? pressScaleFor(layoutWidth) : 1
|
|
94
|
+
}],
|
|
95
|
+
opacity: pressed ? MOTION_TRANSFORM.pressOpacity : 1
|
|
96
|
+
}), [layoutWidth, pressed]);
|
|
97
|
+
const staticOverlayStyle = useMemo(() => ({
|
|
98
|
+
opacity: pressed ? STATE_LAYER_OPACITY.pressed : 0
|
|
99
|
+
}), [pressed]);
|
|
100
|
+
const animatedStyle = motion.enabled ? reanimatedPressStyle : staticPressStyle;
|
|
101
|
+
const overlayStyle = motion.enabled ? reanimatedOverlayStyle : staticOverlayStyle;
|
|
102
|
+
const focusRingStyle = useAnimatedStyle(() => ({
|
|
103
|
+
opacity: focusOpacity.value
|
|
104
|
+
}));
|
|
105
|
+
const handlers = useMemo(() => ({
|
|
106
|
+
onPressIn,
|
|
107
|
+
onPressOut,
|
|
108
|
+
onLayout
|
|
109
|
+
}), [onPressIn, onPressOut, onLayout]);
|
|
110
|
+
return {
|
|
111
|
+
pressed,
|
|
112
|
+
animatedStyle,
|
|
113
|
+
overlayStyle,
|
|
114
|
+
focusRingStyle,
|
|
115
|
+
handlers,
|
|
116
|
+
onLayout
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
export function useFocusRing(focused, disabled = false) {
|
|
120
|
+
const motion = useMotion();
|
|
121
|
+
const focusOpacity = useSharedValue(0);
|
|
122
|
+
const animateFocus = useCallback(isFocused => {
|
|
123
|
+
if (disabled) return;
|
|
124
|
+
const target = isFocused ? STATE_LAYER_OPACITY.focus : 0;
|
|
125
|
+
if (!motion.enabled || target === 0) {
|
|
126
|
+
focusOpacity.value = target;
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
focusOpacity.value = withSpring(target, {
|
|
130
|
+
...springs.effectsFast,
|
|
131
|
+
reduceMotion: ReduceMotion.System
|
|
132
|
+
});
|
|
133
|
+
}, [disabled, focusOpacity, motion.enabled]);
|
|
134
|
+
useEffect(() => {
|
|
135
|
+
animateFocus(focused);
|
|
136
|
+
}, [focused, animateFocus]);
|
|
137
|
+
const focusRingStyle = useAnimatedStyle(() => ({
|
|
138
|
+
opacity: focusOpacity.value
|
|
139
|
+
}));
|
|
140
|
+
return {
|
|
141
|
+
focusRingStyle,
|
|
142
|
+
animateFocus
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=usePressState.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
export { concentric } from "./radius.js";
|
|
3
4
|
export { sx } from "./sx.js";
|
|
4
5
|
export { useThemedStyles } from "./useThemedStyles.js";
|
|
5
6
|
export { createVariants, createTextVariants, createThemedVariants, createThemedTextVariants, variantFactory, themedVariantFactory } from "./variants.js";
|
package/lib/module/index.js
CHANGED
|
@@ -68,6 +68,7 @@ export { StageProgress } from "./modules/stage-progress/index.js";
|
|
|
68
68
|
export { StatTile } from "./modules/stat-tile/index.js";
|
|
69
69
|
export { LoadingState, ErrorState } from "./modules/state-block/index.js";
|
|
70
70
|
export { Stepper } from "./modules/stepper/index.js";
|
|
71
|
+
export { Box, Surface } from "./modules/surface/index.js";
|
|
71
72
|
export { SwipeableRow } from "./modules/swipeable-row/index.js";
|
|
72
73
|
export { Switch } from "./modules/switch/index.js";
|
|
73
74
|
export { Tabs } from "./modules/tabs/index.js";
|