@mrpelz/uikit-ish 7.9.0 → 7.11.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/action-sheet/main.d.ts +1 -2
- package/dist/components/action-sheet/main.d.ts.map +1 -1
- package/dist/components/action-sheet/main.js +12 -12
- package/dist/components/action-sheet/main.js.map +1 -1
- package/dist/components/action-sheet/props.d.ts +2 -2
- package/dist/components/action-sheet/props.d.ts.map +1 -1
- package/dist/components/action-sheet/style.css +10 -1
- package/dist/components/activity-view/main.d.ts +1 -1
- package/dist/components/activity-view/main.d.ts.map +1 -1
- package/dist/components/activity-view/main.js +9 -11
- package/dist/components/activity-view/main.js.map +1 -1
- package/dist/components/activity-view/style.css +21 -21
- package/dist/components/alert/main.d.ts +2 -3
- package/dist/components/alert/main.d.ts.map +1 -1
- package/dist/components/alert/main.js +12 -15
- package/dist/components/alert/main.js.map +1 -1
- package/dist/components/alert/props.d.ts +3 -3
- package/dist/components/alert/style.css +23 -23
- package/dist/components/avatar/main.d.ts.map +1 -1
- package/dist/components/avatar/main.js +7 -8
- package/dist/components/avatar/main.js.map +1 -1
- package/dist/components/avatar/style.css +1 -1
- package/dist/components/badge/main.d.ts +1 -1
- package/dist/components/badge/main.js +4 -4
- package/dist/components/badge/main.js.map +1 -1
- package/dist/components/badge/style.css +7 -2
- package/dist/components/button/main.d.ts.map +1 -1
- package/dist/components/button/main.js +9 -9
- package/dist/components/button/main.js.map +1 -1
- package/dist/components/button/props.d.ts +8 -8
- package/dist/components/button/props.d.ts.map +1 -1
- package/dist/components/button/style.css +27 -29
- package/dist/components/checkbox/main.d.ts.map +1 -1
- package/dist/components/checkbox/main.js +5 -7
- package/dist/components/checkbox/main.js.map +1 -1
- package/dist/components/checkbox/style.css +3 -3
- package/dist/components/color-picker/color.d.ts +23 -0
- package/dist/components/color-picker/color.d.ts.map +1 -0
- package/dist/components/color-picker/color.js +150 -0
- package/dist/components/color-picker/color.js.map +1 -0
- package/dist/components/color-picker/main.d.ts +41 -5
- package/dist/components/color-picker/main.d.ts.map +1 -1
- package/dist/components/color-picker/main.js +633 -99
- package/dist/components/color-picker/main.js.map +1 -1
- package/dist/components/color-picker/named-colors.d.ts +3 -0
- package/dist/components/color-picker/named-colors.d.ts.map +1 -0
- package/dist/components/color-picker/named-colors.js +152 -0
- package/dist/components/color-picker/named-colors.js.map +1 -0
- package/dist/components/color-picker/props.d.ts +97 -14
- package/dist/components/color-picker/props.d.ts.map +1 -1
- package/dist/components/color-picker/style.css +316 -50
- package/dist/components/contextual-menu/main.d.ts.map +1 -1
- package/dist/components/contextual-menu/main.js +189 -236
- package/dist/components/contextual-menu/main.js.map +1 -1
- package/dist/components/contextual-menu/props.d.ts +10 -33
- package/dist/components/contextual-menu/props.d.ts.map +1 -1
- package/dist/components/contextual-menu/style.css +60 -34
- package/dist/components/date-picker/main.d.ts.map +1 -1
- package/dist/components/date-picker/main.js +100 -66
- package/dist/components/date-picker/main.js.map +1 -1
- package/dist/components/date-picker/props.d.ts +10 -10
- package/dist/components/date-picker/props.d.ts.map +1 -1
- package/dist/components/date-picker/style.css +51 -47
- package/dist/components/drawer/main.d.ts.map +1 -1
- package/dist/components/drawer/main.js +52 -7
- package/dist/components/drawer/main.js.map +1 -1
- package/dist/components/drawer/style.css +1 -1
- package/dist/components/edit-menu/main.d.ts.map +1 -1
- package/dist/components/edit-menu/main.js +41 -30
- package/dist/components/edit-menu/main.js.map +1 -1
- package/dist/components/edit-menu/props.d.ts +4 -4
- package/dist/components/edit-menu/props.d.ts.map +1 -1
- package/dist/components/edit-menu/style.css +27 -1
- package/dist/components/form/main.js +3 -3
- package/dist/components/form/main.js.map +1 -1
- package/dist/components/glass/main.d.ts +1 -1
- package/dist/components/glass/main.js +4 -4
- package/dist/components/glass/main.js.map +1 -1
- package/dist/components/glass/props.d.ts +5 -5
- package/dist/components/glass/props.d.ts.map +1 -1
- package/dist/components/glass/style.css +157 -157
- package/dist/components/header/main.d.ts.map +1 -1
- package/dist/components/header/main.js +27 -26
- package/dist/components/header/main.js.map +1 -1
- package/dist/components/header/style.css +13 -52
- package/dist/components/index.d.ts +6 -6
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +2 -2
- package/dist/components/index.js.map +1 -1
- package/dist/components/layout/main.js +5 -5
- package/dist/components/layout/main.js.map +1 -1
- package/dist/components/layout/style.css +2 -2
- package/dist/components/list/main.d.ts +11 -3
- package/dist/components/list/main.d.ts.map +1 -1
- package/dist/components/list/main.js +296 -300
- package/dist/components/list/main.js.map +1 -1
- package/dist/components/list/props.d.ts +49 -16
- package/dist/components/list/props.d.ts.map +1 -1
- package/dist/components/list/reorder.d.ts +146 -0
- package/dist/components/list/reorder.d.ts.map +1 -0
- package/dist/components/list/reorder.js +819 -0
- package/dist/components/list/reorder.js.map +1 -0
- package/dist/components/list/select.d.ts +6 -0
- package/dist/components/list/select.d.ts.map +1 -0
- package/dist/components/list/select.js +141 -0
- package/dist/components/list/select.js.map +1 -0
- package/dist/components/list/style.css +206 -158
- package/dist/components/menu/main.d.ts +81 -30
- package/dist/components/menu/main.d.ts.map +1 -1
- package/dist/components/menu/main.js +568 -93
- package/dist/components/menu/main.js.map +1 -1
- package/dist/components/menu/props.d.ts +3 -4
- package/dist/components/menu/props.d.ts.map +1 -1
- package/dist/components/menu/style.css +30 -12
- package/dist/components/navigation/main.d.ts +5 -2
- package/dist/components/navigation/main.d.ts.map +1 -1
- package/dist/components/navigation/main.js +287 -57
- package/dist/components/navigation/main.js.map +1 -1
- package/dist/components/navigation/props.d.ts +37 -4
- package/dist/components/navigation/props.d.ts.map +1 -1
- package/dist/components/navigation/style.css +32 -2
- package/dist/components/page/main.d.ts.map +1 -1
- package/dist/components/page/main.js +12 -7
- package/dist/components/page/main.js.map +1 -1
- package/dist/components/page/props.d.ts +1 -1
- package/dist/components/page/style.css +3 -6
- package/dist/components/page-control/main.d.ts +1 -1
- package/dist/components/page-control/main.js +9 -9
- package/dist/components/page-control/main.js.map +1 -1
- package/dist/components/page-control/style.css +2 -2
- package/dist/components/popover/main.d.ts +1 -1
- package/dist/components/popover/main.d.ts.map +1 -1
- package/dist/components/popover/main.js +41 -17
- package/dist/components/popover/main.js.map +1 -1
- package/dist/components/popover/props.d.ts +2 -2
- package/dist/components/popover/style.css +10 -1
- package/dist/components/progress/main.d.ts +1 -2
- package/dist/components/progress/main.d.ts.map +1 -1
- package/dist/components/progress/main.js +45 -19
- package/dist/components/progress/main.js.map +1 -1
- package/dist/components/progress/props.d.ts +22 -8
- package/dist/components/progress/props.d.ts.map +1 -1
- package/dist/components/progress/style.css +15 -15
- package/dist/components/roll/main.js +10 -10
- package/dist/components/roll/main.js.map +1 -1
- package/dist/components/roll/props.d.ts +1 -1
- package/dist/components/roll/style.css +11 -11
- package/dist/components/segmented/main.d.ts.map +1 -1
- package/dist/components/segmented/main.js +183 -31
- package/dist/components/segmented/main.js.map +1 -1
- package/dist/components/segmented/props.d.ts +7 -0
- package/dist/components/segmented/props.d.ts.map +1 -1
- package/dist/components/segmented/style.css +148 -14
- package/dist/components/sheet/main.d.ts +6 -5
- package/dist/components/sheet/main.d.ts.map +1 -1
- package/dist/components/sheet/main.js +53 -27
- package/dist/components/sheet/main.js.map +1 -1
- package/dist/components/sheet/props.d.ts +29 -1
- package/dist/components/sheet/props.d.ts.map +1 -1
- package/dist/components/sheet/style.css +138 -33
- package/dist/components/sidebar/main.d.ts.map +1 -1
- package/dist/components/sidebar/main.js +9 -13
- package/dist/components/sidebar/main.js.map +1 -1
- package/dist/components/sidebar/style.css +8 -8
- package/dist/components/slider/main.d.ts.map +1 -1
- package/dist/components/slider/main.js +19 -19
- package/dist/components/slider/main.js.map +1 -1
- package/dist/components/slider/props.d.ts +1 -2
- package/dist/components/slider/props.d.ts.map +1 -1
- package/dist/components/slider/style.css +25 -25
- package/dist/components/stepper/main.d.ts.map +1 -1
- package/dist/components/stepper/main.js +13 -15
- package/dist/components/stepper/main.js.map +1 -1
- package/dist/components/stepper/style.css +8 -8
- package/dist/components/switch/main.d.ts.map +1 -1
- package/dist/components/switch/main.js +25 -18
- package/dist/components/switch/main.js.map +1 -1
- package/dist/components/switch/props.d.ts +5 -3
- package/dist/components/switch/props.d.ts.map +1 -1
- package/dist/components/switch/style.css +13 -17
- package/dist/components/symbol/main.d.ts +1 -1
- package/dist/components/symbol/main.d.ts.map +1 -1
- package/dist/components/symbol/main.js +6 -5
- package/dist/components/symbol/main.js.map +1 -1
- package/dist/components/symbol/props.d.ts +3 -3
- package/dist/components/symbol/style.css +1 -1
- package/dist/components/tab-bar/main.d.ts +2 -2
- package/dist/components/tab-bar/main.d.ts.map +1 -1
- package/dist/components/tab-bar/main.js +78 -59
- package/dist/components/tab-bar/main.js.map +1 -1
- package/dist/components/tab-bar/props.d.ts +3 -3
- package/dist/components/tab-bar/style.css +92 -56
- package/dist/components/text-field/main.d.ts +3 -2
- package/dist/components/text-field/main.d.ts.map +1 -1
- package/dist/components/text-field/main.js +26 -28
- package/dist/components/text-field/main.js.map +1 -1
- package/dist/components/text-field/props.d.ts +16 -1
- package/dist/components/text-field/props.d.ts.map +1 -1
- package/dist/components/text-field/style.css +105 -31
- package/dist/components/toolbar/main.d.ts.map +1 -1
- package/dist/components/toolbar/main.js +18 -20
- package/dist/components/toolbar/main.js.map +1 -1
- package/dist/components/toolbar/props.d.ts +10 -4
- package/dist/components/toolbar/props.d.ts.map +1 -1
- package/dist/components/toolbar/style.css +13 -13
- package/dist/components/tooltip/main.js +4 -4
- package/dist/components/tooltip/main.js.map +1 -1
- package/dist/components/tooltip/style.css +5 -5
- package/dist/components/typography/main.d.ts +2 -2
- package/dist/components/typography/main.d.ts.map +1 -1
- package/dist/components/typography/main.js +10 -12
- package/dist/components/typography/main.js.map +1 -1
- package/dist/components/typography/props.d.ts +9 -9
- package/dist/components/typography/props.d.ts.map +1 -1
- package/dist/components/typography/style.css +503 -503
- package/dist/components/utils/main.d.ts +52 -6
- package/dist/components/utils/main.d.ts.map +1 -1
- package/dist/components/utils/main.js +163 -6
- package/dist/components/utils/main.js.map +1 -1
- package/dist/components/utils/props.d.ts +24 -3
- package/dist/components/utils/props.d.ts.map +1 -1
- package/dist/components/utils/style.css +4 -4
- package/dist/components/viewport/edge-effect.d.ts +10 -0
- package/dist/components/viewport/edge-effect.d.ts.map +1 -0
- package/dist/components/viewport/edge-effect.js +100 -0
- package/dist/components/viewport/edge-effect.js.map +1 -0
- package/dist/components/viewport/edge.d.ts +39 -0
- package/dist/components/viewport/edge.d.ts.map +1 -0
- package/dist/components/viewport/edge.js +151 -0
- package/dist/components/viewport/edge.js.map +1 -0
- package/dist/components/viewport/input.d.ts +19 -3
- package/dist/components/viewport/input.d.ts.map +1 -1
- package/dist/components/viewport/input.js +197 -12
- package/dist/components/viewport/input.js.map +1 -1
- package/dist/components/viewport/main.d.ts +10 -5
- package/dist/components/viewport/main.d.ts.map +1 -1
- package/dist/components/viewport/main.js +327 -90
- package/dist/components/viewport/main.js.map +1 -1
- package/dist/components/viewport/padding.d.ts +31 -3
- package/dist/components/viewport/padding.d.ts.map +1 -1
- package/dist/components/viewport/padding.js +116 -17
- package/dist/components/viewport/padding.js.map +1 -1
- package/dist/components/viewport/props.d.ts +69 -8
- package/dist/components/viewport/props.d.ts.map +1 -1
- package/dist/components/viewport/style.css +230 -6
- package/dist/styles.css +285 -302
- package/package.json +4 -4
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
/* Contextual-menu (see main.tsx). */
|
|
2
2
|
@layer uikit-ish {
|
|
3
|
-
.uikit-contextual-menu-scroller {
|
|
4
|
-
position: fixed;
|
|
5
|
-
|
|
6
|
-
/* An overlay: above the page's layers (e.g. Viewport's bars), overlays
|
|
7
|
-
among themselves in the order they open (see Menu). */
|
|
8
|
-
z-index: 100;
|
|
9
|
-
overflow: hidden auto;
|
|
10
|
-
inset: 0;
|
|
11
|
-
overscroll-behavior: contain;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
3
|
.uikit-contextual-menu-trigger {
|
|
15
4
|
display: inline-flex;
|
|
16
5
|
|
|
@@ -18,11 +7,13 @@
|
|
|
18
7
|
transition-duration: 300ms;
|
|
19
8
|
transition-property: translate, opacity;
|
|
20
9
|
transition-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
|
|
21
|
-
translate:
|
|
10
|
+
translate: var(--uikit-contextual-menu-lift-x, 0)
|
|
11
|
+
var(--uikit-contextual-menu-lift-y, 0);
|
|
22
12
|
}
|
|
23
13
|
|
|
24
|
-
/* Lifted
|
|
25
|
-
|
|
14
|
+
/* Lifted onto the preview's slot (see main.tsx): above the backdrop and
|
|
15
|
+
the menu (overlays at 100, see Menu), as far as its ancestors'
|
|
16
|
+
stacking contexts let it. */
|
|
26
17
|
&[data-lifted] {
|
|
27
18
|
position: relative;
|
|
28
19
|
z-index: 101;
|
|
@@ -31,11 +22,6 @@
|
|
|
31
22
|
&[data-previewed] > * {
|
|
32
23
|
opacity: 0;
|
|
33
24
|
}
|
|
34
|
-
|
|
35
|
-
/* Scrolled (too tall, see Root): following it at once. */
|
|
36
|
-
&[data-overflowing] > * {
|
|
37
|
-
transition-property: opacity;
|
|
38
|
-
}
|
|
39
25
|
}
|
|
40
26
|
|
|
41
27
|
.uikit-contextual-menu-backdrop {
|
|
@@ -52,32 +38,72 @@
|
|
|
52
38
|
}
|
|
53
39
|
}
|
|
54
40
|
|
|
55
|
-
/*
|
|
56
|
-
trigger
|
|
57
|
-
.uikit-contextual-menu-
|
|
58
|
-
|
|
41
|
+
/* The stack (see main.tsx): the preview's slot, then the menu, aligned
|
|
42
|
+
to the trigger as the menu is (`data-align`). */
|
|
43
|
+
.uikit-contextual-menu-positioner {
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
align-items: center;
|
|
47
|
+
gap: 8px;
|
|
48
|
+
|
|
49
|
+
&[data-align='start'] {
|
|
50
|
+
align-items: flex-start;
|
|
51
|
+
}
|
|
59
52
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
53
|
+
&[data-align='end'] {
|
|
54
|
+
align-items: flex-end;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* The menu: the room left below the slot (taller, it scrolls). */
|
|
58
|
+
& > .uikit-menu-popup {
|
|
59
|
+
max-height: calc(
|
|
60
|
+
var(--available-height) - var(--uikit-contextual-menu-slot, 0px) -
|
|
61
|
+
8px
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.uikit-contextual-menu-slot {
|
|
67
|
+
display: flex;
|
|
68
|
+
max-width: var(--available-width);
|
|
69
|
+
flex: none;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
}
|
|
64
72
|
|
|
65
|
-
|
|
66
|
-
|
|
73
|
+
/* (Not pressed, as the preview isn't: outside the menu, see Menu's
|
|
74
|
+
positioner.) */
|
|
75
|
+
.uikit-contextual-menu-positioner > .uikit-contextual-menu-slot {
|
|
67
76
|
pointer-events: none;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* In the slot: at most the room the menu leaves (or, the menu taller,
|
|
80
|
+
half of it), clipped; scaling in from the trigger's place, out as the
|
|
81
|
+
menu closes. Shown as the trigger is pressed: the release is the
|
|
82
|
+
trigger's (Base UI cancels opening a menu released elsewhere). */
|
|
83
|
+
.uikit-contextual-menu-preview {
|
|
84
|
+
overflow: clip;
|
|
85
|
+
max-width: var(--available-width);
|
|
86
|
+
max-height: calc(
|
|
87
|
+
var(--available-height) - 8px -
|
|
88
|
+
min(
|
|
89
|
+
var(--uikit-contextual-menu-popup, 0px),
|
|
90
|
+
var(--available-height) / 2
|
|
91
|
+
)
|
|
92
|
+
);
|
|
93
|
+
pointer-events: none;
|
|
94
|
+
transform-origin: top;
|
|
68
95
|
transition-duration: 300ms;
|
|
69
|
-
transition-property:
|
|
96
|
+
transition-property: scale, opacity;
|
|
70
97
|
transition-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
|
|
71
|
-
translate: 0 calc(var(--uikit-contextual-menu-lift, 0) * -1px);
|
|
72
98
|
|
|
73
99
|
@starting-style {
|
|
74
100
|
opacity: 0;
|
|
75
101
|
scale: 0.8;
|
|
76
102
|
}
|
|
77
103
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
104
|
+
.uikit-contextual-menu-positioner[data-closed] & {
|
|
105
|
+
opacity: 0;
|
|
106
|
+
scale: 0.8;
|
|
81
107
|
}
|
|
82
108
|
}
|
|
83
109
|
}
|
|
@@ -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,EAQV,MAAM,OAAO,CAAC;AAEf,OAAO,EAAU,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAO5D,OAAO,KAAK,EACV,cAAc,EAEd,oBAAoB,EACpB,aAAa,EAGb,yBAAyB,EAIzB,eAAe,EAMf,aAAa,EACd,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,4BAA4B,EAC5B,yBAAyB,EACzB,cAAc,EACd,cAAc,EACd,gCAAgC,EAChC,eAAe,EACf,eAAe,EACf,SAAS,EACT,YAAY,EACZ,aAAa,EACb,SAAS,EACT,aAAa,GACd,MAAM,YAAY,CAAC;
|
|
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,EAQV,MAAM,OAAO,CAAC;AAEf,OAAO,EAAU,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAO5D,OAAO,KAAK,EACV,cAAc,EAEd,oBAAoB,EACpB,aAAa,EAGb,yBAAyB,EAIzB,eAAe,EAMf,aAAa,EACd,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,4BAA4B,EAC5B,yBAAyB,EACzB,cAAc,EACd,cAAc,EACd,gCAAgC,EAChC,eAAe,EACf,eAAe,EACf,SAAS,EACT,YAAY,EACZ,aAAa,EACb,SAAS,EACT,aAAa,GACd,MAAM,YAAY,CAAC;AAy3DpB,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAE1E,eAAO,MAAM,UAAU;;;;;gBAljBqC,MAAM;;;;;;gBA7pCtD,eAAe,CAAC,aAAa,CAAC;;;;;kBAqoC9B,cAAc;QACxB;;;WAGG;gBACK,SAAS;;;;;;CA+kBlB,CAAC"}
|
|
@@ -14,38 +14,33 @@ import { Roll } from '../roll/main.js';
|
|
|
14
14
|
import { cn } from '../utils/main.js';
|
|
15
15
|
import { createHandle } from './handle.js';
|
|
16
16
|
import { useMonthPager } from './pager.js';
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
// on the tint at 12%.
|
|
17
|
+
// Collapsed buttons (default and selected) and pickers (inline and
|
|
18
|
+
// compact), light and dark, in the semantic colors: the collapsed buttons
|
|
19
|
+
// `tertiarySystemFill`, text `label` (selected: the tint), weekdays
|
|
20
|
+
// `tertiaryLabel`, today and the arrows in the tint, the selected day on the
|
|
21
|
+
// tint at 12%, the separator `separator`. Ranges follow Framework7
|
|
22
|
+
// (`calendar-ios.less`): their ends on the tint, the days between on the
|
|
23
|
+
// tint at 12%.
|
|
25
24
|
//
|
|
26
|
-
// A date picker
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
// days between.
|
|
25
|
+
// A date picker: `mode` picks a date, a time or both; `pickerStyle` shows
|
|
26
|
+
// them `compact` (collapsed buttons, opening the calendar or the time in a
|
|
27
|
+
// popover, a Base UI `Popover`) or `inline` (the calendar in place). Names,
|
|
28
|
+
// numerals, the hour cycle and the week's first day follow the locale
|
|
29
|
+
// (`Intl`). With `range`, two days are picked: a start and an end
|
|
30
|
+
// (Framework7 `rangePicker`), highlighted with the days between.
|
|
33
31
|
//
|
|
34
32
|
// The calendar is a group of day buttons (one tabbable): arrow keys move by
|
|
35
33
|
// a day or week, Page Up/Down by a month, Home/End to the week's ends. Its
|
|
36
|
-
// title opens a month and year roll (see `Roll`) over the days
|
|
37
|
-
//
|
|
38
|
-
//
|
|
34
|
+
// title opens a month and year roll (see `Roll`) over the days, the time's
|
|
35
|
+
// button a roll of hours and minutes (both editable: pressing the selected
|
|
36
|
+
// row, or typing, enters a number), as the compact time's popover.
|
|
39
37
|
//
|
|
40
|
-
//
|
|
41
|
-
// - The rolls take the days' place (
|
|
42
|
-
//
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
// - The
|
|
46
|
-
// from the sides.
|
|
47
|
-
// - The collapsed buttons are capsules (or, `buttonShape`, Figma's 6px
|
|
48
|
-
// corners).
|
|
38
|
+
// Also:
|
|
39
|
+
// - The rolls take the days' place (the time's too).
|
|
40
|
+
// - The popover is `Popover`'s (the menus' glass, see there), its corners
|
|
41
|
+
// 13px.
|
|
42
|
+
// - The calendar's width is a minimum: 7 × 44px days, 16px from the sides.
|
|
43
|
+
// - The collapsed buttons are capsules (or, `buttonShape`, 6px corners).
|
|
49
44
|
// What swiping the days does (see `swipe`): a range dragged only picking
|
|
50
45
|
// one.
|
|
51
46
|
const swipeOf = (swipe, isRange) => {
|
|
@@ -137,13 +132,18 @@ const rangePlace = (day, range) => {
|
|
|
137
132
|
return 'middle';
|
|
138
133
|
return undefined;
|
|
139
134
|
};
|
|
135
|
+
/**
|
|
136
|
+
* How long (ms) after a month settled (a swipe's scroll ending) the
|
|
137
|
+
* calendar's height changes (see `CalendarPanel`).
|
|
138
|
+
*/
|
|
139
|
+
const resizeDelay = 200;
|
|
140
140
|
/** Controlled or uncontrolled state (as Base UI's components). */
|
|
141
141
|
const useControlled = (value, defaultValue) => {
|
|
142
142
|
const [state, setState] = useState(defaultValue);
|
|
143
143
|
return [value === undefined ? state : value, setState];
|
|
144
144
|
};
|
|
145
145
|
const CollapsedButton = forwardRef(({ className, shape, ...props }, ref) => (_jsx(Button.Root, { ref: ref, shape: shape === 'roundedRectangle' ? 'roundedRectangle' : 'capsule', type: "button", variant: "bordered-secondary", ...props, className: cn('uikit-date-picker-collapsed-button', className), "data-date-picker-part": "collapsed-button" })));
|
|
146
|
-
//
|
|
146
|
+
// A time row: a 52px row, the title (Body) and the time.
|
|
147
147
|
const TimeRow = forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn('uikit-date-picker-time-row', className), "data-date-picker-part": "time-row", ...props })));
|
|
148
148
|
const Chevron = ({ isNext }) => (_jsx("svg", { "aria-hidden": "true", fill: "none", height: "20", stroke: "currentcolor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2.4", viewBox: "0 0 12 20", width: "12", children: _jsx("path", { d: isNext ? 'M3 2l7 8-7 8' : 'M9 2l-7 8 7 8' }) }));
|
|
149
149
|
const Disclosure = () => (_jsx("svg", { "aria-hidden": "true", fill: "none", height: "0.75em", stroke: "currentcolor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", viewBox: "0 0 8 14", width: "0.43em", children: _jsx("path", { d: "M1.5 1.5L6.5 7l-5 5.5" }) }));
|
|
@@ -197,8 +197,7 @@ const TimeRoll = ({ hourCycle: cycle, locale, max, min, onValueChange: onChange,
|
|
|
197
197
|
: Array.from({ length: 24 }, (_, index) => index);
|
|
198
198
|
const twelveHour = hourCycle === 'h12' ? hours % 12 || 12 : hours % 12;
|
|
199
199
|
const shownHour = twelve ? twelveHour : hours;
|
|
200
|
-
// Beyond the limits: the nearest within them (the roll moving back
|
|
201
|
-
// UIKit's).
|
|
200
|
+
// Beyond the limits: the nearest within them (the roll moving back).
|
|
202
201
|
const set = (hour, minute, { event }) => {
|
|
203
202
|
let next = at(hour, minute);
|
|
204
203
|
if (min !== undefined && next < min)
|
|
@@ -332,7 +331,7 @@ const formValueOf = (value, mode = 'date') => {
|
|
|
332
331
|
* `name`, or, in a Base UI `Field`, as the field's.
|
|
333
332
|
*/
|
|
334
333
|
const FormValue = ({ form, mode, name, isOmitted = false, value }) => isOmitted ? null : (_jsx(BaseField.Control, { form: form, name: name, type: "hidden", value: formValueOf(value, mode) }));
|
|
335
|
-
/** The calendar (
|
|
334
|
+
/** The calendar (inline), with an optional time row. */
|
|
336
335
|
const CalendarPanel = (props) => {
|
|
337
336
|
const { firstDayOfWeek: weekStartProp, highlighted, highlightedWeekdays = [], hourCycle, isDateDisabled, label, locale, max, min, showAdjacentMonths, time, } = props;
|
|
338
337
|
const { dragged, draggedFrom, range, setDragged, setDraggedFrom, setValue, single, value, } = useCalendarValue(props);
|
|
@@ -351,7 +350,10 @@ const CalendarPanel = (props) => {
|
|
|
351
350
|
monthRef.current = month;
|
|
352
351
|
});
|
|
353
352
|
const suppressClick = useRef(false);
|
|
354
|
-
|
|
353
|
+
// The body's height, and its transition running (see below).
|
|
354
|
+
const bodyRef = useRef(null);
|
|
355
|
+
const bodyHeight = useRef(undefined);
|
|
356
|
+
const transition = useRef(undefined);
|
|
355
357
|
const titleId = useId();
|
|
356
358
|
const rollId = useId();
|
|
357
359
|
const formats = useMemo(() => ({
|
|
@@ -391,22 +393,73 @@ const CalendarPanel = (props) => {
|
|
|
391
393
|
});
|
|
392
394
|
// The strip as high as the shown month's days (its neighbours' clipped),
|
|
393
395
|
// as they're laid out (not while hidden, e.g. in a closed row: none).
|
|
396
|
+
// Months of more or fewer weeks: the strip resized at once, the body
|
|
397
|
+
// around it transitioning (its content clipped meanwhile), a moment after
|
|
398
|
+
// the month settled (`resizeDelay`: resized as a swipe settled, it
|
|
399
|
+
// faltered). Under a roll, kept as it was (no shifts mid-roll):
|
|
400
|
+
// transitioning once the roll closes, at once.
|
|
401
|
+
const isRolled = rolled !== undefined;
|
|
402
|
+
const wasRolled = useRef(isRolled);
|
|
394
403
|
useLayoutEffect(() => {
|
|
395
404
|
const { current: days } = daysRef;
|
|
396
405
|
const { current: pages } = pagesRef;
|
|
397
|
-
|
|
406
|
+
const { current: body } = bodyRef;
|
|
407
|
+
const isClosing = wasRolled.current && !isRolled;
|
|
408
|
+
wasRolled.current = isRolled;
|
|
409
|
+
if (!days || !pages || !body || isRolled)
|
|
398
410
|
return undefined;
|
|
411
|
+
let isPending = false;
|
|
399
412
|
const fit = () => {
|
|
400
413
|
if (days.offsetHeight === 0)
|
|
401
|
-
return;
|
|
402
|
-
height.current = days.offsetHeight;
|
|
414
|
+
return false;
|
|
403
415
|
pages.style.height = `${String(days.offsetHeight)}px`;
|
|
416
|
+
return true;
|
|
417
|
+
};
|
|
418
|
+
const resize = () => {
|
|
419
|
+
isPending = false;
|
|
420
|
+
if (!fit())
|
|
421
|
+
return;
|
|
422
|
+
const next = body.offsetHeight;
|
|
423
|
+
const previous = bodyHeight.current;
|
|
424
|
+
bodyHeight.current = next;
|
|
425
|
+
if (previous === undefined || previous === next)
|
|
426
|
+
return;
|
|
427
|
+
transition.current?.cancel();
|
|
428
|
+
body.style.overflow = 'clip';
|
|
429
|
+
const animation = body.animate([{ height: `${String(previous)}px` }, { height: `${String(next)}px` }], { duration: 300, easing: 'ease' });
|
|
430
|
+
transition.current = animation;
|
|
431
|
+
const done = () => {
|
|
432
|
+
if (transition.current === animation) {
|
|
433
|
+
body.style.removeProperty('overflow');
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
animation.addEventListener('finish', done);
|
|
437
|
+
animation.addEventListener('cancel', done);
|
|
404
438
|
};
|
|
405
|
-
|
|
406
|
-
|
|
439
|
+
let timer;
|
|
440
|
+
if (bodyHeight.current === undefined || isClosing) {
|
|
441
|
+
resize();
|
|
442
|
+
}
|
|
443
|
+
else {
|
|
444
|
+
isPending = true;
|
|
445
|
+
timer = setTimeout(resize, resizeDelay);
|
|
446
|
+
}
|
|
447
|
+
// Resized otherwise (e.g. the text size): at once, the body's height
|
|
448
|
+
// as it is (not mid-transition: its own then).
|
|
449
|
+
const observer = new ResizeObserver(() => {
|
|
450
|
+
if (isPending)
|
|
451
|
+
return;
|
|
452
|
+
fit();
|
|
453
|
+
if (transition.current?.playState === 'running')
|
|
454
|
+
return;
|
|
455
|
+
bodyHeight.current = body.offsetHeight;
|
|
456
|
+
});
|
|
407
457
|
observer.observe(days);
|
|
408
|
-
return () =>
|
|
409
|
-
|
|
458
|
+
return () => {
|
|
459
|
+
clearTimeout(timer);
|
|
460
|
+
observer.disconnect();
|
|
461
|
+
};
|
|
462
|
+
}, [isRolled, month, weekStart]);
|
|
410
463
|
// The months side by side, scrolled sideways (see pager.ts): turned to,
|
|
411
464
|
// by scrolling, its day focused.
|
|
412
465
|
const isPreviousDisabled = Boolean(min && addDays(startOfMonth(month), -1) < startOfDay(min));
|
|
@@ -433,24 +486,6 @@ const CalendarPanel = (props) => {
|
|
|
433
486
|
pagesRef,
|
|
434
487
|
});
|
|
435
488
|
const { goTo } = pager;
|
|
436
|
-
// Months of more or fewer weeks: once settled on one (not while
|
|
437
|
-
// scrolled: a native touch drag would falter), the strip's height
|
|
438
|
-
// transitioning (between heights laid out).
|
|
439
|
-
useLayoutEffect(() => {
|
|
440
|
-
const { current: days } = daysRef;
|
|
441
|
-
const { current: pages } = pagesRef;
|
|
442
|
-
if (!days || !pages)
|
|
443
|
-
return;
|
|
444
|
-
const next = days.offsetHeight;
|
|
445
|
-
const previous = height.current;
|
|
446
|
-
if (next === 0)
|
|
447
|
-
return;
|
|
448
|
-
height.current = next;
|
|
449
|
-
pages.style.height = `${String(next)}px`;
|
|
450
|
-
if (previous === undefined || previous === next)
|
|
451
|
-
return;
|
|
452
|
-
pages.animate([{ height: `${String(previous)}px` }, { height: `${String(next)}px` }], { duration: 300, easing: 'ease' });
|
|
453
|
-
}, [month, weekStart]);
|
|
454
489
|
// Moved by keyboard: on past disabled days (in the direction moved), to
|
|
455
490
|
// one that can be focused.
|
|
456
491
|
const moveTo = (date) => {
|
|
@@ -676,7 +711,7 @@ const CalendarPanel = (props) => {
|
|
|
676
711
|
const neighbour = (shown) => (_jsx("div", { inert: true, "aria-hidden": "true", className: "uikit-date-picker-weeks", "data-date-picker-part": "weeks", children: monthWeeks(shown, weekStart)
|
|
677
712
|
.flat()
|
|
678
713
|
.map((day) => cell(day, shown, false)) }, shown.getTime()));
|
|
679
|
-
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": "Previous month", 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": "Next month", 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", { 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, 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, onPointerCancel: onPointerEnd, onPointerDown: onPointerDown, onPointerMove: onPointerMove, onPointerUp: onPointerEnd, onClickCapture: (event) => {
|
|
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": "Previous month", 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": "Next month", 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, 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, onPointerCancel: onPointerEnd, onPointerDown: onPointerDown, onPointerMove: onPointerMove, onPointerUp: onPointerEnd, onClickCapture: (event) => {
|
|
680
715
|
if (!suppressClick.current)
|
|
681
716
|
return;
|
|
682
717
|
suppressClick.current = false;
|
|
@@ -688,7 +723,7 @@ const CalendarPanel = (props) => {
|
|
|
688
723
|
setFocused(day);
|
|
689
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 })] }));
|
|
690
725
|
};
|
|
691
|
-
/** A footer row (see `CalendarProps` `footer`):
|
|
726
|
+
/** A footer row (see `CalendarProps` `footer`): a time row's, 52px. */
|
|
692
727
|
const CalendarRow = TimeRow;
|
|
693
728
|
/** A footer button (see `CalendarProps` `footer`): a collapsed button. */
|
|
694
729
|
const CalendarButton = CollapsedButton;
|
|
@@ -699,11 +734,11 @@ const CalendarButton = CollapsedButton;
|
|
|
699
734
|
*/
|
|
700
735
|
const CalendarMessage = forwardRef(({ className, variant = 'info', ...props }, ref) => (_jsx("p", { ref: ref, "aria-live": "polite", "data-variant": variant, role: variant === 'error' ? 'alert' : undefined, ...props, className: cn('uikit-date-picker-message', className), "data-date-picker-part": "message" })));
|
|
701
736
|
/**
|
|
702
|
-
* The footer's
|
|
737
|
+
* The footer's time row: the time's button, showing its
|
|
703
738
|
* roll; the picker's default footer, with a time.
|
|
704
739
|
*/
|
|
705
740
|
const CalendarTimeRow = ({ calendar, label = 'Time' }) => calendar.time ? (_jsxs(CalendarRow, { children: [_jsx("span", { "aria-hidden": "true", children: label }), _jsx(CalendarButton, { "aria-controls": calendar.time.controls, "aria-expanded": calendar.time.shown, "aria-label": "Time", disabled: calendar.disabled, shape: calendar.buttonShape, onClick: calendar.time.toggle, children: calendar.time.label })] })) : null;
|
|
706
|
-
/** The calendar (
|
|
741
|
+
/** The calendar (inline, without the time). */
|
|
707
742
|
const Calendar = (props) => _jsx(CalendarPanel, { ...props });
|
|
708
743
|
/** The calendar's props, of the picker's (its value, and its changes). */
|
|
709
744
|
const calendarPropsOf = (props, change, value) => {
|
|
@@ -775,8 +810,8 @@ const dateLabelOf = (format, range, single) => {
|
|
|
775
810
|
};
|
|
776
811
|
/**
|
|
777
812
|
* The compact style's calendar popover: from the date's button, or, with a
|
|
778
|
-
* time, from the time's too, with the time's roll shown (
|
|
779
|
-
*
|
|
813
|
+
* time, from the time's too, with the time's roll shown (one popover for
|
|
814
|
+
* both).
|
|
780
815
|
*/
|
|
781
816
|
const CalendarPopover = ({ align, children, dateLabel, isDisabled, onOpenChange, open, shape, timeLabel, }) => {
|
|
782
817
|
const dateTriggerId = useId();
|
|
@@ -860,7 +895,7 @@ const useListSync = (handle, open, changeOpen) => {
|
|
|
860
895
|
}, [isPickerOpen]);
|
|
861
896
|
};
|
|
862
897
|
/**
|
|
863
|
-
* A date picker
|
|
898
|
+
* A date picker: a date, a time or both (`mode`), or
|
|
864
899
|
* a range of dates (`range`); collapsed buttons opening the calendar or the
|
|
865
900
|
* time in a popover (or toggling `open`, without `popover`), or the
|
|
866
901
|
* calendar in place (`pickerStyle`).
|
|
@@ -909,8 +944,7 @@ const Root = (props) => {
|
|
|
909
944
|
/**
|
|
910
945
|
* A date picker's pickers in place (see `Root` `handle`): its calendar and
|
|
911
946
|
* time roll, each in collapsible list rows (`List.CollapsiblePanel`),
|
|
912
|
-
* opened by its buttons; placed after the picker's row (
|
|
913
|
-
* Calendar). In an `List.AccordionItem` (with its row), one of its items.
|
|
947
|
+
* opened by its buttons; placed after the picker's row. In an `List.AccordionItem` (with its row), one of its items.
|
|
914
948
|
*/
|
|
915
949
|
const Expandable = ({ handle, }) => {
|
|
916
950
|
const { calendar, open, time } = useSyncExternalStore(handle.subscribe, handle.getSnapshot);
|