@mrpelz/uikit-ish 7.13.1 → 7.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accordion/style.css +0 -3
- package/dist/components/action-sheet/main.d.ts.map +1 -1
- package/dist/components/action-sheet/main.js +9 -6
- package/dist/components/action-sheet/main.js.map +1 -1
- package/dist/components/action-sheet/props.d.ts +2 -1
- package/dist/components/action-sheet/props.d.ts.map +1 -1
- package/dist/components/activity-view/style.css +17 -17
- package/dist/components/alert/main.d.ts.map +1 -1
- package/dist/components/alert/main.js +12 -4
- package/dist/components/alert/main.js.map +1 -1
- package/dist/components/alert/props.d.ts +2 -1
- package/dist/components/alert/props.d.ts.map +1 -1
- package/dist/components/alert/style.css +39 -15
- package/dist/components/avatar/style.css +2 -2
- package/dist/components/badge/style.css +1 -1
- package/dist/components/button/main.js +1 -1
- package/dist/components/button/main.js.map +1 -1
- package/dist/components/button/props.d.ts +3 -2
- package/dist/components/button/props.d.ts.map +1 -1
- package/dist/components/button/style.css +18 -29
- package/dist/components/card/buttons.d.ts +35 -0
- package/dist/components/card/buttons.d.ts.map +1 -0
- package/dist/components/card/buttons.js +60 -0
- package/dist/components/card/buttons.js.map +1 -0
- package/dist/components/card/channels.d.ts +43 -0
- package/dist/components/card/channels.d.ts.map +1 -0
- package/dist/components/card/channels.js +321 -0
- package/dist/components/card/channels.js.map +1 -0
- package/dist/components/card/color.d.ts +21 -0
- package/dist/components/card/color.d.ts.map +1 -0
- package/dist/components/card/color.js +100 -0
- package/dist/components/card/color.js.map +1 -0
- package/dist/components/card/main.d.ts +81 -0
- package/dist/components/card/main.d.ts.map +1 -0
- package/dist/components/card/main.js +91 -0
- package/dist/components/card/main.js.map +1 -0
- package/dist/components/card/parts.css +769 -0
- package/dist/components/card/press.d.ts +25 -0
- package/dist/components/card/press.d.ts.map +1 -0
- package/dist/components/card/press.js +111 -0
- package/dist/components/card/press.js.map +1 -0
- package/dist/components/card/progress.d.ts +43 -0
- package/dist/components/card/progress.d.ts.map +1 -0
- package/dist/components/card/progress.js +122 -0
- package/dist/components/card/progress.js.map +1 -0
- package/dist/components/card/props.d.ts +393 -0
- package/dist/components/card/props.d.ts.map +1 -0
- package/dist/components/card/props.js +2 -0
- package/dist/components/card/props.js.map +1 -0
- package/dist/components/card/root.d.ts +100 -0
- package/dist/components/card/root.d.ts.map +1 -0
- package/dist/components/card/root.js +388 -0
- package/dist/components/card/root.js.map +1 -0
- package/dist/components/card/rows.d.ts +19 -0
- package/dist/components/card/rows.d.ts.map +1 -0
- package/dist/components/card/rows.js +185 -0
- package/dist/components/card/rows.js.map +1 -0
- package/dist/components/card/segmented.d.ts +61 -0
- package/dist/components/card/segmented.d.ts.map +1 -0
- package/dist/components/card/segmented.js +289 -0
- package/dist/components/card/segmented.js.map +1 -0
- package/dist/components/card/shared.d.ts +55 -0
- package/dist/components/card/shared.d.ts.map +1 -0
- package/dist/components/card/shared.js +80 -0
- package/dist/components/card/shared.js.map +1 -0
- package/dist/components/card/slider.d.ts +16 -0
- package/dist/components/card/slider.d.ts.map +1 -0
- package/dist/components/card/slider.js +48 -0
- package/dist/components/card/slider.js.map +1 -0
- package/dist/components/card/stages.d.ts +18 -0
- package/dist/components/card/stages.d.ts.map +1 -0
- package/dist/components/card/stages.js +37 -0
- package/dist/components/card/stages.js.map +1 -0
- package/dist/components/card/style.css +959 -0
- package/dist/components/checkbox/style.css +10 -5
- package/dist/components/collapsible/style.css +0 -3
- package/dist/components/color-picker/color.d.ts +2 -2
- package/dist/components/color-picker/color.d.ts.map +1 -1
- package/dist/components/color-picker/color.js +7 -7
- package/dist/components/color-picker/color.js.map +1 -1
- package/dist/components/color-picker/main.d.ts +11 -5
- package/dist/components/color-picker/main.d.ts.map +1 -1
- package/dist/components/color-picker/main.js +147 -89
- package/dist/components/color-picker/main.js.map +1 -1
- package/dist/components/color-picker/props.d.ts +216 -6
- package/dist/components/color-picker/props.d.ts.map +1 -1
- package/dist/components/color-picker/style.css +12 -31
- package/dist/components/contextual-menu/main.d.ts +6 -2
- package/dist/components/contextual-menu/main.d.ts.map +1 -1
- package/dist/components/contextual-menu/main.js +67 -43
- package/dist/components/contextual-menu/main.js.map +1 -1
- package/dist/components/contextual-menu/props.d.ts +2 -1
- package/dist/components/contextual-menu/props.d.ts.map +1 -1
- package/dist/components/contextual-menu/style.css +64 -2
- package/dist/components/control-cards/main.d.ts +38 -0
- package/dist/components/control-cards/main.d.ts.map +1 -0
- package/dist/components/control-cards/main.js +196 -0
- package/dist/components/control-cards/main.js.map +1 -0
- package/dist/components/control-cards/props.d.ts +238 -0
- package/dist/components/control-cards/props.d.ts.map +1 -0
- package/dist/components/control-cards/props.js +2 -0
- package/dist/components/control-cards/props.js.map +1 -0
- package/dist/components/control-cards/style.css +2 -0
- package/dist/components/date-picker/main.d.ts +8 -3
- package/dist/components/date-picker/main.d.ts.map +1 -1
- package/dist/components/date-picker/main.js +73 -30
- package/dist/components/date-picker/main.js.map +1 -1
- package/dist/components/date-picker/pager.d.ts.map +1 -1
- package/dist/components/date-picker/pager.js +9 -2
- package/dist/components/date-picker/pager.js.map +1 -1
- package/dist/components/date-picker/props.d.ts +81 -5
- package/dist/components/date-picker/props.d.ts.map +1 -1
- package/dist/components/date-picker/style.css +25 -17
- package/dist/components/drawer/style.css +6 -0
- package/dist/components/edit-menu/main.d.ts +2 -1
- package/dist/components/edit-menu/main.d.ts.map +1 -1
- package/dist/components/edit-menu/main.js +8 -4
- package/dist/components/edit-menu/main.js.map +1 -1
- package/dist/components/edit-menu/style.css +2 -2
- package/dist/components/glass/backdrop.d.ts +75 -0
- package/dist/components/glass/backdrop.d.ts.map +1 -0
- package/dist/components/glass/backdrop.js +608 -0
- package/dist/components/glass/backdrop.js.map +1 -0
- package/dist/components/glass/gradient.d.ts +17 -0
- package/dist/components/glass/gradient.d.ts.map +1 -0
- package/dist/components/glass/gradient.js +233 -0
- package/dist/components/glass/gradient.js.map +1 -0
- package/dist/components/glass/main.d.ts +60 -6
- package/dist/components/glass/main.d.ts.map +1 -1
- package/dist/components/glass/main.js +100 -122
- package/dist/components/glass/main.js.map +1 -1
- package/dist/components/glass/marker.d.ts +66 -0
- package/dist/components/glass/marker.d.ts.map +1 -0
- package/dist/components/glass/marker.js +268 -0
- package/dist/components/glass/marker.js.map +1 -0
- package/dist/components/glass/props.d.ts +33 -7
- package/dist/components/glass/props.d.ts.map +1 -1
- package/dist/components/glass/style.css +172 -75
- package/dist/components/grid/dashes.d.ts +15 -0
- package/dist/components/grid/dashes.d.ts.map +1 -0
- package/dist/components/grid/dashes.js +37 -0
- package/dist/components/grid/dashes.js.map +1 -0
- package/dist/components/grid/edit.d.ts +11 -0
- package/dist/components/grid/edit.d.ts.map +1 -0
- package/dist/components/grid/edit.js +1066 -0
- package/dist/components/grid/edit.js.map +1 -0
- package/dist/components/grid/handle.d.ts +123 -0
- package/dist/components/grid/handle.d.ts.map +1 -0
- package/dist/components/grid/handle.js +194 -0
- package/dist/components/grid/handle.js.map +1 -0
- package/dist/components/grid/icons.d.ts +40 -0
- package/dist/components/grid/icons.d.ts.map +1 -0
- package/dist/components/grid/icons.js +140 -0
- package/dist/components/grid/icons.js.map +1 -0
- package/dist/components/grid/layout.d.ts +111 -0
- package/dist/components/grid/layout.d.ts.map +1 -0
- package/dist/components/grid/layout.js +1257 -0
- package/dist/components/grid/layout.js.map +1 -0
- package/dist/components/grid/main.d.ts +63 -0
- package/dist/components/grid/main.d.ts.map +1 -0
- package/dist/components/grid/main.js +1977 -0
- package/dist/components/grid/main.js.map +1 -0
- package/dist/components/grid/overlay.d.ts +24 -0
- package/dist/components/grid/overlay.d.ts.map +1 -0
- package/dist/components/grid/overlay.js +312 -0
- package/dist/components/grid/overlay.js.map +1 -0
- package/dist/components/grid/plan.d.ts +78 -0
- package/dist/components/grid/plan.d.ts.map +1 -0
- package/dist/components/grid/plan.js +249 -0
- package/dist/components/grid/plan.js.map +1 -0
- package/dist/components/grid/props.d.ts +579 -0
- package/dist/components/grid/props.d.ts.map +1 -0
- package/dist/components/grid/props.js +2 -0
- package/dist/components/grid/props.js.map +1 -0
- package/dist/components/grid/reshape.d.ts +60 -0
- package/dist/components/grid/reshape.d.ts.map +1 -0
- package/dist/components/grid/reshape.js +214 -0
- package/dist/components/grid/reshape.js.map +1 -0
- package/dist/components/grid/style.css +1323 -0
- package/dist/components/header/main.d.ts.map +1 -1
- package/dist/components/header/main.js +97 -10
- package/dist/components/header/main.js.map +1 -1
- package/dist/components/header/props.d.ts +2 -2
- package/dist/components/header/props.d.ts.map +1 -1
- package/dist/components/header/style.css +40 -49
- package/dist/components/index.d.ts +16 -10
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +11 -5
- package/dist/components/index.js.map +1 -1
- package/dist/components/island/main.d.ts +2 -2
- package/dist/components/island/main.d.ts.map +1 -1
- package/dist/components/island/main.js +193 -41
- package/dist/components/island/main.js.map +1 -1
- package/dist/components/island/props.d.ts +4 -2
- package/dist/components/island/props.d.ts.map +1 -1
- package/dist/components/island/style.css +50 -3
- package/dist/components/layout/main.d.ts +3 -6
- package/dist/components/layout/main.d.ts.map +1 -1
- package/dist/components/layout/main.js +225 -56
- package/dist/components/layout/main.js.map +1 -1
- package/dist/components/layout/props.d.ts +43 -2
- package/dist/components/layout/props.d.ts.map +1 -1
- package/dist/components/layout/style.css +81 -23
- package/dist/components/list/main.d.ts +8 -6
- package/dist/components/list/main.d.ts.map +1 -1
- package/dist/components/list/main.js +132 -24
- package/dist/components/list/main.js.map +1 -1
- package/dist/components/list/props.d.ts +25 -0
- package/dist/components/list/props.d.ts.map +1 -1
- package/dist/components/list/reorder.d.ts +50 -2
- package/dist/components/list/reorder.d.ts.map +1 -1
- package/dist/components/list/reorder.js +40 -17
- package/dist/components/list/reorder.js.map +1 -1
- package/dist/components/list/style.css +160 -75
- package/dist/components/menu/main.d.ts +9 -5
- package/dist/components/menu/main.d.ts.map +1 -1
- package/dist/components/menu/main.js +87 -9
- package/dist/components/menu/main.js.map +1 -1
- package/dist/components/menu/props.d.ts +14 -0
- package/dist/components/menu/props.d.ts.map +1 -1
- package/dist/components/menu/style.css +41 -31
- package/dist/components/navigation/main.d.ts.map +1 -1
- package/dist/components/navigation/main.js +35 -13
- package/dist/components/navigation/main.js.map +1 -1
- package/dist/components/navigation/style.css +7 -0
- package/dist/components/page/main.d.ts.map +1 -1
- package/dist/components/page/main.js +6 -3
- package/dist/components/page/main.js.map +1 -1
- package/dist/components/page/props.d.ts +3 -2
- package/dist/components/page/props.d.ts.map +1 -1
- package/dist/components/page/style.css +8 -4
- package/dist/components/page-control/main.d.ts.map +1 -1
- package/dist/components/page-control/main.js +32 -15
- package/dist/components/page-control/main.js.map +1 -1
- package/dist/components/page-control/props.d.ts +9 -3
- package/dist/components/page-control/props.d.ts.map +1 -1
- package/dist/components/page-control/style.css +36 -0
- package/dist/components/pager/main.d.ts +12 -0
- package/dist/components/pager/main.d.ts.map +1 -0
- package/dist/components/pager/main.js +368 -0
- package/dist/components/pager/main.js.map +1 -0
- package/dist/components/pager/props.d.ts +36 -0
- package/dist/components/pager/props.d.ts.map +1 -0
- package/dist/components/pager/props.js +2 -0
- package/dist/components/pager/props.js.map +1 -0
- package/dist/components/pager/style.css +42 -0
- package/dist/components/popover/main.d.ts +10 -4
- package/dist/components/popover/main.d.ts.map +1 -1
- package/dist/components/popover/main.js +30 -19
- package/dist/components/popover/main.js.map +1 -1
- package/dist/components/popover/props.d.ts +2 -0
- package/dist/components/popover/props.d.ts.map +1 -1
- package/dist/components/popover/style.css +6 -2
- package/dist/components/progress/main.d.ts.map +1 -1
- package/dist/components/progress/main.js +3 -2
- package/dist/components/progress/main.js.map +1 -1
- package/dist/components/progress/style.css +4 -10
- package/dist/components/roll/main.d.ts.map +1 -1
- package/dist/components/roll/main.js +5 -3
- package/dist/components/roll/main.js.map +1 -1
- package/dist/components/roll/style.css +2 -2
- package/dist/components/segmented/main.d.ts.map +1 -1
- package/dist/components/segmented/main.js +4 -4
- package/dist/components/segmented/main.js.map +1 -1
- package/dist/components/segmented/props.d.ts +5 -2
- package/dist/components/segmented/props.d.ts.map +1 -1
- package/dist/components/segmented/style.css +17 -8
- package/dist/components/settings/main.d.ts +48 -1
- package/dist/components/settings/main.d.ts.map +1 -1
- package/dist/components/settings/main.js +311 -66
- package/dist/components/settings/main.js.map +1 -1
- package/dist/components/settings/props.d.ts +46 -4
- package/dist/components/settings/props.d.ts.map +1 -1
- package/dist/components/settings/region.d.ts +3 -0
- package/dist/components/settings/region.d.ts.map +1 -0
- package/dist/components/settings/region.js +120 -0
- package/dist/components/settings/region.js.map +1 -0
- package/dist/components/settings/style.css +2 -2
- package/dist/components/sheet/main.d.ts.map +1 -1
- package/dist/components/sheet/main.js +156 -45
- package/dist/components/sheet/main.js.map +1 -1
- package/dist/components/sheet/props.d.ts +4 -2
- package/dist/components/sheet/props.d.ts.map +1 -1
- package/dist/components/sheet/snap.d.ts +54 -0
- package/dist/components/sheet/snap.d.ts.map +1 -1
- package/dist/components/sheet/snap.js +261 -23
- package/dist/components/sheet/snap.js.map +1 -1
- package/dist/components/sheet/style.css +171 -20
- package/dist/components/sidebar/main.d.ts +2 -1
- package/dist/components/sidebar/main.d.ts.map +1 -1
- package/dist/components/sidebar/main.js +18 -6
- package/dist/components/sidebar/main.js.map +1 -1
- package/dist/components/sidebar/props.d.ts +2 -1
- package/dist/components/sidebar/props.d.ts.map +1 -1
- package/dist/components/sidebar/style.css +78 -0
- package/dist/components/slider/main.d.ts.map +1 -1
- package/dist/components/slider/main.js +55 -10
- package/dist/components/slider/main.js.map +1 -1
- package/dist/components/slider/props.d.ts +1 -0
- package/dist/components/slider/props.d.ts.map +1 -1
- package/dist/components/slider/style.css +15 -6
- package/dist/components/stack/main.d.ts +8 -0
- package/dist/components/stack/main.d.ts.map +1 -0
- package/dist/components/stack/main.js +25 -0
- package/dist/components/stack/main.js.map +1 -0
- package/dist/components/stack/props.d.ts +42 -0
- package/dist/components/stack/props.d.ts.map +1 -0
- package/dist/components/stack/props.js +2 -0
- package/dist/components/stack/props.js.map +1 -0
- package/dist/components/stack/style.css +68 -0
- package/dist/components/stepper/main.d.ts +3 -1
- package/dist/components/stepper/main.d.ts.map +1 -1
- package/dist/components/stepper/main.js +4 -0
- package/dist/components/stepper/main.js.map +1 -1
- package/dist/components/stepper/style.css +2 -2
- package/dist/components/switch/main.d.ts.map +1 -1
- package/dist/components/switch/main.js +9 -3
- package/dist/components/switch/main.js.map +1 -1
- package/dist/components/switch/props.d.ts +4 -1
- package/dist/components/switch/props.d.ts.map +1 -1
- package/dist/components/symbol/main.d.ts.map +1 -1
- package/dist/components/symbol/main.js +5 -1
- package/dist/components/symbol/main.js.map +1 -1
- package/dist/components/symbol/props.d.ts +10 -0
- package/dist/components/symbol/props.d.ts.map +1 -1
- package/dist/components/symbol/style.css +21 -3
- package/dist/components/tab-bar/main.d.ts.map +1 -1
- package/dist/components/tab-bar/main.js +8 -5
- package/dist/components/tab-bar/main.js.map +1 -1
- package/dist/components/tab-bar/props.d.ts +16 -12
- package/dist/components/tab-bar/props.d.ts.map +1 -1
- package/dist/components/tab-bar/style.css +38 -21
- package/dist/components/text-field/main.d.ts.map +1 -1
- package/dist/components/text-field/main.js +6 -3
- package/dist/components/text-field/main.js.map +1 -1
- package/dist/components/text-field/style.css +28 -17
- package/dist/components/toolbar/main.d.ts +5 -2
- package/dist/components/toolbar/main.d.ts.map +1 -1
- package/dist/components/toolbar/main.js +19 -1
- package/dist/components/toolbar/main.js.map +1 -1
- package/dist/components/toolbar/props.d.ts +18 -3
- package/dist/components/toolbar/props.d.ts.map +1 -1
- package/dist/components/toolbar/style.css +127 -11
- package/dist/components/tooltip/main.d.ts +6 -1
- package/dist/components/tooltip/main.d.ts.map +1 -1
- package/dist/components/tooltip/main.js +13 -7
- package/dist/components/tooltip/main.js.map +1 -1
- package/dist/components/tooltip/style.css +2 -2
- package/dist/components/typography/main.d.ts +1 -0
- package/dist/components/typography/main.d.ts.map +1 -1
- package/dist/components/typography/main.js +1 -0
- package/dist/components/typography/main.js.map +1 -1
- package/dist/components/typography/sizes.css +456 -0
- package/dist/components/typography/style.css +24 -456
- package/dist/components/utils/main.d.ts +50 -4
- package/dist/components/utils/main.d.ts.map +1 -1
- package/dist/components/utils/main.js +113 -3
- package/dist/components/utils/main.js.map +1 -1
- package/dist/components/viewport/current.d.ts +15 -0
- package/dist/components/viewport/current.d.ts.map +1 -0
- package/dist/components/viewport/current.js +74 -0
- package/dist/components/viewport/current.js.map +1 -0
- package/dist/components/viewport/edge-effect.d.ts.map +1 -1
- package/dist/components/viewport/edge-effect.js +58 -26
- package/dist/components/viewport/edge-effect.js.map +1 -1
- package/dist/components/viewport/edge.d.ts +7 -4
- package/dist/components/viewport/edge.d.ts.map +1 -1
- package/dist/components/viewport/edge.js +21 -7
- package/dist/components/viewport/edge.js.map +1 -1
- package/dist/components/viewport/focus-scroll.d.ts +21 -0
- package/dist/components/viewport/focus-scroll.d.ts.map +1 -0
- package/dist/components/viewport/focus-scroll.js +273 -0
- package/dist/components/viewport/focus-scroll.js.map +1 -0
- package/dist/components/viewport/input.d.ts +39 -1
- package/dist/components/viewport/input.d.ts.map +1 -1
- package/dist/components/viewport/input.js +122 -13
- package/dist/components/viewport/input.js.map +1 -1
- package/dist/components/viewport/main.d.ts +16 -1
- package/dist/components/viewport/main.d.ts.map +1 -1
- package/dist/components/viewport/main.js +276 -50
- package/dist/components/viewport/main.js.map +1 -1
- package/dist/components/viewport/padding.d.ts +1 -1
- package/dist/components/viewport/padding.d.ts.map +1 -1
- package/dist/components/viewport/padding.js +2 -2
- package/dist/components/viewport/props.d.ts +12 -2
- package/dist/components/viewport/props.d.ts.map +1 -1
- package/dist/components/viewport/status-bar.d.ts +9 -0
- package/dist/components/viewport/status-bar.d.ts.map +1 -0
- package/dist/components/viewport/status-bar.js +131 -0
- package/dist/components/viewport/status-bar.js.map +1 -0
- package/dist/components/viewport/style.css +67 -16
- package/dist/styles.css +371 -279
- package/package.json +5 -4
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { CardFormat, CardRootProps } from '../card/main.js';
|
|
3
|
+
import type { SymbolIcon } from '../symbol/main.js';
|
|
4
|
+
/**
|
|
5
|
+
* What every control card takes: a `Card.Root`'s props (`context`,
|
|
6
|
+
* `actionsRef`, `className`…), its label, its symbol, and what's added to
|
|
7
|
+
* its parts (`children`: e.g. a corner button, after them; a composed
|
|
8
|
+
* card's own parts).
|
|
9
|
+
*/
|
|
10
|
+
export type ControlCardProps = Omit<CardRootProps, 'children'> & {
|
|
11
|
+
/**
|
|
12
|
+
* What's added after its parts (e.g. a `Card.ExpandButton`); a composed
|
|
13
|
+
* card's (a progress, stages, a light, rows) its parts too.
|
|
14
|
+
*/
|
|
15
|
+
children?: ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Its symbol's icon while on (e.g. filled), its `icon` while off (e.g.
|
|
18
|
+
* outlined), see `Symbol`. Without one, its `icon` always.
|
|
19
|
+
*/
|
|
20
|
+
emphasizedIcon?: SymbolIcon;
|
|
21
|
+
/** Its symbol's icon (e.g. outlined, for a card switched on and off). */
|
|
22
|
+
icon: SymbolIcon;
|
|
23
|
+
/**
|
|
24
|
+
* What it is (e.g. a device's name): its title, and its controls'
|
|
25
|
+
* accessible name.
|
|
26
|
+
*/
|
|
27
|
+
label: string;
|
|
28
|
+
};
|
|
29
|
+
/** Words for a state, on and off (e.g. `['Open', 'Closed']`). */
|
|
30
|
+
export type ControlCardStates = readonly [on: string, off: string];
|
|
31
|
+
/** What a card's value text is told (see `getValueText`). */
|
|
32
|
+
export type ControlCardValueTextDetails = {
|
|
33
|
+
/** Whether it's on; without a switch, `undefined`. */
|
|
34
|
+
checked: boolean | undefined;
|
|
35
|
+
/** Its words for on and off (see `states`). */
|
|
36
|
+
states: ControlCardStates;
|
|
37
|
+
};
|
|
38
|
+
/** A card's value text (see `getValueText`): what's shown, and read. */
|
|
39
|
+
export type ControlCardGetValueText = (formattedValue: string, value: number, details: ControlCardValueTextDetails) => string;
|
|
40
|
+
export type ControlCardStateProps = ControlCardProps & {
|
|
41
|
+
/** Whether it's on (lit, its emphasized icon): e.g. a door open. */
|
|
42
|
+
active: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Its value's words, on and off.
|
|
45
|
+
* @default ['On', 'Off']
|
|
46
|
+
*/
|
|
47
|
+
states?: ControlCardStates;
|
|
48
|
+
};
|
|
49
|
+
export type ControlCardSwitchProps = ControlCardProps & {
|
|
50
|
+
/** Whether it's on (controlled). */
|
|
51
|
+
checked?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Whether it's on at first (uncontrolled).
|
|
54
|
+
* @default false
|
|
55
|
+
*/
|
|
56
|
+
defaultChecked?: boolean;
|
|
57
|
+
/** Whether its switch takes no input (the card's presses neither). */
|
|
58
|
+
disabled?: boolean;
|
|
59
|
+
/** As it's switched (by its switch, or a press on the card). */
|
|
60
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
61
|
+
/**
|
|
62
|
+
* Its value's words, on and off.
|
|
63
|
+
* @default ['On', 'Off']
|
|
64
|
+
*/
|
|
65
|
+
states?: ControlCardStates;
|
|
66
|
+
/**
|
|
67
|
+
* Its tint (a CSS color): its symbol's and its switch's while on.
|
|
68
|
+
* @default the switch's on color (green)
|
|
69
|
+
*/
|
|
70
|
+
tint?: string;
|
|
71
|
+
};
|
|
72
|
+
export type ControlCardValueProps = ControlCardProps & CardFormat & {
|
|
73
|
+
/**
|
|
74
|
+
* Its trend: an arrow after its value (a `Card.Trend`), pointing up as
|
|
75
|
+
* steeply as it rises (-90 to 90 degrees, 0 steady). None, no arrow.
|
|
76
|
+
*/
|
|
77
|
+
trend?: number;
|
|
78
|
+
/** Its number (formatted, see `format`), or what's shown instead. */
|
|
79
|
+
value: number | ReactNode;
|
|
80
|
+
};
|
|
81
|
+
export type ControlCardSliderProps = ControlCardProps & CardFormat & {
|
|
82
|
+
/**
|
|
83
|
+
* It controls a brightness (e.g. a dimmer): its glass dark in both
|
|
84
|
+
* color schemes (its fill telling how much light), its symbol on (its
|
|
85
|
+
* emphasized icon) above its minimum, while on. Else, its glass
|
|
86
|
+
* follows the color scheme (e.g. blinds).
|
|
87
|
+
* @default false
|
|
88
|
+
*/
|
|
89
|
+
brightness?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Whether it's on (controlled): a switch at its top trailing corner,
|
|
92
|
+
* and a click on it (not a drag) toggling it. Its value kept either
|
|
93
|
+
* way (how the two go together is the app's, e.g. on at its minimum,
|
|
94
|
+
* at its maximum); off, its fill not drawn, a dashed line where it'd
|
|
95
|
+
* end (see `Card`). Neither this nor `defaultChecked`: no switch.
|
|
96
|
+
*/
|
|
97
|
+
checked?: boolean;
|
|
98
|
+
/** Whether it's on at first (uncontrolled; a switch, see `checked`). */
|
|
99
|
+
defaultChecked?: boolean;
|
|
100
|
+
/** Its value at first (uncontrolled). */
|
|
101
|
+
defaultValue?: number;
|
|
102
|
+
/** Whether it takes no input (its slider, its switch). */
|
|
103
|
+
disabled?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Its value's text (its value line, and what assistive technology reads),
|
|
106
|
+
* from its formatted number (see `format`), its number, and whether it's
|
|
107
|
+
* on (see `states`).
|
|
108
|
+
* @default with a switch, its state's word and its number (“On · 60%”,
|
|
109
|
+
* “Off · 60%”); without one, its number
|
|
110
|
+
*/
|
|
111
|
+
getValueText?: ControlCardGetValueText;
|
|
112
|
+
/**
|
|
113
|
+
* Its greatest value.
|
|
114
|
+
* @default 100
|
|
115
|
+
*/
|
|
116
|
+
max?: number;
|
|
117
|
+
/**
|
|
118
|
+
* Its least value.
|
|
119
|
+
* @default 0
|
|
120
|
+
*/
|
|
121
|
+
min?: number;
|
|
122
|
+
/** As it's switched (see `checked`). */
|
|
123
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
124
|
+
/** As its value changes, dragged (or by keyboard). */
|
|
125
|
+
onValueChange?: (value: number) => void;
|
|
126
|
+
/**
|
|
127
|
+
* Its value's words, on and off, with a switch (see `getValueText`).
|
|
128
|
+
* @default ['On', 'Off']
|
|
129
|
+
*/
|
|
130
|
+
states?: ControlCardStates;
|
|
131
|
+
/**
|
|
132
|
+
* Its values' step: given, a tick at each (none: continuous).
|
|
133
|
+
* @default none (continuous: 1/100 of its range)
|
|
134
|
+
*/
|
|
135
|
+
step?: number;
|
|
136
|
+
/**
|
|
137
|
+
* Its fill's color: opaque, any color (its text drawn again over it,
|
|
138
|
+
* dark on a bright fill, light on a dim one).
|
|
139
|
+
* @default the app's tint
|
|
140
|
+
*/
|
|
141
|
+
tint?: string;
|
|
142
|
+
/** Its value (controlled). */
|
|
143
|
+
value?: number;
|
|
144
|
+
};
|
|
145
|
+
export type ControlCardButtonProps = ControlCardProps & {
|
|
146
|
+
/** A badge on its symbol (e.g. a count, a `Badge`'s); none, none. */
|
|
147
|
+
badge?: ReactNode;
|
|
148
|
+
/** Its value's words (e.g. when it last rang). */
|
|
149
|
+
status?: ReactNode;
|
|
150
|
+
};
|
|
151
|
+
export type ControlCardProgressProps = ControlCardProps & {
|
|
152
|
+
/** Whether it's on (lit, its emphasized icon). */
|
|
153
|
+
active?: boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Its parts: a `Card.Progress` (its value) holding a `Card.Subtitle`, a
|
|
156
|
+
* `Card.ProgressValue`, a `Card.ProgressBar`, as the app shows them; and
|
|
157
|
+
* what's added (e.g. a corner button).
|
|
158
|
+
*/
|
|
159
|
+
children?: ReactNode;
|
|
160
|
+
/**
|
|
161
|
+
* Its symbol's color while it's on, and its bar's fill's (unless the
|
|
162
|
+
* bar's own `tint`).
|
|
163
|
+
* @default the app's tint
|
|
164
|
+
*/
|
|
165
|
+
tint?: string;
|
|
166
|
+
};
|
|
167
|
+
export type ControlCardStagesProps = ControlCardProps & {
|
|
168
|
+
/** Whether it's on (lit, its emphasized icon), e.g. while it runs. */
|
|
169
|
+
active?: boolean;
|
|
170
|
+
/**
|
|
171
|
+
* Its parts: e.g. a `Card.Subtitle`, a `Card.StageList`; and what's added
|
|
172
|
+
* (e.g. a corner button).
|
|
173
|
+
*/
|
|
174
|
+
children: ReactNode;
|
|
175
|
+
/**
|
|
176
|
+
* Its symbol's color while it's on, and its stages' (unless the list's
|
|
177
|
+
* own `tint`).
|
|
178
|
+
* @default the app's tint
|
|
179
|
+
*/
|
|
180
|
+
tint?: string;
|
|
181
|
+
};
|
|
182
|
+
export type ControlCardLightProps = ControlCardProps & CardFormat & {
|
|
183
|
+
/** Whether it's on (controlled). */
|
|
184
|
+
checked?: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Its parts: its `Card.Channels`, shown large (expanded, resized,
|
|
187
|
+
* opened); and what's added (e.g. a corner button).
|
|
188
|
+
*/
|
|
189
|
+
children?: ReactNode;
|
|
190
|
+
/**
|
|
191
|
+
* Whether it's on at first (uncontrolled).
|
|
192
|
+
* @default false
|
|
193
|
+
*/
|
|
194
|
+
defaultChecked?: boolean;
|
|
195
|
+
/** Whether its switch takes no input (the card's presses neither). */
|
|
196
|
+
disabled?: boolean;
|
|
197
|
+
/**
|
|
198
|
+
* Its value's text (its value line), the app's: from its brightness
|
|
199
|
+
* formatted (see `format`; its strongest amount channel's share), its
|
|
200
|
+
* brightness, and whether it's on (see `states`).
|
|
201
|
+
* @default on, its brightness (“60%”); off, its off word (“Off”)
|
|
202
|
+
*/
|
|
203
|
+
getValueText?: ControlCardGetValueText;
|
|
204
|
+
/** As it's switched. */
|
|
205
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
206
|
+
/**
|
|
207
|
+
* Its value's words, on and off (see `getValueText`).
|
|
208
|
+
* @default ['On', 'Off']
|
|
209
|
+
*/
|
|
210
|
+
states?: ControlCardStates;
|
|
211
|
+
};
|
|
212
|
+
export type ControlCardListProps = ControlCardProps & {
|
|
213
|
+
/**
|
|
214
|
+
* Its parts: its `Card.Rows` (as many as fit shown; rows left out,
|
|
215
|
+
* expanding or opening its tile, see `Card.Rows`); and what's added (e.g.
|
|
216
|
+
* a `Card.ExpandButton`, a `Card.CloseButton`).
|
|
217
|
+
*/
|
|
218
|
+
children?: ReactNode;
|
|
219
|
+
/** Its value's words, under its title (none: none). */
|
|
220
|
+
status?: ReactNode;
|
|
221
|
+
};
|
|
222
|
+
export type ControlCardSegmentedProps = ControlCardProps & {
|
|
223
|
+
/**
|
|
224
|
+
* Its parts: its `Card.Segmented` (its options, its value); and what's
|
|
225
|
+
* added (e.g. a `Card.OpenButton` for its 1x1 size, a `Card.CloseButton`).
|
|
226
|
+
* Its symbol and value its chosen option's.
|
|
227
|
+
*/
|
|
228
|
+
children: ReactNode;
|
|
229
|
+
/**
|
|
230
|
+
* The option (or options) that's off: chosen, the card isn't lit (its
|
|
231
|
+
* dark glass); any other, it is (e.g. `['off', 'away']`). None: as its
|
|
232
|
+
* glass is (never lit).
|
|
233
|
+
*/
|
|
234
|
+
offValue?: string | readonly string[];
|
|
235
|
+
/** Its symbol's tint (an option's own instead, while it's chosen). */
|
|
236
|
+
tint?: string;
|
|
237
|
+
};
|
|
238
|
+
//# sourceMappingURL=props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/components/control-cards/props.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.js","sourceRoot":"","sources":["../../../src/components/control-cards/props.tsx"],"names":[],"mappings":""}
|
|
@@ -5,8 +5,13 @@ import '../typography/style.css';
|
|
|
5
5
|
import './style.css';
|
|
6
6
|
import { FunctionComponent, ReactNode } from 'react';
|
|
7
7
|
import { ButtonRootProps } from '../button/main.js';
|
|
8
|
-
import type { CalendarFooter, CalendarMessageProps, CalendarProps, DatePickerExpandableProps, DatePickerProps, TimeRollProps } from './props.js';
|
|
9
|
-
export type { CalendarFooter, CalendarMessageProps, CalendarProps, CalendarSwipe, DatePickerChangeEventDetails, DatePickerExpandableProps, DatePickerMode, DatePickerOpen, DatePickerOpenChangeEventDetails, DatePickerProps, DatePickerStyle, DateRange, DayHighlight, DayHighlights, HourCycle, TimeRollProps, } from './props.js';
|
|
8
|
+
import type { CalendarFooter, CalendarMessageProps, CalendarProps, DatePickerExpandableProps, DatePickerLabels, DatePickerProps, TimeRollProps } from './props.js';
|
|
9
|
+
export type { CalendarFooter, CalendarMessageProps, CalendarProps, CalendarSwipe, DatePickerCalendarLabels, DatePickerChangeEventDetails, DatePickerExpandableProps, DatePickerLabels, DatePickerMode, DatePickerOpen, DatePickerOpenChangeEventDetails, DatePickerOwnLabels, DatePickerProps, DatePickerStyle, DatePickerTimeLabels, DateRange, DayHighlight, DayHighlights, HourCycle, TimeRollProps, } from './props.js';
|
|
10
|
+
/**
|
|
11
|
+
* A picker's built-in words, for assistive technology (English): the
|
|
12
|
+
* defaults of every part's `…Label` props (see `DatePickerLabels`).
|
|
13
|
+
*/
|
|
14
|
+
export declare const datePickerLabels: Required<DatePickerLabels>;
|
|
10
15
|
export { DatePickerHandle, useCreateDatePickerHandle } from './handle.js';
|
|
11
16
|
export declare const DatePicker: {
|
|
12
17
|
Root: FunctionComponent<DatePickerProps>;
|
|
@@ -27,7 +32,7 @@ export declare const DatePicker: {
|
|
|
27
32
|
calendar: CalendarFooter;
|
|
28
33
|
/**
|
|
29
34
|
* The row's title.
|
|
30
|
-
* @default
|
|
35
|
+
* @default its picker's `timeLabel` (see `datePickerLabels`)
|
|
31
36
|
*/
|
|
32
37
|
label?: ReactNode;
|
|
33
38
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/components/date-picker/main.tsx"],"names":[],"mappings":"AACA,OAAO,qBAAqB,CAAC;AAC7B,OAAO,sBAAsB,CAAC;AAC9B,OAAO,mBAAmB,CAAC;AAC3B,OAAO,yBAAyB,CAAC;AACjC,OAAO,aAAa,CAAC;AAIrB,OAAO,EAML,iBAAiB,EAIjB,SAAS,
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/components/date-picker/main.tsx"],"names":[],"mappings":"AACA,OAAO,qBAAqB,CAAC;AAC7B,OAAO,sBAAsB,CAAC;AAC9B,OAAO,mBAAmB,CAAC;AAC3B,OAAO,yBAAyB,CAAC;AACjC,OAAO,aAAa,CAAC;AAIrB,OAAO,EAML,iBAAiB,EAIjB,SAAS,EASV,MAAM,OAAO,CAAC;AAEf,OAAO,EAAU,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAQ5D,OAAO,KAAK,EACV,cAAc,EAEd,oBAAoB,EACpB,aAAa,EAGb,yBAAyB,EACzB,gBAAgB,EAIhB,eAAe,EAMf,aAAa,EACd,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,wBAAwB,EACxB,4BAA4B,EAC5B,yBAAyB,EACzB,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,gCAAgC,EAChC,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,SAAS,EACT,YAAY,EACZ,aAAa,EACb,SAAS,EACT,aAAa,GACd,MAAM,YAAY,CAAC;AA6EpB;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB,CAWvD,CAAC;AAq2DF,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAE1E,eAAO,MAAM,UAAU;;;;;gBAzkBqC,MAAM;;;;;;gBAhrCtD,eAAe,CAAC,aAAa,CAAC;;;;;kBAspC9B,cAAc;QACxB;;;WAGG;gBACK,SAAS;;;;;;CAwmBlB,CAAC"}
|
|
@@ -6,12 +6,13 @@ import '../roll/style.css';
|
|
|
6
6
|
import '../typography/style.css';
|
|
7
7
|
import './style.css';
|
|
8
8
|
import { Field as BaseField } from '@base-ui/react/field';
|
|
9
|
-
import { forwardRef, Fragment, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore, } from 'react';
|
|
9
|
+
import { forwardRef, Fragment, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore, } from 'react';
|
|
10
10
|
import { Button } from '../button/main.js';
|
|
11
11
|
import { List, useCollapsible, useExpandedOpen } from '../list/main.js';
|
|
12
12
|
import { Popover } from '../popover/main.js';
|
|
13
13
|
import { Roll } from '../roll/main.js';
|
|
14
|
-
import {
|
|
14
|
+
import { useLocale, useSettings } from '../settings/main.js';
|
|
15
|
+
import { cn, createLabels, reducedMotionOf } from '../utils/main.js';
|
|
15
16
|
import { createHandle } from './handle.js';
|
|
16
17
|
import { useMonthPager } from './pager.js';
|
|
17
18
|
// Collapsed buttons (default and selected) and pickers (inline and
|
|
@@ -67,6 +68,24 @@ const clampDay = (date, min, max) => {
|
|
|
67
68
|
return startOfDay(max);
|
|
68
69
|
return date;
|
|
69
70
|
};
|
|
71
|
+
/**
|
|
72
|
+
* A picker's built-in words, for assistive technology (English): the
|
|
73
|
+
* defaults of every part's `…Label` props (see `DatePickerLabels`).
|
|
74
|
+
*/
|
|
75
|
+
export const datePickerLabels = {
|
|
76
|
+
dateAndTimeLabel: 'Date and time',
|
|
77
|
+
dateLabel: 'Date',
|
|
78
|
+
dayPeriodLabel: 'AM/PM',
|
|
79
|
+
hoursLabel: 'Hours',
|
|
80
|
+
minutesLabel: 'Minutes',
|
|
81
|
+
monthLabel: 'Month',
|
|
82
|
+
nextMonthLabel: 'Next month',
|
|
83
|
+
previousMonthLabel: 'Previous month',
|
|
84
|
+
timeLabel: 'Time',
|
|
85
|
+
yearLabel: 'Year',
|
|
86
|
+
};
|
|
87
|
+
/** A picker's words (see `Root`), for its parts within; a part's own. */
|
|
88
|
+
const { LabelsContext, useLabels } = createLabels(datePickerLabels);
|
|
70
89
|
const isSelectable = (date, min, max) => (!min || date >= startOfDay(min)) && (!max || date <= startOfDay(max));
|
|
71
90
|
// The week's first day (0: Sunday) in a locale, where `Intl` knows it.
|
|
72
91
|
const firstDayOfWeek = (locale) => {
|
|
@@ -92,14 +111,17 @@ const monthWeeks = (month, weekStart) => {
|
|
|
92
111
|
/**
|
|
93
112
|
* A day's highlights (see `DayHighlights`): its dots' tints (`undefined`:
|
|
94
113
|
* the date's color), and its button's attributes for a text and a circle
|
|
95
|
-
* highlight (the last of each)
|
|
114
|
+
* highlight (the last of each); with `differentiateWithoutColor`, a text
|
|
115
|
+
* highlight's dot too.
|
|
96
116
|
*/
|
|
97
|
-
const highlightsOf = (highlights) => {
|
|
117
|
+
const highlightsOf = (highlights, differentiateWithoutColor) => {
|
|
98
118
|
if (!highlights)
|
|
99
119
|
return { attributes: {}, dots: [] };
|
|
100
120
|
const list = highlights === true ? [{}] : [highlights].flat();
|
|
121
|
+
// (State told without color alone, see Settings: a text highlight's dot
|
|
122
|
+
// too, as its tint's alone wouldn't tell.)
|
|
101
123
|
const dots = list
|
|
102
|
-
.filter(({ style = 'dot' }) => style === 'dot')
|
|
124
|
+
.filter(({ style = 'dot' }) => style === 'dot' || (differentiateWithoutColor && style === 'text'))
|
|
103
125
|
.map(({ tint }) => tint);
|
|
104
126
|
const text = list.findLast(({ style }) => style === 'text');
|
|
105
127
|
const circle = list.findLast(({ style }) => style === 'circle');
|
|
@@ -172,7 +194,9 @@ const timeFormat = (locale, cycle) => {
|
|
|
172
194
|
* The time as a roll: hours, minutes and (12 hours) the day period, the
|
|
173
195
|
* numbers editable (e.g. in an expandable list row, see `DatePicker.Root`).
|
|
174
196
|
*/
|
|
175
|
-
const TimeRoll = ({ hourCycle: cycle, locale, max, min, onValueChange: onChange, value, }) => {
|
|
197
|
+
const TimeRoll = ({ dayPeriodLabel, hourCycle: cycle, hoursLabel, locale: ownLocale, max, min, minutesLabel, onValueChange: onChange, value, }) => {
|
|
198
|
+
const locale = useLocale(ownLocale);
|
|
199
|
+
const labels = useLabels({ dayPeriodLabel, hoursLabel, minutesLabel });
|
|
176
200
|
const date = value ?? new Date();
|
|
177
201
|
// Its day at a time, and whether that's beyond the limits.
|
|
178
202
|
const at = (hour, minute) => {
|
|
@@ -208,14 +232,14 @@ const TimeRoll = ({ hourCycle: cycle, locale, max, min, onValueChange: onChange,
|
|
|
208
232
|
};
|
|
209
233
|
// A shown hour's (of the shown period, with 12 hours), as 0–23.
|
|
210
234
|
const hourOf = (hour) => twelve ? (hour % 12) + (isPm ? 12 : 0) : hour;
|
|
211
|
-
const period = (_jsxs(Roll.Column, { "aria-label":
|
|
235
|
+
const period = (_jsxs(Roll.Column, { "aria-label": labels.dayPeriodLabel, value: isPm ? 'pm' : 'am', onValueChange: (next, details) => {
|
|
212
236
|
if ((next === 'pm') === isPm)
|
|
213
237
|
return;
|
|
214
238
|
set((hours + 12) % 24, date.getMinutes(), details);
|
|
215
239
|
}, children: [_jsx(Roll.Item, { disabled: !isWithin(at(0, 0), at(11, 59)), value: "am", children: periods[0] }), _jsx(Roll.Item, { disabled: !isWithin(at(12, 0), at(23, 59)), value: "pm", children: periods[1] })] }));
|
|
216
|
-
return (_jsxs(Roll.Root, { children: [twelve && periodFirst ? period : null, _jsx(Roll.Column, { editable: true, align: "end", "aria-label":
|
|
240
|
+
return (_jsxs(Roll.Root, { children: [twelve && periodFirst ? period : null, _jsx(Roll.Column, { editable: true, align: "end", "aria-label": labels.hoursLabel, value: shownHour, onValueChange: (next, details) => {
|
|
217
241
|
set(hourOf(Number(next)), date.getMinutes(), details);
|
|
218
|
-
}, children: hourValues.map((hour) => (_jsx(Roll.Item, { disabled: !isWithin(at(hourOf(hour), 0), at(hourOf(hour), 59)), value: hour, children: numbers.hour.format(hour) }, hour))) }), _jsx(Roll.Column, { editable: true, align: "start", "aria-label":
|
|
242
|
+
}, children: hourValues.map((hour) => (_jsx(Roll.Item, { disabled: !isWithin(at(hourOf(hour), 0), at(hourOf(hour), 59)), value: hour, children: numbers.hour.format(hour) }, hour))) }), _jsx(Roll.Column, { editable: true, align: "start", "aria-label": labels.minutesLabel, value: date.getMinutes(), onValueChange: (next, details) => set(hours, Number(next), details), children: Array.from({ length: 60 }, (_, minute) => (_jsx(Roll.Item, { disabled: isBeyond(at(hours, minute)), value: minute, children: numbers.minute.format(minute) }, minute))) }), twelve && !periodFirst ? period : null] }));
|
|
219
243
|
};
|
|
220
244
|
const clampMonth = (month, min, max) => {
|
|
221
245
|
if (min && month < startOfMonth(min))
|
|
@@ -225,7 +249,7 @@ const clampMonth = (month, min, max) => {
|
|
|
225
249
|
return month;
|
|
226
250
|
};
|
|
227
251
|
/** The shown month as a roll: months and years (within the limits). */
|
|
228
|
-
const MonthYearRoll = ({ locale, max, min, month, onChange }) => {
|
|
252
|
+
const MonthYearRoll = ({ locale, max, min, month, monthLabel, onChange, yearLabel }) => {
|
|
229
253
|
const names = useMemo(() => {
|
|
230
254
|
const format = new Intl.DateTimeFormat(locale, { month: 'long' });
|
|
231
255
|
return Array.from({ length: 12 }, (_, index) => format.format(new Date(2000, index, 1)));
|
|
@@ -239,7 +263,7 @@ const MonthYearRoll = ({ locale, max, min, month, onChange }) => {
|
|
|
239
263
|
const last = max?.getFullYear() ?? Math.max(around + 100, year);
|
|
240
264
|
const inLimits = (candidate) => (!min || candidate >= startOfMonth(min)) &&
|
|
241
265
|
(!max || candidate <= startOfMonth(max));
|
|
242
|
-
return (_jsxs(Roll.Root, { children: [_jsx(Roll.Column, { align: "end", "aria-label":
|
|
266
|
+
return (_jsxs(Roll.Root, { children: [_jsx(Roll.Column, { align: "end", "aria-label": monthLabel, value: month.getMonth(), onValueChange: (next) => onChange(new Date(year, Number(next), 1)), children: names.map((name, index) => (_jsx(Roll.Item, { disabled: !inLimits(new Date(year, index, 1)), value: index, children: name }, name))) }), _jsx(Roll.Column, { editable: true, align: "start", "aria-label": yearLabel, value: year, onValueChange: (next) => onChange(clampMonth(new Date(Number(next), month.getMonth(), 1), min, max)), children: Array.from({ length: last - first + 1 }, (_, index) => (_jsx(Roll.Item, { value: first + index, children: yearFormat.format(first + index) }, first + index))) })] }));
|
|
243
267
|
};
|
|
244
268
|
/**
|
|
245
269
|
* The calendar's value: a date or a range (shown, while one is dragged,
|
|
@@ -333,7 +357,10 @@ const formValueOf = (value, mode = 'date') => {
|
|
|
333
357
|
const FormValue = ({ form, mode, name, isOmitted = false, value }) => isOmitted ? null : (_jsx(BaseField.Control, { form: form, name: name, type: "hidden", value: formValueOf(value, mode) }));
|
|
334
358
|
/** The calendar (inline), with an optional time row. */
|
|
335
359
|
const CalendarPanel = (props) => {
|
|
336
|
-
const { firstDayOfWeek: weekStartProp, highlighted, highlightedWeekdays = [], hourCycle, isDateDisabled, label, locale, max, min, showAdjacentMonths, time, } = props;
|
|
360
|
+
const { firstDayOfWeek: weekStartProp, highlighted, highlightedWeekdays = [], hourCycle, isDateDisabled, label, locale: ownLocale, max, min, showAdjacentMonths, time, } = props;
|
|
361
|
+
const locale = useLocale(ownLocale);
|
|
362
|
+
const labels = useLabels(props);
|
|
363
|
+
const { differentiateWithoutColor } = useSettings();
|
|
337
364
|
const { dragged, draggedFrom, range, setDragged, setDraggedFrom, setValue, single, value, } = useCalendarValue(props);
|
|
338
365
|
const today = startOfDay(new Date());
|
|
339
366
|
const [month, setMonth] = useState(() => startOfMonth(range?.start ?? single ?? today));
|
|
@@ -425,6 +452,9 @@ const CalendarPanel = (props) => {
|
|
|
425
452
|
if (previous === undefined || previous === next)
|
|
426
453
|
return;
|
|
427
454
|
transition.current?.cancel();
|
|
455
|
+
// (Motion reduced: at its new height at once.)
|
|
456
|
+
if (reducedMotionOf(body).matches)
|
|
457
|
+
return;
|
|
428
458
|
body.style.overflow = 'clip';
|
|
429
459
|
const animation = body.animate([{ height: `${String(previous)}px` }, { height: `${String(next)}px` }], { duration: 300, easing: 'ease' });
|
|
430
460
|
transition.current = animation;
|
|
@@ -674,7 +704,7 @@ const CalendarPanel = (props) => {
|
|
|
674
704
|
return (_jsx("span", { "data-outside": outside }, day.getTime()));
|
|
675
705
|
}
|
|
676
706
|
// Not the adjacent months' days (nor their weekdays, see below).
|
|
677
|
-
const { attributes, dots } = highlightsOf(outside ? undefined : highlighted?.(day));
|
|
707
|
+
const { attributes, dots } = highlightsOf(outside ? undefined : highlighted?.(day), differentiateWithoutColor);
|
|
678
708
|
return (_jsxs("button", { "aria-current": isSameDay(day, today) ? 'date' : undefined, "aria-label": isInteractive ? formats.full.format(day) : undefined, "data-date": isInteractive ? day.getTime() : undefined, ...attributes, className: "uikit-date-picker-day", "data-date-picker-part": "day", "data-outside": outside, "data-range": rangePlace(day, range), disabled: !enabled(day), tabIndex: isInteractive && !outside && isSameDay(day, focused) ? 0 : -1, type: "button", "aria-pressed": range ? rangePlace(day, range) !== undefined : isSameDay(day, single), "data-weekday-highlighted": (!outside && highlightedWeekdays.includes(day.getDay())) || undefined, onClick: isInteractive
|
|
679
709
|
? (event) => {
|
|
680
710
|
// Another month's day: shows its month (not selected).
|
|
@@ -711,7 +741,7 @@ const CalendarPanel = (props) => {
|
|
|
711
741
|
const neighbour = (shown) => (_jsx("div", { inert: true, "aria-hidden": "true", className: "uikit-date-picker-weeks", "data-date-picker-part": "weeks", children: monthWeeks(shown, weekStart)
|
|
712
742
|
.flat()
|
|
713
743
|
.map((day) => cell(day, shown, false)) }, shown.getTime()));
|
|
714
|
-
return (_jsxs("div", { className: "uikit-date-picker-panel", "data-date-picker-part": "calendar", children: [_jsxs("div", { className: "uikit-date-picker-header", "data-date-picker-part": "header", children: [_jsx("h2", { "aria-live": "polite", className: "uikit-date-picker-month-title", "data-date-picker-part": "month-title", id: titleId, children: _jsxs("button", { "aria-controls": rollId, "aria-expanded": rolled === 'monthYear', className: "uikit-date-picker-title-button", "data-date-picker-part": "title-button", type: "button", onClick: () => toggle('monthYear'), children: [formats.month.format(pager.shown), _jsx(Disclosure, {})] }) }), _jsxs("div", { className: "uikit-date-picker-arrows", "data-date-picker-part": "arrows", hidden: rolled === 'monthYear', children: [_jsx(Button.Root, { "aria-label":
|
|
744
|
+
return (_jsxs("div", { className: "uikit-date-picker-panel", "data-date-picker-part": "calendar", children: [_jsxs("div", { className: "uikit-date-picker-header", "data-date-picker-part": "header", children: [_jsx("h2", { "aria-live": "polite", className: "uikit-date-picker-month-title", "data-date-picker-part": "month-title", id: titleId, children: _jsxs("button", { "aria-controls": rollId, "aria-expanded": rolled === 'monthYear', className: "uikit-date-picker-title-button", "data-date-picker-part": "title-button", type: "button", onClick: () => toggle('monthYear'), children: [formats.month.format(pager.shown), _jsx(Disclosure, {})] }) }), _jsxs("div", { className: "uikit-date-picker-arrows", "data-date-picker-part": "arrows", hidden: rolled === 'monthYear', children: [_jsx(Button.Root, { "aria-label": labels.previousMonthLabel, className: "uikit-date-picker-arrow", "data-date-picker-part": "arrow", disabled: isPreviousDisabled, shape: "circle", onClick: () => showMonth(addMonths(pager.shown, -1)), children: _jsx(Chevron, { isNext: false }) }), _jsx(Button.Root, { "aria-label": labels.nextMonthLabel, className: "uikit-date-picker-arrow", "data-date-picker-part": "arrow", disabled: isNextDisabled, shape: "circle", onClick: () => showMonth(addMonths(pager.shown, 1)), children: _jsx(Chevron, { isNext: true }) })] })] }), _jsxs("div", { ref: bodyRef, className: "uikit-date-picker-body", "data-date-picker-part": "body", "data-rolled": rolled === undefined ? undefined : '', children: [_jsx("div", { "aria-hidden": "true", className: "uikit-date-picker-weekdays", "data-date-picker-part": "weekdays", children: weekdays.map((day) => (_jsx("abbr", { title: formats.weekdayLong.format(day), "data-weekday-highlighted": highlightedWeekdays.includes(day.getDay()) || undefined, children: formats.weekday.format(day) }, day.getDay()))) }), _jsx("div", { ref: pagesRef, className: "uikit-date-picker-pages", "data-date-picker-part": "pages", "data-swipe": swipes, onPointerCancel: onPointerEnd, onPointerDown: onPointerDown, onPointerMove: onPointerMove, onPointerUp: onPointerEnd, children: pager.months.map((shown) => shown.getTime() === month.getTime() ? (_jsx("div", { ref: daysRef, "aria-label": label, "aria-labelledby": label ? undefined : titleId, className: "uikit-date-picker-weeks", "data-date-picker-part": "weeks", "data-swipe": swipes, role: "group", onKeyDown: onKeyDown, onClickCapture: (event) => {
|
|
715
745
|
if (!suppressClick.current)
|
|
716
746
|
return;
|
|
717
747
|
suppressClick.current = false;
|
|
@@ -721,7 +751,7 @@ const CalendarPanel = (props) => {
|
|
|
721
751
|
const day = dayOf(event.target);
|
|
722
752
|
if (day && !isSameDay(day, focused))
|
|
723
753
|
setFocused(day);
|
|
724
|
-
}, children: weeks.flat().map((day) => cell(day, month, true)) }, shown.getTime())) : (neighbour(shown))) }), rolled === undefined ? null : (_jsx("div", { className: "uikit-date-picker-overlay", "data-date-picker-part": "roll", id: rollId, children: rolled === 'monthYear' ? (_jsx(MonthYearRoll, { locale: locale, max: max, min: min, month: month, onChange: showMonth })) : (_jsx(TimeRoll, { hourCycle: hourCycle, locale: locale, max: max, min: min, value: single, onValueChange: changeTime })) }))] }), footerContent === null || footerContent === undefined ? null : (_jsxs(_Fragment, { children: [_jsx("div", { className: "uikit-date-picker-separator", "data-date-picker-part": "separator" }), footerContent] })), _jsx(FormValue, { form: props.form, isOmitted: props.formControl === false, name: props.name, value: value })] }));
|
|
754
|
+
}, children: weeks.flat().map((day) => cell(day, month, true)) }, shown.getTime())) : (neighbour(shown))) }), rolled === undefined ? null : (_jsx("div", { className: "uikit-date-picker-overlay", "data-date-picker-part": "roll", id: rollId, children: rolled === 'monthYear' ? (_jsx(MonthYearRoll, { locale: locale, max: max, min: min, month: month, monthLabel: labels.monthLabel, yearLabel: labels.yearLabel, onChange: showMonth })) : (_jsx(TimeRoll, { hourCycle: hourCycle, locale: locale, max: max, min: min, value: single, onValueChange: changeTime })) }))] }), footerContent === null || footerContent === undefined ? null : (_jsxs(_Fragment, { children: [_jsx("div", { className: "uikit-date-picker-separator", "data-date-picker-part": "separator" }), footerContent] })), _jsx(FormValue, { form: props.form, isOmitted: props.formControl === false, name: props.name, value: value })] }));
|
|
725
755
|
};
|
|
726
756
|
/** A footer row (see `CalendarProps` `footer`): a time row's, 52px. */
|
|
727
757
|
const CalendarRow = TimeRow;
|
|
@@ -737,7 +767,10 @@ const CalendarMessage = forwardRef(({ className, variant = 'info', ...props }, r
|
|
|
737
767
|
* The footer's time row: the time's button, showing its
|
|
738
768
|
* roll; the picker's default footer, with a time.
|
|
739
769
|
*/
|
|
740
|
-
const CalendarTimeRow = ({ calendar, label
|
|
770
|
+
const CalendarTimeRow = ({ calendar, label }) => {
|
|
771
|
+
const { timeLabel } = useContext(LabelsContext);
|
|
772
|
+
return calendar.time ? (_jsxs(CalendarRow, { children: [_jsx("span", { "aria-hidden": "true", children: label ?? timeLabel }), _jsx(CalendarButton, { "aria-controls": calendar.time.controls, "aria-expanded": calendar.time.shown, "aria-label": timeLabel, disabled: calendar.disabled, shape: calendar.buttonShape, onClick: calendar.time.toggle, children: calendar.time.label })] })) : null;
|
|
773
|
+
};
|
|
741
774
|
/** The calendar (inline, without the time). */
|
|
742
775
|
const Calendar = (props) => _jsx(CalendarPanel, { ...props });
|
|
743
776
|
/** The calendar's props, of the picker's (its value, and its changes). */
|
|
@@ -794,7 +827,8 @@ const defaultFooter = (calendar) => (_jsx(CalendarTimeRow, { calendar: calendar
|
|
|
794
827
|
/** The compact style's time: its button, the roll in a popover. */
|
|
795
828
|
const TimePopover = ({ align, isDisabled, label, onOpenChange, isOpen, shape, ...props }) => {
|
|
796
829
|
const popupRef = useRef(null);
|
|
797
|
-
|
|
830
|
+
const { timeLabel } = useContext(LabelsContext);
|
|
831
|
+
return (_jsxs(Popover.Root, { open: isOpen, onOpenChange: onOpenChange, children: [_jsx(Popover.Trigger, { "aria-label": timeLabel, disabled: isDisabled, render: _jsx(CollapsedButton, { shape: shape }), children: label }), _jsx(Popover.Portal, { children: _jsx(Popover.Positioner, { align: align, children: _jsx(Popover.Popup, { ref: popupRef, "aria-label": timeLabel, className: "uikit-date-picker-popup", "data-date-picker-part": "popup",
|
|
798
832
|
// The popup (not the first column: focused while the popup
|
|
799
833
|
// opens, Chrome scrolls it off its selection).
|
|
800
834
|
initialFocus: popupRef, children: _jsx("div", { className: "uikit-date-picker-time-popup", "data-date-picker-part": "time-popup", children: _jsx(TimeRoll, { ...props }) }) }) }) })] }));
|
|
@@ -813,11 +847,12 @@ const dateLabelOf = (format, range, single) => {
|
|
|
813
847
|
* time, from the time's too, with the time's roll shown (one popover for
|
|
814
848
|
* both).
|
|
815
849
|
*/
|
|
816
|
-
const CalendarPopover = ({ align, children,
|
|
850
|
+
const CalendarPopover = ({ align, children, dateText, isDisabled, onOpenChange, open, shape, timeText, }) => {
|
|
851
|
+
const labels = useContext(LabelsContext);
|
|
817
852
|
const dateTriggerId = useId();
|
|
818
853
|
const timeTriggerId = useId();
|
|
819
854
|
const collapsedRef = useRef(null);
|
|
820
|
-
const hasTime =
|
|
855
|
+
const hasTime = timeText !== undefined;
|
|
821
856
|
// The time's button is the open one while the time's roll shows (however
|
|
822
857
|
// it was opened, or shown), the date's otherwise.
|
|
823
858
|
const [isTimeShown, setIsTimeShown] = useState(open === 'time');
|
|
@@ -833,10 +868,11 @@ const CalendarPopover = ({ align, children, dateLabel, isDisabled, onOpenChange,
|
|
|
833
868
|
: null;
|
|
834
869
|
const picker = trigger?.dataset.datePickerTrigger === 'time' ? 'time' : 'date';
|
|
835
870
|
onOpenChange(isOpen ? picker : null, { event, reason });
|
|
836
|
-
}, children: [_jsx(Popover.Trigger, { "data-date-picker-trigger": "date", disabled: isDisabled, id: dateTriggerId, render: _jsx(CollapsedButton, { shape: shape }), children:
|
|
871
|
+
}, children: [_jsx(Popover.Trigger, { "data-date-picker-trigger": "date", disabled: isDisabled, id: dateTriggerId, render: _jsx(CollapsedButton, { shape: shape }), children: dateText }), hasTime ? (_jsx(Popover.Trigger, { "aria-label": labels.timeLabel, "data-date-picker-trigger": "time", disabled: isDisabled, id: timeTriggerId, render: _jsx(CollapsedButton, { shape: shape }), children: timeText })) : null, _jsx(Popover.Portal, { children: _jsx(Popover.Positioner, { align: align, anchor: collapsedRef, children: _jsx(Popover.Popup, { "aria-label": hasTime ? labels.dateAndTimeLabel : labels.dateLabel, className: "uikit-date-picker-popup", "data-date-picker-part": "popup", children: _jsx(Fragment, { children: children(open === 'time' ? 'time' : undefined, setIsTimeShown) }, open ?? 'closed') }) }) })] }) }));
|
|
837
872
|
};
|
|
838
873
|
/** The compact style's buttons, toggling `open` (without popovers). */
|
|
839
|
-
const ToggleButtons = ({
|
|
874
|
+
const ToggleButtons = ({ dateText, isDisabled, onOpenChange, open, shape, timeText }) => {
|
|
875
|
+
const labels = useContext(LabelsContext);
|
|
840
876
|
const toggle = (picker, event) => onOpenChange(open === picker ? null : picker, {
|
|
841
877
|
event,
|
|
842
878
|
reason: 'trigger-press',
|
|
@@ -852,7 +888,7 @@ const ToggleButtons = ({ dateLabel, isDisabled, onOpenChange, open, shape, timeL
|
|
|
852
888
|
return;
|
|
853
889
|
onOpenChange(null, { event: new Event('disable'), reason: 'none' });
|
|
854
890
|
});
|
|
855
|
-
return (_jsxs("div", { ref: ref, className: "uikit-date-picker-collapsed", "data-date-picker-part": "collapsed", children: [
|
|
891
|
+
return (_jsxs("div", { ref: ref, className: "uikit-date-picker-collapsed", "data-date-picker-part": "collapsed", children: [dateText === undefined ? null : (_jsx(CollapsedButton, { "aria-expanded": open === 'date', disabled: isDisabled, shape: shape, onClick: (event) => toggle('date', event), children: dateText })), timeText === undefined ? null : (_jsx(CollapsedButton, { "aria-expanded": open === 'time', "aria-label": labels.timeLabel, disabled: isDisabled, shape: shape, onClick: (event) => toggle('time', event), children: timeText }))] }));
|
|
856
892
|
};
|
|
857
893
|
/**
|
|
858
894
|
* A picker in collapsible list rows (see `List.CollapsiblePanel`): closed
|
|
@@ -900,8 +936,9 @@ const useListSync = (handle, open, changeOpen) => {
|
|
|
900
936
|
* time in a popover (or toggling `open`, without `popover`), or the
|
|
901
937
|
* calendar in place (`pickerStyle`).
|
|
902
938
|
*/
|
|
903
|
-
const
|
|
904
|
-
const { buttonShape, disabled = false, hourCycle, locale, mode = 'date', pickerStyle = 'compact', popover = true, } = props;
|
|
939
|
+
const RootBody = (props) => {
|
|
940
|
+
const { buttonShape, disabled = false, hourCycle, locale: ownLocale, mode = 'date', pickerStyle = 'compact', popover = true, } = props;
|
|
941
|
+
const locale = useLocale(ownLocale);
|
|
905
942
|
const { change, range, single } = usePickerValue(props);
|
|
906
943
|
const [open, changeOpen] = usePickerOpen(props);
|
|
907
944
|
const formats = useMemo(() => ({
|
|
@@ -932,22 +969,28 @@ const Root = (props) => {
|
|
|
932
969
|
if (pickerStyle === 'inline' && hasDate) {
|
|
933
970
|
return (_jsxs(_Fragment, { children: [calendar(), formValue] }));
|
|
934
971
|
}
|
|
935
|
-
const
|
|
936
|
-
const
|
|
972
|
+
const dateText = dateLabelOf(formats.date, range, single);
|
|
973
|
+
const timeText = single ? formats.time.format(single) : '–';
|
|
937
974
|
// Without popovers: buttons toggling `open` (for the app to show them,
|
|
938
975
|
// or, with a handle, its `Expandable`).
|
|
939
976
|
if (!popover || props.handle) {
|
|
940
|
-
return (_jsxs(_Fragment, { children: [_jsx(ToggleButtons, {
|
|
977
|
+
return (_jsxs(_Fragment, { children: [_jsx(ToggleButtons, { dateText: hasDate ? dateText : undefined, isDisabled: disabled, open: open, shape: buttonShape, timeText: hasTime ? timeText : undefined, onOpenChange: changeOpen }), formValue] }));
|
|
941
978
|
}
|
|
942
979
|
if (!hasDate) {
|
|
943
|
-
return (_jsxs("div", { className: "uikit-date-picker-collapsed", "data-date-picker-part": "collapsed", children: [formValue, _jsx(TimePopover, { align: props.popoverAlign, hourCycle: hourCycle, isDisabled: disabled, isOpen: open === 'time', label:
|
|
980
|
+
return (_jsxs("div", { className: "uikit-date-picker-collapsed", "data-date-picker-part": "collapsed", children: [formValue, _jsx(TimePopover, { align: props.popoverAlign, hourCycle: hourCycle, isDisabled: disabled, isOpen: open === 'time', label: timeText, locale: locale, max: props.max, min: props.min, shape: buttonShape, value: single, onValueChange: change, onOpenChange: (isOpen, { event, reason }) => changeOpen(isOpen ? 'time' : null, { event, reason }) })] }));
|
|
944
981
|
}
|
|
945
|
-
return (_jsxs(_Fragment, { children: [_jsx(CalendarPopover, { align: props.popoverAlign,
|
|
982
|
+
return (_jsxs(_Fragment, { children: [_jsx(CalendarPopover, { align: props.popoverAlign, dateText: dateText, isDisabled: disabled, open: open, shape: buttonShape, timeText: hasTime ? timeText : undefined, onOpenChange: changeOpen, children: (initialRoll, onTimeShownChange) => calendar(initialRoll, onTimeShownChange) }), formValue] }));
|
|
946
983
|
};
|
|
984
|
+
/**
|
|
985
|
+
* A date picker (see `RootBody`), its words (its `…Label` props, see
|
|
986
|
+
* `datePickerLabels`) for its parts within.
|
|
987
|
+
*/
|
|
988
|
+
const Root = (props) => (_jsx(LabelsContext.Provider, { value: useLabels(props), children: _jsx(RootBody, { ...props }) }));
|
|
947
989
|
/**
|
|
948
990
|
* A date picker's pickers in place (see `Root` `handle`): its calendar and
|
|
949
991
|
* time roll, each in collapsible list rows (`List.CollapsiblePanel`),
|
|
950
|
-
* opened by its buttons; placed after the picker's row. In
|
|
992
|
+
* opened by its buttons; placed after the picker's row. In a
|
|
993
|
+
* `List.AccordionItem` (with its row), one of its items.
|
|
951
994
|
*/
|
|
952
995
|
const Expandable = ({ handle, }) => {
|
|
953
996
|
const { calendar, open, time } = useSyncExternalStore(handle.subscribe, handle.getSnapshot);
|