@box/blueprint-web 16.8.3 → 16.8.5

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 (88) hide show
  1. package/THIRD_PARTY_LICENSES +0 -50
  2. package/dist/lib-esm/accordion/accordion.module.js +1 -1
  3. package/dist/lib-esm/avatar/avatar.module.js +1 -1
  4. package/dist/lib-esm/badge/base-badge.js +1 -1
  5. package/dist/lib-esm/badge/base-badge.module.js +1 -1
  6. package/dist/lib-esm/badge/icon-badge.js +1 -1
  7. package/dist/lib-esm/branding-styles/utils/createTheme.d.ts +16 -16
  8. package/dist/lib-esm/branding-styles/utils/createTheme.js +5 -6
  9. package/dist/lib-esm/breadcrumb/breadcrumb.js +1 -1
  10. package/dist/lib-esm/breadcrumb/useFolderTreeTruncation.js +1 -1
  11. package/dist/lib-esm/card-tooltip/card-tooltip.module.js +1 -1
  12. package/dist/lib-esm/checkbox/checkbox.module.js +1 -1
  13. package/dist/lib-esm/circular-progress/circular-progress.module.js +1 -1
  14. package/dist/lib-esm/combobox/combobox.module.js +1 -1
  15. package/dist/lib-esm/combobox-group/combobox-group.module.js +1 -1
  16. package/dist/lib-esm/content-card/content-card.module.js +1 -1
  17. package/dist/lib-esm/data-table/cell/sticky-cell.module.js +1 -1
  18. package/dist/lib-esm/data-table/data-table.module.js +1 -1
  19. package/dist/lib-esm/date-picker/date-picker.module.js +1 -1
  20. package/dist/lib-esm/elemental-breadcrumb/elemental-breadcrumb.module.js +1 -1
  21. package/dist/lib-esm/empty-state/empty-state.module.js +1 -1
  22. package/dist/lib-esm/index.css +1833 -1833
  23. package/dist/lib-esm/inline-trigger-button/inline-trigger-button.module.js +1 -1
  24. package/dist/lib-esm/input-chip/input-chip.module.js +1 -1
  25. package/dist/lib-esm/list-item/index.js +0 -1
  26. package/dist/lib-esm/list-item/table.js +1 -1
  27. package/dist/lib-esm/list-item/utils/column-visibility-context/useThrottledContainerResize.js +1 -1
  28. package/dist/lib-esm/loading-indicator/loading-indicator.module.js +1 -1
  29. package/dist/lib-esm/modal/modal.module.js +1 -1
  30. package/dist/lib-esm/page/page.figma.d.ts +1 -0
  31. package/dist/lib-esm/page/page.module.js +1 -1
  32. package/dist/lib-esm/page-section/page-section.module.js +1 -1
  33. package/dist/lib-esm/password-input/password-input.module.js +1 -1
  34. package/dist/lib-esm/primitives/base-button/base-button.module.js +1 -1
  35. package/dist/lib-esm/primitives/base-text-input/base-text-input.module.js +1 -1
  36. package/dist/lib-esm/primitives/calendar/calendar.module.js +1 -1
  37. package/dist/lib-esm/primitives/context-menu/context-menu-sub-menu-root.js +0 -1
  38. package/dist/lib-esm/primitives/context-menu/context-menu.module.js +1 -1
  39. package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-menu-root.js +0 -1
  40. package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu.module.js +1 -1
  41. package/dist/lib-esm/primitives/inline-error/utils/use-inline-error-presence.js +1 -1
  42. package/dist/lib-esm/primitives/menu-combobox/menu-combobox.module.js +1 -1
  43. package/dist/lib-esm/primitives/notification/notification-provider.js +8 -3
  44. package/dist/lib-esm/primitives/notification/notification.module.js +1 -1
  45. package/dist/lib-esm/primitives/popover/popover.module.js +1 -1
  46. package/dist/lib-esm/primitives/select-menu-grid/select-menu-grid-option.js +1 -1
  47. package/dist/lib-esm/primitives/select-menu-grid/select-menu-grid-option.module.js +1 -1
  48. package/dist/lib-esm/primitives/select-menu-grid/select-menu-grid.js +1 -1
  49. package/dist/lib-esm/primitives/tabs/tabs.module.js +1 -1
  50. package/dist/lib-esm/progress-bar/progress-bar.module.js +1 -1
  51. package/dist/lib-esm/radio-group/radio-group.module.js +1 -1
  52. package/dist/lib-esm/select/select.module.js +1 -1
  53. package/dist/lib-esm/side-panel/side-panel.module.js +1 -1
  54. package/dist/lib-esm/switch/switch.module.js +1 -1
  55. package/dist/lib-esm/text/text.module.js +1 -1
  56. package/dist/lib-esm/text/types.d.ts +1 -1
  57. package/dist/lib-esm/text-area/text-area-autosize/text-area-autosize.module.js +1 -1
  58. package/dist/lib-esm/text-area/text-area.module.js +1 -1
  59. package/dist/lib-esm/text-button/text-button.module.js +1 -1
  60. package/dist/lib-esm/text-input/text-input.module.js +1 -1
  61. package/dist/lib-esm/time-picker/time-picker.module.js +1 -1
  62. package/dist/lib-esm/toolbar/toolbar.module.js +1 -1
  63. package/dist/lib-esm/toolbar/utils/horizontal-scroll-context.js +1 -1
  64. package/dist/lib-esm/toolbar/utils/use-scroll-state.js +1 -1
  65. package/dist/lib-esm/tooltip/tooltip.module.js +1 -1
  66. package/dist/lib-esm/trigger-button/trigger-button.module.js +1 -1
  67. package/dist/lib-esm/util-components/base-grid-list-item/base-grid-list-item.js +1 -1
  68. package/dist/lib-esm/util-components/base-grid-list-item/base-grid-list-item.module.js +1 -1
  69. package/dist/lib-esm/util-components/base-grid-list-item/base-grid-list.js +1 -1
  70. package/dist/lib-esm/util-components/interactive-icon/interactive-icon.module.js +1 -1
  71. package/dist/lib-esm/util-components/scrollable-container/scrollable-container.d.ts +1 -1
  72. package/dist/lib-esm/util-components/scrollable-container/scrollable-container.js +1 -1
  73. package/dist/lib-esm/utils/chunk.d.ts +5 -0
  74. package/dist/lib-esm/utils/chunk.js +17 -0
  75. package/dist/lib-esm/utils/deepMerge.d.ts +13 -0
  76. package/dist/lib-esm/utils/deepMerge.js +70 -0
  77. package/dist/lib-esm/utils/isDefined.js +1 -3
  78. package/dist/lib-esm/utils/mapValues.d.ts +7 -0
  79. package/dist/lib-esm/utils/mapValues.js +20 -0
  80. package/dist/lib-esm/utils/noop.d.ts +1 -0
  81. package/dist/lib-esm/utils/noop.js +5 -0
  82. package/dist/lib-esm/utils/omit.d.ts +6 -0
  83. package/dist/lib-esm/utils/omit.js +20 -0
  84. package/dist/lib-esm/utils/scroll-context.js +1 -1
  85. package/dist/lib-esm/utils/throttle.d.ts +11 -0
  86. package/dist/lib-esm/utils/throttle.js +51 -0
  87. package/dist/lib-esm/utils/useIsEllipsized.js +1 -1
  88. package/package.json +4 -4
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Splits `array` into groups of length `size`. The final group holds the remaining
3
+ * elements. Mirrors `lodash/chunk`: a size below 1 yields an empty array.
4
+ */
5
+ const chunk = (array, size = 1) => {
6
+ const chunkSize = Math.max(Math.trunc(size), 0);
7
+ if (!Array.isArray(array) || chunkSize < 1) {
8
+ return [];
9
+ }
10
+ const result = [];
11
+ for (let i = 0; i < array.length; i += chunkSize) {
12
+ result.push(array.slice(i, i + chunkSize));
13
+ }
14
+ return result;
15
+ };
16
+
17
+ export { chunk };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Recursively merges own enumerable properties of the `sources` into `target`, mutating and
3
+ * returning `target`. Covers the plain-object usage of `lodash/merge` in this package:
4
+ * undefined source values are skipped and source objects are never mutated. React elements
5
+ * (and other `$$typeof`-tagged objects) are treated as opaque values rather than merged.
6
+ *
7
+ * `target` and the sources are constrained to objects: primitives cannot be mutated in place and
8
+ * would fail at runtime. A nullish `target` is returned unchanged (nothing is merged), so callers
9
+ * holding a possibly-undefined target (e.g. `Map.get()`) must narrow it before merging into it.
10
+ */
11
+ export declare function deepMerge<TObject extends object, TSource extends object>(target: TObject, source: TSource): TObject & TSource;
12
+ export declare function deepMerge<TObject extends object, TSource1 extends object, TSource2 extends object>(target: TObject, source1: TSource1, source2: TSource2): TObject & TSource1 & TSource2;
13
+ export declare function deepMerge<TTarget extends null | undefined>(target: TTarget, ...sources: object[]): TTarget;
@@ -0,0 +1,70 @@
1
+ // Keys that can mutate an object's prototype chain (prototype pollution). Sources passed to
2
+ // deepMerge are not guaranteed to be trusted (e.g. caller-provided notification props), so these
3
+ // are never copied or merged onto the target.
4
+ const UNSAFE_KEYS = new Set(['__proto__', 'constructor', 'prototype']);
5
+ const isUnsafeKey = key => UNSAFE_KEYS.has(key);
6
+ const isPlainObject = value => {
7
+ if (typeof value !== 'object' || value === null) {
8
+ return false;
9
+ }
10
+ // Never recurse into React elements (or other tagged objects): treat them as opaque values.
11
+ if ('$$typeof' in value) {
12
+ return false;
13
+ }
14
+ const proto = Object.getPrototypeOf(value);
15
+ return proto === Object.prototype || proto === null;
16
+ };
17
+ const cloneDeep = value => {
18
+ if (Array.isArray(value)) {
19
+ return value.map(cloneDeep);
20
+ }
21
+ if (isPlainObject(value)) {
22
+ const output = {};
23
+ for (const key of Object.keys(value)) {
24
+ if (isUnsafeKey(key)) {
25
+ continue; // eslint-disable-line no-continue
26
+ }
27
+ output[key] = cloneDeep(value[key]);
28
+ }
29
+ return output;
30
+ }
31
+ return value;
32
+ };
33
+ const mergeInto = (target, source) => {
34
+ for (const key of Object.keys(source)) {
35
+ // Skip prototype-polluting keys before touching the target.
36
+ if (isUnsafeKey(key)) {
37
+ continue; // eslint-disable-line no-continue
38
+ }
39
+ const sourceValue = source[key];
40
+ // Matches lodash/merge: undefined source values never overwrite an existing value.
41
+ if (sourceValue === undefined) {
42
+ continue; // eslint-disable-line no-continue
43
+ }
44
+ const targetValue = target[key];
45
+ if (isPlainObject(sourceValue)) {
46
+ if (isPlainObject(targetValue)) {
47
+ mergeInto(targetValue, sourceValue);
48
+ } else {
49
+ // Clone so the merged result never shares references with (and cannot mutate) a source.
50
+ target[key] = cloneDeep(sourceValue);
51
+ }
52
+ } else {
53
+ target[key] = sourceValue;
54
+ }
55
+ }
56
+ };
57
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, no-redeclare -- overload implementation
58
+ function deepMerge(target, ...sources) {
59
+ if (target == null) {
60
+ return target;
61
+ }
62
+ for (const source of sources) {
63
+ if (source != null) {
64
+ mergeInto(target, source);
65
+ }
66
+ }
67
+ return target;
68
+ }
69
+
70
+ export { deepMerge };
@@ -1,8 +1,6 @@
1
- import isUndefined from 'lodash/isUndefined';
2
-
3
1
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
2
  const isDefined = value => {
5
- return !isUndefined(value);
3
+ return value !== undefined;
6
4
  };
