@fibrae/semi-foundation 0.1.1 → 0.2.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/anchor/foundation.d.ts +1 -1
- package/dist/anchor/foundation.js +21 -21
- package/dist/audio-player/foundation.d.ts +10 -10
- package/dist/audio-player/foundation.js +19 -19
- package/dist/auto-complete/foundation.d.ts +12 -12
- package/dist/auto-complete/foundation.js +51 -51
- package/dist/avatar/foundation.d.ts +5 -5
- package/dist/avatar/foundation.js +16 -16
- package/dist/backtop/foundation.d.ts +2 -2
- package/dist/backtop/foundation.js +7 -7
- package/dist/banner/foundation.d.ts +1 -1
- package/dist/banner/foundation.js +4 -4
- package/dist/base/auto-close-foundation.d.ts +8 -8
- package/dist/base/auto-close-foundation.js +15 -15
- package/dist/base/foundation.d.ts +4 -3
- package/dist/base/foundation.js +12 -11
- package/dist/breadcrumb/foundation.d.ts +5 -5
- package/dist/breadcrumb/foundation.js +9 -10
- package/dist/breadcrumb/item-foundation.d.ts +3 -3
- package/dist/breadcrumb/item-foundation.js +6 -6
- package/dist/calendar/event-util.js +1 -1
- package/dist/calendar/foundation.js +4 -4
- package/dist/calendar/month-foundation.d.ts +2 -2
- package/dist/calendar/month-foundation.js +6 -6
- package/dist/carousel/foundation.d.ts +17 -17
- package/dist/carousel/foundation.js +51 -51
- package/dist/cascader/foundation.d.ts +34 -26
- package/dist/cascader/foundation.js +143 -121
- package/dist/checkbox/checkbox-foundation.d.ts +2 -2
- package/dist/checkbox/checkbox-foundation.js +15 -15
- package/dist/checkbox/checkbox-group-foundation.d.ts +2 -2
- package/dist/checkbox/checkbox-group-foundation.js +8 -8
- package/dist/code-highlight/index.d.ts +1 -1
- package/dist/code-highlight/index.js +3 -3
- package/dist/collapse/foundation.d.ts +2 -2
- package/dist/collapse/foundation.js +7 -7
- package/dist/collapsible/foundation.d.ts +3 -3
- package/dist/collapsible/foundation.js +8 -8
- package/dist/color-picker/alpha-slider-foundation.d.ts +2 -4
- package/dist/color-picker/alpha-slider-foundation.js +10 -10
- package/dist/color-picker/color-choose-area-foundation.d.ts +2 -5
- package/dist/color-picker/color-choose-area-foundation.js +14 -14
- package/dist/color-picker/color-slider-foundation.d.ts +2 -4
- package/dist/color-picker/color-slider-foundation.js +10 -10
- package/dist/color-picker/data-part-foundation.d.ts +5 -5
- package/dist/color-picker/data-part-foundation.js +11 -11
- package/dist/color-picker/foundation.d.ts +4 -4
- package/dist/color-picker/foundation.js +10 -10
- package/dist/config-provider/breakpoint-observer.d.ts +3 -3
- package/dist/config-provider/breakpoint-observer.js +6 -6
- package/dist/cropper/foundation.d.ts +15 -15
- package/dist/cropper/foundation.js +26 -23
- package/dist/date-picker/_utils/picker-type.d.ts +1 -1
- package/dist/date-picker/foundation.d.ts +36 -36
- package/dist/date-picker/foundation.js +125 -129
- package/dist/date-picker/input-foundation.d.ts +9 -9
- package/dist/date-picker/input-foundation.js +28 -28
- package/dist/date-picker/months-grid-foundation.d.ts +16 -16
- package/dist/date-picker/months-grid-foundation.js +64 -65
- package/dist/date-picker/year-and-month-foundation.d.ts +3 -3
- package/dist/date-picker/year-and-month-foundation.js +11 -11
- package/dist/drag-move/foundation.d.ts +2 -2
- package/dist/drag-move/foundation.js +15 -13
- package/dist/dropdown/foundation.d.ts +8 -5
- package/dist/dropdown/foundation.js +32 -28
- package/dist/dropdown/menu-foundation.d.ts +1 -1
- package/dist/dropdown/menu-foundation.js +11 -11
- package/dist/feedback/foundation.d.ts +9 -9
- package/dist/feedback/foundation.js +33 -33
- package/dist/form/form-api-proxy.d.ts +8 -7
- package/dist/form/form-api-proxy.js +25 -25
- package/dist/form/foundation.d.ts +5 -5
- package/dist/form/foundation.js +60 -61
- package/dist/highlight/foundation.js +1 -1
- package/dist/hot-keys/foundation.d.ts +2 -2
- package/dist/hot-keys/foundation.js +5 -5
- package/dist/image/image-foundation.d.ts +4 -4
- package/dist/image/image-foundation.js +10 -10
- package/dist/image/preview-footer-foundation.d.ts +3 -3
- package/dist/image/preview-footer-foundation.js +10 -10
- package/dist/image/preview-foundation.js +7 -6
- package/dist/image/preview-image-foundation.d.ts +6 -8
- package/dist/image/preview-image-foundation.js +14 -14
- package/dist/image/preview-inner-foundation.d.ts +9 -9
- package/dist/image/preview-inner-foundation.js +38 -38
- package/dist/input/foundation.d.ts +10 -10
- package/dist/input/foundation.js +47 -49
- package/dist/input/text-entry-foundation.d.ts +3 -3
- package/dist/input/text-entry-foundation.js +14 -14
- package/dist/input/textarea-foundation.d.ts +7 -7
- package/dist/input/textarea-foundation.js +36 -36
- package/dist/input-number/foundation.d.ts +16 -14
- package/dist/input-number/foundation.js +54 -53
- package/dist/json-viewer/foundation.d.ts +8 -8
- package/dist/json-viewer/foundation.js +23 -23
- package/dist/lottie/foundation.d.ts +1 -1
- package/dist/lottie/foundation.js +4 -4
- package/dist/markdown-render/foundation.d.ts +1 -1
- package/dist/markdown-render/foundation.js +4 -4
- package/dist/modal/modal-content-foundation.d.ts +7 -7
- package/dist/modal/modal-content-foundation.js +20 -20
- package/dist/modal/modal-foundation.d.ts +6 -6
- package/dist/modal/modal-foundation.js +24 -24
- package/dist/navigation/foundation.d.ts +1 -1
- package/dist/navigation/foundation.js +14 -14
- package/dist/navigation/item-foundation.d.ts +1 -1
- package/dist/navigation/item-foundation.js +8 -8
- package/dist/navigation/sub-nav-foundation.d.ts +3 -3
- package/dist/navigation/sub-nav-foundation.js +17 -17
- package/dist/notification/notification-list-foundation.d.ts +7 -7
- package/dist/notification/notification-list-foundation.js +12 -12
- package/dist/overflow-list/foundation.d.ts +4 -4
- package/dist/overflow-list/foundation.js +18 -18
- package/dist/pagination/foundation.d.ts +8 -8
- package/dist/pagination/foundation.js +28 -28
- package/dist/pincode/foundation.d.ts +5 -5
- package/dist/pincode/foundation.js +22 -22
- package/dist/popconfirm/popconfirm-foundation.d.ts +7 -7
- package/dist/popconfirm/popconfirm-foundation.js +26 -26
- package/dist/radio/radio-foundation.d.ts +5 -5
- package/dist/radio/radio-foundation.js +15 -15
- package/dist/radio/radio-group-foundation.d.ts +2 -2
- package/dist/radio/radio-group-foundation.js +9 -9
- package/dist/rating/foundation.d.ts +10 -10
- package/dist/rating/foundation.js +35 -35
- package/dist/resizable/group/index.d.ts +6 -6
- package/dist/resizable/group/index.js +40 -40
- package/dist/resizable/single/index.d.ts +2 -2
- package/dist/resizable/single/index.js +9 -9
- package/dist/scroll-list/item-foundation.d.ts +7 -7
- package/dist/scroll-list/item-foundation.js +35 -35
- package/dist/select/foundation.d.ts +42 -56
- package/dist/select/foundation.js +214 -279
- package/dist/select/option-foundation.d.ts +23 -27
- package/dist/select/option-foundation.js +10 -18
- package/dist/side-sheet/side-sheet-foundation.d.ts +6 -6
- package/dist/side-sheet/side-sheet-foundation.js +22 -22
- package/dist/slider/foundation.d.ts +16 -16
- package/dist/slider/foundation.js +46 -46
- package/dist/sortable/accessibility.d.ts +1 -1
- package/dist/sortable/accessibility.js +2 -2
- package/dist/spin/foundation.d.ts +2 -2
- package/dist/spin/foundation.js +6 -6
- package/dist/steps/utils.d.ts +1 -1
- package/dist/switch/foundation.d.ts +2 -2
- package/dist/switch/foundation.js +7 -7
- package/dist/table/foundation.d.ts +14 -14
- package/dist/table/foundation.js +93 -93
- package/dist/table/utils.d.ts +2 -2
- package/dist/tabs/foundation.d.ts +5 -5
- package/dist/tabs/foundation.js +17 -17
- package/dist/tag-input/foundation.d.ts +11 -11
- package/dist/tag-input/foundation.js +52 -52
- package/dist/time-picker/foundation.d.ts +13 -13
- package/dist/time-picker/foundation.js +39 -39
- package/dist/time-picker/input-foundation.d.ts +4 -4
- package/dist/time-picker/input-foundation.js +13 -13
- package/dist/toast/toast-list-foundation.d.ts +7 -7
- package/dist/toast/toast-list-foundation.js +14 -14
- package/dist/tooltip/foundation.d.ts +9 -9
- package/dist/tooltip/foundation.js +67 -61
- package/dist/transfer/foundation.d.ts +22 -9
- package/dist/transfer/foundation.js +38 -23
- package/dist/tree/foundation.d.ts +14 -14
- package/dist/tree/foundation.js +61 -61
- package/dist/tree/shared.d.ts +1 -1
- package/dist/tree-select/foundation.d.ts +26 -20
- package/dist/tree-select/foundation.js +91 -83
- package/dist/typography/ellipsis.d.ts +4 -4
- package/dist/typography/ellipsis.js +8 -8
- package/dist/typography/format-numeral.d.ts +1 -1
- package/dist/typography/format-numeral.js +2 -2
- package/dist/upload/constants.d.ts +1 -1
- package/dist/upload/foundation.d.ts +17 -17
- package/dist/upload/foundation.js +92 -92
- package/dist/upload/utils.d.ts +3 -3
- package/dist/upload/utils.js +6 -6
- package/dist/user-guide/foundation.d.ts +3 -3
- package/dist/user-guide/foundation.js +19 -19
- package/dist/utils/a11y.d.ts +1 -1
- package/dist/utils/announcer.d.ts +2 -2
- package/dist/utils/announcer.js +4 -4
- package/dist/utils/focus-handle.d.ts +1 -1
- package/dist/utils/focus-handle.js +1 -2
- package/dist/utils/focus-scope.d.ts +5 -5
- package/dist/utils/focus-scope.js +10 -10
- package/dist/utils/is-promise.d.ts +1 -1
- package/dist/utils/release-holder.d.ts +2 -2
- package/dist/utils/release-holder.js +4 -4
- package/dist/video-player/foundation.d.ts +15 -15
- package/dist/video-player/foundation.js +89 -89
- package/dist/video-player/progress-foundation.d.ts +2 -2
- package/dist/video-player/progress-foundation.js +12 -12
- package/package.json +2 -2
|
@@ -23,7 +23,7 @@ var TagInputFoundation = class TagInputFoundation extends BaseFoundation {
|
|
|
23
23
|
return getSplitedArray(originString, separators);
|
|
24
24
|
}
|
|
25
25
|
#checkInputChangeValid(value) {
|
|
26
|
-
const { maxLength, separator } = this.
|
|
26
|
+
const { maxLength, separator } = this.adapter.getProps();
|
|
27
27
|
const { inputValue } = this.#current();
|
|
28
28
|
let allowChange = true;
|
|
29
29
|
if (typeof maxLength === "number") {
|
|
@@ -33,7 +33,7 @@ var TagInputFoundation = class TagInputFoundation extends BaseFoundation {
|
|
|
33
33
|
for (let i = 0; i < maxLen; i++) if (valueArr[i] !== void 0 && (inputArr[i] === void 0 || valueArr[i].length > inputArr[i].length)) {
|
|
34
34
|
if (valueArr[i].length > maxLength) {
|
|
35
35
|
allowChange = false;
|
|
36
|
-
this.
|
|
36
|
+
this.adapter.notifyInputExceed(value);
|
|
37
37
|
break;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -41,7 +41,7 @@ var TagInputFoundation = class TagInputFoundation extends BaseFoundation {
|
|
|
41
41
|
return allowChange;
|
|
42
42
|
}
|
|
43
43
|
#handleAddTags(e) {
|
|
44
|
-
const { separator, max, allowDuplicates } = this.
|
|
44
|
+
const { separator, max, allowDuplicates } = this.adapter.getProps();
|
|
45
45
|
const { inputValue, tagsArray } = this.#current();
|
|
46
46
|
let addTags = this.#splitArray(inputValue, separator);
|
|
47
47
|
addTags = addTags.filter((item, idx) => {
|
|
@@ -52,7 +52,7 @@ var TagInputFoundation = class TagInputFoundation extends BaseFoundation {
|
|
|
52
52
|
});
|
|
53
53
|
let newTagList = tagsArray.concat(addTags);
|
|
54
54
|
if (typeof max === "number" && newTagList.length > max) {
|
|
55
|
-
this.
|
|
55
|
+
this.adapter.notifyExceed(newTagList);
|
|
56
56
|
addTags = addTags.slice(0, Math.max(0, max - tagsArray.length));
|
|
57
57
|
newTagList = tagsArray.concat(addTags);
|
|
58
58
|
}
|
|
@@ -60,18 +60,18 @@ var TagInputFoundation = class TagInputFoundation extends BaseFoundation {
|
|
|
60
60
|
this.#onInputChange("", e);
|
|
61
61
|
}
|
|
62
62
|
#onRemove(newTagList, removedTags, index) {
|
|
63
|
-
if (!this.
|
|
64
|
-
this.
|
|
65
|
-
this.
|
|
63
|
+
if (!this.isControlledComponent()) this.adapter.setTagsArray(newTagList);
|
|
64
|
+
this.adapter.notifyTagChange(newTagList);
|
|
65
|
+
this.adapter.notifyTagRemove(removedTags, index);
|
|
66
66
|
}
|
|
67
67
|
#onAdd(newTagList, addTags) {
|
|
68
|
-
if (!this.
|
|
69
|
-
this.
|
|
70
|
-
this.
|
|
68
|
+
if (!this.isControlledComponent()) this.adapter.setTagsArray(newTagList);
|
|
69
|
+
this.adapter.notifyTagChange(newTagList);
|
|
70
|
+
this.adapter.notifyTagAdd(addTags);
|
|
71
71
|
}
|
|
72
72
|
#onInputChange(value, e) {
|
|
73
|
-
this.
|
|
74
|
-
this.
|
|
73
|
+
this.adapter.setInputValue(value);
|
|
74
|
+
this.adapter.notifyInputChange(value, e);
|
|
75
75
|
}
|
|
76
76
|
/** A controlled `value` wins over state, and a controlled `null` means no tags */
|
|
77
77
|
static getTagsArray(props, state) {
|
|
@@ -122,38 +122,38 @@ var TagInputFoundation = class TagInputFoundation extends BaseFoundation {
|
|
|
122
122
|
this.#fitInline = false;
|
|
123
123
|
}
|
|
124
124
|
/** Re-fits the inline input width without field-sizing; hosts call it when the typed text changes */
|
|
125
|
-
fitInputWidth() {
|
|
126
|
-
const input = this.#fitInline ? this.
|
|
125
|
+
fitInputWidth = () => {
|
|
126
|
+
const input = this.#fitInline ? this.adapter.getInput() : null;
|
|
127
127
|
if (input) fitInputWidth(input);
|
|
128
|
-
}
|
|
129
|
-
handleInputChange(value, e) {
|
|
128
|
+
};
|
|
129
|
+
handleInputChange = (value, e) => {
|
|
130
130
|
const { entering } = this.getStates();
|
|
131
131
|
if (entering) this.#onInputChange(value, e);
|
|
132
132
|
else if (this.#checkInputChangeValid(value)) this.#onInputChange(value, e);
|
|
133
|
-
}
|
|
133
|
+
};
|
|
134
134
|
handleInputCompositionStart = (_e) => {
|
|
135
135
|
const { maxLength } = this.getProps();
|
|
136
136
|
if (typeof maxLength !== "number") return;
|
|
137
|
-
this.
|
|
137
|
+
this.adapter.setEntering(true);
|
|
138
138
|
};
|
|
139
139
|
handleInputCompositionEnd = (e) => {
|
|
140
140
|
const { value } = e.target;
|
|
141
141
|
const { maxLength, separator } = this.getProps();
|
|
142
142
|
if (typeof maxLength !== "number") return;
|
|
143
|
-
this.
|
|
143
|
+
this.adapter.setEntering(false);
|
|
144
144
|
let allowChange = true;
|
|
145
145
|
const inputArr = this.#splitArray(value, separator);
|
|
146
146
|
let index = 0;
|
|
147
147
|
for (; index < inputArr.length; index++) if (inputArr[index].length > maxLength) {
|
|
148
148
|
allowChange = false;
|
|
149
|
-
this.
|
|
149
|
+
this.adapter.notifyInputExceed(value);
|
|
150
150
|
break;
|
|
151
151
|
}
|
|
152
152
|
if (!allowChange) {
|
|
153
153
|
const newInputArr = inputArr.slice(0, index);
|
|
154
154
|
if (index < inputArr.length) newInputArr.push(inputArr[index].slice(0, maxLength));
|
|
155
155
|
this.#onInputChange(newInputArr.join(Array.isArray(separator) ? separator[0] : separator), e);
|
|
156
|
-
} else this.
|
|
156
|
+
} else this.adapter.setInputValue(value);
|
|
157
157
|
};
|
|
158
158
|
handleKeyDown = (e) => {
|
|
159
159
|
const { inputValue, tagsArray } = this.#current();
|
|
@@ -168,55 +168,55 @@ var TagInputFoundation = class TagInputFoundation extends BaseFoundation {
|
|
|
168
168
|
const removedTag = tagsArray[length - 1];
|
|
169
169
|
this.#onRemove(newTagList, removedTag, length - 1);
|
|
170
170
|
}
|
|
171
|
-
this.
|
|
171
|
+
this.adapter.notifyKeyDown(e);
|
|
172
172
|
};
|
|
173
|
-
handleInputBlur(e) {
|
|
174
|
-
const { addOnBlur } = this.
|
|
173
|
+
handleInputBlur = (e) => {
|
|
174
|
+
const { addOnBlur } = this.adapter.getProps();
|
|
175
175
|
if (addOnBlur === true && this.#current().inputValue !== "") this.#handleAddTags(e);
|
|
176
176
|
this.deactivate();
|
|
177
|
-
this.
|
|
178
|
-
this.
|
|
179
|
-
}
|
|
180
|
-
handleInputFocus(e) {
|
|
177
|
+
this.adapter.setFocusing(false);
|
|
178
|
+
this.adapter.notifyBlur(e);
|
|
179
|
+
};
|
|
180
|
+
handleInputFocus = (e) => {
|
|
181
181
|
this.handleClick();
|
|
182
|
-
this.
|
|
183
|
-
this.
|
|
184
|
-
}
|
|
185
|
-
handleClearBtn(e) {
|
|
182
|
+
this.adapter.setFocusing(true);
|
|
183
|
+
this.adapter.notifyFocus(e);
|
|
184
|
+
};
|
|
185
|
+
handleClearBtn = (e) => {
|
|
186
186
|
const { inputValue, tagsArray } = this.#current();
|
|
187
187
|
if (tagsArray.length > 0) {
|
|
188
|
-
if (!this.
|
|
189
|
-
this.
|
|
188
|
+
if (!this.isControlledComponent()) this.adapter.setTagsArray([]);
|
|
189
|
+
this.adapter.notifyTagChange([]);
|
|
190
190
|
}
|
|
191
191
|
if (inputValue.length > 0) this.#onInputChange("", e);
|
|
192
192
|
e.stopPropagation();
|
|
193
|
-
}
|
|
194
|
-
handleTagClose(index) {
|
|
193
|
+
};
|
|
194
|
+
handleTagClose = (index) => {
|
|
195
195
|
const { tagsArray } = this.#current();
|
|
196
196
|
const newTagList = [...tagsArray];
|
|
197
197
|
newTagList.splice(index, 1);
|
|
198
198
|
const removedTag = tagsArray[index];
|
|
199
199
|
this.#onRemove(newTagList, removedTag, index);
|
|
200
|
-
}
|
|
201
|
-
handleClick() {
|
|
200
|
+
};
|
|
201
|
+
handleClick = () => {
|
|
202
202
|
const { disabled } = this.getProps();
|
|
203
203
|
if (disabled) return;
|
|
204
|
-
if (!this.getState("active")) this.
|
|
205
|
-
}
|
|
204
|
+
if (!this.getState("active")) this.adapter.setActive(true);
|
|
205
|
+
};
|
|
206
206
|
/** Ends the active session started by a click: on a mousedown outside the TagInput, or on blur() */
|
|
207
|
-
deactivate() {
|
|
208
|
-
this.
|
|
209
|
-
}
|
|
210
|
-
handleClickPrefixOrSuffix() {
|
|
211
|
-
const { disabled } = this.
|
|
212
|
-
const { focusing } = this.
|
|
213
|
-
if (!disabled && !focusing) this.
|
|
214
|
-
}
|
|
215
|
-
handleSortEnd({ oldIndex, newIndex }) {
|
|
207
|
+
deactivate = () => {
|
|
208
|
+
this.adapter.setActive(false);
|
|
209
|
+
};
|
|
210
|
+
handleClickPrefixOrSuffix = () => {
|
|
211
|
+
const { disabled } = this.adapter.getProps();
|
|
212
|
+
const { focusing } = this.adapter.getStates();
|
|
213
|
+
if (!disabled && !focusing) this.adapter.toggleFocusing(true);
|
|
214
|
+
};
|
|
215
|
+
handleSortEnd = ({ oldIndex, newIndex }) => {
|
|
216
216
|
const { tagsArray } = this.#current();
|
|
217
217
|
const newTagsArray = arrayMove(tagsArray, oldIndex, newIndex);
|
|
218
|
-
if (!this.
|
|
219
|
-
this.
|
|
220
|
-
}
|
|
218
|
+
if (!this.isControlledComponent()) this.adapter.setTagsArray(newTagsArray);
|
|
219
|
+
this.adapter.notifyTagChange(newTagsArray);
|
|
220
|
+
};
|
|
221
221
|
};
|
|
222
222
|
export { TagInputFoundation as default };
|
|
@@ -73,36 +73,36 @@ export default class TimePickerFoundation<P extends TimePickerBaseProps = TimePi
|
|
|
73
73
|
inputValue: string;
|
|
74
74
|
invalid: boolean;
|
|
75
75
|
};
|
|
76
|
-
handlePanelChange(result: {
|
|
76
|
+
handlePanelChange: (result: {
|
|
77
77
|
timeStampValue: number;
|
|
78
|
-
}, index?: number)
|
|
78
|
+
}, index?: number) => void;
|
|
79
79
|
/**
|
|
80
80
|
* Derives the value, input text and validity state from a `value` prop. With `prevTimeZone`, `value` is the
|
|
81
81
|
* shown value in that zone and is re-zoned into `timeZone`.
|
|
82
82
|
*/
|
|
83
|
-
syncValueFromProps({ value, timeZone, prevTimeZone }: {
|
|
83
|
+
syncValueFromProps: ({ value, timeZone, prevTimeZone }: {
|
|
84
84
|
value: TimeValue | (TimeValue | undefined)[];
|
|
85
85
|
timeZone?: string | number;
|
|
86
86
|
prevTimeZone?: string | number;
|
|
87
|
-
})
|
|
88
|
-
handleFocus(e: E)
|
|
87
|
+
}) => void;
|
|
88
|
+
handleFocus: (e: E) => void;
|
|
89
89
|
/** A custom trigger without a focus target of its own is a button: Enter, Space and Down Arrow open the panel */
|
|
90
|
-
handleTriggerKeyDown(e: Pick<KeyboardEvent,
|
|
91
|
-
refreshInputValue()
|
|
90
|
+
handleTriggerKeyDown: (e: Pick<KeyboardEvent, "key" | "preventDefault">) => void;
|
|
91
|
+
refreshInputValue: () => void;
|
|
92
92
|
/**
|
|
93
93
|
* Closes the panel and reports openChange(false), without blur and without moving focus, e.g. for a picker that
|
|
94
94
|
* leaves the page while open (Vue KeepAlive)
|
|
95
95
|
*/
|
|
96
|
-
close()
|
|
96
|
+
close: () => void;
|
|
97
97
|
/**
|
|
98
98
|
* The panel is a custom-trigger popup, so the Popover leaves Esc to the picker. Keyboard focus in a list returns
|
|
99
99
|
* to the input first: the input opens the panel on focus, which must not happen once the panel is closed. The
|
|
100
100
|
* focus stays in the picker, so this is no blur.
|
|
101
101
|
*/
|
|
102
|
-
handleEscKeyDown()
|
|
103
|
-
handlePanelOpen()
|
|
102
|
+
handleEscKeyDown: () => void;
|
|
103
|
+
handlePanelOpen: () => void;
|
|
104
104
|
/** Called for a mousedown outside the trigger and the panel while the panel is shown */
|
|
105
|
-
handleClickOutside(e: MouseEvent)
|
|
106
|
-
handleInputChange(input: string)
|
|
107
|
-
handleInputBlur()
|
|
105
|
+
handleClickOutside: (e: MouseEvent) => void;
|
|
106
|
+
handleInputChange: (input: string) => void;
|
|
107
|
+
handleInputBlur: () => void;
|
|
108
108
|
}
|
|
@@ -30,7 +30,7 @@ var TimePickerFoundation = class TimePickerFoundation extends BaseFoundation {
|
|
|
30
30
|
let str = inputValue;
|
|
31
31
|
let _value = value;
|
|
32
32
|
const timeZone = this.getProp("timeZone");
|
|
33
|
-
if (this.
|
|
33
|
+
if (this.adapter.isRangePicker()) {
|
|
34
34
|
const parts = inputValue.split(this.getProp("rangeSeparator"));
|
|
35
35
|
str = value.length === 2 ? [parts[0], parts[1] ?? ""] : parts;
|
|
36
36
|
} else _value = Array.isArray(_value) ? _value[0] : _value;
|
|
@@ -45,7 +45,7 @@ var TimePickerFoundation = class TimePickerFoundation extends BaseFoundation {
|
|
|
45
45
|
str = formatToString(_value, formatToken, dateFnsLocale);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
this.
|
|
48
|
+
this.adapter.notifyChange(_value, str);
|
|
49
49
|
}
|
|
50
50
|
#hasChanged(dates = [], oldDates = []) {
|
|
51
51
|
const formatToken = this.getValidFormat();
|
|
@@ -58,7 +58,7 @@ var TimePickerFoundation = class TimePickerFoundation extends BaseFoundation {
|
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
isDisabledHMS({ hours, minutes, seconds }, panelType = "left", dates = []) {
|
|
61
|
-
const { disabledHours, disabledMinutes, disabledSeconds } = TimePickerFoundation.getDisabledTimeFns(this.getProps(), dates, panelType, this.
|
|
61
|
+
const { disabledHours, disabledMinutes, disabledSeconds } = TimePickerFoundation.getDisabledTimeFns(this.getProps(), dates, panelType, this.adapter.isRangePicker());
|
|
62
62
|
const hDis = hours != null && hourIsDisabled(disabledHours, hours);
|
|
63
63
|
const mDis = hours != null && minutes != null && minuteIsDisabled(disabledMinutes, hours, minutes);
|
|
64
64
|
const sDis = hours != null && minutes != null && seconds != null && secondIsDisabled(disabledSeconds, hours, minutes, seconds);
|
|
@@ -71,7 +71,7 @@ var TimePickerFoundation = class TimePickerFoundation extends BaseFoundation {
|
|
|
71
71
|
validateDates(dates = []) {
|
|
72
72
|
let invalid = dates.some((d) => d !== void 0 && isNaN(Number(d)));
|
|
73
73
|
if (!invalid) {
|
|
74
|
-
if (this.
|
|
74
|
+
if (this.adapter.isRangePicker()) invalid = dates.some((d, idx) => {
|
|
75
75
|
if (d === void 0) return false;
|
|
76
76
|
const panelType = idx === 1 ? "right" : "left";
|
|
77
77
|
return this.isDisabledHMS({
|
|
@@ -142,15 +142,15 @@ var TimePickerFoundation = class TimePickerFoundation extends BaseFoundation {
|
|
|
142
142
|
invalid: false
|
|
143
143
|
};
|
|
144
144
|
}
|
|
145
|
-
handlePanelChange(result, index = 0) {
|
|
145
|
+
handlePanelChange = (result, index = 0) => {
|
|
146
146
|
const formatToken = this.getValidFormat();
|
|
147
147
|
const dateFnsLocale = this.getProp("dateFnsLocale");
|
|
148
148
|
const oldValue = this.getState("value");
|
|
149
|
-
const value = this.
|
|
149
|
+
const value = this.adapter.isRangePicker() ? [oldValue[0], oldValue[1]] : transformToArray(oldValue);
|
|
150
150
|
if (result) {
|
|
151
151
|
value[index] = parseToDate(result.timeStampValue, formatToken, dateFnsLocale);
|
|
152
152
|
const inputValue = this.formatValue(value);
|
|
153
|
-
if (!this.
|
|
153
|
+
if (!this.isControlledComponent("value")) {
|
|
154
154
|
const invalid = this.validateDates(value);
|
|
155
155
|
this.setState({
|
|
156
156
|
value,
|
|
@@ -160,67 +160,67 @@ var TimePickerFoundation = class TimePickerFoundation extends BaseFoundation {
|
|
|
160
160
|
}
|
|
161
161
|
if (this.#hasChanged(value, oldValue)) this.#notifyChange(value, inputValue);
|
|
162
162
|
}
|
|
163
|
-
}
|
|
163
|
+
};
|
|
164
164
|
/**
|
|
165
165
|
* Derives the value, input text and validity state from a `value` prop. With `prevTimeZone`, `value` is the
|
|
166
166
|
* shown value in that zone and is re-zoned into `timeZone`.
|
|
167
167
|
*/
|
|
168
|
-
syncValueFromProps({ value, timeZone, prevTimeZone }) {
|
|
168
|
+
syncValueFromProps = ({ value, timeZone, prevTimeZone }) => {
|
|
169
169
|
const dates = TimePickerFoundation.#parseDates(value, this.getProps(), timeZone, prevTimeZone);
|
|
170
170
|
this.setState({
|
|
171
171
|
value: dates,
|
|
172
172
|
invalid: this.validateDates(dates),
|
|
173
173
|
inputValue: this.formatValue(dates)
|
|
174
174
|
});
|
|
175
|
-
}
|
|
176
|
-
handleFocus(e) {
|
|
175
|
+
};
|
|
176
|
+
handleFocus = (e) => {
|
|
177
177
|
this.handlePanelOpen();
|
|
178
|
-
this.
|
|
179
|
-
}
|
|
178
|
+
this.adapter.notifyFocus(e);
|
|
179
|
+
};
|
|
180
180
|
/** A custom trigger without a focus target of its own is a button: Enter, Space and Down Arrow open the panel */
|
|
181
|
-
handleTriggerKeyDown(e) {
|
|
181
|
+
handleTriggerKeyDown = (e) => {
|
|
182
182
|
if (e.key === "Enter" || e.key === " " || e.key === "ArrowDown") {
|
|
183
183
|
e.preventDefault();
|
|
184
184
|
this.handlePanelOpen();
|
|
185
185
|
}
|
|
186
|
-
}
|
|
187
|
-
refreshInputValue() {
|
|
186
|
+
};
|
|
187
|
+
refreshInputValue = () => {
|
|
188
188
|
this.setState({ inputValue: this.formatValue(this.getState("value")) });
|
|
189
|
-
}
|
|
189
|
+
};
|
|
190
190
|
/**
|
|
191
191
|
* Closes the panel and reports openChange(false), without blur and without moving focus, e.g. for a picker that
|
|
192
192
|
* leaves the page while open (Vue KeepAlive)
|
|
193
193
|
*/
|
|
194
|
-
close() {
|
|
195
|
-
if (!this.
|
|
196
|
-
this.
|
|
197
|
-
}
|
|
194
|
+
close = () => {
|
|
195
|
+
if (!this.isControlledComponent("open")) this.adapter.setPanelOpen(false);
|
|
196
|
+
this.adapter.notifyOpenChange(false);
|
|
197
|
+
};
|
|
198
198
|
/**
|
|
199
199
|
* The panel is a custom-trigger popup, so the Popover leaves Esc to the picker. Keyboard focus in a list returns
|
|
200
200
|
* to the input first: the input opens the panel on focus, which must not happen once the panel is closed. The
|
|
201
201
|
* focus stays in the picker, so this is no blur.
|
|
202
202
|
*/
|
|
203
|
-
handleEscKeyDown() {
|
|
204
|
-
if (this.
|
|
203
|
+
handleEscKeyDown = () => {
|
|
204
|
+
if (this.adapter.isKeyboardFocusInPanel()) this.adapter.setTriggerFocus();
|
|
205
205
|
this.close();
|
|
206
|
-
}
|
|
207
|
-
handlePanelOpen() {
|
|
206
|
+
};
|
|
207
|
+
handlePanelOpen = () => {
|
|
208
208
|
if (this.getProp("disabled") || TimePickerFoundation.isPanelShown(this.getProps(), this.getStates())) return;
|
|
209
|
-
if (!this.
|
|
210
|
-
this.
|
|
211
|
-
}
|
|
209
|
+
if (!this.isControlledComponent("open")) this.adapter.setPanelOpen(true);
|
|
210
|
+
this.adapter.notifyOpenChange(true);
|
|
211
|
+
};
|
|
212
212
|
/** Called for a mousedown outside the trigger and the panel while the panel is shown */
|
|
213
|
-
handleClickOutside(e) {
|
|
213
|
+
handleClickOutside = (e) => {
|
|
214
214
|
this.close();
|
|
215
|
-
this.
|
|
216
|
-
}
|
|
217
|
-
handleInputChange(input) {
|
|
218
|
-
this.
|
|
215
|
+
this.adapter.notifyBlur(e);
|
|
216
|
+
};
|
|
217
|
+
handleInputChange = (input) => {
|
|
218
|
+
this.adapter.setInputValue(input);
|
|
219
219
|
const rangeSeparator = this.getProp("rangeSeparator");
|
|
220
220
|
const inputValues = (input ?? "").split(rangeSeparator);
|
|
221
221
|
const formatToken = this.getValidFormat();
|
|
222
222
|
if (input !== "" && inputValues.some((time) => !isTimeFormatLike(time, formatToken))) return;
|
|
223
|
-
const isRange = this.
|
|
223
|
+
const isRange = this.adapter.isRangePicker();
|
|
224
224
|
if (isRange && inputValues.length > 2) {
|
|
225
225
|
this.setState({ invalid: true });
|
|
226
226
|
return;
|
|
@@ -230,17 +230,17 @@ var TimePickerFoundation = class TimePickerFoundation extends BaseFoundation {
|
|
|
230
230
|
const invalid = this.validateDates(dates);
|
|
231
231
|
const oldValue = this.getState("value");
|
|
232
232
|
const value = invalid ? transformToArray(oldValue) : [...dates];
|
|
233
|
-
if (this.
|
|
233
|
+
if (this.isControlledComponent("value") || invalid) this.setState({ invalid });
|
|
234
234
|
else this.setState({
|
|
235
235
|
invalid,
|
|
236
236
|
value: dates
|
|
237
237
|
});
|
|
238
238
|
if (this.#hasChanged(value, oldValue)) this.#notifyChange(value, input);
|
|
239
|
-
}
|
|
240
|
-
handleInputBlur() {
|
|
239
|
+
};
|
|
240
|
+
handleInputBlur = () => {
|
|
241
241
|
const inputValue = this.getState("inputValue");
|
|
242
242
|
const value = this.getState("value");
|
|
243
|
-
if (inputValue || this.
|
|
243
|
+
if (inputValue || this.isControlledComponent("value")) this.setState({
|
|
244
244
|
inputValue: this.formatValue(value),
|
|
245
245
|
invalid: false
|
|
246
246
|
});
|
|
@@ -249,6 +249,6 @@ var TimePickerFoundation = class TimePickerFoundation extends BaseFoundation {
|
|
|
249
249
|
value: [],
|
|
250
250
|
invalid: false
|
|
251
251
|
});
|
|
252
|
-
}
|
|
252
|
+
};
|
|
253
253
|
};
|
|
254
254
|
export { TimePickerFoundation as default };
|
|
@@ -8,8 +8,8 @@ export interface TimeInputAdapter<P extends object = object, S extends object =
|
|
|
8
8
|
}
|
|
9
9
|
export default class TimeInputFoundation<P extends object = object, S extends object = object, E = unknown> extends BaseFoundation<TimeInputAdapter<P, S, E>, P, S> {
|
|
10
10
|
#private;
|
|
11
|
-
handleFocus(e: E)
|
|
12
|
-
handleChange(v: string)
|
|
13
|
-
handleBlur(e: E)
|
|
14
|
-
restoreCursor()
|
|
11
|
+
handleFocus: (e: E) => void;
|
|
12
|
+
handleChange: (v: string) => void;
|
|
13
|
+
handleBlur: (e: E) => void;
|
|
14
|
+
restoreCursor: () => void;
|
|
15
15
|
}
|
|
@@ -3,31 +3,31 @@ import BaseFoundation from "../base/foundation.js";
|
|
|
3
3
|
var TimeInputFoundation = class extends BaseFoundation {
|
|
4
4
|
#cursorIndex = null;
|
|
5
5
|
#storeCursor() {
|
|
6
|
-
const inputNode = this.
|
|
6
|
+
const inputNode = this.adapter.getInputNode();
|
|
7
7
|
if (inputNode) this.#cursorIndex = inputNode.selectionStart;
|
|
8
8
|
}
|
|
9
9
|
#clearCursor() {
|
|
10
10
|
this.#cursorIndex = null;
|
|
11
11
|
}
|
|
12
|
-
handleFocus(e) {
|
|
12
|
+
handleFocus = (e) => {
|
|
13
13
|
this.#storeCursor();
|
|
14
|
-
this.
|
|
15
|
-
}
|
|
16
|
-
handleChange(v) {
|
|
14
|
+
this.adapter.notifyFocus(e);
|
|
15
|
+
};
|
|
16
|
+
handleChange = (v) => {
|
|
17
17
|
this.#storeCursor();
|
|
18
|
-
this.
|
|
19
|
-
}
|
|
20
|
-
handleBlur(e) {
|
|
18
|
+
this.adapter.notifyChange(v);
|
|
19
|
+
};
|
|
20
|
+
handleBlur = (e) => {
|
|
21
21
|
this.#clearCursor();
|
|
22
|
-
this.
|
|
23
|
-
}
|
|
24
|
-
restoreCursor() {
|
|
25
|
-
const inputNode = this.
|
|
22
|
+
this.adapter.notifyBlur(e);
|
|
23
|
+
};
|
|
24
|
+
restoreCursor = () => {
|
|
25
|
+
const inputNode = this.adapter.getInputNode();
|
|
26
26
|
const cursorIndex = this.#cursorIndex;
|
|
27
27
|
if (inputNode && cursorIndex !== null) {
|
|
28
28
|
inputNode.selectionStart = cursorIndex;
|
|
29
29
|
inputNode.selectionEnd = cursorIndex;
|
|
30
30
|
}
|
|
31
|
-
}
|
|
31
|
+
};
|
|
32
32
|
};
|
|
33
33
|
export { TimeInputFoundation as default };
|
|
@@ -15,11 +15,11 @@ export default class ToastListStore {
|
|
|
15
15
|
subscribe: (listener: () => void) => () => void;
|
|
16
16
|
getSnapshot: () => ToastListState;
|
|
17
17
|
/** Shows a toast at the end, or updates the shown one with the same id in place */
|
|
18
|
-
add(toast: ToastInstance)
|
|
19
|
-
remove(id: string)
|
|
20
|
-
finishLeave(id: string)
|
|
21
|
-
clear()
|
|
22
|
-
setStack(option?: boolean | number)
|
|
23
|
-
config(opts: ConfigProps)
|
|
24
|
-
resetConfig()
|
|
18
|
+
add: (toast: ToastInstance) => void;
|
|
19
|
+
remove: (id: string) => void;
|
|
20
|
+
finishLeave: (id: string) => void;
|
|
21
|
+
clear: () => void;
|
|
22
|
+
setStack: (option?: boolean | number) => void;
|
|
23
|
+
config: (opts: ConfigProps) => void;
|
|
24
|
+
resetConfig: () => void;
|
|
25
25
|
}
|
|
@@ -19,36 +19,36 @@ var ToastListStore = class {
|
|
|
19
19
|
subscribe = (listener) => this.#items.subscribe(listener);
|
|
20
20
|
getSnapshot = () => this.#items.getSnapshot();
|
|
21
21
|
/** Shows a toast at the end, or updates the shown one with the same id in place */
|
|
22
|
-
add(toast) {
|
|
22
|
+
add = (toast) => {
|
|
23
23
|
this.#items.add(toast);
|
|
24
|
-
}
|
|
25
|
-
remove(id) {
|
|
24
|
+
};
|
|
25
|
+
remove = (id) => {
|
|
26
26
|
this.#items.remove(id);
|
|
27
|
-
}
|
|
28
|
-
finishLeave(id) {
|
|
27
|
+
};
|
|
28
|
+
finishLeave = (id) => {
|
|
29
29
|
this.#items.finishLeave(id);
|
|
30
|
-
}
|
|
31
|
-
clear() {
|
|
30
|
+
};
|
|
31
|
+
clear = () => {
|
|
32
32
|
this.#items.clear();
|
|
33
|
-
}
|
|
34
|
-
setStack(option) {
|
|
33
|
+
};
|
|
34
|
+
setStack = (option) => {
|
|
35
35
|
const stack = option === true ? numbers.stackThreshold : typeof option === "number" ? Math.max(option, 0) : 0;
|
|
36
36
|
const { stack: current, updatedItems } = this.#items.getSnapshot();
|
|
37
37
|
if (stack !== current) this.#items.set({
|
|
38
38
|
stack,
|
|
39
39
|
updatedItems
|
|
40
40
|
});
|
|
41
|
-
}
|
|
42
|
-
config(opts) {
|
|
41
|
+
};
|
|
42
|
+
config = (opts) => {
|
|
43
43
|
for (const pos of positions) if (pos in opts) this.defaults[pos] = opts[pos];
|
|
44
44
|
if (typeof opts.theme === "string" && strings.themes.includes(opts.theme)) this.defaults.theme = opts.theme;
|
|
45
45
|
if (typeof opts.zIndex === "number") this.defaults.zIndex = opts.zIndex;
|
|
46
46
|
if (typeof opts.duration === "number") this.defaults.duration = opts.duration;
|
|
47
47
|
if (typeof opts.getPopupContainer === "function") this.defaults.getPopupContainer = opts.getPopupContainer;
|
|
48
|
-
}
|
|
49
|
-
resetConfig() {
|
|
48
|
+
};
|
|
49
|
+
resetConfig = () => {
|
|
50
50
|
this.defaults = { ...builtInOpts };
|
|
51
51
|
if (this.#initialConfig) this.config(this.#initialConfig);
|
|
52
|
-
}
|
|
52
|
+
};
|
|
53
53
|
};
|
|
54
54
|
export { ToastListStore as default };
|
|
@@ -75,20 +75,20 @@ export default class Tooltip<P extends TooltipBaseProps = TooltipBaseProps, S ex
|
|
|
75
75
|
init(): void;
|
|
76
76
|
destroy(): void;
|
|
77
77
|
/** Regenerates the trigger and popup handlers, which depend on `trigger` and `clickToHide` */
|
|
78
|
-
rebindEvents()
|
|
79
|
-
removePortal()
|
|
78
|
+
rebindEvents: () => void;
|
|
79
|
+
removePortal: () => void;
|
|
80
80
|
/** Hosts call this when the `visible` prop changes */
|
|
81
|
-
handleVisiblePropChange()
|
|
82
|
-
updateStateIfCursorOnTrigger()
|
|
81
|
+
handleVisiblePropChange: () => void;
|
|
82
|
+
updateStateIfCursorOnTrigger: () => void;
|
|
83
83
|
delayShow(): void;
|
|
84
84
|
show(): void;
|
|
85
85
|
/** Called once `showPopover()` has been issued for this opening (by the layout effect that reacts to the
|
|
86
86
|
* mount `insertPortal` requested); a hover popup can still back out here if the pointer already left. */
|
|
87
|
-
handleOpened()
|
|
87
|
+
handleOpened: () => void;
|
|
88
88
|
/** Hosts call this right after `showPopover()`: positions the popup and keeps it beside the trigger until it closes */
|
|
89
|
-
handleShown()
|
|
89
|
+
handleShown: () => void;
|
|
90
90
|
/** Positions an open popup beside its trigger at once, without waiting for a frame */
|
|
91
|
-
calcPosition()
|
|
91
|
+
calcPosition: () => void;
|
|
92
92
|
delayHide(): void;
|
|
93
93
|
hide: () => void;
|
|
94
94
|
/**
|
|
@@ -96,10 +96,10 @@ export default class Tooltip<P extends TooltipBaseProps = TooltipBaseProps, S ex
|
|
|
96
96
|
* focus is. Returns whether the popup took the key; one that does not leaves it to the layer below.
|
|
97
97
|
*/
|
|
98
98
|
handleEscape: (event: KeyboardEvent) => boolean;
|
|
99
|
-
handleContainerKeydown(event: Pick<KeyboardEvent,
|
|
99
|
+
handleContainerKeydown: (event: Pick<KeyboardEvent, "key" | "shiftKey" | "preventDefault">) => void;
|
|
100
100
|
/**
|
|
101
101
|
* Focus the trigger. A 'focus' or 'hover' trigger binds onFocus to show the popup, so focusing it
|
|
102
102
|
* reopens the popup; callers hide the popup right after.
|
|
103
103
|
*/
|
|
104
|
-
focusTrigger()
|
|
104
|
+
focusTrigger: () => void;
|
|
105
105
|
}
|