@g9tm/lynxcontrols 0.0.0-stage → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -2
- package/dist/.tsbuildinfo +1 -0
- package/dist/base/base.css +16 -0
- package/dist/base/base.css.map +1 -0
- package/dist/base/control.d.ts +68 -0
- package/dist/base/control.d.ts.map +1 -0
- package/dist/base/control.jsx +36 -0
- package/dist/base/control.jsx.map +1 -0
- package/dist/base/corner-badge.d.ts +35 -0
- package/dist/base/corner-badge.d.ts.map +1 -0
- package/dist/base/corner-badge.jsx +45 -0
- package/dist/base/corner-badge.jsx.map +1 -0
- package/dist/base/disposer.d.ts +28 -0
- package/dist/base/disposer.d.ts.map +1 -0
- package/dist/base/disposer.jsx +61 -0
- package/dist/base/disposer.jsx.map +1 -0
- package/dist/base/index.d.ts +10 -0
- package/dist/base/index.d.ts.map +1 -0
- package/dist/base/index.jsx +9 -0
- package/dist/base/press.d.ts +38 -0
- package/dist/base/press.d.ts.map +1 -0
- package/dist/base/press.jsx +73 -0
- package/dist/base/press.jsx.map +1 -0
- package/dist/base/pressable.d.ts +25 -0
- package/dist/base/pressable.d.ts.map +1 -0
- package/dist/base/pressable.jsx +38 -0
- package/dist/base/pressable.jsx.map +1 -0
- package/dist/base/selection-item.d.ts +29 -0
- package/dist/base/selection-item.d.ts.map +1 -0
- package/dist/base/selection-item.jsx +6 -0
- package/dist/base/selection-item.jsx.map +1 -0
- package/dist/base/timers.d.ts +7 -0
- package/dist/base/timers.d.ts.map +1 -0
- package/dist/base/timers.jsx +10 -0
- package/dist/base/timers.jsx.map +1 -0
- package/dist/base/use-controllable-state.d.ts +30 -0
- package/dist/base/use-controllable-state.d.ts.map +1 -0
- package/dist/base/use-controllable-state.jsx +49 -0
- package/dist/base/use-controllable-state.jsx.map +1 -0
- package/dist/base/use-stable-callback.d.ts +8 -0
- package/dist/base/use-stable-callback.d.ts.map +1 -0
- package/dist/base/use-stable-callback.jsx +12 -0
- package/dist/base/use-stable-callback.jsx.map +1 -0
- package/dist/button/button.css +162 -0
- package/dist/button/button.css.map +1 -0
- package/dist/button/button.d.ts +52 -0
- package/dist/button/button.d.ts.map +1 -0
- package/dist/button/button.jsx +88 -0
- package/dist/button/button.jsx.map +1 -0
- package/dist/button/header-action-button.d.ts +34 -0
- package/dist/button/header-action-button.d.ts.map +1 -0
- package/dist/button/header-action-button.jsx +51 -0
- package/dist/button/header-action-button.jsx.map +1 -0
- package/dist/button/icon-button.d.ts +46 -0
- package/dist/button/icon-button.d.ts.map +1 -0
- package/dist/button/icon-button.jsx +69 -0
- package/dist/button/icon-button.jsx.map +1 -0
- package/dist/button/index.d.ts +9 -0
- package/dist/button/index.d.ts.map +1 -0
- package/dist/button/index.jsx +8 -0
- package/dist/button/nav-card.d.ts +58 -0
- package/dist/button/nav-card.d.ts.map +1 -0
- package/dist/button/nav-card.jsx +96 -0
- package/dist/button/nav-card.jsx.map +1 -0
- package/dist/button/safe-tap.d.ts +27 -0
- package/dist/button/safe-tap.d.ts.map +1 -0
- package/dist/button/safe-tap.jsx +46 -0
- package/dist/button/safe-tap.jsx.map +1 -0
- package/dist/button/safe.d.ts +84 -0
- package/dist/button/safe.d.ts.map +1 -0
- package/dist/button/safe.jsx +116 -0
- package/dist/button/safe.jsx.map +1 -0
- package/dist/button/vertical-icon-text-button.d.ts +18 -0
- package/dist/button/vertical-icon-text-button.d.ts.map +1 -0
- package/dist/button/vertical-icon-text-button.jsx +21 -0
- package/dist/button/vertical-icon-text-button.jsx.map +1 -0
- package/dist/button/visuals.d.ts +53 -0
- package/dist/button/visuals.d.ts.map +1 -0
- package/dist/button/visuals.jsx +92 -0
- package/dist/button/visuals.jsx.map +1 -0
- package/dist/cascade/cascade-panel.d.ts +80 -0
- package/dist/cascade/cascade-panel.d.ts.map +1 -0
- package/dist/cascade/cascade-panel.jsx +179 -0
- package/dist/cascade/cascade-panel.jsx.map +1 -0
- package/dist/cascade/cascade.css +70 -0
- package/dist/cascade/cascade.css.map +1 -0
- package/dist/cascade/index.d.ts +3 -0
- package/dist/cascade/index.d.ts.map +1 -0
- package/dist/cascade/index.jsx +2 -0
- package/dist/cascade/model.d.ts +68 -0
- package/dist/cascade/model.d.ts.map +1 -0
- package/dist/cascade/model.jsx +161 -0
- package/dist/cascade/model.jsx.map +1 -0
- package/dist/deferred/deferred-content.d.ts +82 -0
- package/dist/deferred/deferred-content.d.ts.map +1 -0
- package/dist/deferred/deferred-content.jsx +263 -0
- package/dist/deferred/deferred-content.jsx.map +1 -0
- package/dist/deferred/deferred.css +62 -0
- package/dist/deferred/deferred.css.map +1 -0
- package/dist/deferred/index.d.ts +3 -0
- package/dist/deferred/index.d.ts.map +1 -0
- package/dist/deferred/index.jsx +2 -0
- package/dist/deferred/readiness-signal.d.ts +16 -0
- package/dist/deferred/readiness-signal.d.ts.map +1 -0
- package/dist/deferred/readiness-signal.jsx +29 -0
- package/dist/deferred/readiness-signal.jsx.map +1 -0
- package/dist/display/activity-indicator.d.ts +21 -0
- package/dist/display/activity-indicator.d.ts.map +1 -0
- package/dist/display/activity-indicator.jsx +22 -0
- package/dist/display/activity-indicator.jsx.map +1 -0
- package/dist/display/culture-date-time-label.d.ts +64 -0
- package/dist/display/culture-date-time-label.d.ts.map +1 -0
- package/dist/display/culture-date-time-label.jsx +73 -0
- package/dist/display/culture-date-time-label.jsx.map +1 -0
- package/dist/display/display.css +217 -0
- package/dist/display/display.css.map +1 -0
- package/dist/display/index.d.ts +7 -0
- package/dist/display/index.d.ts.map +1 -0
- package/dist/display/index.jsx +6 -0
- package/dist/display/progress-bar.d.ts +38 -0
- package/dist/display/progress-bar.d.ts.map +1 -0
- package/dist/display/progress-bar.jsx +57 -0
- package/dist/display/progress-bar.jsx.map +1 -0
- package/dist/display/separator.d.ts +30 -0
- package/dist/display/separator.d.ts.map +1 -0
- package/dist/display/separator.jsx +55 -0
- package/dist/display/separator.jsx.map +1 -0
- package/dist/display/shimmer.d.ts +41 -0
- package/dist/display/shimmer.d.ts.map +1 -0
- package/dist/display/shimmer.jsx +41 -0
- package/dist/display/shimmer.jsx.map +1 -0
- package/dist/display/title-with-line.d.ts +13 -0
- package/dist/display/title-with-line.d.ts.map +1 -0
- package/dist/display/title-with-line.jsx +21 -0
- package/dist/display/title-with-line.jsx.map +1 -0
- package/dist/edge-panel/edge-panel.css +132 -0
- package/dist/edge-panel/edge-panel.css.map +1 -0
- package/dist/edge-panel/edge-panel.d.ts +87 -0
- package/dist/edge-panel/edge-panel.d.ts.map +1 -0
- package/dist/edge-panel/edge-panel.jsx +326 -0
- package/dist/edge-panel/edge-panel.jsx.map +1 -0
- package/dist/edge-panel/helper.d.ts +27 -0
- package/dist/edge-panel/helper.d.ts.map +1 -0
- package/dist/edge-panel/helper.jsx +118 -0
- package/dist/edge-panel/helper.jsx.map +1 -0
- package/dist/edge-panel/index.d.ts +4 -0
- package/dist/edge-panel/index.d.ts.map +1 -0
- package/dist/edge-panel/index.jsx +3 -0
- package/dist/edge-panel/types.d.ts +155 -0
- package/dist/edge-panel/types.d.ts.map +1 -0
- package/dist/edge-panel/types.jsx +139 -0
- package/dist/edge-panel/types.jsx.map +1 -0
- package/dist/expander/expander.css +54 -0
- package/dist/expander/expander.css.map +1 -0
- package/dist/expander/expander.d.ts +46 -0
- package/dist/expander/expander.d.ts.map +1 -0
- package/dist/expander/expander.jsx +112 -0
- package/dist/expander/expander.jsx.map +1 -0
- package/dist/expander/index.d.ts +2 -0
- package/dist/expander/index.d.ts.map +1 -0
- package/dist/expander/index.jsx +1 -0
- package/dist/fields/dictation.d.ts +43 -0
- package/dist/fields/dictation.d.ts.map +1 -0
- package/dist/fields/dictation.jsx +124 -0
- package/dist/fields/dictation.jsx.map +1 -0
- package/dist/fields/editor.d.ts +26 -0
- package/dist/fields/editor.d.ts.map +1 -0
- package/dist/fields/editor.jsx +46 -0
- package/dist/fields/editor.jsx.map +1 -0
- package/dist/fields/fields.css +164 -0
- package/dist/fields/fields.css.map +1 -0
- package/dist/fields/index.d.ts +13 -0
- package/dist/fields/index.d.ts.map +1 -0
- package/dist/fields/index.jsx +12 -0
- package/dist/fields/input-policy.d.ts +48 -0
- package/dist/fields/input-policy.d.ts.map +1 -0
- package/dist/fields/input-policy.jsx +215 -0
- package/dist/fields/input-policy.jsx.map +1 -0
- package/dist/fields/notch.d.ts +10 -0
- package/dist/fields/notch.d.ts.map +1 -0
- package/dist/fields/notch.jsx +9 -0
- package/dist/fields/notch.jsx.map +1 -0
- package/dist/fields/outlined-field.d.ts +152 -0
- package/dist/fields/outlined-field.d.ts.map +1 -0
- package/dist/fields/outlined-field.jsx +199 -0
- package/dist/fields/outlined-field.jsx.map +1 -0
- package/dist/fields/pin-entry.d.ts +65 -0
- package/dist/fields/pin-entry.d.ts.map +1 -0
- package/dist/fields/pin-entry.jsx +294 -0
- package/dist/fields/pin-entry.jsx.map +1 -0
- package/dist/fields/search-entry.d.ts +35 -0
- package/dist/fields/search-entry.d.ts.map +1 -0
- package/dist/fields/search-entry.jsx +118 -0
- package/dist/fields/search-entry.jsx.map +1 -0
- package/dist/fields/slot-layout.d.ts +33 -0
- package/dist/fields/slot-layout.d.ts.map +1 -0
- package/dist/fields/slot-layout.jsx +33 -0
- package/dist/fields/slot-layout.jsx.map +1 -0
- package/dist/fields/text-entry.d.ts +62 -0
- package/dist/fields/text-entry.d.ts.map +1 -0
- package/dist/fields/text-entry.jsx +82 -0
- package/dist/fields/text-entry.jsx.map +1 -0
- package/dist/fields/use-dictation.d.ts +34 -0
- package/dist/fields/use-dictation.d.ts.map +1 -0
- package/dist/fields/use-dictation.jsx +80 -0
- package/dist/fields/use-dictation.jsx.map +1 -0
- package/dist/fields/use-text-input.d.ts +150 -0
- package/dist/fields/use-text-input.d.ts.map +1 -0
- package/dist/fields/use-text-input.jsx +247 -0
- package/dist/fields/use-text-input.jsx.map +1 -0
- package/dist/fields/validator.d.ts +14 -0
- package/dist/fields/validator.d.ts.map +1 -0
- package/dist/fields/validator.jsx +20 -0
- package/dist/fields/validator.jsx.map +1 -0
- package/dist/host/back.d.ts +42 -0
- package/dist/host/back.d.ts.map +1 -0
- package/dist/host/back.jsx +47 -0
- package/dist/host/back.jsx.map +1 -0
- package/dist/host/hooks.d.ts +90 -0
- package/dist/host/hooks.d.ts.map +1 -0
- package/dist/host/hooks.jsx +166 -0
- package/dist/host/hooks.jsx.map +1 -0
- package/dist/host/host.css +81 -0
- package/dist/host/host.css.map +1 -0
- package/dist/host/host.d.ts +70 -0
- package/dist/host/host.d.ts.map +1 -0
- package/dist/host/host.jsx +229 -0
- package/dist/host/host.jsx.map +1 -0
- package/dist/host/index.d.ts +9 -0
- package/dist/host/index.d.ts.map +1 -0
- package/dist/host/index.jsx +8 -0
- package/dist/host/keyboard.d.ts +24 -0
- package/dist/host/keyboard.d.ts.map +1 -0
- package/dist/host/keyboard.jsx +28 -0
- package/dist/host/keyboard.jsx.map +1 -0
- package/dist/host/layers.d.ts +69 -0
- package/dist/host/layers.d.ts.map +1 -0
- package/dist/host/layers.jsx +111 -0
- package/dist/host/layers.jsx.map +1 -0
- package/dist/host/page-loading-overlay.d.ts +17 -0
- package/dist/host/page-loading-overlay.d.ts.map +1 -0
- package/dist/host/page-loading-overlay.jsx +16 -0
- package/dist/host/page-loading-overlay.jsx.map +1 -0
- package/dist/host/readiness.d.ts +57 -0
- package/dist/host/readiness.d.ts.map +1 -0
- package/dist/host/readiness.jsx +138 -0
- package/dist/host/readiness.jsx.map +1 -0
- package/dist/host/registry.d.ts +106 -0
- package/dist/host/registry.d.ts.map +1 -0
- package/dist/host/registry.jsx +93 -0
- package/dist/host/registry.jsx.map +1 -0
- package/dist/icon/icon.css +39 -0
- package/dist/icon/icon.css.map +1 -0
- package/dist/icon/icon.d.ts +57 -0
- package/dist/icon/icon.d.ts.map +1 -0
- package/dist/icon/icon.jsx +115 -0
- package/dist/icon/icon.jsx.map +1 -0
- package/dist/icon/index.d.ts +4 -0
- package/dist/icon/index.d.ts.map +1 -0
- package/dist/icon/index.jsx +3 -0
- package/dist/icon/slot.d.ts +45 -0
- package/dist/icon/slot.d.ts.map +1 -0
- package/dist/icon/slot.jsx +61 -0
- package/dist/icon/slot.jsx.map +1 -0
- package/dist/icon/swatch.d.ts +29 -0
- package/dist/icon/swatch.d.ts.map +1 -0
- package/dist/icon/swatch.jsx +25 -0
- package/dist/icon/swatch.jsx.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.jsx +1 -0
- package/dist/pickers/combo-box.d.ts +42 -0
- package/dist/pickers/combo-box.d.ts.map +1 -0
- package/dist/pickers/combo-box.jsx +129 -0
- package/dist/pickers/combo-box.jsx.map +1 -0
- package/dist/pickers/date-time-picker.d.ts +63 -0
- package/dist/pickers/date-time-picker.d.ts.map +1 -0
- package/dist/pickers/date-time-picker.jsx +141 -0
- package/dist/pickers/date-time-picker.jsx.map +1 -0
- package/dist/pickers/date-time.d.ts +82 -0
- package/dist/pickers/date-time.d.ts.map +1 -0
- package/dist/pickers/date-time.jsx +130 -0
- package/dist/pickers/date-time.jsx.map +1 -0
- package/dist/pickers/index.d.ts +10 -0
- package/dist/pickers/index.d.ts.map +1 -0
- package/dist/pickers/index.jsx +9 -0
- package/dist/pickers/picker-sheet.d.ts +21 -0
- package/dist/pickers/picker-sheet.d.ts.map +1 -0
- package/dist/pickers/picker-sheet.jsx +61 -0
- package/dist/pickers/picker-sheet.jsx.map +1 -0
- package/dist/pickers/picker.d.ts +32 -0
- package/dist/pickers/picker.d.ts.map +1 -0
- package/dist/pickers/picker.jsx +72 -0
- package/dist/pickers/picker.jsx.map +1 -0
- package/dist/pickers/pickers.css +219 -0
- package/dist/pickers/pickers.css.map +1 -0
- package/dist/pickers/timespan-picker.d.ts +36 -0
- package/dist/pickers/timespan-picker.d.ts.map +1 -0
- package/dist/pickers/timespan-picker.jsx +99 -0
- package/dist/pickers/timespan-picker.jsx.map +1 -0
- package/dist/pickers/timespan.d.ts +38 -0
- package/dist/pickers/timespan.d.ts.map +1 -0
- package/dist/pickers/timespan.jsx +49 -0
- package/dist/pickers/timespan.jsx.map +1 -0
- package/dist/pickers/trigger.d.ts +34 -0
- package/dist/pickers/trigger.d.ts.map +1 -0
- package/dist/pickers/trigger.jsx +77 -0
- package/dist/pickers/trigger.jsx.map +1 -0
- package/dist/pickers/wheel-column.d.ts +32 -0
- package/dist/pickers/wheel-column.d.ts.map +1 -0
- package/dist/pickers/wheel-column.jsx +99 -0
- package/dist/pickers/wheel-column.jsx.map +1 -0
- package/dist/plus-button/index.d.ts +3 -0
- package/dist/plus-button/index.d.ts.map +1 -0
- package/dist/plus-button/index.jsx +2 -0
- package/dist/plus-button/model.d.ts +65 -0
- package/dist/plus-button/model.d.ts.map +1 -0
- package/dist/plus-button/model.jsx +86 -0
- package/dist/plus-button/model.jsx.map +1 -0
- package/dist/plus-button/plus-button.css +67 -0
- package/dist/plus-button/plus-button.css.map +1 -0
- package/dist/plus-button/plus-button.d.ts +38 -0
- package/dist/plus-button/plus-button.d.ts.map +1 -0
- package/dist/plus-button/plus-button.jsx +155 -0
- package/dist/plus-button/plus-button.jsx.map +1 -0
- package/dist/popup/frame.d.ts +101 -0
- package/dist/popup/frame.d.ts.map +1 -0
- package/dist/popup/frame.jsx +252 -0
- package/dist/popup/frame.jsx.map +1 -0
- package/dist/popup/index.d.ts +8 -0
- package/dist/popup/index.d.ts.map +1 -0
- package/dist/popup/index.jsx +7 -0
- package/dist/popup/input-form.d.ts +35 -0
- package/dist/popup/input-form.d.ts.map +1 -0
- package/dist/popup/input-form.jsx +160 -0
- package/dist/popup/input-form.jsx.map +1 -0
- package/dist/popup/input.d.ts +175 -0
- package/dist/popup/input.d.ts.map +1 -0
- package/dist/popup/input.jsx +176 -0
- package/dist/popup/input.jsx.map +1 -0
- package/dist/popup/popup-view.d.ts +25 -0
- package/dist/popup/popup-view.d.ts.map +1 -0
- package/dist/popup/popup-view.jsx +67 -0
- package/dist/popup/popup-view.jsx.map +1 -0
- package/dist/popup/popup.css +203 -0
- package/dist/popup/popup.css.map +1 -0
- package/dist/popup/queue.d.ts +90 -0
- package/dist/popup/queue.d.ts.map +1 -0
- package/dist/popup/queue.jsx +309 -0
- package/dist/popup/queue.jsx.map +1 -0
- package/dist/popup/service.d.ts +60 -0
- package/dist/popup/service.d.ts.map +1 -0
- package/dist/popup/service.jsx +350 -0
- package/dist/popup/service.jsx.map +1 -0
- package/dist/popup/types.d.ts +222 -0
- package/dist/popup/types.d.ts.map +1 -0
- package/dist/popup/types.jsx +218 -0
- package/dist/popup/types.jsx.map +1 -0
- package/dist/provider/contexts.d.ts +41 -0
- package/dist/provider/contexts.d.ts.map +1 -0
- package/dist/provider/contexts.jsx +11 -0
- package/dist/provider/contexts.jsx.map +1 -0
- package/dist/provider/global-events.d.ts +8 -0
- package/dist/provider/global-events.d.ts.map +1 -0
- package/dist/provider/global-events.jsx +17 -0
- package/dist/provider/global-events.jsx.map +1 -0
- package/dist/provider/hooks.d.ts +49 -0
- package/dist/provider/hooks.d.ts.map +1 -0
- package/dist/provider/hooks.jsx +72 -0
- package/dist/provider/hooks.jsx.map +1 -0
- package/dist/provider/index.d.ts +5 -0
- package/dist/provider/index.d.ts.map +1 -0
- package/dist/provider/index.jsx +3 -0
- package/dist/provider/provider.css +18 -0
- package/dist/provider/provider.css.map +1 -0
- package/dist/provider/provider.d.ts +51 -0
- package/dist/provider/provider.d.ts.map +1 -0
- package/dist/provider/provider.jsx +290 -0
- package/dist/provider/provider.jsx.map +1 -0
- package/dist/provider/settings.d.ts +99 -0
- package/dist/provider/settings.d.ts.map +1 -0
- package/dist/provider/settings.jsx +45 -0
- package/dist/provider/settings.jsx.map +1 -0
- package/dist/provider/theme-css.d.ts +12 -0
- package/dist/provider/theme-css.d.ts.map +1 -0
- package/dist/provider/theme-css.jsx +19 -0
- package/dist/provider/theme-css.jsx.map +1 -0
- package/dist/provider/theme-root.d.ts +10 -0
- package/dist/provider/theme-root.d.ts.map +1 -0
- package/dist/provider/theme-root.jsx +24 -0
- package/dist/provider/theme-root.jsx.map +1 -0
- package/dist/provider/theme.css +473 -0
- package/dist/provider/theme.css.map +1 -0
- package/dist/range-slider/index.d.ts +3 -0
- package/dist/range-slider/index.d.ts.map +1 -0
- package/dist/range-slider/index.jsx +2 -0
- package/dist/range-slider/math.d.ts +23 -0
- package/dist/range-slider/math.d.ts.map +1 -0
- package/dist/range-slider/math.jsx +71 -0
- package/dist/range-slider/math.jsx.map +1 -0
- package/dist/range-slider/range-slider.css +90 -0
- package/dist/range-slider/range-slider.css.map +1 -0
- package/dist/range-slider/range-slider.d.ts +52 -0
- package/dist/range-slider/range-slider.d.ts.map +1 -0
- package/dist/range-slider/range-slider.jsx +159 -0
- package/dist/range-slider/range-slider.jsx.map +1 -0
- package/dist/selection/index.d.ts +5 -0
- package/dist/selection/index.d.ts.map +1 -0
- package/dist/selection/index.jsx +3 -0
- package/dist/selection/model.d.ts +53 -0
- package/dist/selection/model.d.ts.map +1 -0
- package/dist/selection/model.jsx +69 -0
- package/dist/selection/model.jsx.map +1 -0
- package/dist/selection/selection-sheet.d.ts +80 -0
- package/dist/selection/selection-sheet.d.ts.map +1 -0
- package/dist/selection/selection-sheet.jsx +366 -0
- package/dist/selection/selection-sheet.jsx.map +1 -0
- package/dist/selection/selection.css +76 -0
- package/dist/selection/selection.css.map +1 -0
- package/dist/selection/use-selection-model.d.ts +9 -0
- package/dist/selection/use-selection-model.d.ts.map +1 -0
- package/dist/selection/use-selection-model.jsx +22 -0
- package/dist/selection/use-selection-model.jsx.map +1 -0
- package/dist/sheet/frame.d.ts +47 -0
- package/dist/sheet/frame.d.ts.map +1 -0
- package/dist/sheet/frame.jsx +270 -0
- package/dist/sheet/frame.jsx.map +1 -0
- package/dist/sheet/gesture.d.ts +51 -0
- package/dist/sheet/gesture.d.ts.map +1 -0
- package/dist/sheet/gesture.jsx +107 -0
- package/dist/sheet/gesture.jsx.map +1 -0
- package/dist/sheet/handoff.d.ts +32 -0
- package/dist/sheet/handoff.d.ts.map +1 -0
- package/dist/sheet/handoff.jsx +33 -0
- package/dist/sheet/handoff.jsx.map +1 -0
- package/dist/sheet/header.d.ts +46 -0
- package/dist/sheet/header.d.ts.map +1 -0
- package/dist/sheet/header.jsx +158 -0
- package/dist/sheet/header.jsx.map +1 -0
- package/dist/sheet/height-memo.d.ts +47 -0
- package/dist/sheet/height-memo.d.ts.map +1 -0
- package/dist/sheet/height-memo.jsx +100 -0
- package/dist/sheet/height-memo.jsx.map +1 -0
- package/dist/sheet/index.d.ts +12 -0
- package/dist/sheet/index.d.ts.map +1 -0
- package/dist/sheet/index.jsx +11 -0
- package/dist/sheet/loadable.d.ts +35 -0
- package/dist/sheet/loadable.d.ts.map +1 -0
- package/dist/sheet/loadable.jsx +65 -0
- package/dist/sheet/loadable.jsx.map +1 -0
- package/dist/sheet/motion.d.ts +59 -0
- package/dist/sheet/motion.d.ts.map +1 -0
- package/dist/sheet/motion.jsx +59 -0
- package/dist/sheet/motion.jsx.map +1 -0
- package/dist/sheet/options.d.ts +252 -0
- package/dist/sheet/options.d.ts.map +1 -0
- package/dist/sheet/options.jsx +92 -0
- package/dist/sheet/options.jsx.map +1 -0
- package/dist/sheet/processing.d.ts +22 -0
- package/dist/sheet/processing.d.ts.map +1 -0
- package/dist/sheet/processing.jsx +66 -0
- package/dist/sheet/processing.jsx.map +1 -0
- package/dist/sheet/service.d.ts +55 -0
- package/dist/sheet/service.d.ts.map +1 -0
- package/dist/sheet/service.jsx +143 -0
- package/dist/sheet/service.jsx.map +1 -0
- package/dist/sheet/sheet.css +246 -0
- package/dist/sheet/sheet.css.map +1 -0
- package/dist/sheet/sheet.d.ts +19 -0
- package/dist/sheet/sheet.d.ts.map +1 -0
- package/dist/sheet/sheet.jsx +40 -0
- package/dist/sheet/sheet.jsx.map +1 -0
- package/dist/sheet/sizing.d.ts +87 -0
- package/dist/sheet/sizing.d.ts.map +1 -0
- package/dist/sheet/sizing.jsx +159 -0
- package/dist/sheet/sizing.jsx.map +1 -0
- package/dist/sheet/stack.d.ts +161 -0
- package/dist/sheet/stack.d.ts.map +1 -0
- package/dist/sheet/stack.jsx +378 -0
- package/dist/sheet/stack.jsx.map +1 -0
- package/dist/swipe/index.d.ts +3 -0
- package/dist/swipe/index.d.ts.map +1 -0
- package/dist/swipe/index.jsx +2 -0
- package/dist/swipe/model.d.ts +72 -0
- package/dist/swipe/model.d.ts.map +1 -0
- package/dist/swipe/model.jsx +66 -0
- package/dist/swipe/model.jsx.map +1 -0
- package/dist/swipe/swipe-view.d.ts +40 -0
- package/dist/swipe/swipe-view.d.ts.map +1 -0
- package/dist/swipe/swipe-view.jsx +163 -0
- package/dist/swipe/swipe-view.jsx.map +1 -0
- package/dist/swipe/swipe.css +34 -0
- package/dist/swipe/swipe.css.map +1 -0
- package/dist/tab-bar/index.d.ts +4 -0
- package/dist/tab-bar/index.d.ts.map +1 -0
- package/dist/tab-bar/index.jsx +3 -0
- package/dist/tab-bar/metrics.d.ts +230 -0
- package/dist/tab-bar/metrics.d.ts.map +1 -0
- package/dist/tab-bar/metrics.jsx +221 -0
- package/dist/tab-bar/metrics.jsx.map +1 -0
- package/dist/tab-bar/model.d.ts +170 -0
- package/dist/tab-bar/model.d.ts.map +1 -0
- package/dist/tab-bar/model.jsx +349 -0
- package/dist/tab-bar/model.jsx.map +1 -0
- package/dist/tab-bar/tab-bar.css +173 -0
- package/dist/tab-bar/tab-bar.css.map +1 -0
- package/dist/tab-bar/tab-bar.d.ts +61 -0
- package/dist/tab-bar/tab-bar.d.ts.map +1 -0
- package/dist/tab-bar/tab-bar.jsx +346 -0
- package/dist/tab-bar/tab-bar.jsx.map +1 -0
- package/dist/tabs/index.d.ts +3 -0
- package/dist/tabs/index.d.ts.map +1 -0
- package/dist/tabs/index.jsx +2 -0
- package/dist/tabs/model.d.ts +83 -0
- package/dist/tabs/model.d.ts.map +1 -0
- package/dist/tabs/model.jsx +113 -0
- package/dist/tabs/model.jsx.map +1 -0
- package/dist/tabs/tab-view.d.ts +47 -0
- package/dist/tabs/tab-view.d.ts.map +1 -0
- package/dist/tabs/tab-view.jsx +227 -0
- package/dist/tabs/tab-view.jsx.map +1 -0
- package/dist/tabs/tabs.css +182 -0
- package/dist/tabs/tabs.css.map +1 -0
- package/dist/toast/index.d.ts +3 -0
- package/dist/toast/index.d.ts.map +1 -0
- package/dist/toast/index.jsx +2 -0
- package/dist/toast/service.d.ts +48 -0
- package/dist/toast/service.d.ts.map +1 -0
- package/dist/toast/service.jsx +238 -0
- package/dist/toast/service.jsx.map +1 -0
- package/dist/toast/store.d.ts +176 -0
- package/dist/toast/store.d.ts.map +1 -0
- package/dist/toast/store.jsx +355 -0
- package/dist/toast/store.jsx.map +1 -0
- package/dist/toast/toast.css +159 -0
- package/dist/toast/toast.css.map +1 -0
- package/dist/toggle/checkbox-math.d.ts +52 -0
- package/dist/toggle/checkbox-math.d.ts.map +1 -0
- package/dist/toggle/checkbox-math.jsx +111 -0
- package/dist/toggle/checkbox-math.jsx.map +1 -0
- package/dist/toggle/checkbox.d.ts +56 -0
- package/dist/toggle/checkbox.d.ts.map +1 -0
- package/dist/toggle/checkbox.jsx +152 -0
- package/dist/toggle/checkbox.jsx.map +1 -0
- package/dist/toggle/chip-group.d.ts +50 -0
- package/dist/toggle/chip-group.d.ts.map +1 -0
- package/dist/toggle/chip-group.jsx +107 -0
- package/dist/toggle/chip-group.jsx.map +1 -0
- package/dist/toggle/index.d.ts +5 -0
- package/dist/toggle/index.d.ts.map +1 -0
- package/dist/toggle/index.jsx +4 -0
- package/dist/toggle/switch.d.ts +52 -0
- package/dist/toggle/switch.d.ts.map +1 -0
- package/dist/toggle/switch.jsx +192 -0
- package/dist/toggle/switch.jsx.map +1 -0
- package/dist/toggle/toggle.css +188 -0
- package/dist/toggle/toggle.css.map +1 -0
- package/package.json +155 -4
- package/rspeedy/index.d.ts +21 -0
- package/rspeedy/index.mjs +75 -0
- package/rspeedy/index.test.mjs +52 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { G9InputType, G9KeyboardType, G9StringKey, getNumberSymbols, normalizeToAscii } from "@g9tm/lynxcontrols-foundation";
|
|
2
|
+
const ltrTypes = new Set([
|
|
3
|
+
G9InputType.Number,
|
|
4
|
+
G9InputType.Decimal,
|
|
5
|
+
G9InputType.SignedNumber,
|
|
6
|
+
G9InputType.SignedDecimal,
|
|
7
|
+
G9InputType.Phone,
|
|
8
|
+
G9InputType.Email,
|
|
9
|
+
G9InputType.Url
|
|
10
|
+
]);
|
|
11
|
+
const asciiDigitOnlyTypes = new Set([
|
|
12
|
+
G9InputType.Number,
|
|
13
|
+
G9InputType.Decimal,
|
|
14
|
+
G9InputType.SignedNumber,
|
|
15
|
+
G9InputType.SignedDecimal,
|
|
16
|
+
G9InputType.Phone,
|
|
17
|
+
G9InputType.LettersAndNumbers,
|
|
18
|
+
G9InputType.LettersNumbersSpace
|
|
19
|
+
]);
|
|
20
|
+
function inputTypePrefersLeftToRight(inputType) {
|
|
21
|
+
return ltrTypes.has(inputType);
|
|
22
|
+
}
|
|
23
|
+
function resolveKeyboardForInputType(inputType) {
|
|
24
|
+
switch(inputType){
|
|
25
|
+
case G9InputType.Number:
|
|
26
|
+
case G9InputType.Decimal:
|
|
27
|
+
case G9InputType.SignedNumber:
|
|
28
|
+
case G9InputType.SignedDecimal:
|
|
29
|
+
return G9KeyboardType.Number;
|
|
30
|
+
case G9InputType.Phone:
|
|
31
|
+
return G9KeyboardType.Phone;
|
|
32
|
+
case G9InputType.Email:
|
|
33
|
+
return G9KeyboardType.Email;
|
|
34
|
+
case G9InputType.Url:
|
|
35
|
+
return G9KeyboardType.Url;
|
|
36
|
+
default:
|
|
37
|
+
return G9KeyboardType.Default;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function resolveEffectiveKeyboard(inputType, keyboardType) {
|
|
41
|
+
const ownKeyboard = inputType === G9InputType.Default || inputType === G9InputType.Custom;
|
|
42
|
+
const resolved = ownKeyboard ? keyboardType : resolveKeyboardForInputType(inputType);
|
|
43
|
+
return resolved === G9KeyboardType.Password ? G9KeyboardType.Default : resolved;
|
|
44
|
+
}
|
|
45
|
+
function resolveInputElementType(inputType, keyboard, masked) {
|
|
46
|
+
if (masked) return 'password';
|
|
47
|
+
switch(keyboard){
|
|
48
|
+
case G9KeyboardType.Number:
|
|
49
|
+
return inputType === G9InputType.Number ? 'number' : 'digit';
|
|
50
|
+
case G9KeyboardType.Phone:
|
|
51
|
+
return 'tel';
|
|
52
|
+
case G9KeyboardType.Email:
|
|
53
|
+
return 'email';
|
|
54
|
+
default:
|
|
55
|
+
return 'text';
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const isAsciiDigit = (c)=>c >= '0' && c <= '9';
|
|
59
|
+
const isLatinLetter = (c)=>c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z';
|
|
60
|
+
const isPersianLetter = (c)=>c >= '' && c <= 'ۿ' && !(c >= '٠' && c <= '٩') && !(c >= '۰' && c <= '۹');
|
|
61
|
+
const isPersianOrAsciiDigit = (c)=>isAsciiDigit(c) || c >= '٠' && c <= '٩' || c >= '۰' && c <= '۹';
|
|
62
|
+
const isPhoneChar = (c)=>isAsciiDigit(c) || '+' === c || '-' === c || ' ' === c || '(' === c || ')' === c;
|
|
63
|
+
const isWhiteSpace = (c)=>/\s/.test(c);
|
|
64
|
+
const isMultilingual = (c)=>isLatinLetter(c) || isPersianLetter(c) || isPersianOrAsciiDigit(c) || ' ' === c;
|
|
65
|
+
function filterChars(s, keep) {
|
|
66
|
+
let out = '';
|
|
67
|
+
let changed = false;
|
|
68
|
+
for(let i = 0; i < s.length; i++){
|
|
69
|
+
const c = s.charAt(i);
|
|
70
|
+
if (keep(c)) out += c;
|
|
71
|
+
else changed = true;
|
|
72
|
+
}
|
|
73
|
+
return changed ? out : s;
|
|
74
|
+
}
|
|
75
|
+
function filterSignedInteger(s) {
|
|
76
|
+
let out = '';
|
|
77
|
+
for(let i = 0; i < s.length; i++){
|
|
78
|
+
const c = s.charAt(i);
|
|
79
|
+
if (0 === i && '-' === c || isAsciiDigit(c)) out += c;
|
|
80
|
+
}
|
|
81
|
+
return out;
|
|
82
|
+
}
|
|
83
|
+
function filterDecimal(s, allowSign, separator) {
|
|
84
|
+
let out = '';
|
|
85
|
+
let sawSeparator = false;
|
|
86
|
+
for(let i = 0; i < s.length; i++){
|
|
87
|
+
const c = s.charAt(i);
|
|
88
|
+
if (allowSign && 0 === i && '-' === c || isAsciiDigit(c)) out += c;
|
|
89
|
+
else if (!sawSeparator && (c === separator || '.' === c || '٫' === c)) {
|
|
90
|
+
out += separator;
|
|
91
|
+
sawSeparator = true;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return out;
|
|
95
|
+
}
|
|
96
|
+
const g9CustomPatternCacheLimit = 64;
|
|
97
|
+
const patternCache = new Map();
|
|
98
|
+
function compilePattern(pattern) {
|
|
99
|
+
const cached = patternCache.get(pattern);
|
|
100
|
+
if (void 0 !== cached) return cached;
|
|
101
|
+
let compiled;
|
|
102
|
+
try {
|
|
103
|
+
compiled = new RegExp(pattern);
|
|
104
|
+
} catch {
|
|
105
|
+
compiled = null;
|
|
106
|
+
}
|
|
107
|
+
if (patternCache.size >= g9CustomPatternCacheLimit) patternCache.clear();
|
|
108
|
+
patternCache.set(pattern, compiled);
|
|
109
|
+
return compiled;
|
|
110
|
+
}
|
|
111
|
+
function customPatternCacheSize() {
|
|
112
|
+
return patternCache.size;
|
|
113
|
+
}
|
|
114
|
+
function filterByCustomPattern(s, pattern) {
|
|
115
|
+
if (null == pattern || '' === pattern.trim()) return s;
|
|
116
|
+
const rx = compilePattern(pattern);
|
|
117
|
+
if (!rx) return s;
|
|
118
|
+
return filterChars(s, (c)=>{
|
|
119
|
+
rx.lastIndex = 0;
|
|
120
|
+
return rx.test(c);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function decimalSeparatorFor(numberingSystem) {
|
|
124
|
+
return getNumberSymbols(numberingSystem).decimal;
|
|
125
|
+
}
|
|
126
|
+
function sanitizeInputText(inputType, raw, allowedCharsPattern, decimalSeparator = '.') {
|
|
127
|
+
if (!raw) return raw;
|
|
128
|
+
const text = asciiDigitOnlyTypes.has(inputType) ? normalizeToAscii(raw) : raw;
|
|
129
|
+
switch(inputType){
|
|
130
|
+
case G9InputType.Number:
|
|
131
|
+
return filterChars(text, isAsciiDigit);
|
|
132
|
+
case G9InputType.Decimal:
|
|
133
|
+
return filterDecimal(text, false, decimalSeparator);
|
|
134
|
+
case G9InputType.SignedNumber:
|
|
135
|
+
return filterSignedInteger(text);
|
|
136
|
+
case G9InputType.SignedDecimal:
|
|
137
|
+
return filterDecimal(text, true, decimalSeparator);
|
|
138
|
+
case G9InputType.Phone:
|
|
139
|
+
return filterChars(text, isPhoneChar);
|
|
140
|
+
case G9InputType.Email:
|
|
141
|
+
case G9InputType.Url:
|
|
142
|
+
return filterChars(text, (c)=>!isWhiteSpace(c));
|
|
143
|
+
case G9InputType.Letters:
|
|
144
|
+
return filterChars(text, isLatinLetter);
|
|
145
|
+
case G9InputType.LettersAndNumbers:
|
|
146
|
+
return filterChars(text, (c)=>isLatinLetter(c) || isAsciiDigit(c));
|
|
147
|
+
case G9InputType.LettersNumbersSpace:
|
|
148
|
+
return filterChars(text, (c)=>isLatinLetter(c) || isAsciiDigit(c) || ' ' === c);
|
|
149
|
+
case G9InputType.PersianLetters:
|
|
150
|
+
return filterChars(text, (c)=>isPersianLetter(c) || ' ' === c);
|
|
151
|
+
case G9InputType.PersianLettersAndNumbers:
|
|
152
|
+
return filterChars(text, (c)=>isPersianLetter(c) || isPersianOrAsciiDigit(c) || ' ' === c);
|
|
153
|
+
case G9InputType.MultilingualLettersAndNumbers:
|
|
154
|
+
case G9InputType.NoSpecialChars:
|
|
155
|
+
return filterChars(text, isMultilingual);
|
|
156
|
+
case G9InputType.Custom:
|
|
157
|
+
return filterByCustomPattern(text, allowedCharsPattern);
|
|
158
|
+
default:
|
|
159
|
+
return text;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
const emailPattern = /^[^@\s]+@[^@\s]+\.[^@\s]+$/;
|
|
163
|
+
const hierarchicalSchemes = new Set([
|
|
164
|
+
'http',
|
|
165
|
+
'https',
|
|
166
|
+
'ftp',
|
|
167
|
+
'ws',
|
|
168
|
+
'wss',
|
|
169
|
+
'file',
|
|
170
|
+
'net.tcp'
|
|
171
|
+
]);
|
|
172
|
+
function isAbsoluteUri(value) {
|
|
173
|
+
if (/\s/.test(value.trim()) || '' === value.trim()) return false;
|
|
174
|
+
const v = value.trim();
|
|
175
|
+
if (/^[A-Za-z]:[\\/]/.test(v)) return true;
|
|
176
|
+
const match = /^([A-Za-z][A-Za-z0-9+.-]*):(.*)$/.exec(v);
|
|
177
|
+
if (!match) return false;
|
|
178
|
+
const scheme = match[1].toLowerCase();
|
|
179
|
+
const rest = match[2];
|
|
180
|
+
if (hierarchicalSchemes.has(scheme)) {
|
|
181
|
+
const authority = /^\/\/([^/?#]*)/.exec(rest);
|
|
182
|
+
if (!authority) return false;
|
|
183
|
+
return 'file' === scheme || '' !== authority[1].replace(/^[^@]*@/, '');
|
|
184
|
+
}
|
|
185
|
+
return '' !== rest;
|
|
186
|
+
}
|
|
187
|
+
function validateInputText(inputType, value, validationPattern, customMessage, strings) {
|
|
188
|
+
if (!value) return null;
|
|
189
|
+
switch(inputType){
|
|
190
|
+
case G9InputType.Email:
|
|
191
|
+
return emailPattern.test(value) ? null : null != customMessage ? customMessage : strings.get(G9StringKey.InvalidEmail);
|
|
192
|
+
case G9InputType.Url:
|
|
193
|
+
return isAbsoluteUri(value) ? null : null != customMessage ? customMessage : strings.get(G9StringKey.InvalidUrl);
|
|
194
|
+
case G9InputType.Custom:
|
|
195
|
+
{
|
|
196
|
+
if (!validationPattern) return null;
|
|
197
|
+
let ok;
|
|
198
|
+
try {
|
|
199
|
+
ok = new RegExp(validationPattern).test(value);
|
|
200
|
+
} catch {
|
|
201
|
+
ok = false;
|
|
202
|
+
}
|
|
203
|
+
return ok ? null : null != customMessage ? customMessage : strings.get(G9StringKey.InvalidValue);
|
|
204
|
+
}
|
|
205
|
+
default:
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
function inputTypeHasValidationRule(inputType, validationPattern) {
|
|
210
|
+
if (inputType === G9InputType.Email || inputType === G9InputType.Url) return true;
|
|
211
|
+
return inputType === G9InputType.Custom && !!validationPattern;
|
|
212
|
+
}
|
|
213
|
+
export { customPatternCacheSize, decimalSeparatorFor, g9CustomPatternCacheLimit, inputTypeHasValidationRule, inputTypePrefersLeftToRight, isAbsoluteUri, resolveEffectiveKeyboard, resolveInputElementType, resolveKeyboardForInputType, sanitizeInputText, validateInputText };
|
|
214
|
+
|
|
215
|
+
//# sourceMappingURL=input-policy.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields/input-policy.jsx","sources":["../../src/fields/input-policy.ts"],"sourcesContent":["import {\n G9InputType,\n G9KeyboardType,\n type G9NumberingSystem,\n G9StringKey,\n type G9Strings,\n getNumberSymbols,\n normalizeToAscii,\n} from '@g9tm/lynxcontrols-foundation';\n\n// MAUI `G9InputTypePolicy` (Controls/Shared/G9InputType.cs): one input type drives the keyboard, the live keystroke\n// filter and the blur validation. Pure functions; the fields call them, tests pin them.\n\n/** `<input type>` values the Lynx `<input>` element accepts. */\nexport type G9LynxInputElementType = 'text' | 'number' | 'digit' | 'password' | 'tel' | 'email';\n\nconst ltrTypes: ReadonlySet<G9InputType> = new Set<G9InputType>([\n G9InputType.Number,\n G9InputType.Decimal,\n G9InputType.SignedNumber,\n G9InputType.SignedDecimal,\n G9InputType.Phone,\n G9InputType.Email,\n G9InputType.Url,\n]);\n\nconst asciiDigitOnlyTypes: ReadonlySet<G9InputType> = new Set<G9InputType>([\n G9InputType.Number,\n G9InputType.Decimal,\n G9InputType.SignedNumber,\n G9InputType.SignedDecimal,\n G9InputType.Phone,\n G9InputType.LettersAndNumbers,\n G9InputType.LettersNumbersSpace,\n]);\n\n/**\n * Whether values of this type are written left-to-right whatever the culture (numbers, phone numbers, email\n * addresses, URLs). Only the entered value and its caret are pinned; label, outline and icons follow the culture.\n */\nexport function inputTypePrefersLeftToRight(inputType: G9InputType): boolean {\n return ltrTypes.has(inputType);\n}\n\n/** The on-screen keyboard an input type implies (MAUI `G9InputTypePolicy.ResolveKeyboard`). */\nexport function resolveKeyboardForInputType(inputType: G9InputType): G9KeyboardType {\n switch (inputType) {\n case G9InputType.Number:\n case G9InputType.Decimal:\n case G9InputType.SignedNumber:\n case G9InputType.SignedDecimal:\n return G9KeyboardType.Number;\n case G9InputType.Phone:\n return G9KeyboardType.Phone;\n case G9InputType.Email:\n return G9KeyboardType.Email;\n case G9InputType.Url:\n return G9KeyboardType.Url;\n default:\n return G9KeyboardType.Default;\n }\n}\n\n/**\n * The keyboard a field shows: the input type's keyboard, or, for `'default'` input, the field's own `keyboardType`\n * (MAUI ignored `KeyboardType` for every input type; here it works for `'default'` and `'custom'`).\n * `'password'` maps to the default keyboard, as in MAUI.\n */\nexport function resolveEffectiveKeyboard(inputType: G9InputType, keyboardType: G9KeyboardType): G9KeyboardType {\n const ownKeyboard = inputType === G9InputType.Default || inputType === G9InputType.Custom;\n const resolved = ownKeyboard ? keyboardType : resolveKeyboardForInputType(inputType);\n return resolved === G9KeyboardType.Password ? G9KeyboardType.Default : resolved;\n}\n\n/**\n * The Lynx `<input type>` for a keyboard (the `G9InputType` → element mapping table in `docs/fields.md`). Lynx has no\n * URL keyboard, so `'url'` uses `'text'`; decimal and signed types use `'digit'` (a numeric pad with a separator).\n * A masked password is always `'password'`.\n */\nexport function resolveInputElementType(\n inputType: G9InputType,\n keyboard: G9KeyboardType,\n masked: boolean,\n): G9LynxInputElementType {\n if (masked) return 'password';\n switch (keyboard) {\n case G9KeyboardType.Number:\n return inputType === G9InputType.Number ? 'number' : 'digit';\n case G9KeyboardType.Phone:\n return 'tel';\n case G9KeyboardType.Email:\n return 'email';\n default:\n return 'text';\n }\n}\n\nconst isAsciiDigit = (c: string): boolean => c >= '0' && c <= '9';\nconst isLatinLetter = (c: string): boolean => (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');\nconst isPersianLetter = (c: string): boolean =>\n c >= '' && c <= 'ۿ' && !(c >= '٠' && c <= '٩') && !(c >= '۰' && c <= '۹');\nconst isPersianOrAsciiDigit = (c: string): boolean =>\n isAsciiDigit(c) || (c >= '٠' && c <= '٩') || (c >= '۰' && c <= '۹');\nconst isPhoneChar = (c: string): boolean =>\n isAsciiDigit(c) || c === '+' || c === '-' || c === ' ' || c === '(' || c === ')';\nconst isWhiteSpace = (c: string): boolean => /\\s/.test(c);\nconst isMultilingual = (c: string): boolean =>\n isLatinLetter(c) || isPersianLetter(c) || isPersianOrAsciiDigit(c) || c === ' ';\n\nfunction filterChars(s: string, keep: (c: string) => boolean): string {\n let out = '';\n let changed = false;\n for (let i = 0; i < s.length; i++) {\n const c = s.charAt(i);\n if (keep(c)) out += c;\n else changed = true;\n }\n return changed ? out : s;\n}\n\nfunction filterSignedInteger(s: string): string {\n let out = '';\n for (let i = 0; i < s.length; i++) {\n const c = s.charAt(i);\n if ((i === 0 && c === '-') || isAsciiDigit(c)) out += c;\n }\n return out;\n}\n\nfunction filterDecimal(s: string, allowSign: boolean, separator: string): string {\n let out = '';\n let sawSeparator = false;\n for (let i = 0; i < s.length; i++) {\n const c = s.charAt(i);\n if ((allowSign && i === 0 && c === '-') || isAsciiDigit(c)) {\n out += c;\n } else if (!sawSeparator && (c === separator || c === '.' || c === '٫')) {\n out += separator;\n sawSeparator = true;\n }\n }\n return out;\n}\n\n/** Most distinct custom patterns kept compiled (MAUI `CustomPatternCacheLimit`). */\nexport const g9CustomPatternCacheLimit = 64;\nconst patternCache = new Map<string, RegExp | null>();\n\nfunction compilePattern(pattern: string): RegExp | null {\n const cached = patternCache.get(pattern);\n if (cached !== undefined) return cached;\n let compiled: RegExp | null;\n try {\n compiled = new RegExp(pattern);\n } catch {\n compiled = null;\n }\n if (patternCache.size >= g9CustomPatternCacheLimit) patternCache.clear();\n patternCache.set(pattern, compiled);\n return compiled;\n}\n\n/** Number of compiled custom patterns currently cached (for tests). */\nexport function customPatternCacheSize(): number {\n return patternCache.size;\n}\n\nfunction filterByCustomPattern(s: string, pattern: string | null | undefined): string {\n if (pattern == null || pattern.trim() === '') return s;\n const rx = compilePattern(pattern);\n // An invalid pattern passes the text through so the field stays usable; blur validation surfaces it.\n if (!rx) return s;\n return filterChars(s, (c) => {\n rx.lastIndex = 0;\n return rx.test(c);\n });\n}\n\n/** The decimal separator `Decimal`/`SignedDecimal` normalise to: the culture numbering system's (`.` or `٫`). */\nexport function decimalSeparatorFor(numberingSystem: G9NumberingSystem): string {\n return getNumberSymbols(numberingSystem).decimal;\n}\n\n/**\n * Strips every character the input type rejects (MAUI `G9InputTypePolicy.SanitizeText`). Types that accept ASCII\n * digits only see Persian and Arabic-Indic digits as ASCII first. Returns `raw` itself when nothing changes, so a\n * caller can compare by identity. The decimal types keep one separator, normalised to `decimalSeparator`.\n */\nexport function sanitizeInputText(\n inputType: G9InputType,\n raw: string,\n allowedCharsPattern?: string | null,\n decimalSeparator = '.',\n): string {\n if (!raw) return raw;\n const text = asciiDigitOnlyTypes.has(inputType) ? normalizeToAscii(raw) : raw;\n switch (inputType) {\n case G9InputType.Number:\n return filterChars(text, isAsciiDigit);\n case G9InputType.Decimal:\n return filterDecimal(text, false, decimalSeparator);\n case G9InputType.SignedNumber:\n return filterSignedInteger(text);\n case G9InputType.SignedDecimal:\n return filterDecimal(text, true, decimalSeparator);\n case G9InputType.Phone:\n return filterChars(text, isPhoneChar);\n case G9InputType.Email:\n case G9InputType.Url:\n return filterChars(text, (c) => !isWhiteSpace(c));\n case G9InputType.Letters:\n return filterChars(text, isLatinLetter);\n case G9InputType.LettersAndNumbers:\n return filterChars(text, (c) => isLatinLetter(c) || isAsciiDigit(c));\n case G9InputType.LettersNumbersSpace:\n return filterChars(text, (c) => isLatinLetter(c) || isAsciiDigit(c) || c === ' ');\n case G9InputType.PersianLetters:\n return filterChars(text, (c) => isPersianLetter(c) || c === ' ');\n case G9InputType.PersianLettersAndNumbers:\n return filterChars(text, (c) => isPersianLetter(c) || isPersianOrAsciiDigit(c) || c === ' ');\n case G9InputType.MultilingualLettersAndNumbers:\n case G9InputType.NoSpecialChars:\n return filterChars(text, isMultilingual);\n case G9InputType.Custom:\n return filterByCustomPattern(text, allowedCharsPattern);\n default:\n return text;\n }\n}\n\nconst emailPattern = /^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$/;\nconst hierarchicalSchemes: ReadonlySet<string> = new Set(['http', 'https', 'ftp', 'ws', 'wss', 'file', 'net.tcp']);\n\n/**\n * An absolute URI in the sense of .NET `Uri.TryCreate(value, UriKind.Absolute)` for the cases forms meet: a scheme,\n * then, for the hierarchical web schemes, `//` and a non-empty host; no whitespace; a Windows drive path counts.\n */\nexport function isAbsoluteUri(value: string): boolean {\n if (/\\s/.test(value.trim()) || value.trim() === '') return false;\n const v = value.trim();\n if (/^[A-Za-z]:[\\\\/]/.test(v)) return true;\n const match = /^([A-Za-z][A-Za-z0-9+.-]*):(.*)$/.exec(v);\n if (!match) return false;\n const scheme = (match[1] as string).toLowerCase();\n const rest = match[2] as string;\n if (hierarchicalSchemes.has(scheme)) {\n const authority = /^\\/\\/([^/?#]*)/.exec(rest);\n if (!authority) return false;\n return scheme === 'file' || (authority[1] as string).replace(/^[^@]*@/, '') !== '';\n }\n return rest !== '';\n}\n\n/**\n * Validates a final value (MAUI `G9InputTypePolicy.Validate`): `null` when acceptable, else the message —\n * `customMessage` when given, else the culture's `invalidEmail` / `invalidUrl` / `invalidValue`. Empty values pass.\n * `Custom` checks `validationPattern`; a pattern that does not compile fails closed.\n */\nexport function validateInputText(\n inputType: G9InputType,\n value: string | null | undefined,\n validationPattern: string | null | undefined,\n customMessage: string | null | undefined,\n strings: Pick<G9Strings, 'get'>,\n): string | null {\n if (!value) return null;\n switch (inputType) {\n case G9InputType.Email:\n return emailPattern.test(value) ? null : (customMessage ?? strings.get(G9StringKey.InvalidEmail));\n case G9InputType.Url:\n return isAbsoluteUri(value) ? null : (customMessage ?? strings.get(G9StringKey.InvalidUrl));\n case G9InputType.Custom: {\n if (!validationPattern) return null;\n let ok: boolean;\n try {\n ok = new RegExp(validationPattern).test(value);\n } catch {\n ok = false;\n }\n return ok ? null : (customMessage ?? strings.get(G9StringKey.InvalidValue));\n }\n default:\n return null;\n }\n}\n\n/** Whether the type (with its pattern) has a blur-time rule (part of MAUI `ShouldAutoValidate`). */\nexport function inputTypeHasValidationRule(\n inputType: G9InputType,\n validationPattern: string | null | undefined,\n): boolean {\n if (inputType === G9InputType.Email || inputType === G9InputType.Url) return true;\n return inputType === G9InputType.Custom && !!validationPattern;\n}\n"],"names":["ltrTypes","Set","G9InputType","asciiDigitOnlyTypes","inputTypePrefersLeftToRight","inputType","resolveKeyboardForInputType","G9KeyboardType","resolveEffectiveKeyboard","keyboardType","ownKeyboard","resolved","resolveInputElementType","keyboard","masked","isAsciiDigit","c","isLatinLetter","isPersianLetter","isPersianOrAsciiDigit","isPhoneChar","isWhiteSpace","isMultilingual","filterChars","s","keep","out","changed","i","filterSignedInteger","filterDecimal","allowSign","separator","sawSeparator","g9CustomPatternCacheLimit","patternCache","Map","compilePattern","pattern","cached","undefined","compiled","RegExp","customPatternCacheSize","filterByCustomPattern","rx","decimalSeparatorFor","numberingSystem","getNumberSymbols","sanitizeInputText","raw","allowedCharsPattern","decimalSeparator","text","normalizeToAscii","emailPattern","hierarchicalSchemes","isAbsoluteUri","value","v","match","scheme","rest","authority","validateInputText","validationPattern","customMessage","strings","G9StringKey","ok","inputTypeHasValidationRule"],"mappings":";AAgBA,MAAMA,WAAqC,IAAIC,IAAiB;IAC9DC,YAAY,MAAM;IAClBA,YAAY,OAAO;IACnBA,YAAY,YAAY;IACxBA,YAAY,aAAa;IACzBA,YAAY,KAAK;IACjBA,YAAY,KAAK;IACjBA,YAAY,GAAG;CAChB;AAED,MAA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IAAIG,cAAcH,YAAY,GAAG,EAAE,OAAO;IAC7E,OAAOG,cAAcH,YAAY,MAAM,IAAI,CAAC,CAAC+D;AAC/C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** The CSS variable a container sets to the colour behind its fields (the floated label's notch paints it). */
|
|
2
|
+
export declare const g9FieldNotchBackgroundVariable = "--g9-field-notch-background";
|
|
3
|
+
/**
|
|
4
|
+
* Inline style for a container whose background is not `--g9-background` (a card, a sheet, a popup): the floated
|
|
5
|
+
* label of every field inside it hides the outline with `color`, so no box of another colour shows behind the label.
|
|
6
|
+
* Pass a colour literal (a `var()` inside a custom property is not resolved on every engine). G9 sheets and popups set
|
|
7
|
+
* it themselves. Needs the app's `pluginG9Lynx()` (inline CSS variables).
|
|
8
|
+
*/
|
|
9
|
+
export declare function g9FieldNotchStyle(color: string): Readonly<Record<string, string>>;
|
|
10
|
+
//# sourceMappingURL=notch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notch.d.ts","sourceRoot":"","sources":["../../src/fields/notch.ts"],"names":[],"mappings":"AAEA,+GAA+G;AAC/G,eAAO,MAAM,8BAA8B,gCAAgC,CAAC;AAE5E;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAEjF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const g9FieldNotchBackgroundVariable = '--g9-field-notch-background';
|
|
2
|
+
function g9FieldNotchStyle(color) {
|
|
3
|
+
return {
|
|
4
|
+
[g9FieldNotchBackgroundVariable]: color
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export { g9FieldNotchBackgroundVariable, g9FieldNotchStyle };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=notch.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields/notch.jsx","sources":["../../src/fields/notch.ts"],"sourcesContent":["// The floated label's notch colour (no stylesheet import: sheets and popups set it without pulling fields.css).\n\n/** The CSS variable a container sets to the colour behind its fields (the floated label's notch paints it). */\nexport const g9FieldNotchBackgroundVariable = '--g9-field-notch-background';\n\n/**\n * Inline style for a container whose background is not `--g9-background` (a card, a sheet, a popup): the floated\n * label of every field inside it hides the outline with `color`, so no box of another colour shows behind the label.\n * Pass a colour literal (a `var()` inside a custom property is not resolved on every engine). G9 sheets and popups set\n * it themselves. Needs the app's `pluginG9Lynx()` (inline CSS variables).\n */\nexport function g9FieldNotchStyle(color: string): Readonly<Record<string, string>> {\n return { [g9FieldNotchBackgroundVariable]: color };\n}\n"],"names":["g9FieldNotchBackgroundVariable","g9FieldNotchStyle","color"],"mappings":"AAGO,MAAMA,iCAAiC;AAQvC,SAASC,kBAAkBC,KAAa;IAC7C,OAAO;QAAE,CAACF,+BAA+B,EAAEE;IAAM;AACnD"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import './fields.css';
|
|
2
|
+
import { G9FilledValueHighlight, type G9ImageSource } from '@g9tm/lynxcontrols-foundation';
|
|
3
|
+
import type { ReactNode } from '@lynx-js/react';
|
|
4
|
+
import type { G9IconInput } from '../icon/icon.js';
|
|
5
|
+
import { type G9PhysicalPadding } from './slot-layout.js';
|
|
6
|
+
/** Props every outlined field shares (the public members of MAUI `G9OutlinedFieldBase`). */
|
|
7
|
+
export interface G9OutlinedFieldProps {
|
|
8
|
+
/**
|
|
9
|
+
* Element `id` of the field root (MAUI `AutomationId`; automation taps its bounds to focus it). Used verbatim: keep
|
|
10
|
+
* it to `[A-Za-z0-9_-]`.
|
|
11
|
+
*/
|
|
12
|
+
readonly id?: string;
|
|
13
|
+
/** Floating label. Without it the placeholder is the label (MAUI `Label ?? Placeholder`). */
|
|
14
|
+
readonly label?: string | null;
|
|
15
|
+
/** Placeholder; shown as the label when `label` is not set. */
|
|
16
|
+
readonly placeholder?: string | null;
|
|
17
|
+
/** Helper line under the field; replaced by `errorText` while the field has an error. */
|
|
18
|
+
readonly helperText?: string | null;
|
|
19
|
+
/** Error message, shown (in the error colour) while `hasError`. */
|
|
20
|
+
readonly errorText?: string | null;
|
|
21
|
+
/** Error state: error outline, label and helper colour. Validation can also set it (`validate()`). Default false. */
|
|
22
|
+
readonly hasError?: boolean;
|
|
23
|
+
/** Keep the label floated even when empty and unfocused. Default false. */
|
|
24
|
+
readonly alwaysFloat?: boolean;
|
|
25
|
+
/** Value visible and selectable but not editable (MAUI `IsReadOnly`). Default false. */
|
|
26
|
+
readonly readOnly?: boolean;
|
|
27
|
+
/** Not interactive and dimmed (MAUI `IsEnabled = false`). Default false. */
|
|
28
|
+
readonly disabled?: boolean;
|
|
29
|
+
/** Maximum characters; `-1` (default) or `0` means unlimited. */
|
|
30
|
+
readonly maxLength?: number;
|
|
31
|
+
/** Show the `n / max` counter (only when `maxLength > 0`). Default false. */
|
|
32
|
+
readonly showCharacterCounter?: boolean;
|
|
33
|
+
/** Status colour (any CSS colour or `g9Token(...)`); used while `useStatusColor`. Default the primary colour. */
|
|
34
|
+
readonly statusColor?: string | null;
|
|
35
|
+
/** Draw the outline in `statusColor` (emphasised) whatever the focus. Default false. */
|
|
36
|
+
readonly useStatusColor?: boolean;
|
|
37
|
+
/** Soft inner halo while focused (no error, no status colour). Default false. */
|
|
38
|
+
readonly showFocusHalo?: boolean;
|
|
39
|
+
/** Filled-value accent of this field; `'inherit'` (default) takes `settings.fields.highlightFilledValue`. */
|
|
40
|
+
readonly filledValueHighlight?: G9FilledValueHighlight;
|
|
41
|
+
readonly leadingEmoji?: string | null;
|
|
42
|
+
readonly leadingIcon?: G9IconInput;
|
|
43
|
+
readonly leadingImagePath?: string | null;
|
|
44
|
+
readonly leadingImage?: G9ImageSource | null;
|
|
45
|
+
readonly trailingEmoji?: string | null;
|
|
46
|
+
readonly trailingIcon?: G9IconInput;
|
|
47
|
+
readonly trailingImagePath?: string | null;
|
|
48
|
+
readonly trailingImage?: G9ImageSource | null;
|
|
49
|
+
/** Spinner in the trailing slot (wins over every trailing icon). Default false. */
|
|
50
|
+
readonly isTrailingBusy?: boolean;
|
|
51
|
+
/** Keep the trailing icon on the physical right in RTL too. Default false. */
|
|
52
|
+
readonly forceTrailingIconRight?: boolean;
|
|
53
|
+
/** Keep the leading icon on the physical left in RTL too. Default false. */
|
|
54
|
+
readonly forceLeadingIconLeft?: boolean;
|
|
55
|
+
/** Box height; `0` (default) uses `G9Metrics.ControlHeight` (52). */
|
|
56
|
+
readonly fieldHeight?: number;
|
|
57
|
+
/** Reserve the floated label's overhang above the box (MAUI `FloatingLabelClearance`, 6). Default false. */
|
|
58
|
+
readonly reserveFloatingLabelClearance?: boolean;
|
|
59
|
+
/** Leading icon tap (MAUI `LeadingCommand` + `CommandParameter`). Makes the icon actionable. */
|
|
60
|
+
readonly onLeadingPress?: () => void;
|
|
61
|
+
/** Trailing icon tap when no built-in affordance claims it (MAUI `TrailingCommand`). */
|
|
62
|
+
readonly onTrailingPress?: () => void;
|
|
63
|
+
/** Extra padding of the inner content (MAUI `InnerContentPadding`), physical sides. */
|
|
64
|
+
readonly innerContentPadding?: Partial<G9PhysicalPadding>;
|
|
65
|
+
/** Class of the root element. */
|
|
66
|
+
readonly className?: string;
|
|
67
|
+
}
|
|
68
|
+
/** What {@link resolveOutlinedFieldState} needs besides the props. */
|
|
69
|
+
export interface G9OutlinedFieldStateInput {
|
|
70
|
+
readonly focused: boolean;
|
|
71
|
+
readonly hasValue: boolean;
|
|
72
|
+
/** A value the field shows without text (a picker's selection): floats the label like a value. */
|
|
73
|
+
readonly valueFloated?: boolean;
|
|
74
|
+
/** App-wide filled-value accent (`settings.fields.highlightFilledValue`). */
|
|
75
|
+
readonly highlightFilledValue: boolean;
|
|
76
|
+
/** Characters of the value, for the counter. */
|
|
77
|
+
readonly textLength: number;
|
|
78
|
+
/** Resting chrome tone: `'outline'` (default) or `'placeholder'` (search). */
|
|
79
|
+
readonly restingTone?: 'outline' | 'placeholder';
|
|
80
|
+
}
|
|
81
|
+
/** The resolved look of an outlined field (colours are CSS colour values). */
|
|
82
|
+
export interface G9OutlinedFieldState {
|
|
83
|
+
readonly floated: boolean;
|
|
84
|
+
/** Outline, floated label and trailing icon colour. */
|
|
85
|
+
readonly stateColor: string;
|
|
86
|
+
readonly labelColor: string;
|
|
87
|
+
/** Leading icon and resting label colour. */
|
|
88
|
+
readonly restingContentColor: string;
|
|
89
|
+
readonly labelText: string;
|
|
90
|
+
/** Helper line text (`errorText` while in error), `''` when hidden. */
|
|
91
|
+
readonly helperText: string;
|
|
92
|
+
readonly helperColor: string;
|
|
93
|
+
/** Counter text (`'n / max'`), `''` when hidden. */
|
|
94
|
+
readonly counterText: string;
|
|
95
|
+
readonly footerVisible: boolean;
|
|
96
|
+
readonly strokeWidth: number;
|
|
97
|
+
/** Focus halo thickness, 0 when off. */
|
|
98
|
+
readonly haloWidth: number;
|
|
99
|
+
readonly fieldHeight: number;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Resolves the field's state colours and footer (MAUI `ResolveStateColor`, `ResolveFloatingLabelColor`, the footer
|
|
103
|
+
* part of `Refresh`). Precedence: error > status colour > focus > accented filled value > resting.
|
|
104
|
+
*/
|
|
105
|
+
export declare function resolveOutlinedFieldState(props: G9OutlinedFieldProps, input: G9OutlinedFieldStateInput): G9OutlinedFieldState;
|
|
106
|
+
/** {@link resolveOutlinedFieldState} with the app-wide settings read from the provider. */
|
|
107
|
+
export declare function useOutlinedField(props: G9OutlinedFieldProps, input: Omit<G9OutlinedFieldStateInput, 'highlightFilledValue'>): G9OutlinedFieldState;
|
|
108
|
+
/** A built-in trailing affordance an input puts in the trailing slot (password eye, microphone, clear). */
|
|
109
|
+
export interface G9TrailingAffordance {
|
|
110
|
+
/** What it shows. */
|
|
111
|
+
readonly icon: G9IconInput;
|
|
112
|
+
/** Icon colour; default the state colour. */
|
|
113
|
+
readonly color?: string;
|
|
114
|
+
/** Accessibility label. */
|
|
115
|
+
readonly label?: string;
|
|
116
|
+
/** Stable key (MAUI `ResolveTrailingIconSignature`): the slot is rebuilt only when it changes. */
|
|
117
|
+
readonly signature: string;
|
|
118
|
+
readonly onPress: () => void;
|
|
119
|
+
}
|
|
120
|
+
/** Props of {@link G9OutlinedField}: the shared props plus what the composing input supplies. */
|
|
121
|
+
export interface G9OutlinedFieldFrameProps extends G9OutlinedFieldProps {
|
|
122
|
+
readonly focused: boolean;
|
|
123
|
+
readonly hasValue: boolean;
|
|
124
|
+
readonly valueFloated?: boolean;
|
|
125
|
+
readonly textLength?: number;
|
|
126
|
+
/** The input element (or any content) inside the box. */
|
|
127
|
+
readonly children?: ReactNode;
|
|
128
|
+
/** A built-in trailing affordance; replaces the trailing icon props (busy still wins). */
|
|
129
|
+
readonly trailingAffordance?: G9TrailingAffordance | null;
|
|
130
|
+
/** Tapping the box (outside the icons) focuses the content (MAUI `FocusTarget`). */
|
|
131
|
+
readonly onFocusRequest?: () => void;
|
|
132
|
+
/** Resting tone (`'placeholder'` for search, MAUI `ResolveRestingOutlineColor` override). */
|
|
133
|
+
readonly restingTone?: 'outline' | 'placeholder';
|
|
134
|
+
/** Vertical placement of the icons and the resting label: centred (entries) or top/bottom (editor). */
|
|
135
|
+
readonly multiline?: boolean;
|
|
136
|
+
/** Accessibility label of the box (defaults to the label text). */
|
|
137
|
+
readonly accessibilityLabel?: string;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* The outlined field frame (MAUI `G9OutlinedFieldBase`): outline with a notched floating label, leading and
|
|
141
|
+
* trailing icon slots, helper/error line and counter. Inputs (`G9TextEntry`, `G9Editor`, `G9SearchEntry`, the pickers)
|
|
142
|
+
* put their element in `children`. Direction is set on the root from the culture (labels, icons, helper follow it;
|
|
143
|
+
* the input decides its own text direction). A tap on an icon never focuses the content; a tap elsewhere on the box
|
|
144
|
+
* calls `onFocusRequest`.
|
|
145
|
+
*
|
|
146
|
+
* Look: colours come from the theme variables (`--g9-primary`, `--g9-outline`, `--g9-error`, …). The floated label
|
|
147
|
+
* sits on the outline with the background `--g9-field-notch-background` (default `--g9-background`; set it on a
|
|
148
|
+
* container of another colour with `g9FieldNotchStyle`, G9 sheets and popups do), which hides the
|
|
149
|
+
* outline under it.
|
|
150
|
+
*/
|
|
151
|
+
export declare function G9OutlinedField(props: G9OutlinedFieldFrameProps): ReactNode;
|
|
152
|
+
//# sourceMappingURL=outlined-field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outlined-field.d.ts","sourceRoot":"","sources":["../../src/fields/outlined-field.tsx"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,sBAAsB,EAAE,KAAK,aAAa,EAAa,MAAM,+BAA+B,CAAC;AACtG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,OAAO,EAAE,KAAK,iBAAiB,EAA0B,MAAM,eAAe,CAAC;AAM/E,4FAA4F;AAC5F,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,6FAA6F;IAC7F,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,+DAA+D;IAC/D,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,yFAAyF;IACzF,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,mEAAmE;IACnE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,qHAAqH;IACrH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,2EAA2E;IAC3E,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B,wFAAwF;IACxF,QAAQ,CAAC,QAAQ,CAA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AC,EAAE,MAAM,IAAI,CAAC;IACrC,6FAA6F;IAC7F,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC;IACjD,uGAAuG;IACvG,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,mEAAmE;IACnE,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;CACtC;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,yBAAyB,GAAG,SAAS,CAsL3E"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import "./fields.css";
|
|
2
|
+
import { G9FilledValueHighlight, G9Metrics } from "@g9tm/lynxcontrols-foundation";
|
|
3
|
+
import { g9IdProps, g9RowStyle } from "../base/control.jsx";
|
|
4
|
+
import { g9KeyboardTargetProps } from "../host/keyboard.jsx";
|
|
5
|
+
import { G9IconSlot, hasIconSlot } from "../icon/slot.jsx";
|
|
6
|
+
import { useG9Direction, useG9Settings } from "../provider/hooks.jsx";
|
|
7
|
+
import { resolveFieldSlotLayout } from "./slot-layout.jsx";
|
|
8
|
+
const v = (token)=>`var(--g9-${token})`;
|
|
9
|
+
function resolveOutlinedFieldState(props, input) {
|
|
10
|
+
var _props_filledValueHighlight, _props_statusColor, _props_errorText, _props_helperText, _props_maxLength, _ref, _props_label;
|
|
11
|
+
const hasError = true === props.hasError;
|
|
12
|
+
const useStatus = true === props.useStatusColor;
|
|
13
|
+
const filled = input.hasValue || true === input.valueFloated;
|
|
14
|
+
const highlight = null != (_props_filledValueHighlight = props.filledValueHighlight) ? _props_filledValueHighlight : G9FilledValueHighlight.Inherit;
|
|
15
|
+
const accentFilled = highlight === G9FilledValueHighlight.Accent ? true : highlight === G9FilledValueHighlight.Neutral ? false : input.highlightFilledValue;
|
|
16
|
+
const placeholderTone = 'placeholder' === input.restingTone;
|
|
17
|
+
const restingOutline = placeholderTone ? v('input-placeholder') : v('outline');
|
|
18
|
+
const restingContentColor = placeholderTone ? v('input-placeholder') : v('text-tertiary');
|
|
19
|
+
let stateColor;
|
|
20
|
+
stateColor = hasError ? v('error') : useStatus ? null != (_props_statusColor = props.statusColor) ? _props_statusColor : v('primary') : input.focused ? v('primary') : filled && accentFilled ? v('primary') : restingOutline;
|
|
21
|
+
const floated = true === props.alwaysFloat || true === input.valueFloated || input.focused || input.hasValue;
|
|
22
|
+
const neutralFilledRest = filled && !input.focused && !hasError && !useStatus && !accentFilled;
|
|
23
|
+
const labelColor = floated && !neutralFilledRest ? stateColor : restingContentColor;
|
|
24
|
+
const helperRaw = hasError ? null != (_props_errorText = props.errorText) ? _props_errorText : '' : null != (_props_helperText = props.helperText) ? _props_helperText : '';
|
|
25
|
+
const helperText = '' === helperRaw.trim() ? '' : helperRaw;
|
|
26
|
+
const maxLength = null != (_props_maxLength = props.maxLength) ? _props_maxLength : -1;
|
|
27
|
+
const counterText = true === props.showCharacterCounter && maxLength > 0 ? `${input.textLength} / ${maxLength}` : '';
|
|
28
|
+
const emphasis = input.focused || hasError || useStatus;
|
|
29
|
+
const halo = true === props.showFocusHalo && input.focused && !hasError && !useStatus;
|
|
30
|
+
const labelRaw = null != (_ref = null != (_props_label = props.label) ? _props_label : props.placeholder) ? _ref : '';
|
|
31
|
+
return {
|
|
32
|
+
floated,
|
|
33
|
+
stateColor,
|
|
34
|
+
labelColor,
|
|
35
|
+
restingContentColor,
|
|
36
|
+
labelText: '' === labelRaw.trim() ? '' : labelRaw,
|
|
37
|
+
helperText,
|
|
38
|
+
helperColor: hasError ? v('error') : v('text-tertiary'),
|
|
39
|
+
counterText,
|
|
40
|
+
footerVisible: '' !== helperText || '' !== counterText,
|
|
41
|
+
strokeWidth: emphasis ? G9Metrics.OutlinedFieldEmphasisStrokeThickness : G9Metrics.OutlinedFieldStrokeThickness,
|
|
42
|
+
haloWidth: halo ? G9Metrics.OutlinedFieldFocusHaloThickness : 0,
|
|
43
|
+
fieldHeight: props.fieldHeight && props.fieldHeight > 0 ? props.fieldHeight : G9Metrics.ControlHeight
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function useOutlinedField(props, input) {
|
|
47
|
+
const settings = useG9Settings();
|
|
48
|
+
return resolveOutlinedFieldState(props, {
|
|
49
|
+
...input,
|
|
50
|
+
highlightFilledValue: settings.fields.highlightFilledValue
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function physicalSide(column) {
|
|
54
|
+
return 0 === column ? 'left' : 'right';
|
|
55
|
+
}
|
|
56
|
+
function G9OutlinedField(props) {
|
|
57
|
+
var _props_valueFloated, _props_textLength, _props_restingTone, _props_leadingEmoji, _props_leadingImagePath, _props_leadingImage, _props_trailingEmoji, _props_trailingImagePath, _props_trailingImage, _props_trailingAffordance, _props_innerContentPadding, _pad_left, _pad_top, _pad_right, _pad_bottom, _affordance_color;
|
|
58
|
+
const direction = useG9Direction();
|
|
59
|
+
const isRtl = 'rtl' === direction;
|
|
60
|
+
const state = useOutlinedField(props, {
|
|
61
|
+
focused: props.focused,
|
|
62
|
+
hasValue: props.hasValue,
|
|
63
|
+
valueFloated: null != (_props_valueFloated = props.valueFloated) ? _props_valueFloated : false,
|
|
64
|
+
textLength: null != (_props_textLength = props.textLength) ? _props_textLength : 0,
|
|
65
|
+
restingTone: null != (_props_restingTone = props.restingTone) ? _props_restingTone : 'outline'
|
|
66
|
+
});
|
|
67
|
+
const leading = {
|
|
68
|
+
emoji: null != (_props_leadingEmoji = props.leadingEmoji) ? _props_leadingEmoji : null,
|
|
69
|
+
icon: props.leadingIcon,
|
|
70
|
+
imagePath: null != (_props_leadingImagePath = props.leadingImagePath) ? _props_leadingImagePath : null,
|
|
71
|
+
image: null != (_props_leadingImage = props.leadingImage) ? _props_leadingImage : null
|
|
72
|
+
};
|
|
73
|
+
const trailing = {
|
|
74
|
+
emoji: null != (_props_trailingEmoji = props.trailingEmoji) ? _props_trailingEmoji : null,
|
|
75
|
+
icon: props.trailingIcon,
|
|
76
|
+
imagePath: null != (_props_trailingImagePath = props.trailingImagePath) ? _props_trailingImagePath : null,
|
|
77
|
+
image: null != (_props_trailingImage = props.trailingImage) ? _props_trailingImage : null
|
|
78
|
+
};
|
|
79
|
+
const busy = true === props.isTrailingBusy;
|
|
80
|
+
const affordance = null != (_props_trailingAffordance = props.trailingAffordance) ? _props_trailingAffordance : null;
|
|
81
|
+
const hasLeading = hasIconSlot(leading);
|
|
82
|
+
const hasTrailing = busy || null !== affordance || hasIconSlot(trailing);
|
|
83
|
+
const pad = null != (_props_innerContentPadding = props.innerContentPadding) ? _props_innerContentPadding : {};
|
|
84
|
+
const slot = resolveFieldSlotLayout({
|
|
85
|
+
hasLeadingIcon: hasLeading,
|
|
86
|
+
hasTrailingIcon: hasTrailing,
|
|
87
|
+
isRtl,
|
|
88
|
+
forceTrailingIconRight: true === props.forceTrailingIconRight,
|
|
89
|
+
forceLeadingIconLeft: true === props.forceLeadingIconLeft
|
|
90
|
+
}, {
|
|
91
|
+
left: null != (_pad_left = pad.left) ? _pad_left : 0,
|
|
92
|
+
top: null != (_pad_top = pad.top) ? _pad_top : 0,
|
|
93
|
+
right: null != (_pad_right = pad.right) ? _pad_right : 0,
|
|
94
|
+
bottom: null != (_pad_bottom = pad.bottom) ? _pad_bottom : 0
|
|
95
|
+
});
|
|
96
|
+
const disabled = true === props.disabled;
|
|
97
|
+
const leadingActionable = void 0 !== props.onLeadingPress;
|
|
98
|
+
const trailingActionable = null !== affordance || void 0 !== props.onTrailingPress;
|
|
99
|
+
const onLeadingTap = ()=>{
|
|
100
|
+
var _props_onLeadingPress;
|
|
101
|
+
if (disabled || !leadingActionable) return;
|
|
102
|
+
null == (_props_onLeadingPress = props.onLeadingPress) || _props_onLeadingPress.call(props);
|
|
103
|
+
};
|
|
104
|
+
const onTrailingTap = ()=>{
|
|
105
|
+
var _props_onTrailingPress;
|
|
106
|
+
if (disabled || busy || !trailingActionable) return;
|
|
107
|
+
if (affordance) affordance.onPress();
|
|
108
|
+
else null == (_props_onTrailingPress = props.onTrailingPress) || _props_onTrailingPress.call(props);
|
|
109
|
+
};
|
|
110
|
+
const onBoxTap = ()=>{
|
|
111
|
+
var _props_onFocusRequest;
|
|
112
|
+
if (!disabled) null == (_props_onFocusRequest = props.onFocusRequest) || _props_onFocusRequest.call(props);
|
|
113
|
+
};
|
|
114
|
+
const multiline = true === props.multiline;
|
|
115
|
+
const labelHeight = G9Metrics.FloatingLabelHeight;
|
|
116
|
+
const restTop = multiline ? (G9Metrics.ControlHeight - labelHeight) / 2 : (state.fieldHeight - labelHeight) / 2;
|
|
117
|
+
const labelX = slot.labelRestX + (state.floated ? slot.labelFloatedX : 0);
|
|
118
|
+
const labelAnchor = isRtl ? 'right' : 'left';
|
|
119
|
+
const iconSize = G9Metrics.InputIconSize;
|
|
120
|
+
const slotStyle = (column, width, bottomAligned)=>({
|
|
121
|
+
[physicalSide(column)]: '0px',
|
|
122
|
+
width: `${width}px`,
|
|
123
|
+
...bottomAligned ? {
|
|
124
|
+
bottom: '0px',
|
|
125
|
+
height: `${G9Metrics.EditorTrailingSlotHeight}px`
|
|
126
|
+
} : {
|
|
127
|
+
top: '0px',
|
|
128
|
+
bottom: '0px'
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
const trailingContent = busy ? <view className="g9-field__busy" style={{
|
|
132
|
+
borderColor: state.stateColor,
|
|
133
|
+
borderTopColor: 'transparent'
|
|
134
|
+
}}/> : affordance ? <G9IconSlot icon={affordance.icon} color={null != (_affordance_color = affordance.color) ? _affordance_color : state.stateColor} size={iconSize}/> : <G9IconSlot {...trailing} color={state.stateColor} size={iconSize}/>;
|
|
135
|
+
return <view className={`g9-field g9-dir-${direction}${disabled ? ' g9-field--disabled' : ''}${props.className ? ` ${props.className}` : ''}`} {...g9IdProps(props.id)}>
|
|
136
|
+
<view {...g9KeyboardTargetProps} className={`g9-field__box${state.floated ? ' g9-field__box--floated' : ''}${props.focused ? ' g9-field__box--focused' : ''}`} accessibility-element={false} style={{
|
|
137
|
+
height: multiline ? void 0 : `${state.fieldHeight}px`,
|
|
138
|
+
minHeight: multiline ? `${state.fieldHeight}px` : void 0,
|
|
139
|
+
marginTop: props.reserveFloatingLabelClearance ? `${G9Metrics.FloatingLabelClearance}px` : '0px'
|
|
140
|
+
}} bindtap={onBoxTap}>
|
|
141
|
+
{}
|
|
142
|
+
<view className="g9-field__outline" style={{
|
|
143
|
+
borderColor: state.stateColor,
|
|
144
|
+
borderWidth: `${state.strokeWidth}px`,
|
|
145
|
+
borderRadius: `${G9Metrics.RadiusMd}px`
|
|
146
|
+
}}/>
|
|
147
|
+
{state.haloWidth > 0 ? <view className="g9-field__halo" style={{
|
|
148
|
+
borderColor: state.stateColor,
|
|
149
|
+
borderWidth: `${state.haloWidth}px`,
|
|
150
|
+
opacity: G9Metrics.FocusRingOpacity,
|
|
151
|
+
borderRadius: `${G9Metrics.RadiusMd}px`
|
|
152
|
+
}}/> : null}
|
|
153
|
+
<view className="g9-field__content" style={{
|
|
154
|
+
paddingLeft: `${slot.innerPadding.left + (hasLeading && 0 === slot.leadingColumn ? G9Metrics.LeadingIconSlotWidth : 0) + (hasTrailing && 0 === slot.trailingColumn ? G9Metrics.TrailingIconSlotWidth : 0)}px`,
|
|
155
|
+
paddingRight: `${slot.innerPadding.right + (hasLeading && 2 === slot.leadingColumn ? G9Metrics.LeadingIconSlotWidth : 0) + (hasTrailing && 2 === slot.trailingColumn ? G9Metrics.TrailingIconSlotWidth : 0)}px`,
|
|
156
|
+
paddingTop: `${slot.innerPadding.top}px`,
|
|
157
|
+
paddingBottom: `${slot.innerPadding.bottom}px`
|
|
158
|
+
}}>
|
|
159
|
+
{props.children}
|
|
160
|
+
</view>
|
|
161
|
+
{hasLeading ? <view className="g9-field__slot g9-field__slot--leading" style={slotStyle(slot.leadingColumn, G9Metrics.LeadingIconSlotWidth, false)} catchtap={onLeadingTap} {...leadingActionable ? {
|
|
162
|
+
'accessibility-element': true,
|
|
163
|
+
'accessibility-traits': 'button'
|
|
164
|
+
} : {}}>
|
|
165
|
+
<G9IconSlot {...leading} color={state.restingContentColor} size={iconSize}/>
|
|
166
|
+
</view> : null}
|
|
167
|
+
{hasTrailing ? <view key={busy ? 'busy' : affordance ? affordance.signature : 'icon'} className="g9-field__slot g9-field__slot--trailing" style={slotStyle(slot.trailingColumn, G9Metrics.TrailingIconSlotWidth, multiline && !busy)} catchtap={onTrailingTap} {...trailingActionable ? {
|
|
168
|
+
'accessibility-element': true,
|
|
169
|
+
'accessibility-traits': 'button',
|
|
170
|
+
...(null == affordance ? void 0 : affordance.label) ? {
|
|
171
|
+
'accessibility-label': affordance.label
|
|
172
|
+
} : {}
|
|
173
|
+
} : {}}>
|
|
174
|
+
{trailingContent}
|
|
175
|
+
</view> : null}
|
|
176
|
+
{state.labelText ? <text className={`g9-field__label${state.floated ? ' g9-field__label--floated' : ''}`} style={{
|
|
177
|
+
[labelAnchor]: `${G9Metrics.InputHorizontalPadding}px`,
|
|
178
|
+
top: `${state.floated ? G9Metrics.FloatingLabelFloatedY : restTop}px`,
|
|
179
|
+
fontSize: `${state.floated ? G9Metrics.FloatingLabelFontSizeFloat : G9Metrics.FloatingLabelFontSizeRest}px`,
|
|
180
|
+
color: disabled ? 'var(--g9-text-disabled)' : state.labelColor,
|
|
181
|
+
transform: `translateX(${labelX}px)`
|
|
182
|
+
}}>
|
|
183
|
+
{state.labelText}
|
|
184
|
+
</text> : null}
|
|
185
|
+
</view>
|
|
186
|
+
{state.footerVisible ? <view className="g9-field__footer" style={g9RowStyle(direction)}>
|
|
187
|
+
{state.helperText ? <text className="g9-field__helper" style={{
|
|
188
|
+
color: state.helperColor,
|
|
189
|
+
textAlign: isRtl ? 'right' : 'left'
|
|
190
|
+
}}>
|
|
191
|
+
{state.helperText}
|
|
192
|
+
</text> : <view className="g9-field__helper"/>}
|
|
193
|
+
{state.counterText ? <text className="g9-field__counter">{state.counterText}</text> : null}
|
|
194
|
+
</view> : null}
|
|
195
|
+
</view>;
|
|
196
|
+
}
|
|
197
|
+
export { G9OutlinedField, resolveOutlinedFieldState, useOutlinedField };
|
|
198
|
+
|
|
199
|
+
//# sourceMappingURL=outlined-field.jsx.map
|