@fibrae/semi-foundation 0.8.0 → 0.9.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.
Files changed (30) hide show
  1. package/dist/components/calendar/event-util.js +1 -1
  2. package/dist/components/carousel/foundation.js +1 -1
  3. package/dist/components/cascader/foundation.js +1 -1
  4. package/dist/components/date-picker/months-grid-foundation.d.ts +1 -1
  5. package/dist/components/date-picker/months-grid-foundation.js +1 -1
  6. package/dist/components/dropdown/menu-foundation.d.ts +1 -1
  7. package/dist/components/form/form.css +18 -1
  8. package/dist/components/form/form.scss +22 -1
  9. package/dist/components/form/json-schema.d.ts +44 -1
  10. package/dist/components/form/rules.js +1 -1
  11. package/dist/components/form/variables.scss +1 -1
  12. package/dist/components/image/preview-image-foundation.js +1 -1
  13. package/dist/components/image/preview-inner-foundation.js +2 -4
  14. package/dist/components/input-number/foundation.js +2 -2
  15. package/dist/components/json-viewer/foundation.js +1 -1
  16. package/dist/components/navigation/foundation.js +6 -8
  17. package/dist/components/pagination/foundation.d.ts +1 -1
  18. package/dist/components/select/option-foundation.d.ts +2 -1
  19. package/dist/components/side-sheet/side-sheet-foundation.js +1 -1
  20. package/dist/components/slider/foundation.d.ts +1 -1
  21. package/dist/components/table/foundation.js +2 -2
  22. package/dist/components/tooltip/foundation.js +2 -4
  23. package/dist/components/tree/tree-util.js +4 -4
  24. package/dist/components/upload/foundation.js +1 -1
  25. package/dist/components/video-player/foundation.js +1 -1
  26. package/dist/utils/a11y.d.ts +2 -0
  27. package/dist/utils/a11y.js +5 -1
  28. package/dist/utils/index.d.ts +2 -2
  29. package/dist/utils/index.js +2 -2
  30. package/package.json +2 -2
@@ -143,7 +143,7 @@ function parseRangeAllDayEvent(event, startDate, rangeStart, rangeEnd, parsed) {
143
143
  let dateLength;
144
144
  const j = differenceInCalendarDays(startDate, rangeStart);
145
145
  let i = 0;
146
- while (Boolean(parsed[i]) && Boolean(parsed[i][j])) i++;
146
+ while (parsed[i] && parsed[i][j]) i++;
147
147
  if (!end) dateLength = 0;
148
148
  else dateLength = isDateInRange(end, rangeStart, rangeEnd) ? differenceInCalendarDays(end, startDate) : differenceInCalendarDays(rangeEnd, startDate);
149
149
  itemInfo.leftPos = round(Number(j) / dateRangeLen);
@@ -44,7 +44,7 @@ var CarouselFoundation = class CarouselFoundation extends BaseFoundation {
44
44
  }
45
45
  }
46
46
  #play(interval) {
47
- if (this.#interval) clearInterval(this.#interval);
47
+ clearInterval(this.#interval);
48
48
  this.#interval = setInterval(() => {
49
49
  this.next();
50
50
  }, interval);
@@ -593,7 +593,7 @@ var CascaderFoundation = class CascaderFoundation extends BaseFoundation {
593
593
  }
