@lekoala/date-picker 0.4.0 → 0.5.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/README.md +281 -265
- package/custom-elements.json +10 -0
- package/dist/date-picker.css +20 -15
- package/dist/date-picker.js +199 -115
- package/dist/date-picker.min.css +1 -1
- package/dist/date-picker.min.js +13 -13
- package/dist/date-picker.standalone.min.js +34 -29
- package/dist/types/control-classes.d.ts +30 -0
- package/dist/types/control-classes.d.ts.map +1 -0
- package/dist/types/date-calendar.d.ts +15 -0
- package/dist/types/date-calendar.d.ts.map +1 -1
- package/dist/types/date-picker.d.ts +15 -0
- package/dist/types/date-picker.d.ts.map +1 -1
- package/dist/types/date.d.ts +4 -2
- package/dist/types/date.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/intl.d.ts.map +1 -1
- package/dist/types/source.d.ts +1 -0
- package/dist/types/source.d.ts.map +1 -1
- package/docs/API.md +430 -408
- package/docs/DECISIONS.md +68 -62
- package/docs/USE_CASES.md +156 -144
- package/package.json +3 -3
- package/src/control-classes.js +50 -0
- package/src/date-calendar.js +47 -16
- package/src/date-field.js +1 -1
- package/src/date-picker.css +20 -15
- package/src/date-picker.js +47 -46
- package/src/date.js +8 -3
- package/src/index.js +1 -0
- package/src/intl.js +39 -10
- package/src/source.js +14 -4
package/dist/date-picker.css
CHANGED
|
@@ -46,7 +46,7 @@ date-calendar {
|
|
|
46
46
|
|
|
47
47
|
.dp-calendar-header {
|
|
48
48
|
display: grid;
|
|
49
|
-
grid-template-columns: minmax(0, 1fr)
|
|
49
|
+
grid-template-columns: minmax(0, 1fr) var(--dp-year-inline-size) auto auto;
|
|
50
50
|
/* Stretch (not center): once a UA natural height exceeds
|
|
51
51
|
--dp-header-control-size, the row grows to the tallest control and the
|
|
52
52
|
others stretch to match, so month/year/nav stay equal. */
|
|
@@ -62,12 +62,16 @@ date-calendar {
|
|
|
62
62
|
track stays under the month select so the fixed-width year input never
|
|
63
63
|
stretches. Visual mirroring itself is left to the inherited `dir`. */
|
|
64
64
|
date-calendar[data-year-first] .dp-calendar-header {
|
|
65
|
-
grid-template-columns:
|
|
65
|
+
grid-template-columns: var(--dp-year-inline-size) minmax(0, 1fr) auto auto;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
.dp-calendar-header :where(button, select, input) {
|
|
69
|
-
min-block-size: var(--dp-header-control-size);
|
|
70
69
|
box-sizing: border-box;
|
|
70
|
+
min-inline-size: 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.dp-calendar-header .dp-skin {
|
|
74
|
+
min-block-size: var(--dp-header-control-size);
|
|
71
75
|
/* Shared vertical metrics: UA default padding/line-height differ per control
|
|
72
76
|
(up to ~13px apart), which only shows once --dp-header-control-size drops
|
|
73
77
|
below content size. */
|
|
@@ -80,8 +84,7 @@ date-calendar[data-year-first] .dp-calendar-header {
|
|
|
80
84
|
line-height: 1.2;
|
|
81
85
|
}
|
|
82
86
|
|
|
83
|
-
.dp-calendar-header input {
|
|
84
|
-
min-inline-size: 0;
|
|
87
|
+
.dp-calendar-header input.dp-skin {
|
|
85
88
|
padding-inline: 0.45rem;
|
|
86
89
|
}
|
|
87
90
|
|
|
@@ -91,11 +94,13 @@ date-calendar[data-year-first] .dp-calendar-header {
|
|
|
91
94
|
control and the others stretch to match. */
|
|
92
95
|
.dp-month-select {
|
|
93
96
|
inline-size: 100%;
|
|
94
|
-
min-inline-size: 0;
|
|
95
97
|
/* Long month names in a narrow track (compact consumers, long locales)
|
|
96
98
|
would paint under the caret: truncate with an ellipsis instead. */
|
|
97
99
|
overflow: hidden;
|
|
98
100
|
text-overflow: ellipsis;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.dp-month-select.dp-skin {
|
|
99
104
|
appearance: none;
|
|
100
105
|
padding-inline: 0.45rem 2rem;
|
|
101
106
|
background-image:
|
|
@@ -111,18 +116,18 @@ date-calendar[data-year-first] .dp-calendar-header {
|
|
|
111
116
|
/* Inherited RTL mirrors the header layout via the grid. The logical
|
|
112
117
|
`padding-inline` already flips, so only the physically-positioned caret has
|
|
113
118
|
to follow it to the other side. */
|
|
114
|
-
[dir="rtl"] .dp-month-select,
|
|
115
|
-
html[dir="rtl"] .dp-month-select {
|
|
119
|
+
[dir="rtl"] .dp-month-select.dp-skin,
|
|
120
|
+
html[dir="rtl"] .dp-month-select.dp-skin {
|
|
116
121
|
background-position:
|
|
117
122
|
0.9rem 50%,
|
|
118
123
|
0.65rem 50%;
|
|
119
124
|
}
|
|
120
125
|
|
|
121
126
|
.dp-year-input {
|
|
122
|
-
inline-size:
|
|
127
|
+
inline-size: 100%;
|
|
123
128
|
}
|
|
124
129
|
|
|
125
|
-
.dp-nav {
|
|
130
|
+
.dp-nav.dp-skin {
|
|
126
131
|
display: grid;
|
|
127
132
|
place-items: center;
|
|
128
133
|
inline-size: var(--dp-header-control-size);
|
|
@@ -139,19 +144,19 @@ html[dir="rtl"] .dp-month-select {
|
|
|
139
144
|
pointer-events: none;
|
|
140
145
|
}
|
|
141
146
|
|
|
142
|
-
.dp-calendar-header :
|
|
147
|
+
.dp-calendar-header .dp-skin:disabled,
|
|
143
148
|
.dp-picker-button:disabled {
|
|
144
149
|
cursor: not-allowed;
|
|
145
150
|
opacity: 0.45;
|
|
146
151
|
}
|
|
147
152
|
|
|
148
|
-
.dp-nav:hover:not(:disabled) {
|
|
153
|
+
.dp-nav.dp-skin:hover:not(:disabled) {
|
|
149
154
|
background: var(--dp-hover);
|
|
150
155
|
}
|
|
151
156
|
|
|
152
157
|
/* Inner outlines survive forced colors and keep focus inside each control.
|
|
153
158
|
The picker trigger uses a tighter inset around its icon below. */
|
|
154
|
-
.dp-calendar-header :
|
|
159
|
+
.dp-calendar-header .dp-skin:focus-visible,
|
|
155
160
|
date-picker > input:not([type="hidden"]):focus-visible,
|
|
156
161
|
.dp-day:focus-visible {
|
|
157
162
|
outline: var(--dp-focus-width) solid var(--dp-focus);
|
|
@@ -446,8 +451,8 @@ date-picker[range] > .dp-picker-button[data-endpoint="end"] {
|
|
|
446
451
|
@media (forced-colors: active) {
|
|
447
452
|
/* The author-drawn caret is a gradient and disappears here: hand the
|
|
448
453
|
control back to the browser instead of trying to rebuild it. */
|
|
449
|
-
.dp-month-select,
|
|
450
|
-
[dir="rtl"] .dp-month-select {
|
|
454
|
+
.dp-month-select.dp-skin,
|
|
455
|
+
[dir="rtl"] .dp-month-select.dp-skin {
|
|
451
456
|
appearance: auto;
|
|
452
457
|
background-image: none;
|
|
453
458
|
padding-inline: 0.45rem;
|