@thewhileloop/whileui 1.2.3 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +246 -83
- package/dist/blocks/chat/chat.d.ts +3 -4
- package/dist/blocks/chat/chat.js +29 -17
- package/dist/blocks/chat/index.d.ts +0 -1
- package/dist/blocks/chat/index.js +0 -1
- package/dist/blocks/commerce/checkout-summary.d.ts +1 -2
- package/dist/blocks/commerce/checkout-summary.js +16 -4
- package/dist/blocks/commerce/feature-gate.d.ts +1 -2
- package/dist/blocks/commerce/feature-gate.js +14 -4
- package/dist/blocks/commerce/index.d.ts +0 -1
- package/dist/blocks/commerce/index.js +0 -1
- package/dist/blocks/commerce/metric-card.d.ts +3 -4
- package/dist/blocks/commerce/metric-card.js +7 -3
- package/dist/blocks/commerce/plan-toggle.d.ts +1 -2
- package/dist/blocks/commerce/plan-toggle.js +11 -9
- package/dist/blocks/commerce/pricing-card.d.ts +1 -2
- package/dist/blocks/commerce/pricing-card.js +23 -6
- package/dist/blocks/commerce/product-card.d.ts +1 -2
- package/dist/blocks/commerce/product-card.js +23 -9
- package/dist/blocks/commerce/subscription-card.d.ts +1 -2
- package/dist/blocks/commerce/subscription-card.js +6 -3
- package/dist/blocks/commerce/upgrade-banner.d.ts +1 -2
- package/dist/blocks/commerce/upgrade-banner.js +13 -3
- package/dist/blocks/commerce/usage-bar.d.ts +1 -2
- package/dist/blocks/commerce/usage-bar.js +4 -2
- package/dist/blocks/datepicker/date-range-picker-modal.d.ts +2 -3
- package/dist/blocks/datepicker/date-range-picker-modal.js +33 -7
- package/dist/blocks/datepicker/datepicker-inline.d.ts +1 -2
- package/dist/blocks/datepicker/datepicker-inline.js +9 -3
- package/dist/blocks/datepicker/datepicker-modal.d.ts +2 -3
- package/dist/blocks/datepicker/datepicker-modal.js +49 -17
- package/dist/blocks/datepicker/index.d.ts +0 -1
- package/dist/blocks/datepicker/index.js +0 -1
- package/dist/blocks/datepicker/use-calendar-theme.d.ts +0 -1
- package/dist/blocks/datepicker/use-calendar-theme.js +0 -1
- package/dist/blocks/layout/action-bar.d.ts +1 -2
- package/dist/blocks/layout/action-bar.js +0 -1
- package/dist/blocks/layout/app-shell.d.ts +1 -2
- package/dist/blocks/layout/app-shell.js +11 -5
- package/dist/blocks/layout/confirm-action-sheet.d.ts +1 -2
- package/dist/blocks/layout/confirm-action-sheet.js +18 -6
- package/dist/blocks/layout/content-skeleton.d.ts +1 -2
- package/dist/blocks/layout/content-skeleton.js +22 -9
- package/dist/blocks/layout/docked-input.d.ts +11 -0
- package/dist/blocks/layout/docked-input.js +27 -0
- package/dist/blocks/layout/empty-state.d.ts +1 -2
- package/dist/blocks/layout/empty-state.js +10 -5
- package/dist/blocks/layout/error-boundary.d.ts +1 -2
- package/dist/blocks/layout/error-boundary.js +0 -2
- package/dist/blocks/layout/error-state.d.ts +1 -2
- package/dist/blocks/layout/error-state.js +0 -2
- package/dist/blocks/layout/form-modal-screen.d.ts +1 -2
- package/dist/blocks/layout/form-modal-screen.js +24 -21
- package/dist/blocks/layout/index.d.ts +2 -2
- package/dist/blocks/layout/index.js +2 -2
- package/dist/blocks/layout/keyboard-aware-screen.d.ts +14 -0
- package/dist/blocks/layout/keyboard-aware-screen.js +12 -0
- package/dist/blocks/layout/loading-screen.d.ts +1 -2
- package/dist/blocks/layout/loading-screen.js +6 -8
- package/dist/blocks/layout/page-skeleton.d.ts +1 -2
- package/dist/blocks/layout/page-skeleton.js +38 -20
- package/dist/blocks/layout/pull-to-refresh-scroll-view.d.ts +8 -4
- package/dist/blocks/layout/pull-to-refresh-scroll-view.js +17 -4
- package/dist/blocks/layout/screen-skeleton.d.ts +1 -2
- package/dist/blocks/layout/screen-skeleton.js +0 -1
- package/dist/blocks/layout/sheet.d.ts +9 -9
- package/dist/blocks/layout/sheet.js +51 -21
- package/dist/blocks/layout/smart-input.d.ts +6 -1
- package/dist/blocks/layout/smart-input.js +121 -9
- package/dist/blocks/lists/index.d.ts +0 -2
- package/dist/blocks/lists/index.js +0 -2
- package/dist/blocks/lists/list-item.d.ts +1 -2
- package/dist/blocks/lists/list-item.js +20 -6
- package/dist/blocks/lists/notification-item.d.ts +1 -2
- package/dist/blocks/lists/notification-item.js +19 -6
- package/dist/blocks/lists/timeline-feed.d.ts +1 -2
- package/dist/blocks/lists/timeline-feed.js +4 -2
- package/dist/blocks/media/index.d.ts +0 -1
- package/dist/blocks/media/index.js +0 -1
- package/dist/blocks/media/smart-image.d.ts +0 -1
- package/dist/blocks/media/smart-image.js +24 -8
- package/dist/blocks/navigation/bottom-nav.d.ts +1 -2
- package/dist/blocks/navigation/bottom-nav.js +7 -4
- package/dist/blocks/navigation/drawer-menu.d.ts +1 -2
- package/dist/blocks/navigation/drawer-menu.js +52 -15
- package/dist/blocks/navigation/floating-bottom-nav.d.ts +1 -2
- package/dist/blocks/navigation/floating-bottom-nav.js +14 -5
- package/dist/blocks/navigation/header.d.ts +2 -3
- package/dist/blocks/navigation/header.js +13 -5
- package/dist/blocks/navigation/index.d.ts +0 -2
- package/dist/blocks/navigation/index.js +0 -2
- package/dist/blocks/navigation/tab-bar.d.ts +1 -2
- package/dist/blocks/navigation/tab-bar.js +22 -10
- package/dist/blocks/splash/index.d.ts +0 -1
- package/dist/blocks/splash/index.js +0 -1
- package/dist/blocks/splash/splash-screen.d.ts +3 -4
- package/dist/blocks/splash/splash-screen.js +15 -11
- package/dist/components/accordion/accordion.d.ts +4 -5
- package/dist/components/accordion/accordion.js +6 -7
- package/dist/components/accordion/index.d.ts +0 -1
- package/dist/components/accordion/index.js +0 -1
- package/dist/components/alert/alert.d.ts +2 -3
- package/dist/components/alert/alert.js +19 -8
- package/dist/components/alert/index.d.ts +0 -1
- package/dist/components/alert/index.js +0 -1
- package/dist/components/alert-dialog/alert-dialog.d.ts +9 -10
- package/dist/components/alert-dialog/alert-dialog.js +175 -51
- package/dist/components/alert-dialog/index.d.ts +0 -1
- package/dist/components/alert-dialog/index.js +0 -1
- package/dist/components/aspect-ratio/aspect-ratio.d.ts +1 -2
- package/dist/components/aspect-ratio/aspect-ratio.js +0 -3
- package/dist/components/aspect-ratio/index.d.ts +0 -1
- package/dist/components/aspect-ratio/index.js +0 -1
- package/dist/components/avatar/avatar.d.ts +2 -3
- package/dist/components/avatar/avatar.js +7 -8
- package/dist/components/avatar/index.d.ts +0 -1
- package/dist/components/avatar/index.js +0 -1
- package/dist/components/badge/badge.d.ts +6 -7
- package/dist/components/badge/badge.js +21 -9
- package/dist/components/badge/index.d.ts +0 -1
- package/dist/components/badge/index.js +0 -1
- package/dist/components/button/button.d.ts +11 -10
- package/dist/components/button/button.js +62 -33
- package/dist/components/button/index.d.ts +0 -1
- package/dist/components/button/index.js +0 -1
- package/dist/components/card/card.d.ts +5 -3
- package/dist/components/card/card.js +28 -14
- package/dist/components/card/index.d.ts +0 -1
- package/dist/components/card/index.js +0 -1
- package/dist/components/checkbox/checkbox.d.ts +1 -2
- package/dist/components/checkbox/checkbox.js +15 -2
- package/dist/components/checkbox/index.d.ts +0 -1
- package/dist/components/checkbox/index.js +0 -1
- package/dist/components/collapsible/collapsible.d.ts +4 -4
- package/dist/components/collapsible/collapsible.js +8 -11
- package/dist/components/collapsible/index.d.ts +0 -1
- package/dist/components/collapsible/index.js +0 -1
- package/dist/components/container/container.d.ts +146 -0
- package/dist/components/container/container.js +43 -0
- package/dist/components/container/index.d.ts +1 -0
- package/dist/components/container/index.js +1 -0
- package/dist/components/context-menu/context-menu.d.ts +6 -7
- package/dist/components/context-menu/context-menu.js +42 -12
- package/dist/components/context-menu/index.d.ts +0 -1
- package/dist/components/context-menu/index.js +0 -1
- package/dist/components/data-row/data-row.d.ts +0 -1
- package/dist/components/data-row/data-row.js +35 -17
- package/dist/components/data-row/index.d.ts +0 -1
- package/dist/components/data-row/index.js +0 -1
- package/dist/components/dialog/dialog.d.ts +8 -9
- package/dist/components/dialog/dialog.js +48 -24
- package/dist/components/dialog/index.d.ts +0 -1
- package/dist/components/dialog/index.js +0 -1
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +6 -7
- package/dist/components/dropdown-menu/dropdown-menu.js +45 -11
- package/dist/components/dropdown-menu/index.d.ts +0 -1
- package/dist/components/dropdown-menu/index.js +0 -1
- package/dist/components/form-field/form-field.d.ts +0 -1
- package/dist/components/form-field/form-field.js +26 -13
- package/dist/components/form-field/index.d.ts +0 -1
- package/dist/components/form-field/index.js +0 -1
- package/dist/components/hover-card/hover-card.d.ts +1 -2
- package/dist/components/hover-card/hover-card.js +12 -3
- package/dist/components/hover-card/index.d.ts +0 -1
- package/dist/components/hover-card/index.js +0 -1
- package/dist/components/input/index.d.ts +0 -1
- package/dist/components/input/index.js +0 -1
- package/dist/components/input/input.d.ts +2 -3
- package/dist/components/input/input.js +18 -3
- package/dist/components/label/index.d.ts +0 -1
- package/dist/components/label/index.js +0 -1
- package/dist/components/label/label.d.ts +0 -1
- package/dist/components/label/label.js +0 -1
- package/dist/components/labeled-field/index.d.ts +0 -1
- package/dist/components/labeled-field/index.js +0 -1
- package/dist/components/labeled-field/labeled-field.d.ts +1 -2
- package/dist/components/labeled-field/labeled-field.js +10 -2
- package/dist/components/menubar/index.d.ts +0 -1
- package/dist/components/menubar/index.js +0 -1
- package/dist/components/menubar/menubar.d.ts +7 -8
- package/dist/components/menubar/menubar.js +48 -15
- package/dist/components/numeric-input/index.d.ts +0 -1
- package/dist/components/numeric-input/index.js +0 -1
- package/dist/components/numeric-input/numeric-input.d.ts +6 -5
- package/dist/components/numeric-input/numeric-input.js +55 -26
- package/dist/components/otp-input/index.d.ts +0 -1
- package/dist/components/otp-input/index.js +0 -1
- package/dist/components/otp-input/otp-input.d.ts +3 -4
- package/dist/components/otp-input/otp-input.js +13 -9
- package/dist/components/popover/index.d.ts +0 -1
- package/dist/components/popover/index.js +0 -1
- package/dist/components/popover/popover.d.ts +4 -2
- package/dist/components/popover/popover.js +21 -4
- package/dist/components/pressable/index.d.ts +0 -1
- package/dist/components/pressable/index.js +0 -1
- package/dist/components/pressable/pressable.d.ts +7 -1
- package/dist/components/pressable/pressable.js +47 -4
- package/dist/components/progress/index.d.ts +0 -1
- package/dist/components/progress/index.js +0 -1
- package/dist/components/progress/progress.d.ts +0 -1
- package/dist/components/progress/progress.js +5 -2
- package/dist/components/radio-group/index.d.ts +0 -1
- package/dist/components/radio-group/index.js +0 -1
- package/dist/components/radio-group/radio-group.d.ts +2 -3
- package/dist/components/radio-group/radio-group.js +16 -7
- package/dist/components/row/index.d.ts +0 -1
- package/dist/components/row/index.js +0 -1
- package/dist/components/row/row.d.ts +0 -1
- package/dist/components/row/row.js +0 -1
- package/dist/components/segmented-control/index.d.ts +0 -1
- package/dist/components/segmented-control/index.js +0 -1
- package/dist/components/segmented-control/segmented-control.d.ts +7 -8
- package/dist/components/segmented-control/segmented-control.js +57 -24
- package/dist/components/select/index.d.ts +0 -1
- package/dist/components/select/index.js +0 -1
- package/dist/components/select/select.d.ts +15 -7
- package/dist/components/select/select.js +53 -11
- package/dist/components/separator/index.d.ts +0 -1
- package/dist/components/separator/index.js +0 -1
- package/dist/components/separator/separator.d.ts +0 -1
- package/dist/components/separator/separator.js +0 -1
- package/dist/components/skeleton/index.d.ts +0 -1
- package/dist/components/skeleton/index.js +0 -1
- package/dist/components/skeleton/skeleton.d.ts +3 -4
- package/dist/components/skeleton/skeleton.js +7 -8
- package/dist/components/spinner/index.d.ts +0 -1
- package/dist/components/spinner/index.js +0 -1
- package/dist/components/spinner/spinner.d.ts +1 -2
- package/dist/components/spinner/spinner.js +4 -2
- package/dist/components/stack/index.d.ts +0 -1
- package/dist/components/stack/index.js +0 -1
- package/dist/components/stack/stack.d.ts +0 -1
- package/dist/components/stack/stack.js +0 -1
- package/dist/components/switch/index.d.ts +0 -1
- package/dist/components/switch/index.js +0 -1
- package/dist/components/switch/switch.d.ts +1 -2
- package/dist/components/switch/switch.js +21 -2
- package/dist/components/tabs/index.d.ts +0 -1
- package/dist/components/tabs/index.js +0 -1
- package/dist/components/tabs/tabs.d.ts +6 -7
- package/dist/components/tabs/tabs.js +42 -12
- package/dist/components/text/index.d.ts +0 -1
- package/dist/components/text/index.js +0 -1
- package/dist/components/text/text.d.ts +0 -1
- package/dist/components/text/text.js +0 -1
- package/dist/components/textarea/index.d.ts +0 -1
- package/dist/components/textarea/index.js +0 -1
- package/dist/components/textarea/textarea.d.ts +2 -3
- package/dist/components/textarea/textarea.js +16 -8
- package/dist/components/toast/index.d.ts +0 -1
- package/dist/components/toast/index.js +0 -1
- package/dist/components/toast/toast.d.ts +5 -6
- package/dist/components/toast/toast.js +40 -24
- package/dist/components/toggle/index.d.ts +0 -1
- package/dist/components/toggle/index.js +0 -1
- package/dist/components/toggle/toggle.d.ts +6 -7
- package/dist/components/toggle/toggle.js +32 -16
- package/dist/components/toggle-group/index.d.ts +0 -1
- package/dist/components/toggle-group/index.js +0 -1
- package/dist/components/toggle-group/toggle-group.d.ts +7 -8
- package/dist/components/toggle-group/toggle-group.js +36 -19
- package/dist/components/tooltip/index.d.ts +0 -1
- package/dist/components/tooltip/index.js +0 -1
- package/dist/components/tooltip/tooltip.d.ts +1 -2
- package/dist/components/tooltip/tooltip.js +20 -3
- package/dist/components/view/index.d.ts +0 -1
- package/dist/components/view/index.js +0 -1
- package/dist/components/view/view.d.ts +0 -1
- package/dist/components/view/view.js +0 -1
- package/dist/index.d.ts +9 -3
- package/dist/index.js +9 -7
- package/dist/lib/cn.d.ts +0 -1
- package/dist/lib/cn.js +0 -1
- package/dist/lib/compose-event-handlers.d.ts +15 -0
- package/dist/lib/compose-event-handlers.js +20 -0
- package/dist/lib/focus-ring.d.ts +25 -0
- package/dist/lib/focus-ring.js +25 -0
- package/dist/lib/font-context.d.ts +1 -1
- package/dist/lib/font-context.js +6 -4
- package/dist/lib/frosted-surface.d.ts +0 -1
- package/dist/lib/frosted-surface.js +31 -6
- package/dist/lib/interaction-tokens.d.ts +12 -1
- package/dist/lib/interaction-tokens.js +27 -13
- package/dist/lib/motion-policy.d.ts +25 -0
- package/dist/lib/motion-policy.js +97 -0
- package/dist/lib/overlay-insets.d.ts +17 -0
- package/dist/lib/overlay-insets.js +23 -0
- package/dist/lib/portal.d.ts +0 -1
- package/dist/lib/portal.js +0 -1
- package/dist/lib/react-native-classname.d.ts +0 -1
- package/dist/lib/react-native-classname.js +0 -1
- package/dist/lib/recipes.d.ts +30 -0
- package/dist/lib/recipes.js +138 -0
- package/dist/lib/tap-only.d.ts +11 -0
- package/dist/lib/tap-only.js +24 -0
- package/dist/lib/theme-bridge.d.ts +0 -1
- package/dist/lib/theme-bridge.js +11 -3
- package/dist/lib/theme-colors.d.ts +2 -46
- package/dist/lib/theme-colors.js +25 -226
- package/dist/lib/theme-contract.d.ts +78 -0
- package/dist/lib/theme-contract.js +481 -0
- package/dist/lib/theme-derive.d.ts +4 -0
- package/dist/lib/theme-derive.js +80 -0
- package/dist/lib/theme-presets.d.ts +31 -0
- package/dist/lib/theme-presets.js +221 -0
- package/dist/lib/tv.d.ts +0 -1
- package/dist/lib/tv.js +0 -1
- package/dist/lib/visual-token-contract.d.ts +110 -0
- package/dist/lib/visual-token-contract.js +583 -0
- package/dist/lib/visual-tokens.d.ts +2 -38
- package/dist/lib/visual-tokens.js +22 -75
- package/dist/tokens.d.ts +4 -0
- package/dist/tokens.js +6 -0
- package/dist/vite.d.ts +0 -1
- package/dist/vite.js +0 -1
- package/package.json +30 -20
- package/dist/blocks/auth/forgot-password-form.d.ts +0 -10
- package/dist/blocks/auth/forgot-password-form.d.ts.map +0 -1
- package/dist/blocks/auth/forgot-password-form.js +0 -17
- package/dist/blocks/auth/forgot-password-form.js.map +0 -1
- package/dist/blocks/auth/index.d.ts +0 -8
- package/dist/blocks/auth/index.d.ts.map +0 -1
- package/dist/blocks/auth/index.js +0 -8
- package/dist/blocks/auth/index.js.map +0 -1
- package/dist/blocks/auth/reset-password-form.d.ts +0 -9
- package/dist/blocks/auth/reset-password-form.d.ts.map +0 -1
- package/dist/blocks/auth/reset-password-form.js +0 -16
- package/dist/blocks/auth/reset-password-form.js.map +0 -1
- package/dist/blocks/auth/sign-in-form.d.ts +0 -17
- package/dist/blocks/auth/sign-in-form.d.ts.map +0 -1
- package/dist/blocks/auth/sign-in-form.js +0 -19
- package/dist/blocks/auth/sign-in-form.js.map +0 -1
- package/dist/blocks/auth/sign-up-form.d.ts +0 -17
- package/dist/blocks/auth/sign-up-form.d.ts.map +0 -1
- package/dist/blocks/auth/sign-up-form.js +0 -21
- package/dist/blocks/auth/sign-up-form.js.map +0 -1
- package/dist/blocks/auth/social-connections.d.ts +0 -10
- package/dist/blocks/auth/social-connections.d.ts.map +0 -1
- package/dist/blocks/auth/social-connections.js +0 -8
- package/dist/blocks/auth/social-connections.js.map +0 -1
- package/dist/blocks/auth/user-menu.d.ts +0 -12
- package/dist/blocks/auth/user-menu.d.ts.map +0 -1
- package/dist/blocks/auth/user-menu.js +0 -10
- package/dist/blocks/auth/user-menu.js.map +0 -1
- package/dist/blocks/auth/verify-email-form.d.ts +0 -10
- package/dist/blocks/auth/verify-email-form.d.ts.map +0 -1
- package/dist/blocks/auth/verify-email-form.js +0 -17
- package/dist/blocks/auth/verify-email-form.js.map +0 -1
- package/dist/blocks/chat/chat.d.ts.map +0 -1
- package/dist/blocks/chat/chat.js.map +0 -1
- package/dist/blocks/chat/index.d.ts.map +0 -1
- package/dist/blocks/chat/index.js.map +0 -1
- package/dist/blocks/commerce/checkout-summary.d.ts.map +0 -1
- package/dist/blocks/commerce/checkout-summary.js.map +0 -1
- package/dist/blocks/commerce/feature-gate.d.ts.map +0 -1
- package/dist/blocks/commerce/feature-gate.js.map +0 -1
- package/dist/blocks/commerce/index.d.ts.map +0 -1
- package/dist/blocks/commerce/index.js.map +0 -1
- package/dist/blocks/commerce/metric-card.d.ts.map +0 -1
- package/dist/blocks/commerce/metric-card.js.map +0 -1
- package/dist/blocks/commerce/plan-toggle.d.ts.map +0 -1
- package/dist/blocks/commerce/plan-toggle.js.map +0 -1
- package/dist/blocks/commerce/pricing-card.d.ts.map +0 -1
- package/dist/blocks/commerce/pricing-card.js.map +0 -1
- package/dist/blocks/commerce/product-card.d.ts.map +0 -1
- package/dist/blocks/commerce/product-card.js.map +0 -1
- package/dist/blocks/commerce/subscription-card.d.ts.map +0 -1
- package/dist/blocks/commerce/subscription-card.js.map +0 -1
- package/dist/blocks/commerce/upgrade-banner.d.ts.map +0 -1
- package/dist/blocks/commerce/upgrade-banner.js.map +0 -1
- package/dist/blocks/commerce/usage-bar.d.ts.map +0 -1
- package/dist/blocks/commerce/usage-bar.js.map +0 -1
- package/dist/blocks/datepicker/date-range-picker-modal.d.ts.map +0 -1
- package/dist/blocks/datepicker/date-range-picker-modal.js.map +0 -1
- package/dist/blocks/datepicker/datepicker-inline.d.ts.map +0 -1
- package/dist/blocks/datepicker/datepicker-inline.js.map +0 -1
- package/dist/blocks/datepicker/datepicker-modal.d.ts.map +0 -1
- package/dist/blocks/datepicker/datepicker-modal.js.map +0 -1
- package/dist/blocks/datepicker/index.d.ts.map +0 -1
- package/dist/blocks/datepicker/index.js.map +0 -1
- package/dist/blocks/datepicker/use-calendar-theme.d.ts.map +0 -1
- package/dist/blocks/datepicker/use-calendar-theme.js.map +0 -1
- package/dist/blocks/layout/action-bar.d.ts.map +0 -1
- package/dist/blocks/layout/action-bar.js.map +0 -1
- package/dist/blocks/layout/app-shell.d.ts.map +0 -1
- package/dist/blocks/layout/app-shell.js.map +0 -1
- package/dist/blocks/layout/confirm-action-sheet.d.ts.map +0 -1
- package/dist/blocks/layout/confirm-action-sheet.js.map +0 -1
- package/dist/blocks/layout/content-skeleton.d.ts.map +0 -1
- package/dist/blocks/layout/content-skeleton.js.map +0 -1
- package/dist/blocks/layout/empty-state.d.ts.map +0 -1
- package/dist/blocks/layout/empty-state.js.map +0 -1
- package/dist/blocks/layout/error-boundary.d.ts.map +0 -1
- package/dist/blocks/layout/error-boundary.js.map +0 -1
- package/dist/blocks/layout/error-state.d.ts.map +0 -1
- package/dist/blocks/layout/error-state.js.map +0 -1
- package/dist/blocks/layout/form-modal-screen.d.ts.map +0 -1
- package/dist/blocks/layout/form-modal-screen.js.map +0 -1
- package/dist/blocks/layout/index.d.ts.map +0 -1
- package/dist/blocks/layout/index.js.map +0 -1
- package/dist/blocks/layout/loading-screen.d.ts.map +0 -1
- package/dist/blocks/layout/loading-screen.js.map +0 -1
- package/dist/blocks/layout/onboarding-screen.d.ts +0 -19
- package/dist/blocks/layout/onboarding-screen.d.ts.map +0 -1
- package/dist/blocks/layout/onboarding-screen.js +0 -35
- package/dist/blocks/layout/onboarding-screen.js.map +0 -1
- package/dist/blocks/layout/page-skeleton.d.ts.map +0 -1
- package/dist/blocks/layout/page-skeleton.js.map +0 -1
- package/dist/blocks/layout/pull-to-refresh-scroll-view.d.ts.map +0 -1
- package/dist/blocks/layout/pull-to-refresh-scroll-view.js.map +0 -1
- package/dist/blocks/layout/screen-skeleton.d.ts.map +0 -1
- package/dist/blocks/layout/screen-skeleton.js.map +0 -1
- package/dist/blocks/layout/sheet.d.ts.map +0 -1
- package/dist/blocks/layout/sheet.js.map +0 -1
- package/dist/blocks/layout/smart-image.d.ts +0 -9
- package/dist/blocks/layout/smart-image.d.ts.map +0 -1
- package/dist/blocks/layout/smart-image.js +0 -23
- package/dist/blocks/layout/smart-image.js.map +0 -1
- package/dist/blocks/layout/smart-input.d.ts.map +0 -1
- package/dist/blocks/layout/smart-input.js.map +0 -1
- package/dist/blocks/lists/index.d.ts.map +0 -1
- package/dist/blocks/lists/index.js.map +0 -1
- package/dist/blocks/lists/list-item.d.ts.map +0 -1
- package/dist/blocks/lists/list-item.js.map +0 -1
- package/dist/blocks/lists/notification-item.d.ts.map +0 -1
- package/dist/blocks/lists/notification-item.js.map +0 -1
- package/dist/blocks/lists/swipeable-item.d.ts +0 -17
- package/dist/blocks/lists/swipeable-item.d.ts.map +0 -1
- package/dist/blocks/lists/swipeable-item.js +0 -65
- package/dist/blocks/lists/swipeable-item.js.map +0 -1
- package/dist/blocks/lists/timeline-feed.d.ts.map +0 -1
- package/dist/blocks/lists/timeline-feed.js.map +0 -1
- package/dist/blocks/media/index.d.ts.map +0 -1
- package/dist/blocks/media/index.js.map +0 -1
- package/dist/blocks/media/smart-image.d.ts.map +0 -1
- package/dist/blocks/media/smart-image.js.map +0 -1
- package/dist/blocks/navigation/bottom-nav.d.ts.map +0 -1
- package/dist/blocks/navigation/bottom-nav.js.map +0 -1
- package/dist/blocks/navigation/drawer-menu.d.ts.map +0 -1
- package/dist/blocks/navigation/drawer-menu.js.map +0 -1
- package/dist/blocks/navigation/floating-bottom-nav.d.ts.map +0 -1
- package/dist/blocks/navigation/floating-bottom-nav.js.map +0 -1
- package/dist/blocks/navigation/header.d.ts.map +0 -1
- package/dist/blocks/navigation/header.js.map +0 -1
- package/dist/blocks/navigation/index.d.ts.map +0 -1
- package/dist/blocks/navigation/index.js.map +0 -1
- package/dist/blocks/navigation/navigation-sidebar.d.ts +0 -25
- package/dist/blocks/navigation/navigation-sidebar.d.ts.map +0 -1
- package/dist/blocks/navigation/navigation-sidebar.js +0 -18
- package/dist/blocks/navigation/navigation-sidebar.js.map +0 -1
- package/dist/blocks/navigation/tab-bar.d.ts.map +0 -1
- package/dist/blocks/navigation/tab-bar.js.map +0 -1
- package/dist/blocks/profile/account-card.d.ts +0 -11
- package/dist/blocks/profile/account-card.d.ts.map +0 -1
- package/dist/blocks/profile/account-card.js +0 -10
- package/dist/blocks/profile/account-card.js.map +0 -1
- package/dist/blocks/profile/index.d.ts +0 -5
- package/dist/blocks/profile/index.d.ts.map +0 -1
- package/dist/blocks/profile/index.js +0 -5
- package/dist/blocks/profile/index.js.map +0 -1
- package/dist/blocks/profile/profile-header.d.ts +0 -27
- package/dist/blocks/profile/profile-header.d.ts.map +0 -1
- package/dist/blocks/profile/profile-header.js +0 -11
- package/dist/blocks/profile/profile-header.js.map +0 -1
- package/dist/blocks/profile/settings-item.d.ts +0 -15
- package/dist/blocks/profile/settings-item.d.ts.map +0 -1
- package/dist/blocks/profile/settings-item.js +0 -11
- package/dist/blocks/profile/settings-item.js.map +0 -1
- package/dist/blocks/profile/settings-section.d.ts +0 -7
- package/dist/blocks/profile/settings-section.d.ts.map +0 -1
- package/dist/blocks/profile/settings-section.js +0 -9
- package/dist/blocks/profile/settings-section.js.map +0 -1
- package/dist/blocks/splash/index.d.ts.map +0 -1
- package/dist/blocks/splash/index.js.map +0 -1
- package/dist/blocks/splash/splash-screen.d.ts.map +0 -1
- package/dist/blocks/splash/splash-screen.js.map +0 -1
- package/dist/components/accordion/accordion.d.ts.map +0 -1
- package/dist/components/accordion/accordion.js.map +0 -1
- package/dist/components/accordion/index.d.ts.map +0 -1
- package/dist/components/accordion/index.js.map +0 -1
- package/dist/components/alert/alert.d.ts.map +0 -1
- package/dist/components/alert/alert.js.map +0 -1
- package/dist/components/alert/index.d.ts.map +0 -1
- package/dist/components/alert/index.js.map +0 -1
- package/dist/components/alert-dialog/alert-dialog.d.ts.map +0 -1
- package/dist/components/alert-dialog/alert-dialog.js.map +0 -1
- package/dist/components/alert-dialog/index.d.ts.map +0 -1
- package/dist/components/alert-dialog/index.js.map +0 -1
- package/dist/components/aspect-ratio/aspect-ratio.d.ts.map +0 -1
- package/dist/components/aspect-ratio/aspect-ratio.js.map +0 -1
- package/dist/components/aspect-ratio/index.d.ts.map +0 -1
- package/dist/components/aspect-ratio/index.js.map +0 -1
- package/dist/components/avatar/avatar.d.ts.map +0 -1
- package/dist/components/avatar/avatar.js.map +0 -1
- package/dist/components/avatar/index.d.ts.map +0 -1
- package/dist/components/avatar/index.js.map +0 -1
- package/dist/components/badge/badge.d.ts.map +0 -1
- package/dist/components/badge/badge.js.map +0 -1
- package/dist/components/badge/index.d.ts.map +0 -1
- package/dist/components/badge/index.js.map +0 -1
- package/dist/components/box/box.d.ts +0 -143
- package/dist/components/box/box.d.ts.map +0 -1
- package/dist/components/box/box.js +0 -38
- package/dist/components/box/box.js.map +0 -1
- package/dist/components/box/index.d.ts +0 -2
- package/dist/components/box/index.d.ts.map +0 -1
- package/dist/components/box/index.js +0 -2
- package/dist/components/box/index.js.map +0 -1
- package/dist/components/button/button.d.ts.map +0 -1
- package/dist/components/button/button.js.map +0 -1
- package/dist/components/button/index.d.ts.map +0 -1
- package/dist/components/button/index.js.map +0 -1
- package/dist/components/card/card.d.ts.map +0 -1
- package/dist/components/card/card.js.map +0 -1
- package/dist/components/card/index.d.ts.map +0 -1
- package/dist/components/card/index.js.map +0 -1
- package/dist/components/checkbox/checkbox.d.ts.map +0 -1
- package/dist/components/checkbox/checkbox.js.map +0 -1
- package/dist/components/checkbox/index.d.ts.map +0 -1
- package/dist/components/checkbox/index.js.map +0 -1
- package/dist/components/collapsible/collapsible.d.ts.map +0 -1
- package/dist/components/collapsible/collapsible.js.map +0 -1
- package/dist/components/collapsible/index.d.ts.map +0 -1
- package/dist/components/collapsible/index.js.map +0 -1
- package/dist/components/context-menu/context-menu.d.ts.map +0 -1
- package/dist/components/context-menu/context-menu.js.map +0 -1
- package/dist/components/context-menu/index.d.ts.map +0 -1
- package/dist/components/context-menu/index.js.map +0 -1
- package/dist/components/data-row/data-row.d.ts.map +0 -1
- package/dist/components/data-row/data-row.js.map +0 -1
- package/dist/components/data-row/index.d.ts.map +0 -1
- package/dist/components/data-row/index.js.map +0 -1
- package/dist/components/dialog/dialog.d.ts.map +0 -1
- package/dist/components/dialog/dialog.js.map +0 -1
- package/dist/components/dialog/index.d.ts.map +0 -1
- package/dist/components/dialog/index.js.map +0 -1
- package/dist/components/dropdown-menu/dropdown-menu.d.ts.map +0 -1
- package/dist/components/dropdown-menu/dropdown-menu.js.map +0 -1
- package/dist/components/dropdown-menu/index.d.ts.map +0 -1
- package/dist/components/dropdown-menu/index.js.map +0 -1
- package/dist/components/form-field/form-field.d.ts.map +0 -1
- package/dist/components/form-field/form-field.js.map +0 -1
- package/dist/components/form-field/index.d.ts.map +0 -1
- package/dist/components/form-field/index.js.map +0 -1
- package/dist/components/hover-card/hover-card.d.ts.map +0 -1
- package/dist/components/hover-card/hover-card.js.map +0 -1
- package/dist/components/hover-card/index.d.ts.map +0 -1
- package/dist/components/hover-card/index.js.map +0 -1
- package/dist/components/input/index.d.ts.map +0 -1
- package/dist/components/input/index.js.map +0 -1
- package/dist/components/input/input.d.ts.map +0 -1
- package/dist/components/input/input.js.map +0 -1
- package/dist/components/label/index.d.ts.map +0 -1
- package/dist/components/label/index.js.map +0 -1
- package/dist/components/label/label.d.ts.map +0 -1
- package/dist/components/label/label.js.map +0 -1
- package/dist/components/labeled-field/index.d.ts.map +0 -1
- package/dist/components/labeled-field/index.js.map +0 -1
- package/dist/components/labeled-field/labeled-field.d.ts.map +0 -1
- package/dist/components/labeled-field/labeled-field.js.map +0 -1
- package/dist/components/layout/index.d.ts +0 -2
- package/dist/components/layout/index.d.ts.map +0 -1
- package/dist/components/layout/index.js +0 -2
- package/dist/components/layout/index.js.map +0 -1
- package/dist/components/layout/layout.d.ts +0 -395
- package/dist/components/layout/layout.d.ts.map +0 -1
- package/dist/components/layout/layout.js +0 -93
- package/dist/components/layout/layout.js.map +0 -1
- package/dist/components/menubar/index.d.ts.map +0 -1
- package/dist/components/menubar/index.js.map +0 -1
- package/dist/components/menubar/menubar.d.ts.map +0 -1
- package/dist/components/menubar/menubar.js.map +0 -1
- package/dist/components/numeric-input/index.d.ts.map +0 -1
- package/dist/components/numeric-input/index.js.map +0 -1
- package/dist/components/numeric-input/numeric-input.d.ts.map +0 -1
- package/dist/components/numeric-input/numeric-input.js.map +0 -1
- package/dist/components/otp-input/index.d.ts.map +0 -1
- package/dist/components/otp-input/index.js.map +0 -1
- package/dist/components/otp-input/otp-input.d.ts.map +0 -1
- package/dist/components/otp-input/otp-input.js.map +0 -1
- package/dist/components/popover/index.d.ts.map +0 -1
- package/dist/components/popover/index.js.map +0 -1
- package/dist/components/popover/popover.d.ts.map +0 -1
- package/dist/components/popover/popover.js.map +0 -1
- package/dist/components/pressable/index.d.ts.map +0 -1
- package/dist/components/pressable/index.js.map +0 -1
- package/dist/components/pressable/pressable.d.ts.map +0 -1
- package/dist/components/pressable/pressable.js.map +0 -1
- package/dist/components/progress/index.d.ts.map +0 -1
- package/dist/components/progress/index.js.map +0 -1
- package/dist/components/progress/progress.d.ts.map +0 -1
- package/dist/components/progress/progress.js.map +0 -1
- package/dist/components/radio-group/index.d.ts.map +0 -1
- package/dist/components/radio-group/index.js.map +0 -1
- package/dist/components/radio-group/radio-group.d.ts.map +0 -1
- package/dist/components/radio-group/radio-group.js.map +0 -1
- package/dist/components/row/index.d.ts.map +0 -1
- package/dist/components/row/index.js.map +0 -1
- package/dist/components/row/row.d.ts.map +0 -1
- package/dist/components/row/row.js.map +0 -1
- package/dist/components/segmented-control/index.d.ts.map +0 -1
- package/dist/components/segmented-control/index.js.map +0 -1
- package/dist/components/segmented-control/segmented-control.d.ts.map +0 -1
- package/dist/components/segmented-control/segmented-control.js.map +0 -1
- package/dist/components/select/index.d.ts.map +0 -1
- package/dist/components/select/index.js.map +0 -1
- package/dist/components/select/select.d.ts.map +0 -1
- package/dist/components/select/select.js.map +0 -1
- package/dist/components/separator/index.d.ts.map +0 -1
- package/dist/components/separator/index.js.map +0 -1
- package/dist/components/separator/separator.d.ts.map +0 -1
- package/dist/components/separator/separator.js.map +0 -1
- package/dist/components/skeleton/index.d.ts.map +0 -1
- package/dist/components/skeleton/index.js.map +0 -1
- package/dist/components/skeleton/skeleton.d.ts.map +0 -1
- package/dist/components/skeleton/skeleton.js.map +0 -1
- package/dist/components/spinner/index.d.ts.map +0 -1
- package/dist/components/spinner/index.js.map +0 -1
- package/dist/components/spinner/spinner.d.ts.map +0 -1
- package/dist/components/spinner/spinner.js.map +0 -1
- package/dist/components/stack/index.d.ts.map +0 -1
- package/dist/components/stack/index.js.map +0 -1
- package/dist/components/stack/stack.d.ts.map +0 -1
- package/dist/components/stack/stack.js.map +0 -1
- package/dist/components/switch/index.d.ts.map +0 -1
- package/dist/components/switch/index.js.map +0 -1
- package/dist/components/switch/switch.d.ts.map +0 -1
- package/dist/components/switch/switch.js.map +0 -1
- package/dist/components/tabs/index.d.ts.map +0 -1
- package/dist/components/tabs/index.js.map +0 -1
- package/dist/components/tabs/tabs.d.ts.map +0 -1
- package/dist/components/tabs/tabs.js.map +0 -1
- package/dist/components/text/index.d.ts.map +0 -1
- package/dist/components/text/index.js.map +0 -1
- package/dist/components/text/text.d.ts.map +0 -1
- package/dist/components/text/text.js.map +0 -1
- package/dist/components/textarea/index.d.ts.map +0 -1
- package/dist/components/textarea/index.js.map +0 -1
- package/dist/components/textarea/textarea.d.ts.map +0 -1
- package/dist/components/textarea/textarea.js.map +0 -1
- package/dist/components/toast/index.d.ts.map +0 -1
- package/dist/components/toast/index.js.map +0 -1
- package/dist/components/toast/toast.d.ts.map +0 -1
- package/dist/components/toast/toast.js.map +0 -1
- package/dist/components/toggle/index.d.ts.map +0 -1
- package/dist/components/toggle/index.js.map +0 -1
- package/dist/components/toggle/toggle.d.ts.map +0 -1
- package/dist/components/toggle/toggle.js.map +0 -1
- package/dist/components/toggle-group/index.d.ts.map +0 -1
- package/dist/components/toggle-group/index.js.map +0 -1
- package/dist/components/toggle-group/toggle-group.d.ts.map +0 -1
- package/dist/components/toggle-group/toggle-group.js.map +0 -1
- package/dist/components/tooltip/index.d.ts.map +0 -1
- package/dist/components/tooltip/index.js.map +0 -1
- package/dist/components/tooltip/tooltip.d.ts.map +0 -1
- package/dist/components/tooltip/tooltip.js.map +0 -1
- package/dist/components/view/index.d.ts.map +0 -1
- package/dist/components/view/index.js.map +0 -1
- package/dist/components/view/view.d.ts.map +0 -1
- package/dist/components/view/view.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/cn.d.ts.map +0 -1
- package/dist/lib/cn.js.map +0 -1
- package/dist/lib/font-context.d.ts.map +0 -1
- package/dist/lib/font-context.js.map +0 -1
- package/dist/lib/frosted-surface.d.ts.map +0 -1
- package/dist/lib/frosted-surface.js.map +0 -1
- package/dist/lib/index.d.ts +0 -6
- package/dist/lib/index.d.ts.map +0 -1
- package/dist/lib/index.js +0 -6
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/interaction-tokens.d.ts.map +0 -1
- package/dist/lib/interaction-tokens.js.map +0 -1
- package/dist/lib/portal.d.ts.map +0 -1
- package/dist/lib/portal.js.map +0 -1
- package/dist/lib/react-native-classname.d.ts.map +0 -1
- package/dist/lib/react-native-classname.js.map +0 -1
- package/dist/lib/theme-bridge.d.ts.map +0 -1
- package/dist/lib/theme-bridge.js.map +0 -1
- package/dist/lib/theme-colors.d.ts.map +0 -1
- package/dist/lib/theme-colors.js.map +0 -1
- package/dist/lib/tv.d.ts.map +0 -1
- package/dist/lib/tv.js.map +0 -1
- package/dist/lib/visual-tokens.d.ts.map +0 -1
- package/dist/lib/visual-tokens.js.map +0 -1
- package/dist/vite.d.ts.map +0 -1
- package/dist/vite.js.map +0 -1
|
@@ -2,15 +2,23 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { Pressable, View } from 'react-native';
|
|
4
4
|
import { cn } from '../../lib/cn';
|
|
5
|
+
import { focusRing } from '../../lib/focus-ring';
|
|
5
6
|
import { useInteractionTokens, withInteractivePressableStyle } from '../../lib/interaction-tokens';
|
|
7
|
+
import { useVisualTokens } from '../../lib/visual-tokens';
|
|
6
8
|
function Switch({ checked: controlledChecked, defaultChecked = false, onCheckedChange, disabled = false, className, ...props }) {
|
|
7
9
|
const [internalChecked, setInternalChecked] = useState(defaultChecked);
|
|
8
10
|
const isChecked = controlledChecked ?? internalChecked;
|
|
9
11
|
const interaction = useInteractionTokens();
|
|
12
|
+
const visual = useVisualTokens();
|
|
10
13
|
const interactiveStyle = withInteractivePressableStyle(undefined, interaction, {
|
|
11
14
|
disabled,
|
|
12
15
|
pressedVariant: 'default',
|
|
13
16
|
});
|
|
17
|
+
const trackHeight = Math.max(24, Math.round(visual.controlHeightSm * 0.9));
|
|
18
|
+
const trackWidth = Math.round(trackHeight * 1.45);
|
|
19
|
+
const inset = Math.max(2, Math.round(trackHeight * 0.08));
|
|
20
|
+
const thumbSize = trackHeight - inset * 2 - 2;
|
|
21
|
+
const thumbOffset = Math.max(0, trackWidth - thumbSize - inset * 2 - 2);
|
|
14
22
|
const handleToggle = () => {
|
|
15
23
|
if (disabled)
|
|
16
24
|
return;
|
|
@@ -18,8 +26,19 @@ function Switch({ checked: controlledChecked, defaultChecked = false, onCheckedC
|
|
|
18
26
|
setInternalChecked(newValue);
|
|
19
27
|
onCheckedChange?.(newValue);
|
|
20
28
|
};
|
|
21
|
-
return (_jsx(Pressable, { onPress: handleToggle, disabled: disabled, style: interactiveStyle, hitSlop: { top: 12, bottom: 12, left: 12, right: 12 }, accessibilityRole: "switch", accessibilityState: { checked: isChecked, disabled }, children: _jsx(View, { className: cn('
|
|
29
|
+
return (_jsx(Pressable, { onPress: handleToggle, disabled: disabled, style: interactiveStyle, hitSlop: { top: 12, bottom: 12, left: 12, right: 12 }, accessibilityRole: "switch", accessibilityState: { checked: isChecked, disabled }, "aria-checked": isChecked, children: _jsx(View, { className: cn('flex-row items-center justify-start', isChecked ? 'border-primary bg-primary' : 'border-input bg-muted', focusRing, className), style: {
|
|
30
|
+
width: trackWidth,
|
|
31
|
+
height: trackHeight,
|
|
32
|
+
borderWidth: visual.borderWidthEmphasis,
|
|
33
|
+
borderRadius: trackHeight / 2,
|
|
34
|
+
padding: inset,
|
|
35
|
+
}, ...props, children: _jsx(View, { className: "border-border bg-background shadow-sm", style: {
|
|
36
|
+
width: thumbSize,
|
|
37
|
+
height: thumbSize,
|
|
38
|
+
borderWidth: visual.borderWidthEmphasis,
|
|
39
|
+
borderRadius: thumbSize / 2,
|
|
40
|
+
transform: [{ translateX: isChecked ? thumbOffset : 0 }],
|
|
41
|
+
} }) }) }));
|
|
22
42
|
}
|
|
23
43
|
Switch.displayName = 'Switch';
|
|
24
44
|
export { Switch };
|
|
25
|
-
//# sourceMappingURL=switch.js.map
|
|
@@ -5,7 +5,7 @@ declare const tabsTriggerVariants: import("tailwind-variants").TVReturnType<{
|
|
|
5
5
|
active: string;
|
|
6
6
|
inactive: string;
|
|
7
7
|
};
|
|
8
|
-
}, undefined, "inline-flex items-center justify-center whitespace-nowrap
|
|
8
|
+
}, undefined, "inline-flex items-center justify-center whitespace-nowrap font-medium", import("tailwind-variants/dist/config.js").TVConfig<{
|
|
9
9
|
state: {
|
|
10
10
|
active: string;
|
|
11
11
|
inactive: string;
|
|
@@ -25,7 +25,7 @@ declare const tabsTriggerVariants: import("tailwind-variants").TVReturnType<{
|
|
|
25
25
|
active: string;
|
|
26
26
|
inactive: string;
|
|
27
27
|
};
|
|
28
|
-
}, undefined, "inline-flex items-center justify-center whitespace-nowrap
|
|
28
|
+
}, undefined, "inline-flex items-center justify-center whitespace-nowrap font-medium", import("tailwind-variants/dist/config.js").TVConfig<{
|
|
29
29
|
state: {
|
|
30
30
|
active: string;
|
|
31
31
|
inactive: string;
|
|
@@ -54,21 +54,20 @@ export interface TabsContentProps extends ViewProps {
|
|
|
54
54
|
value: string;
|
|
55
55
|
className?: string;
|
|
56
56
|
}
|
|
57
|
-
declare function Tabs({ defaultValue, value: controlledValue, onValueChange, className, children, ...props }: TabsProps): import("react
|
|
57
|
+
declare function Tabs({ defaultValue, value: controlledValue, onValueChange, className, children, ...props }: TabsProps): import("react").JSX.Element;
|
|
58
58
|
declare namespace Tabs {
|
|
59
59
|
var displayName: string;
|
|
60
60
|
}
|
|
61
|
-
declare function TabsList({ className, ...props }: TabsListProps): import("react
|
|
61
|
+
declare function TabsList({ className, style, ...props }: TabsListProps): import("react").JSX.Element;
|
|
62
62
|
declare namespace TabsList {
|
|
63
63
|
var displayName: string;
|
|
64
64
|
}
|
|
65
|
-
declare function TabsTrigger({ value: tabValue, children, className, disabled, style: styleProp, ...props }: TabsTriggerProps): import("react
|
|
65
|
+
declare function TabsTrigger({ value: tabValue, children, className, disabled, style: styleProp, ...props }: TabsTriggerProps): import("react").JSX.Element;
|
|
66
66
|
declare namespace TabsTrigger {
|
|
67
67
|
var displayName: string;
|
|
68
68
|
}
|
|
69
|
-
declare function TabsContent({ value: tabValue, className, children, ...props }: TabsContentProps): import("react
|
|
69
|
+
declare function TabsContent({ value: tabValue, className, children, ...props }: TabsContentProps): import("react").JSX.Element | null;
|
|
70
70
|
declare namespace TabsContent {
|
|
71
71
|
var displayName: string;
|
|
72
72
|
}
|
|
73
73
|
export { Tabs, TabsList, TabsTrigger, TabsContent, tabsTriggerVariants };
|
|
74
|
-
//# sourceMappingURL=tabs.d.ts.map
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useContext, useState } from 'react';
|
|
2
|
+
import { createContext, useCallback, useContext, useMemo, useState } from 'react';
|
|
3
3
|
import { View, Pressable } from 'react-native';
|
|
4
4
|
import { cn } from '../../lib/cn';
|
|
5
|
+
import { focusRingInset } from '../../lib/focus-ring';
|
|
5
6
|
import { tv } from '../../lib/tv';
|
|
6
7
|
import { useInteractionTokens, withInteractivePressableStyle } from '../../lib/interaction-tokens';
|
|
8
|
+
import { useThemeColors } from '../../lib/theme-colors';
|
|
9
|
+
import { useVisualTokens } from '../../lib/visual-tokens';
|
|
10
|
+
import { typographyStyle } from '../../lib/recipes';
|
|
7
11
|
const TabsContext = createContext({
|
|
8
12
|
value: '',
|
|
9
13
|
onValueChange: () => { },
|
|
10
14
|
});
|
|
11
|
-
// ─── Variants ────────────────────────────────────────────────
|
|
12
15
|
const tabsTriggerVariants = tv({
|
|
13
|
-
base: 'inline-flex items-center justify-center whitespace-nowrap
|
|
16
|
+
base: 'inline-flex items-center justify-center whitespace-nowrap font-medium',
|
|
14
17
|
variants: {
|
|
15
18
|
state: {
|
|
16
|
-
active: '
|
|
19
|
+
active: 'text-foreground',
|
|
17
20
|
inactive: 'text-muted-foreground',
|
|
18
21
|
},
|
|
19
22
|
},
|
|
@@ -21,28 +24,56 @@ const tabsTriggerVariants = tv({
|
|
|
21
24
|
state: 'inactive',
|
|
22
25
|
},
|
|
23
26
|
});
|
|
24
|
-
|
|
27
|
+
function getTabsListStyle(visual, colors) {
|
|
28
|
+
const inset = Math.max(4, Math.round(visual.controlPaddingYSm * 0.5));
|
|
29
|
+
return {
|
|
30
|
+
borderRadius: visual.radiusXl,
|
|
31
|
+
backgroundColor: colors.muted,
|
|
32
|
+
padding: inset,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function getTabsTriggerStyle(visual, colors, active) {
|
|
36
|
+
return {
|
|
37
|
+
...typographyStyle(visual, 'label'),
|
|
38
|
+
minHeight: visual.controlHeightDefault,
|
|
39
|
+
borderRadius: visual.radiusLg,
|
|
40
|
+
paddingHorizontal: visual.controlPaddingXDefault,
|
|
41
|
+
paddingVertical: visual.controlPaddingYDefault,
|
|
42
|
+
borderWidth: active ? visual.borderWidthHairline : 0,
|
|
43
|
+
borderColor: active ? colors.surfaceBorder : 'transparent',
|
|
44
|
+
backgroundColor: active ? colors.surfaceElevated : 'transparent',
|
|
45
|
+
};
|
|
46
|
+
}
|
|
25
47
|
function Tabs({ defaultValue, value: controlledValue, onValueChange, className, children, ...props }) {
|
|
26
48
|
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
27
49
|
const value = controlledValue ?? internalValue;
|
|
28
|
-
const handleValueChange = (newValue) => {
|
|
50
|
+
const handleValueChange = useCallback((newValue) => {
|
|
29
51
|
setInternalValue(newValue);
|
|
30
52
|
onValueChange?.(newValue);
|
|
31
|
-
};
|
|
32
|
-
|
|
53
|
+
}, [onValueChange]);
|
|
54
|
+
const contextValue = useMemo(() => ({ value, onValueChange: handleValueChange }), [handleValueChange, value]);
|
|
55
|
+
return (_jsx(TabsContext.Provider, { value: contextValue, children: _jsx(View, { className: cn('w-full', className), ...props, children: children }) }));
|
|
33
56
|
}
|
|
34
|
-
function TabsList({ className, ...props }) {
|
|
35
|
-
|
|
57
|
+
function TabsList({ className, style, ...props }) {
|
|
58
|
+
const visual = useVisualTokens();
|
|
59
|
+
const colors = useThemeColors();
|
|
60
|
+
return (_jsx(View, { accessibilityRole: "tablist", className: cn('flex flex-row items-center justify-center', className), style: [getTabsListStyle(visual, colors), style], ...props }));
|
|
36
61
|
}
|
|
37
62
|
function TabsTrigger({ value: tabValue, children, className, disabled, style: styleProp, ...props }) {
|
|
38
63
|
const { value, onValueChange } = useContext(TabsContext);
|
|
39
64
|
const isActive = value === tabValue;
|
|
40
65
|
const interaction = useInteractionTokens();
|
|
66
|
+
const visual = useVisualTokens();
|
|
67
|
+
const colors = useThemeColors();
|
|
41
68
|
const interactiveStyle = withInteractivePressableStyle(styleProp, interaction, {
|
|
42
69
|
disabled: Boolean(disabled),
|
|
43
70
|
pressedVariant: 'default',
|
|
44
71
|
});
|
|
45
|
-
|
|
72
|
+
const tokenStyle = getTabsTriggerStyle(visual, colors, isActive);
|
|
73
|
+
return (_jsx(Pressable, { className: cn(tabsTriggerVariants({ state: isActive ? 'active' : 'inactive' }), 'flex-1', focusRingInset, className), style: (state) => {
|
|
74
|
+
const baseStyle = typeof interactiveStyle === 'function' ? interactiveStyle(state) : interactiveStyle;
|
|
75
|
+
return [baseStyle, tokenStyle];
|
|
76
|
+
}, onPress: () => onValueChange(tabValue), accessibilityRole: "tab", accessibilityState: { selected: isActive, disabled: Boolean(disabled) }, "aria-selected": isActive, disabled: disabled, ...props, children: children }));
|
|
46
77
|
}
|
|
47
78
|
function TabsContent({ value: tabValue, className, children, ...props }) {
|
|
48
79
|
const { value } = useContext(TabsContext);
|
|
@@ -55,4 +86,3 @@ TabsList.displayName = 'TabsList';
|
|
|
55
86
|
TabsTrigger.displayName = 'TabsTrigger';
|
|
56
87
|
TabsContent.displayName = 'TabsContent';
|
|
57
88
|
export { Tabs, TabsList, TabsTrigger, TabsContent, tabsTriggerVariants };
|
|
58
|
-
//# sourceMappingURL=tabs.js.map
|
|
@@ -7,7 +7,7 @@ declare const textareaVariants: import("tailwind-variants").TVReturnType<{
|
|
|
7
7
|
sm: string;
|
|
8
8
|
lg: string;
|
|
9
9
|
};
|
|
10
|
-
}, undefined, "w-full
|
|
10
|
+
}, undefined, "w-full border-border bg-muted text-foreground", import("tailwind-variants/dist/config.js").TVConfig<{
|
|
11
11
|
size: {
|
|
12
12
|
default: string;
|
|
13
13
|
sm: string;
|
|
@@ -31,7 +31,7 @@ declare const textareaVariants: import("tailwind-variants").TVReturnType<{
|
|
|
31
31
|
sm: string;
|
|
32
32
|
lg: string;
|
|
33
33
|
};
|
|
34
|
-
}, undefined, "w-full
|
|
34
|
+
}, undefined, "w-full border-border bg-muted text-foreground", import("tailwind-variants/dist/config.js").TVConfig<{
|
|
35
35
|
size: {
|
|
36
36
|
default: string;
|
|
37
37
|
sm: string;
|
|
@@ -49,4 +49,3 @@ export interface TextareaProps extends Omit<TextInputProps, 'style'>, VariantPro
|
|
|
49
49
|
}
|
|
50
50
|
declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<TextInput>>;
|
|
51
51
|
export { Textarea, textareaVariants };
|
|
52
|
-
//# sourceMappingURL=textarea.d.ts.map
|
|
@@ -2,25 +2,30 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { TextInput } from 'react-native';
|
|
4
4
|
import { cn } from '../../lib/cn';
|
|
5
|
+
import { focusRing } from '../../lib/focus-ring';
|
|
5
6
|
import { tv } from '../../lib/tv';
|
|
6
7
|
import { useThemeColors } from '../../lib/theme-colors';
|
|
7
8
|
import { useInteractionTokens } from '../../lib/interaction-tokens';
|
|
8
9
|
import { useVisualTokens } from '../../lib/visual-tokens';
|
|
9
|
-
|
|
10
|
+
import { typographyStyle } from '../../lib/recipes';
|
|
10
11
|
const textareaVariants = tv({
|
|
11
|
-
base: 'w-full
|
|
12
|
+
base: 'w-full border-border bg-muted text-foreground',
|
|
12
13
|
variants: {
|
|
13
14
|
size: {
|
|
14
15
|
default: '',
|
|
15
|
-
sm: '
|
|
16
|
-
lg: '
|
|
16
|
+
sm: '',
|
|
17
|
+
lg: '',
|
|
17
18
|
},
|
|
18
19
|
},
|
|
19
20
|
defaultVariants: {
|
|
20
21
|
size: 'default',
|
|
21
22
|
},
|
|
22
23
|
});
|
|
23
|
-
|
|
24
|
+
const TEXTAREA_TEXT_ROLE = {
|
|
25
|
+
default: 'label',
|
|
26
|
+
sm: 'caption',
|
|
27
|
+
lg: 'body',
|
|
28
|
+
};
|
|
24
29
|
const Textarea = React.forwardRef(({ className, size = 'default', placeholderTextColor, ...props }, ref) => {
|
|
25
30
|
const colors = useThemeColors();
|
|
26
31
|
const interaction = useInteractionTokens();
|
|
@@ -31,12 +36,15 @@ const Textarea = React.forwardRef(({ className, size = 'default', placeholderTex
|
|
|
31
36
|
? visual.textareaMinHeightLg
|
|
32
37
|
: visual.textareaMinHeightDefault;
|
|
33
38
|
const style = {
|
|
39
|
+
...typographyStyle(visual, TEXTAREA_TEXT_ROLE[size ?? 'default'] ?? 'label'),
|
|
34
40
|
minHeight,
|
|
41
|
+
borderWidth: visual.borderWidthControl,
|
|
42
|
+
borderRadius: visual.radiusLg,
|
|
43
|
+
paddingHorizontal: visual.controlPaddingXDefault,
|
|
44
|
+
paddingVertical: visual.controlPaddingYDefault,
|
|
35
45
|
...(props.editable === false ? { opacity: interaction.disabledOpacity } : null),
|
|
36
46
|
};
|
|
37
|
-
return (_jsx(TextInput, { ref: ref, className: cn(textareaVariants({ size }),
|
|
47
|
+
return (_jsx(TextInput, { ref: ref, className: cn(textareaVariants({ size }), focusRing, className), style: style, multiline: true, textAlignVertical: "top", placeholderTextColor: placeholderTextColor ?? colors.placeholder, ...props }));
|
|
38
48
|
});
|
|
39
49
|
Textarea.displayName = 'Textarea';
|
|
40
|
-
// ─── Exports ─────────────────────────────────────────────────
|
|
41
50
|
export { Textarea, textareaVariants };
|
|
42
|
-
//# sourceMappingURL=textarea.js.map
|
|
@@ -22,14 +22,14 @@ export declare function useToast(): ToastContextValue;
|
|
|
22
22
|
export interface ToastProviderProps {
|
|
23
23
|
children: React.ReactNode;
|
|
24
24
|
}
|
|
25
|
-
export declare function ToastProvider({ children }: ToastProviderProps):
|
|
25
|
+
export declare function ToastProvider({ children }: ToastProviderProps): React.JSX.Element;
|
|
26
26
|
declare const toastVariants: import("tailwind-variants").TVReturnType<{
|
|
27
27
|
variant: {
|
|
28
28
|
default: string;
|
|
29
29
|
destructive: string;
|
|
30
30
|
success: string;
|
|
31
31
|
};
|
|
32
|
-
}, undefined, "w-full flex-row items-center justify-between
|
|
32
|
+
}, undefined, "w-full flex-row items-center justify-between border", import("tailwind-variants/dist/config.js").TVConfig<{
|
|
33
33
|
variant: {
|
|
34
34
|
default: string;
|
|
35
35
|
destructive: string;
|
|
@@ -53,7 +53,7 @@ declare const toastVariants: import("tailwind-variants").TVReturnType<{
|
|
|
53
53
|
destructive: string;
|
|
54
54
|
success: string;
|
|
55
55
|
};
|
|
56
|
-
}, undefined, "w-full flex-row items-center justify-between
|
|
56
|
+
}, undefined, "w-full flex-row items-center justify-between border", import("tailwind-variants/dist/config.js").TVConfig<{
|
|
57
57
|
variant: {
|
|
58
58
|
default: string;
|
|
59
59
|
destructive: string;
|
|
@@ -70,10 +70,9 @@ export interface ToastProps extends ViewProps, VariantProps<typeof toastVariants
|
|
|
70
70
|
toast: ToastData;
|
|
71
71
|
onDismiss: () => void;
|
|
72
72
|
}
|
|
73
|
-
declare function Toast({ toast: toastData, onDismiss, className, ...props }: ToastProps):
|
|
73
|
+
declare function Toast({ toast: toastData, onDismiss, className, style, ...props }: ToastProps): React.JSX.Element;
|
|
74
74
|
export interface ToastContainerProps extends ViewProps {
|
|
75
75
|
position?: 'top' | 'bottom';
|
|
76
76
|
}
|
|
77
|
-
export declare function ToastContainer({ position, className, ...props }: ToastContainerProps):
|
|
77
|
+
export declare function ToastContainer({ position, className, style, ...props }: ToastContainerProps): React.JSX.Element;
|
|
78
78
|
export { Toast, toastVariants };
|
|
79
|
-
//# sourceMappingURL=toast.d.ts.map
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useCallback, useContext, useEffect, useState } from 'react';
|
|
2
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
|
3
3
|
import { Pressable, View } from 'react-native';
|
|
4
4
|
import Animated, { SlideInUp, SlideOutUp } from 'react-native-reanimated';
|
|
5
5
|
import { Text } from '../text';
|
|
6
6
|
import { cn } from '../../lib/cn';
|
|
7
7
|
import { tv } from '../../lib/tv';
|
|
8
|
-
|
|
8
|
+
import { useVisualTokens } from '../../lib/visual-tokens';
|
|
9
|
+
import { useThemeColors } from '../../lib/theme-colors';
|
|
10
|
+
import { shadowStyle, surfacePadding, surfaceRadius, typographyStyle } from '../../lib/recipes';
|
|
9
11
|
const ToastContext = createContext(null);
|
|
10
12
|
export function useToast() {
|
|
11
13
|
const context = useContext(ToastContext);
|
|
@@ -15,6 +17,16 @@ export function useToast() {
|
|
|
15
17
|
return context;
|
|
16
18
|
}
|
|
17
19
|
let toastId = 0;
|
|
20
|
+
const TEXT_COLOR_BY_VARIANT = {
|
|
21
|
+
default: 'text-foreground',
|
|
22
|
+
destructive: 'text-destructive-foreground',
|
|
23
|
+
success: 'text-success-foreground',
|
|
24
|
+
};
|
|
25
|
+
const DESCRIPTION_COLOR_BY_VARIANT = {
|
|
26
|
+
default: 'text-muted-foreground',
|
|
27
|
+
destructive: 'text-destructive-foreground-muted',
|
|
28
|
+
success: 'text-success-foreground-muted',
|
|
29
|
+
};
|
|
18
30
|
export function ToastProvider({ children }) {
|
|
19
31
|
const [toasts, setToasts] = useState([]);
|
|
20
32
|
const toast = useCallback((data) => {
|
|
@@ -28,11 +40,11 @@ export function ToastProvider({ children }) {
|
|
|
28
40
|
const dismissAll = useCallback(() => {
|
|
29
41
|
setToasts([]);
|
|
30
42
|
}, []);
|
|
31
|
-
|
|
43
|
+
const contextValue = useMemo(() => ({ toasts, toast, dismiss, dismissAll }), [dismiss, dismissAll, toast, toasts]);
|
|
44
|
+
return _jsx(ToastContext.Provider, { value: contextValue, children: children });
|
|
32
45
|
}
|
|
33
|
-
// ─── Toast Variants ──────────────────────────────────────────
|
|
34
46
|
const toastVariants = tv({
|
|
35
|
-
base: 'w-full flex-row items-center justify-between
|
|
47
|
+
base: 'w-full flex-row items-center justify-between border',
|
|
36
48
|
variants: {
|
|
37
49
|
variant: {
|
|
38
50
|
default: 'border-border bg-background',
|
|
@@ -44,36 +56,40 @@ const toastVariants = tv({
|
|
|
44
56
|
variant: 'default',
|
|
45
57
|
},
|
|
46
58
|
});
|
|
47
|
-
function Toast({ toast: toastData, onDismiss, className, ...props }) {
|
|
59
|
+
function Toast({ toast: toastData, onDismiss, className, style, ...props }) {
|
|
48
60
|
const { title, description, variant = 'default', duration = 4000, action } = toastData;
|
|
61
|
+
const visual = useVisualTokens();
|
|
62
|
+
const colors = useThemeColors();
|
|
49
63
|
useEffect(() => {
|
|
50
64
|
if (duration > 0) {
|
|
51
65
|
const timer = setTimeout(onDismiss, duration);
|
|
52
66
|
return () => clearTimeout(timer);
|
|
53
67
|
}
|
|
54
68
|
}, [duration, onDismiss]);
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const descColor = descColorByVariant[variant];
|
|
67
|
-
return (_jsxs(Animated.View, { entering: SlideInUp.duration(300), exiting: SlideOutUp.duration(200), className: cn(toastVariants({ variant }), className), ...props, children: [_jsxs(View, { className: "flex-1 gap-1", children: [title && _jsx(Text, { className: cn('text-sm font-semibold', textColor), children: title }), description && _jsx(Text, { className: cn('text-sm', descColor), children: description })] }), _jsxs(View, { className: "flex-row items-center gap-2", children: [action && (_jsx(Pressable, { onPress: () => {
|
|
69
|
+
const textColor = TEXT_COLOR_BY_VARIANT[variant];
|
|
70
|
+
const descColor = DESCRIPTION_COLOR_BY_VARIANT[variant];
|
|
71
|
+
return (_jsxs(Animated.View, { entering: SlideInUp.duration(300), exiting: SlideOutUp.duration(200), className: cn(toastVariants({ variant }), className), style: [
|
|
72
|
+
{
|
|
73
|
+
borderRadius: surfaceRadius(visual, 'lg'),
|
|
74
|
+
borderWidth: visual.borderWidthHairline,
|
|
75
|
+
padding: surfacePadding(visual, 'sm'),
|
|
76
|
+
},
|
|
77
|
+
shadowStyle(visual, colors, 'lg'),
|
|
78
|
+
style,
|
|
79
|
+
], ...props, children: [_jsxs(View, { className: "flex-1 gap-1", children: [title && (_jsx(Text, { className: cn('font-semibold', textColor), style: typographyStyle(visual, 'label'), children: title })), description && (_jsx(Text, { className: cn(descColor), style: typographyStyle(visual, 'label'), children: description }))] }), _jsxs(View, { className: "flex-row items-center gap-2", children: [action && (_jsx(Pressable, { accessibilityRole: "button", onPress: () => {
|
|
68
80
|
action.onPress();
|
|
69
81
|
onDismiss();
|
|
70
|
-
}, className: "
|
|
82
|
+
}, className: "border border-border", style: {
|
|
83
|
+
borderRadius: visual.radiusMd,
|
|
84
|
+
borderWidth: visual.borderWidthControl,
|
|
85
|
+
paddingHorizontal: visual.controlPaddingXSm,
|
|
86
|
+
paddingVertical: visual.controlPaddingYSm,
|
|
87
|
+
}, children: _jsx(Text, { className: cn('font-medium', textColor), style: typographyStyle(visual, 'label'), children: action.label }) })), _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: "Dismiss", onPress: onDismiss, className: "p-1", children: _jsx(Text, { className: cn(textColor), style: typographyStyle(visual, 'emphasis'), children: "\u00D7" }) })] })] }));
|
|
71
88
|
}
|
|
72
|
-
export function ToastContainer({ position = 'top', className, ...props }) {
|
|
89
|
+
export function ToastContainer({ position = 'top', className, style, ...props }) {
|
|
73
90
|
const { toasts, dismiss } = useToast();
|
|
91
|
+
const visual = useVisualTokens();
|
|
74
92
|
const positionClass = position === 'top' ? 'top-0' : 'bottom-0';
|
|
75
|
-
return (_jsx(View, { className: cn('absolute left-0 right-0 z-50
|
|
93
|
+
return (_jsx(View, { className: cn('absolute left-0 right-0 z-50 py-2', positionClass, className), style: [{ paddingHorizontal: visual.surfacePaddingSm }, style], pointerEvents: "box-none", ...props, children: toasts.map((toast) => (_jsx(View, { className: "mb-2", children: _jsx(Toast, { toast: toast, onDismiss: () => dismiss(toast.id) }) }, toast.id))) }));
|
|
76
94
|
}
|
|
77
|
-
// ─── Exports ─────────────────────────────────────────────────
|
|
78
95
|
export { Toast, toastVariants };
|
|
79
|
-
//# sourceMappingURL=toast.js.map
|
|
@@ -15,7 +15,7 @@ declare const toggleVariants: import("tailwind-variants").TVReturnType<{
|
|
|
15
15
|
true: string;
|
|
16
16
|
false: string;
|
|
17
17
|
};
|
|
18
|
-
}, undefined, "inline-flex items-center justify-center
|
|
18
|
+
}, undefined, "inline-flex items-center justify-center active:bg-accent", import("tailwind-variants/dist/config.js").TVConfig<{
|
|
19
19
|
variant: {
|
|
20
20
|
default: string;
|
|
21
21
|
outline: string;
|
|
@@ -71,7 +71,7 @@ declare const toggleVariants: import("tailwind-variants").TVReturnType<{
|
|
|
71
71
|
true: string;
|
|
72
72
|
false: string;
|
|
73
73
|
};
|
|
74
|
-
}, undefined, "inline-flex items-center justify-center
|
|
74
|
+
}, undefined, "inline-flex items-center justify-center active:bg-accent", import("tailwind-variants/dist/config.js").TVConfig<{
|
|
75
75
|
variant: {
|
|
76
76
|
default: string;
|
|
77
77
|
outline: string;
|
|
@@ -110,7 +110,7 @@ declare const toggleTextVariants: import("tailwind-variants").TVReturnType<{
|
|
|
110
110
|
sm: string;
|
|
111
111
|
lg: string;
|
|
112
112
|
};
|
|
113
|
-
}, undefined, "
|
|
113
|
+
}, undefined, "font-medium", import("tailwind-variants/dist/config.js").TVConfig<{
|
|
114
114
|
pressed: {
|
|
115
115
|
true: string;
|
|
116
116
|
false: string;
|
|
@@ -150,7 +150,7 @@ declare const toggleTextVariants: import("tailwind-variants").TVReturnType<{
|
|
|
150
150
|
sm: string;
|
|
151
151
|
lg: string;
|
|
152
152
|
};
|
|
153
|
-
}, undefined, "
|
|
153
|
+
}, undefined, "font-medium", import("tailwind-variants/dist/config.js").TVConfig<{
|
|
154
154
|
pressed: {
|
|
155
155
|
true: string;
|
|
156
156
|
false: string;
|
|
@@ -183,13 +183,12 @@ export interface ToggleProps extends Omit<PressableProps, 'children'> {
|
|
|
183
183
|
export interface ToggleTextProps extends TextProps {
|
|
184
184
|
className?: string;
|
|
185
185
|
}
|
|
186
|
-
declare function Toggle({ pressed: controlledPressed, defaultPressed, onPressedChange, variant, size, className, children, ...props }: ToggleProps):
|
|
186
|
+
declare function Toggle({ pressed: controlledPressed, defaultPressed, onPressedChange, variant, size, className, children, style: styleProp, ...props }: ToggleProps): React.JSX.Element;
|
|
187
187
|
declare namespace Toggle {
|
|
188
188
|
var displayName: string;
|
|
189
189
|
}
|
|
190
|
-
declare function ToggleText({ className, ...props }: ToggleTextProps):
|
|
190
|
+
declare function ToggleText({ className, style, ...props }: ToggleTextProps): React.JSX.Element;
|
|
191
191
|
declare namespace ToggleText {
|
|
192
192
|
var displayName: string;
|
|
193
193
|
}
|
|
194
194
|
export { Toggle, ToggleText, toggleVariants, toggleTextVariants };
|
|
195
|
-
//# sourceMappingURL=toggle.d.ts.map
|
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import React, { createContext, useContext } from 'react';
|
|
2
|
+
import React, { createContext, useContext, useMemo } from 'react';
|
|
3
3
|
import { Pressable, Text } from 'react-native';
|
|
4
4
|
import { cn } from '../../lib/cn';
|
|
5
|
+
import { focusRing } from '../../lib/focus-ring';
|
|
5
6
|
import { tv } from '../../lib/tv';
|
|
7
|
+
import { useVisualTokens } from '../../lib/visual-tokens';
|
|
8
|
+
import { controlRecipe, typographyStyle } from '../../lib/recipes';
|
|
6
9
|
const ToggleContext = createContext({
|
|
7
10
|
pressed: false,
|
|
8
11
|
variant: 'default',
|
|
9
12
|
size: 'default',
|
|
10
13
|
});
|
|
11
|
-
// ─── Variants ────────────────────────────────────────────────
|
|
12
14
|
const toggleVariants = tv({
|
|
13
|
-
base: 'inline-flex items-center justify-center
|
|
15
|
+
base: 'inline-flex items-center justify-center active:bg-accent',
|
|
14
16
|
variants: {
|
|
15
17
|
variant: {
|
|
16
18
|
default: 'bg-transparent',
|
|
17
19
|
outline: 'border border-input bg-transparent',
|
|
18
20
|
},
|
|
19
21
|
size: {
|
|
20
|
-
default: '
|
|
21
|
-
sm: '
|
|
22
|
-
lg: '
|
|
22
|
+
default: '',
|
|
23
|
+
sm: '',
|
|
24
|
+
lg: '',
|
|
23
25
|
},
|
|
24
26
|
pressed: {
|
|
25
27
|
true: 'bg-accent',
|
|
@@ -32,17 +34,22 @@ const toggleVariants = tv({
|
|
|
32
34
|
pressed: false,
|
|
33
35
|
},
|
|
34
36
|
});
|
|
37
|
+
const TOGGLE_TEXT_ROLE = {
|
|
38
|
+
default: 'label',
|
|
39
|
+
sm: 'caption',
|
|
40
|
+
lg: 'body',
|
|
41
|
+
};
|
|
35
42
|
const toggleTextVariants = tv({
|
|
36
|
-
base: '
|
|
43
|
+
base: 'font-medium',
|
|
37
44
|
variants: {
|
|
38
45
|
pressed: {
|
|
39
46
|
true: 'text-accent-foreground',
|
|
40
47
|
false: 'text-muted-foreground',
|
|
41
48
|
},
|
|
42
49
|
size: {
|
|
43
|
-
default: '
|
|
44
|
-
sm: '
|
|
45
|
-
lg: '
|
|
50
|
+
default: '',
|
|
51
|
+
sm: '',
|
|
52
|
+
lg: '',
|
|
46
53
|
},
|
|
47
54
|
},
|
|
48
55
|
defaultVariants: {
|
|
@@ -50,22 +57,31 @@ const toggleTextVariants = tv({
|
|
|
50
57
|
size: 'default',
|
|
51
58
|
},
|
|
52
59
|
});
|
|
53
|
-
|
|
54
|
-
function Toggle({ pressed: controlledPressed, defaultPressed = false, onPressedChange, variant = 'default', size = 'default', className, children, ...props }) {
|
|
60
|
+
function Toggle({ pressed: controlledPressed, defaultPressed = false, onPressedChange, variant = 'default', size = 'default', className, children, style: styleProp, ...props }) {
|
|
55
61
|
const [internalPressed, setInternalPressed] = React.useState(defaultPressed);
|
|
56
62
|
const pressed = controlledPressed ?? internalPressed;
|
|
63
|
+
const visual = useVisualTokens();
|
|
57
64
|
const handlePress = () => {
|
|
58
65
|
const next = !pressed;
|
|
59
66
|
setInternalPressed(next);
|
|
60
67
|
onPressedChange?.(next);
|
|
61
68
|
};
|
|
62
|
-
|
|
69
|
+
const tokenStyle = {
|
|
70
|
+
...controlRecipe(visual, size ?? 'default'),
|
|
71
|
+
...(variant === 'outline' ? { borderWidth: visual.borderWidthControl } : null),
|
|
72
|
+
};
|
|
73
|
+
const contextValue = useMemo(() => ({ pressed, variant, size }), [pressed, size, variant]);
|
|
74
|
+
return (_jsx(ToggleContext.Provider, { value: contextValue, children: _jsx(Pressable, { className: cn(toggleVariants({ variant, size, pressed }), focusRing, className), style: (state) => [
|
|
75
|
+
tokenStyle,
|
|
76
|
+
typeof styleProp === 'function' ? styleProp(state) : styleProp,
|
|
77
|
+
], onPress: handlePress, accessibilityRole: "button", accessibilityState: { selected: pressed }, ...props, children: children }) }));
|
|
63
78
|
}
|
|
64
|
-
function ToggleText({ className, ...props }) {
|
|
79
|
+
function ToggleText({ className, style, ...props }) {
|
|
65
80
|
const { pressed, size } = useContext(ToggleContext);
|
|
66
|
-
|
|
81
|
+
const visual = useVisualTokens();
|
|
82
|
+
const typography = typographyStyle(visual, TOGGLE_TEXT_ROLE[size ?? 'default'] ?? 'label');
|
|
83
|
+
return (_jsx(Text, { className: cn(toggleTextVariants({ pressed, size }), className), style: [typography, style], ...props }));
|
|
67
84
|
}
|
|
68
85
|
Toggle.displayName = 'Toggle';
|
|
69
86
|
ToggleText.displayName = 'ToggleText';
|
|
70
87
|
export { Toggle, ToggleText, toggleVariants, toggleTextVariants };
|
|
71
|
-
//# sourceMappingURL=toggle.js.map
|