@fibrae/semi-foundation 0.1.1 → 0.3.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 -4
- package/dist/anchor/foundation.js +21 -22
- package/dist/audio-player/foundation.d.ts +10 -13
- package/dist/audio-player/foundation.js +19 -20
- package/dist/auto-complete/foundation.d.ts +12 -14
- package/dist/auto-complete/foundation.js +51 -52
- package/dist/avatar/foundation.d.ts +5 -6
- package/dist/avatar/foundation.js +16 -16
- package/dist/avatar/variables.scss +0 -1
- package/dist/backtop/foundation.d.ts +2 -5
- package/dist/backtop/foundation.js +7 -8
- package/dist/banner/foundation.d.ts +1 -1
- package/dist/banner/foundation.js +4 -4
- package/dist/base/auto-close-foundation.d.ts +8 -9
- package/dist/base/auto-close-foundation.js +15 -15
- package/dist/base/foundation.d.ts +4 -4
- package/dist/base/foundation.js +12 -11
- package/dist/base/list-store.d.ts +0 -1
- 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.d.ts +0 -10
- package/dist/calendar/event-util.js +1 -11
- package/dist/calendar/foundation.d.ts +1 -6
- package/dist/calendar/foundation.js +5 -9
- package/dist/calendar/month-foundation.d.ts +2 -3
- package/dist/calendar/month-foundation.js +6 -7
- package/dist/carousel/foundation.d.ts +17 -19
- package/dist/carousel/foundation.js +51 -51
- package/dist/cascader/foundation.d.ts +36 -32
- package/dist/cascader/foundation.js +145 -132
- package/dist/cascader/util.d.ts +1 -8
- package/dist/cascader/util.js +1 -8
- package/dist/checkbox/checkbox-foundation.d.ts +3 -7
- package/dist/checkbox/checkbox-foundation.js +15 -17
- package/dist/checkbox/checkbox-group-foundation.d.ts +2 -3
- package/dist/checkbox/checkbox-group-foundation.js +8 -8
- package/dist/code-highlight/index.d.ts +1 -2
- 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-picker.scss +0 -2
- 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/color-picker/interface.d.ts +0 -1
- package/dist/config-provider/breakpoint-observer.d.ts +3 -3
- package/dist/config-provider/breakpoint-observer.js +6 -6
- package/dist/config-provider/responsive-types.d.ts +0 -16
- package/dist/cropper/foundation.d.ts +15 -16
- package/dist/cropper/foundation.js +26 -24
- package/dist/date-picker/_utils/get-default-picker-date.d.ts +0 -3
- package/dist/date-picker/_utils/get-default-picker-date.js +0 -3
- package/dist/date-picker/_utils/get-inset-input-format-token.d.ts +0 -2
- package/dist/date-picker/_utils/get-inset-input-format-token.js +0 -2
- package/dist/date-picker/_utils/get-inset-input-value-from-inset-input-str.d.ts +0 -2
- package/dist/date-picker/_utils/get-inset-input-value-from-inset-input-str.js +0 -2
- package/dist/date-picker/_utils/parser.d.ts +0 -3
- package/dist/date-picker/_utils/parser.js +0 -7
- package/dist/date-picker/_utils/picker-type.d.ts +1 -3
- package/dist/date-picker/_utils/picker-type.js +0 -2
- package/dist/date-picker/_utils/to-callback-args.d.ts +0 -1
- package/dist/date-picker/_utils/to-callback-args.js +0 -1
- package/dist/date-picker/date-picker.scss +0 -3
- package/dist/date-picker/foundation.d.ts +39 -58
- package/dist/date-picker/foundation.js +126 -153
- package/dist/date-picker/input-foundation.d.ts +10 -16
- package/dist/date-picker/input-foundation.js +28 -30
- package/dist/date-picker/month-foundation.d.ts +0 -3
- package/dist/date-picker/month-foundation.js +0 -2
- package/dist/date-picker/months-grid-foundation.d.ts +17 -26
- package/dist/date-picker/months-grid-foundation.js +65 -75
- 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 -3
- package/dist/drag-move/foundation.js +15 -13
- package/dist/dropdown/foundation.d.ts +8 -7
- package/dist/dropdown/foundation.js +32 -28
- package/dist/dropdown/menu-foundation.d.ts +1 -2
- package/dist/dropdown/menu-foundation.js +11 -11
- package/dist/feedback/foundation.d.ts +9 -10
- package/dist/feedback/foundation.js +33 -33
- package/dist/feedback/variables.scss +1 -5
- package/dist/float-button/float-button.css +0 -1
- package/dist/float-button/float-button.scss +0 -2
- package/dist/form/form-api-proxy.d.ts +8 -7
- package/dist/form/form-api-proxy.js +25 -25
- package/dist/form/form.scss +0 -12
- package/dist/form/foundation.d.ts +5 -5
- package/dist/form/foundation.js +60 -76
- package/dist/form/interface.d.ts +2 -15
- package/dist/form/utils.d.ts +0 -8
- package/dist/form/utils.js +0 -7
- package/dist/form/variables.scss +1 -4
- package/dist/grid/variables.scss +0 -10
- package/dist/highlight/foundation.d.ts +0 -2
- package/dist/highlight/foundation.js +1 -3
- package/dist/hot-keys/foundation.d.ts +2 -3
- package/dist/hot-keys/foundation.js +5 -5
- package/dist/image/image-foundation.d.ts +4 -6
- package/dist/image/image-foundation.js +10 -10
- package/dist/image/preview-footer-foundation.d.ts +3 -4
- package/dist/image/preview-footer-foundation.js +10 -10
- package/dist/image/preview-foundation.d.ts +0 -3
- package/dist/image/preview-foundation.js +7 -6
- package/dist/image/preview-image-foundation.d.ts +6 -9
- package/dist/image/preview-image-foundation.js +14 -14
- package/dist/image/preview-inner-foundation.d.ts +9 -10
- package/dist/image/preview-inner-foundation.js +38 -38
- package/dist/input/foundation.d.ts +10 -11
- package/dist/input/foundation.js +47 -49
- package/dist/input/text-entry-foundation.d.ts +3 -5
- package/dist/input/text-entry-foundation.js +14 -15
- package/dist/input/textarea-foundation.d.ts +7 -8
- package/dist/input/textarea-foundation.js +36 -36
- package/dist/input-number/caret.d.ts +0 -1
- package/dist/input-number/caret.js +0 -1
- package/dist/input-number/foundation.d.ts +16 -19
- package/dist/input-number/foundation.js +54 -58
- package/dist/json-viewer/foundation.d.ts +8 -10
- package/dist/json-viewer/foundation.js +23 -24
- package/dist/locale/interface.d.ts +0 -3
- package/dist/lottie/foundation.d.ts +1 -1
- package/dist/lottie/foundation.js +4 -4
- package/dist/markdown-render/foundation.d.ts +2 -7
- package/dist/markdown-render/foundation.js +5 -9
- 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 -8
- package/dist/navigation/foundation.js +14 -20
- 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 -4
- package/dist/navigation/sub-nav-foundation.js +17 -17
- package/dist/notification/notification-list-foundation.d.ts +7 -8
- package/dist/notification/notification-list-foundation.js +12 -13
- package/dist/notification/variables.scss +0 -1
- package/dist/overflow-list/foundation.d.ts +4 -6
- package/dist/overflow-list/foundation.js +18 -19
- package/dist/pagination/foundation.d.ts +8 -10
- package/dist/pagination/foundation.js +28 -28
- package/dist/pincode/foundation.d.ts +6 -9
- package/dist/pincode/foundation.js +23 -26
- package/dist/popconfirm/popconfirm-foundation.d.ts +7 -9
- package/dist/popconfirm/popconfirm-foundation.js +26 -26
- package/dist/progress/generates.d.ts +1 -4
- package/dist/progress/generates.js +1 -4
- package/dist/progress/utils.d.ts +1 -1
- package/dist/progress/utils.js +1 -1
- package/dist/radio/radio-foundation.d.ts +5 -9
- package/dist/radio/radio-foundation.js +15 -16
- package/dist/radio/radio-group-foundation.d.ts +2 -3
- package/dist/radio/radio-group-foundation.js +9 -9
- package/dist/rating/foundation.d.ts +10 -15
- package/dist/rating/foundation.js +35 -38
- package/dist/resizable/group/index.d.ts +6 -10
- package/dist/resizable/group/index.js +40 -44
- package/dist/resizable/resizable.scss +0 -1
- package/dist/resizable/single/index.d.ts +3 -7
- package/dist/resizable/single/index.js +10 -13
- package/dist/scroll-list/item-foundation.d.ts +7 -9
- package/dist/scroll-list/item-foundation.js +35 -36
- package/dist/scroll-list/variables.scss +1 -6
- package/dist/select/foundation.d.ts +42 -57
- package/dist/select/foundation.js +214 -279
- package/dist/select/option-foundation.d.ts +23 -28
- package/dist/select/option-foundation.js +10 -19
- package/dist/select/variables.scss +1 -8
- package/dist/side-sheet/side-sheet-foundation.d.ts +7 -12
- package/dist/side-sheet/side-sheet-foundation.js +23 -27
- package/dist/side-sheet/variables.scss +1 -3
- package/dist/slider/foundation.d.ts +17 -28
- package/dist/slider/foundation.js +47 -59
- package/dist/slider/variables.scss +1 -5
- package/dist/sortable/accessibility.d.ts +1 -1
- package/dist/sortable/accessibility.js +2 -2
- package/dist/spin/foundation.d.ts +2 -4
- package/dist/spin/foundation.js +6 -7
- package/dist/spin/variables.scss +1 -3
- package/dist/steps/utils.d.ts +1 -1
- package/dist/switch/foundation.d.ts +2 -3
- package/dist/switch/foundation.js +7 -7
- package/dist/switch/switch.scss +1 -1
- package/dist/switch/variables.scss +1 -5
- package/dist/table/foundation.d.ts +24 -33
- package/dist/table/foundation.js +144 -108
- package/dist/table/table.scss +0 -1
- package/dist/table/utils.d.ts +2 -10
- package/dist/table/utils.js +0 -13
- package/dist/table/variables.scss +1 -5
- package/dist/tabs/foundation.d.ts +5 -14
- package/dist/tabs/foundation.js +17 -21
- package/dist/tabs/tabs.scss +1 -1
- package/dist/tag/focus.js +0 -1
- package/dist/tag-input/foundation.d.ts +11 -13
- package/dist/tag-input/foundation.js +52 -53
- package/dist/tag-input/tag-input.scss +0 -1
- package/dist/tag-input/utils/tag-focus.d.ts +0 -1
- package/dist/tag-input/utils/tag-focus.js +0 -1
- package/dist/time-picker/combox-foundation.d.ts +3 -11
- package/dist/time-picker/combox-foundation.js +3 -10
- package/dist/time-picker/foundation.d.ts +13 -23
- package/dist/time-picker/foundation.js +39 -48
- package/dist/time-picker/input-foundation.d.ts +4 -4
- package/dist/time-picker/input-foundation.js +13 -13
- package/dist/time-picker/utils/index.d.ts +0 -11
- package/dist/time-picker/utils/index.js +0 -11
- package/dist/toast/toast-list-foundation.d.ts +7 -7
- package/dist/toast/toast-list-foundation.js +14 -14
- package/dist/tooltip/adjust-position.d.ts +1 -2
- package/dist/tooltip/constants.d.ts +0 -3
- package/dist/tooltip/constants.js +0 -3
- package/dist/tooltip/foundation.d.ts +9 -12
- package/dist/tooltip/foundation.js +67 -63
- package/dist/tooltip/position.scss +0 -1
- package/dist/transfer/foundation.d.ts +22 -13
- package/dist/transfer/foundation.js +38 -24
- package/dist/tree/foundation.d.ts +14 -16
- package/dist/tree/foundation.js +61 -62
- package/dist/tree/shared.d.ts +2 -4
- package/dist/tree/shared.js +0 -2
- package/dist/tree/tree-util.d.ts +0 -5
- package/dist/tree/tree-util.js +0 -5
- package/dist/tree-select/foundation.d.ts +26 -22
- package/dist/tree-select/foundation.js +91 -86
- package/dist/typography/ellipsis.d.ts +5 -7
- package/dist/typography/ellipsis.js +8 -10
- package/dist/typography/format-numeral.d.ts +1 -1
- package/dist/typography/format-numeral.js +2 -2
- package/dist/typography/typography.scss +0 -1
- package/dist/upload/constants.d.ts +1 -1
- package/dist/upload/foundation.d.ts +17 -23
- package/dist/upload/foundation.js +93 -103
- package/dist/upload/utils.d.ts +3 -8
- package/dist/upload/utils.js +6 -11
- package/dist/user-guide/foundation.d.ts +3 -5
- package/dist/user-guide/foundation.js +19 -19
- package/dist/utils/a11y.d.ts +2 -6
- package/dist/utils/a11y.js +1 -4
- package/dist/utils/announcer.d.ts +2 -2
- package/dist/utils/announcer.js +4 -4
- package/dist/utils/array.d.ts +0 -6
- package/dist/utils/array.js +0 -6
- package/dist/utils/date-fns-extra.js +1 -5
- package/dist/utils/dom.d.ts +0 -1
- package/dist/utils/dom.js +0 -1
- package/dist/utils/escape-html.js +0 -3
- package/dist/utils/field-sizing.d.ts +0 -2
- package/dist/utils/field-sizing.js +0 -2
- package/dist/utils/focus-handle.d.ts +1 -2
- package/dist/utils/focus-handle.js +1 -3
- package/dist/utils/focus-scope.d.ts +5 -6
- package/dist/utils/focus-scope.js +10 -11
- 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/utils/scroll-lock.d.ts +3 -4
- package/dist/utils/scroll-lock.js +3 -4
- package/dist/utils/tween.d.ts +0 -1
- package/dist/utils/tween.js +0 -1
- package/dist/utils/uuid.d.ts +0 -1
- package/dist/utils/uuid.js +0 -1
- package/dist/utils/warning.d.ts +0 -1
- package/dist/utils/warning.js +0 -1
- 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 -3
- package/dist/video-player/progress-foundation.js +12 -13
- package/dist/video-player/variables.scss +1 -1
- package/package.json +2 -2
|
@@ -17,7 +17,6 @@ export interface TimePickerAdapter<P extends TimePickerBaseProps = TimePickerBas
|
|
|
17
17
|
/** focuses the input, or the focus target of a custom trigger */
|
|
18
18
|
setTriggerFocus: () => void;
|
|
19
19
|
}
|
|
20
|
-
/** The props the foundation reads with getProp */
|
|
21
20
|
export interface TimePickerBaseProps {
|
|
22
21
|
dateFnsLocale?: Locale;
|
|
23
22
|
disabled?: boolean;
|
|
@@ -53,10 +52,6 @@ export default class TimePickerFoundation<P extends TimePickerBaseProps = TimePi
|
|
|
53
52
|
protected validateDates(dates?: Array<Date>): boolean;
|
|
54
53
|
protected formatValue(dates: Date[]): string;
|
|
55
54
|
protected parseInput(str: string): Date[];
|
|
56
|
-
/**
|
|
57
|
-
* The format in use: the `format` prop when not `undefined`, else the 12- or 24-hour default; a value that is
|
|
58
|
-
* not a string falls back to the 24-hour default
|
|
59
|
-
*/
|
|
60
55
|
static getValidFormat(props: Record<string, any>): string;
|
|
61
56
|
/**
|
|
62
57
|
* The disabled-time callbacks of one panel, as the panel lists and validation both use them. `disabledTime` is
|
|
@@ -67,42 +62,37 @@ export default class TimePickerFoundation<P extends TimePickerBaseProps = TimePi
|
|
|
67
62
|
static getPosition(props: Record<string, any>, direction?: string): Position;
|
|
68
63
|
/** A controlled `open` is not copied into state, so the shown panel comes from props when they carry it; a disabled picker shows none */
|
|
69
64
|
static isPanelShown(props: Record<string, any>, state: Record<string, any>): boolean;
|
|
70
|
-
/** The value and input text of the first render, from `value` or else `defaultValue` */
|
|
71
65
|
static getInitialState(props: Record<string, any>): {
|
|
72
66
|
value: Date[];
|
|
73
67
|
inputValue: string;
|
|
74
68
|
invalid: boolean;
|
|
75
69
|
};
|
|
76
|
-
handlePanelChange(result: {
|
|
70
|
+
handlePanelChange: (result: {
|
|
77
71
|
timeStampValue: number;
|
|
78
|
-
}, index?: number)
|
|
79
|
-
|
|
80
|
-
* Derives the value, input text and validity state from a `value` prop. With `prevTimeZone`, `value` is the
|
|
81
|
-
* shown value in that zone and is re-zoned into `timeZone`.
|
|
82
|
-
*/
|
|
83
|
-
syncValueFromProps({ value, timeZone, prevTimeZone }: {
|
|
72
|
+
}, index?: number) => void;
|
|
73
|
+
syncValueFromProps: ({ value, timeZone, prevTimeZone }: {
|
|
84
74
|
value: TimeValue | (TimeValue | undefined)[];
|
|
85
75
|
timeZone?: string | number;
|
|
86
76
|
prevTimeZone?: string | number;
|
|
87
|
-
})
|
|
88
|
-
handleFocus(e: E)
|
|
77
|
+
}) => void;
|
|
78
|
+
handleFocus: (e: E) => void;
|
|
89
79
|
/** 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()
|
|
80
|
+
handleTriggerKeyDown: (e: Pick<KeyboardEvent, "key" | "preventDefault">) => void;
|
|
81
|
+
refreshInputValue: () => void;
|
|
92
82
|
/**
|
|
93
83
|
* Closes the panel and reports openChange(false), without blur and without moving focus, e.g. for a picker that
|
|
94
84
|
* leaves the page while open (Vue KeepAlive)
|
|
95
85
|
*/
|
|
96
|
-
close()
|
|
86
|
+
close: () => void;
|
|
97
87
|
/**
|
|
98
88
|
* The panel is a custom-trigger popup, so the Popover leaves Esc to the picker. Keyboard focus in a list returns
|
|
99
89
|
* to the input first: the input opens the panel on focus, which must not happen once the panel is closed. The
|
|
100
90
|
* focus stays in the picker, so this is no blur.
|
|
101
91
|
*/
|
|
102
|
-
handleEscKeyDown()
|
|
103
|
-
handlePanelOpen()
|
|
92
|
+
handleEscKeyDown: () => void;
|
|
93
|
+
handlePanelOpen: () => void;
|
|
104
94
|
/** 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()
|
|
95
|
+
handleClickOutside: (e: MouseEvent) => void;
|
|
96
|
+
handleInputChange: (input: string) => void;
|
|
97
|
+
handleInputBlur: () => void;
|
|
108
98
|
}
|
|
@@ -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({
|
|
@@ -101,10 +101,6 @@ var TimePickerFoundation = class TimePickerFoundation extends BaseFoundation {
|
|
|
101
101
|
if (str && typeof str === "string") return str.split(rangeSeparator).map((v) => parseToDate(v, validFormat, dateFnsLocale));
|
|
102
102
|
return [];
|
|
103
103
|
}
|
|
104
|
-
/**
|
|
105
|
-
* The format in use: the `format` prop when not `undefined`, else the 12- or 24-hour default; a value that is
|
|
106
|
-
* not a string falls back to the 24-hour default
|
|
107
|
-
*/
|
|
108
104
|
static getValidFormat(props) {
|
|
109
105
|
let _format = props.format;
|
|
110
106
|
if (_format === void 0) _format = props.use12Hours ? strings.DEFAULT_FORMAT_A : strings.DEFAULT_FORMAT;
|
|
@@ -132,7 +128,6 @@ var TimePickerFoundation = class TimePickerFoundation extends BaseFoundation {
|
|
|
132
128
|
static isPanelShown(props, state) {
|
|
133
129
|
return (props.open !== void 0 ? Boolean(props.open) : Boolean(state.open)) && !props.disabled;
|
|
134
130
|
}
|
|
135
|
-
/** The value and input text of the first render, from `value` or else `defaultValue` */
|
|
136
131
|
static getInitialState(props) {
|
|
137
132
|
const value = props.value === void 0 ? props.defaultValue : props.value;
|
|
138
133
|
const dates = TimePickerFoundation.#parseDates(value, props, props.timeZone);
|
|
@@ -142,15 +137,15 @@ var TimePickerFoundation = class TimePickerFoundation extends BaseFoundation {
|
|
|
142
137
|
invalid: false
|
|
143
138
|
};
|
|
144
139
|
}
|
|
145
|
-
handlePanelChange(result, index = 0) {
|
|
140
|
+
handlePanelChange = (result, index = 0) => {
|
|
146
141
|
const formatToken = this.getValidFormat();
|
|
147
142
|
const dateFnsLocale = this.getProp("dateFnsLocale");
|
|
148
143
|
const oldValue = this.getState("value");
|
|
149
|
-
const value = this.
|
|
144
|
+
const value = this.adapter.isRangePicker() ? [oldValue[0], oldValue[1]] : transformToArray(oldValue);
|
|
150
145
|
if (result) {
|
|
151
146
|
value[index] = parseToDate(result.timeStampValue, formatToken, dateFnsLocale);
|
|
152
147
|
const inputValue = this.formatValue(value);
|
|
153
|
-
if (!this.
|
|
148
|
+
if (!this.isControlledComponent("value")) {
|
|
154
149
|
const invalid = this.validateDates(value);
|
|
155
150
|
this.setState({
|
|
156
151
|
value,
|
|
@@ -160,67 +155,63 @@ var TimePickerFoundation = class TimePickerFoundation extends BaseFoundation {
|
|
|
160
155
|
}
|
|
161
156
|
if (this.#hasChanged(value, oldValue)) this.#notifyChange(value, inputValue);
|
|
162
157
|
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
* Derives the value, input text and validity state from a `value` prop. With `prevTimeZone`, `value` is the
|
|
166
|
-
* shown value in that zone and is re-zoned into `timeZone`.
|
|
167
|
-
*/
|
|
168
|
-
syncValueFromProps({ value, timeZone, prevTimeZone }) {
|
|
158
|
+
};
|
|
159
|
+
syncValueFromProps = ({ value, timeZone, prevTimeZone }) => {
|
|
169
160
|
const dates = TimePickerFoundation.#parseDates(value, this.getProps(), timeZone, prevTimeZone);
|
|
170
161
|
this.setState({
|
|
171
162
|
value: dates,
|
|
172
163
|
invalid: this.validateDates(dates),
|
|
173
164
|
inputValue: this.formatValue(dates)
|
|
174
165
|
});
|
|
175
|
-
}
|
|
176
|
-
handleFocus(e) {
|
|
166
|
+
};
|
|
167
|
+
handleFocus = (e) => {
|
|
177
168
|
this.handlePanelOpen();
|
|
178
|
-
this.
|
|
179
|
-
}
|
|
169
|
+
this.adapter.notifyFocus(e);
|
|
170
|
+
};
|
|
180
171
|
/** A custom trigger without a focus target of its own is a button: Enter, Space and Down Arrow open the panel */
|
|
181
|
-
handleTriggerKeyDown(e) {
|
|
172
|
+
handleTriggerKeyDown = (e) => {
|
|
182
173
|
if (e.key === "Enter" || e.key === " " || e.key === "ArrowDown") {
|
|
183
174
|
e.preventDefault();
|
|
184
175
|
this.handlePanelOpen();
|
|
185
176
|
}
|
|
186
|
-
}
|
|
187
|
-
refreshInputValue() {
|
|
177
|
+
};
|
|
178
|
+
refreshInputValue = () => {
|
|
188
179
|
this.setState({ inputValue: this.formatValue(this.getState("value")) });
|
|
189
|
-
}
|
|
180
|
+
};
|
|
190
181
|
/**
|
|
191
182
|
* Closes the panel and reports openChange(false), without blur and without moving focus, e.g. for a picker that
|
|
192
183
|
* leaves the page while open (Vue KeepAlive)
|
|
193
184
|
*/
|
|
194
|
-
close() {
|
|
195
|
-
if (!this.
|
|
196
|
-
this.
|
|
197
|
-
}
|
|
185
|
+
close = () => {
|
|
186
|
+
if (!this.isControlledComponent("open")) this.adapter.setPanelOpen(false);
|
|
187
|
+
this.adapter.notifyOpenChange(false);
|
|
188
|
+
};
|
|
198
189
|
/**
|
|
199
190
|
* The panel is a custom-trigger popup, so the Popover leaves Esc to the picker. Keyboard focus in a list returns
|
|
200
191
|
* to the input first: the input opens the panel on focus, which must not happen once the panel is closed. The
|
|
201
192
|
* focus stays in the picker, so this is no blur.
|
|
202
193
|
*/
|
|
203
|
-
handleEscKeyDown() {
|
|
204
|
-
if (this.
|
|
194
|
+
handleEscKeyDown = () => {
|
|
195
|
+
if (this.adapter.isKeyboardFocusInPanel()) this.adapter.setTriggerFocus();
|
|
205
196
|
this.close();
|
|
206
|
-
}
|
|
207
|
-
handlePanelOpen() {
|
|
197
|
+
};
|
|
198
|
+
handlePanelOpen = () => {
|
|
208
199
|
if (this.getProp("disabled") || TimePickerFoundation.isPanelShown(this.getProps(), this.getStates())) return;
|
|
209
|
-
if (!this.
|
|
210
|
-
this.
|
|
211
|
-
}
|
|
200
|
+
if (!this.isControlledComponent("open")) this.adapter.setPanelOpen(true);
|
|
201
|
+
this.adapter.notifyOpenChange(true);
|
|
202
|
+
};
|
|
212
203
|
/** Called for a mousedown outside the trigger and the panel while the panel is shown */
|
|
213
|
-
handleClickOutside(e) {
|
|
204
|
+
handleClickOutside = (e) => {
|
|
214
205
|
this.close();
|
|
215
|
-
this.
|
|
216
|
-
}
|
|
217
|
-
handleInputChange(input) {
|
|
218
|
-
this.
|
|
206
|
+
this.adapter.notifyBlur(e);
|
|
207
|
+
};
|
|
208
|
+
handleInputChange = (input) => {
|
|
209
|
+
this.adapter.setInputValue(input);
|
|
219
210
|
const rangeSeparator = this.getProp("rangeSeparator");
|
|
220
211
|
const inputValues = (input ?? "").split(rangeSeparator);
|
|
221
212
|
const formatToken = this.getValidFormat();
|
|
222
213
|
if (input !== "" && inputValues.some((time) => !isTimeFormatLike(time, formatToken))) return;
|
|
223
|
-
const isRange = this.
|
|
214
|
+
const isRange = this.adapter.isRangePicker();
|
|
224
215
|
if (isRange && inputValues.length > 2) {
|
|
225
216
|
this.setState({ invalid: true });
|
|
226
217
|
return;
|
|
@@ -230,17 +221,17 @@ var TimePickerFoundation = class TimePickerFoundation extends BaseFoundation {
|
|
|
230
221
|
const invalid = this.validateDates(dates);
|
|
231
222
|
const oldValue = this.getState("value");
|
|
232
223
|
const value = invalid ? transformToArray(oldValue) : [...dates];
|
|
233
|
-
if (this.
|
|
224
|
+
if (this.isControlledComponent("value") || invalid) this.setState({ invalid });
|
|
234
225
|
else this.setState({
|
|
235
226
|
invalid,
|
|
236
227
|
value: dates
|
|
237
228
|
});
|
|
238
229
|
if (this.#hasChanged(value, oldValue)) this.#notifyChange(value, input);
|
|
239
|
-
}
|
|
240
|
-
handleInputBlur() {
|
|
230
|
+
};
|
|
231
|
+
handleInputBlur = () => {
|
|
241
232
|
const inputValue = this.getState("inputValue");
|
|
242
233
|
const value = this.getState("value");
|
|
243
|
-
if (inputValue || this.
|
|
234
|
+
if (inputValue || this.isControlledComponent("value")) this.setState({
|
|
244
235
|
inputValue: this.formatValue(value),
|
|
245
236
|
invalid: false
|
|
246
237
|
});
|
|
@@ -249,6 +240,6 @@ var TimePickerFoundation = class TimePickerFoundation extends BaseFoundation {
|
|
|
249
240
|
value: [],
|
|
250
241
|
invalid: false
|
|
251
242
|
});
|
|
252
|
-
}
|
|
243
|
+
};
|
|
253
244
|
};
|
|
254
245
|
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 };
|
|
@@ -4,15 +4,4 @@ export declare function hourIsDisabled(disabledHours: () => number[], hour: numb
|
|
|
4
4
|
export declare function minuteIsDisabled(disabledMinutes: (hour: number) => number[], hour: number, minute: number): boolean;
|
|
5
5
|
export declare function secondIsDisabled(disabledSeconds: (hour: number, minute: number) => number[], hour: number, minute: number, second: number): boolean;
|
|
6
6
|
export declare function transformToArray<T>(value: T[]): T[];
|
|
7
|
-
/**
|
|
8
|
-
* Determine whether the time length is the same as the format
|
|
9
|
-
* e.g.
|
|
10
|
-
* format | time | return
|
|
11
|
-
* HH:mm | 12:00 | true
|
|
12
|
-
* HH:mm:ss | 12:00:00 | true
|
|
13
|
-
* yyyy HH:mm | 2021 12:00| true
|
|
14
|
-
* HH | 1 | false
|
|
15
|
-
* HH:mm | 12:0 | false
|
|
16
|
-
* HH:mm:ss | 12:00:0 | false
|
|
17
|
-
*/
|
|
18
7
|
export declare function isTimeFormatLike(time: string, formatToken: string): boolean;
|
|
@@ -32,17 +32,6 @@ function secondIsDisabled(disabledSeconds, hour, minute, second) {
|
|
|
32
32
|
function transformToArray(value) {
|
|
33
33
|
return Array.isArray(value) ? [...value] : [];
|
|
34
34
|
}
|
|
35
|
-
/**
|
|
36
|
-
* Determine whether the time length is the same as the format
|
|
37
|
-
* e.g.
|
|
38
|
-
* format | time | return
|
|
39
|
-
* HH:mm | 12:00 | true
|
|
40
|
-
* HH:mm:ss | 12:00:00 | true
|
|
41
|
-
* yyyy HH:mm | 2021 12:00| true
|
|
42
|
-
* HH | 1 | false
|
|
43
|
-
* HH:mm | 12:0 | false
|
|
44
|
-
* HH:mm:ss | 12:00:0 | false
|
|
45
|
-
*/
|
|
46
35
|
function isTimeFormatLike(time, formatToken) {
|
|
47
36
|
let isLike = true;
|
|
48
37
|
const dateFnsSupportFormatCh = "BDEGHKLMOPQRSTXYabcehimopqstuwxyz";
|
|
@@ -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 };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Only rects and numbers go in (no DOM, window or class instance), so it can be table-tested.
|
|
3
3
|
*/
|
|
4
4
|
export interface AdjustRect {
|
|
5
5
|
left: number;
|
|
@@ -21,7 +21,6 @@ export interface AdjustPositionInput {
|
|
|
21
21
|
triggerRect: AdjustRect;
|
|
22
22
|
/** popup size, nothing is adjusted when width or height is 0 */
|
|
23
23
|
wrapperRect: Pick<AdjustRect, 'width' | 'height'>;
|
|
24
|
-
/** rect of the popup container */
|
|
25
24
|
containerRect: Pick<AdjustRect, 'left' | 'right' | 'top' | 'bottom'>;
|
|
26
25
|
viewport: {
|
|
27
26
|
width: number;
|
|
@@ -8,7 +8,6 @@ export declare const strings: {
|
|
|
8
8
|
readonly STATUS_LOADING: "loading";
|
|
9
9
|
readonly LEAVE_DELAY_WARNING: "[Semi Tooltip] 'mouseLeaveDelay' cannot be less than 'mouseEnterDelay', which may cause the dropdown layer to not be hidden.";
|
|
10
10
|
};
|
|
11
|
-
/** The DOM event names the trigger and popup listeners bind to */
|
|
12
11
|
export declare const TRIGGER_EVENT_NAMES: {
|
|
13
12
|
readonly mouseEnter: "mouseenter";
|
|
14
13
|
readonly mouseLeave: "mouseleave";
|
|
@@ -21,7 +20,6 @@ export declare const TRIGGER_EVENT_NAMES: {
|
|
|
21
20
|
readonly contextMenu: "contextmenu";
|
|
22
21
|
};
|
|
23
22
|
export declare const canRoleCarryPopupState: (role: string) => boolean;
|
|
24
|
-
/** Whether a wrapper around a trigger with this `display` must fill the width */
|
|
25
23
|
export declare const isBlockDisplay: (display?: string) => boolean;
|
|
26
24
|
/**
|
|
27
25
|
* Whether a disabled or loading trigger gets a wrapper span that takes the pointer events: a loading Button
|
|
@@ -30,7 +28,6 @@ export declare const isBlockDisplay: (display?: string) => boolean;
|
|
|
30
28
|
export declare const wrapsSpecialTrigger: (trigger: string | undefined, loading: boolean) => boolean;
|
|
31
29
|
/** The forced light and dark areas; the popup leaves the trigger's subtree, so it copies the innermost one around it */
|
|
32
30
|
export declare const COLOR_SCHEME_SELECTOR = ".semi-always-dark, .semi-always-light";
|
|
33
|
-
/** The class that keeps a popup in the scheme of `area`, the innermost COLOR_SCHEME_SELECTOR element around the trigger */
|
|
34
31
|
export declare const colorSchemeOf: (area?: Element | null) => "semi-always-dark" | "semi-always-light";
|
|
35
32
|
/**
|
|
36
33
|
* Where a popup opened from a trigger in `root` is inserted: the shadow root, else body, so forms, labels and inherited
|
|
@@ -31,7 +31,6 @@ const strings = {
|
|
|
31
31
|
STATUS_LOADING: "loading",
|
|
32
32
|
LEAVE_DELAY_WARNING: "[Semi Tooltip] 'mouseLeaveDelay' cannot be less than 'mouseEnterDelay', which may cause the dropdown layer to not be hidden."
|
|
33
33
|
};
|
|
34
|
-
/** The DOM event names the trigger and popup listeners bind to */
|
|
35
34
|
const TRIGGER_EVENT_NAMES = {
|
|
36
35
|
mouseEnter: "mouseenter",
|
|
37
36
|
mouseLeave: "mouseleave",
|
|
@@ -60,7 +59,6 @@ const BLOCK_DISPLAYS = /* @__PURE__ */ new Set([
|
|
|
60
59
|
"grid"
|
|
61
60
|
]);
|
|
62
61
|
const canRoleCarryPopupState = (role) => POPUP_TRIGGER_ROLES.has(role);
|
|
63
|
-
/** Whether a wrapper around a trigger with this `display` must fill the width */
|
|
64
62
|
const isBlockDisplay = (display) => BLOCK_DISPLAYS.has(display);
|
|
65
63
|
/**
|
|
66
64
|
* Whether a disabled or loading trigger gets a wrapper span that takes the pointer events: a loading Button
|
|
@@ -71,7 +69,6 @@ const alwaysDark = `${BASE_CLASS_PREFIX}-always-dark`;
|
|
|
71
69
|
const alwaysLight = `${BASE_CLASS_PREFIX}-always-light`;
|
|
72
70
|
/** The forced light and dark areas; the popup leaves the trigger's subtree, so it copies the innermost one around it */
|
|
73
71
|
const COLOR_SCHEME_SELECTOR = `.${alwaysDark}, .${alwaysLight}`;
|
|
74
|
-
/** The class that keeps a popup in the scheme of `area`, the innermost COLOR_SCHEME_SELECTOR element around the trigger */
|
|
75
72
|
const colorSchemeOf = (area) => area ? area.classList.contains(alwaysDark) ? alwaysDark : alwaysLight : void 0;
|
|
76
73
|
/**
|
|
77
74
|
* Where a popup opened from a trigger in `root` is inserted: the shadow root, else body, so forms, labels and inherited
|
|
@@ -32,12 +32,10 @@ export interface TooltipAdapter<P extends TooltipBaseProps = TooltipBaseProps, S
|
|
|
32
32
|
getTriggerRect(): DOMRect | null;
|
|
33
33
|
/** The element getTriggerRect measures; null while unknown, and then every scroll repositions the popup */
|
|
34
34
|
getTriggerElement(): Element | null;
|
|
35
|
-
/** Starts observing every trigger element with `observer` */
|
|
36
35
|
observeTrigger(observer: ResizeObserver | IntersectionObserver): void;
|
|
37
36
|
unobserveTrigger(observer: ResizeObserver | IntersectionObserver): void;
|
|
38
37
|
}
|
|
39
38
|
export type Position = ArrayElement<typeof strings.POSITION_SET>;
|
|
40
|
-
/** The props the foundation reads with getProp */
|
|
41
39
|
export interface TooltipBaseProps {
|
|
42
40
|
arrowPointAtCenter?: boolean;
|
|
43
41
|
autoAdjustOverflow?: boolean;
|
|
@@ -62,7 +60,6 @@ export interface TooltipBaseProps {
|
|
|
62
60
|
trigger?: ArrayElement<typeof strings.TRIGGER_SET>;
|
|
63
61
|
visible?: boolean;
|
|
64
62
|
}
|
|
65
|
-
/** The state the foundation reads with getState */
|
|
66
63
|
export interface TooltipBaseState {
|
|
67
64
|
isInsert: boolean;
|
|
68
65
|
transitionState: 'enter' | 'leave' | '';
|
|
@@ -75,20 +72,20 @@ export default class Tooltip<P extends TooltipBaseProps = TooltipBaseProps, S ex
|
|
|
75
72
|
init(): void;
|
|
76
73
|
destroy(): void;
|
|
77
74
|
/** Regenerates the trigger and popup handlers, which depend on `trigger` and `clickToHide` */
|
|
78
|
-
rebindEvents()
|
|
79
|
-
removePortal()
|
|
75
|
+
rebindEvents: () => void;
|
|
76
|
+
removePortal: () => void;
|
|
80
77
|
/** Hosts call this when the `visible` prop changes */
|
|
81
|
-
handleVisiblePropChange()
|
|
82
|
-
updateStateIfCursorOnTrigger()
|
|
78
|
+
handleVisiblePropChange: () => void;
|
|
79
|
+
updateStateIfCursorOnTrigger: () => void;
|
|
83
80
|
delayShow(): void;
|
|
84
81
|
show(): void;
|
|
85
82
|
/** Called once `showPopover()` has been issued for this opening (by the layout effect that reacts to the
|
|
86
83
|
* mount `insertPortal` requested); a hover popup can still back out here if the pointer already left. */
|
|
87
|
-
handleOpened()
|
|
84
|
+
handleOpened: () => void;
|
|
88
85
|
/** Hosts call this right after `showPopover()`: positions the popup and keeps it beside the trigger until it closes */
|
|
89
|
-
handleShown()
|
|
86
|
+
handleShown: () => void;
|
|
90
87
|
/** Positions an open popup beside its trigger at once, without waiting for a frame */
|
|
91
|
-
calcPosition()
|
|
88
|
+
calcPosition: () => void;
|
|
92
89
|
delayHide(): void;
|
|
93
90
|
hide: () => void;
|
|
94
91
|
/**
|
|
@@ -96,10 +93,10 @@ export default class Tooltip<P extends TooltipBaseProps = TooltipBaseProps, S ex
|
|
|
96
93
|
* focus is. Returns whether the popup took the key; one that does not leaves it to the layer below.
|
|
97
94
|
*/
|
|
98
95
|
handleEscape: (event: KeyboardEvent) => boolean;
|
|
99
|
-
handleContainerKeydown(event: Pick<KeyboardEvent,
|
|
96
|
+
handleContainerKeydown: (event: Pick<KeyboardEvent, "key" | "shiftKey" | "preventDefault">) => void;
|
|
100
97
|
/**
|
|
101
98
|
* Focus the trigger. A 'focus' or 'hover' trigger binds onFocus to show the popup, so focusing it
|
|
102
99
|
* reopens the popup; callers hide the popup right after.
|
|
103
100
|
*/
|
|
104
|
-
focusTrigger()
|
|
101
|
+
focusTrigger: () => void;
|
|
105
102
|
}
|