@fibrae/semi-foundation 0.6.0 → 0.7.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 (103) hide show
  1. package/dist/base/index.d.ts +2 -1
  2. package/dist/base/index.js +2 -1
  3. package/dist/base/overlay-session.d.ts +16 -0
  4. package/dist/base/overlay-session.js +36 -0
  5. package/dist/components/audio-player/foundation.js +1 -1
  6. package/dist/components/auto-complete/constants.d.ts +3 -1
  7. package/dist/components/auto-complete/foundation.d.ts +1 -1
  8. package/dist/components/auto-complete/foundation.js +15 -16
  9. package/dist/components/badge/constants.d.ts +3 -1
  10. package/dist/components/button/constants.d.ts +3 -1
  11. package/dist/components/card/constants.d.ts +3 -1
  12. package/dist/components/cascader/constants.d.ts +2 -0
  13. package/dist/components/cascader/foundation.d.ts +2 -4
  14. package/dist/components/cascader/foundation.js +4 -1
  15. package/dist/components/color-picker/foundation.d.ts +2 -0
  16. package/dist/components/color-picker/foundation.js +5 -0
  17. package/dist/components/cropper/constants.d.ts +2 -0
  18. package/dist/components/date-picker/_utils/index.d.ts +1 -2
  19. package/dist/components/date-picker/_utils/index.js +1 -2
  20. package/dist/components/date-picker/_utils/is-timestamp.js +1 -1
  21. package/dist/components/date-picker/_utils/parse-value.js +1 -1
  22. package/dist/components/date-picker/_utils/picker-type.js +1 -1
  23. package/dist/components/date-picker/constants.d.ts +2 -0
  24. package/dist/components/date-picker/foundation.d.ts +3 -4
  25. package/dist/components/date-picker/foundation.js +8 -3
  26. package/dist/components/date-picker/input-foundation.d.ts +1 -0
  27. package/dist/components/date-picker/input-foundation.js +1 -1
  28. package/dist/components/date-picker/month-foundation.d.ts +1 -1
  29. package/dist/components/date-picker/month-foundation.js +1 -0
  30. package/dist/components/date-picker/months-grid-foundation.d.ts +1 -1
  31. package/dist/components/date-picker/months-grid-foundation.js +1 -1
  32. package/dist/components/descriptions/constants.d.ts +3 -1
  33. package/dist/components/dropdown/constants.d.ts +2 -0
  34. package/dist/components/dropdown/menu-foundation.d.ts +1 -1
  35. package/dist/components/empty/constants.d.ts +3 -1
  36. package/dist/components/feedback/constants.d.ts +3 -1
  37. package/dist/components/highlight/constants.d.ts +3 -1
  38. package/dist/components/image/constants.d.ts +5 -1
  39. package/dist/components/image/preview-inner-foundation.js +6 -15
  40. package/dist/components/input/constants.d.ts +5 -1
  41. package/dist/components/input-number/constants.d.ts +3 -1
  42. package/dist/components/modal/constants.d.ts +3 -1
  43. package/dist/components/modal/modal-content-foundation.d.ts +3 -3
  44. package/dist/components/modal/modal-content-foundation.js +5 -3
  45. package/dist/components/modal/modal-foundation.d.ts +0 -2
  46. package/dist/components/modal/modal-foundation.js +6 -16
  47. package/dist/components/navigation/constants.d.ts +4 -0
  48. package/dist/components/overflow-list/constants.d.ts +2 -0
  49. package/dist/components/pagination/foundation.d.ts +1 -1
  50. package/dist/components/popconfirm/constants.d.ts +3 -1
  51. package/dist/components/popover/constants.d.ts +2 -0
  52. package/dist/components/radio/constants.d.ts +3 -1
  53. package/dist/components/scroll-list/item-foundation.js +1 -0
  54. package/dist/components/select/constants.d.ts +2 -0
  55. package/dist/components/select/foundation.d.ts +1 -4
  56. package/dist/components/select/foundation.js +31 -56
  57. package/dist/components/select/select.css +3 -3
  58. package/dist/components/select/select.scss +8 -3
  59. package/dist/components/side-sheet/constants.d.ts +2 -0
  60. package/dist/components/side-sheet/side-sheet-foundation.d.ts +6 -4
  61. package/dist/components/side-sheet/side-sheet-foundation.js +33 -23
  62. package/dist/components/slider/constants.d.ts +3 -1
  63. package/dist/components/slider/foundation.d.ts +7 -7
  64. package/dist/components/slider/foundation.js +9 -6
  65. package/dist/components/spin/constants.d.ts +3 -1
  66. package/dist/components/table/constants.d.ts +2 -0
  67. package/dist/components/tabs/constants.d.ts +2 -0
  68. package/dist/components/tabs/foundation.js +19 -60
  69. package/dist/components/time-picker/combobox-options.js +1 -1
  70. package/dist/components/time-picker/constants.d.ts +2 -0
  71. package/dist/components/time-picker/foundation.d.ts +3 -1
  72. package/dist/components/time-picker/foundation.js +7 -1
  73. package/dist/components/tooltip/constants.d.ts +2 -0
  74. package/dist/components/tooltip/foundation.d.ts +13 -15
  75. package/dist/components/tooltip/foundation.js +54 -15
  76. package/dist/components/tree/constants.d.ts +2 -0
  77. package/dist/components/tree/foundation.d.ts +17 -3
  78. package/dist/components/tree/foundation.js +37 -2
  79. package/dist/components/tree/shared.d.ts +37 -0
  80. package/dist/components/tree/shared.js +42 -1
  81. package/dist/components/tree-select/constants.d.ts +2 -0
  82. package/dist/components/tree-select/foundation.d.ts +15 -10
  83. package/dist/components/tree-select/foundation.js +44 -7
  84. package/dist/components/upload/constants.d.ts +4 -2
  85. package/dist/components/upload/utils.d.ts +5 -0
  86. package/dist/components/upload/utils.js +8 -2
  87. package/dist/components/video-player/foundation.js +1 -1
  88. package/dist/components/video-player/utils.d.ts +0 -2
  89. package/dist/components/video-player/utils.js +1 -14
  90. package/dist/locale/interface.d.ts +2 -0
  91. package/dist/locale/source/en_US.js +1 -0
  92. package/dist/locale/source/zh_CN.js +1 -0
  93. package/dist/utils/a11y.d.ts +9 -0
  94. package/dist/utils/a11y.js +19 -1
  95. package/dist/utils/date-fns-extra.d.ts +1 -0
  96. package/dist/utils/date-fns-extra.js +4 -1
  97. package/dist/utils/index.d.ts +3 -2
  98. package/dist/utils/index.js +3 -2
  99. package/dist/utils/media.d.ts +2 -0
  100. package/dist/utils/media.js +15 -0
  101. package/package.json +2 -2
  102. package/dist/components/date-picker/_utils/is-valid-date.d.ts +0 -1
  103. package/dist/components/date-picker/_utils/is-valid-date.js +0 -5
