@lekoala/slot-picker 0.1.0 → 0.1.2
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 +85 -39
- package/custom-elements.json +0 -5
- package/dist/slot-picker.css +22 -0
- package/dist/slot-picker.js +160 -134
- package/dist/slot-picker.min.css +1 -1
- package/dist/slot-picker.min.js +24 -24
- package/dist/types/date.d.ts +8 -1
- package/dist/types/date.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/locales/ar.d.ts +0 -1
- package/dist/types/locales/ar.d.ts.map +1 -1
- package/dist/types/locales/de.d.ts +0 -1
- package/dist/types/locales/de.d.ts.map +1 -1
- package/dist/types/locales/en.d.ts +0 -1
- package/dist/types/locales/en.d.ts.map +1 -1
- package/dist/types/locales/es.d.ts +0 -1
- package/dist/types/locales/es.d.ts.map +1 -1
- package/dist/types/locales/fr.d.ts +0 -1
- package/dist/types/locales/fr.d.ts.map +1 -1
- package/dist/types/locales/hi.d.ts +0 -1
- package/dist/types/locales/hi.d.ts.map +1 -1
- package/dist/types/locales/id.d.ts +0 -1
- package/dist/types/locales/id.d.ts.map +1 -1
- package/dist/types/locales/it.d.ts +0 -1
- package/dist/types/locales/it.d.ts.map +1 -1
- package/dist/types/locales/ja.d.ts +0 -1
- package/dist/types/locales/ja.d.ts.map +1 -1
- package/dist/types/locales/ko.d.ts +0 -1
- package/dist/types/locales/ko.d.ts.map +1 -1
- package/dist/types/locales/nl.d.ts +0 -1
- package/dist/types/locales/nl.d.ts.map +1 -1
- package/dist/types/locales/pl.d.ts +0 -1
- package/dist/types/locales/pl.d.ts.map +1 -1
- package/dist/types/locales/pt-BR.d.ts +0 -1
- package/dist/types/locales/pt-BR.d.ts.map +1 -1
- package/dist/types/locales/pt-PT.d.ts +0 -1
- package/dist/types/locales/pt-PT.d.ts.map +1 -1
- package/dist/types/locales/ru.d.ts +0 -1
- package/dist/types/locales/ru.d.ts.map +1 -1
- package/dist/types/locales/tr.d.ts +0 -1
- package/dist/types/locales/tr.d.ts.map +1 -1
- package/dist/types/locales/zh-CN.d.ts +0 -1
- package/dist/types/locales/zh-CN.d.ts.map +1 -1
- package/dist/types/messages.d.ts +0 -3
- package/dist/types/messages.d.ts.map +1 -1
- package/dist/types/model.d.ts +58 -23
- package/dist/types/model.d.ts.map +1 -1
- package/dist/types/slot-picker.d.ts +25 -15
- package/dist/types/slot-picker.d.ts.map +1 -1
- package/dist/types/views/shared.d.ts +5 -4
- package/dist/types/views/shared.d.ts.map +1 -1
- package/docs/USE_CASES.md +24 -18
- package/package.json +1 -1
- package/src/date.js +11 -1
- package/src/index.js +13 -2
- package/src/locales/ar.js +0 -1
- package/src/locales/de.js +0 -1
- package/src/locales/en.js +0 -1
- package/src/locales/es.js +0 -1
- package/src/locales/fr.js +0 -1
- package/src/locales/hi.js +0 -1
- package/src/locales/id.js +0 -1
- package/src/locales/it.js +0 -1
- package/src/locales/ja.js +0 -1
- package/src/locales/ko.js +0 -1
- package/src/locales/nl.js +0 -1
- package/src/locales/pl.js +0 -1
- package/src/locales/pt-BR.js +0 -1
- package/src/locales/pt-PT.js +0 -1
- package/src/locales/ru.js +0 -1
- package/src/locales/tr.js +0 -1
- package/src/locales/zh-CN.js +0 -1
- package/src/messages.js +0 -1
- package/src/model.js +149 -55
- package/src/slot-picker.css +22 -0
- package/src/slot-picker.js +123 -100
- package/src/views/shared.js +10 -7
package/dist/types/model.d.ts
CHANGED
|
@@ -58,11 +58,11 @@ export declare function normalizeDays(input: SlotDay[]): {
|
|
|
58
58
|
}[];
|
|
59
59
|
/**
|
|
60
60
|
* Fill missing days so an empty day remains visible.
|
|
61
|
+
* The projected dates decide which columns exist; loaded data never does.
|
|
61
62
|
* @param {SlotDay[]} days
|
|
62
|
-
* @param {string}
|
|
63
|
-
* @param {number} dayCount
|
|
63
|
+
* @param {string[]} dates
|
|
64
64
|
*/
|
|
65
|
-
export declare function visibleDays(days: SlotDay[],
|
|
65
|
+
export declare function visibleDays(days: SlotDay[], dates: string[]): {
|
|
66
66
|
date: string;
|
|
67
67
|
slots: {
|
|
68
68
|
start: string;
|
|
@@ -105,14 +105,45 @@ export declare function collapsedDays(days: SlotDay[], maxVisibleRows: number, e
|
|
|
105
105
|
*/
|
|
106
106
|
export declare function isValidRange(min: string, max: string): boolean;
|
|
107
107
|
/**
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
* Invalid bounds (`min > max`) resolve to 0, never a magic window.
|
|
111
|
-
* @param {number} dayCount
|
|
108
|
+
* Keep a civil date inside an inclusive interval. Empty bounds are open.
|
|
109
|
+
* @param {string} date
|
|
112
110
|
* @param {string} min
|
|
113
111
|
* @param {string} max
|
|
114
112
|
*/
|
|
115
|
-
export declare function
|
|
113
|
+
export declare function clampDate(date: string, min: string, max: string): string;
|
|
114
|
+
/**
|
|
115
|
+
* Weekdays that are never projected as a column, as `Date#getDay` indexes
|
|
116
|
+
* (0 = Sunday). This is calendar structure, known before any data is loaded:
|
|
117
|
+
* it is not an availability rule and never inspects a `SlotDay`.
|
|
118
|
+
* @param {readonly number[]|null|undefined} input
|
|
119
|
+
* @returns {number[]}
|
|
120
|
+
*/
|
|
121
|
+
export declare function normalizeHiddenDays(input: readonly number[] | null | undefined): number[];
|
|
122
|
+
/**
|
|
123
|
+
* The projection: the civil dates actually rendered as columns.
|
|
124
|
+
*
|
|
125
|
+
* `dayCount` counts columns, never civil days. A hidden weekday widens the
|
|
126
|
+
* civil envelope instead of eating a column, so at equal width and bounds a
|
|
127
|
+
* window always keeps its capacity. Only `min`/`max` can return fewer dates
|
|
128
|
+
* than requested, because the interval itself holds too few projectable days.
|
|
129
|
+
* @param {string} start
|
|
130
|
+
* @param {number} dayCount
|
|
131
|
+
* @param {readonly number[]} [hiddenDays]
|
|
132
|
+
* @param {string} [min]
|
|
133
|
+
* @param {string} [max]
|
|
134
|
+
* @returns {string[]}
|
|
135
|
+
*/
|
|
136
|
+
export declare function projectDates(start: string, dayCount: number, hiddenDays?: readonly number[], min?: string, max?: string): string[];
|
|
137
|
+
/**
|
|
138
|
+
* Adjacent window, stepping by projected days so navigation preserves the
|
|
139
|
+
* column capacity. `direction` is 1 or -1.
|
|
140
|
+
* @param {string[]} dates
|
|
141
|
+
* @param {1|-1} direction
|
|
142
|
+
* @param {readonly number[]} [hiddenDays]
|
|
143
|
+
* @param {string} [min]
|
|
144
|
+
* @param {string} [max]
|
|
145
|
+
*/
|
|
146
|
+
export declare function stepStart(dates: string[], direction: 1 | -1, hiddenDays?: readonly number[], min?: string, max?: string): string;
|
|
116
147
|
/**
|
|
117
148
|
* Normalize an override ladder: descending widths, sane counts.
|
|
118
149
|
* @param {{minWidth?:number,dayCount?:number}[]} breakpoints
|
|
@@ -137,25 +168,26 @@ export declare function resolveVisibleDayCount(dayCount: number, width: number,
|
|
|
137
168
|
dayCount: number;
|
|
138
169
|
}[]): number;
|
|
139
170
|
/**
|
|
140
|
-
*
|
|
141
|
-
* count unless the interval itself is shorter.
|
|
171
|
+
* First projected day of the window `start` belongs to, inside the bounds.
|
|
142
172
|
* @param {string} start
|
|
143
173
|
* @param {string} min
|
|
144
174
|
* @param {string} max
|
|
145
175
|
* @param {number} dayCount
|
|
176
|
+
* @param {readonly number[]} [hiddenDays]
|
|
146
177
|
*/
|
|
147
|
-
export declare function clampStart(start: string, min: string, max: string, dayCount: number): string;
|
|
178
|
+
export declare function clampStart(start: string, min: string, max: string, dayCount: number, hiddenDays?: readonly number[]): string;
|
|
148
179
|
/**
|
|
149
|
-
* Stable range adjustment: keep `start` when `date` is already
|
|
180
|
+
* Stable range adjustment: keep `start` when `date` is already projected,
|
|
150
181
|
* otherwise shift just enough to bring `date` back into the window.
|
|
151
|
-
* Shared by resize, `goTo`, and min/max/day-count changes.
|
|
182
|
+
* Shared by resize, `goTo`, and min/max/day-count/hidden-day changes.
|
|
152
183
|
* @param {string} start
|
|
153
184
|
* @param {number} dayCount
|
|
154
185
|
* @param {string} date
|
|
155
186
|
* @param {string} min
|
|
156
187
|
* @param {string} max
|
|
188
|
+
* @param {readonly number[]} [hiddenDays]
|
|
157
189
|
*/
|
|
158
|
-
export declare function ensureVisible(start: string, dayCount: number, date: string, min: string, max: string): string;
|
|
190
|
+
export declare function ensureVisible(start: string, dayCount: number, date: string, min: string, max: string, hiddenDays?: readonly number[]): string;
|
|
159
191
|
/**
|
|
160
192
|
* Any appointment slot in the visible window.
|
|
161
193
|
* @param {SlotDay[]} days
|
|
@@ -170,23 +202,26 @@ export declare function hasSlots(days: SlotDay[]): boolean;
|
|
|
170
202
|
*/
|
|
171
203
|
export declare function hasDayContent(days: SlotDay[]): boolean;
|
|
172
204
|
/**
|
|
173
|
-
*
|
|
174
|
-
*
|
|
205
|
+
* Public range of a projection: first and last rendered day plus the number
|
|
206
|
+
* of columns. `end` is the last projected day, so the civil envelope
|
|
207
|
+
* (`start` to `end`) may span more days than `dayCount` when weekdays are
|
|
208
|
+
* hidden. That envelope is exactly what a source has to load.
|
|
209
|
+
* @param {string[]} dates
|
|
175
210
|
*/
|
|
176
|
-
export declare function rangeDetail(
|
|
211
|
+
export declare function rangeDetail(dates: string[]): {
|
|
177
212
|
start: string;
|
|
178
213
|
end: string;
|
|
179
214
|
dayCount: number;
|
|
180
215
|
};
|
|
181
216
|
/**
|
|
182
|
-
* Civil-only active day resolution.
|
|
183
|
-
* Loaded slots never influence the consulted day:
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
* @param {
|
|
217
|
+
* Civil-only active day resolution against the projected dates.
|
|
218
|
+
* Loaded slots never influence the consulted day: absent/invalid maps to the
|
|
219
|
+
* first column, out-of-range clamps to the window, and a date falling on a
|
|
220
|
+
* hidden weekday resolves to the next projected column.
|
|
221
|
+
* @param {string[]} dates
|
|
187
222
|
* @param {string} activeDate
|
|
188
223
|
*/
|
|
189
|
-
export declare function resolveActiveDate(
|
|
224
|
+
export declare function resolveActiveDate(dates: string[], activeDate: string): string;
|
|
190
225
|
/**
|
|
191
226
|
* @param {SlotDay[]} days
|
|
192
227
|
* @returns {{dayIndex:number, slotIndex:number, value:string}[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/model.js"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,EAFzB,SAAS;IAAC,QAAQ,EAAC,MAAM,CAAC;IAAA,QAAQ,EAAC,MAAM,CAAA;CAAC,EAQlD,CAAC;AAKA,YAAuG,IAAI,GAAjG;IAAC,KAAK,EAAC,MAAM,CAAC;IAAA,GAAG,CAAC,EAAC,MAAM,CAAC;IAAA,QAAQ,CAAC,EAAC,OAAO,CAAC;IAAA,WAAW,CAAC,EAAC,MAAM,CAAC;IAAA,IAAI,CAAC,EAAC,MAAM,CAAC;IAAA,IAAI,CAAC,EAAC,OAAO,CAAA;CAAC,CAAM;AAE1G,YAA4D,SAAS,GAA3D;IAAC,KAAK,EAAC,MAAM,CAAC;IAAA,WAAW,CAAC,EAAC,MAAM,CAAC;IAAA,IAAI,CAAC,EAAC,OAAO,CAAA;CAAC,CAAW;
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/model.js"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,EAFzB,SAAS;IAAC,QAAQ,EAAC,MAAM,CAAC;IAAA,QAAQ,EAAC,MAAM,CAAA;CAAC,EAQlD,CAAC;AAKA,YAAuG,IAAI,GAAjG;IAAC,KAAK,EAAC,MAAM,CAAC;IAAA,GAAG,CAAC,EAAC,MAAM,CAAC;IAAA,QAAQ,CAAC,EAAC,OAAO,CAAC;IAAA,WAAW,CAAC,EAAC,MAAM,CAAC;IAAA,IAAI,CAAC,EAAC,MAAM,CAAC;IAAA,IAAI,CAAC,EAAC,OAAO,CAAA;CAAC,CAAM;AAE1G,YAA4D,SAAS,GAA3D;IAAC,KAAK,EAAC,MAAM,CAAC;IAAA,WAA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|
responsiveBreakpoints: ResponsiveBreakpoint[] | null;
|
|
18
|
-
|
|
18
|
+
hiddenDays: number[] | null;
|
|
19
19
|
}>;
|
|
20
20
|
/** @typedef {import("./model.js").SlotDay} SlotDay */
|
|
21
21
|
/** @typedef {"up"|"down"|"left"|"right"|"home"|"end"} FocusDirection */
|
|
@@ -32,7 +32,7 @@ export type ConfigureOptions = Partial<{
|
|
|
32
32
|
* responsive: boolean,
|
|
33
33
|
* homeDate: string|null,
|
|
34
34
|
* responsiveBreakpoints: ResponsiveBreakpoint[]|null,
|
|
35
|
-
*
|
|
35
|
+
* hiddenDays: number[]|null,
|
|
36
36
|
* }>} ConfigureOptions
|
|
37
37
|
*/
|
|
38
38
|
/**
|
|
@@ -44,9 +44,11 @@ export type ConfigureOptions = Partial<{
|
|
|
44
44
|
* - value: YYYY-MM-DDTHH:mm
|
|
45
45
|
*
|
|
46
46
|
* State:
|
|
47
|
-
* - dayCount: consumer's maximum intention
|
|
47
|
+
* - dayCount: consumer's maximum intention, counted in columns
|
|
48
|
+
* - hiddenDays: weekdays that are never a column (calendar structure)
|
|
48
49
|
* - visibleDayCount: capacity actually resolved from bounds + width
|
|
49
|
-
* - start/range:
|
|
50
|
+
* - start/range: first and last projected day; the civil envelope between
|
|
51
|
+
* them may be wider than `dayCount` when weekdays are hidden
|
|
50
52
|
* - activeDate: consulted day
|
|
51
53
|
* - focusedValue: keyboard target, never a selection
|
|
52
54
|
* - value: selected local slot value
|
|
@@ -77,8 +79,19 @@ export declare class SlotPickerElement extends HTMLElement {
|
|
|
77
79
|
/** @param {number} value */
|
|
78
80
|
set dayCount(value: number);
|
|
79
81
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
+
* Weekdays that are never rendered as a column, as `Date#getDay` indexes
|
|
83
|
+
* (`[0, 6]` hides the weekend). Calendar structure, resolved before any
|
|
84
|
+
* data is loaded, so `dayCount` keeps meaning "columns": hidden weekdays
|
|
85
|
+
* widen the civil envelope handed to the source instead of eating a column.
|
|
86
|
+
* Never confused with `closed`, which is the state of a real date.
|
|
87
|
+
* @returns {number[]}
|
|
88
|
+
*/
|
|
89
|
+
get hiddenDays(): number[];
|
|
90
|
+
/** @param {readonly number[]|null} value */
|
|
91
|
+
set hiddenDays(value: readonly number[] | null);
|
|
92
|
+
/**
|
|
93
|
+
* Capacity actually resolved from `dayCount`, the width and the bounds.
|
|
94
|
+
* @see dayCount for the consumer's intention.
|
|
82
95
|
*/
|
|
83
96
|
get visibleDayCount(): number;
|
|
84
97
|
get responsive(): boolean;
|
|
@@ -115,14 +128,6 @@ export declare class SlotPickerElement extends HTMLElement {
|
|
|
115
128
|
*/
|
|
116
129
|
get noticeDisplay(): "action" | "inline" | "none";
|
|
117
130
|
set noticeDisplay(value: string);
|
|
118
|
-
/**
|
|
119
|
-
* Projection policy for `closed` days:
|
|
120
|
-
* - `show` (default) renders every civil day;
|
|
121
|
-
* - `hide` omits closed days from the projection without changing the civil
|
|
122
|
-
* range, `previous()`/`next()` or `source.load()`.
|
|
123
|
-
*/
|
|
124
|
-
get closedDays(): "hide" | "show";
|
|
125
|
-
set closedDays(value: string);
|
|
126
131
|
get expanded(): boolean;
|
|
127
132
|
set expanded(value: boolean);
|
|
128
133
|
get maxVisibleRows(): number;
|
|
@@ -146,7 +151,12 @@ export declare class SlotPickerElement extends HTMLElement {
|
|
|
146
151
|
*/
|
|
147
152
|
get locale(): string;
|
|
148
153
|
set locale(value: string);
|
|
149
|
-
/**
|
|
154
|
+
/**
|
|
155
|
+
* Resolved visible range: first projected day, last projected day, and the
|
|
156
|
+
* number of columns. Empty and invalid when the count is 0. The civil
|
|
157
|
+
* envelope `start`..`end` is what the source must load and may be wider
|
|
158
|
+
* than `dayCount`.
|
|
159
|
+
*/
|
|
150
160
|
get range(): {
|
|
151
161
|
start: string;
|
|
152
162
|
end: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot-picker.d.ts","sourceRoot":"","sources":["../../src/slot-picker.js"],"names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AC/B,IAAI,IAAI,CAAC,KAAK,EADF,OAAO,EACL,EAIb;IAED,4DAA4D;IAC5D,IAAI,MAAM,CAAC,MAAM,EADL,OAAO,aAAa,EAAE,UAAU,GAAC,IAC5B,EAGhB;IAED,IAAI,MAAM,IANE,OAAO,aAAa,EAAE,UAAU,GAAC,IAAI,CAQhD;IAED;;;;OAIG;IACH,IAAI,QAAQ,CAAC,KAAK,EAFP,OAAO,CAAC,cAAc,eAAe,EAAE,gBAAgB,CAAC,GAAC,IAElD,EAGjB;IAED;;;OAGG;IACH,IAAI,MAAM,WAGT;IAED,IAAI,MAAM,CAAC,KAAK,QAAA,EAGf;IAED;;;;;OAKG;IACH,IAAI,KAAK;;;;MAER;IAED,QAAQ,SAEP;IAED,IAAI,SAEH;IAED;;;;;OAKG;IACH,IAAI,CAAC,IAAI,EAHE,MAGF,GAFI,MAAM,CAQlB;IAED,iFAAiF;IACjF,MAAM,WAEL;IAED;;;;;OAKG;IACG,oBAAoB,CAAC,OAAO,AAH/B,CACA,EADQ;QAAC,KAAK,CAAC,EAAC,MAAM,CAAA;KAGc,GAF1B,OAAO,CAAC,MAAM,GAAC,IAAI,CAAC,CAgBhC;IAED;;;OAGG;IACH,SAAS,CAAC,OAAO,AAFd,CAAmC,EAA3B,gBAEW,QAqBrB;IA6BK,MAAM,kBAEX;CA2jBF"}
|
|
@@ -8,7 +8,6 @@ export type RangeEmptyMessages = {
|
|
|
8
8
|
rangeEmptyDescription: string;
|
|
9
9
|
rangeEmptyNext: string;
|
|
10
10
|
nextAvailability: string;
|
|
11
|
-
closedRange: string;
|
|
12
11
|
};
|
|
13
12
|
/** @param {string} value */
|
|
14
13
|
export declare function escapeHtml(value: string): string;
|
|
@@ -84,15 +83,17 @@ export declare function slotCountText(count: number, messages: SlotCountMessages
|
|
|
84
83
|
* the immediately following window, while `next availability` (opt-in via
|
|
85
84
|
* `next-availability`) is the contextual business search that may skip
|
|
86
85
|
* several windows through the source. They are never merged.
|
|
87
|
-
*
|
|
86
|
+
*
|
|
87
|
+
* A closed day is day content, so a window holding one never reaches this
|
|
88
|
+
* state: it keeps its columns and says "Closed" in each of them.
|
|
89
|
+
* @param {{start:string,end:string,invalid:boolean,canNext:boolean,nextAvailability:boolean,locale:string,messages:RangeEmptyMessages}} options
|
|
88
90
|
*/
|
|
89
|
-
export declare function rangeEmpty({ start, end, invalid, canNext, nextAvailability,
|
|
91
|
+
export declare function rangeEmpty({ start, end, invalid, canNext, nextAvailability, locale, messages }: {
|
|
90
92
|
start: string;
|
|
91
93
|
end: string;
|
|
92
94
|
invalid: boolean;
|
|
93
95
|
canNext: boolean;
|
|
94
96
|
nextAvailability: boolean;
|
|
95
|
-
closed: boolean;
|
|
96
97
|
locale: string;
|
|
97
98
|
messages: RangeEmptyMessages;
|
|
98
99
|
}): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/views/shared.js"],"names":[],"mappings":"AAGI,YAAsC,IAAI,GAAhC,OAAO,aAAa,EAAE,IAAI,CAAM;AAC1C,YAA6C,iBAAiB,GAApD;IAAC,OAAO,EAAC,MAAM,CAAC;IAAA,SAAS,EAAC,MAAM,CAAA;CAAC,CAAmB;AAC9D,
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/views/shared.js"],"names":[],"mappings":"AAGI,YAAsC,IAAI,GAAhC,OAAO,aAAa,EAAE,IAAI,CAAM;AAC1C,YAA6C,iBAAiB,GAApD;IAAC,OAAO,EAAC,MAAM,CAAC;IAAA,SAAS,EAAC,MAAM,CAAA;CAAC,CAAmB;AAC9D,YAA+G,kBAAkB,GAAvH;IAAC,eAAe,EAAC,MAAM,CAAC;IAAA,qBAAqB,EAAC,MAAM,CAAC;IAAA,cAAc,EAAC,MAAM,CAAC;IAAA,gBAAgB,EAAC,MAAM,CAAA;CAAC,CAAoB;AAKrI,4BAA4B;AAC5B,wBAAgB,UAAU,CAAC,KAAK,EADpB,MAC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AgB,UAAU,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,QAAQ,EAAE,EAFpF;IAAC,KAAK,EAAC,MAAM,CAAC;IAAA,GAAG,EAAC,MAAM,CAAC;IAAA,OAAO,EAAC,OAAO,CAAC;IAAA,OAAO,EAAC,OAAO,CAAC;IAAA,gBAAgB,EAAC,OAAO,CAAC;IAAA,MAAM,EAAC,MAAM,CAAC;IAAA,QAAQ,EAAC,kBAAkB,CAAA;CAEvC,UA+B9F"}
|
package/docs/USE_CASES.md
CHANGED
|
@@ -22,9 +22,9 @@ The consumer can show three or five days depending on its layout.
|
|
|
22
22
|
|
|
23
23
|
Acceptance:
|
|
24
24
|
|
|
25
|
-
- `dayCount` means exactly N consecutive civil days;
|
|
26
|
-
- previous/next navigation changes `start`, not `value
|
|
27
|
-
- `rangechange` exposes the
|
|
25
|
+
- `dayCount` means exactly N projected columns; without hidden weekdays those are N consecutive civil days;
|
|
26
|
+
- previous/next navigation changes `start`, not `value`, and moves by projected days so the column count is preserved;
|
|
27
|
+
- `rangechange` exposes the first and last projected day plus the column count; the civil envelope between them may be wider;
|
|
28
28
|
- min/max bounds disable impossible navigation;
|
|
29
29
|
- responsive policy remains consumer-owned.
|
|
30
30
|
|
|
@@ -34,7 +34,7 @@ A source function loads availability for the visible range.
|
|
|
34
34
|
|
|
35
35
|
Acceptance:
|
|
36
36
|
|
|
37
|
-
- the source receives the exact visible
|
|
37
|
+
- the source receives the exact civil envelope of the visible window (`start` to `end`, inclusive), which is known before the request: no adaptive or repeated fetching is ever required;
|
|
38
38
|
- superseded requests are aborted;
|
|
39
39
|
- stale responses never repaint the current range;
|
|
40
40
|
- source/backend URL conventions are application-owned;
|
|
@@ -120,7 +120,7 @@ Acceptance:
|
|
|
120
120
|
- `layout` is `columns` (default) or `day`; the consumer chooses it explicitly;
|
|
121
121
|
- there is no automatic `columns` to `day` breakpoint on viewport size;
|
|
122
122
|
- `activeDate` is the last day explicitly targeted by the user (day click or slot activation);
|
|
123
|
-
- `activeDate` resolution is civil-only: absent maps to
|
|
123
|
+
- `activeDate` resolution is civil-only: absent maps to the first projected day, before-range maps to it, after-range maps to the last projected day, and a hidden weekday maps to the next projected column; loaded slots never influence it;
|
|
124
124
|
- activating a slot sets `activeDate` to that slot's day before dispatching `slotactivate`;
|
|
125
125
|
- changing `layout` preserves `activeDate` and `value`;
|
|
126
126
|
- the active day uses `aria-pressed`, never `aria-current="date"`;
|
|
@@ -138,7 +138,10 @@ next known availability. A wholly empty window is a distinct state.
|
|
|
138
138
|
Acceptance:
|
|
139
139
|
|
|
140
140
|
- `min`/`max` are hard bounds: `min <= start` and `end <= max`;
|
|
141
|
+
- at equal width and bounds the picker keeps its column capacity; only the bounds can really reduce it, and only when the interval itself holds too few projectable days;
|
|
142
|
+
- `dayCount`, the measured width, `min`/`max` and `hiddenDays` are all resolved before the request, so the capacity is known before any data arrives and a response can never change it;
|
|
141
143
|
- when the requested `dayCount` does not fit the bounds, the resolved `visibleDayCount` shrinks instead of showing out-of-bounds days;
|
|
144
|
+
- a window sitting at the upper bound keeps its capacity by extending backwards rather than losing a column;
|
|
142
145
|
- `min > max` is an explicit invalid configuration: `range` is `{ start: "", end: "", dayCount: 0 }`, `data-invalid-range` is set, navigation is disabled, and the source is never called;
|
|
143
146
|
- `dayCount` is the consumer's maximum intention; `visibleDayCount` is the capacity resolved from bounds and the width available to the projection;
|
|
144
147
|
- responsive resolution is opt-in via `responsive`, uses `ResizeObserver`, and never reads `window.innerWidth`; it measures the projection width (inside the navigation rail), not the host width; `responsiveBreakpoints` is overridable;
|
|
@@ -154,31 +157,34 @@ Acceptance:
|
|
|
154
157
|
- `goToNextAvailability()` is a contextual action, never permanent chrome: it is surfaced in the range empty state when `next-availability` is set;
|
|
155
158
|
- a window with no slot, no notice and no closed day renders a range empty state (`.sp-range-empty` replacing the projection, with a `next()` action, plus the contextual availability action when `next-availability` is set);
|
|
156
159
|
- a window with a notice or a closed day but no slots keeps the normal projection, so the exception or the closure stays visible;
|
|
160
|
+
- navigation controls are offered only when stepping would really move the window, so a bound sitting on a non-projected day never leaves an inert arrow enabled;
|
|
157
161
|
- resize changes the range, never `value`; event order is stable (`rangechange`, then `daychange`, then any reload);
|
|
158
162
|
- collapsed `columns` projection keeps a stable footprint derived from `max-visible-rows`: full, sparse and wholly empty ranges reserve the same height, so navigating between equivalent ranges never causes avoidable vertical layout shift;
|
|
159
163
|
- `expanded` content may grow naturally past that floor; in `layout="day"`, only the empty state gets a baseline.
|
|
160
164
|
|
|
161
|
-
## U11 —
|
|
165
|
+
## U11 — Hidden days, closed days, sparse availability
|
|
162
166
|
|
|
163
|
-
The
|
|
164
|
-
|
|
167
|
+
The consumer can remove weekdays from the calendar structure, and the source
|
|
168
|
+
can distinguish a closed date from an open date with no availability, without
|
|
169
|
+
the component knowing any opening-hours rule.
|
|
165
170
|
|
|
166
171
|
Acceptance:
|
|
167
172
|
|
|
168
|
-
- a
|
|
169
|
-
- the
|
|
170
|
-
-
|
|
173
|
+
- three states stay distinct and are never merged: a hidden weekday (no column at all), `closed: true` (a column saying `messages.closed`), and `slots: []` on an open day (a column saying `messages.empty`);
|
|
174
|
+
- `hiddenDays` is calendar structure, resolved from the civil date alone before any data is loaded: it is a `Date#getDay` index list on the JS property (no attribute), never inferred from a `SlotDay`, and `configure({ hiddenDays })` applies it transactionally;
|
|
175
|
+
- `dayCount` counts columns: a hidden weekday widens the civil envelope handed to `source.load()` instead of costing a column, so `end - start + 1` may exceed `dayCount`;
|
|
176
|
+
- `previous()`/`next()` step by projected days, `start` landing on a hidden weekday resolves forward to the first projected day, and `activeDate` on a hidden weekday resolves to the next projected column;
|
|
177
|
+
- a sparse weekly schedule (a practitioner opening one or two weekdays) therefore projects as N real opening days spread over several weeks, instead of a grid mostly made of closed columns the user has to page through;
|
|
178
|
+
- with `responsive`, a narrow screen lowers the ceiling but not the kind of column: the fewer columns that fit are still real opening days, and `dayCount` itself is untouched;
|
|
179
|
+
- invalid `hiddenDays` input throws: non-integers, indexes outside `0`–`6`, a non-array, or all seven weekdays hidden;
|
|
180
|
+
- `closed: true` is the business state of one date (a holiday, an exceptional or recurring closure decided by the application); the component never computes opening hours, recurrence or "Monday only";
|
|
181
|
+
- loaded data never adds or removes a column: a closed day keeps its place, exactly like a day carrying a `notice`;
|
|
171
182
|
- a closed day is stylable through `[data-closed]` on the day, the panel and the day strip; `--sp-closed-opacity` is the default theming hook;
|
|
172
183
|
- `notice` stays reserved for exceptional information and may coexist with `closed`;
|
|
173
184
|
- a window whose only content is closed days keeps the normal projection instead of collapsing into the range empty state;
|
|
174
|
-
- `source.next()` / `goToNextAvailability()` let the application jump to the next real availability between windows; they never change the
|
|
175
|
-
- `closed-days="show"` (default) renders every civil day; `closed-days="hide"` removes closed days from the projection only;
|
|
176
|
-
- hiding a closed day never extends the civil range to compensate: `day-count` stays the civil count, and the rendered column count follows the projected days;
|
|
177
|
-
- hiding never alters `range`, `visibleDayCount`, `previous()`/`next()`, `goTo()` or `source.load()`, and toggling `closed-days` never reloads the source;
|
|
178
|
-
- in `layout="day"`, a closed day that is the consulted `activeDate` stays visible until another day is activated; data arrival never moves `activeDate`;
|
|
179
|
-
- a window whose civil days are all closed renders the range empty state with `messages.closedRange`, distinct from `messages.empty`;
|
|
185
|
+
- `source.next()` / `goToNextAvailability()` let the application jump to the next real availability between windows; they never change the shape of a window;
|
|
180
186
|
- `closed: true` with bookable slots is invalid input and is rejected by normalization;
|
|
181
|
-
- no recurrence or opening-hours rule enters the core.
|
|
187
|
+
- no availability recurrence or opening-hours rule enters the core: `hiddenDays` is a structural weekday filter on the calendar, not a statement about what is bookable.
|
|
182
188
|
|
|
183
189
|
## Not a use case for this package
|
|
184
190
|
|
package/package.json
CHANGED
package/src/date.js
CHANGED
|
@@ -41,7 +41,9 @@ export function daysBetween(a, b) {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
|
-
* Inclusive
|
|
44
|
+
* Inclusive end of `dayCount` consecutive civil days.
|
|
45
|
+
* This is plain civil math, not the picker's range rule: a projection may
|
|
46
|
+
* skip weekdays, so its civil envelope can be wider than its column count.
|
|
45
47
|
* @param {string} start
|
|
46
48
|
* @param {number} dayCount
|
|
47
49
|
*/
|
|
@@ -49,6 +51,14 @@ export function rangeEnd(start, dayCount) {
|
|
|
49
51
|
return addDays(start, Math.max(1, dayCount) - 1);
|
|
50
52
|
}
|
|
51
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Civil weekday index, 0 = Sunday, matching `Date#getDay`.
|
|
56
|
+
* @param {string} value
|
|
57
|
+
*/
|
|
58
|
+
export function weekdayIndex(value) {
|
|
59
|
+
return toUtcDate(value).getUTCDay();
|
|
60
|
+
}
|
|
61
|
+
|
|
52
62
|
/** @param {string} value */
|
|
53
63
|
export function toUtcDate(value) {
|
|
54
64
|
const { year, month, day } = parts(value);
|
package/src/index.js
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {
|
|
2
|
+
addDays,
|
|
3
|
+
compareDates,
|
|
4
|
+
daysBetween,
|
|
5
|
+
isDateValue,
|
|
6
|
+
rangeEnd,
|
|
7
|
+
todayValue,
|
|
8
|
+
weekdayIndex,
|
|
9
|
+
} from "./date.js";
|
|
2
10
|
export { DEFAULT_MESSAGES, getDefaultMessages, resolveMessages, setDefaultMessages } from "./messages.js";
|
|
3
11
|
export {
|
|
4
|
-
|
|
12
|
+
clampDate,
|
|
5
13
|
clampStart,
|
|
6
14
|
collapsedDays,
|
|
7
15
|
ensureVisible,
|
|
@@ -14,11 +22,14 @@ export {
|
|
|
14
22
|
moveFocus,
|
|
15
23
|
normalizeBreakpoints,
|
|
16
24
|
normalizeDays,
|
|
25
|
+
normalizeHiddenDays,
|
|
26
|
+
projectDates,
|
|
17
27
|
RESPONSIVE_BREAKPOINTS,
|
|
18
28
|
rangeDetail,
|
|
19
29
|
resolveActiveDate,
|
|
20
30
|
resolveVisibleDayCount,
|
|
21
31
|
slotValue,
|
|
32
|
+
stepStart,
|
|
22
33
|
visibleDays,
|
|
23
34
|
} from "./model.js";
|
|
24
35
|
export { SlotPickerElement } from "./slot-picker.js";
|
package/src/locales/ar.js
CHANGED
|
@@ -8,7 +8,6 @@ export default {
|
|
|
8
8
|
loading: "جارٍ تحميل التوفر",
|
|
9
9
|
empty: "لا يوجد توفر",
|
|
10
10
|
closed: "مغلق",
|
|
11
|
-
closedRange: "مغلق خلال هذه الفترة",
|
|
12
11
|
rangeEmptyTitle: "لا يوجد أي موعد متاح في هذه الفترة",
|
|
13
12
|
rangeEmptyDescription: "من {start} إلى {end}",
|
|
14
13
|
rangeEmptyNext: "عرض الفترة التالية",
|
package/src/locales/de.js
CHANGED
|
@@ -8,7 +8,6 @@ export default {
|
|
|
8
8
|
loading: "Verfügbarkeiten werden geladen",
|
|
9
9
|
empty: "Keine Verfügbarkeit",
|
|
10
10
|
closed: "Geschlossen",
|
|
11
|
-
closedRange: "In diesem Zeitraum geschlossen",
|
|
12
11
|
rangeEmptyTitle: "Keine Verfügbarkeit in diesem Zeitraum",
|
|
13
12
|
rangeEmptyDescription: "Vom {start} bis {end}",
|
|
14
13
|
rangeEmptyNext: "Nächsten Zeitraum anzeigen",
|
package/src/locales/en.js
CHANGED
|
@@ -8,7 +8,6 @@ export default {
|
|
|
8
8
|
loading: "Loading availability",
|
|
9
9
|
empty: "No availability",
|
|
10
10
|
closed: "Closed",
|
|
11
|
-
closedRange: "Closed during this period",
|
|
12
11
|
rangeEmptyTitle: "No availability in this period",
|
|
13
12
|
rangeEmptyDescription: "From {start} to {end}",
|
|
14
13
|
rangeEmptyNext: "See the next period",
|
package/src/locales/es.js
CHANGED
|
@@ -8,7 +8,6 @@ export default {
|
|
|
8
8
|
loading: "Cargando disponibilidad",
|
|
9
9
|
empty: "Sin disponibilidad",
|
|
10
10
|
closed: "Cerrado",
|
|
11
|
-
closedRange: "Cerrado durante este período",
|
|
12
11
|
rangeEmptyTitle: "Sin disponibilidad en este período",
|
|
13
12
|
rangeEmptyDescription: "Del {start} al {end}",
|
|
14
13
|
rangeEmptyNext: "Ver el siguiente período",
|
package/src/locales/fr.js
CHANGED
|
@@ -8,7 +8,6 @@ export default {
|
|
|
8
8
|
loading: "Chargement des disponibilités",
|
|
9
9
|
empty: "Aucune disponibilité",
|
|
10
10
|
closed: "Fermé",
|
|
11
|
-
closedRange: "Fermé sur cette période",
|
|
12
11
|
rangeEmptyTitle: "Aucun créneau disponible sur cette période",
|
|
13
12
|
rangeEmptyDescription: "Du {start} au {end}",
|
|
14
13
|
rangeEmptyNext: "Voir la période suivante",
|
package/src/locales/hi.js
CHANGED
|
@@ -8,7 +8,6 @@ export default {
|
|
|
8
8
|
loading: "उपलब्धता लोड हो रही है",
|
|
9
9
|
empty: "कोई उपलब्धता नहीं",
|
|
10
10
|
closed: "बंद",
|
|
11
|
-
closedRange: "इस अवधि के दौरान बंद",
|
|
12
11
|
rangeEmptyTitle: "इस अवधि में कोई स्लॉट उपलब्ध नहीं",
|
|
13
12
|
rangeEmptyDescription: "{start} से {end} तक",
|
|
14
13
|
rangeEmptyNext: "अगली अवधि देखें",
|
package/src/locales/id.js
CHANGED
|
@@ -8,7 +8,6 @@ export default {
|
|
|
8
8
|
loading: "Memuat ketersediaan",
|
|
9
9
|
empty: "Tidak ada ketersediaan",
|
|
10
10
|
closed: "Tutup",
|
|
11
|
-
closedRange: "Tutup selama periode ini",
|
|
12
11
|
rangeEmptyTitle: "Tidak ada ketersediaan pada periode ini",
|
|
13
12
|
rangeEmptyDescription: "Dari {start} hingga {end}",
|
|
14
13
|
rangeEmptyNext: "Lihat periode berikutnya",
|
package/src/locales/it.js
CHANGED
|
@@ -8,7 +8,6 @@ export default {
|
|
|
8
8
|
loading: "Caricamento disponibilità",
|
|
9
9
|
empty: "Nessuna disponibilità",
|
|
10
10
|
closed: "Chiuso",
|
|
11
|
-
closedRange: "Chiuso in questo periodo",
|
|
12
11
|
rangeEmptyTitle: "Nessuna disponibilità in questo periodo",
|
|
13
12
|
rangeEmptyDescription: "Dal {start} al {end}",
|
|
14
13
|
rangeEmptyNext: "Vedi il periodo successivo",
|
package/src/locales/ja.js
CHANGED
package/src/locales/ko.js
CHANGED
package/src/locales/nl.js
CHANGED
|
@@ -8,7 +8,6 @@ export default {
|
|
|
8
8
|
loading: "Beschikbaarheid laden",
|
|
9
9
|
empty: "Geen beschikbaarheid",
|
|
10
10
|
closed: "Gesloten",
|
|
11
|
-
closedRange: "Gesloten in deze periode",
|
|
12
11
|
rangeEmptyTitle: "Geen beschikbaarheid in deze periode",
|
|
13
12
|
rangeEmptyDescription: "Van {start} tot {end}",
|
|
14
13
|
rangeEmptyNext: "Volgende periode bekijken",
|
package/src/locales/pl.js
CHANGED
|
@@ -8,7 +8,6 @@ export default {
|
|
|
8
8
|
loading: "Ładowanie dostępności",
|
|
9
9
|
empty: "Brak dostępności",
|
|
10
10
|
closed: "Zamknięte",
|
|
11
|
-
closedRange: "Zamknięte w tym okresie",
|
|
12
11
|
rangeEmptyTitle: "Brak dostępności w tym okresie",
|
|
13
12
|
rangeEmptyDescription: "Od {start} do {end}",
|
|
14
13
|
rangeEmptyNext: "Zobacz następny okres",
|
package/src/locales/pt-BR.js
CHANGED
|
@@ -8,7 +8,6 @@ export default {
|
|
|
8
8
|
loading: "Carregando disponibilidade",
|
|
9
9
|
empty: "Sem disponibilidade",
|
|
10
10
|
closed: "Fechado",
|
|
11
|
-
closedRange: "Fechado neste período",
|
|
12
11
|
rangeEmptyTitle: "Sem disponibilidade neste período",
|
|
13
12
|
rangeEmptyDescription: "De {start} a {end}",
|
|
14
13
|
rangeEmptyNext: "Ver o próximo período",
|
package/src/locales/pt-PT.js
CHANGED
|
@@ -8,7 +8,6 @@ export default {
|
|
|
8
8
|
loading: "A carregar disponibilidade",
|
|
9
9
|
empty: "Sem disponibilidade",
|
|
10
10
|
closed: "Fechado",
|
|
11
|
-
closedRange: "Fechado neste período",
|
|
12
11
|
rangeEmptyTitle: "Sem disponibilidade neste período",
|
|
13
12
|
rangeEmptyDescription: "De {start} a {end}",
|
|
14
13
|
rangeEmptyNext: "Ver o período seguinte",
|
package/src/locales/ru.js
CHANGED
|
@@ -8,7 +8,6 @@ export default {
|
|
|
8
8
|
loading: "Загрузка доступности",
|
|
9
9
|
empty: "Нет доступных слотов",
|
|
10
10
|
closed: "Закрыто",
|
|
11
|
-
closedRange: "Закрыто в этот период",
|
|
12
11
|
rangeEmptyTitle: "На этот период нет доступных слотов",
|
|
13
12
|
rangeEmptyDescription: "С {start} по {end}",
|
|
14
13
|
rangeEmptyNext: "Показать следующий период",
|
package/src/locales/tr.js
CHANGED
|
@@ -8,7 +8,6 @@ export default {
|
|
|
8
8
|
loading: "Uygunluk yükleniyor",
|
|
9
9
|
empty: "Uygun zaman yok",
|
|
10
10
|
closed: "Kapalı",
|
|
11
|
-
closedRange: "Bu dönemde kapalı",
|
|
12
11
|
rangeEmptyTitle: "Bu dönemde uygun zaman yok",
|
|
13
12
|
rangeEmptyDescription: "{start} ile {end} arası",
|
|
14
13
|
rangeEmptyNext: "Sonraki dönemi gör",
|
package/src/locales/zh-CN.js
CHANGED
package/src/messages.js
CHANGED
|
@@ -8,7 +8,6 @@ const DEFAULT_MESSAGES = {
|
|
|
8
8
|
loading: "Loading availability",
|
|
9
9
|
empty: "No availability",
|
|
10
10
|
closed: "Closed",
|
|
11
|
-
closedRange: "Closed during this period",
|
|
12
11
|
rangeEmptyTitle: "No availability in this period",
|
|
13
12
|
rangeEmptyDescription: "From {start} to {end}",
|
|
14
13
|
rangeEmptyNext: "See the next period",
|