@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
|
@@ -13,18 +13,18 @@ var AutoCloseFoundation = class extends BaseFoundation {
|
|
|
13
13
|
destroy() {
|
|
14
14
|
this.clearCloseTimer();
|
|
15
15
|
}
|
|
16
|
-
leave() {
|
|
16
|
+
leave = () => {
|
|
17
17
|
this.#leaving = true;
|
|
18
18
|
this.clearCloseTimer();
|
|
19
|
-
}
|
|
20
|
-
pauseCloseTimer() {
|
|
19
|
+
};
|
|
20
|
+
pauseCloseTimer = () => {
|
|
21
21
|
this.#paused = true;
|
|
22
22
|
this.clearCloseTimer();
|
|
23
|
-
}
|
|
24
|
-
resumeCloseTimer() {
|
|
23
|
+
};
|
|
24
|
+
resumeCloseTimer = () => {
|
|
25
25
|
this.#paused = false;
|
|
26
26
|
this.startCloseTimer();
|
|
27
|
-
}
|
|
27
|
+
};
|
|
28
28
|
startCloseTimer() {
|
|
29
29
|
this.clearCloseTimer();
|
|
30
30
|
const duration = this.getProp("duration");
|
|
@@ -32,30 +32,30 @@ var AutoCloseFoundation = class extends BaseFoundation {
|
|
|
32
32
|
this.close();
|
|
33
33
|
}, duration * 1e3);
|
|
34
34
|
}
|
|
35
|
-
clickClose(e) {
|
|
35
|
+
clickClose = (e) => {
|
|
36
36
|
e.stopPropagation();
|
|
37
37
|
if (this.#leaving) return;
|
|
38
|
-
this.
|
|
38
|
+
this.adapter.notifyCloseClick?.(this.#id);
|
|
39
39
|
this.close();
|
|
40
|
-
}
|
|
41
|
-
close(e) {
|
|
40
|
+
};
|
|
41
|
+
close = (e) => {
|
|
42
42
|
e?.stopPropagation();
|
|
43
43
|
if (this.#leaving) return;
|
|
44
44
|
this.#leaving = true;
|
|
45
45
|
this.clearCloseTimer();
|
|
46
|
-
this.
|
|
47
|
-
this.
|
|
48
|
-
}
|
|
46
|
+
this.adapter.notifyWrapperToRemove(this.#id);
|
|
47
|
+
this.adapter.notifyClose();
|
|
48
|
+
};
|
|
49
49
|
clearCloseTimer() {
|
|
50
50
|
if (this.#timer) {
|
|
51
51
|
clearTimeout(this.#timer);
|
|
52
52
|
this.#timer = null;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
restartCloseTimer() {
|
|
55
|
+
restartCloseTimer = () => {
|
|
56
56
|
this.#leaving = false;
|
|
57
57
|
this.clearCloseTimer();
|
|
58
58
|
if (!this.#paused) this.startCloseTimer();
|
|
59
|
-
}
|
|
59
|
+
};
|
|
60
60
|
};
|
|
61
61
|
export { AutoCloseFoundation as default };
|
|
@@ -30,7 +30,8 @@ export interface DirectionContext {
|
|
|
30
30
|
* - The constructor may run more than once per mount (StrictMode discards one instance), so it has no side effects.
|
|
31
31
|
* - On mount the host calls `connect()` then `init()`, after the DOM is in place and before paint (layout phase).
|
|
32
32
|
* On unmount it calls `destroy()` then `disconnect()`. Under StrictMode the kept instance goes through
|
|
33
|
-
* init -> destroy -> init.
|
|
33
|
+
* init -> destroy -> init. `destroy()` must not rely on the DOM still being attached: Svelte removes a
|
|
34
|
+
* component's DOM before it runs teardown.
|
|
34
35
|
* - `init()` may run again after `destroy()` on state the user already changed (StrictMode, and React Activity each
|
|
35
36
|
* time it shows again), so it must be idempotent: initial values resolved from props (`default*`, `value`) belong
|
|
36
37
|
* in a static `getInitialState` the host calls when it creates the state; `init()` only subscribes and runs
|
|
@@ -52,13 +53,13 @@ export interface DirectionContext {
|
|
|
52
53
|
*/
|
|
53
54
|
export default class BaseFoundation<T extends DefaultAdapter<P, S, any>, P = Record<string, any>, S = Record<string, any>> {
|
|
54
55
|
#private;
|
|
55
|
-
protected
|
|
56
|
+
protected adapter: T;
|
|
56
57
|
constructor(adapter: T);
|
|
57
58
|
/**
|
|
58
59
|
* A prop is controlled when its value is not `undefined`: a Vue adapter's props hold every declared key. Without
|
|
59
60
|
* a key it checks `value`, the controlled prop of most components.
|
|
60
61
|
*/
|
|
61
|
-
protected
|
|
62
|
+
protected isControlledComponent(key?: keyof P & string): boolean;
|
|
62
63
|
/** Aborted when the component unmounts: a listener registered with it needs no removal of its own */
|
|
63
64
|
protected get signal(): AbortSignal;
|
|
64
65
|
getProp<K extends keyof P>(key: K): P[K];
|
package/dist/base/foundation.js
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* - The constructor may run more than once per mount (StrictMode discards one instance), so it has no side effects.
|
|
8
8
|
* - On mount the host calls `connect()` then `init()`, after the DOM is in place and before paint (layout phase).
|
|
9
9
|
* On unmount it calls `destroy()` then `disconnect()`. Under StrictMode the kept instance goes through
|
|
10
|
-
* init -> destroy -> init.
|
|
10
|
+
* init -> destroy -> init. `destroy()` must not rely on the DOM still being attached: Svelte removes a
|
|
11
|
+
* component's DOM before it runs teardown.
|
|
11
12
|
* - `init()` may run again after `destroy()` on state the user already changed (StrictMode, and React Activity each
|
|
12
13
|
* time it shows again), so it must be idempotent: initial values resolved from props (`default*`, `value`) belong
|
|
13
14
|
* in a static `getInitialState` the host calls when it creates the state; `init()` only subscribes and runs
|
|
@@ -29,15 +30,15 @@
|
|
|
29
30
|
*/
|
|
30
31
|
var BaseFoundation = class {
|
|
31
32
|
#lifetime = null;
|
|
32
|
-
|
|
33
|
+
adapter;
|
|
33
34
|
constructor(adapter) {
|
|
34
|
-
this.
|
|
35
|
+
this.adapter = adapter;
|
|
35
36
|
}
|
|
36
37
|
/**
|
|
37
38
|
* A prop is controlled when its value is not `undefined`: a Vue adapter's props hold every declared key. Without
|
|
38
39
|
* a key it checks `value`, the controlled prop of most components.
|
|
39
40
|
*/
|
|
40
|
-
|
|
41
|
+
isControlledComponent(key = "value") {
|
|
41
42
|
return this.getProps()[key] !== void 0;
|
|
42
43
|
}
|
|
43
44
|
/** Aborted when the component unmounts: a listener registered with it needs no removal of its own */
|
|
@@ -46,25 +47,25 @@ var BaseFoundation = class {
|
|
|
46
47
|
return this.#lifetime.signal;
|
|
47
48
|
}
|
|
48
49
|
getProp(key) {
|
|
49
|
-
return this.
|
|
50
|
+
return this.adapter.getProp(key);
|
|
50
51
|
}
|
|
51
52
|
getProps() {
|
|
52
|
-
return this.
|
|
53
|
+
return this.adapter.getProps();
|
|
53
54
|
}
|
|
54
55
|
getState(key) {
|
|
55
|
-
return this.
|
|
56
|
+
return this.adapter.getState(key);
|
|
56
57
|
}
|
|
57
58
|
getStates() {
|
|
58
|
-
return this.
|
|
59
|
+
return this.adapter.getStates();
|
|
59
60
|
}
|
|
60
61
|
setState(states, cb) {
|
|
61
|
-
return this.
|
|
62
|
+
return this.adapter.setState({ ...states }, cb);
|
|
62
63
|
}
|
|
63
64
|
getContext(key) {
|
|
64
|
-
return this.
|
|
65
|
+
return this.adapter.getContext(key);
|
|
65
66
|
}
|
|
66
67
|
getContexts() {
|
|
67
|
-
return this.
|
|
68
|
+
return this.adapter.getContexts();
|
|
68
69
|
}
|
|
69
70
|
connect() {
|
|
70
71
|
this.#lifetime = new AbortController();
|
|
@@ -22,16 +22,16 @@ export default class BreadcrumbFoundation<P extends object = object, S extends o
|
|
|
22
22
|
/** `activeIndex` marks the current item; without it the last one is current */
|
|
23
23
|
static isActive(index: number, total: number, activeIndex?: number): boolean;
|
|
24
24
|
/** No separator after the last item, nor after one hidden behind a custom more area or the popover */
|
|
25
|
-
static shouldRenderSeparator(index: number, total: number,
|
|
25
|
+
static shouldRenderSeparator(index: number, total: number, { collapsed, start, end, hasCustomMore, moreType }: {
|
|
26
26
|
collapsed: boolean;
|
|
27
27
|
start: number;
|
|
28
28
|
end: number;
|
|
29
29
|
hasCustomMore: boolean;
|
|
30
30
|
moreType?: string;
|
|
31
31
|
}): boolean;
|
|
32
|
-
handleClick(info: BreadcrumbItemInfo, event: E)
|
|
33
|
-
handleExpand(clickEvent: unknown)
|
|
34
|
-
handleExpandKeyDown(keyboardEvent: Pick<KeyboardEvent,
|
|
32
|
+
handleClick: (info: BreadcrumbItemInfo, event: E) => void;
|
|
33
|
+
handleExpand: (clickEvent: unknown) => void;
|
|
34
|
+
handleExpandKeyDown: (keyboardEvent: Pick<KeyboardEvent, "key" | "target" | "preventDefault"> & {
|
|
35
35
|
currentTarget: Node;
|
|
36
|
-
})
|
|
36
|
+
}) => void;
|
|
37
37
|
}
|
|
@@ -38,24 +38,23 @@ var BreadcrumbFoundation = class extends BaseFoundation {
|
|
|
38
38
|
return activeIndex !== void 0 ? activeIndex === index : index === total - 1;
|
|
39
39
|
}
|
|
40
40
|
/** No separator after the last item, nor after one hidden behind a custom more area or the popover */
|
|
41
|
-
static shouldRenderSeparator(index, total,
|
|
42
|
-
const { collapsed, start, end, hasCustomMore, moreType } = collapse;
|
|
41
|
+
static shouldRenderSeparator(index, total, { collapsed, start, end, hasCustomMore, moreType }) {
|
|
43
42
|
const hidden = collapsed && (hasCustomMore || moreType === "popover") && index >= start && index <= end;
|
|
44
43
|
return index !== total - 1 && !hidden;
|
|
45
44
|
}
|
|
46
|
-
handleClick(info, event) {
|
|
47
|
-
this.
|
|
48
|
-
}
|
|
49
|
-
handleExpand(clickEvent) {
|
|
50
|
-
this.
|
|
51
|
-
}
|
|
52
|
-
handleExpandKeyDown(keyboardEvent) {
|
|
45
|
+
handleClick = (info, event) => {
|
|
46
|
+
this.adapter.notifyClick(info, event);
|
|
47
|
+
};
|
|
48
|
+
handleExpand = (clickEvent) => {
|
|
49
|
+
this.adapter.expandCollapsed(clickEvent);
|
|
50
|
+
};
|
|
51
|
+
handleExpandKeyDown = (keyboardEvent) => {
|
|
53
52
|
const { target } = keyboardEvent;
|
|
54
53
|
if (!(target instanceof Node && keyboardEvent.currentTarget.contains(target))) return;
|
|
55
54
|
if (isEnterPress(keyboardEvent) || keyboardEvent.key === " ") {
|
|
56
55
|
keyboardEvent.preventDefault();
|
|
57
56
|
this.handleExpand(keyboardEvent);
|
|
58
57
|
}
|
|
59
|
-
}
|
|
58
|
+
};
|
|
60
59
|
};
|
|
61
60
|
export { BreadcrumbFoundation as default };
|
|
@@ -35,11 +35,11 @@ export default class BreadcrumbItemFoundation<P extends object = object, S exten
|
|
|
35
35
|
noLink?: boolean;
|
|
36
36
|
hasOnClick: boolean;
|
|
37
37
|
}): boolean;
|
|
38
|
-
handleClick(item: BreadcrumbItemInfo, e: E)
|
|
38
|
+
handleClick: (item: BreadcrumbItemInfo, e: E) => void;
|
|
39
39
|
/** Enter goes through a real click so handlers keep receiving a MouseEvent */
|
|
40
|
-
handleKeyDown(e: Pick<KeyboardEvent,
|
|
40
|
+
handleKeyDown: (e: Pick<KeyboardEvent, "key" | "preventDefault"> & {
|
|
41
41
|
currentTarget: {
|
|
42
42
|
click: () => void;
|
|
43
43
|
};
|
|
44
|
-
}, isKeyboardLink: boolean)
|
|
44
|
+
}, isKeyboardLink: boolean) => void;
|
|
45
45
|
}
|
|
@@ -21,16 +21,16 @@ var BreadcrumbItemFoundation = class extends BaseFoundation {
|
|
|
21
21
|
static isKeyboardLink({ active, hasHref, noLink, hasOnClick }) {
|
|
22
22
|
return !active && !hasHref && !noLink && hasOnClick;
|
|
23
23
|
}
|
|
24
|
-
handleClick(item, e) {
|
|
25
|
-
this.
|
|
26
|
-
this.
|
|
27
|
-
}
|
|
24
|
+
handleClick = (item, e) => {
|
|
25
|
+
this.adapter.notifyClick(item, e);
|
|
26
|
+
this.adapter.notifyParent(item, e);
|
|
27
|
+
};
|
|
28
28
|
/** Enter goes through a real click so handlers keep receiving a MouseEvent */
|
|
29
|
-
handleKeyDown(e, isKeyboardLink) {
|
|
29
|
+
handleKeyDown = (e, isKeyboardLink) => {
|
|
30
30
|
if (isKeyboardLink && e.key === "Enter") {
|
|
31
31
|
e.preventDefault();
|
|
32
32
|
e.currentTarget.click();
|
|
33
33
|
}
|
|
34
|
-
}
|
|
34
|
+
};
|
|
35
35
|
};
|
|
36
36
|
export { BreadcrumbItemFoundation as default };
|
|
@@ -147,7 +147,7 @@ function filterEvents(events, start, end) {
|
|
|
147
147
|
}
|
|
148
148
|
function parseRangeAllDayEvent(event, startDate, rangeStart, rangeEnd, parsed) {
|
|
149
149
|
const dateRangeLen = differenceInCalendarDays(rangeEnd, rangeStart);
|
|
150
|
-
event.
|
|
150
|
+
event.toSorted((a, b) => compareAsc(a.start, b.start)).forEach((item) => {
|
|
151
151
|
const itemInfo = { ...item };
|
|
152
152
|
const { end } = item;
|
|
153
153
|
let dateLength;
|
|
@@ -28,7 +28,7 @@ var CalendarFoundation = class CalendarFoundation extends BaseFoundation {
|
|
|
28
28
|
static #parseRangeEvents(events, [start, end]) {
|
|
29
29
|
let parsed = [[]];
|
|
30
30
|
const filtered = filterEvents(events, start, end);
|
|
31
|
-
[...filtered.keys()].
|
|
31
|
+
[...filtered.keys()].toSorted(compareAsc).forEach((item) => {
|
|
32
32
|
const startDate = new Date(item);
|
|
33
33
|
const curr = filtered.get(item).filter((event) => isSameDay(event.date, startDate));
|
|
34
34
|
parsed = parseRangeAllDayEvent(curr, startDate, start, end, parsed);
|
|
@@ -42,10 +42,10 @@ var CalendarFoundation = class CalendarFoundation extends BaseFoundation {
|
|
|
42
42
|
const update = () => {
|
|
43
43
|
if (!isSameDay(this.getProp("displayValue"), getCurrDate())) {
|
|
44
44
|
clearInterval(this.#currTimeTimer);
|
|
45
|
-
this.
|
|
45
|
+
this.adapter.setShowCurrTime(false);
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
|
-
this.
|
|
48
|
+
this.adapter.updateCurrPos(round(getPos(getCurrDate())));
|
|
49
49
|
};
|
|
50
50
|
update();
|
|
51
51
|
clearInterval(this.#currTimeTimer);
|
|
@@ -187,7 +187,7 @@ var CalendarFoundation = class CalendarFoundation extends BaseFoundation {
|
|
|
187
187
|
init() {
|
|
188
188
|
const { showCurrTime, displayValue } = this.getProps();
|
|
189
189
|
if (showCurrTime && isSameDay(displayValue, getCurrDate())) {
|
|
190
|
-
this.
|
|
190
|
+
this.adapter.setShowCurrTime(true);
|
|
191
191
|
this.#startCurrentTimeTicker();
|
|
192
192
|
}
|
|
193
193
|
}
|
|
@@ -6,6 +6,6 @@ export interface CalendarMonthAdapter<P extends object = object, S extends objec
|
|
|
6
6
|
/** Drives the month view's "more" card */
|
|
7
7
|
export default class CalendarMonthFoundation<P extends object = object, S extends object = object> extends BaseFoundation<CalendarMonthAdapter<P, S>, P, S> {
|
|
8
8
|
/** Closes the "more" card from its close button or a mousedown outside */
|
|
9
|
-
closeCard(e:
|
|
10
|
-
showCard(key: string)
|
|
9
|
+
closeCard: (e: unknown, key: string) => void;
|
|
10
|
+
showCard: (key: string) => void;
|
|
11
11
|
}
|
|
@@ -3,11 +3,11 @@ import BaseFoundation from "../base/foundation.js";
|
|
|
3
3
|
/** Drives the month view's "more" card */
|
|
4
4
|
var CalendarMonthFoundation = class extends BaseFoundation {
|
|
5
5
|
/** Closes the "more" card from its close button or a mousedown outside */
|
|
6
|
-
closeCard(e, key) {
|
|
7
|
-
this.
|
|
8
|
-
}
|
|
9
|
-
showCard(key) {
|
|
10
|
-
this.
|
|
11
|
-
}
|
|
6
|
+
closeCard = (e, key) => {
|
|
7
|
+
this.adapter.notifyClose(e, key);
|
|
8
|
+
};
|
|
9
|
+
showCard = (key) => {
|
|
10
|
+
this.adapter.openCard(key);
|
|
11
|
+
};
|
|
12
12
|
};
|
|
13
13
|
export { CalendarMonthFoundation as default };
|
|
@@ -40,22 +40,22 @@ export default class CarouselFoundation<P extends CarouselBaseProps = CarouselBa
|
|
|
40
40
|
activeIndex: number;
|
|
41
41
|
}, total: number): number;
|
|
42
42
|
init(): void;
|
|
43
|
-
setForcePlay(forcePlay: boolean)
|
|
44
|
-
stopByUser()
|
|
45
|
-
stop()
|
|
46
|
-
handleAutoPlayChange(autoPlayOn: boolean)
|
|
47
|
-
handlePointerEnter()
|
|
48
|
-
handlePointerLeave()
|
|
49
|
-
resetPointer()
|
|
50
|
-
handleSlideCountChange(previous: number, count: number)
|
|
51
|
-
handleKeyboardFocus()
|
|
52
|
-
handleFocusLeave()
|
|
53
|
-
goTo(activeIndex: number)
|
|
54
|
-
next()
|
|
55
|
-
prev()
|
|
43
|
+
setForcePlay: (forcePlay: boolean) => void;
|
|
44
|
+
stopByUser: () => void;
|
|
45
|
+
stop: () => void;
|
|
46
|
+
handleAutoPlayChange: (autoPlayOn: boolean) => void;
|
|
47
|
+
handlePointerEnter: () => void;
|
|
48
|
+
handlePointerLeave: () => void;
|
|
49
|
+
resetPointer: () => void;
|
|
50
|
+
handleSlideCountChange: (previous: number, count: number) => void;
|
|
51
|
+
handleKeyboardFocus: () => void;
|
|
52
|
+
handleFocusLeave: () => void;
|
|
53
|
+
goTo: (activeIndex: number) => void;
|
|
54
|
+
next: () => void;
|
|
55
|
+
prev: () => void;
|
|
56
56
|
destroy(): void;
|
|
57
|
-
handleAutoPlay()
|
|
58
|
-
handleKeyDown(event: Pick<KeyboardEvent,
|
|
59
|
-
onIndicatorChange(activeIndex: number)
|
|
60
|
-
syncActiveIndex(activeIndex: number)
|
|
57
|
+
handleAutoPlay: () => void;
|
|
58
|
+
handleKeyDown: (event: Pick<KeyboardEvent, "key" | "altKey" | "ctrlKey" | "metaKey" | "preventDefault">) => boolean;
|
|
59
|
+
onIndicatorChange: (activeIndex: number) => void;
|
|
60
|
+
syncActiveIndex: (activeIndex: number) => void;
|
|
61
61
|
}
|
|
@@ -16,11 +16,11 @@ var CarouselFoundation = class CarouselFoundation extends BaseFoundation {
|
|
|
16
16
|
if (this.#interval) {
|
|
17
17
|
clearInterval(this.#interval);
|
|
18
18
|
this.#interval = null;
|
|
19
|
-
this.
|
|
19
|
+
this.adapter.setRotating(false);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
#getActiveIndex() {
|
|
23
|
-
return CarouselFoundation.deriveActiveIndex(this.getProps(), this.getStates(), this.
|
|
23
|
+
return CarouselFoundation.deriveActiveIndex(this.getProps(), this.getStates(), this.adapter.getSlideCount());
|
|
24
24
|
}
|
|
25
25
|
#restartAfterManualSwitch() {
|
|
26
26
|
if (!this.#pausedByHover) this.handleAutoPlay();
|
|
@@ -29,9 +29,9 @@ var CarouselFoundation = class CarouselFoundation extends BaseFoundation {
|
|
|
29
29
|
const { isInit } = this.getStates();
|
|
30
30
|
const stateActiveIndex = this.#getActiveIndex();
|
|
31
31
|
if (stateActiveIndex !== activeIndex) {
|
|
32
|
-
if (isInit) this.
|
|
33
|
-
this.
|
|
34
|
-
this.
|
|
32
|
+
if (isInit) this.adapter.setIsInit(false);
|
|
33
|
+
this.adapter.setPreActiveIndex(stateActiveIndex);
|
|
34
|
+
this.adapter.notifyChange(activeIndex, stateActiveIndex);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
#play(interval) {
|
|
@@ -39,7 +39,7 @@ var CarouselFoundation = class CarouselFoundation extends BaseFoundation {
|
|
|
39
39
|
this.#interval = setInterval(() => {
|
|
40
40
|
this.next();
|
|
41
41
|
}, interval);
|
|
42
|
-
this.
|
|
42
|
+
this.adapter.setRotating(true);
|
|
43
43
|
}
|
|
44
44
|
#pauseForHover() {
|
|
45
45
|
const { autoPlay } = this.getProps();
|
|
@@ -56,7 +56,7 @@ var CarouselFoundation = class CarouselFoundation extends BaseFoundation {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
getValidIndex(index) {
|
|
59
|
-
const total = this.
|
|
59
|
+
const total = this.adapter.getSlideCount();
|
|
60
60
|
return total === 0 ? 0 : (index % total + total) % total;
|
|
61
61
|
}
|
|
62
62
|
getSwitchingTime() {
|
|
@@ -66,10 +66,10 @@ var CarouselFoundation = class CarouselFoundation extends BaseFoundation {
|
|
|
66
66
|
return speed;
|
|
67
67
|
}
|
|
68
68
|
getIsControlledComponent() {
|
|
69
|
-
return this.
|
|
69
|
+
return this.isControlledComponent("activeIndex");
|
|
70
70
|
}
|
|
71
71
|
handleNewActiveIndex(activeIndex) {
|
|
72
|
-
if (this.#getActiveIndex() !== activeIndex) this.
|
|
72
|
+
if (this.#getActiveIndex() !== activeIndex) this.adapter.setNewActiveIndex(activeIndex);
|
|
73
73
|
}
|
|
74
74
|
static isAutoPlayOn(autoPlay) {
|
|
75
75
|
return autoPlay === true || typeof autoPlay === "object" && autoPlay !== null;
|
|
@@ -84,97 +84,97 @@ var CarouselFoundation = class CarouselFoundation extends BaseFoundation {
|
|
|
84
84
|
init() {
|
|
85
85
|
if (!this.getIsControlledComponent()) this.handleAutoPlay();
|
|
86
86
|
}
|
|
87
|
-
setForcePlay(forcePlay) {
|
|
87
|
+
setForcePlay = (forcePlay) => {
|
|
88
88
|
this.#forcePlay = forcePlay;
|
|
89
89
|
if (forcePlay) this.#stoppedByUser = false;
|
|
90
|
-
}
|
|
91
|
-
stopByUser() {
|
|
90
|
+
};
|
|
91
|
+
stopByUser = () => {
|
|
92
92
|
this.#forcePlay = false;
|
|
93
93
|
this.#stoppedByUser = true;
|
|
94
94
|
this.stop();
|
|
95
|
-
}
|
|
96
|
-
stop() {
|
|
95
|
+
};
|
|
96
|
+
stop = () => {
|
|
97
97
|
this.#pausedByHover = false;
|
|
98
98
|
this.#resumeOnFocusLeave = false;
|
|
99
99
|
this.#unregisterInterval();
|
|
100
|
-
}
|
|
101
|
-
handleAutoPlayChange(autoPlayOn) {
|
|
100
|
+
};
|
|
101
|
+
handleAutoPlayChange = (autoPlayOn) => {
|
|
102
102
|
if (!autoPlayOn && !this.#forcePlay) this.stop();
|
|
103
|
-
}
|
|
104
|
-
handlePointerEnter() {
|
|
103
|
+
};
|
|
104
|
+
handlePointerEnter = () => {
|
|
105
105
|
this.#pointerInside = true;
|
|
106
106
|
this.#hoverEnter();
|
|
107
|
-
}
|
|
108
|
-
handlePointerLeave() {
|
|
107
|
+
};
|
|
108
|
+
handlePointerLeave = () => {
|
|
109
109
|
this.#pointerInside = false;
|
|
110
110
|
this.#hoverLeave();
|
|
111
|
-
}
|
|
112
|
-
resetPointer() {
|
|
111
|
+
};
|
|
112
|
+
resetPointer = () => {
|
|
113
113
|
this.#hoverEnter.cancel();
|
|
114
114
|
this.#hoverLeave.cancel();
|
|
115
115
|
this.#pointerInside = false;
|
|
116
|
-
}
|
|
117
|
-
handleSlideCountChange(previous, count) {
|
|
116
|
+
};
|
|
117
|
+
handleSlideCountChange = (previous, count) => {
|
|
118
118
|
if (previous <= 1 && count > 1 && !this.getIsControlledComponent()) {
|
|
119
119
|
this.handleAutoPlay();
|
|
120
120
|
if (this.#pointerInside) this.#pauseForHover();
|
|
121
121
|
}
|
|
122
|
-
}
|
|
123
|
-
handleKeyboardFocus() {
|
|
122
|
+
};
|
|
123
|
+
handleKeyboardFocus = () => {
|
|
124
124
|
this.#keyboardFocusWithin = true;
|
|
125
125
|
if (this.#interval) {
|
|
126
126
|
this.#unregisterInterval();
|
|
127
127
|
this.#resumeOnFocusLeave = true;
|
|
128
128
|
}
|
|
129
|
-
}
|
|
130
|
-
handleFocusLeave() {
|
|
129
|
+
};
|
|
130
|
+
handleFocusLeave = () => {
|
|
131
131
|
this.#keyboardFocusWithin = false;
|
|
132
132
|
if (this.#resumeOnFocusLeave) {
|
|
133
133
|
this.#resumeOnFocusLeave = false;
|
|
134
134
|
this.handleAutoPlay();
|
|
135
135
|
}
|
|
136
|
-
}
|
|
137
|
-
goTo(activeIndex) {
|
|
136
|
+
};
|
|
137
|
+
goTo = (activeIndex) => {
|
|
138
138
|
const stateActiveIndex = this.#getActiveIndex();
|
|
139
139
|
const targetIndex = this.getValidIndex(activeIndex);
|
|
140
|
-
this.
|
|
140
|
+
this.adapter.setIsReverse(stateActiveIndex > targetIndex);
|
|
141
141
|
this.#notifyChange(targetIndex);
|
|
142
142
|
if (!this.getIsControlledComponent()) this.handleNewActiveIndex(targetIndex);
|
|
143
|
-
}
|
|
144
|
-
next() {
|
|
143
|
+
};
|
|
144
|
+
next = () => {
|
|
145
145
|
this.#unregisterInterval();
|
|
146
146
|
const targetIndex = this.getValidIndex(this.#getActiveIndex() + 1);
|
|
147
|
-
this.
|
|
147
|
+
this.adapter.setIsReverse(false);
|
|
148
148
|
this.#notifyChange(targetIndex);
|
|
149
149
|
if (!this.getIsControlledComponent()) this.handleNewActiveIndex(targetIndex);
|
|
150
150
|
this.#restartAfterManualSwitch();
|
|
151
|
-
}
|
|
152
|
-
prev() {
|
|
151
|
+
};
|
|
152
|
+
prev = () => {
|
|
153
153
|
this.#unregisterInterval();
|
|
154
154
|
const targetIndex = this.getValidIndex(this.#getActiveIndex() - 1);
|
|
155
|
-
this.
|
|
155
|
+
this.adapter.setIsReverse(true);
|
|
156
156
|
this.#notifyChange(targetIndex);
|
|
157
157
|
if (!this.getIsControlledComponent()) this.handleNewActiveIndex(targetIndex);
|
|
158
158
|
this.#restartAfterManualSwitch();
|
|
159
|
-
}
|
|
159
|
+
};
|
|
160
160
|
destroy() {
|
|
161
161
|
this.#hoverEnter.cancel();
|
|
162
162
|
this.#hoverLeave.cancel();
|
|
163
163
|
clearInterval(this.#interval);
|
|
164
164
|
this.#interval = null;
|
|
165
165
|
}
|
|
166
|
-
handleAutoPlay() {
|
|
166
|
+
handleAutoPlay = () => {
|
|
167
167
|
const { autoPlay } = this.getProps();
|
|
168
168
|
if (this.#stoppedByUser) return;
|
|
169
169
|
const reduceMotion = !this.#forcePlay && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
170
|
-
if (this.
|
|
170
|
+
if (this.adapter.getSlideCount() > 1 && !reduceMotion && (CarouselFoundation.isAutoPlayOn(autoPlay) || this.#forcePlay)) {
|
|
171
171
|
if (this.#keyboardFocusWithin) this.#resumeOnFocusLeave = true;
|
|
172
172
|
else this.#play(this.getSwitchingTime());
|
|
173
173
|
}
|
|
174
|
-
}
|
|
175
|
-
handleKeyDown(event) {
|
|
174
|
+
};
|
|
175
|
+
handleKeyDown = (event) => {
|
|
176
176
|
if (event.altKey || event.ctrlKey || event.metaKey) return false;
|
|
177
|
-
const isRtl = this.
|
|
177
|
+
const isRtl = this.adapter.getContext("direction") === "rtl";
|
|
178
178
|
switch (event.key) {
|
|
179
179
|
case "ArrowLeft":
|
|
180
180
|
case "ArrowRight":
|
|
@@ -185,20 +185,20 @@ var CarouselFoundation = class CarouselFoundation extends BaseFoundation {
|
|
|
185
185
|
this.goTo(0);
|
|
186
186
|
break;
|
|
187
187
|
case "End":
|
|
188
|
-
this.goTo(this.
|
|
188
|
+
this.goTo(this.adapter.getSlideCount() - 1);
|
|
189
189
|
break;
|
|
190
190
|
default: return false;
|
|
191
191
|
}
|
|
192
192
|
event.preventDefault();
|
|
193
193
|
return true;
|
|
194
|
-
}
|
|
195
|
-
onIndicatorChange(activeIndex) {
|
|
196
|
-
this.
|
|
194
|
+
};
|
|
195
|
+
onIndicatorChange = (activeIndex) => {
|
|
196
|
+
this.adapter.setIsReverse(this.#getActiveIndex() > activeIndex);
|
|
197
197
|
this.#notifyChange(activeIndex);
|
|
198
198
|
if (!this.getIsControlledComponent()) this.handleNewActiveIndex(activeIndex);
|
|
199
|
-
}
|
|
200
|
-
syncActiveIndex(activeIndex) {
|
|
201
|
-
if (activeIndex !== void 0 && activeIndex !== this.getStates().activeIndex) this.
|
|
202
|
-
}
|
|
199
|
+
};
|
|
200
|
+
syncActiveIndex = (activeIndex) => {
|
|
201
|
+
if (activeIndex !== void 0 && activeIndex !== this.getStates().activeIndex) this.adapter.setNewActiveIndex(activeIndex);
|
|
202
|
+
};
|
|
203
203
|
};
|
|
204
204
|
export { CarouselFoundation as default };
|