@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
@use 'semi:theme' as *;
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
$spacing-table-paddingY: $spacing-base; // 表格空数据占位及虚拟列表分组垂直内边距
|
|
4
4
|
$spacing-table-paddingX: $spacing-base-tight; // 表格空数据占位及虚拟列表分组水平内边距
|
|
5
5
|
$spacing-table_middle-paddingY: $spacing-base-tight; // 中尺寸表格单元格垂直内边距
|
|
@@ -26,11 +26,9 @@ $spacing-table_expand_icon-marginRight: 8px; // 行展开按钮右侧外边距
|
|
|
26
26
|
$spacing-table_panel_operation-paddingX: $spacing-base; // 表格操作栏水平内边距
|
|
27
27
|
$spacing-table_panel_operation-paddingY: $spacing-tight; // 表格操作栏垂直内边距
|
|
28
28
|
|
|
29
|
-
// Size
|
|
30
29
|
$width-table_base_border: 1px; // 表格单元格分割线宽度
|
|
31
30
|
$width-table_header_border: 1px; // 表格表头分割线宽度
|
|
32
31
|
$width-table_resizer_border: 2px; // 表格拉伸列标示线宽度
|
|
33
|
-
// $radius-table_base: 4px;
|
|
34
32
|
$width-table_column_selection: 48px; // 表格选择列及展开列宽度
|
|
35
33
|
$width-table_column_sorter-icon: 16px; // 表格排序按钮宽度
|
|
36
34
|
$height-table_column_sorter-icon: 16px; // 表格排序按钮高度
|
|
@@ -42,7 +40,6 @@ $width-table_react_resizable_handle: 9px; // 表格伸缩列调节热区宽度
|
|
|
42
40
|
$height-table_pagination_outer_min: 60px; // 表格分页器高度
|
|
43
41
|
$height-table_column_filter_dropdown: 290px; // 表格过滤筛选列表最大高度
|
|
44
42
|
|
|
45
|
-
// Color no need to change
|
|
46
43
|
$color-table_panel-bg-default: var(--semi-color-primary); // 操作区域样式默认背景颜色
|
|
47
44
|
$color-table_panel-text-default: var(--semi-color-primary-light-active); // 表格操作栏选中项文本颜色
|
|
48
45
|
$color-table-bg-default: var(--semi-color-bg-1); // 表格固定列及吸顶表头背景颜色
|
|
@@ -77,7 +74,6 @@ $color-table_placeholder-text-default: var(--semi-color-text-2); // 表格空数
|
|
|
77
74
|
|
|
78
75
|
$color-table_cell-bg-hover: var(--semi-color-bg-0); // 让表格在 hover 时正确显示 $color-table_body-bg-hover 颜色,如无必要不要修改
|
|
79
76
|
|
|
80
|
-
// Other
|
|
81
77
|
$font-table_base-fontSize: 14px; // 表格默认文本字号
|
|
82
78
|
$border-table_base-borderStyle: solid; // 表格描边样式
|
|
83
79
|
$width-table_fixed_shadow: 6px; // 表格固定列滚动阴影宽度
|
|
@@ -11,13 +11,10 @@ export interface MotionView {
|
|
|
11
11
|
export type MotionViewInput = Pick<MotionView, 'activeKey' | 'propsActiveKey' | 'paneKeys'>;
|
|
12
12
|
/** The members of a keyboard event the foundation reads; DOM and synthetic events both satisfy it */
|
|
13
13
|
export type TabKeyEvent = Pick<KeyboardEvent, 'key' | 'altKey' | 'ctrlKey' | 'metaKey' | 'target' | 'currentTarget' | 'preventDefault' | 'stopPropagation'>;
|
|
14
|
-
/** What a pane's slide-in depends on */
|
|
15
14
|
export interface PaneMotionInput {
|
|
16
|
-
itemKey
|
|
15
|
+
itemKey?: string;
|
|
17
16
|
activeKey: string | null;
|
|
18
|
-
/** The key selected before activeKey, null on mount */
|
|
19
17
|
prevActiveKey: string | null;
|
|
20
|
-
/** The itemKeys of the panes in order */
|
|
21
18
|
paneKeys: ReadonlyArray<string | undefined>;
|
|
22
19
|
tabPosition: 'top' | 'left';
|
|
23
20
|
tabPaneMotion: boolean;
|
|
@@ -35,20 +32,17 @@ interface TabEntry {
|
|
|
35
32
|
itemKey?: string;
|
|
36
33
|
disabled?: boolean;
|
|
37
34
|
}
|
|
38
|
-
/** The props the foundation reads */
|
|
39
35
|
export interface TabsBaseProps {
|
|
40
36
|
activeKey?: string | null;
|
|
41
37
|
tabPosition?: 'top' | 'left';
|
|
42
38
|
preventScroll?: boolean;
|
|
43
39
|
}
|
|
44
|
-
/** The state the foundation reads */
|
|
45
40
|
export interface TabsBaseState {
|
|
46
41
|
activeKey: string | null;
|
|
47
42
|
}
|
|
48
43
|
export default class TabsFoundation<P extends TabsBaseProps = TabsBaseProps, S extends TabsBaseState = TabsBaseState, E = unknown> extends BaseFoundation<TabsAdapter<P, S, E>, P, S> {
|
|
49
44
|
#private;
|
|
50
45
|
protected handleNewActiveKey(activeKey: string | null): void;
|
|
51
|
-
/** activeKey, else defaultActiveKey, else the first enabled entry of `list` that has a key */
|
|
52
46
|
static getDefaultActiveKey(props: {
|
|
53
47
|
activeKey?: string | null;
|
|
54
48
|
defaultActiveKey?: string;
|
|
@@ -58,14 +52,12 @@ export default class TabsFoundation<P extends TabsBaseProps = TabsBaseProps, S e
|
|
|
58
52
|
* null, matches no tab, or the tab sits in the more menu), the first enabled one takes it.
|
|
59
53
|
*/
|
|
60
54
|
static getTabbableKey(tabs: ReadonlyArray<TabEntry>, activeKey: string | null): string | undefined;
|
|
61
|
-
/** The slide-in class of a pane and whether it plays: only the selected pane slides, from the side of the previous one */
|
|
62
55
|
static getPaneMotion({ itemKey, activeKey, prevActiveKey, paneKeys, tabPosition, tabPaneMotion, forceDisableMotion }: PaneMotionInput): {
|
|
63
56
|
startClassName: string;
|
|
64
57
|
hasMotion: boolean;
|
|
65
58
|
};
|
|
66
59
|
/** The next MotionView; `prev` itself when nothing it records changed, so hosts can compare by reference */
|
|
67
60
|
static getMotionView(prev: MotionView | undefined, { activeKey, propsActiveKey, paneKeys }: MotionViewInput): MotionView;
|
|
68
|
-
/** Splits `list` into the tabs that stay in the bar and the last `more` ones (or `more.count`) that move into the menu */
|
|
69
61
|
static splitMore<T>(list: readonly T[], more: number | {
|
|
70
62
|
count: number;
|
|
71
63
|
}): {
|
|
@@ -76,16 +68,15 @@ export default class TabsFoundation<P extends TabsBaseProps = TabsBaseProps, S e
|
|
|
76
68
|
static isTabsOverflowing(barEl: HTMLElement, tabPosition?: 'top' | 'left'): boolean;
|
|
77
69
|
/** `barItemKey` is the data-scrollkey of the tab, see getBarItemKey */
|
|
78
70
|
static scrollTabIntoView(barEl: HTMLElement | null | undefined, barItemKey: string, position?: ScrollLogicalPosition, behavior?: ScrollBehavior): void;
|
|
79
|
-
/** Re-keys the OverflowList visibility map by itemKey; `hasHidden` and `isShowInViewport` summarize it */
|
|
80
71
|
static readVisibleState(visibleMap: ReadonlyMap<string, boolean>): {
|
|
81
72
|
visibleState: Map<string, boolean>;
|
|
82
73
|
isShowInViewport: boolean;
|
|
83
74
|
hasHidden: boolean;
|
|
84
75
|
};
|
|
85
|
-
handleTabClick(activeKey: string, event: E)
|
|
86
|
-
syncActiveKey(activeKey?: string | null)
|
|
87
|
-
handleTabPanesChange(panes: ReadonlyArray<TabEntry>)
|
|
88
|
-
handleTabDelete(tabKey: string)
|
|
76
|
+
handleTabClick: (activeKey: string, event: E) => void;
|
|
77
|
+
syncActiveKey: (activeKey?: string | null) => void;
|
|
78
|
+
handleTabPanesChange: (panes: ReadonlyArray<TabEntry>) => void;
|
|
79
|
+
handleTabDelete: (tabKey: string) => void;
|
|
89
80
|
handleKeyDown: (event: E & TabKeyEvent, itemKey: string, closable: boolean) => void;
|
|
90
81
|
}
|
|
91
82
|
export {};
|
package/dist/tabs/foundation.js
CHANGED
|
@@ -8,7 +8,7 @@ const OVERFLOW_LIST_SCROLL_WRAPPER = `${BASE_CLASS_PREFIX}-overflow-list-scroll-
|
|
|
8
8
|
var TabsFoundation = class TabsFoundation extends BaseFoundation {
|
|
9
9
|
#notifyChange(activeKey) {
|
|
10
10
|
const { activeKey: stateActiveKey } = this.getStates();
|
|
11
|
-
if (stateActiveKey !== activeKey) this.
|
|
11
|
+
if (stateActiveKey !== activeKey) this.adapter.notifyChange(activeKey);
|
|
12
12
|
}
|
|
13
13
|
#handlePrevent(event) {
|
|
14
14
|
event.stopPropagation();
|
|
@@ -37,7 +37,7 @@ var TabsFoundation = class TabsFoundation extends BaseFoundation {
|
|
|
37
37
|
}
|
|
38
38
|
#switchTabOnArrowPress(key, tab, allTabs) {
|
|
39
39
|
const { preventScroll } = this.getProps();
|
|
40
|
-
const rtl = this.
|
|
40
|
+
const rtl = this.adapter.getContext("direction") === "rtl";
|
|
41
41
|
const step = {
|
|
42
42
|
ArrowLeft: rtl ? 1 : -1,
|
|
43
43
|
ArrowUp: -1,
|
|
@@ -55,9 +55,8 @@ var TabsFoundation = class TabsFoundation extends BaseFoundation {
|
|
|
55
55
|
}
|
|
56
56
|
handleNewActiveKey(activeKey) {
|
|
57
57
|
const { activeKey: stateActiveKey } = this.getStates();
|
|
58
|
-
if (stateActiveKey !== activeKey) this.
|
|
58
|
+
if (stateActiveKey !== activeKey) this.adapter.setNewActiveKey(activeKey);
|
|
59
59
|
}
|
|
60
|
-
/** activeKey, else defaultActiveKey, else the first enabled entry of `list` that has a key */
|
|
61
60
|
static getDefaultActiveKey(props, list) {
|
|
62
61
|
if (props.activeKey !== void 0) return props.activeKey;
|
|
63
62
|
if (props.defaultActiveKey !== void 0) return props.defaultActiveKey;
|
|
@@ -71,7 +70,6 @@ var TabsFoundation = class TabsFoundation extends BaseFoundation {
|
|
|
71
70
|
if (tabs.some((tab) => tab.itemKey === activeKey)) return;
|
|
72
71
|
return tabs.find((tab) => !tab.disabled)?.itemKey;
|
|
73
72
|
}
|
|
74
|
-
/** The slide-in class of a pane and whether it plays: only the selected pane slides, from the side of the previous one */
|
|
75
73
|
static getPaneMotion({ itemKey, activeKey, prevActiveKey, paneKeys, tabPosition, tabPaneMotion, forceDisableMotion }) {
|
|
76
74
|
const activeIndex = activeKey === null ? -1 : paneKeys.indexOf(activeKey);
|
|
77
75
|
const itemIndex = itemKey === void 0 ? -1 : paneKeys.indexOf(itemKey);
|
|
@@ -100,7 +98,6 @@ var TabsFoundation = class TabsFoundation extends BaseFoundation {
|
|
|
100
98
|
forceDisableMotion: propsActiveKey === prev.propsActiveKey ? prev.forceDisableMotion : paneKeys.includes(propsActiveKey) && !prev.paneKeys.includes(propsActiveKey)
|
|
101
99
|
};
|
|
102
100
|
}
|
|
103
|
-
/** Splits `list` into the tabs that stay in the bar and the last `more` ones (or `more.count`) that move into the menu */
|
|
104
101
|
static splitMore(list, more) {
|
|
105
102
|
if (typeof more !== "number" && typeof more !== "object") throw new Error("[Semi Tabs]: invalid tab props format: more");
|
|
106
103
|
const keep = list.length - Math.min(typeof more === "number" ? more : more.count, list.length);
|
|
@@ -126,7 +123,6 @@ var TabsFoundation = class TabsFoundation extends BaseFoundation {
|
|
|
126
123
|
inline: position
|
|
127
124
|
});
|
|
128
125
|
}
|
|
129
|
-
/** Re-keys the OverflowList visibility map by itemKey; `hasHidden` and `isShowInViewport` summarize it */
|
|
130
126
|
static readVisibleState(visibleMap) {
|
|
131
127
|
const visibleState = new Map([...visibleMap].map(([barItemKey, visible]) => [getItemKeyByBarItemKey(barItemKey), visible]));
|
|
132
128
|
const visibles = [...visibleState.values()];
|
|
@@ -136,28 +132,28 @@ var TabsFoundation = class TabsFoundation extends BaseFoundation {
|
|
|
136
132
|
hasHidden: visibles.some((visible) => !visible)
|
|
137
133
|
};
|
|
138
134
|
}
|
|
139
|
-
handleTabClick(activeKey, event) {
|
|
135
|
+
handleTabClick = (activeKey, event) => {
|
|
140
136
|
this.#notifyChange(activeKey);
|
|
141
|
-
if (!this.
|
|
142
|
-
this.
|
|
143
|
-
}
|
|
144
|
-
syncActiveKey(activeKey) {
|
|
137
|
+
if (!this.isControlledComponent("activeKey")) this.handleNewActiveKey(activeKey);
|
|
138
|
+
this.adapter.notifyTabClick(activeKey, event);
|
|
139
|
+
};
|
|
140
|
+
syncActiveKey = (activeKey) => {
|
|
145
141
|
if (activeKey !== void 0) this.handleNewActiveKey(activeKey);
|
|
146
|
-
}
|
|
147
|
-
handleTabPanesChange(panes) {
|
|
148
|
-
if (this.
|
|
142
|
+
};
|
|
143
|
+
handleTabPanesChange = (panes) => {
|
|
144
|
+
if (this.isControlledComponent("activeKey")) return;
|
|
149
145
|
const { activeKey } = this.getStates();
|
|
150
146
|
if (!panes.some((pane) => pane.itemKey === activeKey)) this.handleNewActiveKey(TabsFoundation.getDefaultActiveKey({}, panes));
|
|
151
|
-
}
|
|
152
|
-
handleTabDelete(tabKey) {
|
|
153
|
-
this.
|
|
154
|
-
}
|
|
147
|
+
};
|
|
148
|
+
handleTabDelete = (tabKey) => {
|
|
149
|
+
this.adapter.notifyTabDelete(tabKey);
|
|
150
|
+
};
|
|
155
151
|
handleKeyDown = (event, itemKey, closable) => {
|
|
156
152
|
if (event.altKey || event.ctrlKey || event.metaKey) return;
|
|
157
153
|
const tab = event.currentTarget;
|
|
158
|
-
if (event.target !== tab) return;
|
|
154
|
+
if (!(tab instanceof HTMLElement) || event.target !== tab) return;
|
|
159
155
|
const { preventScroll } = this.getProps();
|
|
160
|
-
const allTabs = [...tab.
|
|
156
|
+
const allTabs = [...tab.closest("[role=\"tablist\"]").querySelectorAll(`[data-tabkey^="${TAB_DATA_KEY_PREFIX}"]`)];
|
|
161
157
|
const tabs = allTabs.filter((item) => item.getAttribute("aria-disabled") !== "true");
|
|
162
158
|
switch (event.key) {
|
|
163
159
|
case "ArrowLeft":
|
package/dist/tabs/tabs.scss
CHANGED
|
@@ -56,12 +56,12 @@ $ignoreIcon: '.#{$prefix}-icon-checkbox_tick, .#{$prefix}-icon-radio, .#{$prefix
|
|
|
56
56
|
display: flex;
|
|
57
57
|
align-content: center;
|
|
58
58
|
|
|
59
|
+
// :not(:not(&-icon)) outranks the generic icon rules
|
|
59
60
|
&-icon:not(:not(&-icon)) {
|
|
60
61
|
display: flex;
|
|
61
62
|
flex-shrink: 0;
|
|
62
63
|
align-items: center;
|
|
63
64
|
margin-inline: $spacing-tabs_tab-more_trigger_icon-marginLeft $spacing-tabs_tab-more_trigger_icon-marginRight;
|
|
64
|
-
// :not(:not(&-icon)) outranks the generic icon rules
|
|
65
65
|
margin-top: $spacing-tabs_tab-more_trigger_icon-marginTop;
|
|
66
66
|
margin-bottom: $spacing-tabs_tab-more_trigger_icon-marginBottom;
|
|
67
67
|
}
|
package/dist/tag/focus.js
CHANGED
|
@@ -5,7 +5,6 @@ const tagCls = cssClasses.PREFIX;
|
|
|
5
5
|
function isReachableTag(node) {
|
|
6
6
|
return node instanceof HTMLElement && node.matches(`.${tagCls}:not(.${tagCls}-invisible)`) && node.tabIndex >= 0;
|
|
7
7
|
}
|
|
8
|
-
/** Prefers the following tag, falling back to the preceding one. */
|
|
9
8
|
function findAdjacentTag(tag) {
|
|
10
9
|
for (let node = tag.nextElementSibling; node; node = node.nextElementSibling) if (isReachableTag(node)) return node;
|
|
11
10
|
for (let node = tag.previousElementSibling; node; node = node.previousElementSibling) if (isReachableTag(node)) return node;
|
|
@@ -13,7 +13,6 @@ export interface TagSortIds {
|
|
|
13
13
|
ids: string[];
|
|
14
14
|
move?: OnSortEndProps;
|
|
15
15
|
}
|
|
16
|
-
/** The props the foundation reads with getProps */
|
|
17
16
|
export interface TagInputBaseProps {
|
|
18
17
|
value?: string[] | null;
|
|
19
18
|
inputValue?: string;
|
|
@@ -65,7 +64,6 @@ export default class TagInputFoundation<P extends TagInputBaseProps = TagInputBa
|
|
|
65
64
|
* values return `prev` itself, so a caller can skip the update and an untaken sort stays pending.
|
|
66
65
|
*/
|
|
67
66
|
static getSortIds(values: string[], prev?: TagSortIds): TagSortIds;
|
|
68
|
-
/** The input text on screen: a string `inputValue` prop wins over state */
|
|
69
67
|
static getInputValue(props: {
|
|
70
68
|
inputValue?: string;
|
|
71
69
|
}, state: {
|
|
@@ -74,18 +72,18 @@ export default class TagInputFoundation<P extends TagInputBaseProps = TagInputBa
|
|
|
74
72
|
init(): void;
|
|
75
73
|
destroy(): void;
|
|
76
74
|
/** Re-fits the inline input width without field-sizing; hosts call it when the typed text changes */
|
|
77
|
-
fitInputWidth()
|
|
78
|
-
handleInputChange(value: string, e: E)
|
|
79
|
-
handleInputCompositionStart: (_e:
|
|
75
|
+
fitInputWidth: () => void;
|
|
76
|
+
handleInputChange: (value: string, e: E) => void;
|
|
77
|
+
handleInputCompositionStart: (_e: unknown) => void;
|
|
80
78
|
handleInputCompositionEnd: (e: any) => void;
|
|
81
79
|
handleKeyDown: (e: TagInputKeyboardEvent) => void;
|
|
82
|
-
handleInputBlur(e: TagInputCursorEvent)
|
|
83
|
-
handleInputFocus(e: TagInputCursorEvent)
|
|
84
|
-
handleClearBtn(e: TagInputMouseEvent)
|
|
85
|
-
handleTagClose(index: number)
|
|
86
|
-
handleClick()
|
|
80
|
+
handleInputBlur: (e: TagInputCursorEvent) => void;
|
|
81
|
+
handleInputFocus: (e: TagInputCursorEvent) => void;
|
|
82
|
+
handleClearBtn: (e: TagInputMouseEvent) => void;
|
|
83
|
+
handleTagClose: (index: number) => void;
|
|
84
|
+
handleClick: () => void;
|
|
87
85
|
/** Ends the active session started by a click: on a mousedown outside the TagInput, or on blur() */
|
|
88
|
-
deactivate()
|
|
89
|
-
handleClickPrefixOrSuffix()
|
|
90
|
-
handleSortEnd({ oldIndex, newIndex }: OnSortEndProps)
|
|
86
|
+
deactivate: () => void;
|
|
87
|
+
handleClickPrefixOrSuffix: () => void;
|
|
88
|
+
handleSortEnd: ({ oldIndex, newIndex }: OnSortEndProps) => void;
|
|
91
89
|
}
|
|
@@ -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) {
|
|
@@ -107,7 +107,6 @@ var TagInputFoundation = class TagInputFoundation extends BaseFoundation {
|
|
|
107
107
|
ids: values.map((value) => unused.get(value)?.shift() ?? newId(value))
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
|
-
/** The input text on screen: a string `inputValue` prop wins over state */
|
|
111
110
|
static getInputValue(props, state) {
|
|
112
111
|
return typeof props.inputValue === "string" ? props.inputValue : state.inputValue;
|
|
113
112
|
}
|
|
@@ -122,38 +121,38 @@ var TagInputFoundation = class TagInputFoundation extends BaseFoundation {
|
|
|
122
121
|
this.#fitInline = false;
|
|
123
122
|
}
|
|
124
123
|
/** 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.
|
|
124
|
+
fitInputWidth = () => {
|
|
125
|
+
const input = this.#fitInline ? this.adapter.getInput() : null;
|
|
127
126
|
if (input) fitInputWidth(input);
|
|
128
|
-
}
|
|
129
|
-
handleInputChange(value, e) {
|
|
127
|
+
};
|
|
128
|
+
handleInputChange = (value, e) => {
|
|
130
129
|
const { entering } = this.getStates();
|
|
131
130
|
if (entering) this.#onInputChange(value, e);
|
|
132
131
|
else if (this.#checkInputChangeValid(value)) this.#onInputChange(value, e);
|
|
133
|
-
}
|
|
132
|
+
};
|
|
134
133
|
handleInputCompositionStart = (_e) => {
|
|
135
134
|
const { maxLength } = this.getProps();
|
|
136
135
|
if (typeof maxLength !== "number") return;
|
|
137
|
-
this.
|
|
136
|
+
this.adapter.setEntering(true);
|
|
138
137
|
};
|
|
139
138
|
handleInputCompositionEnd = (e) => {
|
|
140
139
|
const { value } = e.target;
|
|
141
140
|
const { maxLength, separator } = this.getProps();
|
|
142
141
|
if (typeof maxLength !== "number") return;
|
|
143
|
-
this.
|
|
142
|
+
this.adapter.setEntering(false);
|
|
144
143
|
let allowChange = true;
|
|
145
144
|
const inputArr = this.#splitArray(value, separator);
|
|
146
145
|
let index = 0;
|
|
147
146
|
for (; index < inputArr.length; index++) if (inputArr[index].length > maxLength) {
|
|
148
147
|
allowChange = false;
|
|
149
|
-
this.
|
|
148
|
+
this.adapter.notifyInputExceed(value);
|
|
150
149
|
break;
|
|
151
150
|
}
|
|
152
151
|
if (!allowChange) {
|
|
153
152
|
const newInputArr = inputArr.slice(0, index);
|
|
154
153
|
if (index < inputArr.length) newInputArr.push(inputArr[index].slice(0, maxLength));
|
|
155
154
|
this.#onInputChange(newInputArr.join(Array.isArray(separator) ? separator[0] : separator), e);
|
|
156
|
-
} else this.
|
|
155
|
+
} else this.adapter.setInputValue(value);
|
|
157
156
|
};
|
|
158
157
|
handleKeyDown = (e) => {
|
|
159
158
|
const { inputValue, tagsArray } = this.#current();
|
|
@@ -168,55 +167,55 @@ var TagInputFoundation = class TagInputFoundation extends BaseFoundation {
|
|
|
168
167
|
const removedTag = tagsArray[length - 1];
|
|
169
168
|
this.#onRemove(newTagList, removedTag, length - 1);
|
|
170
169
|
}
|
|
171
|
-
this.
|
|
170
|
+
this.adapter.notifyKeyDown(e);
|
|
172
171
|
};
|
|
173
|
-
handleInputBlur(e) {
|
|
174
|
-
const { addOnBlur } = this.
|
|
172
|
+
handleInputBlur = (e) => {
|
|
173
|
+
const { addOnBlur } = this.adapter.getProps();
|
|
175
174
|
if (addOnBlur === true && this.#current().inputValue !== "") this.#handleAddTags(e);
|
|
176
175
|
this.deactivate();
|
|
177
|
-
this.
|
|
178
|
-
this.
|
|
179
|
-
}
|
|
180
|
-
handleInputFocus(e) {
|
|
176
|
+
this.adapter.setFocusing(false);
|
|
177
|
+
this.adapter.notifyBlur(e);
|
|
178
|
+
};
|
|
179
|
+
handleInputFocus = (e) => {
|
|
181
180
|
this.handleClick();
|
|
182
|
-
this.
|
|
183
|
-
this.
|
|
184
|
-
}
|
|
185
|
-
handleClearBtn(e) {
|
|
181
|
+
this.adapter.setFocusing(true);
|
|
182
|
+
this.adapter.notifyFocus(e);
|
|
183
|
+
};
|
|
184
|
+
handleClearBtn = (e) => {
|
|
186
185
|
const { inputValue, tagsArray } = this.#current();
|
|
187
186
|
if (tagsArray.length > 0) {
|
|
188
|
-
if (!this.
|
|
189
|
-
this.
|
|
187
|
+
if (!this.isControlledComponent()) this.adapter.setTagsArray([]);
|
|
188
|
+
this.adapter.notifyTagChange([]);
|
|
190
189
|
}
|
|
191
190
|
if (inputValue.length > 0) this.#onInputChange("", e);
|
|
192
191
|
e.stopPropagation();
|
|
193
|
-
}
|
|
194
|
-
handleTagClose(index) {
|
|
192
|
+
};
|
|
193
|
+
handleTagClose = (index) => {
|
|
195
194
|
const { tagsArray } = this.#current();
|
|
196
195
|
const newTagList = [...tagsArray];
|
|
197
196
|
newTagList.splice(index, 1);
|
|
198
197
|
const removedTag = tagsArray[index];
|
|
199
198
|
this.#onRemove(newTagList, removedTag, index);
|
|
200
|
-
}
|
|
201
|
-
handleClick() {
|
|
199
|
+
};
|
|
200
|
+
handleClick = () => {
|
|
202
201
|
const { disabled } = this.getProps();
|
|
203
202
|
if (disabled) return;
|
|
204
|
-
if (!this.getState("active")) this.
|
|
205
|
-
}
|
|
203
|
+
if (!this.getState("active")) this.adapter.setActive(true);
|
|
204
|
+
};
|
|
206
205
|
/** 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 }) {
|
|
206
|
+
deactivate = () => {
|
|
207
|
+
this.adapter.setActive(false);
|
|
208
|
+
};
|
|
209
|
+
handleClickPrefixOrSuffix = () => {
|
|
210
|
+
const { disabled } = this.adapter.getProps();
|
|
211
|
+
const { focusing } = this.adapter.getStates();
|
|
212
|
+
if (!disabled && !focusing) this.adapter.toggleFocusing(true);
|
|
213
|
+
};
|
|
214
|
+
handleSortEnd = ({ oldIndex, newIndex }) => {
|
|
216
215
|
const { tagsArray } = this.#current();
|
|
217
216
|
const newTagsArray = arrayMove(tagsArray, oldIndex, newIndex);
|
|
218
|
-
if (!this.
|
|
219
|
-
this.
|
|
220
|
-
}
|
|
217
|
+
if (!this.isControlledComponent()) this.adapter.setTagsArray(newTagsArray);
|
|
218
|
+
this.adapter.notifyTagChange(newTagsArray);
|
|
219
|
+
};
|
|
221
220
|
};
|
|
222
221
|
export { TagInputFoundation as default };
|
|
@@ -5,7 +5,6 @@ import { tabbable } from "tabbable";
|
|
|
5
5
|
function tagStops(wrapper) {
|
|
6
6
|
return tabbable(wrapper, { displayCheck: "none" }).filter((node) => !node.closest(`.${cssClasses.PREFIX}-wrapper-input, .${cssClasses.PREFIX}-sortable-handle`));
|
|
7
7
|
}
|
|
8
|
-
/** The place of the focused element among the tags' tab stops in the TagInput's wrapper, or -1 */
|
|
9
8
|
function getFocusedTagStop(wrapper) {
|
|
10
9
|
return wrapper ? tagStops(wrapper).indexOf(FocusTrapHandle.getActiveElement(wrapper)) : -1;
|
|
11
10
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export type TimeStamp = Date | string | number;
|
|
2
2
|
export type ColumnType = 'ampm' | 'hour' | 'minute' | 'second';
|
|
3
|
-
/** The props one time panel is computed from */
|
|
4
3
|
export interface ComboboxBaseProps {
|
|
5
4
|
timeStampValue?: TimeStamp;
|
|
6
5
|
format?: string;
|
|
@@ -19,17 +18,15 @@ export declare function formatOption(option: number, disabledOptions: number[]):
|
|
|
19
18
|
value: string;
|
|
20
19
|
disabled: boolean;
|
|
21
20
|
};
|
|
22
|
-
/** Pure calculations for one time panel: which columns show, what each lists, and the time a picked item makes */
|
|
23
21
|
export default class ComboboxFoundation {
|
|
24
|
-
/** The columns `format` asks for */
|
|
25
22
|
static getColumns(format: string): {
|
|
26
23
|
showHour: boolean;
|
|
27
24
|
showMinute: boolean;
|
|
28
25
|
showSecond: boolean;
|
|
29
26
|
};
|
|
30
27
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
28
|
+
* Every column reads the shown time (midnight, or noon in a PM panel, while there is no value), the time a picked
|
|
29
|
+
* item is applied to.
|
|
33
30
|
*/
|
|
34
31
|
static getOptions(props: ComboboxBaseProps): {
|
|
35
32
|
isAM: boolean;
|
|
@@ -58,10 +55,7 @@ export default class ComboboxFoundation {
|
|
|
58
55
|
showMinute: boolean;
|
|
59
56
|
showSecond: boolean;
|
|
60
57
|
};
|
|
61
|
-
/**
|
|
62
|
-
* The time after picking `itemValue` in column `type`. A 12-hour hour keeps the half day `isAM` names; AM/PM moves
|
|
63
|
-
* the time by 12 hours only when it is in the other half day.
|
|
64
|
-
*/
|
|
58
|
+
/** A 12-hour hour keeps the half day `isAM` names; AM/PM moves the time by 12 hours only when it is in the other half day */
|
|
65
59
|
static applyItem(timeStampValue: TimeStamp, type: ColumnType, itemValue: string, use12Hours: boolean, isAM: boolean): Date;
|
|
66
60
|
/**
|
|
67
61
|
* `disabledHours()`, mapped onto the 12-hour column of the half day `isAM` names when `use12Hours`; the hours of
|
|
@@ -70,10 +64,8 @@ export default class ComboboxFoundation {
|
|
|
70
64
|
static getDisabledHours({ use12Hours, disabledHours, isAM }: Pick<ComboboxBaseProps, 'use12Hours' | 'disabledHours'> & {
|
|
71
65
|
isAM?: boolean;
|
|
72
66
|
}): number[];
|
|
73
|
-
/** The half day of the value; `defaultIsAM` applies while there is no value */
|
|
74
67
|
static isAM(timeStamp: TimeStamp, defaultIsAM?: boolean): boolean;
|
|
75
68
|
/** A timestamp of 0 is a value; only nothing and '' are not */
|
|
76
69
|
static hasValue(timeStamp: unknown): boolean;
|
|
77
|
-
/** The time a panel shows; without a value, today's midnight, or noon when the panel shows PM */
|
|
78
70
|
static getDisplayDateFromTimeStamp(timeStamp: TimeStamp, defaultIsPM?: boolean): Date;
|
|
79
71
|
}
|
|
@@ -19,9 +19,7 @@ function toColumn(options, disabledOptions, selected) {
|
|
|
19
19
|
selectedIndex: options.indexOf(selected)
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
/** Pure calculations for one time panel: which columns show, what each lists, and the time a picked item makes */
|
|
23
22
|
var ComboboxFoundation = class ComboboxFoundation {
|
|
24
|
-
/** The columns `format` asks for */
|
|
25
23
|
static getColumns(format) {
|
|
26
24
|
return {
|
|
27
25
|
showHour: /HH|hh|H|h/.test(format),
|
|
@@ -30,8 +28,8 @@ var ComboboxFoundation = class ComboboxFoundation {
|
|
|
30
28
|
};
|
|
31
29
|
}
|
|
32
30
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
31
|
+
* Every column reads the shown time (midnight, or noon in a PM panel, while there is no value), the time a picked
|
|
32
|
+
* item is applied to.
|
|
35
33
|
*/
|
|
36
34
|
static getOptions(props) {
|
|
37
35
|
const { timeStampValue, use12Hours, hourStep, disabledMinutes, disabledSeconds, hideDisabledOptions, minuteStep, secondStep } = props;
|
|
@@ -57,10 +55,7 @@ var ComboboxFoundation = class ComboboxFoundation {
|
|
|
57
55
|
second: toColumn(secondOptions, disabledSecondOptions, dateTime.getSeconds())
|
|
58
56
|
};
|
|
59
57
|
}
|
|
60
|
-
/**
|
|
61
|
-
* The time after picking `itemValue` in column `type`. A 12-hour hour keeps the half day `isAM` names; AM/PM moves
|
|
62
|
-
* the time by 12 hours only when it is in the other half day.
|
|
63
|
-
*/
|
|
58
|
+
/** A 12-hour hour keeps the half day `isAM` names; AM/PM moves the time by 12 hours only when it is in the other half day */
|
|
64
59
|
static applyItem(timeStampValue, type, itemValue, use12Hours, isAM) {
|
|
65
60
|
const date = ComboboxFoundation.getDisplayDateFromTimeStamp(timeStampValue, use12Hours && !isAM);
|
|
66
61
|
const hours = date.getHours();
|
|
@@ -83,7 +78,6 @@ var ComboboxFoundation = class ComboboxFoundation {
|
|
|
83
78
|
if (use12Hours && Array.isArray(disabledOptions)) return disabledOptions.filter((h) => h < 12 === Boolean(isAM)).map((h) => h % 12 || 12);
|
|
84
79
|
return disabledOptions;
|
|
85
80
|
}
|
|
86
|
-
/** The half day of the value; `defaultIsAM` applies while there is no value */
|
|
87
81
|
static isAM(timeStamp, defaultIsAM = true) {
|
|
88
82
|
return ComboboxFoundation.hasValue(timeStamp) ? ComboboxFoundation.getDisplayDateFromTimeStamp(timeStamp).getHours() < 12 : defaultIsAM;
|
|
89
83
|
}
|
|
@@ -91,7 +85,6 @@ var ComboboxFoundation = class ComboboxFoundation {
|
|
|
91
85
|
static hasValue(timeStamp) {
|
|
92
86
|
return timeStamp != null && timeStamp !== "" && isValidDate(new Date(timeStamp));
|
|
93
87
|
}
|
|
94
|
-
/** The time a panel shows; without a value, today's midnight, or noon when the panel shows PM */
|
|
95
88
|
static getDisplayDateFromTimeStamp(timeStamp, defaultIsPM = false) {
|
|
96
89
|
if (!ComboboxFoundation.hasValue(timeStamp)) {
|
|
97
90
|
const now = /* @__PURE__ */ new Date();
|