react-miui 0.34.0 → 0.36.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/.claude/settings.local.json +2 -1
- package/CHANGELOG.md +17 -0
- package/dist/components/form/index.d.ts +1 -0
- package/dist/components/form/index.d.ts.map +1 -1
- package/dist/components/form/index.js +1 -0
- package/dist/components/form/index.js.map +1 -1
- package/dist/components/form/input/Input.d.ts.map +1 -1
- package/dist/components/form/input/Input.js +9 -5
- package/dist/components/form/input/Input.js.map +1 -1
- package/dist/components/form/timepicker/TimePicker.css.d.ts +99 -0
- package/dist/components/form/timepicker/TimePicker.css.d.ts.map +1 -0
- package/dist/components/form/timepicker/TimePicker.css.js +116 -0
- package/dist/components/form/timepicker/TimePicker.css.js.map +1 -0
- package/dist/components/form/timepicker/TimePicker.d.ts +22 -0
- package/dist/components/form/timepicker/TimePicker.d.ts.map +1 -0
- package/dist/components/form/timepicker/TimePicker.js +141 -0
- package/dist/components/form/timepicker/TimePicker.js.map +1 -0
- package/dist/components/form/timepicker/TimePicker.styled.d.ts +936 -0
- package/dist/components/form/timepicker/TimePicker.styled.d.ts.map +1 -0
- package/dist/components/form/timepicker/TimePicker.styled.js +29 -0
- package/dist/components/form/timepicker/TimePicker.styled.js.map +1 -0
- package/dist/components/form/timepicker/TimePickerModal.d.ts +17 -0
- package/dist/components/form/timepicker/TimePickerModal.d.ts.map +1 -0
- package/dist/components/form/timepicker/TimePickerModal.js +92 -0
- package/dist/components/form/timepicker/TimePickerModal.js.map +1 -0
- package/dist/components/form/timepicker/Wheel.d.ts +12 -0
- package/dist/components/form/timepicker/Wheel.d.ts.map +1 -0
- package/dist/components/form/timepicker/Wheel.js +187 -0
- package/dist/components/form/timepicker/Wheel.js.map +1 -0
- package/dist/components/form/timepicker/utils.d.ts +4 -0
- package/dist/components/form/timepicker/utils.d.ts.map +1 -0
- package/dist/components/form/timepicker/utils.js +62 -0
- package/dist/components/form/timepicker/utils.js.map +1 -0
- package/dist/components/icons/Clock.d.ts +7 -0
- package/dist/components/icons/Clock.d.ts.map +1 -0
- package/dist/components/icons/Clock.js +45 -0
- package/dist/components/icons/Clock.js.map +1 -0
- package/dist/components/icons/Icon.d.ts +2 -1
- package/dist/components/icons/Icon.d.ts.map +1 -1
- package/dist/components/icons/Icon.js +3 -0
- package/dist/components/icons/Icon.js.map +1 -1
- package/dist/components/layout/header/HeaderIconAction.d.ts.map +1 -1
- package/dist/components/layout/header/HeaderIconAction.js +13 -3
- package/dist/components/layout/header/HeaderIconAction.js.map +1 -1
- package/dist/components/layout/header/HeaderIconAction.styled.d.ts.map +1 -1
- package/dist/components/layout/header/HeaderIconAction.styled.js +11 -17
- package/dist/components/layout/header/HeaderIconAction.styled.js.map +1 -1
- package/dist/components/layout/list/Item.d.ts.map +1 -1
- package/dist/components/layout/list/Item.js +17 -7
- package/dist/components/layout/list/Item.js.map +1 -1
- package/dist/components/layout/list/Item.styled.d.ts.map +1 -1
- package/dist/components/layout/list/Item.styled.js +2 -1
- package/dist/components/layout/list/Item.styled.js.map +1 -1
- package/dist/components/ui/button/Button.d.ts +94 -1
- package/dist/components/ui/button/Button.d.ts.map +1 -1
- package/dist/components/ui/button/Button.js +59 -2
- package/dist/components/ui/button/Button.js.map +1 -1
- package/dist/components/ui/button/Button.styled.d.ts +2 -2
- package/dist/components/ui/button/Button.styled.d.ts.map +1 -1
- package/dist/components/ui/button/Button.styled.js +4 -3
- package/dist/components/ui/button/Button.styled.js.map +1 -1
- package/dist/components/ui/directionPad/Button.d.ts.map +1 -1
- package/dist/components/ui/directionPad/Button.js +7 -2
- package/dist/components/ui/directionPad/Button.js.map +1 -1
- package/dist/components/ui/directionPad/Button.styled.d.ts.map +1 -1
- package/dist/components/ui/directionPad/Button.styled.js +2 -1
- package/dist/components/ui/directionPad/Button.styled.js.map +1 -1
- package/dist/components/ui/directionPad/Middle.d.ts.map +1 -1
- package/dist/components/ui/directionPad/Middle.js +7 -1
- package/dist/components/ui/directionPad/Middle.js.map +1 -1
- package/dist/components/ui/directionPad/Middle.styled.d.ts.map +1 -1
- package/dist/components/ui/directionPad/Middle.styled.js +2 -1
- package/dist/components/ui/directionPad/Middle.styled.js.map +1 -1
- package/dist/components/ui/modal/Modal.d.ts +1 -2
- package/dist/components/ui/modal/Modal.d.ts.map +1 -1
- package/dist/components/ui/modal/Modal.js +114 -42
- package/dist/components/ui/modal/Modal.js.map +1 -1
- package/dist/components/ui/modal/Modal.styled.d.ts +1 -1
- package/dist/components/ui/modal/Modal.styled.d.ts.map +1 -1
- package/dist/components/ui/modal/Modal.styled.js +40 -25
- package/dist/components/ui/modal/Modal.styled.js.map +1 -1
- package/dist/components/ui/modal/ModalButtons.d.ts +179 -1
- package/dist/components/ui/modal/ModalButtons.d.ts.map +1 -1
- package/dist/components/ui/modal/ModalButtons.js +63 -2
- package/dist/components/ui/modal/ModalButtons.js.map +1 -1
- package/dist/components/ui/modal/ModalButtons.styled.d.ts +90 -91
- package/dist/components/ui/modal/ModalButtons.styled.d.ts.map +1 -1
- package/dist/components/ui/modal/ModalButtons.styled.js +5 -7
- package/dist/components/ui/modal/ModalButtons.styled.js.map +1 -1
- package/dist/components/ui/pop/Pop.styled.d.ts.map +1 -1
- package/dist/components/ui/pop/Pop.styled.js +15 -17
- package/dist/components/ui/pop/Pop.styled.js.map +1 -1
- package/dist/components/ui/pop/PopOption.d.ts.map +1 -1
- package/dist/components/ui/pop/PopOption.js +7 -2
- package/dist/components/ui/pop/PopOption.js.map +1 -1
- package/dist/components/ui/toolButton/ToolButton.d.ts +94 -1
- package/dist/components/ui/toolButton/ToolButton.d.ts.map +1 -1
- package/dist/components/ui/toolButton/ToolButton.js +59 -2
- package/dist/components/ui/toolButton/ToolButton.js.map +1 -1
- package/dist/components/ui/toolButton/ToolButton.styled.d.ts +2 -2
- package/dist/components/ui/toolButton/ToolButton.styled.d.ts.map +1 -1
- package/dist/components/ui/toolButton/ToolButton.styled.js +20 -25
- package/dist/components/ui/toolButton/ToolButton.styled.js.map +1 -1
- package/dist/theme.css-global.d.ts.map +1 -1
- package/dist/theme.css-global.js +0 -1
- package/dist/theme.css-global.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/useNativeValidity.d.ts +11 -0
- package/dist/utils/useNativeValidity.d.ts.map +1 -0
- package/dist/utils/useNativeValidity.js +32 -0
- package/dist/utils/useNativeValidity.js.map +1 -0
- package/dist/utils/useRipple.d.ts +15 -0
- package/dist/utils/useRipple.d.ts.map +1 -0
- package/dist/utils/useRipple.js +120 -0
- package/dist/utils/useRipple.js.map +1 -0
- package/dist/utils/useRipple.styled.d.ts +28 -0
- package/dist/utils/useRipple.styled.d.ts.map +1 -0
- package/dist/utils/useRipple.styled.js +36 -0
- package/dist/utils/useRipple.styled.js.map +1 -0
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/index.Pop.html +7 -7
- package/docs/documents/Test.html +2 -2
- package/docs/enums/index.ICON.html +3 -2
- package/docs/functions/index.Action.html +3 -3
- package/docs/functions/index.Button.html +3 -9
- package/docs/functions/index.Card.html +2 -2
- package/docs/functions/index.Checkbox.html +3 -3
- package/docs/functions/index.Choice.html +2 -2
- package/docs/functions/index.ColorPicker.html +3 -3
- package/docs/functions/index.CoveringLoader.html +3 -3
- package/docs/functions/index.DirectionPad.html +2 -2
- package/docs/functions/index.Drawer.html +2 -2
- package/docs/functions/index.EqualActions.html +2 -2
- package/docs/functions/index.FullLoader.html +3 -3
- package/docs/functions/index.Gap.html +2 -2
- package/docs/functions/index.HandleEsc.html +3 -3
- package/docs/functions/index.Header.html +3 -3
- package/docs/functions/index.HeaderIconAction.html +3 -3
- package/docs/functions/index.Icon-1.html +2 -2
- package/docs/functions/index.If.html +3 -3
- package/docs/functions/index.Input.html +1 -1
- package/docs/functions/index.KeyValue.html +2 -2
- package/docs/functions/index.Label.html +2 -2
- package/docs/functions/index.Line.html +3 -3
- package/docs/functions/index.List.html +2 -2
- package/docs/functions/index.Loader.html +3 -3
- package/docs/functions/index.Loading.html +3 -3
- package/docs/functions/index.Message.html +3 -3
- package/docs/functions/index.Modal.html +2 -2
- package/docs/functions/index.ModalButtons.html +3 -3
- package/docs/functions/index.PopLoader.html +3 -3
- package/docs/functions/index.PopOption.html +2 -2
- package/docs/functions/index.Progress.html +2 -2
- package/docs/functions/index.SearchContainer.html +2 -2
- package/docs/functions/index.Section.html +4 -4
- package/docs/functions/index.Select.html +2 -2
- package/docs/functions/index.Selector.html +2 -2
- package/docs/functions/index.Spacer.html +2 -2
- package/docs/functions/index.Stats.html +2 -2
- package/docs/functions/index.StickyHeader.html +4 -4
- package/docs/functions/index.Table.html +2 -2
- package/docs/functions/index.TextArea.html +2 -2
- package/docs/functions/index.TimePicker.html +10 -0
- package/docs/functions/index.ToasterProvider.html +3 -3
- package/docs/functions/index.Toggle.html +3 -3
- package/docs/functions/index.ToolButton.html +3 -9
- package/docs/functions/index.Tooltip.html +3 -3
- package/docs/functions/index.TooltipProvider.html +2 -2
- package/docs/functions/index.borderPxToRem.html +1 -1
- package/docs/functions/index.createTheme.html +1 -1
- package/docs/functions/index.css.html +1 -1
- package/docs/functions/index.dimensionsPxToRem.html +1 -1
- package/docs/functions/index.fontPxToRem.html +1 -1
- package/docs/functions/index.getCssText.html +1 -1
- package/docs/functions/index.globalCss.html +2 -2
- package/docs/functions/index.injectGlobalStyles.html +1 -1
- package/docs/functions/index.keyframes.html +1 -1
- package/docs/functions/index.pxToRem.html +1 -1
- package/docs/functions/index.styled.html +1 -1
- package/docs/functions/index.toast.html +2 -2
- package/docs/functions/index.useToaster.html +1 -1
- package/docs/index.html +2 -2
- package/docs/interfaces/index.IconProps.html +2 -2
- package/docs/interfaces/index.InputCustomProps.html +3 -3
- package/docs/interfaces/index.LoaderProps.html +6 -6
- package/docs/interfaces/index.StickyHeaderProps.html +4 -4
- package/docs/interfaces/index.ToasterProviderProps.html +3 -3
- package/docs/interfaces/index.TooltipProps.html +14 -14
- package/docs/interfaces/index.TooltipProviderProps.html +5 -5
- package/docs/modules/index.html +1 -1
- package/docs/modules.html +1 -1
- package/docs/types/index.ActionProps.html +1 -1
- package/docs/types/index.CardProps.html +1 -1
- package/docs/types/index.CheckboxProps.html +2 -2
- package/docs/types/index.ChoiceProps.html +1 -1
- package/docs/types/index.ColorPickerProps.html +1 -1
- package/docs/types/index.DirectionPadProps.html +1 -1
- package/docs/types/index.DrawerFrom.html +1 -1
- package/docs/types/index.DrawerProps.html +2 -2
- package/docs/types/index.EqualActionsProps.html +1 -1
- package/docs/types/index.HeaderProps.html +1 -1
- package/docs/types/index.InputProps.html +1 -1
- package/docs/types/index.KeyValueProps.html +1 -1
- package/docs/types/index.LabelProps.html +1 -1
- package/docs/types/index.OverwriteProps.html +1 -1
- package/docs/types/index.ProgressProps.html +2 -2
- package/docs/types/index.SelectProps.html +1 -1
- package/docs/types/index.SelectorProps.html +1 -1
- package/docs/types/index.Stat.html +1 -1
- package/docs/types/index.StatsProps.html +1 -1
- package/docs/types/index.TextAreaProps.html +1 -1
- package/docs/types/index.ThemeCSS.html +1 -1
- package/docs/types/index.TimePickerProps.html +1 -0
- package/docs/types/index.ToggleProps.html +2 -2
- package/docs/variables/index.ActionBadgeSelector.html +1 -1
- package/docs/variables/index.ActionCircleSelector.html +1 -1
- package/docs/variables/index.CheckboxCheckmarkWrapperSelector.html +1 -1
- package/docs/variables/index.CheckboxTextLabelSelector.html +1 -1
- package/docs/variables/index.ChoiceItemSelector.html +1 -1
- package/docs/variables/index.ColorPickerColorDisplaySelector.html +1 -1
- package/docs/variables/index.DirectionPadButtonDotSelector.html +1 -1
- package/docs/variables/index.DirectionPadButtonSelector.html +1 -1
- package/docs/variables/index.DirectionPadLineSelector.html +1 -1
- package/docs/variables/index.DirectionPadMiddleSelector.html +1 -1
- package/docs/variables/index.DrawerContentSelector.html +1 -1
- package/docs/variables/index.HeaderAfterSelector.html +1 -1
- package/docs/variables/index.HeaderBeforeSelector.html +1 -1
- package/docs/variables/index.HeaderContentsSelector.html +1 -1
- package/docs/variables/index.HeaderIconActionIconSelector.html +1 -1
- package/docs/variables/index.InputContainerSelector.html +1 -1
- package/docs/variables/index.InputInputSelector.html +1 -1
- package/docs/variables/index.InputLabelSelector.html +1 -1
- package/docs/variables/index.InputPrefixSelector.html +1 -1
- package/docs/variables/index.InputSuffixSelector.html +1 -1
- package/docs/variables/index.KeyValueIconSelector.html +1 -1
- package/docs/variables/index.KeyValueItemSelector.html +1 -1
- package/docs/variables/index.KeyValueKeySelector.html +1 -1
- package/docs/variables/index.KeyValuePairSelector.html +1 -1
- package/docs/variables/index.KeyValueValueSelector.html +1 -1
- package/docs/variables/index.LabelTextSelector.html +1 -1
- package/docs/variables/index.ListItemInnerContainerClassNameSelector.html +1 -1
- package/docs/variables/index.ModalContainerSelector.html +1 -1
- package/docs/variables/index.ModalRemovePaddingSelector.html +1 -1
- package/docs/variables/index.ModalTitleSelector.html +1 -1
- package/docs/variables/index.PopListSelector.html +1 -1
- package/docs/variables/index.PopOptionButtonSelector.html +1 -1
- package/docs/variables/index.PopOptionIconSelector.html +1 -1
- package/docs/variables/index.PopOverlaySelector.html +1 -1
- package/docs/variables/index.ProgressBackgroundSelector.html +1 -1
- package/docs/variables/index.ProgressValueSelector.html +1 -1
- package/docs/variables/index.SelectorItemSelector.html +1 -1
- package/docs/variables/index.StatsItemSelector.html +1 -1
- package/docs/variables/index.StatsLabelSelector.html +1 -1
- package/docs/variables/index.StatsSeparatorSelector.html +1 -1
- package/docs/variables/index.StatsValueSelector.html +1 -1
- package/docs/variables/index.TextAreaLabelSelector.html +1 -1
- package/docs/variables/index.TextAreaTextAreaSelector.html +1 -1
- package/docs/variables/index.TextAreaWrapperSelector.html +1 -1
- package/docs/variables/index.ToggleStyledToggleSelector.html +1 -1
- package/docs/variables/index.TooltipContentSelector.html +1 -1
- package/docs/variables/index.config.html +1 -1
- package/docs/variables/index.cssReset.html +2 -2
- package/docs/variables/index.darkTheme.html +1 -1
- package/docs/variables/index.miuiScrollbars.html +1 -1
- package/docs/variables/index.theme.html +1 -1
- package/esm/components/form/index.d.ts +1 -0
- package/esm/components/form/index.d.ts.map +1 -1
- package/esm/components/form/index.js +1 -0
- package/esm/components/form/index.js.map +1 -1
- package/esm/components/form/input/Input.d.ts.map +1 -1
- package/esm/components/form/input/Input.js +9 -5
- package/esm/components/form/input/Input.js.map +1 -1
- package/esm/components/form/timepicker/TimePicker.css.d.ts +99 -0
- package/esm/components/form/timepicker/TimePicker.css.d.ts.map +1 -0
- package/esm/components/form/timepicker/TimePicker.css.js +102 -0
- package/esm/components/form/timepicker/TimePicker.css.js.map +1 -0
- package/esm/components/form/timepicker/TimePicker.d.ts +22 -0
- package/esm/components/form/timepicker/TimePicker.d.ts.map +1 -0
- package/esm/components/form/timepicker/TimePicker.js +93 -0
- package/esm/components/form/timepicker/TimePicker.js.map +1 -0
- package/esm/components/form/timepicker/TimePicker.styled.d.ts +936 -0
- package/esm/components/form/timepicker/TimePicker.styled.d.ts.map +1 -0
- package/esm/components/form/timepicker/TimePicker.styled.js +20 -0
- package/esm/components/form/timepicker/TimePicker.styled.js.map +1 -0
- package/esm/components/form/timepicker/TimePickerModal.d.ts +17 -0
- package/esm/components/form/timepicker/TimePickerModal.d.ts.map +1 -0
- package/esm/components/form/timepicker/TimePickerModal.js +56 -0
- package/esm/components/form/timepicker/TimePickerModal.js.map +1 -0
- package/esm/components/form/timepicker/Wheel.d.ts +12 -0
- package/esm/components/form/timepicker/Wheel.d.ts.map +1 -0
- package/esm/components/form/timepicker/Wheel.js +151 -0
- package/esm/components/form/timepicker/Wheel.js.map +1 -0
- package/esm/components/form/timepicker/utils.d.ts +4 -0
- package/esm/components/form/timepicker/utils.d.ts.map +1 -0
- package/esm/components/form/timepicker/utils.js +58 -0
- package/esm/components/form/timepicker/utils.js.map +1 -0
- package/esm/components/icons/Clock.d.ts +7 -0
- package/esm/components/icons/Clock.d.ts.map +1 -0
- package/esm/components/icons/Clock.js +9 -0
- package/esm/components/icons/Clock.js.map +1 -0
- package/esm/components/icons/Icon.d.ts +2 -1
- package/esm/components/icons/Icon.d.ts.map +1 -1
- package/esm/components/icons/Icon.js +3 -0
- package/esm/components/icons/Icon.js.map +1 -1
- package/esm/components/layout/header/HeaderIconAction.d.ts.map +1 -1
- package/esm/components/layout/header/HeaderIconAction.js +13 -3
- package/esm/components/layout/header/HeaderIconAction.js.map +1 -1
- package/esm/components/layout/header/HeaderIconAction.styled.d.ts.map +1 -1
- package/esm/components/layout/header/HeaderIconAction.styled.js +11 -17
- package/esm/components/layout/header/HeaderIconAction.styled.js.map +1 -1
- package/esm/components/layout/list/Item.d.ts.map +1 -1
- package/esm/components/layout/list/Item.js +18 -8
- package/esm/components/layout/list/Item.js.map +1 -1
- package/esm/components/layout/list/Item.styled.d.ts.map +1 -1
- package/esm/components/layout/list/Item.styled.js +2 -1
- package/esm/components/layout/list/Item.styled.js.map +1 -1
- package/esm/components/ui/button/Button.d.ts +94 -1
- package/esm/components/ui/button/Button.d.ts.map +1 -1
- package/esm/components/ui/button/Button.js +15 -1
- package/esm/components/ui/button/Button.js.map +1 -1
- package/esm/components/ui/button/Button.styled.d.ts +2 -2
- package/esm/components/ui/button/Button.styled.d.ts.map +1 -1
- package/esm/components/ui/button/Button.styled.js +3 -2
- package/esm/components/ui/button/Button.styled.js.map +1 -1
- package/esm/components/ui/directionPad/Button.d.ts.map +1 -1
- package/esm/components/ui/directionPad/Button.js +7 -2
- package/esm/components/ui/directionPad/Button.js.map +1 -1
- package/esm/components/ui/directionPad/Button.styled.d.ts.map +1 -1
- package/esm/components/ui/directionPad/Button.styled.js +2 -1
- package/esm/components/ui/directionPad/Button.styled.js.map +1 -1
- package/esm/components/ui/directionPad/Middle.d.ts.map +1 -1
- package/esm/components/ui/directionPad/Middle.js +7 -1
- package/esm/components/ui/directionPad/Middle.js.map +1 -1
- package/esm/components/ui/directionPad/Middle.styled.d.ts.map +1 -1
- package/esm/components/ui/directionPad/Middle.styled.js +2 -1
- package/esm/components/ui/directionPad/Middle.styled.js.map +1 -1
- package/esm/components/ui/modal/Modal.d.ts +1 -2
- package/esm/components/ui/modal/Modal.d.ts.map +1 -1
- package/esm/components/ui/modal/Modal.js +103 -43
- package/esm/components/ui/modal/Modal.js.map +1 -1
- package/esm/components/ui/modal/Modal.styled.d.ts +1 -1
- package/esm/components/ui/modal/Modal.styled.d.ts.map +1 -1
- package/esm/components/ui/modal/Modal.styled.js +40 -25
- package/esm/components/ui/modal/Modal.styled.js.map +1 -1
- package/esm/components/ui/modal/ModalButtons.d.ts +179 -1
- package/esm/components/ui/modal/ModalButtons.d.ts.map +1 -1
- package/esm/components/ui/modal/ModalButtons.js +19 -1
- package/esm/components/ui/modal/ModalButtons.js.map +1 -1
- package/esm/components/ui/modal/ModalButtons.styled.d.ts +90 -91
- package/esm/components/ui/modal/ModalButtons.styled.d.ts.map +1 -1
- package/esm/components/ui/modal/ModalButtons.styled.js +3 -6
- package/esm/components/ui/modal/ModalButtons.styled.js.map +1 -1
- package/esm/components/ui/pop/Pop.styled.d.ts.map +1 -1
- package/esm/components/ui/pop/Pop.styled.js +15 -17
- package/esm/components/ui/pop/Pop.styled.js.map +1 -1
- package/esm/components/ui/pop/PopOption.d.ts.map +1 -1
- package/esm/components/ui/pop/PopOption.js +7 -2
- package/esm/components/ui/pop/PopOption.js.map +1 -1
- package/esm/components/ui/toolButton/ToolButton.d.ts +94 -1
- package/esm/components/ui/toolButton/ToolButton.d.ts.map +1 -1
- package/esm/components/ui/toolButton/ToolButton.js +15 -1
- package/esm/components/ui/toolButton/ToolButton.js.map +1 -1
- package/esm/components/ui/toolButton/ToolButton.styled.d.ts +2 -2
- package/esm/components/ui/toolButton/ToolButton.styled.d.ts.map +1 -1
- package/esm/components/ui/toolButton/ToolButton.styled.js +19 -24
- package/esm/components/ui/toolButton/ToolButton.styled.js.map +1 -1
- package/esm/theme.css-global.d.ts.map +1 -1
- package/esm/theme.css-global.js +0 -1
- package/esm/theme.css-global.js.map +1 -1
- package/esm/utils/index.d.ts +1 -0
- package/esm/utils/index.d.ts.map +1 -1
- package/esm/utils/index.js +1 -0
- package/esm/utils/index.js.map +1 -1
- package/esm/utils/useNativeValidity.d.ts +11 -0
- package/esm/utils/useNativeValidity.d.ts.map +1 -0
- package/esm/utils/useNativeValidity.js +29 -0
- package/esm/utils/useNativeValidity.js.map +1 -0
- package/esm/utils/useRipple.d.ts +15 -0
- package/esm/utils/useRipple.d.ts.map +1 -0
- package/esm/utils/useRipple.js +84 -0
- package/esm/utils/useRipple.js.map +1 -0
- package/esm/utils/useRipple.styled.d.ts +28 -0
- package/esm/utils/useRipple.styled.d.ts.map +1 -0
- package/esm/utils/useRipple.styled.js +33 -0
- package/esm/utils/useRipple.styled.js.map +1 -0
- package/package.json +1 -1
- package/src/components/form/index.ts +1 -0
- package/src/components/form/input/Input.stories.tsx +47 -1
- package/src/components/form/input/Input.tsx +11 -5
- package/src/components/form/timepicker/TimePicker.css.ts +132 -0
- package/src/components/form/timepicker/TimePicker.stories.tsx +107 -0
- package/src/components/form/timepicker/TimePicker.styled.ts +52 -0
- package/src/components/form/timepicker/TimePicker.tsx +229 -0
- package/src/components/form/timepicker/TimePickerModal.tsx +131 -0
- package/src/components/form/timepicker/Wheel.tsx +201 -0
- package/src/components/form/timepicker/utils.ts +66 -0
- package/src/components/icons/Clock.tsx +38 -0
- package/src/components/icons/Icon.tsx +3 -0
- package/src/components/layout/header/HeaderIconAction.styled.ts +11 -18
- package/src/components/layout/header/HeaderIconAction.tsx +32 -5
- package/src/components/layout/list/Item.styled.ts +2 -1
- package/src/components/layout/list/Item.tsx +38 -5
- package/src/components/ui/button/Button.styled.ts +3 -2
- package/src/components/ui/button/Button.tsx +33 -1
- package/src/components/ui/directionPad/Button.styled.ts +2 -1
- package/src/components/ui/directionPad/Button.tsx +13 -1
- package/src/components/ui/directionPad/Middle.styled.ts +2 -1
- package/src/components/ui/directionPad/Middle.tsx +13 -1
- package/src/components/ui/modal/Modal.stories.tsx +43 -7
- package/src/components/ui/modal/Modal.styled.ts +46 -25
- package/src/components/ui/modal/Modal.tsx +135 -52
- package/src/components/ui/modal/ModalButtons.styled.ts +4 -7
- package/src/components/ui/modal/ModalButtons.tsx +38 -1
- package/src/components/ui/pop/Pop.styled.ts +15 -18
- package/src/components/ui/pop/PopOption.tsx +15 -1
- package/src/components/ui/toolButton/ToolButton.styled.ts +20 -26
- package/src/components/ui/toolButton/ToolButton.tsx +33 -0
- package/src/theme.css-global.ts +0 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/useNativeValidity.ts +57 -0
- package/src/utils/useRipple.styled.ts +56 -0
- package/src/utils/useRipple.tsx +139 -0
- package/src/components/ui/toolButton/ToolButton.ts +0 -1
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useState } from "react";
|
|
2
|
+
|
|
3
|
+
import { Modal } from "../../ui/modal/Modal";
|
|
4
|
+
import { ModalButtons } from "../../ui/modal/ModalButtons";
|
|
5
|
+
import {
|
|
6
|
+
StyledWheelHighlight,
|
|
7
|
+
StyledWheelsContainer,
|
|
8
|
+
StyledWheelSeparator,
|
|
9
|
+
} from "./TimePicker.styled";
|
|
10
|
+
import { padTwo, parseTimeText } from "./utils";
|
|
11
|
+
import { Wheel } from "./Wheel";
|
|
12
|
+
|
|
13
|
+
interface Props {
|
|
14
|
+
isOpen: boolean;
|
|
15
|
+
/** Current input value, parsed to seed the wheels when the modal opens. */
|
|
16
|
+
initialValue: string;
|
|
17
|
+
withSeconds: boolean;
|
|
18
|
+
minuteStep: number;
|
|
19
|
+
secondStep: number;
|
|
20
|
+
readOnly: boolean;
|
|
21
|
+
title?: React.ReactNode;
|
|
22
|
+
okLabel: React.ReactNode;
|
|
23
|
+
cancelLabel: React.ReactNode;
|
|
24
|
+
onClose: () => void;
|
|
25
|
+
onConfirm: (value: string) => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const snapToStep = (v: number, step: number, max: number): number => {
|
|
29
|
+
const snapped = Math.round(v / step) * step;
|
|
30
|
+
return Math.min(snapped, max - (max % step === 0 ? step : max % step));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const TimePickerModal = ({
|
|
34
|
+
isOpen,
|
|
35
|
+
initialValue,
|
|
36
|
+
withSeconds,
|
|
37
|
+
minuteStep,
|
|
38
|
+
secondStep,
|
|
39
|
+
readOnly,
|
|
40
|
+
title,
|
|
41
|
+
okLabel,
|
|
42
|
+
cancelLabel,
|
|
43
|
+
onClose,
|
|
44
|
+
onConfirm,
|
|
45
|
+
}: Props) => {
|
|
46
|
+
const [draftHours, setDraftHours] = useState(0);
|
|
47
|
+
const [draftMinutes, setDraftMinutes] = useState(0);
|
|
48
|
+
const [draftSeconds, setDraftSeconds] = useState(0);
|
|
49
|
+
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (!isOpen) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const digits = parseTimeText(initialValue, withSeconds);
|
|
55
|
+
const hh = digits.length >= 2 ? parseInt(digits.slice(0, 2), 10) : 0;
|
|
56
|
+
const mmRaw = digits.length >= 4 ? parseInt(digits.slice(2, 4), 10) : 0;
|
|
57
|
+
const ssRaw = digits.length >= 6 ? parseInt(digits.slice(4, 6), 10) : 0;
|
|
58
|
+
setDraftHours(hh);
|
|
59
|
+
setDraftMinutes(snapToStep(mmRaw, minuteStep, 60));
|
|
60
|
+
setDraftSeconds(snapToStep(ssRaw, secondStep, 60));
|
|
61
|
+
}, [isOpen, initialValue, withSeconds, minuteStep, secondStep]);
|
|
62
|
+
|
|
63
|
+
const handleConfirm = useCallback(() => {
|
|
64
|
+
const next = padTwo(draftHours) + ":" + padTwo(draftMinutes)
|
|
65
|
+
+ (withSeconds ? ":" + padTwo(draftSeconds) : "");
|
|
66
|
+
onConfirm(next);
|
|
67
|
+
}, [draftHours, draftMinutes, draftSeconds, withSeconds, onConfirm]);
|
|
68
|
+
|
|
69
|
+
const handleWheelsKeyDown = useCallback((e: React.KeyboardEvent<HTMLDivElement>) => {
|
|
70
|
+
if (e.key === "Enter" && !readOnly) {
|
|
71
|
+
e.preventDefault();
|
|
72
|
+
handleConfirm();
|
|
73
|
+
}
|
|
74
|
+
}, [readOnly, handleConfirm]);
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<Modal
|
|
78
|
+
isOpen={isOpen}
|
|
79
|
+
onClose={onClose}
|
|
80
|
+
title={title}
|
|
81
|
+
>
|
|
82
|
+
<StyledWheelsContainer onKeyDown={handleWheelsKeyDown}>
|
|
83
|
+
<Wheel
|
|
84
|
+
count={24}
|
|
85
|
+
step={1}
|
|
86
|
+
value={draftHours}
|
|
87
|
+
onChange={setDraftHours}
|
|
88
|
+
ariaLabel={"Hours"}
|
|
89
|
+
autoFocus={true}
|
|
90
|
+
/>
|
|
91
|
+
<StyledWheelSeparator>{":"}</StyledWheelSeparator>
|
|
92
|
+
<Wheel
|
|
93
|
+
count={60}
|
|
94
|
+
step={minuteStep}
|
|
95
|
+
value={draftMinutes}
|
|
96
|
+
onChange={setDraftMinutes}
|
|
97
|
+
ariaLabel={"Minutes"}
|
|
98
|
+
/>
|
|
99
|
+
{withSeconds
|
|
100
|
+
? (
|
|
101
|
+
<>
|
|
102
|
+
<StyledWheelSeparator>{":"}</StyledWheelSeparator>
|
|
103
|
+
<Wheel
|
|
104
|
+
count={60}
|
|
105
|
+
step={secondStep}
|
|
106
|
+
value={draftSeconds}
|
|
107
|
+
onChange={setDraftSeconds}
|
|
108
|
+
ariaLabel={"Seconds"}
|
|
109
|
+
/>
|
|
110
|
+
</>
|
|
111
|
+
)
|
|
112
|
+
: null}
|
|
113
|
+
<StyledWheelHighlight aria-hidden={true} />
|
|
114
|
+
</StyledWheelsContainer>
|
|
115
|
+
<ModalButtons>
|
|
116
|
+
<ModalButtons.Button onClick={onClose}>
|
|
117
|
+
{cancelLabel}
|
|
118
|
+
</ModalButtons.Button>
|
|
119
|
+
{readOnly
|
|
120
|
+
? null
|
|
121
|
+
: (
|
|
122
|
+
<ModalButtons.Button variant={"main"} onClick={handleConfirm}>
|
|
123
|
+
{okLabel}
|
|
124
|
+
</ModalButtons.Button>
|
|
125
|
+
)}
|
|
126
|
+
</ModalButtons>
|
|
127
|
+
</Modal>
|
|
128
|
+
);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export { TimePickerModal };
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useLayoutEffect, useRef } from "react";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
StyledWheelFocusRing,
|
|
5
|
+
StyledWheelItem,
|
|
6
|
+
StyledWheelPadder,
|
|
7
|
+
StyledWheelViewport,
|
|
8
|
+
StyledWheelWrapper,
|
|
9
|
+
} from "./TimePicker.styled";
|
|
10
|
+
import { padTwo } from "./utils";
|
|
11
|
+
|
|
12
|
+
interface Props {
|
|
13
|
+
count: number;
|
|
14
|
+
step: number;
|
|
15
|
+
value: number;
|
|
16
|
+
onChange: (v: number) => void;
|
|
17
|
+
ariaLabel: string;
|
|
18
|
+
autoFocus?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const PAGE_JUMP = 3;
|
|
22
|
+
|
|
23
|
+
const Wheel = ({ count, step, value, onChange, ariaLabel, autoFocus = false }: Props) => {
|
|
24
|
+
const viewportRef = useRef<HTMLDivElement>(null);
|
|
25
|
+
const itemRef = useRef<HTMLDivElement>(null);
|
|
26
|
+
const itemHeightRef = useRef<number>(0);
|
|
27
|
+
const scrollRafRef = useRef<number | null>(null);
|
|
28
|
+
const valueRef = useRef(value);
|
|
29
|
+
valueRef.current = value;
|
|
30
|
+
|
|
31
|
+
const items = Math.ceil(count / step);
|
|
32
|
+
const lastValue = (items - 1) * step;
|
|
33
|
+
|
|
34
|
+
const valueToIndex = useCallback((v: number) => {
|
|
35
|
+
const idx = Math.round(v / step);
|
|
36
|
+
if (idx < 0) {
|
|
37
|
+
return 0;
|
|
38
|
+
}
|
|
39
|
+
if (idx >= items) {
|
|
40
|
+
return items - 1;
|
|
41
|
+
}
|
|
42
|
+
return idx;
|
|
43
|
+
}, [items, step]);
|
|
44
|
+
|
|
45
|
+
const scrollToValue = useCallback((v: number, behavior: ScrollBehavior) => {
|
|
46
|
+
const vp = viewportRef.current;
|
|
47
|
+
const h = itemHeightRef.current;
|
|
48
|
+
if (!vp || h === 0) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const idx = valueToIndex(v);
|
|
52
|
+
vp.scrollTo({ top: idx * h, behavior });
|
|
53
|
+
}, [valueToIndex]);
|
|
54
|
+
|
|
55
|
+
useLayoutEffect(() => {
|
|
56
|
+
const item = itemRef.current;
|
|
57
|
+
if (!item) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
itemHeightRef.current = item.getBoundingClientRect().height;
|
|
61
|
+
scrollToValue(valueRef.current, "auto");
|
|
62
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
63
|
+
}, []);
|
|
64
|
+
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
const item = itemRef.current;
|
|
67
|
+
if (!item || typeof ResizeObserver === "undefined") {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const ro = new ResizeObserver((entries) => {
|
|
71
|
+
const entry = entries[0];
|
|
72
|
+
if (!entry) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const h = entry.contentRect.height;
|
|
76
|
+
if (h > 0 && h !== itemHeightRef.current) {
|
|
77
|
+
itemHeightRef.current = h;
|
|
78
|
+
scrollToValue(valueRef.current, "auto");
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
ro.observe(item);
|
|
82
|
+
return () => {
|
|
83
|
+
ro.disconnect();
|
|
84
|
+
};
|
|
85
|
+
}, [scrollToValue]);
|
|
86
|
+
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
const vp = viewportRef.current;
|
|
89
|
+
const h = itemHeightRef.current;
|
|
90
|
+
if (!vp || h === 0) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const currentIdx = Math.round(vp.scrollTop / h);
|
|
94
|
+
const desiredIdx = valueToIndex(value);
|
|
95
|
+
if (currentIdx !== desiredIdx) {
|
|
96
|
+
scrollToValue(value, "smooth");
|
|
97
|
+
}
|
|
98
|
+
}, [value, valueToIndex, scrollToValue]);
|
|
99
|
+
|
|
100
|
+
const handleScroll = useCallback(() => {
|
|
101
|
+
const vp = viewportRef.current;
|
|
102
|
+
if (!vp) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (scrollRafRef.current != null) {
|
|
106
|
+
cancelAnimationFrame(scrollRafRef.current);
|
|
107
|
+
}
|
|
108
|
+
scrollRafRef.current = requestAnimationFrame(() => {
|
|
109
|
+
scrollRafRef.current = null;
|
|
110
|
+
const vpInner = viewportRef.current;
|
|
111
|
+
const h = itemHeightRef.current;
|
|
112
|
+
if (!vpInner || h === 0) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const rawIdx = Math.round(vpInner.scrollTop / h);
|
|
116
|
+
const clamped = Math.max(0, Math.min(items - 1, rawIdx));
|
|
117
|
+
const newValue = clamped * step;
|
|
118
|
+
if (newValue !== valueRef.current) {
|
|
119
|
+
onChange(newValue);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}, [items, step, onChange]);
|
|
123
|
+
|
|
124
|
+
const handleKeyDown = useCallback((e: React.KeyboardEvent<HTMLDivElement>) => {
|
|
125
|
+
let next: number;
|
|
126
|
+
switch (e.key) {
|
|
127
|
+
case "ArrowDown":
|
|
128
|
+
next = valueRef.current + step;
|
|
129
|
+
break;
|
|
130
|
+
case "ArrowUp":
|
|
131
|
+
next = valueRef.current - step;
|
|
132
|
+
break;
|
|
133
|
+
case "PageDown":
|
|
134
|
+
next = valueRef.current + (step * PAGE_JUMP);
|
|
135
|
+
break;
|
|
136
|
+
case "PageUp":
|
|
137
|
+
next = valueRef.current - (step * PAGE_JUMP);
|
|
138
|
+
break;
|
|
139
|
+
case "Home":
|
|
140
|
+
next = 0;
|
|
141
|
+
break;
|
|
142
|
+
case "End":
|
|
143
|
+
next = lastValue;
|
|
144
|
+
break;
|
|
145
|
+
default:
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
e.preventDefault();
|
|
149
|
+
const clamped = Math.max(0, Math.min(lastValue, next));
|
|
150
|
+
if (clamped !== valueRef.current) {
|
|
151
|
+
onChange(clamped);
|
|
152
|
+
}
|
|
153
|
+
}, [step, lastValue, onChange]);
|
|
154
|
+
|
|
155
|
+
useEffect(() => () => {
|
|
156
|
+
if (scrollRafRef.current != null) {
|
|
157
|
+
cancelAnimationFrame(scrollRafRef.current);
|
|
158
|
+
}
|
|
159
|
+
}, []);
|
|
160
|
+
|
|
161
|
+
useEffect(() => {
|
|
162
|
+
if (autoFocus) {
|
|
163
|
+
viewportRef.current?.focus({ preventScroll: true });
|
|
164
|
+
}
|
|
165
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
166
|
+
}, []);
|
|
167
|
+
|
|
168
|
+
const itemElems: React.ReactElement[] = [];
|
|
169
|
+
for (let i = 0; i < items; i++) {
|
|
170
|
+
const v = i * step;
|
|
171
|
+
itemElems.push(
|
|
172
|
+
<StyledWheelItem key={i} ref={i === 0 ? itemRef : undefined}>
|
|
173
|
+
{padTwo(v)}
|
|
174
|
+
</StyledWheelItem>,
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return (
|
|
179
|
+
<StyledWheelWrapper>
|
|
180
|
+
<StyledWheelViewport
|
|
181
|
+
ref={viewportRef}
|
|
182
|
+
onScroll={handleScroll}
|
|
183
|
+
onKeyDown={handleKeyDown}
|
|
184
|
+
role={"spinbutton"}
|
|
185
|
+
aria-label={ariaLabel}
|
|
186
|
+
aria-valuemin={0}
|
|
187
|
+
aria-valuemax={lastValue}
|
|
188
|
+
aria-valuenow={value}
|
|
189
|
+
aria-valuetext={padTwo(value)}
|
|
190
|
+
tabIndex={0}
|
|
191
|
+
>
|
|
192
|
+
<StyledWheelPadder />
|
|
193
|
+
{itemElems}
|
|
194
|
+
<StyledWheelPadder />
|
|
195
|
+
</StyledWheelViewport>
|
|
196
|
+
<StyledWheelFocusRing aria-hidden={true} />
|
|
197
|
+
</StyledWheelWrapper>
|
|
198
|
+
);
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
export { Wheel };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/** Pads a number to a 2-digit string with a leading zero (e.g. `7` → `"07"`). */
|
|
2
|
+
const padTwo = (n: number): string => n.toString().padStart(2, "0");
|
|
3
|
+
|
|
4
|
+
/** Clamps each completed pair in the digit buffer to a valid range: HH≤23, MM≤59, SS≤59. */
|
|
5
|
+
const clampDigits = (digits: string, withSeconds: boolean): string => {
|
|
6
|
+
if (digits.length < 2) {
|
|
7
|
+
return digits;
|
|
8
|
+
}
|
|
9
|
+
let hh = parseInt(digits.slice(0, 2), 10);
|
|
10
|
+
if (hh > 23) {
|
|
11
|
+
hh = 23;
|
|
12
|
+
}
|
|
13
|
+
let out = padTwo(hh);
|
|
14
|
+
if (digits.length < 4) {
|
|
15
|
+
return out + digits.slice(2);
|
|
16
|
+
}
|
|
17
|
+
let mm = parseInt(digits.slice(2, 4), 10);
|
|
18
|
+
if (mm > 59) {
|
|
19
|
+
mm = 59;
|
|
20
|
+
}
|
|
21
|
+
out += padTwo(mm);
|
|
22
|
+
if (!withSeconds || digits.length < 6) {
|
|
23
|
+
return out + digits.slice(4);
|
|
24
|
+
}
|
|
25
|
+
let ss = parseInt(digits.slice(4, 6), 10);
|
|
26
|
+
if (ss > 59) {
|
|
27
|
+
ss = 59;
|
|
28
|
+
}
|
|
29
|
+
out += padTwo(ss);
|
|
30
|
+
return out;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Parses a free-form time string into a clamped 2/4/6-digit buffer.
|
|
35
|
+
* Colon-aware: each colon-separated segment is padded to 2 digits, so `"3:40"` → `"0340"`.
|
|
36
|
+
* Used by the modal to extract HH/MM/SS from whatever the user typed.
|
|
37
|
+
*/
|
|
38
|
+
const parseTimeText = (text: string, withSeconds: boolean): string => {
|
|
39
|
+
if (!text) {
|
|
40
|
+
return "";
|
|
41
|
+
}
|
|
42
|
+
const max = withSeconds ? 6 : 4;
|
|
43
|
+
const segments = text.split(":");
|
|
44
|
+
let raw: string;
|
|
45
|
+
if (segments.length === 1) {
|
|
46
|
+
raw = (segments[0] ?? "").replace(/\D/gu, "");
|
|
47
|
+
if (raw.length === 1) {
|
|
48
|
+
raw = "0" + raw;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
raw = segments.map((s) => {
|
|
53
|
+
const d = s.replace(/\D/gu, "");
|
|
54
|
+
if (d.length === 0) {
|
|
55
|
+
return "";
|
|
56
|
+
}
|
|
57
|
+
if (d.length === 1) {
|
|
58
|
+
return "0" + d;
|
|
59
|
+
}
|
|
60
|
+
return d.slice(0, 2);
|
|
61
|
+
}).join("");
|
|
62
|
+
}
|
|
63
|
+
return clampDigits(raw.slice(0, max), withSeconds);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export { padTwo, parseTimeText };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
|
|
3
|
+
interface Props {
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const Clock = forwardRef<SVGSVGElement, Props>((props, ref) => {
|
|
8
|
+
return (
|
|
9
|
+
<svg
|
|
10
|
+
ref={ref}
|
|
11
|
+
width={"16"}
|
|
12
|
+
height={"16"}
|
|
13
|
+
viewBox={"0 0 16 16"}
|
|
14
|
+
xmlns={"http://www.w3.org/2000/svg"}
|
|
15
|
+
className={props.className}
|
|
16
|
+
>
|
|
17
|
+
<circle
|
|
18
|
+
cx={"8"}
|
|
19
|
+
cy={"8"}
|
|
20
|
+
r={"6.5"}
|
|
21
|
+
fill={"none"}
|
|
22
|
+
stroke={"currentColor"}
|
|
23
|
+
strokeWidth={"1.5"}
|
|
24
|
+
/>
|
|
25
|
+
<path
|
|
26
|
+
fill={"none"}
|
|
27
|
+
stroke={"currentColor"}
|
|
28
|
+
strokeWidth={"1.5"}
|
|
29
|
+
strokeLinecap={"round"}
|
|
30
|
+
d={"M8 4.5V8l2.5 1.75"}
|
|
31
|
+
/>
|
|
32
|
+
</svg>
|
|
33
|
+
);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
Clock.displayName = "Clock";
|
|
37
|
+
|
|
38
|
+
export { Clock };
|
|
@@ -3,6 +3,7 @@ import React, { forwardRef } from "react";
|
|
|
3
3
|
import { Back } from "./Back";
|
|
4
4
|
import { Battery } from "./Battery";
|
|
5
5
|
import { Checkmark } from "./Checkmark";
|
|
6
|
+
import { Clock } from "./Clock";
|
|
6
7
|
import { Config } from "./Config";
|
|
7
8
|
import { Dots } from "./Dots";
|
|
8
9
|
import { Forward } from "./Forward";
|
|
@@ -20,6 +21,7 @@ enum ICON {
|
|
|
20
21
|
trash = "trash",
|
|
21
22
|
config = "config",
|
|
22
23
|
dots = "dots",
|
|
24
|
+
clock = "clock",
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
interface Props {
|
|
@@ -39,6 +41,7 @@ const iconsMap = new Map<ICON, IconComponent>([
|
|
|
39
41
|
[ICON.trash, Trash],
|
|
40
42
|
[ICON.config, Config],
|
|
41
43
|
[ICON.dots, Dots],
|
|
44
|
+
[ICON.clock, Clock],
|
|
42
45
|
]);
|
|
43
46
|
|
|
44
47
|
const Icon = forwardRef<SVGSVGElement, Props>(({ name: iconName, ...props }, ref) => {
|
|
@@ -1,24 +1,17 @@
|
|
|
1
1
|
import { borderPxToRem, css, pxToRem, styled } from "../../../theme";
|
|
2
|
+
import { rippleHostStyles } from "../../../utils/useRipple.styled";
|
|
2
3
|
import { Icon } from "../../icons/Icon";
|
|
3
4
|
|
|
4
|
-
const sharedStyles = css({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"&:hover": {
|
|
16
|
-
background: "#00000022",
|
|
17
|
-
},
|
|
18
|
-
"&:active": {
|
|
19
|
-
background: "#00000011",
|
|
20
|
-
color: "currentColor",
|
|
21
|
-
},
|
|
5
|
+
const sharedStyles = css(rippleHostStyles, {
|
|
6
|
+
width: pxToRem(30),
|
|
7
|
+
height: pxToRem(30),
|
|
8
|
+
background: "none",
|
|
9
|
+
borderRadius: "666px",
|
|
10
|
+
display: "inline-flex",
|
|
11
|
+
alignItems: "center",
|
|
12
|
+
justifyContent: "center",
|
|
13
|
+
border: borderPxToRem(2),
|
|
14
|
+
color: "currentColor",
|
|
22
15
|
});
|
|
23
16
|
|
|
24
17
|
const Btn = styled("button", sharedStyles);
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
|
|
3
|
+
import { useForwardedRef } from "@bedrock-layout/use-forwarded-ref";
|
|
4
|
+
|
|
3
5
|
import type { ReactNode } from "react";
|
|
4
6
|
import type { ICON } from "../../icons/Icon";
|
|
5
7
|
|
|
8
|
+
import { useRipple } from "../../../utils/useRipple";
|
|
6
9
|
import { A, Btn, sharedStyles, StyledIcon } from "./HeaderIconAction.styled";
|
|
7
10
|
|
|
8
11
|
interface LinkProps { // @TODO extract? - same on list item
|
|
@@ -41,8 +44,10 @@ interface Props {
|
|
|
41
44
|
* Use this component if you need a clickable icon that stylistically fits the header.
|
|
42
45
|
* It can be a simple link, a button or a custom link component.
|
|
43
46
|
*/
|
|
44
|
-
const HeaderIconAction = forwardRef<HTMLAnchorElement | HTMLButtonElement, Props>((props, ref) => {
|
|
47
|
+
const HeaderIconAction = forwardRef<HTMLAnchorElement | HTMLButtonElement, Props>((props, ref) => { // eslint-disable-line max-lines-per-function
|
|
45
48
|
const { icon, href, to, Link, className, ...restProps } = props;
|
|
49
|
+
const innerRef = useForwardedRef<HTMLAnchorElement | HTMLButtonElement | null>(ref);
|
|
50
|
+
const ripple = useRipple({ ref: innerRef });
|
|
46
51
|
|
|
47
52
|
let content: ReactNode = icon;
|
|
48
53
|
if (typeof icon === "string") {
|
|
@@ -56,23 +61,45 @@ const HeaderIconAction = forwardRef<HTMLAnchorElement | HTMLButtonElement, Props
|
|
|
56
61
|
|
|
57
62
|
return (
|
|
58
63
|
<Link href={to} {...restProps}>
|
|
59
|
-
<A
|
|
64
|
+
<A
|
|
65
|
+
ref={innerRef as React.Ref<HTMLAnchorElement>}
|
|
66
|
+
className={props.className}
|
|
67
|
+
onPointerDown={ripple.onPointerDown}
|
|
68
|
+
onKeyDown={ripple.onKeyDown}
|
|
69
|
+
>
|
|
70
|
+
{content}
|
|
71
|
+
{ripple.ripples}
|
|
72
|
+
</A>
|
|
60
73
|
</Link>
|
|
61
74
|
);
|
|
62
75
|
}
|
|
63
76
|
|
|
64
77
|
if (href) {
|
|
65
78
|
return (
|
|
66
|
-
<A
|
|
79
|
+
<A
|
|
80
|
+
ref={innerRef as React.Ref<HTMLAnchorElement>}
|
|
81
|
+
href={href}
|
|
82
|
+
className={props.className}
|
|
83
|
+
onPointerDown={ripple.onPointerDown}
|
|
84
|
+
onKeyDown={ripple.onKeyDown}
|
|
85
|
+
{...restProps}
|
|
86
|
+
>
|
|
67
87
|
{content}
|
|
88
|
+
{ripple.ripples}
|
|
68
89
|
</A>
|
|
69
90
|
);
|
|
70
91
|
}
|
|
71
92
|
|
|
72
93
|
return (
|
|
73
|
-
|
|
74
|
-
|
|
94
|
+
<Btn
|
|
95
|
+
ref={innerRef as React.Ref<HTMLButtonElement>}
|
|
96
|
+
className={props.className}
|
|
97
|
+
onClick={props.onClick}
|
|
98
|
+
onPointerDown={ripple.onPointerDown}
|
|
99
|
+
onKeyDown={ripple.onKeyDown}
|
|
100
|
+
>
|
|
75
101
|
{content}
|
|
102
|
+
{ripple.ripples}
|
|
76
103
|
</Btn>
|
|
77
104
|
);
|
|
78
105
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { css, dimensionsPxToRem, fontPxToRem, pxToRem, styled } from "../../../theme";
|
|
2
|
+
import { rippleHostStyles } from "../../../utils/useRipple.styled";
|
|
2
3
|
import { Icon } from "../../icons/Icon";
|
|
3
4
|
|
|
4
|
-
const StyledInnerContainer = styled("div", {
|
|
5
|
+
const StyledInnerContainer = styled("div", rippleHostStyles, {
|
|
5
6
|
display: "flex",
|
|
6
7
|
minHeight: dimensionsPxToRem(174),
|
|
7
8
|
alignItems: "center",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import React, { forwardRef } from "react";
|
|
1
|
+
import React, { forwardRef, useRef } from "react";
|
|
2
2
|
|
|
3
3
|
import { fnWithProps } from "../../../types/fnWithProps";
|
|
4
|
+
import { useRipple } from "../../../utils/useRipple";
|
|
4
5
|
import { ICON } from "../../icons/Icon";
|
|
5
6
|
import { StyledIcon, StyledInnerContainer, StyledItem, StyledNoIcon } from "./Item.styled";
|
|
6
7
|
import { Label } from "./Label";
|
|
@@ -68,7 +69,10 @@ type StyledItemProps = React.ComponentProps<typeof StyledItem>;
|
|
|
68
69
|
*/
|
|
69
70
|
const ItemBase = forwardRef<
|
|
70
71
|
HTMLLIElement, StyledItemProps & Props
|
|
71
|
-
>(({ href, to, onClick, Link, ratio, ...props }, ref) => {
|
|
72
|
+
>(({ href, to, onClick, Link, ratio, ...props }, ref) => { // eslint-disable-line max-lines-per-function
|
|
73
|
+
const innerRef = useRef<HTMLElement | null>(null);
|
|
74
|
+
const ripple = useRipple({ ref: innerRef });
|
|
75
|
+
|
|
72
76
|
const r = ratio ? ratio.split("/") : [];
|
|
73
77
|
|
|
74
78
|
const pre = typeof props.selected === "boolean"
|
|
@@ -92,6 +96,11 @@ const ItemBase = forwardRef<
|
|
|
92
96
|
});
|
|
93
97
|
}) ?? [];
|
|
94
98
|
|
|
99
|
+
const interactive = Boolean(onClick ?? href ?? to);
|
|
100
|
+
const rippleProps = interactive
|
|
101
|
+
? { onPointerDown: ripple.onPointerDown, onKeyDown: ripple.onKeyDown }
|
|
102
|
+
: {};
|
|
103
|
+
|
|
95
104
|
if (to) {
|
|
96
105
|
if (!Link) {
|
|
97
106
|
throw new TypeError("`to` prop given without `Link` component");
|
|
@@ -99,7 +108,16 @@ const ItemBase = forwardRef<
|
|
|
99
108
|
|
|
100
109
|
return (
|
|
101
110
|
<StyledItem {...props} ref={ref}>
|
|
102
|
-
<Link href={to}
|
|
111
|
+
<Link href={to}>
|
|
112
|
+
<StyledInnerContainer
|
|
113
|
+
as={"a"}
|
|
114
|
+
href={to}
|
|
115
|
+
ref={innerRef as React.Ref<HTMLAnchorElement>}
|
|
116
|
+
{...rippleProps}
|
|
117
|
+
>
|
|
118
|
+
{pre}{ren}{ripple.ripples}
|
|
119
|
+
</StyledInnerContainer>
|
|
120
|
+
</Link>
|
|
103
121
|
</StyledItem>
|
|
104
122
|
);
|
|
105
123
|
}
|
|
@@ -107,7 +125,15 @@ const ItemBase = forwardRef<
|
|
|
107
125
|
if (href) {
|
|
108
126
|
return (
|
|
109
127
|
<StyledItem {...props} ref={ref}>
|
|
110
|
-
<StyledInnerContainer
|
|
128
|
+
<StyledInnerContainer
|
|
129
|
+
as={"a"}
|
|
130
|
+
href={href}
|
|
131
|
+
onClick={onClick}
|
|
132
|
+
ref={innerRef as React.Ref<HTMLAnchorElement>}
|
|
133
|
+
{...rippleProps}
|
|
134
|
+
>
|
|
135
|
+
{pre}{ren}{ripple.ripples}
|
|
136
|
+
</StyledInnerContainer>
|
|
111
137
|
</StyledItem>
|
|
112
138
|
);
|
|
113
139
|
}
|
|
@@ -115,7 +141,14 @@ const ItemBase = forwardRef<
|
|
|
115
141
|
if (onClick) {
|
|
116
142
|
return (
|
|
117
143
|
<StyledItem {...props} ref={ref}>
|
|
118
|
-
<StyledInnerContainer
|
|
144
|
+
<StyledInnerContainer
|
|
145
|
+
as={"button"}
|
|
146
|
+
onClick={onClick}
|
|
147
|
+
ref={innerRef as React.Ref<HTMLButtonElement>}
|
|
148
|
+
{...rippleProps}
|
|
149
|
+
>
|
|
150
|
+
{pre}{ren}{ripple.ripples}
|
|
151
|
+
</StyledInnerContainer>
|
|
119
152
|
</StyledItem>
|
|
120
153
|
);
|
|
121
154
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { borderPxToRem, dimensionsPxToRem, fontPxToRem, pxToRem, styled } from "../../../theme";
|
|
2
|
+
import { rippleHostStyles } from "../../../utils/useRipple.styled";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Call-to-action button.
|
|
5
6
|
*/
|
|
6
|
-
const
|
|
7
|
+
const StyledButton = styled("button", rippleHostStyles, {
|
|
7
8
|
"height": dimensionsPxToRem(118),
|
|
8
9
|
"background": "$green1",
|
|
9
10
|
"border": `${borderPxToRem(1)} solid $green1Darker`,
|
|
@@ -39,5 +40,5 @@ const Button = styled("button", {
|
|
|
39
40
|
});
|
|
40
41
|
|
|
41
42
|
export {
|
|
42
|
-
|
|
43
|
+
StyledButton,
|
|
43
44
|
};
|