@yamatozhen/design_system 1.3.1 → 1.3.5
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 +31 -95
- package/dist/components/(buttons)/button/Button.js +1 -0
- package/dist/components/(buttons)/button/Button.styles.css +1 -0
- package/dist/components/(buttons)/button/Button.styles.js +2 -0
- package/dist/components/(buttons)/button/index.js +1 -0
- package/dist/components/(buttons)/buttonGroup/ButtonGroup.js +1 -0
- package/dist/components/(buttons)/buttonGroup/ButtonGroup.styles.css +1 -0
- package/dist/components/(buttons)/buttonGroup/ButtonGroup.styles.js +2 -0
- package/dist/components/(buttons)/buttonGroup/index.js +1 -0
- package/dist/components/(buttons)/buttonSplit/ButtonSplit.js +1 -0
- package/dist/components/(buttons)/buttonSplit/ButtonSplit.styles.css +1 -0
- package/dist/components/(buttons)/buttonSplit/ButtonSplit.styles.js +2 -0
- package/dist/components/(buttons)/buttonSplit/index.js +1 -0
- package/dist/components/(buttons)/fab/Fab.js +1 -0
- package/dist/components/(buttons)/fab/Fab.styles.css +1 -0
- package/dist/components/(buttons)/fab/Fab.styles.js +2 -0
- package/dist/components/(buttons)/fab/index.js +1 -0
- package/dist/components/(buttons)/shared/warnOnce.js +1 -0
- package/dist/components/(buttons)/toggleButton/ButtonToggle.js +1 -0
- package/dist/components/(buttons)/toggleButton/ButtonToggle.styles.css +1 -0
- package/dist/components/(buttons)/toggleButton/ButtonToggle.styles.js +2 -0
- package/dist/components/(buttons)/toggleButton/index.js +1 -0
- package/dist/components/(color)/colorArea/ColorArea.js +1 -0
- package/dist/components/(color)/colorArea/ColorArea.styles.css +1 -0
- package/dist/components/(color)/colorArea/ColorArea.styles.js +2 -0
- package/dist/components/(color)/colorArea/index.js +1 -0
- package/dist/components/(color)/colorField/ColorField.js +1 -0
- package/dist/components/(color)/colorField/ColorField.styles.css +1 -0
- package/dist/components/(color)/colorField/ColorField.styles.js +2 -0
- package/dist/components/(color)/colorField/index.js +1 -0
- package/dist/components/(color)/colorPicker/ColorPicker.js +1 -0
- package/dist/components/(color)/colorPicker/ColorPicker.styles.css +1 -0
- package/dist/components/(color)/colorPicker/ColorPicker.styles.js +2 -0
- package/dist/components/(color)/colorPicker/index.js +1 -0
- package/dist/components/(color)/colorSlider/ColorSlider.js +1 -0
- package/dist/components/(color)/colorSlider/ColorSlider.styles.css +1 -0
- package/dist/components/(color)/colorSlider/ColorSlider.styles.js +2 -0
- package/dist/components/(color)/colorSlider/index.js +1 -0
- package/dist/components/(color)/colorSwatch/ColorSwatch.js +1 -0
- package/dist/components/(color)/colorSwatch/ColorSwatch.styles.css +1 -0
- package/dist/components/(color)/colorSwatch/ColorSwatch.styles.js +2 -0
- package/dist/components/(color)/colorSwatch/index.js +1 -0
- package/dist/components/(color)/colorSwatchPicker/ColorSwatchPicker.js +1 -0
- package/dist/components/(color)/colorSwatchPicker/ColorSwatchPicker.styles.css +1 -0
- package/dist/components/(color)/colorSwatchPicker/ColorSwatchPicker.styles.js +2 -0
- package/dist/components/(color)/colorSwatchPicker/index.js +1 -0
- package/dist/components/(color)/shared/colorUtils.js +1 -0
- package/dist/components/(color)/shared/thumb.styles.css +1 -0
- package/dist/components/(color)/shared/thumb.styles.js +2 -0
- package/dist/components/(color)/shared/useColor.js +1 -0
- package/dist/components/(color)/shared/useDrag2D.js +1 -0
- package/dist/components/(datetime)/calendar/Calendar.js +1 -0
- package/dist/components/(datetime)/calendar/Calendar.styles.css +1 -0
- package/dist/components/(datetime)/calendar/Calendar.styles.js +2 -0
- package/dist/components/(datetime)/dateField/DateField.js +1 -0
- package/dist/components/(datetime)/dateField/DateField.styles.css +1 -0
- package/dist/components/(datetime)/dateField/DateField.styles.js +2 -0
- package/dist/components/(datetime)/datePicker/DatePicker.js +1 -0
- package/dist/components/(datetime)/dateRangePicker/DateRangePicker.js +1 -0
- package/dist/components/(datetime)/rangeCalendar/RangeCalendar.js +1 -0
- package/dist/components/(datetime)/rangeCalendar/RangeCalendar.styles.css +1 -0
- package/dist/components/(datetime)/rangeCalendar/RangeCalendar.styles.js +2 -0
- package/dist/components/(datetime)/shared/CalendarFrame.js +1 -0
- package/dist/components/(datetime)/shared/PickerShell.js +1 -0
- package/dist/components/(datetime)/shared/PickerShell.styles.css +1 -0
- package/dist/components/(datetime)/shared/PickerShell.styles.js +2 -0
- package/dist/components/(datetime)/shared/dateUtils.js +1 -0
- package/dist/components/(datetime)/shared/useCalendarGrid.js +1 -0
- package/dist/components/(datetime)/timeField/TimeField.js +1 -0
- package/dist/components/(datetime)/timeField/TimeField.styles.css +1 -0
- package/dist/components/(datetime)/timeField/TimeField.styles.js +2 -0
- package/dist/components/(effects)/customScrollbar/CustomScrollbar.js +1 -0
- package/dist/components/(effects)/progressiveBlur/ProgressiveBlur.js +5 -0
- package/dist/components/(effects)/ripple/Ripple.js +1 -0
- package/dist/components/(effects)/ripple/Ripple.styles.css +1 -0
- package/dist/components/(effects)/ripple/Ripple.styles.js +2 -0
- package/dist/components/(effects)/scrollShadow/ScrollShadow.js +1 -0
- package/dist/components/(effects)/scrollShadow/ScrollShadow.styles.css +1 -0
- package/dist/components/(effects)/scrollShadow/ScrollShadow.styles.js +2 -0
- package/dist/components/(effects)/scrollShadow/useScrollShadow.js +1 -0
- package/dist/components/(effects)/shape/Shape.js +1 -0
- package/dist/components/(effects)/shape/Shape.styles.css +1 -0
- package/dist/components/(effects)/shape/Shape.styles.js +2 -0
- package/dist/components/(effects)/shape/ShapePaths.js +1 -0
- package/dist/components/(effects)/shape/shapeGeometry.js +1 -0
- package/dist/components/(effects)/shape/shapeTicker.js +1 -0
- package/dist/components/(effects)/shape/springCurves.js +1 -0
- package/dist/components/(effects)/sinewave/Sinewave.js +1 -0
- package/dist/components/(feedback)/circularProgress/CircularProgress.js +1 -0
- package/dist/components/(feedback)/linearProgress/LinearProgress.js +1 -0
- package/dist/components/(feedback)/meter/Meter.js +1 -0
- package/dist/components/(feedback)/shared/progress.js +1 -0
- package/dist/components/(feedback)/sinewaveProgress/SinewaveProgress.js +1 -0
- package/dist/components/(feedback)/skeleton/Skeleton.js +1 -0
- package/dist/components/(feedback)/skeleton/Skeleton.styles.css +1 -0
- package/dist/components/(feedback)/skeleton/Skeleton.styles.js +2 -0
- package/dist/components/(feedback)/skeleton/index.js +1 -0
- package/dist/components/(feedback)/spinner/Spinner.js +1 -0
- package/dist/components/(feedback)/spinner/Spinner.styles.css +1 -0
- package/dist/components/(feedback)/spinner/Spinner.styles.js +2 -0
- package/dist/components/(forms)/checkbox/Checkbox.js +1 -0
- package/dist/components/(forms)/checkbox/Checkbox.styles.css +1 -0
- package/dist/components/(forms)/checkbox/Checkbox.styles.js +2 -0
- package/dist/components/(forms)/checkboxGroup/CheckboxGroup.js +1 -0
- package/dist/components/(forms)/checkboxGroup/CheckboxGroup.styles.css +1 -0
- package/dist/components/(forms)/checkboxGroup/CheckboxGroup.styles.js +2 -0
- package/dist/components/(forms)/fieldset/Fieldset.js +1 -0
- package/dist/components/(forms)/fieldset/Fieldset.styles.css +1 -0
- package/dist/components/(forms)/fieldset/Fieldset.styles.js +2 -0
- package/dist/components/(forms)/fieldset/index.js +1 -0
- package/dist/components/(forms)/fileUpload/FileUpload.js +1 -0
- package/dist/components/(forms)/fileUpload/FileUpload.styles.css +1 -0
- package/dist/components/(forms)/fileUpload/FileUpload.styles.js +2 -0
- package/dist/components/(forms)/fileUpload/index.js +1 -0
- package/dist/components/(forms)/fileUpload/validate.js +1 -0
- package/dist/components/(forms)/form/Form.js +1 -0
- package/dist/components/(forms)/form/Form.styles.css +1 -0
- package/dist/components/(forms)/form/Form.styles.js +2 -0
- package/dist/components/(forms)/form/index.js +1 -0
- package/dist/components/(forms)/input/Input.js +1 -0
- package/dist/components/(forms)/input/Input.styles.css +1 -0
- package/dist/components/(forms)/input/Input.styles.js +2 -0
- package/dist/components/(forms)/inputOtp/InputOtp.js +1 -0
- package/dist/components/(forms)/inputOtp/InputOtp.styles.css +1 -0
- package/dist/components/(forms)/inputOtp/InputOtp.styles.js +2 -0
- package/dist/components/(forms)/numberField/NumberField.js +1 -0
- package/dist/components/(forms)/numberField/NumberField.styles.css +1 -0
- package/dist/components/(forms)/numberField/NumberField.styles.js +2 -0
- package/dist/components/(forms)/numberField/index.js +1 -0
- package/dist/components/(forms)/radio/Radio.js +1 -0
- package/dist/components/(forms)/radio/Radio.styles.css +1 -0
- package/dist/components/(forms)/radio/Radio.styles.js +2 -0
- package/dist/components/(forms)/radioGroup/RadioGroup.js +1 -0
- package/dist/components/(forms)/radioGroup/RadioGroup.styles.css +1 -0
- package/dist/components/(forms)/radioGroup/RadioGroup.styles.js +2 -0
- package/dist/components/(forms)/search/Search.js +1 -0
- package/dist/components/(forms)/search/Search.styles.css +1 -0
- package/dist/components/(forms)/search/Search.styles.js +2 -0
- package/dist/components/(forms)/search/index.js +1 -0
- package/dist/components/(forms)/shared/FieldAdornment.js +1 -0
- package/dist/components/(forms)/shared/FieldAdornment.styles.css +1 -0
- package/dist/components/(forms)/shared/FieldAdornment.styles.js +2 -0
- package/dist/components/(forms)/shared/FieldShell.js +1 -0
- package/dist/components/(forms)/shared/FieldShell.styles.css +1 -0
- package/dist/components/(forms)/shared/FieldShell.styles.js +2 -0
- package/dist/components/(forms)/shared/field.styles.css +1 -0
- package/dist/components/(forms)/shared/field.styles.js +2 -0
- package/dist/components/(forms)/shared/fieldContext.js +1 -0
- package/dist/components/(forms)/shared/icons.js +1 -0
- package/dist/components/(forms)/slider/Slider.js +1 -0
- package/dist/components/(forms)/slider/Slider.styles.css +1 -0
- package/dist/components/(forms)/slider/Slider.styles.js +2 -0
- package/dist/components/(forms)/switch/Switch.js +1 -0
- package/dist/components/(forms)/switch/Switch.styles.css +1 -0
- package/dist/components/(forms)/switch/Switch.styles.js +2 -0
- package/dist/components/(forms)/textArea/TextArea.js +1 -0
- package/dist/components/(layout)/accordion/Accordion.js +1 -0
- package/dist/components/(layout)/accordion/Accordion.styles.css +1 -0
- package/dist/components/(layout)/accordion/Accordion.styles.js +2 -0
- package/dist/components/(layout)/card/Card.js +1 -0
- package/dist/components/(layout)/card/Card.styles.css +1 -0
- package/dist/components/(layout)/card/Card.styles.js +2 -0
- package/dist/components/(layout)/codeSnippet/CodeSnippet.js +2 -0
- package/dist/components/(layout)/codeSnippet/CodeSnippet.styles.css +1 -0
- package/dist/components/(layout)/codeSnippet/CodeSnippet.styles.js +2 -0
- package/dist/components/(layout)/codeSnippet/CodeTheme.styles.css +1 -0
- package/dist/components/(layout)/codeSnippet/CodeTheme.styles.js +2 -0
- package/dist/components/(layout)/codeSnippet/index.js +1 -0
- package/dist/components/(layout)/grid/Grid.js +1 -0
- package/dist/components/(layout)/grid/Grid.styles.css +1 -0
- package/dist/components/(layout)/grid/Grid.styles.js +2 -0
- package/dist/components/(layout)/grid/index.js +1 -0
- package/dist/components/(layout)/list/List.js +1 -0
- package/dist/components/(layout)/list/List.styles.css +1 -0
- package/dist/components/(layout)/list/List.styles.js +2 -0
- package/dist/components/(layout)/list/index.js +1 -0
- package/dist/components/(layout)/section/Section.js +1 -0
- package/dist/components/(layout)/section/Section.styles.css +1 -0
- package/dist/components/(layout)/section/Section.styles.js +2 -0
- package/dist/components/(layout)/section/index.js +1 -0
- package/dist/components/(layout)/table/Table.js +1 -0
- package/dist/components/(layout)/table/Table.styles.css +1 -0
- package/dist/components/(layout)/table/Table.styles.js +2 -0
- package/dist/components/(layout)/table/index.js +1 -0
- package/dist/components/(navigation)/breadcrumbs/Breadcrumbs.js +1 -0
- package/dist/components/(navigation)/breadcrumbs/Breadcrumbs.styles.css +1 -0
- package/dist/components/(navigation)/breadcrumbs/Breadcrumbs.styles.js +2 -0
- package/dist/components/(navigation)/breadcrumbs/index.js +1 -0
- package/dist/components/(navigation)/nav/Nav.js +1 -0
- package/dist/components/(navigation)/nav/Nav.styles.css +1 -0
- package/dist/components/(navigation)/nav/Nav.styles.js +2 -0
- package/dist/components/(navigation)/nav/NavContext.js +1 -0
- package/dist/components/(navigation)/nav/navAppBar/NavAppBar.js +1 -0
- package/dist/components/(navigation)/nav/navAppBar/NavAppBar.styles.css +1 -0
- package/dist/components/(navigation)/nav/navAppBar/NavAppBar.styles.js +2 -0
- package/dist/components/(navigation)/nav/navBar/NavBar.js +1 -0
- package/dist/components/(navigation)/nav/navBar/NavBar.styles.css +1 -0
- package/dist/components/(navigation)/nav/navBar/NavBar.styles.js +2 -0
- package/dist/components/(navigation)/nav/navDrawer/NavDrawer.js +1 -0
- package/dist/components/(navigation)/nav/navDrawer/NavDrawer.styles.css +1 -0
- package/dist/components/(navigation)/nav/navDrawer/NavDrawer.styles.js +2 -0
- package/dist/components/(navigation)/nav/navHooks.js +1 -0
- package/dist/components/(navigation)/nav/navMenu/NavMenu.js +1 -0
- package/dist/components/(navigation)/nav/navRail/NavRail.js +1 -0
- package/dist/components/(navigation)/nav/navRail/NavRail.styles.css +1 -0
- package/dist/components/(navigation)/nav/navRail/NavRail.styles.js +2 -0
- package/dist/components/(navigation)/pagination/Pagination.js +1 -0
- package/dist/components/(navigation)/pagination/Pagination.styles.css +1 -0
- package/dist/components/(navigation)/pagination/Pagination.styles.js +2 -0
- package/dist/components/(navigation)/pagination/index.js +1 -0
- package/dist/components/(overlays)/drawer/Drawer.js +1 -0
- package/dist/components/(overlays)/drawer/Drawer.styles.css +1 -0
- package/dist/components/(overlays)/drawer/Drawer.styles.js +2 -0
- package/dist/components/(overlays)/drawer/index.js +1 -0
- package/dist/components/(overlays)/drop/Drop.js +1 -0
- package/dist/components/(overlays)/drop/Drop.styles.css +1 -0
- package/dist/components/(overlays)/drop/Drop.styles.js +2 -0
- package/dist/components/(overlays)/drop/index.js +1 -0
- package/dist/components/(overlays)/modal/Modal.js +1 -0
- package/dist/components/(overlays)/modal/Modal.styles.css +1 -0
- package/dist/components/(overlays)/modal/Modal.styles.js +2 -0
- package/dist/components/(overlays)/modal/index.js +1 -0
- package/dist/components/(overlays)/popover/Popover.js +1 -0
- package/dist/components/(overlays)/popover/Popover.styles.css +1 -0
- package/dist/components/(overlays)/popover/Popover.styles.js +2 -0
- package/dist/components/(overlays)/popover/index.js +1 -0
- package/dist/components/(overlays)/toast/Toast.js +1 -0
- package/dist/components/(overlays)/toast/Toast.styles.css +1 -0
- package/dist/components/(overlays)/toast/Toast.styles.js +2 -0
- package/dist/components/(overlays)/toast/index.js +1 -0
- package/dist/components/(pickers)/comboBox/ComboBox.js +1 -0
- package/dist/components/(pickers)/comboBox/index.js +1 -0
- package/dist/components/(pickers)/select/Select.js +1 -0
- package/dist/components/(pickers)/select/index.js +1 -0
- package/dist/components/(pickers)/shared/Picker.styles.css +1 -0
- package/dist/components/(pickers)/shared/Picker.styles.js +2 -0
- package/dist/components/(primitives)/avatar/Avatar.js +1 -0
- package/dist/components/(primitives)/avatar/Avatar.styles.css +1 -0
- package/dist/components/(primitives)/avatar/Avatar.styles.js +2 -0
- package/dist/components/(primitives)/avatar/index.js +1 -0
- package/dist/components/(primitives)/badge/Badge.js +1 -0
- package/dist/components/(primitives)/badge/Badge.styles.css +1 -0
- package/dist/components/(primitives)/badge/Badge.styles.js +2 -0
- package/dist/components/(primitives)/badge/index.js +1 -0
- package/dist/components/(primitives)/code/Code.js +1 -0
- package/dist/components/(primitives)/code/Code.styles.css +1 -0
- package/dist/components/(primitives)/code/Code.styles.js +2 -0
- package/dist/components/(primitives)/code/index.js +1 -0
- package/dist/components/(primitives)/comment/Comment.js +1 -0
- package/dist/components/(primitives)/comment/Comment.styles.css +1 -0
- package/dist/components/(primitives)/comment/Comment.styles.js +2 -0
- package/dist/components/(primitives)/icon/Icon.js +1 -0
- package/dist/components/(primitives)/kbd/Kbd.js +1 -0
- package/dist/components/(primitives)/kbd/Kbd.styles.css +1 -0
- package/dist/components/(primitives)/kbd/Kbd.styles.js +2 -0
- package/dist/components/(primitives)/kbd/index.js +1 -0
- package/dist/components/(primitives)/label/Label.js +1 -0
- package/dist/components/(primitives)/separator/Separator.js +1 -0
- package/dist/components/(primitives)/separator/Separator.styles.css +1 -0
- package/dist/components/(primitives)/separator/Separator.styles.js +2 -0
- package/dist/components/(primitives)/separator/index.js +1 -0
- package/dist/hooks/useBodyScrollLock.js +1 -0
- package/dist/hooks/useImageColor.js +1 -0
- package/dist/hooks/useNavSheetDrag.js +1 -0
- package/dist/lib/colorRoles.js +1 -0
- package/dist/lib/cx.js +1 -0
- package/dist/lib/easing.js +1 -0
- package/dist/lib/overlay.js +1 -0
- package/dist/lib/refs.js +1 -0
- package/dist/lib/types.js +0 -0
- package/dist/package.exports.json +398 -0
- package/dist/providers/MobileViewProvider.js +1 -0
- package/dist/providers/ReduceMotionProvider.js +1 -0
- package/dist/themes/fonts/outfit-300.woff2 +0 -0
- package/dist/themes/fonts/outfit-400.woff2 +0 -0
- package/dist/themes/fonts/outfit-500.woff2 +0 -0
- package/dist/themes/fonts/outfit-600.woff2 +0 -0
- package/dist/themes/fonts/outfit-700.woff2 +0 -0
- package/dist/themes/fonts/outfit-800.woff2 +0 -0
- package/dist/themes/theme.css +506 -0
- package/dist/themes/yz-palette-dark-hc.css +41 -0
- package/dist/themes/yz-palette-dark-mc.css +41 -0
- package/dist/themes/yz-palette-dark.css +41 -0
- package/dist/themes/yz-palette-light-hc.css +41 -0
- package/dist/themes/yz-palette-light-mc.css +41 -0
- package/dist/themes/yz-palette-light.css +41 -0
- package/dist/types/components/(buttons)/button/Button.d.ts +105 -0
- package/dist/types/components/(buttons)/button/index.d.ts +31 -0
- package/dist/types/components/(buttons)/buttonGroup/ButtonGroup.d.ts +36 -0
- package/dist/types/components/(buttons)/buttonGroup/index.d.ts +2 -0
- package/dist/types/components/(buttons)/buttonSplit/ButtonSplit.d.ts +17 -0
- package/dist/types/components/(buttons)/buttonSplit/index.d.ts +2 -0
- package/dist/types/components/(buttons)/fab/Fab.d.ts +60 -0
- package/dist/types/components/(buttons)/fab/index.d.ts +2 -0
- package/dist/types/components/(buttons)/shared/warnOnce.d.ts +1 -0
- package/dist/types/components/(buttons)/toggleButton/ButtonToggle.d.ts +19 -0
- package/dist/types/components/(buttons)/toggleButton/index.d.ts +2 -0
- package/dist/types/components/(color)/colorArea/ColorArea.d.ts +15 -0
- package/dist/types/components/(color)/colorArea/index.d.ts +2 -0
- package/dist/types/components/(color)/colorField/ColorField.d.ts +29 -0
- package/dist/types/components/(color)/colorField/index.d.ts +2 -0
- package/dist/types/components/(color)/colorPicker/ColorPicker.d.ts +34 -0
- package/dist/types/components/(color)/colorPicker/index.d.ts +2 -0
- package/dist/types/components/(color)/colorSlider/ColorSlider.d.ts +17 -0
- package/dist/types/components/(color)/colorSlider/index.d.ts +2 -0
- package/dist/types/components/(color)/colorSwatch/ColorSwatch.d.ts +21 -0
- package/dist/types/components/(color)/colorSwatch/index.d.ts +2 -0
- package/dist/types/components/(color)/colorSwatchPicker/ColorSwatchPicker.d.ts +25 -0
- package/dist/types/components/(color)/colorSwatchPicker/index.d.ts +2 -0
- package/dist/types/components/(color)/shared/colorUtils.d.ts +51 -0
- package/dist/types/components/(color)/shared/useColor.d.ts +16 -0
- package/dist/types/components/(color)/shared/useDrag2D.d.ts +14 -0
- package/dist/types/components/(datetime)/calendar/Calendar.d.ts +19 -0
- package/dist/types/components/(datetime)/dateField/DateField.d.ts +18 -0
- package/dist/types/components/(datetime)/datePicker/DatePicker.d.ts +17 -0
- package/dist/types/components/(datetime)/dateRangePicker/DateRangePicker.d.ts +18 -0
- package/dist/types/components/(datetime)/rangeCalendar/RangeCalendar.d.ts +21 -0
- package/dist/types/components/(datetime)/shared/CalendarFrame.d.ts +15 -0
- package/dist/types/components/(datetime)/shared/PickerShell.d.ts +16 -0
- package/dist/types/components/(datetime)/shared/dateUtils.d.ts +13 -0
- package/dist/types/components/(datetime)/shared/useCalendarGrid.d.ts +24 -0
- package/dist/types/components/(datetime)/timeField/TimeField.d.ts +20 -0
- package/dist/types/components/(effects)/customScrollbar/CustomScrollbar.d.ts +5 -0
- package/dist/types/components/(effects)/progressiveBlur/ProgressiveBlur.d.ts +11 -0
- package/dist/types/components/(effects)/ripple/Ripple.d.ts +13 -0
- package/dist/types/components/(effects)/scrollShadow/ScrollShadow.d.ts +19 -0
- package/dist/types/components/(effects)/scrollShadow/useScrollShadow.d.ts +11 -0
- package/dist/types/components/(effects)/shape/Shape.d.ts +55 -0
- package/dist/types/components/(effects)/shape/ShapeLoader.d.ts +7 -0
- package/dist/types/components/(effects)/shape/ShapePaths.d.ts +4 -0
- package/dist/types/components/(effects)/shape/shapeGeometry.d.ts +8 -0
- package/dist/types/components/(effects)/shape/shapeTicker.d.ts +3 -0
- package/dist/types/components/(effects)/shape/springCurves.d.ts +10 -0
- package/dist/types/components/(effects)/sinewave/Sinewave.d.ts +28 -0
- package/dist/types/components/(feedback)/circularProgress/CircularProgress.d.ts +22 -0
- package/dist/types/components/(feedback)/linearProgress/LinearProgress.d.ts +21 -0
- package/dist/types/components/(feedback)/meter/Meter.d.ts +19 -0
- package/dist/types/components/(feedback)/shared/progress.d.ts +10 -0
- package/dist/types/components/(feedback)/sinewaveProgress/SinewaveProgress.d.ts +22 -0
- package/dist/types/components/(feedback)/skeleton/Skeleton.d.ts +16 -0
- package/dist/types/components/(feedback)/skeleton/index.d.ts +2 -0
- package/dist/types/components/(feedback)/spinner/Spinner.d.ts +10 -0
- package/dist/types/components/(forms)/checkbox/Checkbox.d.ts +17 -0
- package/dist/types/components/(forms)/checkboxGroup/CheckboxGroup.d.ts +34 -0
- package/dist/types/components/(forms)/fieldset/Fieldset.d.ts +12 -0
- package/dist/types/components/(forms)/fieldset/index.d.ts +2 -0
- package/dist/types/components/(forms)/fileUpload/FileUpload.d.ts +21 -0
- package/dist/types/components/(forms)/fileUpload/index.d.ts +3 -0
- package/dist/types/components/(forms)/fileUpload/validate.d.ts +17 -0
- package/dist/types/components/(forms)/form/Form.d.ts +19 -0
- package/dist/types/components/(forms)/form/index.d.ts +2 -0
- package/dist/types/components/(forms)/input/Input.d.ts +32 -0
- package/dist/types/components/(forms)/inputOtp/InputOtp.d.ts +18 -0
- package/dist/types/components/(forms)/numberField/NumberField.d.ts +26 -0
- package/dist/types/components/(forms)/numberField/index.d.ts +2 -0
- package/dist/types/components/(forms)/radio/Radio.d.ts +16 -0
- package/dist/types/components/(forms)/radioGroup/RadioGroup.d.ts +31 -0
- package/dist/types/components/(forms)/search/Search.d.ts +21 -0
- package/dist/types/components/(forms)/search/index.d.ts +2 -0
- package/dist/types/components/(forms)/shared/FieldAdornment.d.ts +11 -0
- package/dist/types/components/(forms)/shared/FieldShell.d.ts +20 -0
- package/dist/types/components/(forms)/shared/fieldContext.d.ts +13 -0
- package/dist/types/components/(forms)/shared/icons.d.ts +1 -0
- package/dist/types/components/(forms)/slider/Slider.d.ts +27 -0
- package/dist/types/components/(forms)/switch/Switch.d.ts +16 -0
- package/dist/types/components/(forms)/textArea/TextArea.d.ts +8 -0
- package/dist/types/components/(layout)/accordion/Accordion.d.ts +39 -0
- package/dist/types/components/(layout)/card/Card.d.ts +37 -0
- package/dist/types/components/(layout)/codeSnippet/CodeSnippet.d.ts +20 -0
- package/dist/types/components/(layout)/codeSnippet/index.d.ts +2 -0
- package/dist/types/components/(layout)/grid/Grid.d.ts +33 -0
- package/dist/types/components/(layout)/grid/index.d.ts +2 -0
- package/dist/types/components/(layout)/list/List.d.ts +44 -0
- package/dist/types/components/(layout)/list/index.d.ts +2 -0
- package/dist/types/components/(layout)/section/Section.d.ts +16 -0
- package/dist/types/components/(layout)/section/index.d.ts +2 -0
- package/dist/types/components/(layout)/table/Table.d.ts +116 -0
- package/dist/types/components/(layout)/table/index.d.ts +2 -0
- package/dist/types/components/(navigation)/breadcrumbs/Breadcrumbs.d.ts +23 -0
- package/dist/types/components/(navigation)/breadcrumbs/index.d.ts +2 -0
- package/dist/types/components/(navigation)/nav/Nav.d.ts +48 -0
- package/dist/types/components/(navigation)/nav/NavContext.d.ts +69 -0
- package/dist/types/components/(navigation)/nav/navAppBar/NavAppBar.d.ts +41 -0
- package/dist/types/components/(navigation)/nav/navBar/NavBar.d.ts +12 -0
- package/dist/types/components/(navigation)/nav/navDrawer/NavDrawer.d.ts +19 -0
- package/dist/types/components/(navigation)/nav/navHooks.d.ts +9 -0
- package/dist/types/components/(navigation)/nav/navMenu/NavMenu.d.ts +14 -0
- package/dist/types/components/(navigation)/nav/navRail/NavRail.d.ts +10 -0
- package/dist/types/components/(navigation)/pagination/Pagination.d.ts +22 -0
- package/dist/types/components/(navigation)/pagination/index.d.ts +2 -0
- package/dist/types/components/(overlays)/drawer/Drawer.d.ts +77 -0
- package/dist/types/components/(overlays)/drawer/index.d.ts +2 -0
- package/dist/types/components/(overlays)/drop/Drop.d.ts +86 -0
- package/dist/types/components/(overlays)/drop/index.d.ts +2 -0
- package/dist/types/components/(overlays)/modal/Modal.d.ts +72 -0
- package/dist/types/components/(overlays)/modal/index.d.ts +2 -0
- package/dist/types/components/(overlays)/popover/Popover.d.ts +57 -0
- package/dist/types/components/(overlays)/popover/index.d.ts +2 -0
- package/dist/types/components/(overlays)/toast/Toast.d.ts +67 -0
- package/dist/types/components/(overlays)/toast/index.d.ts +2 -0
- package/dist/types/components/(pickers)/comboBox/ComboBox.d.ts +28 -0
- package/dist/types/components/(pickers)/comboBox/index.d.ts +2 -0
- package/dist/types/components/(pickers)/select/Select.d.ts +27 -0
- package/dist/types/components/(pickers)/select/index.d.ts +2 -0
- package/dist/types/components/(pickers)/shared/PickerItem.d.ts +6 -0
- package/dist/types/components/(pickers)/shared/index.d.ts +1 -0
- package/dist/types/components/(primitives)/avatar/Avatar.d.ts +49 -0
- package/dist/types/components/(primitives)/avatar/index.d.ts +2 -0
- package/dist/types/components/(primitives)/badge/Badge.d.ts +23 -0
- package/dist/types/components/(primitives)/badge/index.d.ts +2 -0
- package/dist/types/components/(primitives)/code/Code.d.ts +10 -0
- package/dist/types/components/(primitives)/code/index.d.ts +2 -0
- package/dist/types/components/(primitives)/comment/Comment.d.ts +8 -0
- package/dist/types/components/(primitives)/icon/Icon.d.ts +8 -0
- package/dist/types/components/(primitives)/kbd/Kbd.d.ts +12 -0
- package/dist/types/components/(primitives)/kbd/index.d.ts +2 -0
- package/dist/types/components/(primitives)/label/Label.d.ts +9 -0
- package/dist/types/components/(primitives)/separator/Separator.d.ts +16 -0
- package/dist/types/components/(primitives)/separator/index.d.ts +2 -0
- package/dist/types/hooks/useBodyScrollLock.d.ts +1 -0
- package/dist/types/hooks/useImageColor.d.ts +13 -0
- package/dist/types/hooks/useNavSheetDrag.d.ts +24 -0
- package/dist/types/lib/colorRoles.d.ts +10 -0
- package/dist/types/lib/cx.d.ts +1 -0
- package/dist/types/lib/easing.d.ts +17 -0
- package/dist/types/lib/overlay.d.ts +10 -0
- package/dist/types/lib/refs.d.ts +1 -0
- package/dist/types/lib/types.d.ts +12 -0
- package/dist/types/providers/MobileViewProvider.d.ts +12 -0
- package/dist/types/providers/ReduceMotionProvider.d.ts +2 -0
- package/package.json +406 -11
- package/scripts/postinstall.js +0 -91
- package/template/app/ClientNav.tsx +0 -258
- package/template/app/globals.css +0 -2
- package/template/app/layout.tsx +0 -94
- package/template/app/themes/dark-mc.css +0 -51
- package/template/app/themes/dark.css +0 -51
- package/template/app/themes/light-mc.css +0 -51
- package/template/app/themes/light.css +0 -51
- package/template/app/themes/theme.css +0 -272
- package/template/components/(buttons)/Button.module.css +0 -351
- package/template/components/(buttons)/ButtonGroup.tsx +0 -414
- package/template/components/(buttons)/FAB.tsx +0 -119
- package/template/components/(buttons)/button.tsx +0 -164
- package/template/components/(controls)/slider/Slider.module.css +0 -250
- package/template/components/(controls)/slider/Slider.tsx +0 -386
- package/template/components/(controls)/switch/Switch.module.css +0 -108
- package/template/components/(controls)/switch/Switch.tsx +0 -69
- package/template/components/(date & time)/calendar/Calendar.module.css +0 -125
- package/template/components/(date & time)/calendar/Calendar.tsx +0 -206
- package/template/components/(date & time)/dateField/DateField.module.css +0 -25
- package/template/components/(date & time)/dateField/DateField.tsx +0 -193
- package/template/components/(date & time)/datePicker/DatePicker.tsx +0 -118
- package/template/components/(date & time)/dateRangePicker/DateRangePicker.tsx +0 -144
- package/template/components/(date & time)/rangeCalendar/RangeCalendar.module.css +0 -203
- package/template/components/(date & time)/rangeCalendar/RangeCalendar.tsx +0 -263
- package/template/components/(date & time)/shared/dateUtils.ts +0 -107
- package/template/components/(date & time)/timeField/TimeField.module.css +0 -39
- package/template/components/(date & time)/timeField/TimeField.tsx +0 -158
- package/template/components/(feedback)/circularProgress/CircularProgress.tsx +0 -646
- package/template/components/(feedback)/linearProgress/LinearProgress.tsx +0 -337
- package/template/components/(feedback)/meter/Meter.tsx +0 -111
- package/template/components/(feedback)/skeleton/Skeleton.module.css +0 -49
- package/template/components/(feedback)/skeleton/Skeleton.tsx +0 -32
- package/template/components/(feedback)/spinner/Spinner.module.css +0 -27
- package/template/components/(feedback)/spinner/Spinner.tsx +0 -60
- package/template/components/(forms)/checkbox/Checkbox.tsx +0 -121
- package/template/components/(forms)/checkboxGroup/CheckboxGroup.tsx +0 -83
- package/template/components/(forms)/description/Description.tsx +0 -34
- package/template/components/(forms)/errorMessage/ErrorMessage.tsx +0 -31
- package/template/components/(forms)/fieldError/FieldError.tsx +0 -39
- package/template/components/(forms)/fieldset/Fieldset.tsx +0 -51
- package/template/components/(forms)/form/Form.tsx +0 -54
- package/template/components/(forms)/input/Input.tsx +0 -50
- package/template/components/(forms)/inputGroup/InputGroup.tsx +0 -65
- package/template/components/(forms)/inputOtp/InputOtp.tsx +0 -139
- package/template/components/(forms)/label/Label.tsx +0 -46
- package/template/components/(forms)/numberField/NumberField.tsx +0 -292
- package/template/components/(forms)/radioGroup/RadioGroup.tsx +0 -175
- package/template/components/(forms)/searchField/SearchField.tsx +0 -139
- package/template/components/(forms)/shared/field.module.css +0 -75
- package/template/components/(forms)/shared/fieldContext.ts +0 -28
- package/template/components/(forms)/textArea/TextArea.tsx +0 -55
- package/template/components/(forms)/textField/TextField.tsx +0 -91
- package/template/components/(layout)/Lightbox/LightboxCard.tsx +0 -100
- package/template/components/(layout)/Lightbox/LightboxGallery.module.css +0 -249
- package/template/components/(layout)/Lightbox/LightboxGallery.tsx +0 -72
- package/template/components/(layout)/Lightbox/LightboxGrid.tsx +0 -185
- package/template/components/(layout)/Lightbox/LightboxModal.module.css +0 -395
- package/template/components/(layout)/Lightbox/LightboxModal.tsx +0 -498
- package/template/components/(layout)/Lightbox/demo.tsx +0 -396
- package/template/components/(layout)/Lightbox/index.ts +0 -30
- package/template/components/(layout)/Lightbox/types.ts +0 -101
- package/template/components/(layout)/Lightbox/useLightboxFilters.ts +0 -140
- package/template/components/(layout)/accordion/Accordion.module.css +0 -108
- package/template/components/(layout)/accordion/Accordion.tsx +0 -251
- package/template/components/(layout)/card/Card.module.css +0 -136
- package/template/components/(layout)/card/Card.tsx +0 -371
- package/template/components/(layout)/list/List.module.css +0 -83
- package/template/components/(layout)/list/List.tsx +0 -332
- package/template/components/(layout)/navigation/Wrap.tsx +0 -41
- package/template/components/(layout)/navigation/breadcrumbs/Breadcrumbs.tsx +0 -145
- package/template/components/(layout)/navigation/nav/Nav.module.css.old +0 -474
- package/template/components/(layout)/navigation/nav/Nav.tsx +0 -186
- package/template/components/(layout)/navigation/nav/NavBar.tsx +0 -396
- package/template/components/(layout)/navigation/nav/NavContext.tsx +0 -259
- package/template/components/(layout)/navigation/nav/NavItem.tsx +0 -195
- package/template/components/(layout)/navigation/nav/NavNew.module.css +0 -406
- package/template/components/(layout)/navigation/nav/NavRail.tsx +0 -317
- package/template/components/(layout)/navigation/nav/NavSection.tsx +0 -101
- package/template/components/(layout)/navigation/nav/NavTab.tsx +0 -25
- package/template/components/(layout)/navigation/nav/navftb/NavFTB.module.css +0 -253
- package/template/components/(layout)/navigation/nav/navftb/NavFTB.tsx +0 -448
- package/template/components/(layout)/navigation/nav/navftb/useTabIndicator.ts +0 -498
- package/template/components/(layout)/navigation/nav/navheader/NavHeader.module.css +0 -59
- package/template/components/(layout)/navigation/nav/navheader/NavHeader.tsx +0 -465
- package/template/components/(layout)/navigation/pagination/Pagination.tsx +0 -261
- package/template/components/(layout)/pages/loadingScreen.tsx +0 -117
- package/template/components/(layout)/pages/maintenance/Maintenance.tsx +0 -53
- package/template/components/(layout)/pages/maintenance/maintenance.module.css +0 -163
- package/template/components/(layout)/scrollShadow/ScrollShadow.module.css +0 -81
- package/template/components/(layout)/scrollShadow/ScrollShadow.tsx +0 -161
- package/template/components/(layout)/scrollShadow/useScrollShadow.ts +0 -130
- package/template/components/(layout)/separator/Separator.tsx +0 -112
- package/template/components/(overlays)/accessibilityModal/AccessibilityModal.tsx +0 -307
- package/template/components/(overlays)/drawer/Drawer.tsx +0 -953
- package/template/components/(overlays)/modal/Modal.tsx +0 -654
- package/template/components/(overlays)/popover/Popover.tsx +0 -420
- package/template/components/(overlays)/toast/Toast.tsx +0 -692
- package/template/components/(pickers)/autocomplete/Autocomplete.tsx +0 -24
- package/template/components/(pickers)/comboBox/ComboBox.tsx +0 -21
- package/template/components/(pickers)/select/Select.tsx +0 -188
- package/template/components/(pickers)/shared/FilterableField.tsx +0 -223
- package/template/components/(pickers)/shared/PickerItem.ts +0 -13
- package/template/components/tools/CustomScrollbar.tsx +0 -107
- package/template/components/tools/Divider.tsx +0 -11
- package/template/components/tools/ReduceMotionContext.tsx +0 -5
- package/template/components/tools/Sinewave.tsx +0 -396
- package/template/components/tools/SinewaveProgress.tsx +0 -140
- package/template/components/tools/badge/Badge.tsx +0 -28
- package/template/components/tools/dropdown/drop.module.css +0 -196
- package/template/components/tools/dropdown/drop.tsx +0 -568
- package/template/components/tools/easing.ts +0 -118
- package/template/components/tools/flubber.d.ts +0 -7
- package/template/components/tools/footer/Footer.tsx +0 -20
- package/template/components/tools/input/Input.module.css +0 -45
- package/template/components/tools/input/Input.tsx +0 -99
- package/template/components/tools/label/Icon.tsx +0 -39
- package/template/components/tools/label/Label.tsx +0 -156
- package/template/components/tools/mobileViewProvider.tsx +0 -53
- package/template/components/tools/ripple/ripple.css +0 -38
- package/template/components/tools/ripple/ripple.tsx +0 -78
- package/template/components/tools/shape/Shape.module.css +0 -25
- package/template/components/tools/shape/Shape.tsx +0 -316
- package/template/components/tools/shape/ShapeLoader.tsx +0 -104
- package/template/components/tools/shape/ShapePaths.ts +0 -116
- package/template/components/tools/switch/Switch.module.css +0 -102
- package/template/components/tools/switch/Switch.tsx +0 -48
- package/template/components/tools/useBodyScrollLock.tsx +0 -27
- package/template/components/tools/useImageColor.ts +0 -47
- package/template/components/tools/useNavSheetDrag.tsx +0 -196
- /package/{template/public/fonts/material-symbols/MaterialSymbolsRounded-VariableFont_FILL,GRAD,opsz,wght.woff2 → dist/themes/fonts/MaterialSymbolsRounded.woff2} +0 -0
|
@@ -1,646 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { easeInOut, motion } from "framer-motion";
|
|
4
|
-
import { cubicBezier } from "@/components/tools/easing";
|
|
5
|
-
import Sinewave from "@/components/tools/Sinewave";
|
|
6
|
-
|
|
7
|
-
// =============================================================================
|
|
8
|
-
// MARK: Public types
|
|
9
|
-
// =============================================================================
|
|
10
|
-
// The circular progress indicator, in both shapes and both behaviors.
|
|
11
|
-
// Self-contained; LinearProgress is its counterpart and shares no code.
|
|
12
|
-
// For the geometry it draws with, see MARK: Arc model below.
|
|
13
|
-
|
|
14
|
-
export type CircularProgressBehavior = "determinate" | "indeterminate";
|
|
15
|
-
export type CircularProgressWeight = 4 | 6 | 8;
|
|
16
|
-
export type CircularProgressVariant =
|
|
17
|
-
| "default"
|
|
18
|
-
| "primary"
|
|
19
|
-
| "secondary"
|
|
20
|
-
| "tertiary";
|
|
21
|
-
export type CircularProgressShape = "flat" | "wavy";
|
|
22
|
-
|
|
23
|
-
// "default" is the odd one out: active reads as primary, but the inactive
|
|
24
|
-
// ring deliberately does NOT follow primary-container — it's pinned to
|
|
25
|
-
// secondary-container. Every other variant follows the normal MD3 pairing
|
|
26
|
-
// (color / color-container). Mirrors LinearProgress's helpers of the same
|
|
27
|
-
// name — kept duplicated rather than shared, per this file's own
|
|
28
|
-
// self-contained convention.
|
|
29
|
-
function activeColorFor(variant: CircularProgressVariant) {
|
|
30
|
-
return variant === "default"
|
|
31
|
-
? "var(--md-sys-color-primary)"
|
|
32
|
-
: `var(--md-sys-color-${variant})`;
|
|
33
|
-
}
|
|
34
|
-
function remainingColorFor(variant: CircularProgressVariant) {
|
|
35
|
-
return variant === "default"
|
|
36
|
-
? "var(--md-sys-color-secondary-container)"
|
|
37
|
-
: `var(--md-sys-color-${variant}-container)`;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface CircularProgressProps {
|
|
41
|
-
/** 0-100 task progress. Only meaningful in `behavior="determinate"`. */
|
|
42
|
-
progress?: number;
|
|
43
|
-
behavior?: CircularProgressBehavior;
|
|
44
|
-
/** Ring thickness. @default 4 */
|
|
45
|
-
weight?: CircularProgressWeight;
|
|
46
|
-
variant?: CircularProgressVariant;
|
|
47
|
-
/** Fires once, the instant `progress` crosses into 100 — not on every
|
|
48
|
-
* render while already at 100, and not again until it drops below 100
|
|
49
|
-
* and climbs back up. */
|
|
50
|
-
onComplete?: () => void;
|
|
51
|
-
shape?: CircularProgressShape;
|
|
52
|
-
/** px gap the remaining ring's start is trimmed by, past the active arc's
|
|
53
|
-
* natural end. @default CIRCULAR_TRACK_GAP_PX[weight]. Collapses to 0 at
|
|
54
|
-
* 0% and 100% — nothing left to gap against once the ring is fully empty
|
|
55
|
-
* or fully complete. */
|
|
56
|
-
gap?: number;
|
|
57
|
-
/** px the active arc's own start is trimmed by, past the dot/seam.
|
|
58
|
-
* @default CIRCULAR_TRACK_GAP_PX[weight]. Collapses to 0 only at 0% (still
|
|
59
|
-
* applies at 100% — a nonzero value there deliberately leaves the arc
|
|
60
|
-
* short of a full circle). */
|
|
61
|
-
startActiveOffset?: number;
|
|
62
|
-
/** Whether the stop indicator dot renders at all. Forced off in
|
|
63
|
-
* indeterminate — there's no endpoint to mark. @default true */
|
|
64
|
-
showDot?: boolean;
|
|
65
|
-
/** Wavy only — resting amplitude of the wave. @default 2. Flattens to 0
|
|
66
|
-
* automatically once progress visually completes. */
|
|
67
|
-
amplitude?: number;
|
|
68
|
-
className?: string;
|
|
69
|
-
style?: React.CSSProperties;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// =============================================================================
|
|
73
|
-
// MARK: Internal tuning constants
|
|
74
|
-
// =============================================================================
|
|
75
|
-
|
|
76
|
-
// Determinate geometry (arc sweep) — cubic-bezier(0.3, 0, 0, 1), not linear.
|
|
77
|
-
const PROGRESS_TRANSITION = "1s cubic-bezier(0.3, 0, 0, 1)";
|
|
78
|
-
const PROGRESS_DURATION_MS = 1000;
|
|
79
|
-
const PROGRESS_EASE = cubicBezier(0.3, 0, 0, 1);
|
|
80
|
-
const PROGRESS_EASE_ARRAY: [number, number, number, number] = [0.3, 0, 0, 1];
|
|
81
|
-
|
|
82
|
-
// Deliberately NOT `var(--transition-expressive-color)`: that token's current
|
|
83
|
-
// value is invalid inside a `transition` shorthand, which makes the browser
|
|
84
|
-
// drop the entire declaration.
|
|
85
|
-
const COLOR_TRANSITION = "0.2s cubic-bezier(0.2, 0, 0, 1)";
|
|
86
|
-
const FADE = { duration: 0.2, ease: easeInOut };
|
|
87
|
-
|
|
88
|
-
const STOP_INDICATOR_SIZE = 4;
|
|
89
|
-
|
|
90
|
-
// Fixed — the wavy ring's radius calc reserves headroom for exactly this much.
|
|
91
|
-
const CIRCULAR_WAVE_AMPLITUDE = 2;
|
|
92
|
-
// Cycles per full 360° revolution = progress% * this — 40%→2, 100%→5, per
|
|
93
|
-
// hand-tuned reference points.
|
|
94
|
-
const CIRCULAR_WAVE_FREQUENCY_PER_PERCENT = 0.09;
|
|
95
|
-
/** Seconds for the wave to crawl exactly one full period around the ring —
|
|
96
|
-
* how fast the ripple travels, independent of how many ripples there are
|
|
97
|
-
* (that's CIRCULAR_WAVE_FREQUENCY_PER_PERCENT) and of the ring's own spin.
|
|
98
|
-
* Lower = faster. Sinewave's own default is 1.6, i.e. half this speed. */
|
|
99
|
-
const WAVE_DURATION = 0.8;
|
|
100
|
-
|
|
101
|
-
// Above this (visually eased) progress, the stop indicator and remaining ring
|
|
102
|
-
// fade out — winding the ring down ahead of completion at 100%.
|
|
103
|
-
const CIRCULAR_WIND_DOWN_THRESHOLD = 80;
|
|
104
|
-
|
|
105
|
-
// px gap left empty on both ends of the circular remaining ring — after the
|
|
106
|
-
// active arc, and before the stop indicator at the top. Per weight.
|
|
107
|
-
const CIRCULAR_TRACK_GAP_PX: Record<CircularProgressWeight, number> = {
|
|
108
|
-
4: 10,
|
|
109
|
-
6: 12,
|
|
110
|
-
8: 14,
|
|
111
|
-
};
|
|
112
|
-
// Ring diameter, keyed by shape then weight — wavy gets extra headroom for
|
|
113
|
-
// the wave's amplitude, flat doesn't need it.
|
|
114
|
-
const CIRCULAR_SIZE: Record<
|
|
115
|
-
CircularProgressShape,
|
|
116
|
-
Record<CircularProgressWeight, number>
|
|
117
|
-
> = {
|
|
118
|
-
flat: { 4: 40, 6: 42, 8: 44 },
|
|
119
|
-
wavy: { 4: 48, 6: 50, 8: 52 },
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
// -- Indeterminate --
|
|
123
|
-
// NOT a separate rendering path. It's the exact same determinate ring with
|
|
124
|
-
// the stop indicator hidden, `progress` oscillating between MIN and MAX, and
|
|
125
|
-
// the whole element rotating underneath it. Rotation is two layers: a stable
|
|
126
|
-
// constant-rate turn, plus an eased KICK burst added on top across each
|
|
127
|
-
// shrink phase.
|
|
128
|
-
/** Arc length's grow → shrink oscillation. */
|
|
129
|
-
const INDETERMINATE_CYCLE_MS = 3600;
|
|
130
|
-
/** Stable base spin — ms for one full 360° turn. Constant rate, never eased,
|
|
131
|
-
* never resets. Its own clock, independent of the arc's oscillation. */
|
|
132
|
-
const INDETERMINATE_ROTATION_MS = 4600;
|
|
133
|
-
/** The nudge, layered ON TOP of the base spin across each shrink — how far
|
|
134
|
-
* it turns, and the primary dial for how much extra motion the spinner has.
|
|
135
|
-
*
|
|
136
|
-
* Its job is to hold the active arc's END visually still: the arc is drawn
|
|
137
|
-
* start-anchored, so while it shrinks its end sweeps BACKWARD by exactly the
|
|
138
|
-
* angle the arc loses. The nudge adds that same angle back, which cancels the
|
|
139
|
-
* two out and leaves the end travelling at nothing but the base rate.
|
|
140
|
-
*
|
|
141
|
-
* That only works while the nudge and the arc's span agree, which is why
|
|
142
|
-
* INDETERMINATE_MAX_PROGRESS is derived from this rather than the other way
|
|
143
|
-
* round — 120° of ring is 33.3pt of arc. Raise this and the arc swings wider
|
|
144
|
-
* to match; the end stays held either way.
|
|
145
|
-
*
|
|
146
|
-
* The nudge is also NOT an independent animation — it's read off the arc's
|
|
147
|
-
* own eased progress each frame. That's what makes it cancel frame for frame;
|
|
148
|
-
* an independent curve of the same total travel still lets the end lurch
|
|
149
|
-
* during the fast middle of the shrink and drift back at the slow ends. It
|
|
150
|
-
* also inherits the arc's easing and timing for free, so there's no separate
|
|
151
|
-
* curve, delay or duration left to keep in sync. */
|
|
152
|
-
const INDETERMINATE_KICK_DEGREES = 120;
|
|
153
|
-
/** 1 holds the end perfectly still; 0 drops the nudge entirely; between the
|
|
154
|
-
* two the end deliberately slips backward as the arc shrinks. */
|
|
155
|
-
const INDETERMINATE_KICK_STRENGTH = 1;
|
|
156
|
-
const INDETERMINATE_MIN_PROGRESS = 15;
|
|
157
|
-
/** Extra arc on top of what the nudge alone implies, in PROGRESS POINTS (not
|
|
158
|
-
* degrees — 30pt is 108° of ring). Widens the arc's swing without touching
|
|
159
|
-
* the nudge's own dial. */
|
|
160
|
-
const INDETERMINATE_EXTRA_SPAN = 30;
|
|
161
|
-
/** The arc's longest extent — see INDETERMINATE_KICK_DEGREES. */
|
|
162
|
-
const INDETERMINATE_MAX_PROGRESS =
|
|
163
|
-
INDETERMINATE_MIN_PROGRESS +
|
|
164
|
-
(INDETERMINATE_KICK_DEGREES / 360) * 100 +
|
|
165
|
-
INDETERMINATE_EXTRA_SPAN;
|
|
166
|
-
/** The angle the arc's end actually gives up across one shrink. The nudge
|
|
167
|
-
* ramps to exactly this, so the per-cycle banked amount MUST match it or the
|
|
168
|
-
* handover snaps by the difference. Derived from the real span rather than
|
|
169
|
-
* from INDETERMINATE_KICK_DEGREES so the two can never drift apart. */
|
|
170
|
-
const INDETERMINATE_ARC_SWEEP_DEGREES =
|
|
171
|
-
((INDETERMINATE_MAX_PROGRESS - INDETERMINATE_MIN_PROGRESS) / 100) * 360;
|
|
172
|
-
/** Curve the arc length grows/shrinks on — drives the remaining ring's width
|
|
173
|
-
* too, since both read the same value. */
|
|
174
|
-
const INDETERMINATE_EASING: [number, number, number, number] = [
|
|
175
|
-
0.79, 0.14, 0.15, 0.86,
|
|
176
|
-
];
|
|
177
|
-
const INDETERMINATE_EASE = cubicBezier(...INDETERMINATE_EASING);
|
|
178
|
-
|
|
179
|
-
// -- Completion retract --
|
|
180
|
-
// Once the ring visually closes at 100%, the active arc's start offset runs
|
|
181
|
-
// 0 → full circumference, pulling the arc's start forward while its end stays
|
|
182
|
-
// pinned at the seam until nothing is left. This is the `startActiveOffset`
|
|
183
|
-
// 0/30/60/90/100/110/112 breakdown the completion sequence was designed from.
|
|
184
|
-
const COMPLETE_RETRACT_MS = 1000;
|
|
185
|
-
/** The wave flattens on the same curve but a shorter clock than the retract.
|
|
186
|
-
* If they share a duration the arc has already retracted to nothing by the
|
|
187
|
-
* time the wave is flat, so the flatten plays with nothing left to show it
|
|
188
|
-
* on. Landing it early means it reads against a still-full ring. */
|
|
189
|
-
const COMPLETE_FLATTEN_MS = 300;
|
|
190
|
-
const COMPLETE_RETRACT_EASING: [number, number, number, number] = [
|
|
191
|
-
0.79, 0.14, 0.15, 0.86,
|
|
192
|
-
];
|
|
193
|
-
const COMPLETE_RETRACT_EASE = cubicBezier(...COMPLETE_RETRACT_EASING);
|
|
194
|
-
|
|
195
|
-
// =============================================================================
|
|
196
|
-
// MARK: Animation hooks
|
|
197
|
-
// =============================================================================
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Mirrors a CSS transition for a plain number: whenever `target` changes, the
|
|
201
|
-
* returned value glides to it over `durationMs` on PROGRESS_EASE's curve —
|
|
202
|
-
* matching PROGRESS_TRANSITION. Used ONLY for threshold-driven effects
|
|
203
|
-
* (wind-down, completion), so they fire when the arc *visually* crosses a
|
|
204
|
-
* value rather than the instant the prop does.
|
|
205
|
-
*/
|
|
206
|
-
function useEasedValue(target: number, durationMs: number): number {
|
|
207
|
-
const [value, setValue] = React.useState(target);
|
|
208
|
-
const valueRef = React.useRef(target);
|
|
209
|
-
// Synced after commit, not during render — refs aren't render-pure.
|
|
210
|
-
React.useLayoutEffect(() => {
|
|
211
|
-
valueRef.current = value;
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
React.useEffect(() => {
|
|
215
|
-
// Restart from wherever the value currently is — also makes the hook
|
|
216
|
-
// StrictMode-safe (a cancelled run resumes instead of freezing).
|
|
217
|
-
const from = valueRef.current;
|
|
218
|
-
if (from === target) return;
|
|
219
|
-
const start = performance.now();
|
|
220
|
-
let frame = 0;
|
|
221
|
-
const tick = (now: number) => {
|
|
222
|
-
const t = Math.min(1, (now - start) / durationMs);
|
|
223
|
-
// Snap exactly on the final frame — `from + (target - from) * 1` can
|
|
224
|
-
// land a float ulp short (99.999...), which would silently break every
|
|
225
|
-
// `visualClamped >= 100` check downstream.
|
|
226
|
-
setValue(t >= 1 ? target : from + (target - from) * PROGRESS_EASE(t));
|
|
227
|
-
if (t < 1) frame = requestAnimationFrame(tick);
|
|
228
|
-
};
|
|
229
|
-
frame = requestAnimationFrame(tick);
|
|
230
|
-
return () => cancelAnimationFrame(frame);
|
|
231
|
-
}, [target, durationMs]);
|
|
232
|
-
|
|
233
|
-
return value;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* The whole of indeterminate: a `progress` value oscillating
|
|
238
|
-
* MIN → MAX → MIN, and a rotation that keeps climbing in one direction
|
|
239
|
-
* (completed cycles carry forward, so it never snaps back). Feed both into
|
|
240
|
-
* the ordinary determinate ring and that's the spinner.
|
|
241
|
-
*/
|
|
242
|
-
function useIndeterminateSpin(active: boolean) {
|
|
243
|
-
const [state, setState] = React.useState({
|
|
244
|
-
progress: INDETERMINATE_MIN_PROGRESS,
|
|
245
|
-
rotation: 0,
|
|
246
|
-
});
|
|
247
|
-
|
|
248
|
-
React.useEffect(() => {
|
|
249
|
-
if (!active) return;
|
|
250
|
-
const span = INDETERMINATE_MAX_PROGRESS - INDETERMINATE_MIN_PROGRESS;
|
|
251
|
-
const startTime = performance.now();
|
|
252
|
-
let frame = 0;
|
|
253
|
-
const tick = (now: number) => {
|
|
254
|
-
const elapsed = now - startTime;
|
|
255
|
-
|
|
256
|
-
const tCycle = elapsed % INDETERMINATE_CYCLE_MS;
|
|
257
|
-
// Where we are inside the current grow (first half) or shrink (second
|
|
258
|
-
// half) phase, 0→1, before any easing.
|
|
259
|
-
const tArc = tCycle / INDETERMINATE_CYCLE_MS;
|
|
260
|
-
const growing = tArc < 0.5;
|
|
261
|
-
const phaseT = growing ? tArc / 0.5 : (tArc - 0.5) / 0.5;
|
|
262
|
-
|
|
263
|
-
const eased = INDETERMINATE_EASE(phaseT);
|
|
264
|
-
const progress = growing
|
|
265
|
-
? INDETERMINATE_MIN_PROGRESS + span * eased
|
|
266
|
-
: INDETERMINATE_MAX_PROGRESS - span * eased;
|
|
267
|
-
|
|
268
|
-
// Layer 1 — stable constant-rate turn.
|
|
269
|
-
const baseRotation = (elapsed / INDETERMINATE_ROTATION_MS) * 360;
|
|
270
|
-
// Layer 2 — the nudge. Read straight off `progress`, so it is exactly
|
|
271
|
-
// the angle the shrinking end has given up so far; zero while growing.
|
|
272
|
-
// Each completed cycle banks a whole one (the nudge ends the shrink at
|
|
273
|
-
// precisely INDETERMINATE_KICK_DEGREES, and the next cycle restarts it
|
|
274
|
-
// at 0), so the handover is seamless and rotation only ever climbs.
|
|
275
|
-
const nudge = growing
|
|
276
|
-
? 0
|
|
277
|
-
: ((INDETERMINATE_MAX_PROGRESS - progress) / 100) * 360;
|
|
278
|
-
const banked =
|
|
279
|
-
Math.floor(elapsed / INDETERMINATE_CYCLE_MS) *
|
|
280
|
-
INDETERMINATE_ARC_SWEEP_DEGREES;
|
|
281
|
-
|
|
282
|
-
setState({
|
|
283
|
-
progress,
|
|
284
|
-
rotation: baseRotation + (banked + nudge) * INDETERMINATE_KICK_STRENGTH,
|
|
285
|
-
});
|
|
286
|
-
frame = requestAnimationFrame(tick);
|
|
287
|
-
};
|
|
288
|
-
frame = requestAnimationFrame(tick);
|
|
289
|
-
return () => cancelAnimationFrame(frame);
|
|
290
|
-
}, [active]);
|
|
291
|
-
|
|
292
|
-
return state;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
/**
|
|
296
|
-
* The completion retract: runs 0 → `distance` on COMPLETE_RETRACT_EASING once
|
|
297
|
-
* `active` goes true, and sits at 0 whenever it isn't. Fed straight into the
|
|
298
|
-
* active arc's `startActiveOffset`, which pulls the arc's start forward while
|
|
299
|
-
* its end stays pinned at the seam.
|
|
300
|
-
*/
|
|
301
|
-
function useRetract(
|
|
302
|
-
active: boolean,
|
|
303
|
-
distance: number,
|
|
304
|
-
durationMs: number,
|
|
305
|
-
): number {
|
|
306
|
-
const [value, setValue] = React.useState(0);
|
|
307
|
-
|
|
308
|
-
React.useEffect(() => {
|
|
309
|
-
if (!active) return;
|
|
310
|
-
const start = performance.now();
|
|
311
|
-
let frame = 0;
|
|
312
|
-
const tick = (now: number) => {
|
|
313
|
-
const t = Math.min(1, (now - start) / durationMs);
|
|
314
|
-
setValue(COMPLETE_RETRACT_EASE(t) * distance);
|
|
315
|
-
if (t < 1) frame = requestAnimationFrame(tick);
|
|
316
|
-
};
|
|
317
|
-
frame = requestAnimationFrame(tick);
|
|
318
|
-
// Rewinding on teardown (rather than on the inactive branch above) keeps
|
|
319
|
-
// the reset out of the effect body, and means a later re-completion can't
|
|
320
|
-
// paint one frame at the previous run's fully-retracted value.
|
|
321
|
-
return () => {
|
|
322
|
-
cancelAnimationFrame(frame);
|
|
323
|
-
setValue(0);
|
|
324
|
-
};
|
|
325
|
-
}, [active, distance, durationMs]);
|
|
326
|
-
|
|
327
|
-
return active ? value : 0;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
// =============================================================================
|
|
331
|
-
// MARK: Ring pieces
|
|
332
|
-
// =============================================================================
|
|
333
|
-
|
|
334
|
-
// CircularRemainingRing — a plain ring drawn via stroke-dasharray/
|
|
335
|
-
// stroke-dashoffset, starting `gap` px past the active arc's end and running
|
|
336
|
-
// untouched to the seam at the top.
|
|
337
|
-
function CircularRemainingRing({
|
|
338
|
-
diameter,
|
|
339
|
-
radius,
|
|
340
|
-
weight,
|
|
341
|
-
progress,
|
|
342
|
-
gap,
|
|
343
|
-
animated,
|
|
344
|
-
visible,
|
|
345
|
-
remainingColor,
|
|
346
|
-
}: {
|
|
347
|
-
diameter: number;
|
|
348
|
-
radius: number;
|
|
349
|
-
weight: CircularProgressWeight;
|
|
350
|
-
progress: number;
|
|
351
|
-
/** Already-resolved effective gap — see `effectiveGap` in CircularProgress. */
|
|
352
|
-
gap: number;
|
|
353
|
-
/** Indeterminate drives geometry per-frame; a CSS transition on top would
|
|
354
|
-
* just lag behind an already-moving target. */
|
|
355
|
-
animated: boolean;
|
|
356
|
-
visible: boolean;
|
|
357
|
-
remainingColor: string;
|
|
358
|
-
}) {
|
|
359
|
-
const circumference = 2 * Math.PI * radius;
|
|
360
|
-
const activeLength = (progress / 100) * circumference;
|
|
361
|
-
const dashLength = Math.max(0, circumference - activeLength - gap);
|
|
362
|
-
const dashOffset = -(activeLength + gap);
|
|
363
|
-
|
|
364
|
-
return (
|
|
365
|
-
<motion.svg
|
|
366
|
-
width={diameter}
|
|
367
|
-
height={diameter}
|
|
368
|
-
viewBox={`0 0 ${diameter} ${diameter}`}
|
|
369
|
-
animate={{ opacity: visible ? 1 : 0 }}
|
|
370
|
-
transition={FADE}
|
|
371
|
-
style={{
|
|
372
|
-
position: "absolute",
|
|
373
|
-
inset: 0,
|
|
374
|
-
transform: "rotate(-90deg)",
|
|
375
|
-
}}
|
|
376
|
-
>
|
|
377
|
-
<circle
|
|
378
|
-
cx={diameter / 2}
|
|
379
|
-
cy={diameter / 2}
|
|
380
|
-
r={radius}
|
|
381
|
-
fill="none"
|
|
382
|
-
stroke={remainingColor}
|
|
383
|
-
strokeLinecap="round"
|
|
384
|
-
style={{
|
|
385
|
-
strokeWidth: weight,
|
|
386
|
-
strokeDasharray: `${dashLength} ${circumference}`,
|
|
387
|
-
strokeDashoffset: dashOffset,
|
|
388
|
-
transition: animated
|
|
389
|
-
? `stroke-dasharray ${PROGRESS_TRANSITION}, stroke-dashoffset ${PROGRESS_TRANSITION}, stroke ${COLOR_TRANSITION}`
|
|
390
|
-
: `stroke ${COLOR_TRANSITION}`,
|
|
391
|
-
}}
|
|
392
|
-
/>
|
|
393
|
-
</motion.svg>
|
|
394
|
-
);
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
// CircularStopIndicator — the small dot marking the ring's 12 o'clock seam,
|
|
398
|
-
// where 0%/100% meet. Position is derived from the ring's own geometry, not
|
|
399
|
-
// a per-shape/weight lookup table: horizontally on the container's midline,
|
|
400
|
-
// vertically so the dot's CENTER lands on the stroke centerline's topmost
|
|
401
|
-
// point (diameter/2 - radius) — hence the half-dot back-off.
|
|
402
|
-
function CircularStopIndicator({
|
|
403
|
-
diameter,
|
|
404
|
-
radius,
|
|
405
|
-
visible,
|
|
406
|
-
activeColor,
|
|
407
|
-
}: {
|
|
408
|
-
diameter: number;
|
|
409
|
-
radius: number;
|
|
410
|
-
visible: boolean;
|
|
411
|
-
activeColor: string;
|
|
412
|
-
}) {
|
|
413
|
-
const top = diameter / 2 - radius - STOP_INDICATOR_SIZE / 2;
|
|
414
|
-
return (
|
|
415
|
-
<motion.span
|
|
416
|
-
aria-hidden="true"
|
|
417
|
-
style={{
|
|
418
|
-
position: "absolute",
|
|
419
|
-
top,
|
|
420
|
-
left: "50%",
|
|
421
|
-
transform: "translateX(-50%)",
|
|
422
|
-
borderRadius: "50%",
|
|
423
|
-
background: activeColor,
|
|
424
|
-
}}
|
|
425
|
-
animate={{
|
|
426
|
-
width: STOP_INDICATOR_SIZE,
|
|
427
|
-
height: STOP_INDICATOR_SIZE,
|
|
428
|
-
opacity: visible ? 1 : 0,
|
|
429
|
-
}}
|
|
430
|
-
transition={FADE}
|
|
431
|
-
/>
|
|
432
|
-
);
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
// =============================================================================
|
|
436
|
-
// MARK: Public component
|
|
437
|
-
// =============================================================================
|
|
438
|
-
|
|
439
|
-
const CircularProgress: React.FC<CircularProgressProps> = ({
|
|
440
|
-
progress = 0,
|
|
441
|
-
behavior = "determinate",
|
|
442
|
-
weight = 4,
|
|
443
|
-
variant = "default",
|
|
444
|
-
shape = "flat",
|
|
445
|
-
onComplete,
|
|
446
|
-
gap,
|
|
447
|
-
startActiveOffset,
|
|
448
|
-
showDot = true,
|
|
449
|
-
amplitude,
|
|
450
|
-
className,
|
|
451
|
-
style,
|
|
452
|
-
}) => {
|
|
453
|
-
const activeColor = activeColorFor(variant);
|
|
454
|
-
const remainingColor = remainingColorFor(variant);
|
|
455
|
-
|
|
456
|
-
const clamped = Math.min(100, Math.max(0, progress));
|
|
457
|
-
const complete = clamped >= 100;
|
|
458
|
-
|
|
459
|
-
// Edge-triggered: fires once per 0→100 crossing, not on every render at 100.
|
|
460
|
-
const wasCompleteRef = React.useRef(false);
|
|
461
|
-
React.useEffect(() => {
|
|
462
|
-
if (complete && !wasCompleteRef.current) onComplete?.();
|
|
463
|
-
wasCompleteRef.current = complete;
|
|
464
|
-
}, [complete, onComplete]);
|
|
465
|
-
|
|
466
|
-
const a11y = {
|
|
467
|
-
role: "progressbar" as const,
|
|
468
|
-
"aria-valuemin": 0,
|
|
469
|
-
"aria-valuemax": 100,
|
|
470
|
-
"aria-valuenow": clamped,
|
|
471
|
-
};
|
|
472
|
-
|
|
473
|
-
const indeterminate = behavior === "indeterminate";
|
|
474
|
-
const spin = useIndeterminateSpin(indeterminate);
|
|
475
|
-
// Indeterminate swaps in the spin's oscillating value and lets the rest of
|
|
476
|
-
// the geometry below run completely unchanged.
|
|
477
|
-
const activeProgress = indeterminate ? spin.progress : clamped;
|
|
478
|
-
|
|
479
|
-
// -- Geometry ------------------------------------------------------------
|
|
480
|
-
// Ring geometry stays keyed to the max/resting amplitude, not the
|
|
481
|
-
// runtime-flattened value below — otherwise the ring would visibly resize
|
|
482
|
-
// as amplitude flattens toward completion.
|
|
483
|
-
const amplitudeMax = amplitude ?? CIRCULAR_WAVE_AMPLITUDE;
|
|
484
|
-
const diameter = CIRCULAR_SIZE[shape][weight];
|
|
485
|
-
const radius =
|
|
486
|
-
shape === "wavy"
|
|
487
|
-
? (diameter - weight) / 2 - amplitudeMax
|
|
488
|
-
: (diameter - weight) / 2;
|
|
489
|
-
const circumference = 2 * Math.PI * radius;
|
|
490
|
-
|
|
491
|
-
// -- Completion sequence (determinate only) ------------------------------
|
|
492
|
-
const visualClamped = useEasedValue(clamped, PROGRESS_DURATION_MS);
|
|
493
|
-
const started = indeterminate ? true : visualClamped > 0;
|
|
494
|
-
const windingDown =
|
|
495
|
-
!indeterminate && visualClamped > CIRCULAR_WIND_DOWN_THRESHOLD;
|
|
496
|
-
// Epsilon guard on top of useEasedValue's exact final snap — float dust
|
|
497
|
-
// must never hold this at 99.999... and silently disable completion.
|
|
498
|
-
const reached = !indeterminate && visualClamped >= 100 - 1e-6;
|
|
499
|
-
// Once closed, the arc's start offset runs 0 → circumference and the arc
|
|
500
|
-
// retracts away to nothing.
|
|
501
|
-
const retractOffset = useRetract(reached, circumference, COMPLETE_RETRACT_MS);
|
|
502
|
-
// Amplitude flattens on the same clock/curve as the retract. Driven here
|
|
503
|
-
// rather than handed to Sinewave as a raw target, because the retract needs
|
|
504
|
-
// Sinewave's own tweens off (`instant` below) — and `instant` is
|
|
505
|
-
// all-or-nothing, so it would swallow the amplitude tween too and snap 2→0.
|
|
506
|
-
const amplitudeDrop = useRetract(reached, amplitudeMax, COMPLETE_FLATTEN_MS);
|
|
507
|
-
const waveAmplitude = amplitudeMax - amplitudeDrop;
|
|
508
|
-
|
|
509
|
-
// MARK: Arc model
|
|
510
|
-
// active: start = 0 + startActiveOffset end = natural mark, untouched
|
|
511
|
-
// remaining: start = natural mark + gap end = full circle, untouched
|
|
512
|
-
// Only the edge adjacent to the OTHER arc is ever trimmed. At 0% and 100%
|
|
513
|
-
// both offsets collapse to 0 — nothing left to trim against once the ring
|
|
514
|
-
// is fully empty or fully closed. At 100% the retract above then drives
|
|
515
|
-
// `startActiveOffset` back up from that 0.
|
|
516
|
-
const atZero = activeProgress <= 0;
|
|
517
|
-
const atFull = activeProgress >= 100;
|
|
518
|
-
const resolvedGap = gap ?? CIRCULAR_TRACK_GAP_PX[weight];
|
|
519
|
-
const resolvedStartActiveOffset =
|
|
520
|
-
startActiveOffset ?? CIRCULAR_TRACK_GAP_PX[weight];
|
|
521
|
-
const effectiveGap = atZero || atFull ? 0 : resolvedGap;
|
|
522
|
-
const effectiveStartActiveOffset = atZero
|
|
523
|
-
? 0
|
|
524
|
-
: atFull
|
|
525
|
-
? retractOffset
|
|
526
|
-
: resolvedStartActiveOffset;
|
|
527
|
-
|
|
528
|
-
// Flat works in px along the circumference, wavy in degrees — same model,
|
|
529
|
-
// converted with this ring's own circumference.
|
|
530
|
-
const naturalEndPx = (activeProgress / 100) * circumference;
|
|
531
|
-
// Flat's arc must be pulled entirely once this hits 0, not just left at zero
|
|
532
|
-
// length: a zero-length dash with a round linecap still paints — as a dot
|
|
533
|
-
// exactly one stroke-width across, in the active color, sitting right where
|
|
534
|
-
// the stop indicator does. That's what surfaces at the end of the retract.
|
|
535
|
-
// Wavy needs no equivalent; buildCircularPath returns "" at zero sweep.
|
|
536
|
-
const activeDash = Math.max(0, naturalEndPx - effectiveStartActiveOffset);
|
|
537
|
-
const activeDashOffset = -effectiveStartActiveOffset;
|
|
538
|
-
const startAngleDeg = (effectiveStartActiveOffset / circumference) * 360;
|
|
539
|
-
const naturalEndDeg = (activeProgress / 100) * 360;
|
|
540
|
-
|
|
541
|
-
// The retract and the indeterminate spin both drive geometry per-frame; a
|
|
542
|
-
// CSS transition (or Sinewave's own tween) layered on top would just lag
|
|
543
|
-
// behind an already-moving target.
|
|
544
|
-
const geometryAnimated = !indeterminate && !reached;
|
|
545
|
-
|
|
546
|
-
// -- Render --------------------------------------------------------------
|
|
547
|
-
return (
|
|
548
|
-
<div
|
|
549
|
-
{...a11y}
|
|
550
|
-
className={className}
|
|
551
|
-
style={{
|
|
552
|
-
position: "relative",
|
|
553
|
-
width: diameter,
|
|
554
|
-
height: diameter,
|
|
555
|
-
flexShrink: 0,
|
|
556
|
-
...style,
|
|
557
|
-
}}
|
|
558
|
-
>
|
|
559
|
-
{/* Indeterminate's rotation lives on its own wrapper so the caller's
|
|
560
|
-
`style` (which may carry its own transform) stays untouched. */}
|
|
561
|
-
<div
|
|
562
|
-
style={{
|
|
563
|
-
position: "absolute",
|
|
564
|
-
inset: 0,
|
|
565
|
-
transform: indeterminate ? `rotate(${spin.rotation}deg)` : undefined,
|
|
566
|
-
}}
|
|
567
|
-
>
|
|
568
|
-
<CircularRemainingRing
|
|
569
|
-
diameter={diameter}
|
|
570
|
-
radius={radius}
|
|
571
|
-
weight={weight}
|
|
572
|
-
progress={activeProgress}
|
|
573
|
-
gap={effectiveGap}
|
|
574
|
-
animated={geometryAnimated}
|
|
575
|
-
visible={!windingDown}
|
|
576
|
-
remainingColor={remainingColor}
|
|
577
|
-
/>
|
|
578
|
-
{showDot && !indeterminate && (
|
|
579
|
-
<CircularStopIndicator
|
|
580
|
-
diameter={diameter}
|
|
581
|
-
radius={radius}
|
|
582
|
-
visible={started && !windingDown}
|
|
583
|
-
activeColor={activeColor}
|
|
584
|
-
/>
|
|
585
|
-
)}
|
|
586
|
-
{/* Active arc — fades in from 0% on both shapes. */}
|
|
587
|
-
{shape === "wavy" ? (
|
|
588
|
-
<motion.div
|
|
589
|
-
animate={{ opacity: started ? 1 : 0 }}
|
|
590
|
-
transition={FADE}
|
|
591
|
-
style={{ position: "absolute", inset: 0 }}
|
|
592
|
-
>
|
|
593
|
-
<Sinewave
|
|
594
|
-
circular
|
|
595
|
-
size={diameter}
|
|
596
|
-
radius={radius}
|
|
597
|
-
startAngle={startAngleDeg}
|
|
598
|
-
sweepAngle={naturalEndDeg - startAngleDeg}
|
|
599
|
-
frequency={activeProgress * CIRCULAR_WAVE_FREQUENCY_PER_PERCENT}
|
|
600
|
-
amplitude={waveAmplitude}
|
|
601
|
-
strokeWidth={weight}
|
|
602
|
-
stroke={activeColor}
|
|
603
|
-
animate
|
|
604
|
-
instant={!geometryAnimated}
|
|
605
|
-
easing={PROGRESS_EASE_ARRAY}
|
|
606
|
-
duration={WAVE_DURATION}
|
|
607
|
-
style={{ margin: 0, minHeight: 0 }}
|
|
608
|
-
/>
|
|
609
|
-
</motion.div>
|
|
610
|
-
) : (
|
|
611
|
-
<motion.svg
|
|
612
|
-
width={diameter}
|
|
613
|
-
height={diameter}
|
|
614
|
-
viewBox={`0 0 ${diameter} ${diameter}`}
|
|
615
|
-
animate={{ opacity: started && activeDash > 0 ? 1 : 0 }}
|
|
616
|
-
transition={FADE}
|
|
617
|
-
style={{
|
|
618
|
-
position: "absolute",
|
|
619
|
-
inset: 0,
|
|
620
|
-
transform: "rotate(-90deg)",
|
|
621
|
-
}}
|
|
622
|
-
>
|
|
623
|
-
<circle
|
|
624
|
-
cx={diameter / 2}
|
|
625
|
-
cy={diameter / 2}
|
|
626
|
-
r={radius}
|
|
627
|
-
fill="none"
|
|
628
|
-
stroke={activeColor}
|
|
629
|
-
strokeLinecap="round"
|
|
630
|
-
style={{
|
|
631
|
-
strokeWidth: weight,
|
|
632
|
-
strokeDasharray: `${activeDash} ${circumference}`,
|
|
633
|
-
strokeDashoffset: activeDashOffset,
|
|
634
|
-
transition: geometryAnimated
|
|
635
|
-
? `stroke-dasharray ${PROGRESS_TRANSITION}, stroke-dashoffset ${PROGRESS_TRANSITION}, stroke-width ${COLOR_TRANSITION}, stroke ${COLOR_TRANSITION}`
|
|
636
|
-
: `stroke ${COLOR_TRANSITION}`,
|
|
637
|
-
}}
|
|
638
|
-
/>
|
|
639
|
-
</motion.svg>
|
|
640
|
-
)}
|
|
641
|
-
</div>
|
|
642
|
-
</div>
|
|
643
|
-
);
|
|
644
|
-
};
|
|
645
|
-
|
|
646
|
-
export default CircularProgress;
|