@@ -1,3 +1,4 @@
1
+ export declare function isValidDate(date: any): boolean;
1
2
  /**
2
3
  * The Intl time zone for a Semi time zone value: an offset in hours or a GMT±HH:MM string becomes the fixed ±HH:MM
3
4
  * offset Intl accepts, which never shifts for DST; any other string is used as is, normally an IANA name
@@ -2,6 +2,9 @@ import { TZDate, tzOffset } from "@date-fns/tz";
2
2
  import { parseISO, toDate } from "date-fns";
3
3
  // src/utils/date-fns-extra.ts
4
4
  const GMTStringReg = /[-+]\d{2}:\d{2}/;
5
+ function isValidDate(date) {
6
+ return date && Object.prototype.toString.call(date) === "[object Date]" && !isNaN(date);
7
+ }
5
8
  /**
6
9
  * The Intl time zone for a Semi time zone value: an offset in hours or a GMT±HH:MM string becomes the fixed ±HH:MM
7
10
  * offset Intl accepts, which never shifts for DST; any other string is used as is, normally an IANA name
@@ -103,4 +106,4 @@ function zonedTimeToUtc(date, timeZone) {
103
106
  if (!ianaTimeZone && typeof date === "string" && !/(Z|[+-]\d{2}(:?\d{2})?)$/.test(date)) return dateValue;
104
107
  return new Date(wallTimeToInstant(wallTimeAsUtc(dateValue), ianaTimeZone));
105
108
  }
106
- export { isValidTimezoneIANAString, toIANA, utcToZonedTime, zonedTimeToUtc };
109
+ export { isValidDate, isValidTimezoneIANAString, toIANA, utcToZonedTime, zonedTimeToUtc };
@@ -1,4 +1,4 @@
1
- import { ListNavigationOptions, Typeahead, crossesFocusBoundary, getEnabledStepIndex, getListTargetIndex, handlePrevent, isAriaKey, isInnerControl, isInnerControlActivation, isInnerControlKey, isNativeInputKey, isTextEditor, joinIds, namedRole, setFocusToFirstItem, setFocusToItem, setFocusToLastItem, stopButtonActivationKeys, warnIfDialogUnnamed } from "./a11y.js";
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";
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";
@@ -19,6 +19,7 @@ import isPromise from "./is-promise.js";
19
19
  import isValidTimeZone from "./is-valid-time-zone.js";
20
20
  import { ENTER_KEY, ESC_KEY, isComposing } from "./key-code.js";
21
21
  import { KEEP_INTERACTIVE_ATTRIBUTE, Layer, POPUP_ID_ATTRIBUTE, POPUP_SELECTOR, containsWithPopups, getPopupTrigger, openLayer, popupTriggerSelector, popupTriggers } from "./layer.js";
22
+ import { ignoreExpectedMediaErrors } from "./media.js";
22
23
  import { get, has, isEmpty, remove, set } from "./object.js";
23
24
  import { isSecondaryPress } from "./pointer.js";
24
25
  import { lockBodyScroll } from "./scroll-lock.js";
@@ -28,4 +29,4 @@ import { Easing, TweenOptions, easeInOutCubic, linear, tween } from "./tween.js"
28
29
  import { ArrayElement, Size } from "./type.js";
29
30
  import { createId } from "./uuid.js";
30
31
  import warning, { isDev } from "./warning.js";
31
- 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, getPopupTrigger, handlePrevent, handoverFocus, has, isAriaKey, 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, scrollIntoViewWithin, set, setFocusToFirstItem, setFocusToItem, setFocusToLastItem, shallowEqualObjects, stopButtonActivationKeys, supportsFieldSizing, supportsFocusVisibleOption, supportsScrollContainerOption, 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, 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, toCssLength, tween, warnIfDialogUnnamed, warning, withOrderSort };
@@ -1,4 +1,4 @@
1
- import { Typeahead, crossesFocusBoundary, getEnabledStepIndex, getListTargetIndex, handlePrevent, isAriaKey, isInnerControl, isInnerControlActivation, isInnerControlKey, isNativeInputKey, isTextEditor, joinIds, namedRole, setFocusToFirstItem, setFocusToItem, setFocusToLastItem, stopButtonActivationKeys, warnIfDialogUnnamed } from "./a11y.js";
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";
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";
@@ -19,6 +19,7 @@ import isPromise from "./is-promise.js";
19
19
  import isValidTimeZone from "./is-valid-time-zone.js";
20
20
  import { ENTER_KEY, ESC_KEY, isComposing } from "./key-code.js";
21
21
  import { KEEP_INTERACTIVE_ATTRIBUTE, POPUP_ID_ATTRIBUTE, POPUP_SELECTOR, containsWithPopups, getPopupTrigger, openLayer, popupTriggerSelector, popupTriggers } from "./layer.js";
22
+ import { ignoreExpectedMediaErrors } from "./media.js";
22
23
  import { get, has, isEmpty, remove, set } from "./object.js";
23
24
  import { isSecondaryPress } from "./pointer.js";
24
25
  import { lockBodyScroll } from "./scroll-lock.js";
@@ -27,4 +28,4 @@ import { focusWithoutRing, scrollIntoViewWithin, supportsFocusVisibleOption, sup
27
28
  import { easeInOutCubic, linear, tween } from "./tween.js";
28
29
  import { createId } from "./uuid.js";
29
30
  import warning, { isDev } from "./warning.js";
30
- 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, getPopupTrigger, handlePrevent, handoverFocus, has, isAriaKey, 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, scrollIntoViewWithin, set, setFocusToFirstItem, setFocusToItem, setFocusToLastItem, shallowEqualObjects, stopButtonActivationKeys, supportsFieldSizing, supportsFocusVisibleOption, supportsScrollContainerOption, 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, 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, toCssLength, tween, warnIfDialogUnnamed, warning, withOrderSort };
@@ -0,0 +1,2 @@
1
+ /** Drops the rejections a media request is expected to meet in normal use; any other rejection stays a rejection. */
2
+ export declare function ignoreExpectedMediaErrors(request: Promise<unknown>): Promise<void>;
@@ -0,0 +1,15 @@
1
+ // src/utils/media.ts
2
+ const EXPECTED_MEDIA_ERRORS = /* @__PURE__ */ new Set([
3
+ "AbortError",
4
+ "NotAllowedError",
5
+ "InvalidStateError",
6
+ "NotSupportedError"
7
+ ]);
8
+ /** Drops the rejections a media request is expected to meet in normal use; any other rejection stays a rejection. */
9
+ function ignoreExpectedMediaErrors(request) {
10
+ return request.then(() => void 0, (error) => {
11
+ if (error instanceof DOMException && EXPECTED_MEDIA_ERRORS.has(error.name)) return;
12
+ throw error;
13
+ });
14
+ }
15
+ export { ignoreExpectedMediaErrors };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fibrae/semi-foundation",
3
- "version": "0.6.0",
3
+ "version": "0.7.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.6.0",
31
+ "@fibrae/semi-json-viewer-core": "0.7.0",
32
32
  "@mdx-js/mdx": "^3.1.1",
33
33
  "@shikijs/core": "^4.6.0",
34
34
  "clsx": "^2.1.1",
@@ -1 +0,0 @@
1
- export default function isValidDate(date: any): boolean;
@@ -1,5 +0,0 @@
1
- // src/components/date-picker/_utils/is-valid-date.ts
2
- function isValidDate(date) {
3
- return date && Object.prototype.toString.call(date) === "[object Date]" && !isNaN(date);
4
- }
5
- export { isValidDate as default };