react-native-platform-components 1.3.0 → 1.5.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/PlatformComponents.podspec +1 -1
- package/README.md +47 -51
- package/android/src/main/java/com/platformcomponents/PCButtonGroupView.kt +664 -0
- package/android/src/main/java/com/platformcomponents/PCButtonGroupViewManager.kt +241 -0
- package/android/src/main/java/com/platformcomponents/PCButtonSupport.kt +159 -0
- package/android/src/main/java/com/platformcomponents/PCButtonView.kt +527 -0
- package/android/src/main/java/com/platformcomponents/PCButtonViewManager.kt +204 -0
- package/android/src/main/java/com/platformcomponents/PCContextMenuView.kt +41 -151
- package/android/src/main/java/com/platformcomponents/PCContextMenuViewManager.kt +7 -63
- package/android/src/main/java/com/platformcomponents/PCDatePickerView.kt +310 -115
- package/android/src/main/java/com/platformcomponents/PCDatePickerViewManager.kt +23 -3
- package/android/src/main/java/com/platformcomponents/PCExpressive.kt +112 -0
- package/android/src/main/java/com/platformcomponents/PCFloatingActionButtonView.kt +485 -0
- package/android/src/main/java/com/platformcomponents/PCFloatingActionButtonViewManager.kt +109 -0
- package/android/src/main/java/com/platformcomponents/PCFloatingToolbarView.kt +247 -0
- package/android/src/main/java/com/platformcomponents/PCFloatingToolbarViewManager.kt +73 -0
- package/android/src/main/java/com/platformcomponents/PCHaptics.kt +46 -0
- package/android/src/main/java/com/platformcomponents/PCImageLoader.kt +42 -7
- package/android/src/main/java/com/platformcomponents/PCLiquidGlassContainerView.kt +32 -0
- package/android/src/main/java/com/platformcomponents/PCLiquidGlassContainerViewManager.kt +31 -0
- package/android/src/main/java/com/platformcomponents/PCLiquidGlassView.kt +32 -6
- package/android/src/main/java/com/platformcomponents/PCLiquidGlassViewManager.kt +4 -0
- package/android/src/main/java/com/platformcomponents/PCMenuSupport.kt +280 -0
- package/android/src/main/java/com/platformcomponents/PCNavigationBarSupport.kt +332 -0
- package/android/src/main/java/com/platformcomponents/PCNavigationRailView.kt +448 -0
- package/android/src/main/java/com/platformcomponents/PCNavigationRailViewManager.kt +176 -0
- package/android/src/main/java/com/platformcomponents/PCSegmentedControlView.kt +35 -17
- package/android/src/main/java/com/platformcomponents/PCSegmentedControlViewManager.kt +20 -3
- package/android/src/main/java/com/platformcomponents/PCSelectionMenuView.kt +371 -39
- package/android/src/main/java/com/platformcomponents/PCSelectionMenuViewManager.kt +18 -4
- package/android/src/main/java/com/platformcomponents/PCTabBarView.kt +397 -0
- package/android/src/main/java/com/platformcomponents/PCTabBarViewManager.kt +182 -0
- package/android/src/main/java/com/platformcomponents/PCTextFieldView.kt +1393 -0
- package/android/src/main/java/com/platformcomponents/PCTextFieldViewManager.kt +354 -0
- package/android/src/main/java/com/platformcomponents/PCThemeSupport.kt +37 -0
- package/android/src/main/java/com/platformcomponents/PlatformComponentsPackage.kt +8 -0
- package/android/src/main/res/drawable/pc_ic_search.xml +12 -0
- package/android/src/main/res/values/attrs.xml +13 -0
- package/android/src/main/res/values/ids.xml +5 -0
- package/android/src/main/res/values/styles.xml +207 -0
- package/ios/PCButton.h +10 -0
- package/ios/PCButton.mm +311 -0
- package/ios/PCButtonGroup.h +10 -0
- package/ios/PCButtonGroup.mm +323 -0
- package/ios/PCButtonGroupView.swift +473 -0
- package/ios/PCButtonSupport.swift +312 -0
- package/ios/PCButtonView.swift +438 -0
- package/ios/PCConstants.swift +23 -2
- package/ios/PCContextMenu.mm +28 -110
- package/ios/PCContextMenu.swift +106 -167
- package/ios/PCDatePicker.mm +21 -9
- package/ios/PCDatePickerView.swift +94 -20
- package/ios/PCFloatingActionButton.h +10 -0
- package/ios/PCFloatingActionButton.mm +177 -0
- package/ios/PCFloatingActionButtonView.swift +426 -0
- package/ios/PCFloatingToolbar.h +10 -0
- package/ios/PCFloatingToolbar.mm +103 -0
- package/ios/PCFloatingToolbarView.swift +336 -0
- package/ios/PCHaptics.swift +91 -0
- package/ios/PCImageLoader.swift +76 -12
- package/ios/PCLiquidGlass.mm +36 -0
- package/ios/PCLiquidGlass.swift +221 -114
- package/ios/PCLiquidGlassContainer.h +10 -0
- package/ios/PCLiquidGlassContainer.mm +84 -0
- package/ios/PCLiquidGlassContainer.swift +69 -0
- package/ios/PCMenuItems.h +76 -0
- package/ios/PCMenuSupport.swift +350 -0
- package/ios/PCNavigationRail.h +10 -0
- package/ios/PCNavigationRail.mm +270 -0
- package/ios/PCNavigationRailView.swift +415 -0
- package/ios/PCSegmentedControl.mm +17 -2
- package/ios/PCSegmentedControl.swift +57 -7
- package/ios/PCSelectionMenu.mm +36 -8
- package/ios/PCSelectionMenu.swift +224 -48
- package/ios/PCTabBar.h +10 -0
- package/ios/PCTabBar.mm +285 -0
- package/ios/PCTabBarAccessory.h +10 -0
- package/ios/PCTabBarAccessory.mm +93 -0
- package/ios/PCTabBarAccessoryView.swift +96 -0
- package/ios/PCTabBarView.swift +671 -0
- package/ios/PCTextField.h +10 -0
- package/ios/PCTextField.mm +546 -0
- package/ios/PCTextFieldView.swift +1558 -0
- package/lib/commonjs/Button.js +149 -0
- package/lib/commonjs/Button.js.map +1 -0
- package/lib/commonjs/ButtonGroup.js +109 -0
- package/lib/commonjs/ButtonGroup.js.map +1 -0
- package/lib/commonjs/ButtonGroupNativeComponent.ts +191 -0
- package/lib/commonjs/ButtonNativeComponent.ts +192 -0
- package/lib/commonjs/ContextMenu.js +9 -48
- package/lib/commonjs/ContextMenu.js.map +1 -1
- package/lib/commonjs/ContextMenuNativeComponent.ts +47 -49
- package/lib/commonjs/DatePicker.js +98 -2
- package/lib/commonjs/DatePicker.js.map +1 -1
- package/lib/commonjs/DatePickerNativeComponent.ts +19 -2
- package/lib/commonjs/FloatingActionButton.js +60 -0
- package/lib/commonjs/FloatingActionButton.js.map +1 -0
- package/lib/commonjs/FloatingActionButtonNativeComponent.ts +58 -0
- package/lib/commonjs/FloatingToolbar.js +77 -0
- package/lib/commonjs/FloatingToolbar.js.map +1 -0
- package/lib/commonjs/FloatingToolbarNativeComponent.ts +47 -0
- package/lib/commonjs/LiquidGlass.js +7 -1
- package/lib/commonjs/LiquidGlass.js.map +1 -1
- package/lib/commonjs/LiquidGlassContainer.js +32 -0
- package/lib/commonjs/LiquidGlassContainer.js.map +1 -0
- package/lib/commonjs/LiquidGlassContainerNativeComponent.ts +17 -0
- package/lib/commonjs/LiquidGlassNativeComponent.ts +8 -0
- package/lib/commonjs/NavigationRail.js +104 -0
- package/lib/commonjs/NavigationRail.js.map +1 -0
- package/lib/commonjs/NavigationRailNativeComponent.ts +107 -0
- package/lib/commonjs/PlatformComponentsProvider.js +18 -0
- package/lib/commonjs/PlatformComponentsProvider.js.map +1 -0
- package/lib/commonjs/SegmentedControl.js +18 -85
- package/lib/commonjs/SegmentedControl.js.map +1 -1
- package/lib/commonjs/SegmentedControlNativeComponent.ts +14 -0
- package/lib/commonjs/SelectionMenu.js +27 -3
- package/lib/commonjs/SelectionMenu.js.map +1 -1
- package/lib/commonjs/SelectionMenuNativeComponent.ts +26 -4
- package/lib/commonjs/SplitButton.js +98 -0
- package/lib/commonjs/SplitButton.js.map +1 -0
- package/lib/commonjs/TabBar.js +203 -0
- package/lib/commonjs/TabBar.js.map +1 -0
- package/lib/commonjs/TabBarAccessoryNativeComponent.ts +19 -0
- package/lib/commonjs/TabBarNativeComponent.ts +145 -0
- package/lib/commonjs/TextField.js +358 -0
- package/lib/commonjs/TextField.js.map +1 -0
- package/lib/commonjs/TextFieldNativeComponent.ts +324 -0
- package/lib/commonjs/focusRegistry.js +79 -0
- package/lib/commonjs/focusRegistry.js.map +1 -0
- package/lib/commonjs/haptics.js +2 -0
- package/lib/commonjs/haptics.js.map +1 -0
- package/lib/commonjs/icons.js +106 -0
- package/lib/commonjs/icons.js.map +1 -0
- package/lib/commonjs/index.js +143 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +157 -63
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/jest.js +910 -0
- package/lib/commonjs/jest.js.map +1 -0
- package/lib/commonjs/labelStyle.js +27 -0
- package/lib/commonjs/labelStyle.js.map +1 -0
- package/lib/commonjs/menuItems.js +68 -0
- package/lib/commonjs/menuItems.js.map +1 -0
- package/lib/commonjs/reactNativeInternals.d.js +2 -0
- package/lib/commonjs/reactNativeInternals.d.js.map +1 -0
- package/lib/commonjs/selectionIdentifiers.js +18 -0
- package/lib/commonjs/selectionIdentifiers.js.map +1 -0
- package/lib/commonjs/submitBehavior.js +19 -0
- package/lib/commonjs/submitBehavior.js.map +1 -0
- package/lib/commonjs/tabItems.js +49 -0
- package/lib/commonjs/tabItems.js.map +1 -0
- package/lib/commonjs/web/Button.js +170 -0
- package/lib/commonjs/web/Button.js.map +1 -0
- package/lib/commonjs/web/ButtonGroup.js +119 -0
- package/lib/commonjs/web/ButtonGroup.js.map +1 -0
- package/lib/commonjs/web/DatePicker.js +168 -0
- package/lib/commonjs/web/DatePicker.js.map +1 -0
- package/lib/commonjs/web/DateRangePicker.js +137 -0
- package/lib/commonjs/web/DateRangePicker.js.map +1 -0
- package/lib/commonjs/web/Dialog.js +54 -0
- package/lib/commonjs/web/Dialog.js.map +1 -0
- package/lib/commonjs/web/FloatingActionButton.js +98 -0
- package/lib/commonjs/web/FloatingActionButton.js.map +1 -0
- package/lib/commonjs/web/Icon.js +34 -0
- package/lib/commonjs/web/Icon.js.map +1 -0
- package/lib/commonjs/web/NativeTheme.js +28 -0
- package/lib/commonjs/web/NativeTheme.js.map +1 -0
- package/lib/commonjs/web/NavigationRail.js +139 -0
- package/lib/commonjs/web/NavigationRail.js.map +1 -0
- package/lib/commonjs/web/PlatformComponentsProvider.js +51 -0
- package/lib/commonjs/web/PlatformComponentsProvider.js.map +1 -0
- package/lib/commonjs/web/SegmentedControl.js +117 -0
- package/lib/commonjs/web/SegmentedControl.js.map +1 -0
- package/lib/commonjs/web/SelectionMenu.js +142 -0
- package/lib/commonjs/web/SelectionMenu.js.map +1 -0
- package/lib/commonjs/web/SplitButton.js +35 -0
- package/lib/commonjs/web/SplitButton.js.map +1 -0
- package/lib/commonjs/web/TabBar.js +131 -0
- package/lib/commonjs/web/TabBar.js.map +1 -0
- package/lib/commonjs/web/TextField.js +322 -0
- package/lib/commonjs/web/TextField.js.map +1 -0
- package/lib/commonjs/web/components.js +36 -0
- package/lib/commonjs/web/components.js.map +1 -0
- package/lib/commonjs/web/containers.js +121 -0
- package/lib/commonjs/web/containers.js.map +1 -0
- package/lib/commonjs/web/dateInput.js +116 -0
- package/lib/commonjs/web/dateInput.js.map +1 -0
- package/lib/commonjs/web/shared.js +192 -0
- package/lib/commonjs/web/shared.js.map +1 -0
- package/lib/commonjs/webComponents.js +6 -0
- package/lib/commonjs/webComponents.js.map +1 -0
- package/lib/module/Button.js +142 -0
- package/lib/module/Button.js.map +1 -0
- package/lib/module/ButtonGroup.js +102 -0
- package/lib/module/ButtonGroup.js.map +1 -0
- package/lib/module/ButtonGroupNativeComponent.ts +191 -0
- package/lib/module/ButtonNativeComponent.ts +192 -0
- package/lib/module/ContextMenu.js +9 -48
- package/lib/module/ContextMenu.js.map +1 -1
- package/lib/module/ContextMenuNativeComponent.ts +47 -49
- package/lib/module/DatePicker.js +98 -4
- package/lib/module/DatePicker.js.map +1 -1
- package/lib/module/DatePickerNativeComponent.ts +19 -2
- package/lib/module/FloatingActionButton.js +53 -0
- package/lib/module/FloatingActionButton.js.map +1 -0
- package/lib/module/FloatingActionButtonNativeComponent.ts +58 -0
- package/lib/module/FloatingToolbar.js +70 -0
- package/lib/module/FloatingToolbar.js.map +1 -0
- package/lib/module/FloatingToolbarNativeComponent.ts +47 -0
- package/lib/module/LiquidGlass.js +7 -1
- package/lib/module/LiquidGlass.js.map +1 -1
- package/lib/module/LiquidGlassContainer.js +26 -0
- package/lib/module/LiquidGlassContainer.js.map +1 -0
- package/lib/module/LiquidGlassContainerNativeComponent.ts +17 -0
- package/lib/module/LiquidGlassNativeComponent.ts +8 -0
- package/lib/module/NavigationRail.js +99 -0
- package/lib/module/NavigationRail.js.map +1 -0
- package/lib/module/NavigationRailNativeComponent.ts +107 -0
- package/lib/module/PlatformComponentsProvider.js +13 -0
- package/lib/module/PlatformComponentsProvider.js.map +1 -0
- package/lib/module/SegmentedControl.js +18 -85
- package/lib/module/SegmentedControl.js.map +1 -1
- package/lib/module/SegmentedControlNativeComponent.ts +14 -0
- package/lib/module/SelectionMenu.js +27 -3
- package/lib/module/SelectionMenu.js.map +1 -1
- package/lib/module/SelectionMenuNativeComponent.ts +26 -4
- package/lib/module/SplitButton.js +91 -0
- package/lib/module/SplitButton.js.map +1 -0
- package/lib/module/TabBar.js +196 -0
- package/lib/module/TabBar.js.map +1 -0
- package/lib/module/TabBarAccessoryNativeComponent.ts +19 -0
- package/lib/module/TabBarNativeComponent.ts +145 -0
- package/lib/module/TextField.js +352 -0
- package/lib/module/TextField.js.map +1 -0
- package/lib/module/TextFieldNativeComponent.ts +324 -0
- package/lib/module/focusRegistry.js +75 -0
- package/lib/module/focusRegistry.js.map +1 -0
- package/lib/module/haptics.js +2 -0
- package/lib/module/haptics.js.map +1 -0
- package/lib/module/icons.js +101 -0
- package/lib/module/icons.js.map +1 -0
- package/lib/module/index.js +13 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +12 -59
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/jest.js +840 -0
- package/lib/module/jest.js.map +1 -0
- package/lib/module/labelStyle.js +23 -0
- package/lib/module/labelStyle.js.map +1 -0
- package/lib/module/menuItems.js +65 -0
- package/lib/module/menuItems.js.map +1 -0
- package/lib/module/reactNativeInternals.d.js +2 -0
- package/lib/module/reactNativeInternals.d.js.map +1 -0
- package/lib/module/selectionIdentifiers.js +14 -0
- package/lib/module/selectionIdentifiers.js.map +1 -0
- package/lib/module/submitBehavior.js +15 -0
- package/lib/module/submitBehavior.js.map +1 -0
- package/lib/module/tabItems.js +45 -0
- package/lib/module/tabItems.js.map +1 -0
- package/lib/module/web/Button.js +164 -0
- package/lib/module/web/Button.js.map +1 -0
- package/lib/module/web/ButtonGroup.js +113 -0
- package/lib/module/web/ButtonGroup.js.map +1 -0
- package/lib/module/web/DatePicker.js +162 -0
- package/lib/module/web/DatePicker.js.map +1 -0
- package/lib/module/web/DateRangePicker.js +131 -0
- package/lib/module/web/DateRangePicker.js.map +1 -0
- package/lib/module/web/Dialog.js +48 -0
- package/lib/module/web/Dialog.js.map +1 -0
- package/lib/module/web/FloatingActionButton.js +94 -0
- package/lib/module/web/FloatingActionButton.js.map +1 -0
- package/lib/module/web/Icon.js +29 -0
- package/lib/module/web/Icon.js.map +1 -0
- package/lib/module/web/NativeTheme.js +23 -0
- package/lib/module/web/NativeTheme.js.map +1 -0
- package/lib/module/web/NavigationRail.js +133 -0
- package/lib/module/web/NavigationRail.js.map +1 -0
- package/lib/module/web/PlatformComponentsProvider.js +44 -0
- package/lib/module/web/PlatformComponentsProvider.js.map +1 -0
- package/lib/module/web/SegmentedControl.js +112 -0
- package/lib/module/web/SegmentedControl.js.map +1 -0
- package/lib/module/web/SelectionMenu.js +137 -0
- package/lib/module/web/SelectionMenu.js.map +1 -0
- package/lib/module/web/SplitButton.js +30 -0
- package/lib/module/web/SplitButton.js.map +1 -0
- package/lib/module/web/TabBar.js +126 -0
- package/lib/module/web/TabBar.js.map +1 -0
- package/lib/module/web/TextField.js +316 -0
- package/lib/module/web/TextField.js.map +1 -0
- package/lib/module/web/components.js +33 -0
- package/lib/module/web/components.js.map +1 -0
- package/lib/module/web/containers.js +112 -0
- package/lib/module/web/containers.js.map +1 -0
- package/lib/module/web/dateInput.js +109 -0
- package/lib/module/web/dateInput.js.map +1 -0
- package/lib/module/web/shared.js +179 -0
- package/lib/module/web/shared.js.map +1 -0
- package/lib/module/webComponents.js +4 -0
- package/lib/module/webComponents.js.map +1 -0
- package/lib/typescript/commonjs/docs/sidebars.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/Button.d.ts +184 -0
- package/lib/typescript/commonjs/src/Button.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/ButtonGroup.d.ts +117 -0
- package/lib/typescript/commonjs/src/ButtonGroup.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/ButtonGroupNativeComponent.d.ts +154 -0
- package/lib/typescript/commonjs/src/ButtonGroupNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/ButtonNativeComponent.d.ts +148 -0
- package/lib/typescript/commonjs/src/ButtonNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/ContextMenu.d.ts +20 -33
- package/lib/typescript/commonjs/src/ContextMenu.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/ContextMenuNativeComponent.d.ts +45 -47
- package/lib/typescript/commonjs/src/ContextMenuNativeComponent.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/DatePicker.d.ts +74 -1
- package/lib/typescript/commonjs/src/DatePicker.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/DatePickerNativeComponent.d.ts +16 -1
- package/lib/typescript/commonjs/src/DatePickerNativeComponent.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/FloatingActionButton.d.ts +67 -0
- package/lib/typescript/commonjs/src/FloatingActionButton.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/FloatingActionButtonNativeComponent.d.ts +43 -0
- package/lib/typescript/commonjs/src/FloatingActionButtonNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/FloatingToolbar.d.ts +75 -0
- package/lib/typescript/commonjs/src/FloatingToolbar.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/FloatingToolbarNativeComponent.d.ts +36 -0
- package/lib/typescript/commonjs/src/FloatingToolbarNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/LiquidGlass.d.ts +17 -0
- package/lib/typescript/commonjs/src/LiquidGlass.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/LiquidGlassContainer.d.ts +27 -0
- package/lib/typescript/commonjs/src/LiquidGlassContainer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/LiquidGlassContainerNativeComponent.d.ts +13 -0
- package/lib/typescript/commonjs/src/LiquidGlassContainerNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/LiquidGlassNativeComponent.d.ts +7 -0
- package/lib/typescript/commonjs/src/LiquidGlassNativeComponent.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/NavigationRail.d.ts +86 -0
- package/lib/typescript/commonjs/src/NavigationRail.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/NavigationRailNativeComponent.d.ts +81 -0
- package/lib/typescript/commonjs/src/NavigationRailNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/PlatformComponentsProvider.d.ts +6 -0
- package/lib/typescript/commonjs/src/PlatformComponentsProvider.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/SegmentedControl.d.ts +35 -47
- package/lib/typescript/commonjs/src/SegmentedControl.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/SegmentedControlNativeComponent.d.ts +11 -0
- package/lib/typescript/commonjs/src/SegmentedControlNativeComponent.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/SelectionMenu.d.ts +44 -2
- package/lib/typescript/commonjs/src/SelectionMenu.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/SelectionMenuNativeComponent.d.ts +20 -4
- package/lib/typescript/commonjs/src/SelectionMenuNativeComponent.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/SplitButton.d.ts +83 -0
- package/lib/typescript/commonjs/src/SplitButton.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/TabBar.d.ts +144 -0
- package/lib/typescript/commonjs/src/TabBar.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/TabBarAccessoryNativeComponent.d.ts +13 -0
- package/lib/typescript/commonjs/src/TabBarAccessoryNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/TabBarNativeComponent.d.ts +110 -0
- package/lib/typescript/commonjs/src/TabBarNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/TextField.d.ts +332 -0
- package/lib/typescript/commonjs/src/TextField.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/TextFieldNativeComponent.d.ts +240 -0
- package/lib/typescript/commonjs/src/TextFieldNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/focusRegistry.d.ts +13 -0
- package/lib/typescript/commonjs/src/focusRegistry.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/haptics.d.ts +20 -0
- package/lib/typescript/commonjs/src/haptics.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/icons.d.ts +58 -0
- package/lib/typescript/commonjs/src/icons.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +13 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.web.d.ts +25 -133
- package/lib/typescript/commonjs/src/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/jest.d.ts +139 -0
- package/lib/typescript/commonjs/src/jest.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/labelStyle.d.ts +20 -0
- package/lib/typescript/commonjs/src/labelStyle.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/menuItems.d.ts +100 -0
- package/lib/typescript/commonjs/src/menuItems.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/selectionIdentifiers.d.ts +3 -0
- package/lib/typescript/commonjs/src/selectionIdentifiers.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/sharedTypes.d.ts +6 -1
- package/lib/typescript/commonjs/src/sharedTypes.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/submitBehavior.d.ts +9 -0
- package/lib/typescript/commonjs/src/submitBehavior.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/tabItems.d.ts +55 -0
- package/lib/typescript/commonjs/src/tabItems.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/Button.d.ts +9 -0
- package/lib/typescript/commonjs/src/web/Button.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/ButtonGroup.d.ts +11 -0
- package/lib/typescript/commonjs/src/web/ButtonGroup.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/DatePicker.d.ts +14 -0
- package/lib/typescript/commonjs/src/web/DatePicker.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/DateRangePicker.d.ts +11 -0
- package/lib/typescript/commonjs/src/web/DateRangePicker.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/Dialog.d.ts +12 -0
- package/lib/typescript/commonjs/src/web/Dialog.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/FloatingActionButton.d.ts +8 -0
- package/lib/typescript/commonjs/src/web/FloatingActionButton.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/Icon.d.ts +12 -0
- package/lib/typescript/commonjs/src/web/Icon.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/NativeTheme.d.ts +10 -0
- package/lib/typescript/commonjs/src/web/NativeTheme.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/NavigationRail.d.ts +8 -0
- package/lib/typescript/commonjs/src/web/NavigationRail.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/PlatformComponentsProvider.d.ts +10 -0
- package/lib/typescript/commonjs/src/web/PlatformComponentsProvider.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/SegmentedControl.d.ts +8 -0
- package/lib/typescript/commonjs/src/web/SegmentedControl.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/SelectionMenu.d.ts +10 -0
- package/lib/typescript/commonjs/src/web/SelectionMenu.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/SplitButton.d.ts +9 -0
- package/lib/typescript/commonjs/src/web/SplitButton.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/TabBar.d.ts +9 -0
- package/lib/typescript/commonjs/src/web/TabBar.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/TextField.d.ts +9 -0
- package/lib/typescript/commonjs/src/web/TextField.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/components.d.ts +17 -0
- package/lib/typescript/commonjs/src/web/components.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/containers.d.ts +24 -0
- package/lib/typescript/commonjs/src/web/containers.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/dateInput.d.ts +20 -0
- package/lib/typescript/commonjs/src/web/dateInput.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/shared.d.ts +43 -0
- package/lib/typescript/commonjs/src/web/shared.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/webComponents.d.ts +43 -0
- package/lib/typescript/commonjs/src/webComponents.d.ts.map +1 -0
- package/lib/typescript/module/docs/sidebars.d.ts.map +1 -1
- package/lib/typescript/module/src/Button.d.ts +184 -0
- package/lib/typescript/module/src/Button.d.ts.map +1 -0
- package/lib/typescript/module/src/ButtonGroup.d.ts +117 -0
- package/lib/typescript/module/src/ButtonGroup.d.ts.map +1 -0
- package/lib/typescript/module/src/ButtonGroupNativeComponent.d.ts +154 -0
- package/lib/typescript/module/src/ButtonGroupNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/ButtonNativeComponent.d.ts +148 -0
- package/lib/typescript/module/src/ButtonNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/ContextMenu.d.ts +20 -33
- package/lib/typescript/module/src/ContextMenu.d.ts.map +1 -1
- package/lib/typescript/module/src/ContextMenuNativeComponent.d.ts +45 -47
- package/lib/typescript/module/src/ContextMenuNativeComponent.d.ts.map +1 -1
- package/lib/typescript/module/src/DatePicker.d.ts +74 -1
- package/lib/typescript/module/src/DatePicker.d.ts.map +1 -1
- package/lib/typescript/module/src/DatePickerNativeComponent.d.ts +16 -1
- package/lib/typescript/module/src/DatePickerNativeComponent.d.ts.map +1 -1
- package/lib/typescript/module/src/FloatingActionButton.d.ts +67 -0
- package/lib/typescript/module/src/FloatingActionButton.d.ts.map +1 -0
- package/lib/typescript/module/src/FloatingActionButtonNativeComponent.d.ts +43 -0
- package/lib/typescript/module/src/FloatingActionButtonNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/FloatingToolbar.d.ts +75 -0
- package/lib/typescript/module/src/FloatingToolbar.d.ts.map +1 -0
- package/lib/typescript/module/src/FloatingToolbarNativeComponent.d.ts +36 -0
- package/lib/typescript/module/src/FloatingToolbarNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/LiquidGlass.d.ts +17 -0
- package/lib/typescript/module/src/LiquidGlass.d.ts.map +1 -1
- package/lib/typescript/module/src/LiquidGlassContainer.d.ts +27 -0
- package/lib/typescript/module/src/LiquidGlassContainer.d.ts.map +1 -0
- package/lib/typescript/module/src/LiquidGlassContainerNativeComponent.d.ts +13 -0
- package/lib/typescript/module/src/LiquidGlassContainerNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/LiquidGlassNativeComponent.d.ts +7 -0
- package/lib/typescript/module/src/LiquidGlassNativeComponent.d.ts.map +1 -1
- package/lib/typescript/module/src/NavigationRail.d.ts +86 -0
- package/lib/typescript/module/src/NavigationRail.d.ts.map +1 -0
- package/lib/typescript/module/src/NavigationRailNativeComponent.d.ts +81 -0
- package/lib/typescript/module/src/NavigationRailNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/PlatformComponentsProvider.d.ts +6 -0
- package/lib/typescript/module/src/PlatformComponentsProvider.d.ts.map +1 -0
- package/lib/typescript/module/src/SegmentedControl.d.ts +35 -47
- package/lib/typescript/module/src/SegmentedControl.d.ts.map +1 -1
- package/lib/typescript/module/src/SegmentedControlNativeComponent.d.ts +11 -0
- package/lib/typescript/module/src/SegmentedControlNativeComponent.d.ts.map +1 -1
- package/lib/typescript/module/src/SelectionMenu.d.ts +44 -2
- package/lib/typescript/module/src/SelectionMenu.d.ts.map +1 -1
- package/lib/typescript/module/src/SelectionMenuNativeComponent.d.ts +20 -4
- package/lib/typescript/module/src/SelectionMenuNativeComponent.d.ts.map +1 -1
- package/lib/typescript/module/src/SplitButton.d.ts +83 -0
- package/lib/typescript/module/src/SplitButton.d.ts.map +1 -0
- package/lib/typescript/module/src/TabBar.d.ts +144 -0
- package/lib/typescript/module/src/TabBar.d.ts.map +1 -0
- package/lib/typescript/module/src/TabBarAccessoryNativeComponent.d.ts +13 -0
- package/lib/typescript/module/src/TabBarAccessoryNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/TabBarNativeComponent.d.ts +110 -0
- package/lib/typescript/module/src/TabBarNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/TextField.d.ts +332 -0
- package/lib/typescript/module/src/TextField.d.ts.map +1 -0
- package/lib/typescript/module/src/TextFieldNativeComponent.d.ts +240 -0
- package/lib/typescript/module/src/TextFieldNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/focusRegistry.d.ts +13 -0
- package/lib/typescript/module/src/focusRegistry.d.ts.map +1 -0
- package/lib/typescript/module/src/haptics.d.ts +20 -0
- package/lib/typescript/module/src/haptics.d.ts.map +1 -0
- package/lib/typescript/module/src/icons.d.ts +58 -0
- package/lib/typescript/module/src/icons.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +13 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/index.web.d.ts +25 -133
- package/lib/typescript/module/src/index.web.d.ts.map +1 -1
- package/lib/typescript/module/src/jest.d.ts +139 -0
- package/lib/typescript/module/src/jest.d.ts.map +1 -0
- package/lib/typescript/module/src/labelStyle.d.ts +20 -0
- package/lib/typescript/module/src/labelStyle.d.ts.map +1 -0
- package/lib/typescript/module/src/menuItems.d.ts +100 -0
- package/lib/typescript/module/src/menuItems.d.ts.map +1 -0
- package/lib/typescript/module/src/selectionIdentifiers.d.ts +3 -0
- package/lib/typescript/module/src/selectionIdentifiers.d.ts.map +1 -0
- package/lib/typescript/module/src/sharedTypes.d.ts +6 -1
- package/lib/typescript/module/src/sharedTypes.d.ts.map +1 -1
- package/lib/typescript/module/src/submitBehavior.d.ts +9 -0
- package/lib/typescript/module/src/submitBehavior.d.ts.map +1 -0
- package/lib/typescript/module/src/tabItems.d.ts +55 -0
- package/lib/typescript/module/src/tabItems.d.ts.map +1 -0
- package/lib/typescript/module/src/web/Button.d.ts +9 -0
- package/lib/typescript/module/src/web/Button.d.ts.map +1 -0
- package/lib/typescript/module/src/web/ButtonGroup.d.ts +11 -0
- package/lib/typescript/module/src/web/ButtonGroup.d.ts.map +1 -0
- package/lib/typescript/module/src/web/DatePicker.d.ts +14 -0
- package/lib/typescript/module/src/web/DatePicker.d.ts.map +1 -0
- package/lib/typescript/module/src/web/DateRangePicker.d.ts +11 -0
- package/lib/typescript/module/src/web/DateRangePicker.d.ts.map +1 -0
- package/lib/typescript/module/src/web/Dialog.d.ts +12 -0
- package/lib/typescript/module/src/web/Dialog.d.ts.map +1 -0
- package/lib/typescript/module/src/web/FloatingActionButton.d.ts +8 -0
- package/lib/typescript/module/src/web/FloatingActionButton.d.ts.map +1 -0
- package/lib/typescript/module/src/web/Icon.d.ts +12 -0
- package/lib/typescript/module/src/web/Icon.d.ts.map +1 -0
- package/lib/typescript/module/src/web/NativeTheme.d.ts +10 -0
- package/lib/typescript/module/src/web/NativeTheme.d.ts.map +1 -0
- package/lib/typescript/module/src/web/NavigationRail.d.ts +8 -0
- package/lib/typescript/module/src/web/NavigationRail.d.ts.map +1 -0
- package/lib/typescript/module/src/web/PlatformComponentsProvider.d.ts +10 -0
- package/lib/typescript/module/src/web/PlatformComponentsProvider.d.ts.map +1 -0
- package/lib/typescript/module/src/web/SegmentedControl.d.ts +8 -0
- package/lib/typescript/module/src/web/SegmentedControl.d.ts.map +1 -0
- package/lib/typescript/module/src/web/SelectionMenu.d.ts +10 -0
- package/lib/typescript/module/src/web/SelectionMenu.d.ts.map +1 -0
- package/lib/typescript/module/src/web/SplitButton.d.ts +9 -0
- package/lib/typescript/module/src/web/SplitButton.d.ts.map +1 -0
- package/lib/typescript/module/src/web/TabBar.d.ts +9 -0
- package/lib/typescript/module/src/web/TabBar.d.ts.map +1 -0
- package/lib/typescript/module/src/web/TextField.d.ts +9 -0
- package/lib/typescript/module/src/web/TextField.d.ts.map +1 -0
- package/lib/typescript/module/src/web/components.d.ts +17 -0
- package/lib/typescript/module/src/web/components.d.ts.map +1 -0
- package/lib/typescript/module/src/web/containers.d.ts +24 -0
- package/lib/typescript/module/src/web/containers.d.ts.map +1 -0
- package/lib/typescript/module/src/web/dateInput.d.ts +20 -0
- package/lib/typescript/module/src/web/dateInput.d.ts.map +1 -0
- package/lib/typescript/module/src/web/shared.d.ts +43 -0
- package/lib/typescript/module/src/web/shared.d.ts.map +1 -0
- package/lib/typescript/module/src/webComponents.d.ts +43 -0
- package/lib/typescript/module/src/webComponents.d.ts.map +1 -0
- package/package.json +55 -4
- package/plugin/build/index.d.ts +3 -2
- package/plugin/build/index.d.ts.map +1 -1
- package/react-native.config.js +6 -0
- package/shared/PCButtonComponentDescriptors-custom.h +22 -0
- package/shared/PCButtonGroupComponentDescriptors-custom.h +22 -0
- package/shared/PCButtonGroupShadowNode-custom.cpp +48 -0
- package/shared/PCButtonGroupShadowNode-custom.h +55 -0
- package/shared/PCButtonGroupState-custom.h +61 -0
- package/shared/PCButtonShadowNode-custom.cpp +48 -0
- package/shared/PCButtonShadowNode-custom.h +55 -0
- package/shared/PCButtonState-custom.h +61 -0
- package/shared/PCFloatingActionButtonComponentDescriptors-custom.h +22 -0
- package/shared/PCFloatingActionButtonShadowNode-custom.cpp +48 -0
- package/shared/PCFloatingActionButtonShadowNode-custom.h +54 -0
- package/shared/PCFloatingActionButtonState-custom.h +61 -0
- package/shared/PCNavigationRailComponentDescriptors-custom.h +47 -0
- package/shared/PCNavigationRailShadowNode-custom.h +42 -0
- package/shared/PCNavigationRailState-custom.h +62 -0
- package/shared/PCTabBarComponentDescriptors-custom.h +22 -0
- package/shared/PCTabBarShadowNode-custom.cpp +54 -0
- package/shared/PCTabBarShadowNode-custom.h +54 -0
- package/shared/PCTabBarState-custom.h +62 -0
- package/shared/PCTextFieldComponentDescriptors-custom.h +22 -0
- package/shared/PCTextFieldShadowNode-custom.cpp +47 -0
- package/shared/PCTextFieldShadowNode-custom.h +55 -0
- package/shared/PCTextFieldState-custom.h +61 -0
- package/shared/react/renderer/components/PlatformComponentsViewSpec/ComponentDescriptors.h +6 -0
- package/src/Button.tsx +359 -0
- package/src/ButtonGroup.tsx +251 -0
- package/src/ButtonGroupNativeComponent.ts +191 -0
- package/src/ButtonNativeComponent.ts +192 -0
- package/src/ContextMenu.tsx +34 -81
- package/src/ContextMenuNativeComponent.ts +47 -49
- package/src/DatePicker.tsx +182 -4
- package/src/DatePickerNativeComponent.ts +19 -2
- package/src/FloatingActionButton.tsx +121 -0
- package/src/FloatingActionButtonNativeComponent.ts +58 -0
- package/src/FloatingToolbar.tsx +164 -0
- package/src/FloatingToolbarNativeComponent.ts +47 -0
- package/src/LiquidGlass.tsx +24 -1
- package/src/LiquidGlassContainer.tsx +42 -0
- package/src/LiquidGlassContainerNativeComponent.ts +17 -0
- package/src/LiquidGlassNativeComponent.ts +8 -0
- package/src/NavigationRail.tsx +203 -0
- package/src/NavigationRailNativeComponent.ts +107 -0
- package/src/PlatformComponentsProvider.tsx +15 -0
- package/src/SegmentedControl.tsx +57 -119
- package/src/SegmentedControlNativeComponent.ts +14 -0
- package/src/SelectionMenu.tsx +81 -6
- package/src/SelectionMenuNativeComponent.ts +26 -4
- package/src/SplitButton.tsx +198 -0
- package/src/TabBar.tsx +373 -0
- package/src/TabBarAccessoryNativeComponent.ts +19 -0
- package/src/TabBarNativeComponent.ts +145 -0
- package/src/TextField.tsx +908 -0
- package/src/TextFieldNativeComponent.ts +324 -0
- package/src/focusRegistry.ts +90 -0
- package/src/haptics.ts +31 -0
- package/src/icons.ts +143 -0
- package/src/index.tsx +13 -0
- package/src/index.web.tsx +53 -199
- package/src/jest.tsx +958 -0
- package/src/labelStyle.ts +36 -0
- package/src/menuItems.ts +152 -0
- package/src/reactNativeInternals.d.ts +22 -0
- package/src/selectionIdentifiers.ts +17 -0
- package/src/sharedTypes.ts +7 -1
- package/src/submitBehavior.ts +16 -0
- package/src/tabItems.ts +113 -0
- package/src/web/Button.tsx +201 -0
- package/src/web/ButtonGroup.tsx +154 -0
- package/src/web/DatePicker.tsx +204 -0
- package/src/web/DateRangePicker.tsx +135 -0
- package/src/web/Dialog.tsx +54 -0
- package/src/web/FloatingActionButton.tsx +76 -0
- package/src/web/Icon.tsx +33 -0
- package/src/web/NativeTheme.ts +23 -0
- package/src/web/NavigationRail.tsx +148 -0
- package/src/web/PlatformComponentsProvider.tsx +48 -0
- package/src/web/SegmentedControl.tsx +127 -0
- package/src/web/SelectionMenu.tsx +149 -0
- package/src/web/SplitButton.tsx +32 -0
- package/src/web/TabBar.tsx +150 -0
- package/src/web/TextField.tsx +361 -0
- package/src/web/components.tsx +71 -0
- package/src/web/containers.tsx +130 -0
- package/src/web/dateInput.ts +137 -0
- package/src/web/shared.ts +176 -0
- package/src/webComponents.ts +45 -0
- package/android/src/main/java/com/platformcomponents/DateConstraints.kt +0 -83
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// web/TextField.tsx
|
|
4
|
+
import React, { forwardRef, useImperativeHandle, useRef, useState } from 'react';
|
|
5
|
+
import { Pressable, Text, TextInput, View } from 'react-native';
|
|
6
|
+
import { resolveSubmitBehavior } from "../submitBehavior.js";
|
|
7
|
+
import { Icon } from "./Icon.js";
|
|
8
|
+
import { usePrimaryColor } from "./shared.js";
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
const ERROR_COLOR = '#B3261E';
|
|
11
|
+
const MUTED_COLOR = 'rgba(128, 128, 128, 1)';
|
|
12
|
+
const OUTLINE_COLOR = 'rgba(128, 128, 128, 0.5)';
|
|
13
|
+
function textEvent(text) {
|
|
14
|
+
return {
|
|
15
|
+
nativeEvent: {
|
|
16
|
+
text
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* A text input with the TextField extras around it: a label above, prefix and
|
|
23
|
+
* suffix, icons, a clear button, a password toggle, and supporting, error and
|
|
24
|
+
* counter text below.
|
|
25
|
+
*/
|
|
26
|
+
export const TextField = /*#__PURE__*/forwardRef(function TextFieldComponent(props, ref) {
|
|
27
|
+
const {
|
|
28
|
+
value,
|
|
29
|
+
defaultValue,
|
|
30
|
+
onChangeText,
|
|
31
|
+
onChange,
|
|
32
|
+
onFocus,
|
|
33
|
+
onBlur,
|
|
34
|
+
onSubmitEditing,
|
|
35
|
+
submitBehavior,
|
|
36
|
+
onSelectionChange,
|
|
37
|
+
selection,
|
|
38
|
+
label,
|
|
39
|
+
placeholder,
|
|
40
|
+
supportingText,
|
|
41
|
+
error,
|
|
42
|
+
prefix,
|
|
43
|
+
suffix,
|
|
44
|
+
leadingIcon,
|
|
45
|
+
trailingIcon,
|
|
46
|
+
onTrailingIconPress,
|
|
47
|
+
leadingIconTestID,
|
|
48
|
+
leadingIconAccessibilityLabel,
|
|
49
|
+
trailingIconTestID,
|
|
50
|
+
trailingIconAccessibilityLabel,
|
|
51
|
+
onPress,
|
|
52
|
+
activeColor,
|
|
53
|
+
outlineColor,
|
|
54
|
+
errorColor,
|
|
55
|
+
containerColor,
|
|
56
|
+
textColor,
|
|
57
|
+
placeholderTextColor,
|
|
58
|
+
maxFontSizeMultiplier,
|
|
59
|
+
textAlign,
|
|
60
|
+
minLines,
|
|
61
|
+
maxLines,
|
|
62
|
+
clearButtonMode = 'never',
|
|
63
|
+
passwordToggle,
|
|
64
|
+
showCharacterCount,
|
|
65
|
+
maxLength,
|
|
66
|
+
keyboardType,
|
|
67
|
+
returnKeyType,
|
|
68
|
+
autoCapitalize,
|
|
69
|
+
autoCorrect,
|
|
70
|
+
secureTextEntry,
|
|
71
|
+
multiline,
|
|
72
|
+
editable = true,
|
|
73
|
+
autoFocus,
|
|
74
|
+
selectTextOnFocus,
|
|
75
|
+
autoComplete,
|
|
76
|
+
keyboardAppearance,
|
|
77
|
+
textStyle,
|
|
78
|
+
accessibilityLabel,
|
|
79
|
+
ios,
|
|
80
|
+
android,
|
|
81
|
+
style,
|
|
82
|
+
testID,
|
|
83
|
+
...viewProps
|
|
84
|
+
} = props;
|
|
85
|
+
const primary = usePrimaryColor();
|
|
86
|
+
const inputRef = useRef(null);
|
|
87
|
+
const eventCount = useRef(0);
|
|
88
|
+
const [uncontrolledText, setUncontrolledText] = useState(defaultValue ?? '');
|
|
89
|
+
const [focused, setFocused] = useState(false);
|
|
90
|
+
const [revealed, setRevealed] = useState(false);
|
|
91
|
+
const text = value ?? uncontrolledText;
|
|
92
|
+
const errorText = typeof error === 'string' ? error : undefined;
|
|
93
|
+
const invalid = error !== undefined && error !== false && error !== '';
|
|
94
|
+
const changeText = next => {
|
|
95
|
+
setUncontrolledText(next);
|
|
96
|
+
eventCount.current += 1;
|
|
97
|
+
onChangeText?.(next);
|
|
98
|
+
onChange?.({
|
|
99
|
+
nativeEvent: {
|
|
100
|
+
text: next,
|
|
101
|
+
eventCount: eventCount.current
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
useImperativeHandle(ref, () => ({
|
|
106
|
+
focus: () => inputRef.current?.focus(),
|
|
107
|
+
blur: () => inputRef.current?.blur(),
|
|
108
|
+
clear: () => changeText(''),
|
|
109
|
+
isFocused: () => inputRef.current?.isFocused() ?? false,
|
|
110
|
+
setSelection: (start, end) => {
|
|
111
|
+
// react-native-web's TextInput ref is the DOM input
|
|
112
|
+
const node = inputRef.current;
|
|
113
|
+
node?.setSelectionRange?.(start, end ?? start);
|
|
114
|
+
}
|
|
115
|
+
}));
|
|
116
|
+
|
|
117
|
+
// The keyboard toolbar and password rules are iOS only
|
|
118
|
+
const returnKey = resolveSubmitBehavior(submitBehavior, multiline);
|
|
119
|
+
// react-native-web submits a multi-line field only when it also blurs;
|
|
120
|
+
// Enter without Shift submits one that keeps focus
|
|
121
|
+
const submitsOnEnter = multiline && returnKey === 'submit';
|
|
122
|
+
const showClear = editable && text.length > 0 && (clearButtonMode === 'always' || clearButtonMode === 'while-editing' && focused || clearButtonMode === 'unless-editing' && !focused);
|
|
123
|
+
const errorTint = errorColor ?? ERROR_COLOR;
|
|
124
|
+
const accent = invalid ? errorTint : focused ? activeColor ?? primary : undefined;
|
|
125
|
+
// A read-only field with onPress acts as a button
|
|
126
|
+
const actsAsButton = !editable && onPress != null;
|
|
127
|
+
// A disabled Pressable marks every focusable descendant aria-disabled.
|
|
128
|
+
// Editable inputs need a neutral container, including their icon actions.
|
|
129
|
+
// https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-disabled
|
|
130
|
+
const FieldContainer = actsAsButton ? Pressable : View;
|
|
131
|
+
const lineHeight = (textStyle?.fontSize ?? 16) * 1.25;
|
|
132
|
+
const bottomText = errorText ?? supportingText;
|
|
133
|
+
const counter = showCharacterCount ? maxLength !== undefined ? `${text.length} / ${maxLength}` : `${text.length}` : undefined;
|
|
134
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
135
|
+
...viewProps,
|
|
136
|
+
style: [{
|
|
137
|
+
gap: 4
|
|
138
|
+
}, style],
|
|
139
|
+
children: [label ? /*#__PURE__*/_jsx(Text, {
|
|
140
|
+
style: {
|
|
141
|
+
fontSize: 13,
|
|
142
|
+
color: accent ?? MUTED_COLOR
|
|
143
|
+
},
|
|
144
|
+
children: label
|
|
145
|
+
}) : null, /*#__PURE__*/_jsxs(FieldContainer, {
|
|
146
|
+
onPress: actsAsButton ? onPress : undefined,
|
|
147
|
+
accessibilityLabel: actsAsButton ? accessibilityLabel ?? label : undefined,
|
|
148
|
+
role: actsAsButton ? 'button' : undefined,
|
|
149
|
+
style: {
|
|
150
|
+
flexDirection: 'row',
|
|
151
|
+
alignItems: multiline ? 'flex-start' : 'center',
|
|
152
|
+
gap: 8,
|
|
153
|
+
minHeight: 40,
|
|
154
|
+
paddingHorizontal: 12,
|
|
155
|
+
borderWidth: 1,
|
|
156
|
+
borderRadius: 8,
|
|
157
|
+
borderColor: accent ?? outlineColor ?? OUTLINE_COLOR,
|
|
158
|
+
backgroundColor: containerColor,
|
|
159
|
+
opacity: editable || actsAsButton ? 1 : 0.6,
|
|
160
|
+
cursor: actsAsButton ? 'pointer' : undefined
|
|
161
|
+
},
|
|
162
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
163
|
+
testID: leadingIconTestID,
|
|
164
|
+
accessibilityLabel: leadingIconAccessibilityLabel,
|
|
165
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
166
|
+
icon: leadingIcon,
|
|
167
|
+
color: MUTED_COLOR
|
|
168
|
+
})
|
|
169
|
+
}), prefix ? /*#__PURE__*/_jsx(Text, {
|
|
170
|
+
style: {
|
|
171
|
+
color: MUTED_COLOR
|
|
172
|
+
},
|
|
173
|
+
children: prefix
|
|
174
|
+
}) : null, /*#__PURE__*/_jsx(TextInput, {
|
|
175
|
+
ref: inputRef,
|
|
176
|
+
testID: testID,
|
|
177
|
+
value: text,
|
|
178
|
+
onChangeText: changeText,
|
|
179
|
+
onFocus: () => {
|
|
180
|
+
setFocused(true);
|
|
181
|
+
onFocus?.(textEvent(text));
|
|
182
|
+
},
|
|
183
|
+
onBlur: () => {
|
|
184
|
+
setFocused(false);
|
|
185
|
+
onBlur?.(textEvent(text));
|
|
186
|
+
},
|
|
187
|
+
onSubmitEditing: multiline && returnKey !== 'blurAndSubmit' ? undefined : () => onSubmitEditing?.(textEvent(text)),
|
|
188
|
+
submitBehavior: returnKey,
|
|
189
|
+
blurOnSubmit: returnKey === 'blurAndSubmit',
|
|
190
|
+
onKeyPress: submitsOnEnter ? event => {
|
|
191
|
+
const {
|
|
192
|
+
key,
|
|
193
|
+
shiftKey
|
|
194
|
+
} = event.nativeEvent;
|
|
195
|
+
if (key !== 'Enter' || shiftKey) return;
|
|
196
|
+
event.preventDefault();
|
|
197
|
+
onSubmitEditing?.(textEvent(text));
|
|
198
|
+
} : undefined,
|
|
199
|
+
selection: selection ? {
|
|
200
|
+
start: selection.start,
|
|
201
|
+
end: selection.end ?? selection.start
|
|
202
|
+
} : undefined,
|
|
203
|
+
onSelectionChange: onSelectionChange,
|
|
204
|
+
placeholder: placeholder,
|
|
205
|
+
placeholderTextColor: placeholderTextColor,
|
|
206
|
+
maxLength: maxLength,
|
|
207
|
+
keyboardType: keyboardType,
|
|
208
|
+
returnKeyType: returnKeyType === 'none' ? undefined : returnKeyType,
|
|
209
|
+
autoCapitalize: autoCapitalize,
|
|
210
|
+
autoCorrect: autoCorrect,
|
|
211
|
+
secureTextEntry: secureTextEntry && !revealed,
|
|
212
|
+
multiline: multiline,
|
|
213
|
+
numberOfLines: multiline ? minLines : undefined,
|
|
214
|
+
editable: editable,
|
|
215
|
+
pointerEvents: actsAsButton ? 'none' : undefined,
|
|
216
|
+
tabIndex: actsAsButton ? -1 : undefined,
|
|
217
|
+
autoFocus: autoFocus,
|
|
218
|
+
selectTextOnFocus: selectTextOnFocus,
|
|
219
|
+
autoComplete: autoComplete,
|
|
220
|
+
accessibilityLabel: accessibilityLabel ?? label,
|
|
221
|
+
"aria-invalid": invalid,
|
|
222
|
+
style: {
|
|
223
|
+
flex: 1,
|
|
224
|
+
minWidth: 0,
|
|
225
|
+
paddingVertical: 8,
|
|
226
|
+
maxHeight: multiline && maxLines ? lineHeight * maxLines + 16 : undefined,
|
|
227
|
+
textAlign,
|
|
228
|
+
color: textColor,
|
|
229
|
+
fontSize: textStyle?.fontSize ?? 16,
|
|
230
|
+
fontFamily: textStyle?.fontFamily,
|
|
231
|
+
fontWeight: textStyle?.fontWeight,
|
|
232
|
+
fontStyle: textStyle?.fontStyle,
|
|
233
|
+
outlineWidth: 0
|
|
234
|
+
}
|
|
235
|
+
}), suffix ? /*#__PURE__*/_jsx(Text, {
|
|
236
|
+
style: {
|
|
237
|
+
color: MUTED_COLOR
|
|
238
|
+
},
|
|
239
|
+
children: suffix
|
|
240
|
+
}) : null, showClear ? /*#__PURE__*/_jsx(FieldButton, {
|
|
241
|
+
label: "Clear text",
|
|
242
|
+
onPress: () => changeText(''),
|
|
243
|
+
children: "\u2715"
|
|
244
|
+
}) : null, passwordToggle ? /*#__PURE__*/_jsx(FieldButton, {
|
|
245
|
+
label: revealed ? 'Hide password' : 'Show password',
|
|
246
|
+
onPress: () => setRevealed(r => !r),
|
|
247
|
+
children: revealed ? 'Hide' : 'Show'
|
|
248
|
+
}) : null, trailingIcon ? onTrailingIconPress ? /*#__PURE__*/_jsx(Pressable, {
|
|
249
|
+
role: "button",
|
|
250
|
+
testID: trailingIconTestID,
|
|
251
|
+
accessibilityLabel: trailingIconAccessibilityLabel,
|
|
252
|
+
onPress: onTrailingIconPress,
|
|
253
|
+
style: {
|
|
254
|
+
padding: 4
|
|
255
|
+
},
|
|
256
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
257
|
+
icon: trailingIcon,
|
|
258
|
+
color: MUTED_COLOR
|
|
259
|
+
})
|
|
260
|
+
}) : /*#__PURE__*/_jsx(View, {
|
|
261
|
+
testID: trailingIconTestID,
|
|
262
|
+
accessibilityLabel: trailingIconAccessibilityLabel,
|
|
263
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
264
|
+
icon: trailingIcon,
|
|
265
|
+
color: MUTED_COLOR
|
|
266
|
+
})
|
|
267
|
+
}) : null]
|
|
268
|
+
}), bottomText || counter ? /*#__PURE__*/_jsxs(View, {
|
|
269
|
+
style: {
|
|
270
|
+
flexDirection: 'row',
|
|
271
|
+
gap: 8
|
|
272
|
+
},
|
|
273
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
274
|
+
style: {
|
|
275
|
+
flex: 1,
|
|
276
|
+
fontSize: 12,
|
|
277
|
+
color: errorText ? errorTint : MUTED_COLOR
|
|
278
|
+
},
|
|
279
|
+
children: bottomText ?? ''
|
|
280
|
+
}), counter ? /*#__PURE__*/_jsx(Text, {
|
|
281
|
+
style: {
|
|
282
|
+
fontSize: 12,
|
|
283
|
+
color: MUTED_COLOR
|
|
284
|
+
},
|
|
285
|
+
children: counter
|
|
286
|
+
}) : null]
|
|
287
|
+
}) : null]
|
|
288
|
+
});
|
|
289
|
+
});
|
|
290
|
+
function FieldButton({
|
|
291
|
+
label,
|
|
292
|
+
onPress,
|
|
293
|
+
children
|
|
294
|
+
}) {
|
|
295
|
+
return /*#__PURE__*/_jsx("button", {
|
|
296
|
+
type: "button",
|
|
297
|
+
"aria-label": label
|
|
298
|
+
// Keep focus in the input, so a clear button shown only while editing
|
|
299
|
+
// is still there when the click lands.
|
|
300
|
+
,
|
|
301
|
+
onMouseDown: event => event.preventDefault(),
|
|
302
|
+
onClick: onPress,
|
|
303
|
+
style: {
|
|
304
|
+
padding: '4px 6px',
|
|
305
|
+
border: 'none',
|
|
306
|
+
borderRadius: 4,
|
|
307
|
+
fontFamily: 'inherit',
|
|
308
|
+
fontSize: 13,
|
|
309
|
+
color: MUTED_COLOR,
|
|
310
|
+
backgroundColor: 'transparent',
|
|
311
|
+
cursor: 'pointer'
|
|
312
|
+
},
|
|
313
|
+
children: children
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
//# sourceMappingURL=TextField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","forwardRef","useImperativeHandle","useRef","useState","Pressable","Text","TextInput","View","resolveSubmitBehavior","Icon","usePrimaryColor","jsx","_jsx","jsxs","_jsxs","ERROR_COLOR","MUTED_COLOR","OUTLINE_COLOR","textEvent","text","nativeEvent","TextField","TextFieldComponent","props","ref","value","defaultValue","onChangeText","onChange","onFocus","onBlur","onSubmitEditing","submitBehavior","onSelectionChange","selection","label","placeholder","supportingText","error","prefix","suffix","leadingIcon","trailingIcon","onTrailingIconPress","leadingIconTestID","leadingIconAccessibilityLabel","trailingIconTestID","trailingIconAccessibilityLabel","onPress","activeColor","outlineColor","errorColor","containerColor","textColor","placeholderTextColor","maxFontSizeMultiplier","textAlign","minLines","maxLines","clearButtonMode","passwordToggle","showCharacterCount","maxLength","keyboardType","returnKeyType","autoCapitalize","autoCorrect","secureTextEntry","multiline","editable","autoFocus","selectTextOnFocus","autoComplete","keyboardAppearance","textStyle","accessibilityLabel","ios","android","style","testID","viewProps","primary","inputRef","eventCount","uncontrolledText","setUncontrolledText","focused","setFocused","revealed","setRevealed","errorText","undefined","invalid","changeText","next","current","focus","blur","clear","isFocused","setSelection","start","end","node","setSelectionRange","returnKey","submitsOnEnter","showClear","length","errorTint","accent","actsAsButton","FieldContainer","lineHeight","fontSize","bottomText","counter","gap","children","color","role","flexDirection","alignItems","minHeight","paddingHorizontal","borderWidth","borderRadius","borderColor","backgroundColor","opacity","cursor","icon","blurOnSubmit","onKeyPress","event","key","shiftKey","preventDefault","numberOfLines","pointerEvents","tabIndex","flex","minWidth","paddingVertical","maxHeight","fontFamily","fontWeight","fontStyle","outlineWidth","FieldButton","r","padding","type","onMouseDown","onClick","border"],"sourceRoot":"../../../src","sources":["web/TextField.tsx"],"mappings":";;AAAA;AACA,OAAOA,KAAK,IACVC,UAAU,EACVC,mBAAmB,EACnBC,MAAM,EACNC,QAAQ,QACH,OAAO;AACd,SAASC,SAAS,EAAEC,IAAI,EAAEC,SAAS,EAAEC,IAAI,QAAQ,cAAc;AAQ/D,SAASC,qBAAqB,QAAQ,sBAAmB;AACzD,SAASC,IAAI,QAAQ,WAAQ;AAC7B,SAASC,eAAe,QAAQ,aAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE3C,MAAMC,WAAW,GAAG,SAAS;AAC7B,MAAMC,WAAW,GAAG,wBAAwB;AAC5C,MAAMC,aAAa,GAAG,0BAA0B;AAEhD,SAASC,SAASA,CAACC,IAAY,EAAkB;EAC/C,OAAO;IAAEC,WAAW,EAAE;MAAED;IAAK;EAAE,CAAC;AAClC;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,SAAS,gBAAGrB,UAAU,CACjC,SAASsB,kBAAkBA,CAACC,KAAK,EAAEC,GAAG,EAAsB;EAC1D,MAAM;IACJC,KAAK;IACLC,YAAY;IACZC,YAAY;IACZC,QAAQ;IACRC,O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;IACA;IAAA;IACAsH,WAAW,EAAGnB,KAAK,IAAKA,KAAK,CAACG,cAAc,CAAC,CAAE;IAC/CiB,OAAO,EAAE1G,OAAQ;IACjB8B,KAAK,EAAE;MACLyE,OAAO,EAAE,SAAS;MAClBI,MAAM,EAAE,MAAM;MACd7B,YAAY,EAAE,CAAC;MACfmB,UAAU,EAAE,SAAS;MACrB/B,QAAQ,EAAE,EAAE;MACZK,KAAK,EAAEvG,WAAW;MAClBgH,eAAe,EAAE,aAAa;MAC9BE,MAAM,EAAE;IACV,CAAE;IAAAZ,QAAA,EAEDA;EAAQ,CACH,CAAC;AAEb","ignoreList":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { withWebComponent } from "./PlatformComponentsProvider.js";
|
|
4
|
+
import { Button as DefaultButton } from "./Button.js";
|
|
5
|
+
import { ButtonGroup as DefaultButtonGroup } from "./ButtonGroup.js";
|
|
6
|
+
import { SplitButton as DefaultSplitButton } from "./SplitButton.js";
|
|
7
|
+
import { DatePicker as DefaultDatePicker } from "./DatePicker.js";
|
|
8
|
+
import { DateRangePicker as DefaultDateRangePicker } from "./DateRangePicker.js";
|
|
9
|
+
import { FloatingActionButton as DefaultFloatingActionButton } from "./FloatingActionButton.js";
|
|
10
|
+
import { NavigationRail as DefaultNavigationRail } from "./NavigationRail.js";
|
|
11
|
+
import { SegmentedControl as DefaultSegmentedControl } from "./SegmentedControl.js";
|
|
12
|
+
import { SelectionMenu as DefaultSelectionMenu } from "./SelectionMenu.js";
|
|
13
|
+
import { TabBar as DefaultTabBar } from "./TabBar.js";
|
|
14
|
+
import { TextField as DefaultTextField } from "./TextField.js";
|
|
15
|
+
import { ContextMenu as DefaultContextMenu, FloatingToolbar as DefaultFloatingToolbar, LiquidGlass as DefaultLiquidGlass, LiquidGlassContainer as DefaultLiquidGlassContainer } from "./containers.js";
|
|
16
|
+
|
|
17
|
+
// Explicit types keep published declarations tied to a resolvable type import.
|
|
18
|
+
export const Button = withWebComponent('Button', DefaultButton);
|
|
19
|
+
export const ButtonGroup = withWebComponent('ButtonGroup', DefaultButtonGroup);
|
|
20
|
+
export const SplitButton = withWebComponent('SplitButton', DefaultSplitButton);
|
|
21
|
+
export const DatePicker = withWebComponent('DatePicker', DefaultDatePicker);
|
|
22
|
+
export const DateRangePicker = withWebComponent('DateRangePicker', DefaultDateRangePicker);
|
|
23
|
+
export const FloatingActionButton = withWebComponent('FloatingActionButton', DefaultFloatingActionButton);
|
|
24
|
+
export const NavigationRail = withWebComponent('NavigationRail', DefaultNavigationRail);
|
|
25
|
+
export const SegmentedControl = withWebComponent('SegmentedControl', DefaultSegmentedControl);
|
|
26
|
+
export const SelectionMenu = withWebComponent('SelectionMenu', DefaultSelectionMenu);
|
|
27
|
+
export const TabBar = withWebComponent('TabBar', DefaultTabBar);
|
|
28
|
+
export const TextField = withWebComponent('TextField', DefaultTextField);
|
|
29
|
+
export const ContextMenu = withWebComponent('ContextMenu', DefaultContextMenu);
|
|
30
|
+
export const FloatingToolbar = withWebComponent('FloatingToolbar', DefaultFloatingToolbar);
|
|
31
|
+
export const LiquidGlass = withWebComponent('LiquidGlass', DefaultLiquidGlass);
|
|
32
|
+
export const LiquidGlassContainer = withWebComponent('LiquidGlassContainer', DefaultLiquidGlassContainer);
|
|
33
|
+
//# sourceMappingURL=components.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["withWebComponent","Button","DefaultButton","ButtonGroup","DefaultButtonGroup","SplitButton","DefaultSplitButton","DatePicker","DefaultDatePicker","DateRangePicker","DefaultDateRangePicker","FloatingActionButton","DefaultFloatingActionButton","NavigationRail","DefaultNavigationRail","SegmentedControl","DefaultSegmentedControl","SelectionMenu","DefaultSelectionMenu","TabBar","DefaultTabBar","TextField","DefaultTextField","ContextMenu","DefaultContextMenu","FloatingToolbar","DefaultFloatingToolbar","LiquidGlass","DefaultLiquidGlass","LiquidGlassContainer","DefaultLiquidGlassContain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AA+C,GAAGb,gBAAgB,CAC7E,gBAAgB,EAChBc,qBACF,CAAC;AACD,OAAO,MAAMC,gBAAmD,GAC9Df,gBAAgB,CAAC,kBAAkB,EAAEgB,uBAAuB,CAAC;AAC/D,OAAO,MAAMC,aAA6C,GAAGjB,gBAAgB,CAC3E,eAAe,EACfkB,oBACF,CAAC;AACD,OAAO,MAAMC,MAA+B,GAAGnB,gBAAgB,CAC7D,QAAQ,EACRoB,aACF,CAAC;AACD,OAAO,MAAMC,SAAqC,GAAGrB,gBAAgB,CACnE,WAAW,EACXsB,gBACF,CAAC;AACD,OAAO,MAAMC,WAAyC,GAAGvB,gBAAgB,CACvE,aAAa,EACbwB,kBACF,CAAC;AACD,OAAO,MAAMC,eAAiD,GAC5DzB,gBAAgB,CAAC,iBAAiB,EAAE0B,sBAAsB,CAAC;AAC7D,OAAO,MAAMC,WAAyC,GAAG3B,gBAAgB,CACvE,aAAa,EACb4B,kBACF,CAAC;AACD,OAAO,MAAMC,oBAA2D,GACtE7B,gBAAgB,CAAC,sBAAsB,EAAE8B,2BAA2B,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// web/containers.tsx
|
|
4
|
+
//
|
|
5
|
+
// The components that wrap children: ContextMenu, FloatingToolbar,
|
|
6
|
+
// LiquidGlass and LiquidGlassContainer. They keep their layout on web and
|
|
7
|
+
// render their children.
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { View } from 'react-native';
|
|
10
|
+
import { warnOnce } from "./shared.js";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Renders its children without a menu: browsers have no native menu to
|
|
14
|
+
* attach. Provide a web menu with a `.web.tsx` file in your app.
|
|
15
|
+
*/
|
|
16
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
+
export function ContextMenu(props) {
|
|
18
|
+
const {
|
|
19
|
+
title,
|
|
20
|
+
actions,
|
|
21
|
+
disabled,
|
|
22
|
+
trigger,
|
|
23
|
+
onPressAction,
|
|
24
|
+
onMenuOpen,
|
|
25
|
+
onMenuClose,
|
|
26
|
+
onPreviewPress,
|
|
27
|
+
ios,
|
|
28
|
+
android,
|
|
29
|
+
children,
|
|
30
|
+
...viewProps
|
|
31
|
+
} = props;
|
|
32
|
+
warnOnce('ContextMenu', 'ContextMenu has no web implementation; its children render without a menu. ' + 'See https://jarx-concepts.github.io/react-native-platform-components/guides/web');
|
|
33
|
+
return /*#__PURE__*/_jsx(View, {
|
|
34
|
+
...viewProps,
|
|
35
|
+
children: children
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A pill-shaped surface that lays out its children in a row or column. It
|
|
41
|
+
* doesn't follow a linked ScrollView (`scrollViewNativeID`, `hideOnScroll`).
|
|
42
|
+
*/
|
|
43
|
+
export function FloatingToolbar(props) {
|
|
44
|
+
const {
|
|
45
|
+
orientation = 'horizontal',
|
|
46
|
+
color,
|
|
47
|
+
scrollViewNativeID,
|
|
48
|
+
hideOnScroll,
|
|
49
|
+
ios,
|
|
50
|
+
android,
|
|
51
|
+
children,
|
|
52
|
+
style,
|
|
53
|
+
...viewProps
|
|
54
|
+
} = props;
|
|
55
|
+
return /*#__PURE__*/_jsx(View, {
|
|
56
|
+
...viewProps,
|
|
57
|
+
style: [{
|
|
58
|
+
flexDirection: orientation === 'vertical' ? 'column' : 'row',
|
|
59
|
+
alignItems: 'center',
|
|
60
|
+
alignSelf: 'flex-start',
|
|
61
|
+
gap: 4,
|
|
62
|
+
padding: 8,
|
|
63
|
+
borderRadius: 32,
|
|
64
|
+
backgroundColor: color ?? 'rgba(128, 128, 128, 0.16)',
|
|
65
|
+
// @ts-expect-error: react-native-web style
|
|
66
|
+
backdropFilter: 'blur(20px)'
|
|
67
|
+
}, style],
|
|
68
|
+
children: children
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* A plain view: Liquid Glass is iOS 26 only, so `isLiquidGlassSupported` is
|
|
74
|
+
* `false` on web, as on Android.
|
|
75
|
+
*/
|
|
76
|
+
export function LiquidGlass(props) {
|
|
77
|
+
const {
|
|
78
|
+
cornerRadius,
|
|
79
|
+
cornerStyle,
|
|
80
|
+
ios,
|
|
81
|
+
android,
|
|
82
|
+
children,
|
|
83
|
+
style,
|
|
84
|
+
...viewProps
|
|
85
|
+
} = props;
|
|
86
|
+
|
|
87
|
+
// A capsule is fully rounded; concentric corners use cornerRadius
|
|
88
|
+
const radius = cornerStyle === 'capsule' ? 9999 : typeof cornerStyle === 'number' ? cornerStyle : cornerRadius;
|
|
89
|
+
return /*#__PURE__*/_jsx(View, {
|
|
90
|
+
...viewProps,
|
|
91
|
+
style: [radius ? {
|
|
92
|
+
borderRadius: radius,
|
|
93
|
+
overflow: 'hidden'
|
|
94
|
+
} : null, style],
|
|
95
|
+
children: children
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** A plain view: glass only merges on iOS 26. */
|
|
100
|
+
export function LiquidGlassContainer(props) {
|
|
101
|
+
const {
|
|
102
|
+
spacing,
|
|
103
|
+
children,
|
|
104
|
+
...viewProps
|
|
105
|
+
} = props;
|
|
106
|
+
return /*#__PURE__*/_jsx(View, {
|
|
107
|
+
...viewProps,
|
|
108
|
+
children: children
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
export const isLiquidGlassSupported = false;
|
|
112
|
+
//# sourceMappingURL=containers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","View","warnOnce","jsx","_jsx","ContextMenu","props","title","actions","disabled","trigger","onPressAction","onMenuOpen","onMenuClose","onPreviewPress","ios","android","children","viewProps","FloatingToolbar","orientation","color","scrollViewNativeID","hideOnScroll","style","flexDirection","alignItems","alignSelf","gap","padding","borderRadius","backgroundColor","backdropFilter","LiquidGlass","cornerRadius","cornerStyle","radius","overflow","LiquidGlassContainer","spacing","isLiquidGlassSupported"],"sourceRoot":"../../../src","sources":["web/containers.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,cAAc;AAMnC,SAASC,QAAQ,QAAQ,aAAU;;AAEnC;AACA;AACA;AACA;AAHA,SAAAC,GAAA,IAAAC,IAAA;AAIA,OAAO,SAASC,WAAWA,CAACC,KAAuB,EAAsB;EACvE,MAAM;IACJC,KAAK;IACLC,OAAO;IACPC,QAAQ;IACRC,OAAO;IACPC,aAAa;IACbC,UAAU;IACVC,WAAW;IACXC,cAAc;IACdC,GAAG;IACHC,OAAO;IACPC,QAAQ;IACR,GAAGC;EACL,CAAC,GAAGZ,KAAK;EAETJ,QAAQ,CACN,aAAa,EACb,6EAA6E,GAC3E,iFACJ,CAAC;EAED,oBAAOE,IAAA,CAACH,IAAI;IAAA,GAAKiB,SAAS;IAAAD,QAAA,EAAGA;EAAQ,CAAO,CAAC;AAC/C;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASE,eAAeA,CAC7Bb,KAA2B,EACP;EACpB,MAAM;IACJc,WAAW,GAAG,YAAY;IAC1BC,KAAK;IACLC,kBAAkB;IAClBC,YAAY;IACZR,GAAG;IACHC,OAAO;IACPC,QAAQ;IACRO,KAAK;IACL,GAAGN;EACL,CAAC,GAAGZ,KAAK;EAET,oBACEF,IAAA,CAACH,IAAI;IAAA,GACCiB,SAAS;IACbM,KAAK,EAAE,CACL;MACEC,aAAa,EAAEL,WAAW,KAAK,UAAU,GAAG,QAAQ,GAAG,KAAK;MAC5DM,UAAU,EAAE,QAAQ;MACpBC,SAAS,EAAE,YAAY;MACvBC,GAAG,EAAE,CAAC;MACNC,OAAO,EAAE,CAAC;MACVC,YAAY,EAAE,EAAE;MAChBC,eAAe,EAAEV,KAAK,IAAI,2BAA2B;MACrD;MACAW,cAAc,EAAE;IAClB,CAAC,EACDR,KAAK,CACL;IAAAP,QAAA,EAEDA;EAAQ,CACL,CAAC;AAEX;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASgB,WAAWA,CAAC3B,KAAuB,EAAsB;EACvE,MAAM;IACJ4B,YAAY;IACZC,WAAW;IACXpB,GAAG;IACHC,OAAO;IACPC,QAAQ;IACRO,KAAK;IACL,GAAGN;EACL,CAAC,GAAGZ,KAAK;;EAET;EACA,MAAM8B,MAAM,GACVD,WAAW,KAAK,SAAS,GACrB,IAAI,GACJ,OAAOA,WAAW,KAAK,QAAQ,GAC7BA,WAAW,GACXD,YAAY;EAEpB,oBACE9B,IAAA,CAACH,IAAI;IAAA,GACCiB,SAAS;IACbM,KAAK,EAAE,CACLY,MAAM,GAAG;MAAEN,YAAY,EAAEM,MAAM;MAAEC,QAAQ,EAAE;IAAS,CAAC,GAAG,IAAI,EAC5Db,KAAK,CACL;IAAAP,QAAA,EAEDA;EAAQ,CACL,CAAC;AAEX;;AAEA;AACA,OAAO,SAASqB,oBAAoBA,CAClChC,KAAgC,EACZ;EACpB,MAAM;IAAEiC,OAAO;IAAEtB,QAAQ;IAAE,GAAGC;EAAU,CAAC,GAAGZ,KAAK;EACjD,oBAAOF,IAAA,CAACH,IAAI;IAAA,GAAKiB,SAAS;IAAAD,QAAA,EAAGA;EAAQ,CAAO,CAAC;AAC/C;AAEA,OAAO,MAAMuB,sBAAsB,GAAG,KAAK","ignoreList":[]}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// web/dateInput.ts
|
|
4
|
+
//
|
|
5
|
+
// Conversions between `Date` and the value strings of the browser's date and
|
|
6
|
+
// time inputs, in local time.
|
|
7
|
+
|
|
8
|
+
/** The `<input type>`s the pickers use. */
|
|
9
|
+
|
|
10
|
+
/** The `<input type>` for a picker mode. */
|
|
11
|
+
export function inputTypeForMode(mode) {
|
|
12
|
+
switch (mode) {
|
|
13
|
+
case 'time':
|
|
14
|
+
case 'countDownTimer':
|
|
15
|
+
return 'time';
|
|
16
|
+
case 'dateAndTime':
|
|
17
|
+
return 'datetime-local';
|
|
18
|
+
case 'yearAndMonth':
|
|
19
|
+
return 'month';
|
|
20
|
+
default:
|
|
21
|
+
return 'date';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const pad = (n, width = 2) => String(n).padStart(width, '0');
|
|
25
|
+
|
|
26
|
+
/** Formats `date` as the value of an input of `type`; `''` for no date. */
|
|
27
|
+
export function formatInputValue(date, type) {
|
|
28
|
+
if (!date || !Number.isFinite(date.getTime())) return '';
|
|
29
|
+
const month = `${pad(date.getFullYear(), 4)}-${pad(date.getMonth() + 1)}`;
|
|
30
|
+
const day = `${month}-${pad(date.getDate())}`;
|
|
31
|
+
const time = `${pad(date.getHours())}:${pad(date.getMinutes())}`;
|
|
32
|
+
if (type === 'month') return month;
|
|
33
|
+
if (type === 'date') return day;
|
|
34
|
+
if (type === 'time') return time;
|
|
35
|
+
return `${day}T${time}`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Parses an input value back into a `Date`. Parts the input doesn't show are
|
|
40
|
+
* kept from `base` (the time of day for a date input, the day for a time
|
|
41
|
+
* input); a month input gives the first of the month. Returns `null` for an
|
|
42
|
+
* empty or invalid value.
|
|
43
|
+
*/
|
|
44
|
+
export function parseInputValue(value, type, base) {
|
|
45
|
+
const hasBase = base && Number.isFinite(base.getTime());
|
|
46
|
+
const result = hasBase ? new Date(base.getTime()) : new Date();
|
|
47
|
+
if (!hasBase) result.setHours(0, 0, 0, 0);
|
|
48
|
+
if (type === 'month') {
|
|
49
|
+
const monthMatch = /^(\d{4,})-(\d{2})$/.exec(value);
|
|
50
|
+
if (!monthMatch) return null;
|
|
51
|
+
const year = Number(monthMatch[1]);
|
|
52
|
+
const month = Number(monthMatch[2]);
|
|
53
|
+
if (year < 1 || month < 1 || month > 12) return null;
|
|
54
|
+
result.setFullYear(year, month - 1, 1);
|
|
55
|
+
return Number.isFinite(result.getTime()) ? result : null;
|
|
56
|
+
}
|
|
57
|
+
const dayMatch = type === 'date' ? /^(\d{4,})-(\d{2})-(\d{2})$/.exec(value) : /^(\d{4,})-(\d{2})-(\d{2})T\d{2}:\d{2}(?::\d{2})?$/.exec(value);
|
|
58
|
+
const timeMatch = /(?:^|T)(\d{2}):(\d{2})(?::(\d{2}))?$/.exec(value);
|
|
59
|
+
if (type !== 'time') {
|
|
60
|
+
if (!dayMatch) return null;
|
|
61
|
+
const year = Number(dayMatch[1]);
|
|
62
|
+
const month = Number(dayMatch[2]);
|
|
63
|
+
const day = Number(dayMatch[3]);
|
|
64
|
+
if (year < 1 || month < 1 || month > 12 || day < 1 || day > 31) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
result.setFullYear(year, month - 1, day);
|
|
68
|
+
// Date setters normalize impossible dates (February 30 becomes March 2).
|
|
69
|
+
if (result.getFullYear() !== year || result.getMonth() !== month - 1 || result.getDate() !== day) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (type !== 'date') {
|
|
74
|
+
if (!timeMatch) return null;
|
|
75
|
+
if (type === 'time' && !/^\d{2}:\d{2}(?::\d{2})?$/.test(value)) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
const hours = Number(timeMatch[1]);
|
|
79
|
+
const minutes = Number(timeMatch[2]);
|
|
80
|
+
const seconds = Number(timeMatch[3] ?? 0);
|
|
81
|
+
if (hours > 23 || minutes > 59 || seconds > 59) return null;
|
|
82
|
+
result.setHours(hours, minutes, seconds, 0);
|
|
83
|
+
}
|
|
84
|
+
return Number.isFinite(result.getTime()) ? result : null;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Compare only the date/time fields the input displays, like its min/max. */
|
|
88
|
+
function inputValueNumber(date, type) {
|
|
89
|
+
if (type === 'month') return date.getFullYear() * 12 + date.getMonth();
|
|
90
|
+
if (type === 'time') return date.getHours() * 60 + date.getMinutes();
|
|
91
|
+
const result = new Date(date.getTime());
|
|
92
|
+
if (type === 'date') result.setHours(0, 0, 0, 0);else result.setSeconds(0, 0);
|
|
93
|
+
return result.getTime();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Bounds also apply to typed values and the modal's initial selection. HTML
|
|
98
|
+
* inputs report constraint violations but don't prevent a button callback.
|
|
99
|
+
*/
|
|
100
|
+
export function isWithinInputBounds(date, type, minDate, maxDate) {
|
|
101
|
+
if (!date || !Number.isFinite(date.getTime())) return false;
|
|
102
|
+
const value = inputValueNumber(date, type);
|
|
103
|
+
const min = minDate ? inputValueNumber(minDate, type) : NaN;
|
|
104
|
+
const max = maxDate ? inputValueNumber(maxDate, type) : NaN;
|
|
105
|
+
// Time inputs have a periodic domain: 23:00–01:00 spans midnight.
|
|
106
|
+
if (type === 'time' && min > max) return value >= min || value <= max;
|
|
107
|
+
return (!Number.isFinite(min) || value >= min) && (!Number.isFinite(max) || value <= max);
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=dateInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["inputTypeForMode","mode","pad","n","width","String","padStart","formatInputValue","date","type","Number","isFinite","getTime","month","getFullYear","getMonth","day","getDate","time","getHours","getMinutes","parseInputValue","value","base","hasBase","result","Date","setHours","monthMatch","exec","year","setFullYear","dayMatch","timeMatch","test","hours","minutes","seconds","inputValueNumber","setSeconds","isWithinInputBounds","minDate","maxDate","min","NaN","max"],"sourceRoot":"../../../src","sources":["web/dateInput.ts"],"mappings":";;AAAA;AACA;AACA;AACA;;AAGA;;AAGA;AACA,OAAO,SAASA,gBAAgBA,CAC9BC,IAAgC,EACjB;EACf,QAAQA,IAAI;IACV,KAAK,MAAM;IACX,KAAK,gBAAgB;MACnB,OAAO,MAAM;IACf,KAAK,aAAa;MAChB,OAAO,gBAAgB;IACzB,KAAK,cAAc;MACjB,OAAO,OAAO;IAChB;MACE,OAAO,MAAM;EACjB;AACF;AAEA,MAAMC,GAAG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