@multiplatform.one/forms 7.66.0 → 7.68.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/dist/cjs/AdaptivePopup/index.cjs +45 -5
- package/dist/cjs/AdaptivePopup/index.native.js +47 -5
- package/dist/cjs/AdaptivePopup/index.native.js.map +1 -1
- package/dist/cjs/Button/glass.cjs +30 -0
- package/dist/cjs/Button/glass.native.js +47 -0
- package/dist/cjs/Button/glass.native.js.map +1 -0
- package/dist/cjs/Button/index.cjs +157 -28
- package/dist/cjs/Button/index.native.js +156 -27
- package/dist/cjs/Button/index.native.js.map +1 -1
- package/dist/cjs/ContextualSaveBar/index.cjs +6 -8
- package/dist/cjs/ContextualSaveBar/index.native.js +6 -8
- package/dist/cjs/ContextualSaveBar/index.native.js.map +1 -1
- package/dist/cjs/DescriptionList/index.cjs +0 -1
- package/dist/cjs/DescriptionList/index.native.js +0 -1
- package/dist/cjs/DescriptionList/index.native.js.map +1 -1
- package/dist/cjs/FloatingPanel/RegularPanel.cjs +164 -0
- package/dist/cjs/FloatingPanel/RegularPanel.native.js +169 -0
- package/dist/cjs/FloatingPanel/RegularPanel.native.js.map +1 -0
- package/dist/cjs/FloatingPanel/compactFace.cjs +6 -0
- package/dist/cjs/FloatingPanel/compactFace.native.js +6 -0
- package/dist/cjs/FloatingPanel/compactFace.native.js.map +1 -1
- package/dist/cjs/FloatingPanel/containingBlock.cjs +46 -0
- package/dist/cjs/FloatingPanel/containingBlock.native.js +51 -0
- package/dist/cjs/FloatingPanel/containingBlock.native.js.map +1 -0
- package/dist/cjs/FloatingPanel/index.cjs +2 -20
- package/dist/cjs/FloatingPanel/index.native.js +79 -45
- package/dist/cjs/FloatingPanel/index.native.js.map +1 -1
- package/dist/cjs/FloatingPanel/pointAnchor.cjs +25 -0
- package/dist/cjs/FloatingPanel/pointAnchor.native.js +26 -0
- package/dist/cjs/FloatingPanel/pointAnchor.native.js.map +1 -1
- package/dist/cjs/FloatingPanel/regularPlacement.cjs +61 -0
- package/dist/cjs/FloatingPanel/regularPlacement.native.js +65 -0
- package/dist/cjs/FloatingPanel/regularPlacement.native.js.map +1 -0
- package/dist/cjs/fields/Barcode/BarcodeScanner.cjs +7 -8
- package/dist/cjs/fields/Barcode/BarcodeScanner.native.js +7 -8
- package/dist/cjs/fields/Barcode/BarcodeScanner.native.js.map +1 -1
- package/dist/cjs/fields/Combobox/index.cjs +1 -1
- package/dist/cjs/fields/Combobox/index.native.js +3 -1
- package/dist/cjs/fields/Combobox/index.native.js.map +1 -1
- package/dist/cjs/fields/FileUpload/index.cjs +83 -60
- package/dist/cjs/fields/FileUpload/index.native.js +96 -73
- package/dist/cjs/fields/FileUpload/index.native.js.map +1 -1
- package/dist/cjs/fields/Geolocation/index.cjs +7 -8
- package/dist/cjs/fields/Geolocation/index.native.js +7 -8
- package/dist/cjs/fields/Geolocation/index.native.js.map +1 -1
- package/dist/cjs/fields/ImageField/index.cjs +4 -6
- package/dist/cjs/fields/ImageField/index.native.js +4 -6
- package/dist/cjs/fields/ImageField/index.native.js.map +1 -1
- package/dist/cjs/fields/Input/index.cjs +5 -0
- package/dist/cjs/fields/Input/index.native.js +5 -0
- package/dist/cjs/fields/Input/index.native.js.map +1 -1
- package/dist/cjs/fields/Select/InlineChoices.cjs +3 -2
- package/dist/cjs/fields/Select/InlineChoices.native.js +5 -2
- package/dist/cjs/fields/Select/InlineChoices.native.js.map +1 -1
- package/dist/cjs/fields/Select/SheetPickerRow.cjs +154 -0
- package/dist/cjs/fields/Select/SheetPickerRow.native.js +165 -0
- package/dist/cjs/fields/Select/SheetPickerRow.native.js.map +1 -0
- package/dist/cjs/fields/Select/index.cjs +63 -4
- package/dist/cjs/fields/Select/index.native.js +85 -26
- package/dist/cjs/fields/Select/index.native.js.map +1 -1
- package/dist/cjs/fields/Select/shouldInlineChoices.cjs +14 -1
- package/dist/cjs/fields/Select/shouldInlineChoices.native.js +15 -1
- package/dist/cjs/fields/Select/shouldInlineChoices.native.js.map +1 -1
- package/dist/cjs/fields/Slider/index.cjs +96 -4
- package/dist/cjs/fields/Slider/index.native.js +103 -5
- package/dist/cjs/fields/Slider/index.native.js.map +1 -1
- package/dist/cjs/fields/Switch/index.cjs +71 -1
- package/dist/cjs/fields/Switch/index.native.js +72 -1
- package/dist/cjs/fields/Switch/index.native.js.map +1 -1
- package/dist/cjs/fields/ToggleGroup/index.cjs +67 -1
- package/dist/cjs/fields/ToggleGroup/index.native.js +75 -1
- package/dist/cjs/fields/ToggleGroup/index.native.js.map +1 -1
- package/dist/cjs/fields/nativeDateTime/OsDateTimeSheet.cjs +54 -47
- package/dist/cjs/fields/nativeDateTime/OsDateTimeSheet.native.js +64 -49
- package/dist/cjs/fields/nativeDateTime/OsDateTimeSheet.native.js.map +1 -1
- package/dist/cjs/fields/nativeDateTime/sheetKeyboard.cjs +54 -0
- package/dist/cjs/fields/nativeDateTime/sheetKeyboard.native.js +57 -0
- package/dist/cjs/fields/nativeDateTime/sheetKeyboard.native.js.map +1 -0
- package/dist/cjs/index.cjs +19 -1
- package/dist/cjs/index.native.js +18 -0
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/shared/colorRamps.cjs +0 -8
- package/dist/cjs/shared/colorRamps.native.js +0 -8
- package/dist/cjs/shared/colorRamps.native.js.map +1 -1
- package/dist/cjs/shared/overlaySizeClass.cjs +42 -0
- package/dist/cjs/shared/overlaySizeClass.native.js +45 -0
- package/dist/cjs/shared/overlaySizeClass.native.js.map +1 -0
- package/dist/cjs/shared/sheetNavigation.cjs +76 -0
- package/dist/cjs/shared/sheetNavigation.native.js +129 -0
- package/dist/cjs/shared/sheetNavigation.native.js.map +1 -0
- package/dist/cjs/shared/systemControlModules.cjs +34 -0
- package/dist/cjs/shared/systemControlModules.gnome.cjs +34 -0
- package/dist/cjs/shared/systemControlModules.gnome.native.js +37 -0
- package/dist/cjs/shared/systemControlModules.gnome.native.js.map +1 -0
- package/dist/cjs/shared/systemControlModules.native.js +77 -0
- package/dist/cjs/shared/systemControlModules.native.js.map +1 -0
- package/dist/cjs/shared/systemControls.cjs +47 -0
- package/dist/cjs/shared/systemControls.native.js +51 -0
- package/dist/cjs/shared/systemControls.native.js.map +1 -0
- package/dist/cjs/standardActions.cjs +117 -0
- package/dist/cjs/standardActions.native.js +120 -0
- package/dist/cjs/standardActions.native.js.map +1 -0
- package/dist/esm/AdaptivePopup/index.mjs +45 -5
- package/dist/esm/AdaptivePopup/index.mjs.map +1 -1
- package/dist/esm/AdaptivePopup/index.native.js +47 -5
- package/dist/esm/AdaptivePopup/index.native.js.map +1 -1
- package/dist/esm/Button/glass.mjs +5 -0
- package/dist/esm/Button/glass.mjs.map +1 -0
- package/dist/esm/Button/glass.native.js +19 -0
- package/dist/esm/Button/glass.native.js.map +1 -0
- package/dist/esm/Button/index.mjs +153 -28
- package/dist/esm/Button/index.mjs.map +1 -1
- package/dist/esm/Button/index.native.js +153 -28
- package/dist/esm/Button/index.native.js.map +1 -1
- package/dist/esm/ContextualSaveBar/index.mjs +7 -9
- package/dist/esm/ContextualSaveBar/index.mjs.map +1 -1
- package/dist/esm/ContextualSaveBar/index.native.js +7 -9
- package/dist/esm/ContextualSaveBar/index.native.js.map +1 -1
- package/dist/esm/DescriptionList/index.mjs +0 -1
- package/dist/esm/DescriptionList/index.mjs.map +1 -1
- package/dist/esm/DescriptionList/index.native.js +0 -1
- package/dist/esm/DescriptionList/index.native.js.map +1 -1
- package/dist/esm/FloatingPanel/RegularPanel.mjs +139 -0
- package/dist/esm/FloatingPanel/RegularPanel.mjs.map +1 -0
- package/dist/esm/FloatingPanel/RegularPanel.native.js +141 -0
- package/dist/esm/FloatingPanel/RegularPanel.native.js.map +1 -0
- package/dist/esm/FloatingPanel/compactFace.mjs +5 -1
- package/dist/esm/FloatingPanel/compactFace.mjs.map +1 -1
- package/dist/esm/FloatingPanel/compactFace.native.js +5 -1
- package/dist/esm/FloatingPanel/compactFace.native.js.map +1 -1
- package/dist/esm/FloatingPanel/containingBlock.mjs +21 -0
- package/dist/esm/FloatingPanel/containingBlock.mjs.map +1 -0
- package/dist/esm/FloatingPanel/containingBlock.native.js +23 -0
- package/dist/esm/FloatingPanel/containingBlock.native.js.map +1 -0
- package/dist/esm/FloatingPanel/index.mjs +1 -19
- package/dist/esm/FloatingPanel/index.mjs.map +1 -1
- package/dist/esm/FloatingPanel/index.native.js +83 -49
- package/dist/esm/FloatingPanel/index.native.js.map +1 -1
- package/dist/esm/FloatingPanel/pointAnchor.mjs +25 -1
- package/dist/esm/FloatingPanel/pointAnchor.mjs.map +1 -1
- package/dist/esm/FloatingPanel/pointAnchor.native.js +26 -1
- package/dist/esm/FloatingPanel/pointAnchor.native.js.map +1 -1
- package/dist/esm/FloatingPanel/regularPlacement.mjs +35 -0
- package/dist/esm/FloatingPanel/regularPlacement.mjs.map +1 -0
- package/dist/esm/FloatingPanel/regularPlacement.native.js +36 -0
- package/dist/esm/FloatingPanel/regularPlacement.native.js.map +1 -0
- package/dist/esm/fields/Barcode/BarcodeScanner.mjs +8 -9
- package/dist/esm/fields/Barcode/BarcodeScanner.mjs.map +1 -1
- package/dist/esm/fields/Barcode/BarcodeScanner.native.js +8 -9
- package/dist/esm/fields/Barcode/BarcodeScanner.native.js.map +1 -1
- package/dist/esm/fields/Combobox/index.mjs +1 -1
- package/dist/esm/fields/Combobox/index.mjs.map +1 -1
- package/dist/esm/fields/Combobox/index.native.js +3 -1
- package/dist/esm/fields/Combobox/index.native.js.map +1 -1
- package/dist/esm/fields/FileUpload/index.mjs +84 -61
- package/dist/esm/fields/FileUpload/index.mjs.map +1 -1
- package/dist/esm/fields/FileUpload/index.native.js +97 -74
- package/dist/esm/fields/FileUpload/index.native.js.map +1 -1
- package/dist/esm/fields/Geolocation/index.mjs +8 -9
- package/dist/esm/fields/Geolocation/index.mjs.map +1 -1
- package/dist/esm/fields/Geolocation/index.native.js +8 -9
- package/dist/esm/fields/Geolocation/index.native.js.map +1 -1
- package/dist/esm/fields/ImageField/index.mjs +6 -8
- package/dist/esm/fields/ImageField/index.mjs.map +1 -1
- package/dist/esm/fields/ImageField/index.native.js +6 -8
- package/dist/esm/fields/ImageField/index.native.js.map +1 -1
- package/dist/esm/fields/Input/index.mjs +6 -1
- package/dist/esm/fields/Input/index.mjs.map +1 -1
- package/dist/esm/fields/Input/index.native.js +6 -1
- package/dist/esm/fields/Input/index.native.js.map +1 -1
- package/dist/esm/fields/Select/InlineChoices.mjs +3 -2
- package/dist/esm/fields/Select/InlineChoices.mjs.map +1 -1
- package/dist/esm/fields/Select/InlineChoices.native.js +5 -2
- package/dist/esm/fields/Select/InlineChoices.native.js.map +1 -1
- package/dist/esm/fields/Select/SheetPickerRow.mjs +129 -0
- package/dist/esm/fields/Select/SheetPickerRow.mjs.map +1 -0
- package/dist/esm/fields/Select/SheetPickerRow.native.js +137 -0
- package/dist/esm/fields/Select/SheetPickerRow.native.js.map +1 -0
- package/dist/esm/fields/Select/index.mjs +64 -5
- package/dist/esm/fields/Select/index.mjs.map +1 -1
- package/dist/esm/fields/Select/index.native.js +86 -27
- package/dist/esm/fields/Select/index.native.js.map +1 -1
- package/dist/esm/fields/Select/shouldInlineChoices.mjs +12 -1
- package/dist/esm/fields/Select/shouldInlineChoices.mjs.map +1 -1
- package/dist/esm/fields/Select/shouldInlineChoices.native.js +13 -1
- package/dist/esm/fields/Select/shouldInlineChoices.native.js.map +1 -1
- package/dist/esm/fields/Slider/index.mjs +96 -4
- package/dist/esm/fields/Slider/index.mjs.map +1 -1
- package/dist/esm/fields/Slider/index.native.js +103 -5
- package/dist/esm/fields/Slider/index.native.js.map +1 -1
- package/dist/esm/fields/Switch/index.mjs +71 -1
- package/dist/esm/fields/Switch/index.mjs.map +1 -1
- package/dist/esm/fields/Switch/index.native.js +72 -1
- package/dist/esm/fields/Switch/index.native.js.map +1 -1
- package/dist/esm/fields/ToggleGroup/index.mjs +67 -1
- package/dist/esm/fields/ToggleGroup/index.mjs.map +1 -1
- package/dist/esm/fields/ToggleGroup/index.native.js +75 -1
- package/dist/esm/fields/ToggleGroup/index.native.js.map +1 -1
- package/dist/esm/fields/nativeDateTime/OsDateTimeSheet.mjs +56 -49
- package/dist/esm/fields/nativeDateTime/OsDateTimeSheet.mjs.map +1 -1
- package/dist/esm/fields/nativeDateTime/OsDateTimeSheet.native.js +66 -51
- package/dist/esm/fields/nativeDateTime/OsDateTimeSheet.native.js.map +1 -1
- package/dist/esm/fields/nativeDateTime/sheetKeyboard.mjs +21 -0
- package/dist/esm/fields/nativeDateTime/sheetKeyboard.mjs.map +1 -0
- package/dist/esm/fields/nativeDateTime/sheetKeyboard.native.js +21 -0
- package/dist/esm/fields/nativeDateTime/sheetKeyboard.native.js.map +1 -0
- package/dist/esm/index.mjs +5 -2
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +5 -2
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/shared/colorRamps.mjs +0 -8
- package/dist/esm/shared/colorRamps.mjs.map +1 -1
- package/dist/esm/shared/colorRamps.native.js +0 -8
- package/dist/esm/shared/colorRamps.native.js.map +1 -1
- package/dist/esm/shared/overlaySizeClass.mjs +14 -0
- package/dist/esm/shared/overlaySizeClass.mjs.map +1 -0
- package/dist/esm/shared/overlaySizeClass.native.js +14 -0
- package/dist/esm/shared/overlaySizeClass.native.js.map +1 -0
- package/dist/esm/shared/sheetNavigation.mjs +47 -0
- package/dist/esm/shared/sheetNavigation.mjs.map +1 -0
- package/dist/esm/shared/sheetNavigation.native.js +97 -0
- package/dist/esm/shared/sheetNavigation.native.js.map +1 -0
- package/dist/esm/shared/systemControlModules.gnome.mjs +8 -0
- package/dist/esm/shared/systemControlModules.gnome.mjs.map +1 -0
- package/dist/esm/shared/systemControlModules.gnome.native.js +8 -0
- package/dist/esm/shared/systemControlModules.gnome.native.js.map +1 -0
- package/dist/esm/shared/systemControlModules.mjs +8 -0
- package/dist/esm/shared/systemControlModules.mjs.map +1 -0
- package/dist/esm/shared/systemControlModules.native.js +47 -0
- package/dist/esm/shared/systemControlModules.native.js.map +1 -0
- package/dist/esm/shared/systemControls.mjs +19 -0
- package/dist/esm/shared/systemControls.mjs.map +1 -0
- package/dist/esm/shared/systemControls.native.js +20 -0
- package/dist/esm/shared/systemControls.native.js.map +1 -0
- package/dist/esm/standardActions.mjs +91 -0
- package/dist/esm/standardActions.mjs.map +1 -0
- package/dist/esm/standardActions.native.js +91 -0
- package/dist/esm/standardActions.native.js.map +1 -0
- package/dist/jsx/AdaptivePopup/index.mjs +45 -5
- package/dist/jsx/AdaptivePopup/index.mjs.map +1 -1
- package/dist/jsx/AdaptivePopup/index.native.js +47 -5
- package/dist/jsx/AdaptivePopup/index.native.js.map +1 -1
- package/dist/jsx/Button/glass.mjs +5 -0
- package/dist/jsx/Button/glass.mjs.map +1 -0
- package/dist/jsx/Button/glass.native.js +47 -0
- package/dist/jsx/Button/glass.native.js.map +1 -0
- package/dist/jsx/Button/index.mjs +153 -28
- package/dist/jsx/Button/index.mjs.map +1 -1
- package/dist/jsx/Button/index.native.js +156 -27
- package/dist/jsx/Button/index.native.js.map +1 -1
- package/dist/jsx/ContextualSaveBar/index.mjs +7 -9
- package/dist/jsx/ContextualSaveBar/index.mjs.map +1 -1
- package/dist/jsx/ContextualSaveBar/index.native.js +6 -8
- package/dist/jsx/ContextualSaveBar/index.native.js.map +1 -1
- package/dist/jsx/DescriptionList/index.mjs +0 -1
- package/dist/jsx/DescriptionList/index.mjs.map +1 -1
- package/dist/jsx/DescriptionList/index.native.js +0 -1
- package/dist/jsx/DescriptionList/index.native.js.map +1 -1
- package/dist/jsx/FloatingPanel/RegularPanel.mjs +139 -0
- package/dist/jsx/FloatingPanel/RegularPanel.mjs.map +1 -0
- package/dist/jsx/FloatingPanel/RegularPanel.native.js +169 -0
- package/dist/jsx/FloatingPanel/RegularPanel.native.js.map +1 -0
- package/dist/jsx/FloatingPanel/compactFace.mjs +5 -1
- package/dist/jsx/FloatingPanel/compactFace.mjs.map +1 -1
- package/dist/jsx/FloatingPanel/compactFace.native.js +6 -0
- package/dist/jsx/FloatingPanel/compactFace.native.js.map +1 -1
- package/dist/jsx/FloatingPanel/containingBlock.mjs +21 -0
- package/dist/jsx/FloatingPanel/containingBlock.mjs.map +1 -0
- package/dist/jsx/FloatingPanel/containingBlock.native.js +51 -0
- package/dist/jsx/FloatingPanel/containingBlock.native.js.map +1 -0
- package/dist/jsx/FloatingPanel/index.mjs +1 -19
- package/dist/jsx/FloatingPanel/index.mjs.map +1 -1
- package/dist/jsx/FloatingPanel/index.native.js +79 -45
- package/dist/jsx/FloatingPanel/index.native.js.map +1 -1
- package/dist/jsx/FloatingPanel/pointAnchor.mjs +25 -1
- package/dist/jsx/FloatingPanel/pointAnchor.mjs.map +1 -1
- package/dist/jsx/FloatingPanel/pointAnchor.native.js +26 -0
- package/dist/jsx/FloatingPanel/pointAnchor.native.js.map +1 -1
- package/dist/jsx/FloatingPanel/regularPlacement.mjs +35 -0
- package/dist/jsx/FloatingPanel/regularPlacement.mjs.map +1 -0
- package/dist/jsx/FloatingPanel/regularPlacement.native.js +65 -0
- package/dist/jsx/FloatingPanel/regularPlacement.native.js.map +1 -0
- package/dist/jsx/fields/Barcode/BarcodeScanner.mjs +8 -9
- package/dist/jsx/fields/Barcode/BarcodeScanner.mjs.map +1 -1
- package/dist/jsx/fields/Barcode/BarcodeScanner.native.js +7 -8
- package/dist/jsx/fields/Barcode/BarcodeScanner.native.js.map +1 -1
- package/dist/jsx/fields/Combobox/index.mjs +1 -1
- package/dist/jsx/fields/Combobox/index.mjs.map +1 -1
- package/dist/jsx/fields/Combobox/index.native.js +3 -1
- package/dist/jsx/fields/Combobox/index.native.js.map +1 -1
- package/dist/jsx/fields/FileUpload/index.mjs +84 -61
- package/dist/jsx/fields/FileUpload/index.mjs.map +1 -1
- package/dist/jsx/fields/FileUpload/index.native.js +96 -73
- package/dist/jsx/fields/FileUpload/index.native.js.map +1 -1
- package/dist/jsx/fields/Geolocation/index.mjs +8 -9
- package/dist/jsx/fields/Geolocation/index.mjs.map +1 -1
- package/dist/jsx/fields/Geolocation/index.native.js +7 -8
- package/dist/jsx/fields/Geolocation/index.native.js.map +1 -1
- package/dist/jsx/fields/ImageField/index.mjs +6 -8
- package/dist/jsx/fields/ImageField/index.mjs.map +1 -1
- package/dist/jsx/fields/ImageField/index.native.js +4 -6
- package/dist/jsx/fields/ImageField/index.native.js.map +1 -1
- package/dist/jsx/fields/Input/index.mjs +6 -1
- package/dist/jsx/fields/Input/index.mjs.map +1 -1
- package/dist/jsx/fields/Input/index.native.js +5 -0
- package/dist/jsx/fields/Input/index.native.js.map +1 -1
- package/dist/jsx/fields/Select/InlineChoices.mjs +3 -2
- package/dist/jsx/fields/Select/InlineChoices.mjs.map +1 -1
- package/dist/jsx/fields/Select/InlineChoices.native.js +5 -2
- package/dist/jsx/fields/Select/InlineChoices.native.js.map +1 -1
- package/dist/jsx/fields/Select/SheetPickerRow.mjs +129 -0
- package/dist/jsx/fields/Select/SheetPickerRow.mjs.map +1 -0
- package/dist/jsx/fields/Select/SheetPickerRow.native.js +165 -0
- package/dist/jsx/fields/Select/SheetPickerRow.native.js.map +1 -0
- package/dist/jsx/fields/Select/index.mjs +64 -5
- package/dist/jsx/fields/Select/index.mjs.map +1 -1
- package/dist/jsx/fields/Select/index.native.js +85 -26
- package/dist/jsx/fields/Select/index.native.js.map +1 -1
- package/dist/jsx/fields/Select/shouldInlineChoices.mjs +12 -1
- package/dist/jsx/fields/Select/shouldInlineChoices.mjs.map +1 -1
- package/dist/jsx/fields/Select/shouldInlineChoices.native.js +15 -1
- package/dist/jsx/fields/Select/shouldInlineChoices.native.js.map +1 -1
- package/dist/jsx/fields/Slider/index.mjs +96 -4
- package/dist/jsx/fields/Slider/index.mjs.map +1 -1
- package/dist/jsx/fields/Slider/index.native.js +103 -5
- package/dist/jsx/fields/Slider/index.native.js.map +1 -1
- package/dist/jsx/fields/Switch/index.mjs +71 -1
- package/dist/jsx/fields/Switch/index.mjs.map +1 -1
- package/dist/jsx/fields/Switch/index.native.js +72 -1
- package/dist/jsx/fields/Switch/index.native.js.map +1 -1
- package/dist/jsx/fields/ToggleGroup/index.mjs +67 -1
- package/dist/jsx/fields/ToggleGroup/index.mjs.map +1 -1
- package/dist/jsx/fields/ToggleGroup/index.native.js +75 -1
- package/dist/jsx/fields/ToggleGroup/index.native.js.map +1 -1
- package/dist/jsx/fields/nativeDateTime/OsDateTimeSheet.mjs +56 -49
- package/dist/jsx/fields/nativeDateTime/OsDateTimeSheet.mjs.map +1 -1
- package/dist/jsx/fields/nativeDateTime/OsDateTimeSheet.native.js +64 -49
- package/dist/jsx/fields/nativeDateTime/OsDateTimeSheet.native.js.map +1 -1
- package/dist/jsx/fields/nativeDateTime/sheetKeyboard.mjs +21 -0
- package/dist/jsx/fields/nativeDateTime/sheetKeyboard.mjs.map +1 -0
- package/dist/jsx/fields/nativeDateTime/sheetKeyboard.native.js +57 -0
- package/dist/jsx/fields/nativeDateTime/sheetKeyboard.native.js.map +1 -0
- package/dist/jsx/index.js +5 -2
- package/dist/jsx/index.js.map +1 -1
- package/dist/jsx/index.mjs +5 -2
- package/dist/jsx/index.mjs.map +1 -1
- package/dist/jsx/index.native.js +18 -0
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/shared/colorRamps.mjs +0 -8
- package/dist/jsx/shared/colorRamps.mjs.map +1 -1
- package/dist/jsx/shared/colorRamps.native.js +0 -8
- package/dist/jsx/shared/colorRamps.native.js.map +1 -1
- package/dist/jsx/shared/overlaySizeClass.mjs +14 -0
- package/dist/jsx/shared/overlaySizeClass.mjs.map +1 -0
- package/dist/jsx/shared/overlaySizeClass.native.js +45 -0
- package/dist/jsx/shared/overlaySizeClass.native.js.map +1 -0
- package/dist/jsx/shared/sheetNavigation.mjs +47 -0
- package/dist/jsx/shared/sheetNavigation.mjs.map +1 -0
- package/dist/jsx/shared/sheetNavigation.native.js +129 -0
- package/dist/jsx/shared/sheetNavigation.native.js.map +1 -0
- package/dist/jsx/shared/systemControlModules.gnome.mjs +8 -0
- package/dist/jsx/shared/systemControlModules.gnome.mjs.map +1 -0
- package/dist/jsx/shared/systemControlModules.gnome.native.js +37 -0
- package/dist/jsx/shared/systemControlModules.gnome.native.js.map +1 -0
- package/dist/jsx/shared/systemControlModules.mjs +8 -0
- package/dist/jsx/shared/systemControlModules.mjs.map +1 -0
- package/dist/jsx/shared/systemControlModules.native.js +77 -0
- package/dist/jsx/shared/systemControlModules.native.js.map +1 -0
- package/dist/jsx/shared/systemControls.mjs +19 -0
- package/dist/jsx/shared/systemControls.mjs.map +1 -0
- package/dist/jsx/shared/systemControls.native.js +51 -0
- package/dist/jsx/shared/systemControls.native.js.map +1 -0
- package/dist/jsx/standardActions.mjs +91 -0
- package/dist/jsx/standardActions.mjs.map +1 -0
- package/dist/jsx/standardActions.native.js +120 -0
- package/dist/jsx/standardActions.native.js.map +1 -0
- package/package.json +20 -8
- package/src/AdaptivePopup/AdaptivePopup.spec.tsx +44 -0
- package/src/AdaptivePopup/AdaptivePopup.stories.tsx +12 -32
- package/src/AdaptivePopup/index.tsx +65 -13
- package/src/Button/Button.disabledGlyph.spec.tsx +111 -0
- package/src/Button/Button.iconButton.spec.tsx +279 -0
- package/src/Button/Button.stories.tsx +59 -3
- package/src/Button/glass.native.ts +38 -0
- package/src/Button/glass.ts +18 -0
- package/src/Button/index.tsx +272 -40
- package/src/ContextualSaveBar/ContextualSaveBar.spec.tsx +3 -1
- package/src/ContextualSaveBar/ContextualSaveBar.stories.tsx +2 -2
- package/src/ContextualSaveBar/index.tsx +7 -10
- package/src/ControlGroup/ControlGroup.stories.tsx +3 -2
- package/src/DescriptionList/index.tsx +0 -1
- package/src/ErrorSummary.stories.tsx +2 -1
- package/src/FieldLayout.stories.tsx +3 -2
- package/src/FloatingPanel/FloatingPanel.menuFace.native.spec.tsx +73 -3
- package/src/FloatingPanel/FloatingPanel.regularWidth.native.spec.tsx +193 -0
- package/src/FloatingPanel/FloatingPanel.stories.tsx +6 -10
- package/src/FloatingPanel/RegularPanel.tsx +159 -0
- package/src/FloatingPanel/compactFace.spec.ts +24 -1
- package/src/FloatingPanel/compactFace.ts +16 -0
- package/src/FloatingPanel/containingBlock.ts +32 -0
- package/src/FloatingPanel/index.native.tsx +80 -35
- package/src/FloatingPanel/index.tsx +1 -33
- package/src/FloatingPanel/pointAnchor.spec.ts +29 -0
- package/src/FloatingPanel/pointAnchor.ts +30 -0
- package/src/FloatingPanel/regularPlacement.spec.ts +65 -0
- package/src/FloatingPanel/regularPlacement.ts +40 -0
- package/src/Form/Form.stories.tsx +6 -5
- package/src/errorSummaryStories.spec.tsx +4 -4
- package/src/fields/Barcode/BarcodeScanner.native.tsx +10 -9
- package/src/fields/Barcode/BarcodeScanner.tsx +10 -9
- package/src/fields/Checkbox/Checkbox.stories.tsx +3 -3
- package/src/fields/Checkbox/CheckboxGroup.stories.tsx +2 -2
- package/src/fields/ColorPicker/ColorPicker.stories.tsx +2 -2
- package/src/fields/Combobox/Combobox.regularWidth.native.spec.tsx +94 -0
- package/src/fields/Combobox/Combobox.stories.tsx +2 -2
- package/src/fields/Combobox/index.tsx +3 -1
- package/src/fields/DatePicker/DatePicker.stories.tsx +2 -1
- package/src/fields/DatePicker/DateRangePicker.stories.tsx +2 -2
- package/src/fields/DatePicker/DatetimePicker.stories.tsx +2 -1
- package/src/fields/DatePicker/MonthPicker.stories.tsx +2 -2
- package/src/fields/DatePicker/MultiDatePicker.stories.tsx +2 -2
- package/src/fields/FileUpload/FileUpload.spec.tsx +11 -6
- package/src/fields/FileUpload/FileUpload.stories.tsx +2 -2
- package/src/fields/FileUpload/index.tsx +101 -77
- package/src/fields/Geolocation/index.tsx +12 -7
- package/src/fields/ImageField/ImageField.spec.tsx +5 -5
- package/src/fields/ImageField/ImageField.stories.tsx +2 -2
- package/src/fields/ImageField/index.tsx +6 -9
- package/src/fields/Input/Input.formName.spec.tsx +53 -0
- package/src/fields/Input/Input.stories.tsx +2 -2
- package/src/fields/Input/index.tsx +6 -1
- package/src/fields/MentionInput/MentionInput.stories.tsx +2 -1
- package/src/fields/Progress/Progress.stories.tsx +2 -1
- package/src/fields/RadioGroup/RadioGroup.stories.tsx +2 -1
- package/src/fields/Select/InlineChoices.tsx +6 -3
- package/src/fields/Select/SheetPickerRow.tsx +160 -0
- package/src/fields/Select/index.tsx +65 -4
- package/src/fields/Select/shouldInlineChoices.spec.ts +21 -1
- package/src/fields/Select/shouldInlineChoices.ts +26 -0
- package/src/fields/Signature/Signature.stories.tsx +2 -2
- package/src/fields/Slider/Slider.system.native.spec.tsx +168 -0
- package/src/fields/Slider/index.tsx +166 -30
- package/src/fields/Stepper/Stepper.stories.tsx +2 -2
- package/src/fields/Switch/Switch.system.native.spec.tsx +162 -0
- package/src/fields/Switch/index.tsx +98 -0
- package/src/fields/TextArea/TextArea.stories.tsx +2 -2
- package/src/fields/ToggleGroup/ToggleGroup.stories.tsx +2 -2
- package/src/fields/ToggleGroup/ToggleGroup.system.native.spec.tsx +192 -0
- package/src/fields/ToggleGroup/index.tsx +111 -0
- package/src/fields/nativeDateTime/OsDateTimeSheet.presentation.spec.tsx +168 -0
- package/src/fields/nativeDateTime/OsDateTimeSheet.tsx +60 -30
- package/src/fields/nativeDateTime/sheetKeyboard.spec.ts +60 -0
- package/src/fields/nativeDateTime/sheetKeyboard.ts +45 -0
- package/src/index.ts +25 -2
- package/src/shared/colorRamps.ts +1 -11
- package/src/shared/overlaySizeClass.spec.ts +27 -0
- package/src/shared/overlaySizeClass.ts +36 -0
- package/src/shared/sheetNavigation.ts +82 -0
- package/src/shared/systemControlModules.gnome.ts +10 -0
- package/src/shared/systemControlModules.native.spec.ts +52 -0
- package/src/shared/systemControlModules.native.ts +66 -0
- package/src/shared/systemControlModules.ts +10 -0
- package/src/shared/systemControls.ts +70 -0
- package/src/standardActions.ts +96 -0
- package/types/AdaptivePopup/index.d.ts +13 -1
- package/types/AdaptivePopup/index.d.ts.map +1 -1
- package/types/Button/glass.d.ts +15 -0
- package/types/Button/glass.d.ts.map +1 -0
- package/types/Button/glass.native.d.ts +11 -0
- package/types/Button/glass.native.d.ts.map +1 -0
- package/types/Button/index.d.ts +45 -1
- package/types/Button/index.d.ts.map +1 -1
- package/types/ContextualSaveBar/index.d.ts.map +1 -1
- package/types/DescriptionList/index.d.ts.map +1 -1
- package/types/FloatingPanel/RegularPanel.d.ts +29 -0
- package/types/FloatingPanel/RegularPanel.d.ts.map +1 -0
- package/types/FloatingPanel/compactFace.d.ts +12 -0
- package/types/FloatingPanel/compactFace.d.ts.map +1 -1
- package/types/FloatingPanel/containingBlock.d.ts +14 -0
- package/types/FloatingPanel/containingBlock.d.ts.map +1 -0
- package/types/FloatingPanel/index.d.ts.map +1 -1
- package/types/FloatingPanel/index.native.d.ts +6 -1
- package/types/FloatingPanel/index.native.d.ts.map +1 -1
- package/types/FloatingPanel/pointAnchor.d.ts +12 -0
- package/types/FloatingPanel/pointAnchor.d.ts.map +1 -1
- package/types/FloatingPanel/regularPlacement.d.ts +20 -0
- package/types/FloatingPanel/regularPlacement.d.ts.map +1 -0
- package/types/fields/Barcode/BarcodeScanner.d.ts.map +1 -1
- package/types/fields/Barcode/BarcodeScanner.native.d.ts.map +1 -1
- package/types/fields/Combobox/index.d.ts.map +1 -1
- package/types/fields/FileUpload/index.d.ts.map +1 -1
- package/types/fields/Geolocation/index.d.ts.map +1 -1
- package/types/fields/ImageField/index.d.ts.map +1 -1
- package/types/fields/Input/index.d.ts.map +1 -1
- package/types/fields/Select/InlineChoices.d.ts.map +1 -1
- package/types/fields/Select/SheetPickerRow.d.ts +23 -0
- package/types/fields/Select/SheetPickerRow.d.ts.map +1 -0
- package/types/fields/Select/index.d.ts.map +1 -1
- package/types/fields/Select/shouldInlineChoices.d.ts +15 -0
- package/types/fields/Select/shouldInlineChoices.d.ts.map +1 -1
- package/types/fields/Slider/index.d.ts +7 -1
- package/types/fields/Slider/index.d.ts.map +1 -1
- package/types/fields/Switch/index.d.ts +7 -1
- package/types/fields/Switch/index.d.ts.map +1 -1
- package/types/fields/ToggleGroup/index.d.ts +8 -1
- package/types/fields/ToggleGroup/index.d.ts.map +1 -1
- package/types/fields/nativeDateTime/OsDateTimeSheet.d.ts.map +1 -1
- package/types/fields/nativeDateTime/sheetKeyboard.d.ts +20 -0
- package/types/fields/nativeDateTime/sheetKeyboard.d.ts.map +1 -0
- package/types/index.d.ts +8 -2
- package/types/index.d.ts.map +1 -1
- package/types/shared/colorRamps.d.ts +1 -11
- package/types/shared/colorRamps.d.ts.map +1 -1
- package/types/shared/overlaySizeClass.d.ts +24 -0
- package/types/shared/overlaySizeClass.d.ts.map +1 -0
- package/types/shared/sheetNavigation.d.ts +31 -0
- package/types/shared/sheetNavigation.d.ts.map +1 -0
- package/types/shared/systemControlModules.d.ts +5 -0
- package/types/shared/systemControlModules.d.ts.map +1 -0
- package/types/shared/systemControlModules.gnome.d.ts +5 -0
- package/types/shared/systemControlModules.gnome.d.ts.map +1 -0
- package/types/shared/systemControlModules.native.d.ts +20 -0
- package/types/shared/systemControlModules.native.d.ts.map +1 -0
- package/types/shared/systemControls.d.ts +53 -0
- package/types/shared/systemControls.d.ts.map +1 -0
- package/types/standardActions.d.ts +24 -0
- package/types/standardActions.d.ts.map +1 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
2
|
+
import { createDefaultThemeConfig } from "@multiplatform.one/theme";
|
|
3
|
+
import { useForm } from "@tanstack/react-form";
|
|
4
|
+
import { cleanup, fireEvent, render } from "@testing-library/react";
|
|
5
|
+
import type { ReactElement } from "react";
|
|
6
|
+
import { TamaguiProvider } from "tamagui";
|
|
7
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
8
|
+
import { Form } from "../../Form";
|
|
9
|
+
import { Slider } from "./index";
|
|
10
|
+
|
|
11
|
+
const system = vi.hoisted(() => ({
|
|
12
|
+
os: "ios" as "ios" | "android" | null,
|
|
13
|
+
installed: true,
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
// The system slider as a probe: it shows the props it got and moves through
|
|
17
|
+
// onValueChange, then onSlidingComplete, the way a drag on UISlider does.
|
|
18
|
+
const SystemSliderProbe = vi.hoisted(
|
|
19
|
+
() =>
|
|
20
|
+
function SystemSliderProbe(props: Record<string, any>) {
|
|
21
|
+
return (
|
|
22
|
+
<input
|
|
23
|
+
data-testid="system-slider"
|
|
24
|
+
data-fill={props.minimumTrackTintColor}
|
|
25
|
+
data-rail={props.maximumTrackTintColor}
|
|
26
|
+
data-thumb={props.thumbTintColor ?? ""}
|
|
27
|
+
data-label={props.accessibilityLabel ?? ""}
|
|
28
|
+
data-min={props.minimumValue}
|
|
29
|
+
data-max={props.maximumValue}
|
|
30
|
+
data-step={props.step}
|
|
31
|
+
disabled={props.disabled}
|
|
32
|
+
value={props.value}
|
|
33
|
+
onChange={(event) => {
|
|
34
|
+
props.onValueChange?.(Number(event.target.value));
|
|
35
|
+
props.onSlidingComplete?.(Number(event.target.value));
|
|
36
|
+
}}
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
},
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
vi.mock("../../shared/systemControls", async (importOriginal) => ({
|
|
43
|
+
...(await importOriginal<typeof import("../../shared/systemControls")>()),
|
|
44
|
+
systemControlPlatform: () => system.os,
|
|
45
|
+
}));
|
|
46
|
+
|
|
47
|
+
vi.mock("../../shared/systemControlModules", () => ({
|
|
48
|
+
loadSystemSlider: () => (system.installed ? SystemSliderProbe : null),
|
|
49
|
+
loadSystemSegmentedControl: () => null,
|
|
50
|
+
}));
|
|
51
|
+
|
|
52
|
+
const mpoTheme = createDefaultThemeConfig();
|
|
53
|
+
const renderInScheme = (ui: ReactElement, scheme: "light" | "dark") =>
|
|
54
|
+
render(
|
|
55
|
+
<TamaguiProvider config={mpoTheme.tamagui} defaultTheme={scheme} disableInjectCSS>
|
|
56
|
+
{ui}
|
|
57
|
+
</TamaguiProvider>,
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
afterEach(cleanup);
|
|
61
|
+
beforeEach(() => {
|
|
62
|
+
system.os = "ios";
|
|
63
|
+
system.installed = true;
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const literal = (value: string | null) => Boolean(value) && !value!.startsWith("$");
|
|
67
|
+
const mpoSlider = (container: HTMLElement) => container.querySelector('[role="slider"]');
|
|
68
|
+
|
|
69
|
+
function FormSlider({ onSubmit }: { onSubmit: (value: { volume: number }) => void }) {
|
|
70
|
+
const form = useForm({ defaultValues: { volume: 20 }, onSubmit: ({ value }) => onSubmit(value) });
|
|
71
|
+
return (
|
|
72
|
+
<Form form={form}>
|
|
73
|
+
<Slider name="volume" label="Volume" />
|
|
74
|
+
<button type="button" onClick={() => form.handleSubmit()}>
|
|
75
|
+
Save
|
|
76
|
+
</button>
|
|
77
|
+
</Form>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// LC-266 PLATFORM-ERGONOMICS (FZ-8118). With @react-native-community/slider in
|
|
82
|
+
// the binary, iOS and Android render the system slider tinted from the theme.
|
|
83
|
+
// Without it (One's binary today, an OTA on an older build) the MPO slider.
|
|
84
|
+
describe("Slider on iOS and Android", () => {
|
|
85
|
+
it.each(["light", "dark"] as const)(
|
|
86
|
+
"renders the system slider with the %s theme's fill and rail as literals",
|
|
87
|
+
(scheme) => {
|
|
88
|
+
const result = renderInScheme(
|
|
89
|
+
<Slider label="Volume" defaultValue={[30]} min={10} max={90} step={5} />,
|
|
90
|
+
scheme,
|
|
91
|
+
);
|
|
92
|
+
const view = result.getByTestId("system-slider") as HTMLInputElement;
|
|
93
|
+
expect(view.value).toBe("30");
|
|
94
|
+
expect(view.dataset).toMatchObject({ min: "10", max: "90", step: "5", label: "Volume" });
|
|
95
|
+
expect(literal(view.getAttribute("data-fill"))).toBe(true);
|
|
96
|
+
expect(literal(view.getAttribute("data-rail"))).toBe(true);
|
|
97
|
+
expect(view.getAttribute("data-fill")).not.toBe(view.getAttribute("data-rail"));
|
|
98
|
+
expect(view.dataset.thumb).toBe("");
|
|
99
|
+
expect(mpoSlider(result.container)).toBeNull();
|
|
100
|
+
expect(result.getByText("30")).toBeTruthy();
|
|
101
|
+
},
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
it("tints the Android thumb with the fill", () => {
|
|
105
|
+
system.os = "android";
|
|
106
|
+
const result = renderInScheme(<Slider label="Volume" />, "light");
|
|
107
|
+
const view = result.getByTestId("system-slider");
|
|
108
|
+
expect(literal(view.getAttribute("data-thumb"))).toBe(true);
|
|
109
|
+
expect(view.dataset.thumb).toBe(view.dataset.fill);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it("reports a move as a one-value array and updates the readout", () => {
|
|
113
|
+
const onChange = vi.fn();
|
|
114
|
+
const result = renderWithProviders(<Slider label="Volume" onChange={onChange} />);
|
|
115
|
+
fireEvent.change(result.getByTestId("system-slider"), { target: { value: "40" } });
|
|
116
|
+
expect(onChange).toHaveBeenCalledWith([40]);
|
|
117
|
+
expect(result.getByText("40")).toBeTruthy();
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
it("writes the form field it is bound to", async () => {
|
|
121
|
+
const onSubmit = vi.fn();
|
|
122
|
+
const result = renderWithProviders(<FormSlider onSubmit={onSubmit} />);
|
|
123
|
+
expect((result.getByTestId("system-slider") as HTMLInputElement).value).toBe("20");
|
|
124
|
+
fireEvent.change(result.getByTestId("system-slider"), { target: { value: "55" } });
|
|
125
|
+
fireEvent.click(result.getByText("Save"));
|
|
126
|
+
await vi.waitFor(() => expect(onSubmit).toHaveBeenCalledWith({ volume: 55 }));
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it("passes disabled through and never reports a disabled or read-only move", () => {
|
|
130
|
+
const onChange = vi.fn();
|
|
131
|
+
const result = renderWithProviders(
|
|
132
|
+
<>
|
|
133
|
+
<Slider label="Off limits" onChange={onChange} disabled />
|
|
134
|
+
<Slider label="Look only" onChange={onChange} readOnly />
|
|
135
|
+
</>,
|
|
136
|
+
);
|
|
137
|
+
const [disabledView, readOnlyView] = result.getAllByTestId("system-slider");
|
|
138
|
+
expect((disabledView as HTMLInputElement).disabled).toBe(true);
|
|
139
|
+
fireEvent.change(disabledView!, { target: { value: "40" } });
|
|
140
|
+
fireEvent.change(readOnlyView!, { target: { value: "40" } });
|
|
141
|
+
expect(onChange).not.toHaveBeenCalled();
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it("falls back to the MPO slider when the binary lacks the module", () => {
|
|
145
|
+
system.installed = false;
|
|
146
|
+
const result = renderWithProviders(<Slider label="Volume" defaultValue={[30]} />);
|
|
147
|
+
expect(result.queryByTestId("system-slider")).toBeNull();
|
|
148
|
+
expect(mpoSlider(result.container)).not.toBeNull();
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it("keeps the MPO slider for a range, a vertical slider and native={false}", () => {
|
|
152
|
+
const result = renderWithProviders(
|
|
153
|
+
<>
|
|
154
|
+
<Slider label="Range" defaultValue={[10, 60]} />
|
|
155
|
+
<Slider label="Tall" sliderProps={{ orientation: "vertical" }} />
|
|
156
|
+
<Slider label="Opted out" native={false} />
|
|
157
|
+
</>,
|
|
158
|
+
);
|
|
159
|
+
expect(result.queryByTestId("system-slider")).toBeNull();
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
it("keeps the MPO slider on web and GNOME", () => {
|
|
163
|
+
system.os = null;
|
|
164
|
+
const result = renderWithProviders(<Slider label="Volume" />);
|
|
165
|
+
expect(result.queryByTestId("system-slider")).toBeNull();
|
|
166
|
+
expect(mpoSlider(result.container)).not.toBeNull();
|
|
167
|
+
});
|
|
168
|
+
});
|
|
@@ -33,6 +33,13 @@ import {
|
|
|
33
33
|
import { Skeleton } from "../../Skeleton";
|
|
34
34
|
import { Field, FieldLayout, useFieldA11y, useFieldDescribedBy } from "../../fieldLayout";
|
|
35
35
|
import { formCommonColors, formControlColors, formSelectedColors } from "../../shared/colorRamps";
|
|
36
|
+
import { loadSystemSlider } from "../../shared/systemControlModules";
|
|
37
|
+
import {
|
|
38
|
+
type SystemPlatform,
|
|
39
|
+
type SystemSliderComponent,
|
|
40
|
+
systemControlPlatform,
|
|
41
|
+
useThemeLiteral,
|
|
42
|
+
} from "../../shared/systemControls";
|
|
36
43
|
import { t } from "../../shared/t";
|
|
37
44
|
import {
|
|
38
45
|
getElevationWrapperProps,
|
|
@@ -180,6 +187,12 @@ export interface SliderProps {
|
|
|
180
187
|
/** When true, renders a skeleton placeholder instead of the slider */
|
|
181
188
|
skeleton?: boolean;
|
|
182
189
|
"aria-label"?: string;
|
|
190
|
+
/**
|
|
191
|
+
* LC-266: on iOS and Android a single-thumb horizontal slider renders the
|
|
192
|
+
* system slider when the binary carries `@react-native-community/slider`.
|
|
193
|
+
* `false` keeps the MPO slider there.
|
|
194
|
+
*/
|
|
195
|
+
native?: boolean;
|
|
183
196
|
}
|
|
184
197
|
|
|
185
198
|
type SliderControlProps = {
|
|
@@ -219,6 +232,91 @@ type SliderControlProps = {
|
|
|
219
232
|
* (track click, keyboard, controlled value change). Drag and first paint stay
|
|
220
233
|
* transition-off so the handle never lags the pointer or wiggles on mount.
|
|
221
234
|
*/
|
|
235
|
+
/**
|
|
236
|
+
* LC-266: the system slider (UISlider, Android SeekBar). The theme paints the
|
|
237
|
+
* fill and the rail, and the Android thumb; iOS keeps its system thumb. The
|
|
238
|
+
* value readout stays beside it, as on the MPO slider.
|
|
239
|
+
*/
|
|
240
|
+
function SystemSliderControl({
|
|
241
|
+
Component,
|
|
242
|
+
platform,
|
|
243
|
+
id,
|
|
244
|
+
value,
|
|
245
|
+
min,
|
|
246
|
+
max,
|
|
247
|
+
step,
|
|
248
|
+
disabled,
|
|
249
|
+
readOnly,
|
|
250
|
+
hasError,
|
|
251
|
+
accessibilityLabel,
|
|
252
|
+
accessibilityHint,
|
|
253
|
+
height,
|
|
254
|
+
onChangeValue,
|
|
255
|
+
onBlur,
|
|
256
|
+
}: {
|
|
257
|
+
Component: SystemSliderComponent;
|
|
258
|
+
platform: SystemPlatform;
|
|
259
|
+
id: string;
|
|
260
|
+
value: number;
|
|
261
|
+
min: number;
|
|
262
|
+
max: number;
|
|
263
|
+
step: number;
|
|
264
|
+
disabled?: boolean;
|
|
265
|
+
readOnly?: boolean;
|
|
266
|
+
hasError?: boolean;
|
|
267
|
+
accessibilityLabel?: string;
|
|
268
|
+
accessibilityHint?: string;
|
|
269
|
+
height: SizeTokens;
|
|
270
|
+
onChangeValue: (value: number) => void;
|
|
271
|
+
onBlur?: (...args: any[]) => void;
|
|
272
|
+
}) {
|
|
273
|
+
const literal = useThemeLiteral();
|
|
274
|
+
const [displayValue, setDisplayValue] = useState(value);
|
|
275
|
+
useEffect(() => setDisplayValue(value), [value]);
|
|
276
|
+
const fill = literal(hasError ? formCommonColors.error : formSelectedColors.mark);
|
|
277
|
+
return (
|
|
278
|
+
<XStack height={height} alignItems="center" width="100%" gap="$3">
|
|
279
|
+
<View
|
|
280
|
+
flex={1}
|
|
281
|
+
minWidth={0}
|
|
282
|
+
justifyContent="center"
|
|
283
|
+
{...(readOnly ? { pointerEvents: "none" as const } : undefined)}
|
|
284
|
+
data-mp-system-control="slider"
|
|
285
|
+
>
|
|
286
|
+
<Component
|
|
287
|
+
id={id}
|
|
288
|
+
style={{ width: "100%" }}
|
|
289
|
+
value={value}
|
|
290
|
+
minimumValue={min}
|
|
291
|
+
maximumValue={max}
|
|
292
|
+
step={step}
|
|
293
|
+
disabled={disabled}
|
|
294
|
+
minimumTrackTintColor={fill}
|
|
295
|
+
maximumTrackTintColor={literal(formControlColors.background)}
|
|
296
|
+
{...(platform === "android" && { thumbTintColor: fill })}
|
|
297
|
+
accessibilityLabel={accessibilityLabel}
|
|
298
|
+
accessibilityHint={accessibilityHint}
|
|
299
|
+
onValueChange={(next) => {
|
|
300
|
+
setDisplayValue(next);
|
|
301
|
+
if (disabled || readOnly) return;
|
|
302
|
+
onChangeValue(next);
|
|
303
|
+
}}
|
|
304
|
+
onSlidingComplete={() => onBlur?.()}
|
|
305
|
+
/>
|
|
306
|
+
</View>
|
|
307
|
+
<Paragraph
|
|
308
|
+
size="$2"
|
|
309
|
+
color={formCommonColors.text}
|
|
310
|
+
minWidth={32}
|
|
311
|
+
textAlign="right"
|
|
312
|
+
aria-hidden
|
|
313
|
+
>
|
|
314
|
+
{formatSliderOutput([displayValue], step)}
|
|
315
|
+
</Paragraph>
|
|
316
|
+
</XStack>
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
|
|
222
320
|
function SliderControl({
|
|
223
321
|
id,
|
|
224
322
|
sliderValue,
|
|
@@ -712,6 +810,7 @@ export function Slider({
|
|
|
712
810
|
sliderProps,
|
|
713
811
|
skeleton,
|
|
714
812
|
"aria-label": ariaLabel,
|
|
813
|
+
native = true,
|
|
715
814
|
}: SliderProps) {
|
|
716
815
|
// Canonical `onChange` and the alias `onValueChange` both fire from the
|
|
717
816
|
// single emit site below (same reconciliation as Switch).
|
|
@@ -740,41 +839,70 @@ export function Slider({
|
|
|
740
839
|
);
|
|
741
840
|
}
|
|
742
841
|
|
|
842
|
+
const systemPlatform = native ? systemControlPlatform() : null;
|
|
843
|
+
const SystemSlider =
|
|
844
|
+
systemPlatform && sliderProps?.orientation !== "vertical" && sliderProps?.dir !== "rtl"
|
|
845
|
+
? loadSystemSlider()
|
|
846
|
+
: null;
|
|
847
|
+
|
|
743
848
|
const control = (
|
|
744
849
|
sliderValue: number[],
|
|
745
850
|
isControlled: boolean,
|
|
746
851
|
handleChange?: (values: number[]) => void,
|
|
747
852
|
handleBlur?: (...args: any[]) => void,
|
|
748
853
|
hasError?: boolean,
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
854
|
+
errorMessage?: string,
|
|
855
|
+
) =>
|
|
856
|
+
SystemSlider && systemPlatform && sliderValue.length === 1 ? (
|
|
857
|
+
<SystemSliderControl
|
|
858
|
+
Component={SystemSlider}
|
|
859
|
+
platform={systemPlatform}
|
|
860
|
+
id={id}
|
|
861
|
+
value={sliderValue[0] ?? min}
|
|
862
|
+
min={min}
|
|
863
|
+
max={max}
|
|
864
|
+
step={step}
|
|
865
|
+
disabled={disabled}
|
|
866
|
+
readOnly={readOnly}
|
|
867
|
+
hasError={hasError}
|
|
868
|
+
accessibilityLabel={ariaLabel ?? (typeof label === "string" ? label : undefined)}
|
|
869
|
+
accessibilityHint={errorMessage ?? helperText}
|
|
870
|
+
height={size || knobProps.sizeToken}
|
|
871
|
+
onChangeValue={(next) => {
|
|
872
|
+
handleChange?.([next]);
|
|
873
|
+
handleValueChange([next]);
|
|
874
|
+
}}
|
|
875
|
+
onBlur={handleBlur}
|
|
876
|
+
/>
|
|
877
|
+
) : (
|
|
878
|
+
<SliderControl
|
|
879
|
+
id={id}
|
|
880
|
+
sliderValue={sliderValue}
|
|
881
|
+
controlled={isControlled}
|
|
882
|
+
min={min}
|
|
883
|
+
max={max}
|
|
884
|
+
step={step}
|
|
885
|
+
disabled={disabled}
|
|
886
|
+
readOnly={readOnly}
|
|
887
|
+
required={required}
|
|
888
|
+
hasError={hasError}
|
|
889
|
+
hasLabel={hasLabel}
|
|
890
|
+
labelText={typeof label === "string" ? label : undefined}
|
|
891
|
+
aria-label={ariaLabel}
|
|
892
|
+
size={size}
|
|
893
|
+
sizeToken={knobProps.sizeToken}
|
|
894
|
+
outlined={knobProps.outlined}
|
|
895
|
+
borderRadius={knobProps.borderRadius.borderRadius}
|
|
896
|
+
transitionToken={transitionToken}
|
|
897
|
+
elevationWrapperProps={elevationWrapperProps}
|
|
898
|
+
sliderProps={sliderProps}
|
|
899
|
+
onChangeValues={(values) => {
|
|
900
|
+
handleChange?.(values);
|
|
901
|
+
handleValueChange(values);
|
|
902
|
+
}}
|
|
903
|
+
onBlur={handleBlur}
|
|
904
|
+
/>
|
|
905
|
+
);
|
|
778
906
|
|
|
779
907
|
if (!resolvedForm || !name) {
|
|
780
908
|
return (
|
|
@@ -789,7 +917,14 @@ export function Slider({
|
|
|
789
917
|
knobProps={knobProps}
|
|
790
918
|
disabled={disabled}
|
|
791
919
|
>
|
|
792
|
-
{control(
|
|
920
|
+
{control(
|
|
921
|
+
value ?? defaultValue ?? [min],
|
|
922
|
+
value !== undefined,
|
|
923
|
+
undefined,
|
|
924
|
+
onBlur,
|
|
925
|
+
!!error,
|
|
926
|
+
typeof error === "string" && error ? error : undefined,
|
|
927
|
+
)}
|
|
793
928
|
</FieldLayout>
|
|
794
929
|
);
|
|
795
930
|
}
|
|
@@ -832,6 +967,7 @@ export function Slider({
|
|
|
832
967
|
},
|
|
833
968
|
mergeFieldHandler(field, "handleBlur", onBlur),
|
|
834
969
|
!!resolvedError,
|
|
970
|
+
typeof resolvedError === "string" && resolvedError ? resolvedError : undefined,
|
|
835
971
|
)}
|
|
836
972
|
</FieldLayout>
|
|
837
973
|
);
|
|
@@ -5,10 +5,10 @@ import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
|
5
5
|
import { useForm } from "@tanstack/react-form";
|
|
6
6
|
import { useState } from "react";
|
|
7
7
|
import { YStack } from "tamagui";
|
|
8
|
-
import { Button } from "../../Button";
|
|
9
8
|
import { Form } from "../../Form";
|
|
10
9
|
import { Stepper } from "./index";
|
|
11
10
|
import { Paragraph } from "@multiplatform.one/theme";
|
|
11
|
+
import { ActionButton } from "@multiplatform.one/components";
|
|
12
12
|
|
|
13
13
|
const meta: Meta<typeof Stepper> = {
|
|
14
14
|
title: "Forms/Stepper",
|
|
@@ -60,7 +60,7 @@ export const Main: Story = {
|
|
|
60
60
|
<Stepper label="Quantity" name="quantity" min={1} max={100} buttonPosition="both" />
|
|
61
61
|
<Stepper label="Price" name="price" step={0.01} precision={2} min={0} />
|
|
62
62
|
<Stepper label="Discount (%)" name="discount" min={0} max={50} step={5} />
|
|
63
|
-
<
|
|
63
|
+
<ActionButton kind="submit" formAction="submit" />
|
|
64
64
|
</YStack>
|
|
65
65
|
</Form>
|
|
66
66
|
);
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
2
|
+
import { createDefaultThemeConfig } from "@multiplatform.one/theme";
|
|
3
|
+
import { useForm } from "@tanstack/react-form";
|
|
4
|
+
import { cleanup, fireEvent, render } from "@testing-library/react";
|
|
5
|
+
import type { ReactElement } from "react";
|
|
6
|
+
import { TamaguiProvider } from "tamagui";
|
|
7
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
8
|
+
import { Form } from "../../Form";
|
|
9
|
+
import { Switch } from "./index";
|
|
10
|
+
|
|
11
|
+
const platform = vi.hoisted(() => ({ os: "ios" as "ios" | "android" | null }));
|
|
12
|
+
|
|
13
|
+
// The system Switch as a probe: it shows the props React Native's Switch got
|
|
14
|
+
// and flips through onValueChange the way a tap on UISwitch does.
|
|
15
|
+
const SystemSwitchProbe = vi.hoisted(
|
|
16
|
+
() =>
|
|
17
|
+
function SystemSwitchProbe(props: Record<string, any>) {
|
|
18
|
+
return (
|
|
19
|
+
<button
|
|
20
|
+
type="button"
|
|
21
|
+
data-testid="system-switch"
|
|
22
|
+
data-value={String(props.value)}
|
|
23
|
+
data-disabled={String(Boolean(props.disabled))}
|
|
24
|
+
data-track-on={props.trackColor?.true}
|
|
25
|
+
data-track-off={props.trackColor?.false}
|
|
26
|
+
data-ios-off={props.ios_backgroundColor}
|
|
27
|
+
data-thumb={props.thumbColor ?? ""}
|
|
28
|
+
data-label={props.accessibilityLabel ?? ""}
|
|
29
|
+
onClick={() => props.disabled || props.onValueChange?.(!props.value)}
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
},
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
vi.mock("../../shared/systemControls", async (importOriginal) => ({
|
|
36
|
+
...(await importOriginal<typeof import("../../shared/systemControls")>()),
|
|
37
|
+
systemControlPlatform: () => platform.os,
|
|
38
|
+
SystemSwitchView: SystemSwitchProbe,
|
|
39
|
+
}));
|
|
40
|
+
|
|
41
|
+
const mpoTheme = createDefaultThemeConfig();
|
|
42
|
+
const renderInScheme = (ui: ReactElement, scheme: "light" | "dark") =>
|
|
43
|
+
render(
|
|
44
|
+
<TamaguiProvider config={mpoTheme.tamagui} defaultTheme={scheme} disableInjectCSS>
|
|
45
|
+
{ui}
|
|
46
|
+
</TamaguiProvider>,
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
afterEach(cleanup);
|
|
50
|
+
beforeEach(() => {
|
|
51
|
+
platform.os = "ios";
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const literal = (value: string | null) => Boolean(value) && !value!.startsWith("$");
|
|
55
|
+
|
|
56
|
+
function FormSwitch({ onSubmit }: { onSubmit: (value: { alerts: boolean }) => void }) {
|
|
57
|
+
const form = useForm({
|
|
58
|
+
defaultValues: { alerts: false },
|
|
59
|
+
onSubmit: ({ value }) => onSubmit(value),
|
|
60
|
+
});
|
|
61
|
+
return (
|
|
62
|
+
<Form form={form}>
|
|
63
|
+
<Switch name="alerts" label="Alerts" />
|
|
64
|
+
<button type="button" onClick={() => form.handleSubmit()}>
|
|
65
|
+
Save
|
|
66
|
+
</button>
|
|
67
|
+
</Form>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// LC-266 PLATFORM-ERGONOMICS (FZ-8117). iOS and Android render React Native's
|
|
72
|
+
// own Switch, tinted from the theme; web and GNOME keep the MPO switch.
|
|
73
|
+
describe("Switch on iOS and Android", () => {
|
|
74
|
+
it.each(["light", "dark"] as const)(
|
|
75
|
+
"renders the system switch with the %s theme's accent and off track as literals",
|
|
76
|
+
(scheme) => {
|
|
77
|
+
const result = renderInScheme(<Switch label="Alerts" defaultValue />, scheme);
|
|
78
|
+
const view = result.getByTestId("system-switch");
|
|
79
|
+
expect(view.dataset.value).toBe("true");
|
|
80
|
+
expect(literal(view.getAttribute("data-track-on"))).toBe(true);
|
|
81
|
+
expect(literal(view.getAttribute("data-track-off"))).toBe(true);
|
|
82
|
+
expect(view.getAttribute("data-ios-off")).toBe(view.getAttribute("data-track-off"));
|
|
83
|
+
expect(view.dataset.thumb).toBe("");
|
|
84
|
+
expect(view.dataset.label).toBe("Alerts");
|
|
85
|
+
expect(result.container.querySelector('[role="switch"]')).toBeNull();
|
|
86
|
+
},
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
it.each(["light", "dark"] as const)(
|
|
90
|
+
"paints the %s theme's off track and thumb on Android",
|
|
91
|
+
(scheme) => {
|
|
92
|
+
platform.os = "android";
|
|
93
|
+
const view = renderInScheme(<Switch label="Alerts" />, scheme).getByTestId("system-switch");
|
|
94
|
+
expect(literal(view.getAttribute("data-track-off"))).toBe(true);
|
|
95
|
+
expect(literal(view.getAttribute("data-thumb"))).toBe(true);
|
|
96
|
+
},
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
it("toggles standalone and reports through onChange and onCheckedChange", () => {
|
|
100
|
+
const onChange = vi.fn();
|
|
101
|
+
const onCheckedChange = vi.fn();
|
|
102
|
+
const result = renderWithProviders(
|
|
103
|
+
<Switch label="Alerts" onChange={onChange} onCheckedChange={onCheckedChange} />,
|
|
104
|
+
);
|
|
105
|
+
const view = result.getByTestId("system-switch");
|
|
106
|
+
fireEvent.click(view);
|
|
107
|
+
expect(onChange).toHaveBeenCalledExactlyOnceWith(true);
|
|
108
|
+
expect(onCheckedChange).toHaveBeenCalledExactlyOnceWith(true);
|
|
109
|
+
expect(view.dataset.value).toBe("true");
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it("follows a controlled value", () => {
|
|
113
|
+
const result = renderWithProviders(<Switch label="Alerts" checked={false} />);
|
|
114
|
+
fireEvent.click(result.getByTestId("system-switch"));
|
|
115
|
+
expect(result.getByTestId("system-switch").dataset.value).toBe("false");
|
|
116
|
+
result.rerender(<Switch label="Alerts" checked />);
|
|
117
|
+
expect(result.getByTestId("system-switch").dataset.value).toBe("true");
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
it("passes disabled to the system switch and never changes a disabled or read-only value", () => {
|
|
121
|
+
const onChange = vi.fn();
|
|
122
|
+
const result = renderWithProviders(
|
|
123
|
+
<>
|
|
124
|
+
<Switch label="Off limits" onChange={onChange} disabled />
|
|
125
|
+
<Switch label="Look only" onChange={onChange} readOnly />
|
|
126
|
+
</>,
|
|
127
|
+
);
|
|
128
|
+
const [disabledView, readOnlyView] = result.getAllByTestId("system-switch");
|
|
129
|
+
expect(disabledView!.dataset.disabled).toBe("true");
|
|
130
|
+
expect(readOnlyView!.dataset.disabled).toBe("false");
|
|
131
|
+
fireEvent.click(disabledView!);
|
|
132
|
+
fireEvent.click(readOnlyView!);
|
|
133
|
+
expect(onChange).not.toHaveBeenCalled();
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
it("writes the form field it is bound to", async () => {
|
|
137
|
+
const onSubmit = vi.fn();
|
|
138
|
+
const result = renderWithProviders(<FormSwitch onSubmit={onSubmit} />);
|
|
139
|
+
fireEvent.click(result.getByTestId("system-switch"));
|
|
140
|
+
fireEvent.click(result.getByText("Save"));
|
|
141
|
+
await vi.waitFor(() => expect(onSubmit).toHaveBeenCalledWith({ alerts: true }));
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it("keeps the MPO switch for native={false}, track icons and switchProps", () => {
|
|
145
|
+
const result = renderWithProviders(
|
|
146
|
+
<>
|
|
147
|
+
<Switch label="Opted out" native={false} />
|
|
148
|
+
<Switch label="Iconed" leftIcon={<span>i</span>} />
|
|
149
|
+
<Switch label="Styled" switchProps={{ opacity: 1 }} />
|
|
150
|
+
</>,
|
|
151
|
+
);
|
|
152
|
+
expect(result.queryByTestId("system-switch")).toBeNull();
|
|
153
|
+
expect(result.container.querySelectorAll('[role="switch"]')).toHaveLength(3);
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
it("keeps the MPO switch on web and GNOME", () => {
|
|
157
|
+
platform.os = null;
|
|
158
|
+
const result = renderWithProviders(<Switch label="Alerts" />);
|
|
159
|
+
expect(result.queryByTestId("system-switch")).toBeNull();
|
|
160
|
+
expect(result.container.querySelector('[role="switch"]')).not.toBeNull();
|
|
161
|
+
});
|
|
162
|
+
});
|