594
594
  static getRenderData(props, state) {
595
595
  const { keyEntities, isSearching } = state;
596
- if (isSearching && Boolean(props.filterTreeNode)) return CascaderFoundation.#getFilteredData(props, state);
596
+ if (isSearching && props.filterTreeNode) return CascaderFoundation.#getFilteredData(props, state);
597
597
  return Object.values(keyEntities).filter((item) => item.parentKey === null && !CascaderFoundation.#missingEntities.has(item)).sort((a, b) => a.ind - b.ind);
598
598
  }
599
599
  static isBranch(data, loadData) {
@@ -113,7 +113,7 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
113
113
  static getYAMOpenType(state: Pick<MonthsGridFoundationState, 'monthLeft' | 'monthRight'>): "none" | "left" | "right" | "both";
114
114
  static isYearOrTime(panel: PanelState): boolean;
115
115
  /** The `x-open-type` of a panel: what it shows in place of, or beside, its month */
116
- static getOpenType(panel: PanelState): "date" | "time" | "year";
116
+ static getOpenType(panel: PanelState): "time" | "date" | "year";
117
117
  static formatMonthText(locale: Pick<Locale['DatePicker'], 'monthText' | 'months'>, month?: Date): string;
118
118
  /** The texts of a panel's date and time switch; the date is the picked range endpoint, else the shown date */
119
119
  static getSwitchTexts({ rangeEndpoint, showDate, dateFormat, format: formatProp, locale, dateFnsLocale }: {
@@ -104,7 +104,7 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
104
104
  #updateSelectedFromProps(values) {
105
105
  const type = this.getProp("type");
106
106
  const { selected, rangeStart, rangeEnd } = this.getStates();
107
- if (values && values?.length) switch (type) {
107
+ if (values?.length) switch (type) {
108
108
  case "date":
109
109
  this.#initDatePickerFromValue(values);
110
110
  break;
@@ -5,7 +5,7 @@ export type DropdownSelectionMode = 'single' | 'multiple';
5
5
  * Role and checked state of a menu item, from the menu's selectionMode (as React Aria Menu) and showTick. Without a
6
6
  * selectionMode a tick shows a checked state, so showTick alone makes the items checkboxes.
7
7
  */
8
- export declare function getItemRole(selectionMode?: DropdownSelectionMode, showTick?: boolean): "menuitem" | "menuitemradio" | "menuitemcheckbox";
8
+ export declare function getItemRole(selectionMode?: DropdownSelectionMode, showTick?: boolean): "menuitemradio" | "menuitemcheckbox" | "menuitem";
9
9
  /**
10
10
  * What a Dropdown provides to everything inside its popup, read by the menus there and by a Dropdown whose trigger is
11
11
  * one of their items. A framework adapter passes it as the foundation context, with the reading direction added.
@@ -86,11 +86,14 @@
86
86
  align-items: center;
87
87
  max-width: 100%;
88
88
  padding-inline-end: 16px;
89
+ margin-top: 0px;
90
+ margin-bottom: 4px;
89
91
  }
90
92
  .semi-form-field-label-with-tooltip .semi-form-field-label {
91
93
  flex: 0 1 auto;
92
94
  min-width: 0;
93
95
  padding-inline-end: 4px;
96
+ margin: 0;
94
97
  }
95
98
  .semi-form-field-label-tooltip {
96
99
  padding: 0;
@@ -108,7 +111,7 @@
108
111
  display: inline-flex;
109
112
  flex-shrink: 0;
110
113
  align-items: center;
111
- font-size: 12px;
114
+ font-size: var(--semi-font-size-regular);
112
115
  color: var(--semi-color-tertiary);
113
116
  }
114
117
  .semi-form-field-error-message, .semi-form-field-help-text {
@@ -153,6 +156,13 @@
153
156
  margin-inline-end: 0;
154
157
  margin-bottom: 0;
155
158
  }
159
+ .semi-form-field[x-label-pos=left] .semi-form-field-label-with-tooltip {
160
+ margin-inline-end: 0;
161
+ margin-bottom: 0;
162
+ }
163
+ .semi-form-field[x-label-pos=left] .semi-form-field-label-with-tooltip .semi-form-field-label {
164
+ margin: 0;
165
+ }
156
166
  .semi-form-field[x-label-pos=left] .semi-form-field-label-with-extra {
157
167
  display: flex;
158
168
  align-items: center;
@@ -225,6 +235,13 @@
225
235
  margin-inline-end: 0;
226
236
  margin-bottom: 0;
227
237
  }
238
+ .semi-form-field-group[x-label-pos=left] .semi-form-field-label-with-tooltip {
239
+ margin-inline-end: 0;
240
+ margin-bottom: 0;
241
+ }
242
+ .semi-form-field-group[x-label-pos=left] .semi-form-field-label-with-tooltip .semi-form-field-label {
243
+ margin: 0;
244
+ }
228
245
 
229
246
  .semi-form-section {
230
247
  min-inline-size: 0;
@@ -130,18 +130,23 @@ $rating: #{$prefix}-rating;
130
130
  }
131
131
 
132
132
  // The tooltip button sits beside the label element, not in it: a label's content names the control, and a
133
- // button must not be nested in a label. The width of the label moves to this wrapper to keep columns aligned.
133
+ // button must not be nested in a label. The width of the label moves to this wrapper to keep columns aligned, and
134
+ // so do the label's outer margins: align-items centers margin boxes, so a bottom margin left on the label would
135
+ // drop the button below the text's center line.
134
136
  &-field-label-with-tooltip {
135
137
  display: flex;
136
138
  flex-shrink: 0;
137
139
  align-items: center;
138
140
  max-width: 100%;
139
141
  padding-inline-end: $spacing-form_label-paddingRight;
142
+ margin-top: $spacing-form_label-marginTop;
143
+ margin-bottom: $spacing-form_label-marginBottom;
140
144
 
141
145
  .#{$field}-label {
142
146
  flex: 0 1 auto;
143
147
  min-width: 0;
144
148
  padding-inline-end: $spacing-form_label_tooltip-marginLeft;
149
+ margin: 0;
145
150
  }
146
151
  }
147
152
 
@@ -202,6 +207,14 @@ $rating: #{$prefix}-rating;
202
207
  margin-inline-end: $spacing-form_label_posLeft-marginRight;
203
208
  margin-bottom: $spacing-form_label_posLeft-marginBottom;
204
209
  }
210
+ .#{$field}-label-with-tooltip {
211
+ margin-inline-end: $spacing-form_label_posLeft-marginRight;
212
+ margin-bottom: $spacing-form_label_posLeft-marginBottom;
213
+
214
+ .#{$field}-label {
215
+ margin: 0;
216
+ }
217
+ }
205
218
  .#{$field}-label-with-extra {
206
219
  display: flex;
207
220
  align-items: center;
@@ -287,6 +300,14 @@ $rating: #{$prefix}-rating;
287
300
  margin-inline-end: $spacing-form_label_posLeft-marginRight;
288
301
  margin-bottom: $spacing-form_label_posLeft-marginBottom;
289
302
  }
303
+ .#{$field}-label-with-tooltip {
304
+ margin-inline-end: $spacing-form_label_posLeft-marginRight;
305
+ margin-bottom: $spacing-form_label_posLeft-marginBottom;
306
+
307
+ .#{$field}-label {
308
+ margin: 0;
309
+ }
310
+ }
290
311
  }
291
312
  }
292
313
 
@@ -62,7 +62,50 @@ export declare function arrayState(node: SchemaFieldNode, count: number): {
62
62
  canRemove: boolean;
63
63
  };
64
64
  /** The props semiRenderers gives the Form control of a leaf node, by kind */
65
- export declare function controlProps(node: SchemaFieldNode): Record<string, unknown>;
65
+ export declare function controlProps(node: SchemaFieldNode): {
66
+ maxLength: number;
67
+ maxCount?: undefined;
68
+ max?: undefined;
69
+ min?: undefined;
70
+ precision?: undefined;
71
+ multiple?: undefined;
72
+ optionList?: undefined;
73
+ } | {
74
+ maxCount: number;
75
+ maxLength?: undefined;
76
+ max?: undefined;
77
+ min?: undefined;
78
+ precision?: undefined;
79
+ multiple?: undefined;
80
+ optionList?: undefined;
81
+ } | {
82
+ max: number;
83
+ min: number;
84
+ precision: number;
85
+ maxLength?: undefined;
86
+ maxCount?: undefined;
87
+ multiple?: undefined;
88
+ optionList?: undefined;
89
+ } | {
90
+ multiple: boolean;
91
+ optionList: {
92
+ label: string;
93
+ value: string | number | boolean;
94
+ }[];
95
+ maxLength?: undefined;
96
+ maxCount?: undefined;
97
+ max?: undefined;
98
+ min?: undefined;
99
+ precision?: undefined;
100
+ } | {
101
+ maxLength?: undefined;
102
+ maxCount?: undefined;
103
+ max?: undefined;
104
+ min?: undefined;
105
+ precision?: undefined;
106
+ multiple?: undefined;
107
+ optionList?: undefined;
108
+ };
66
109
  export declare const schemaFieldWarnings: {
67
110
  noSchema: string;
68
111
  noRenderer: (field: string, kind: string) => string;
@@ -14,7 +14,7 @@ const typeCheckers = {
14
14
  string: (value) => typeof value === "string",
15
15
  number: (value) => typeof value === "number" && !Number.isNaN(value),
16
16
  integer: (value) => Number.isInteger(value),
17
- float: (value) => typeof value === "number" && Number.isFinite(value) && !Number.isInteger(value),
17
+ float: (value) => Number.isFinite(value) && !Number.isInteger(value),
18
18
  boolean: (value) => typeof value === "boolean",
19
19
  array: (value) => Array.isArray(value),
20
20
  object: (value) => typeof value === "object" && value !== null && !Array.isArray(value),
@@ -34,7 +34,7 @@ $color-form_label_optional-text-default: var(--semi-color-tertiary); // 表单
34
34
  $color-form_label_extra-text-default: var(--semi-color-tertiary); // 表单项标签图标颜色
35
35
  $color-form_label_tooltip-icon-default: var(--semi-color-tertiary); // 表单项标签提示图标颜色
36
36
  $spacing-form_label_tooltip-marginLeft: $spacing-extra-tight; // 表单项标签与提示图标的间距
37
- $width-form_label_tooltip-icon: $width-icon-small; // 表单项标签提示图标大小
37
+ $width-form_label_tooltip-icon: $font-size-regular; // 表单项标签提示图标大小,与标签文字同大
38
38
  $color-form_requiredMark-text-default: var(--semi-color-danger); // 必填标记颜色
39
39
  $font-form_requiredMark-fontWeight: $font-weight-bold; // 表单必填标识字重
40
40
 
@@ -52,7 +52,7 @@ var PreviewImageFoundation = class extends BaseFoundation {
52
52
  const { ratio, initialZoom } = this.getProps();
53
53
  let _zoom = 1;
54
54
  this.#syncInitialZoomFlagWithSrc();
55
- if (!this.#initialZoomApplied && typeof initialZoom === "number" && Number.isFinite(initialZoom) && initialZoom > 0) {
55
+ if (!this.#initialZoomApplied && Number.isFinite(initialZoom) && initialZoom > 0) {
56
56
  this.#initialZoomApplied = true;
57
57
  return this.#clampZoom(initialZoom);
58
58
  }
@@ -62,10 +62,8 @@ var PreviewInnerFoundation = class PreviewInnerFoundation extends BaseFoundation
62
62
  if (wrap && (!active || active === document.body)) wrap.focus({ preventScroll: true });
63
63
  }
64
64
  #clearTimer() {
65
- if (this.#timer) {
66
- clearTimeout(this.#timer);
67
- this.#timer = null;
68
- }
65
+ clearTimeout(this.#timer);
66
+ this.#timer = null;
69
67
  }
70
68
  #onWheel(e) {
71
69
  const { zoomStep } = this.getProps();
@@ -155,7 +155,7 @@ var InputNumberFoundation = class InputNumberFoundation extends BaseFoundation {
155
155
  const { scientificNotation } = this.getProps();
156
156
  if (typeof scientificNotation === "object" && scientificNotation !== null) {
157
157
  const t = scientificNotation.threshold;
158
- return typeof t === "number" && Number.isFinite(t) && t >= 1 ? t : 15;
158
+ return Number.isFinite(t) && t >= 1 ? t : 15;
159
159
  }
160
160
  return 15;
161
161
  }
@@ -425,7 +425,7 @@ var InputNumberFoundation = class InputNumberFoundation extends BaseFoundation {
425
425
  }
426
426
  const key = isComposing(event) || event.altKey || event.ctrlKey || event.metaKey ? "" : event.key;
427
427
  const bound = event.shiftKey ? null : key === "Home" ? this.getProp("min") : key === "End" ? this.getProp("max") : null;
428
- const jumpsToBound = typeof bound === "number" && Number.isFinite(bound);
428
+ const jumpsToBound = Number.isFinite(bound);
429
429
  if ((key === "ArrowUp" || key === "ArrowDown") && !this.#canStep(key === "ArrowUp" ? 1 : -1)) event.preventDefault();
430
430
  else if (key === "ArrowUp" || key === "ArrowDown" || jumpsToBound) {
431
431
  this.#lastChangeWasStep = true;
@@ -39,7 +39,7 @@ var JsonViewerFoundation = class extends BaseFoundation {
39
39
  height
40
40
  };
41
41
  this.#resetMeasuredHeights ||= rewrap;
42
- if (this.#resizeRafId !== null) cancelAnimationFrame(this.#resizeRafId);
42
+ cancelAnimationFrame(this.#resizeRafId);
43
43
  this.#resizeRafId = requestAnimationFrame(() => {
44
44
  this.#resizeRafId = null;
45
45
  if (this.#resetMeasuredHeights) this.#jsonViewer?.resetMeasuredHeights();
@@ -31,22 +31,20 @@ var NavigationFoundation = class NavigationFoundation extends BaseFoundation {
31
31
  }
32
32
  static getZeroParentKeys(itemKeysMap = {}, ...itemKeys) {
33
33
  const willAddKeys = [];
34
- if (itemKeys.length) {
35
- for (const itemKey of itemKeys) if (Array.isArray(itemKeysMap[itemKey]) && itemKeysMap[itemKey].length) {
36
- const levelZeroParentKey = itemKeysMap[itemKey][0];
37
- if (levelZeroParentKey != null) willAddKeys.push(levelZeroParentKey);
38
- }
34
+ for (const itemKey of itemKeys) if (Array.isArray(itemKeysMap[itemKey])) {
35
+ const levelZeroParentKey = itemKeysMap[itemKey][0];
36
+ if (levelZeroParentKey != null) willAddKeys.push(levelZeroParentKey);
39
37
  }
40
38
  return willAddKeys;
41
39
  }
42
40
  static buildItemKeysMap(items = [], keysMap = {}, parentKeys = [], keyPropName = "itemKey") {
43
- if (Array.isArray(items) && items.length) for (const item of items) if (Array.isArray(item)) NavigationFoundation.buildItemKeysMap(item, keysMap, [...parentKeys], keyPropName);
41
+ if (Array.isArray(items)) for (const item of items) if (Array.isArray(item)) NavigationFoundation.buildItemKeysMap(item, keysMap, [...parentKeys], keyPropName);
44
42
  else {
45
43
  let itemKey;
46
44
  if (item && typeof item === "object") itemKey = item[keyPropName];
47
45
  if (itemKey != null) {
48
46
  keysMap[itemKey] = [...parentKeys];
49
- if (Array.isArray(item.items) && item.items.length) NavigationFoundation.buildItemKeysMap(item.items, keysMap, [...parentKeys, itemKey], keyPropName);
47
+ if (Array.isArray(item.items)) NavigationFoundation.buildItemKeysMap(item.items, keysMap, [...parentKeys, itemKey], keyPropName);
50
48
  }
51
49
  }
52
50
  return keysMap;
@@ -74,7 +72,7 @@ var NavigationFoundation = class NavigationFoundation extends BaseFoundation {
74
72
  }
75
73
  static getShouldOpenKeys(itemKeysMap = {}, selectedKeys = []) {
76
74
  const willOpenKeySet = /* @__PURE__ */ new Set();
77
- if (Array.isArray(selectedKeys) && selectedKeys.length) selectedKeys.forEach((item) => {
75
+ if (Array.isArray(selectedKeys)) selectedKeys.forEach((item) => {
78
76
  if (item != null) {
79
77
  const parentKeys = itemKeysMap[item];
80
78
  if (Array.isArray(parentKeys)) parentKeys.forEach((k) => willOpenKeySet.add(k));
@@ -53,7 +53,7 @@ export default class PaginationFoundation<P extends PaginationBaseProps = Pagina
53
53
  sizeChangerShown: boolean;
54
54
  hidden: boolean;
55
55
  quickJumpDisabled: boolean;
56
- switchPosition: "bottom" | "top" | "left" | "right" | "topLeft" | "topRight" | "bottomLeft" | "bottomRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver";
56
+ switchPosition: "bottomLeft" | "left" | "right" | "top" | "bottom" | "topLeft" | "topRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver";
57
57
  };
58
58
  static getDisabled(currentPage: number, total: number, pageSize: number): {
59
59
  prevDisabled: boolean;
@@ -1,6 +1,7 @@
1
+ export type SelectRawValue = string | number | boolean;
1
2
  export interface BasicOptionProps {
2
3
  [x: string]: any;
3
- value?: string | number;
4
+ value?: SelectRawValue;
4
5
  label?: string | number | unknown;
5
6
  children?: unknown;
6
7
  disabled?: boolean;
@@ -110,7 +110,7 @@ var SideSheetFoundation = class SideSheetFoundation extends BaseFoundation {
110
110
  focus: dialog,
111
111
  preventScroll: true
112
112
  });
113
- warnIfDialogUnnamed(dialog ?? null, "SideSheet");
113
+ warnIfDialogUnnamed(dialog, "SideSheet");
114
114
  };
115
115
  afterHide = () => {
116
116
  if (this.#session.end()) this.#resources.release();
@@ -95,7 +95,7 @@ export default class SliderFoundation<P extends SliderProps = SliderProps> exten
95
95
  * `reverse` is the class suffix of a vertical slider drawn from the bottom.
96
96
  */
97
97
  static getLayout(props: SliderProps, value: SliderState['currentValue'], { chooseMovePos, isDrag }: Pick<SliderState, 'chooseMovePos' | 'isDrag'>, direction?: string): {
98
- startProp: "top" | "left" | "right";
98
+ startProp: "left" | "right" | "top";
99
99
  inputDir: "rtl" | "ltr";
100
100
  reverse: string;
101
101
  track: {
@@ -349,11 +349,11 @@ var TableFoundation = class TableFoundation extends BaseFoundation {
349
349
  if (!(keysSet instanceof Set)) keysSet = new Set(keys);
350
350
  const childrenRecordName = this.getProp("childrenRecordName");
351
351
  const records = [];
352
- if (keysSet.size && Array.isArray(dataSource) && dataSource.length) {
352
+ if (keysSet.size && Array.isArray(dataSource)) {
353
353
  records.push(...dataSource.filter((data) => keysSet.has(this.getRecordKey(data))));
354
354
  if (records.length < keys.length) for (const item of dataSource) {
355
355
  const children = get(item, childrenRecordName);
356
- if (Array.isArray(children) && children.length) records.push(...this.getRecordsByKeys(children, keys, keysSet));
356
+ if (Array.isArray(children)) records.push(...this.getRecordsByKeys(children, keys, keysSet));
357
357
  }
358
358
  }
359
359
  return records;
@@ -308,10 +308,8 @@ var Tooltip = class Tooltip extends BaseFoundation {
308
308
  event.preventDefault();
309
309
  }
310
310
  #clearDelayTimer() {
311
- if (this.#timer) {
312
- clearTimeout(this.#timer);
313
- this.#timer = null;
314
- }
311
+ clearTimeout(this.#timer);
312
+ this.#timer = null;
315
313
  }
316
314
  /** Under a controlled `visible` that differs, a trigger only asks the owner (D-1); returns whether it asked */
317
315
  #requestFromOwner(visible) {
@@ -366,8 +366,8 @@ function calcCheckedKeysForUnchecked(key, keyEntities, checkedKeys, halfCheckedK
366
366
  const descendantKeys = findDescendantKeys([key], keyEntities, true);
367
367
  const nodeItem = keyEntities[key];
368
368
  descendantKeys.forEach((descendantKey) => {
369
- if (checkedKeys.has(descendantKey)) checkedKeys.delete(descendantKey);
370
- if (halfCheckedKeys.has(descendantKey)) halfCheckedKeys.delete(descendantKey);
369
+ checkedKeys.delete(descendantKey);
370
+ halfCheckedKeys.delete(descendantKey);
371
371
  });
372
372
  const calcCurrLevel = (node) => {
373
373
  const par = node.parent;
@@ -383,8 +383,8 @@ function calcCheckedKeysForUnchecked(key, keyEntities, checkedKeys, halfCheckedK
383
383
  }
384
384
  });
385
385
  else {
386
- if (checkedKeys.has(par.key)) checkedKeys.delete(par.key);
387
- if (halfCheckedKeys.has(par.key)) halfCheckedKeys.delete(par.key);
386
+ checkedKeys.delete(par.key);
387
+ halfCheckedKeys.delete(par.key);
388
388
  calcCurrLevel(par);
389
389
  }
390
390
  };
@@ -145,7 +145,7 @@ var UploadFoundation = class extends BaseFoundation {
145
145
  this.#handleBeforeUploadResultInObject(newResult, file);
146
146
  break;
147
147
  }
148
- case buResult && isPromise(buResult):
148
+ case isPromise(buResult):
149
149
  Promise.resolve(buResult).then((resolveData) => {
150
150
  let newResult = { shouldUpload: true };
151
151
  if (isPlainObject(resolveData)) newResult = {
@@ -12,7 +12,7 @@ var VideoPlayerFoundation = class extends BaseFoundation {
12
12
  #stalled = false;
13
13
  #restoreController;
14
14
  #clearTimer() {
15
- if (this.#controlsTimer) clearTimeout(this.#controlsTimer);
15
+ clearTimeout(this.#controlsTimer);
16
16
  }
17
17
  #handleMouseMove = throttle(() => {
18
18
  this.setState({ showControls: true });
@@ -13,6 +13,8 @@ export declare function isBrowserChord({ key, ctrlKey, metaKey, altKey }: Pick<K
13
13
  * first, so the Form's ids are added to them instead of replacing them
14
14
  */
15
15
  export declare function joinIds(...ids: unknown[]): string | undefined;
16
+ /** aria-invalid is a token: the string 'false' is truthy but means valid */
17
+ export declare function isAriaInvalid(value: unknown): boolean;
16
18
  /** An explicit role wins; otherwise a generic div given a name becomes a group, since a div without a role cannot carry one */
17
19
  export declare function namedRole<A extends object>(attrs: A): RoleOf<A> | 'group' | undefined;
18
20
  /** The role type the caller's own attribute bag declares, so each framework's typed `role` attribute accepts the result */
@@ -29,6 +29,10 @@ function isBrowserChord({ key, ctrlKey, metaKey, altKey }) {
29
29
  function joinIds(...ids) {
30
30
  return ids.filter((id) => typeof id === "string" && id !== "").join(" ") || void 0;
31
31
  }
32
+ /** aria-invalid is a token: the string 'false' is truthy but means valid */
33
+ function isAriaInvalid(value) {
34
+ return Boolean(value) && value !== "false";
35
+ }
32
36
  /** An explicit role wins; otherwise a generic div given a name becomes a group, since a div without a role cannot carry one */
33
37
  function namedRole(attrs) {
34
38
  const { role, "aria-label": label, "aria-labelledby": labelledby } = attrs;
@@ -197,4 +201,4 @@ function warnIfDialogUnnamed(dialog, component) {
197
201
  const hasLabelElement = labelledBy?.split(/\s+/).some((id) => root.getElementById(id)?.textContent.trim());
198
202
  if (!dialog.getAttribute("aria-label")?.trim() && !hasLabelElement) console.warn(`Warning: [Semi ${component}] the dialog has no accessible name. Pass \`title\`, \`aria-label\` or \`aria-labelledby\`.`);
199
203
  }
200
- export { Typeahead, crossesFocusBoundary, getEnabledStepIndex, getListTargetIndex, getOptionId, handlePrevent, isAriaKey, isBrowserChord, isInnerControl, isInnerControlActivation, isInnerControlKey, isNativeInputKey, isTextEditor, joinIds, namedRole, revealOption, setFocusToFirstItem, setFocusToItem, setFocusToLastItem, stopButtonActivationKeys, warnIfDialogUnnamed };
204
+ export { Typeahead, crossesFocusBoundary, getEnabledStepIndex, getListTargetIndex, getOptionId, handlePrevent, isAriaInvalid, isAriaKey, isBrowserChord, isInnerControl, isInnerControlActivation, isInnerControlKey, isNativeInputKey, isTextEditor, joinIds, namedRole, revealOption, setFocusToFirstItem, setFocusToItem, setFocusToLastItem, stopButtonActivationKeys, warnIfDialogUnnamed };
@@ -1,4 +1,4 @@
1
- import { ListNavigationOptions, Typeahead, crossesFocusBoundary, getEnabledStepIndex, getListTargetIndex, getOptionId, handlePrevent, isAriaKey, isBrowserChord, isInnerControl, isInnerControlActivation, isInnerControlKey, isNativeInputKey, isTextEditor, joinIds, namedRole, revealOption, setFocusToFirstItem, setFocusToItem, setFocusToLastItem, stopButtonActivationKeys, warnIfDialogUnnamed } from "./a11y.js";
1
+ import { ListNavigationOptions, Typeahead, crossesFocusBoundary, getEnabledStepIndex, getListTargetIndex, getOptionId, handlePrevent, isAriaInvalid, isAriaKey, isBrowserChord, isInnerControl, isInnerControlActivation, isInnerControlKey, isNativeInputKey, isTextEditor, joinIds, namedRole, revealOption, setFocusToFirstItem, setFocusToItem, setFocusToLastItem, stopButtonActivationKeys, warnIfDialogUnnamed } from "./a11y.js";
2
2
  import { pinAnimatedHeight } from "./animated-height.js";
3
3
  import Announcer, { ANNOUNCE_DELAY, ANNOUNCE_HOLD } from "./announcer.js";
4
4
  import arrayMove from "./array-move.js";
@@ -29,4 +29,4 @@ import { Easing, TweenOptions, easeInOutCubic, linear, tween } from "./tween.js"
29
29
  import { ArrayElement, Size } from "./type.js";
30
30
  import { createId } from "./uuid.js";
31
31
  import warning, { isDev } from "./warning.js";
32
- export { ANNOUNCE_DELAY, ANNOUNCE_HOLD, Announcer, ArrayElement, CopiedTimer, ENTER_KEY, ESC_KEY, Easing, Event as EventEmitter, KEEP_INTERACTIVE_ATTRIBUTE, Layer, ListNavigationOptions, POPUP_ID_ATTRIBUTE, POPUP_SELECTOR, RegisterMediaQueryOption, Size, TweenOptions, Typeahead, addClass, arrayMove, assertClient, centerInScroller, containsWithPopups, copyText, coversPage, createId, crossesFocusBoundary, defaultPopupContainer, differenceUnique, easeInOutCubic, escapeHtmlInMarkdown, findFocusAfter, fitInputWidth, fitTextareaHeight, focusWithoutRing, get, getDataAttr, getEnabledStepIndex, getListTargetIndex, getOptionId, getPopupTrigger, handlePrevent, handoverFocus, has, ignoreExpectedMediaErrors, isAriaKey, isBrowserChord, isComposing, isDev, isEmpty, isEnterPress, isEventInside, isHTMLElement, isInnerControl, isInnerControlActivation, isInnerControlKey, isNativeInputKey, isObject, isPromise, isSecondaryPress, isTextEditor, isValidTimeZone, joinIds, linear, lockBodyScroll, namedRole, noop, onFontsLoaded, openLayer, pinAnimatedHeight, popupTriggerSelector, popupTriggers, registerMediaQuery, remove, removeClass, resolvePopupContainer, revealOption, scrollIntoViewWithin, set, setFocusToFirstItem, setFocusToItem, setFocusToLastItem, shallowEqualObjects, stopButtonActivationKeys, supportsFieldSizing, supportsFocusVisibleOption, supportsScrollContainerOption, supportsScrollbarGutter, toCssLength, tween, warnIfDialogUnnamed, warning, withOrderSort };
32
+ export { ANNOUNCE_DELAY, ANNOUNCE_HOLD, Announcer, ArrayElement, CopiedTimer, ENTER_KEY, ESC_KEY, Easing, Event as EventEmitter, KEEP_INTERACTIVE_ATTRIBUTE, Layer, ListNavigationOptions, POPUP_ID_ATTRIBUTE, POPUP_SELECTOR, RegisterMediaQueryOption, Size, TweenOptions, Typeahead, addClass, arrayMove, assertClient, centerInScroller, containsWithPopups, copyText, coversPage, createId, crossesFocusBoundary, defaultPopupContainer, differenceUnique, easeInOutCubic, escapeHtmlInMarkdown, findFocusAfter, fitInputWidth, fitTextareaHeight, focusWithoutRing, get, getDataAttr, getEnabledStepIndex, getListTargetIndex, getOptionId, getPopupTrigger, handlePrevent, handoverFocus, has, ignoreExpectedMediaErrors, isAriaInvalid, isAriaKey, isBrowserChord, isComposing, isDev, isEmpty, isEnterPress, isEventInside, isHTMLElement, isInnerControl, isInnerControlActivation, isInnerControlKey, isNativeInputKey, isObject, isPromise, isSecondaryPress, isTextEditor, isValidTimeZone, joinIds, linear, lockBodyScroll, namedRole, noop, onFontsLoaded, openLayer, pinAnimatedHeight, popupTriggerSelector, popupTriggers, registerMediaQuery, remove, removeClass, resolvePopupContainer, revealOption, scrollIntoViewWithin, set, setFocusToFirstItem, setFocusToItem, setFocusToLastItem, shallowEqualObjects, stopButtonActivationKeys, supportsFieldSizing, supportsFocusVisibleOption, supportsScrollContainerOption, supportsScrollbarGutter, toCssLength, tween, warnIfDialogUnnamed, warning, withOrderSort };
@@ -1,4 +1,4 @@
1
- import { Typeahead, crossesFocusBoundary, getEnabledStepIndex, getListTargetIndex, getOptionId, handlePrevent, isAriaKey, isBrowserChord, isInnerControl, isInnerControlActivation, isInnerControlKey, isNativeInputKey, isTextEditor, joinIds, namedRole, revealOption, setFocusToFirstItem, setFocusToItem, setFocusToLastItem, stopButtonActivationKeys, warnIfDialogUnnamed } from "./a11y.js";
1
+ import { Typeahead, crossesFocusBoundary, getEnabledStepIndex, getListTargetIndex, getOptionId, handlePrevent, isAriaInvalid, isAriaKey, isBrowserChord, isInnerControl, isInnerControlActivation, isInnerControlKey, isNativeInputKey, isTextEditor, joinIds, namedRole, revealOption, setFocusToFirstItem, setFocusToItem, setFocusToLastItem, stopButtonActivationKeys, warnIfDialogUnnamed } from "./a11y.js";
2
2
  import { pinAnimatedHeight } from "./animated-height.js";
3
3
  import Announcer, { ANNOUNCE_DELAY, ANNOUNCE_HOLD } from "./announcer.js";
4
4
  import arrayMove from "./array-move.js";
@@ -28,4 +28,4 @@ import { focusWithoutRing, scrollIntoViewWithin, supportsFocusVisibleOption, sup
28
28
  import { easeInOutCubic, linear, tween } from "./tween.js";
29
29
  import { createId } from "./uuid.js";
30
30
  import warning, { isDev } from "./warning.js";
31
- export { ANNOUNCE_DELAY, ANNOUNCE_HOLD, Announcer, CopiedTimer, ENTER_KEY, ESC_KEY, Event as EventEmitter, KEEP_INTERACTIVE_ATTRIBUTE, POPUP_ID_ATTRIBUTE, POPUP_SELECTOR, Typeahead, addClass, arrayMove, assertClient, centerInScroller, containsWithPopups, copyText, coversPage, createId, crossesFocusBoundary, defaultPopupContainer, differenceUnique, easeInOutCubic, escapeHtmlInMarkdown, findFocusAfter, fitInputWidth, fitTextareaHeight, focusWithoutRing, get, getDataAttr, getEnabledStepIndex, getListTargetIndex, getOptionId, getPopupTrigger, handlePrevent, handoverFocus, has, ignoreExpectedMediaErrors, isAriaKey, isBrowserChord, isComposing, isDev, isEmpty, isEnterPress, isEventInside, isHTMLElement, isInnerControl, isInnerControlActivation, isInnerControlKey, isNativeInputKey, isObject, isPromise, isSecondaryPress, isTextEditor, isValidTimeZone, joinIds, linear, lockBodyScroll, namedRole, noop, onFontsLoaded, openLayer, pinAnimatedHeight, popupTriggerSelector, popupTriggers, registerMediaQuery, remove, removeClass, resolvePopupContainer, revealOption, scrollIntoViewWithin, set, setFocusToFirstItem, setFocusToItem, setFocusToLastItem, shallowEqualObjects, stopButtonActivationKeys, supportsFieldSizing, supportsFocusVisibleOption, supportsScrollContainerOption, supportsScrollbarGutter, toCssLength, tween, warnIfDialogUnnamed, warning, withOrderSort };
31
+ export { ANNOUNCE_DELAY, ANNOUNCE_HOLD, Announcer, CopiedTimer, ENTER_KEY, ESC_KEY, Event as EventEmitter, KEEP_INTERACTIVE_ATTRIBUTE, POPUP_ID_ATTRIBUTE, POPUP_SELECTOR, Typeahead, addClass, arrayMove, assertClient, centerInScroller, containsWithPopups, copyText, coversPage, createId, crossesFocusBoundary, defaultPopupContainer, differenceUnique, easeInOutCubic, escapeHtmlInMarkdown, findFocusAfter, fitInputWidth, fitTextareaHeight, focusWithoutRing, get, getDataAttr, getEnabledStepIndex, getListTargetIndex, getOptionId, getPopupTrigger, handlePrevent, handoverFocus, has, ignoreExpectedMediaErrors, isAriaInvalid, isAriaKey, isBrowserChord, isComposing, isDev, isEmpty, isEnterPress, isEventInside, isHTMLElement, isInnerControl, isInnerControlActivation, isInnerControlKey, isNativeInputKey, isObject, isPromise, isSecondaryPress, isTextEditor, isValidTimeZone, joinIds, linear, lockBodyScroll, namedRole, noop, onFontsLoaded, openLayer, pinAnimatedHeight, popupTriggerSelector, popupTriggers, registerMediaQuery, remove, removeClass, resolvePopupContainer, revealOption, scrollIntoViewWithin, set, setFocusToFirstItem, setFocusToItem, setFocusToLastItem, shallowEqualObjects, stopButtonActivationKeys, supportsFieldSizing, supportsFocusVisibleOption, supportsScrollContainerOption, supportsScrollbarGutter, toCssLength, tween, warnIfDialogUnnamed, warning, withOrderSort };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fibrae/semi-foundation",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "homepage": "https://semi-design-next.pages.dev",
@@ -28,7 +28,7 @@
28
28
  "dependencies": {
29
29
  "@date-fns/tz": "^1.5.0",
30
30
  "@dnd-kit/dom": "~0.5.3",
31
- "@fibrae/semi-json-viewer-core": "0.8.0",
31
+ "@fibrae/semi-json-viewer-core": "0.9.0",
32
32
  "@mdx-js/mdx": "^3.1.1",
33
33
  "@shikijs/core": "^4.6.0",
34
34
  "clsx": "^2.1.1",