7
5
 
8
6
  export { isDefined };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Creates a new object with the same keys as `object`, running each own enumerable
3
+ * value through `iteratee`. Mirrors `lodash/mapValues`: a nullish input yields `{}`.
4
+ * The iteratee value is intentionally `any` to match lodash's permissive typing so that
5
+ * existing call sites compile unchanged under `strictFunctionTypes`.
6
+ */
7
+ export declare const mapValues: <T extends object, R>(object: T | null | undefined, iteratee: (value: any, key: string, collection: T) => R) => { [K in keyof T]: R; };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Creates a new object with the same keys as `object`, running each own enumerable
3
+ * value through `iteratee`. Mirrors `lodash/mapValues`: a nullish input yields `{}`.
4
+ * The iteratee value is intentionally `any` to match lodash's permissive typing so that
5
+ * existing call sites compile unchanged under `strictFunctionTypes`.
6
+ */
7
+ const mapValues = (object,
8
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
+ iteratee) => {
10
+ const result = {};
11
+ if (object == null) {
12
+ return result;
13
+ }
14
+ for (const key of Object.keys(object)) {
15
+ result[key] = iteratee(object[key], key, object);
16
+ }
17
+ return result;
18
+ };
19
+
20
+ export { mapValues };
@@ -0,0 +1 @@
1
+ export declare const noop: () => void;
@@ -0,0 +1,5 @@
1
+ const noop = () => {
2
+ // Intentionally does nothing. Local replacement for `lodash/noop`.
3
+ };
4
+
5
+ export { noop };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Returns a shallow copy of `object` without the given top-level `keys`.
3
+ * Covers the flat-key usage of `lodash/omit` in this package (no deep paths). Keys that
4
+ * are not present on `object` are ignored, mirroring lodash's permissive behavior.
5
+ */
6
+ export declare const omit: <T extends object>(object: T | null | undefined, keys: readonly PropertyKey[]) => Partial<T>;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Returns a shallow copy of `object` without the given top-level `keys`.
3
+ * Covers the flat-key usage of `lodash/omit` in this package (no deep paths). Keys that
4
+ * are not present on `object` are ignored, mirroring lodash's permissive behavior.
5
+ */
6
+ const omit = (object, keys) => {
7
+ const result = {};
8
+ if (object == null) {
9
+ return result;
10
+ }
11
+ const excluded = new Set(keys);
12
+ for (const key of Object.keys(object)) {
13
+ if (!excluded.has(key)) {
14
+ result[key] = object[key];
15
+ }
16
+ }
17
+ return result;
18
+ };
19
+
20
+ export { omit };
@@ -1,6 +1,6 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import noop from 'lodash/noop';
3
2
  import { useContext, createContext, useState, useCallback, useMemo } from 'react';
3
+ import { noop } from './noop.js';
4
4
 
5
5
  const ScrollContext = /*#__PURE__*/createContext({
6
6
  isScrolledUnderFooter: false,
@@ -0,0 +1,11 @@
1
+ export interface ThrottledFunction<Args extends unknown[]> {
2
+ (...args: Args): void;
3
+ cancel(): void;
4
+ }
5
+ /**
6
+ * Leading + trailing edge throttle, matching the default behavior of `lodash/throttle`
7
+ * for the subset of the API used in this package. The wrapped function is invoked
8
+ * immediately on the first call, then at most once per `wait` ms, and once more on the
9
+ * trailing edge with the most recent arguments.
10
+ */
11
+ export declare const throttle: <Args extends unknown[]>(func: (...args: Args) => void, wait?: number) => ThrottledFunction<Args>;
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Leading + trailing edge throttle, matching the default behavior of `lodash/throttle`
3
+ * for the subset of the API used in this package. The wrapped function is invoked
4
+ * immediately on the first call, then at most once per `wait` ms, and once more on the
5
+ * trailing edge with the most recent arguments.
6
+ */
7
+ const throttle = (func, wait = 0) => {
8
+ let lastInvokeTime;
9
+ let timeout;
10
+ let trailingArgs;
11
+ const invoke = (time, args) => {
12
+ lastInvokeTime = time;
13
+ func(...args);
14
+ };
15
+ const throttled = (...args) => {
16
+ const now = Date.now();
17
+ if (lastInvokeTime === undefined) {
18
+ invoke(now, args);
19
+ return;
20
+ }
21
+ const remaining = wait - (now - lastInvokeTime);
22
+ trailingArgs = args;
23
+ if (remaining <= 0) {
24
+ if (timeout) {
25
+ clearTimeout(timeout);
26
+ timeout = undefined;
27
+ }
28
+ invoke(now, args);
29
+ trailingArgs = undefined;
30
+ } else if (!timeout) {
31
+ timeout = setTimeout(() => {
32
+ timeout = undefined;
33
+ if (trailingArgs) {
34
+ invoke(Date.now(), trailingArgs);
35
+ trailingArgs = undefined;
36
+ }
37
+ }, remaining);
38
+ }
39
+ };
40
+ throttled.cancel = () => {
41
+ if (timeout) {
42
+ clearTimeout(timeout);
43
+ }
44
+ timeout = undefined;
45
+ lastInvokeTime = undefined;
46
+ trailingArgs = undefined;
47
+ };
48
+ return throttled;
49
+ };
50
+
51
+ export { throttle };
@@ -1,5 +1,5 @@
1
- import noop from 'lodash/noop';
2
1
  import { useState, useEffect } from 'react';
2
+ import { noop } from './noop.js';
3
3
 
4
4
  const useIsEllipsized = ref => {
5
5
  const [isEllipsized, setIsEllipsized] = useState(false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/blueprint-web",
3
- "version": "16.8.3",
3
+ "version": "16.8.5",
4
4
  "type": "module",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "publishConfig": {
@@ -47,7 +47,7 @@
47
47
  "dependencies": {
48
48
  "@ariakit/react": "0.4.21",
49
49
  "@ariakit/react-core": "0.4.21",
50
- "@box/blueprint-web-assets": "^5.5.1",
50
+ "@box/blueprint-web-assets": "^5.5.3",
51
51
  "@internationalized/date": "^3.12.0",
52
52
  "@radix-ui/react-accordion": "1.1.2",
53
53
  "@radix-ui/react-checkbox": "1.0.4",
@@ -71,16 +71,16 @@
71
71
  "@react-aria/utils": "3.33.1",
72
72
  "clsx": "^1.2.1",
73
73
  "color": "2.0.1",
74
- "lodash": "^4.17.15",
75
74
  "react-aria": "3.47.0",
76
75
  "react-aria-components": "1.16.0",
77
76
  "type-fest": "^3.2.0"
78
77
  },
79
78
  "devDependencies": {
80
- "@box/storybook-utils": "^1.1.25",
79
+ "@box/storybook-utils": "^1.1.27",
81
80
  "@figma/code-connect": "1.4.4",
82
81
  "@types/react": "^18.0.0",
83
82
  "@types/react-dom": "^18.0.0",
83
+ "lodash": "^4.17.15",
84
84
  "react": "^18.3.0",
85
85
  "react-dom": "^18.3.0",
86
86
  "react-stately": "^3.45.0",