@eightshift/ui-components 3.0.1 → 5.0.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 (144) hide show
  1. package/package.json +101 -101
  2. package/dist/Button-BPLceDeW.js +0 -185
  3. package/dist/Collection-CZxddMZS.js +0 -2332
  4. package/dist/Color-MV5kBVXr.js +0 -2452
  5. package/dist/ColorSwatch-BqQfVu4L.js +0 -64
  6. package/dist/ComboBox-_RfyhwZw.js +0 -1906
  7. package/dist/Dialog-8tYeQ9n4.js +0 -2300
  8. package/dist/FieldError-52GVSGgC.js +0 -42
  9. package/dist/FocusScope-Cri5BFRz.js +0 -831
  10. package/dist/Form-Cq3fu75_.js +0 -5
  11. package/dist/Group-_emcIVxI.js +0 -48
  12. package/dist/Heading-B2153VXe.js +0 -16
  13. package/dist/Hidden-rE6uR-lr.js +0 -41
  14. package/dist/Input-BxpFEIXV.js +0 -133
  15. package/dist/Label-icmbmNdI.js +0 -17
  16. package/dist/List-CZMUbkFU.js +0 -593
  17. package/dist/ListBox-Ca6hiCqz.js +0 -581
  18. package/dist/NumberFormatter-DA8u1Ot7.js +0 -140
  19. package/dist/OverlayArrow-CYXQSlEU.js +0 -629
  20. package/dist/RSPContexts-2lR5GG9p.js +0 -14
  21. package/dist/Select-aab027f3.esm-PDJCDE95.js +0 -2469
  22. package/dist/Separator-4IIDRlV_.js +0 -322
  23. package/dist/Slider-rz2XRMGm.js +0 -853
  24. package/dist/Text-DVSAPY-K.js +0 -16
  25. package/dist/VisuallyHidden-f9zX67a_.js +0 -48
  26. package/dist/_commonjsHelpers-CUmg6egw.js +0 -6
  27. package/dist/assets/index.css +0 -37
  28. package/dist/assets/style-admin.css +0 -5255
  29. package/dist/assets/style-editor.css +0 -5255
  30. package/dist/assets/style.css +0 -5261
  31. package/dist/assets/wp-font-enhancements.css +0 -8
  32. package/dist/assets/wp-ui-enhancements.css +0 -299
  33. package/dist/components/animated-visibility/animated-visibility.js +0 -105
  34. package/dist/components/base-control/base-control.js +0 -86
  35. package/dist/components/breakpoint-preview/breakpoint-preview.js +0 -161
  36. package/dist/components/button/button.js +0 -387
  37. package/dist/components/checkbox/checkbox.js +0 -320
  38. package/dist/components/color-pickers/color-picker.js +0 -272
  39. package/dist/components/color-pickers/color-swatch.js +0 -58
  40. package/dist/components/color-pickers/gradient-editor.js +0 -534
  41. package/dist/components/color-pickers/solid-color-picker.js +0 -1567
  42. package/dist/components/component-toggle/component-toggle.js +0 -158
  43. package/dist/components/container-panel/container-panel.js +0 -131
  44. package/dist/components/draggable/draggable-context.js +0 -5
  45. package/dist/components/draggable/draggable-handle.js +0 -46
  46. package/dist/components/draggable/draggable.js +0 -6207
  47. package/dist/components/draggable-list/draggable-list-context.js +0 -5
  48. package/dist/components/draggable-list/draggable-list-item.js +0 -77
  49. package/dist/components/draggable-list/draggable-list.js +0 -151
  50. package/dist/components/expandable/expandable.js +0 -342
  51. package/dist/components/index.js +0 -137
  52. package/dist/components/input-field/input-field.js +0 -231
  53. package/dist/components/item-collection/item-collection.js +0 -59
  54. package/dist/components/layout/hstack.js +0 -30
  55. package/dist/components/layout/vstack.js +0 -30
  56. package/dist/components/link-input/link-input.js +0 -293
  57. package/dist/components/matrix-align/matrix-align.js +0 -134
  58. package/dist/components/menu/menu.js +0 -285
  59. package/dist/components/modal/modal.js +0 -305
  60. package/dist/components/notice/notice.js +0 -123
  61. package/dist/components/number-picker/number-picker.js +0 -292
  62. package/dist/components/option-select/option-select.js +0 -264
  63. package/dist/components/options-panel/options-panel.js +0 -158
  64. package/dist/components/placeholders/file-placeholder.js +0 -42
  65. package/dist/components/placeholders/image-placeholder.js +0 -88
  66. package/dist/components/placeholders/media-placeholder.js +0 -63
  67. package/dist/components/popover/popover.js +0 -207
  68. package/dist/components/radio/radio.js +0 -579
  69. package/dist/components/repeater/repeater-context.js +0 -5
  70. package/dist/components/repeater/repeater-item.js +0 -119
  71. package/dist/components/repeater/repeater.js +0 -280
  72. package/dist/components/responsive/mini-responsive.js +0 -498
  73. package/dist/components/responsive/responsive-legacy.js +0 -343
  74. package/dist/components/responsive/responsive.js +0 -580
  75. package/dist/components/responsive-preview/responsive-preview.js +0 -123
  76. package/dist/components/rich-label/rich-label.js +0 -66
  77. package/dist/components/select/async-multi-select.js +0 -157
  78. package/dist/components/select/async-single-select.js +0 -137
  79. package/dist/components/select/custom-select-default-components.js +0 -38
  80. package/dist/components/select/multi-select-components.js +0 -8
  81. package/dist/components/select/multi-select.js +0 -151
  82. package/dist/components/select/react-select-component-wrappers.js +0 -90
  83. package/dist/components/select/shared.js +0 -26
  84. package/dist/components/select/single-select.js +0 -131
  85. package/dist/components/select/styles.js +0 -49
  86. package/dist/components/select/v2/async-select.js +0 -297
  87. package/dist/components/select/v2/shared.js +0 -24
  88. package/dist/components/select/v2/single-select.js +0 -990
  89. package/dist/components/slider/column-config-slider.js +0 -210
  90. package/dist/components/slider/slider.js +0 -343
  91. package/dist/components/slider/utils.js +0 -84
  92. package/dist/components/spacer/spacer.js +0 -97
  93. package/dist/components/tabs/tabs.js +0 -702
  94. package/dist/components/toggle/switch.js +0 -155
  95. package/dist/components/toggle/toggle.js +0 -64
  96. package/dist/components/toggle-button/toggle-button.js +0 -324
  97. package/dist/components/tooltip/tooltip.js +0 -525
  98. package/dist/context-D2KUdwNL.js +0 -92
  99. package/dist/default-i18n-CT_oS1Fy.js +0 -922
  100. package/dist/filterDOMProps-EDDcM64A.js +0 -28
  101. package/dist/icons/block-icon.js +0 -42
  102. package/dist/icons/generic-color-swatch.js +0 -113
  103. package/dist/icons/icons.js +0 -30371
  104. package/dist/icons/index.js +0 -11
  105. package/dist/icons/jsx-svg.js +0 -50
  106. package/dist/index-641ee5b8.esm-DIuJijyT.js +0 -3137
  107. package/dist/index-BKGQ6jGS.js +0 -44
  108. package/dist/index-CFozsmNS.js +0 -28321
  109. package/dist/index.js +0 -139
  110. package/dist/lite-DVmmD_-j.js +0 -7
  111. package/dist/modifiers.esm-BuJQPI1X.js +0 -31
  112. package/dist/multi-select-components-Sp-JEFEX.js +0 -3744
  113. package/dist/number-GajL10e1.js +0 -36
  114. package/dist/react-jsx-parser.min-DZCiis5V.js +0 -11753
  115. package/dist/react-select-async.esm-Bql4G5iV.js +0 -107
  116. package/dist/react-select.esm-B_TudhTU.js +0 -15
  117. package/dist/style-admin.js +0 -1
  118. package/dist/style-editor.js +0 -1
  119. package/dist/style.js +0 -1
  120. package/dist/textSelection-0UUS8Yfg.js +0 -46
  121. package/dist/useButton-Cg474OYB.js +0 -71
  122. package/dist/useEvent-B0b-6KBr.js +0 -23
  123. package/dist/useFocusRing-CV5l3lf6.js +0 -107
  124. package/dist/useFormReset-C5OggHsw.js +0 -22
  125. package/dist/useFormValidation-DhDNSjws.js +0 -224
  126. package/dist/useHover-DwDr6ozG.js +0 -900
  127. package/dist/useLabel-D7HkNEHT.js +0 -27
  128. package/dist/useLabels-D8cxd1Z8.js +0 -23
  129. package/dist/useListState-DVr6aYd_.js +0 -161
  130. package/dist/useLocalizedStringFormatter-CFP1YZWQ.js +0 -121
  131. package/dist/useNumberField-TwM0Z9D1.js +0 -1204
  132. package/dist/useNumberFormatter-321rAb4J.js +0 -13
  133. package/dist/usePress-Cucx-xSA.js +0 -664
  134. package/dist/useSingleSelectListState-CMGsRHHh.js +0 -38
  135. package/dist/useToggle-C0I3vs0g.js +0 -59
  136. package/dist/useToggleState-CmQX3SoX.js +0 -19
  137. package/dist/utilities/array-helpers.js +0 -56
  138. package/dist/utilities/debounce-throttle.js +0 -123
  139. package/dist/utilities/es-dash.js +0 -376
  140. package/dist/utilities/index.js +0 -27
  141. package/dist/utilities/text-helpers.js +0 -136
  142. package/dist/utils-DkCSC521.js +0 -370
  143. package/dist/wp/wp-font-enhancements.js +0 -1
  144. package/dist/wp/wp-ui-enhancements.js +0 -1
@@ -1,38 +0,0 @@
1
- import { $ as $e72dd72e1c76a225$export$2f645645f7bca764 } from "./useListState-DVr6aYd_.js";
2
- import { b as $458b0a5536c1a7cf$export$40bfa8c7b0832715 } from "./useHover-DwDr6ozG.js";
3
- import { useMemo } from "react";
4
- function $a0d645289fe9b86b$export$e7f05e985daf4b5f(props) {
5
- var _props_defaultSelectedKey;
6
- let [selectedKey, setSelectedKey] = $458b0a5536c1a7cf$export$40bfa8c7b0832715(props.selectedKey, (_props_defaultSelectedKey = props.defaultSelectedKey) !== null && _props_defaultSelectedKey !== void 0 ? _props_defaultSelectedKey : null, props.onSelectionChange);
7
- let selectedKeys = useMemo(() => selectedKey != null ? [
8
- selectedKey
9
- ] : [], [
10
- selectedKey
11
- ]);
12
- let { collection, disabledKeys, selectionManager } = $e72dd72e1c76a225$export$2f645645f7bca764({
13
- ...props,
14
- selectionMode: "single",
15
- disallowEmptySelection: true,
16
- allowDuplicateSelectionEvents: true,
17
- selectedKeys,
18
- onSelectionChange: (keys) => {
19
- if (keys === "all") return;
20
- var _keys_values_next_value;
21
- let key = (_keys_values_next_value = keys.values().next().value) !== null && _keys_values_next_value !== void 0 ? _keys_values_next_value : null;
22
- if (key === selectedKey && props.onSelectionChange) props.onSelectionChange(key);
23
- setSelectedKey(key);
24
- }
25
- });
26
- let selectedItem = selectedKey != null ? collection.getItem(selectedKey) : null;
27
- return {
28
- collection,
29
- disabledKeys,
30
- selectionManager,
31
- selectedKey,
32
- setSelectedKey,
33
- selectedItem
34
- };
35
- }
36
- export {
37
- $a0d645289fe9b86b$export$e7f05e985daf4b5f as $
38
- };
@@ -1,59 +0,0 @@
1
- import { d as $3ef42575df84b30b$export$9d1611c77c2fe928 } from "./utils-DkCSC521.js";
2
- import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "./filterDOMProps-EDDcM64A.js";
3
- import { $ as $99facab73266f662$export$5add1d006293d136 } from "./useFormReset-C5OggHsw.js";
4
- import { $ as $f6c31cce2adf654f$export$45712eceda6fad21 } from "./usePress-Cucx-xSA.js";
5
- import { a as $f645667febf57a63$export$4c014de7c8940b4c } from "./useHover-DwDr6ozG.js";
6
- function $d2c8e2b0480f3f34$export$cbe85ee05b554577(props, state, ref) {
7
- let { isDisabled = false, isReadOnly = false, value, name, children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, validationState = "valid", isInvalid } = props;
8
- let onChange = (e) => {
9
- e.stopPropagation();
10
- state.setSelected(e.target.checked);
11
- };
12
- let hasChildren = children != null;
13
- let hasAriaLabel = ariaLabel != null || ariaLabelledby != null;
14
- if (!hasChildren && !hasAriaLabel) console.warn("If you do not provide children, you must specify an aria-label for accessibility");
15
- let { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21({
16
- isDisabled
17
- });
18
- let { pressProps: labelProps, isPressed: isLabelPressed } = $f6c31cce2adf654f$export$45712eceda6fad21({
19
- onPress() {
20
- var _ref_current;
21
- state.toggle();
22
- (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.focus();
23
- },
24
- isDisabled: isDisabled || isReadOnly
25
- });
26
- let { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c(props, ref);
27
- let interactions = $3ef42575df84b30b$export$9d1611c77c2fe928(pressProps, focusableProps);
28
- let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, {
29
- labelable: true
30
- });
31
- $99facab73266f662$export$5add1d006293d136(ref, state.isSelected, state.setSelected);
32
- return {
33
- labelProps: $3ef42575df84b30b$export$9d1611c77c2fe928(labelProps, {
34
- onClick: (e) => e.preventDefault()
35
- }),
36
- inputProps: $3ef42575df84b30b$export$9d1611c77c2fe928(domProps, {
37
- "aria-invalid": isInvalid || validationState === "invalid" || void 0,
38
- "aria-errormessage": props["aria-errormessage"],
39
- "aria-controls": props["aria-controls"],
40
- "aria-readonly": isReadOnly || void 0,
41
- onChange,
42
- disabled: isDisabled,
43
- ...value == null ? {} : {
44
- value
45
- },
46
- name,
47
- type: "checkbox",
48
- ...interactions
49
- }),
50
- isSelected: state.isSelected,
51
- isPressed: isPressed || isLabelPressed,
52
- isDisabled,
53
- isReadOnly,
54
- isInvalid: isInvalid || validationState === "invalid"
55
- };
56
- }
57
- export {
58
- $d2c8e2b0480f3f34$export$cbe85ee05b554577 as $
59
- };
@@ -1,19 +0,0 @@
1
- import { b as $458b0a5536c1a7cf$export$40bfa8c7b0832715 } from "./useHover-DwDr6ozG.js";
2
- function $3017fa7ffdddec74$export$8042c6c013fd5226(props = {}) {
3
- let { isReadOnly } = props;
4
- let [isSelected, setSelected] = $458b0a5536c1a7cf$export$40bfa8c7b0832715(props.isSelected, props.defaultSelected || false, props.onChange);
5
- function updateSelected(value) {
6
- if (!isReadOnly) setSelected(value);
7
- }
8
- function toggleState() {
9
- if (!isReadOnly) setSelected(!isSelected);
10
- }
11
- return {
12
- isSelected,
13
- setSelected: updateSelected,
14
- toggle: toggleState
15
- };
16
- }
17
- export {
18
- $3017fa7ffdddec74$export$8042c6c013fd5226 as $
19
- };
@@ -1,56 +0,0 @@
1
- /**
2
- * Move multiple array items to a different position with direction control. Returns a new array with the items moved.
3
- *
4
- * @param {Array} array - The original array.
5
- * @param {Array} fromIndices - An array of indices of the items to move.
6
- * @param {number} to - The index to move the items to.
7
- * @param {'before' | 'after'} direction - The direction to move the items ('before' or 'after').
8
- *
9
- * @returns {Array} - The array with the items moved.
10
- *
11
- * @preserve
12
- */
13
- const arrayMoveMultiple = (array, fromIndices, to, direction = "before") => {
14
- const newArray = array.slice();
15
- fromIndices.sort((a, b) => b - a);
16
- const itemsToMove = fromIndices.map((index) => newArray.splice(index, 1)[0]);
17
- let insertAt = to;
18
- if (direction === "after") {
19
- insertAt += 1;
20
- const minFromIndex = Math.min(...fromIndices);
21
- if (to >= minFromIndex) {
22
- insertAt -= 1;
23
- }
24
- }
25
- newArray.splice(insertAt, 0, ...itemsToMove.reverse());
26
- return newArray;
27
- };
28
- /**
29
- * Fix the IDs of the items in the array to ensure they are unique and sequential.
30
- * If the IDs are missing or duplicate, new IDs are generated for the items.
31
- *
32
- * @param {Array} items - The array of items to fix.
33
- * @param {Function} onChange - The callback to update the items.
34
- * @param {string} [idKey='id'] - The key to use for the IDs.
35
- *
36
- * @preserve
37
- */
38
- const fixIds = (items, onChange, idKey = "id") => {
39
- const allIds = (items == null ? void 0 : items.map((item) => item == null ? void 0 : item[idKey])) ?? [];
40
- const hasDuplicates = (input) => {
41
- var _a;
42
- return ((_a = new Set(input)) == null ? void 0 : _a.size) !== (input == null ? void 0 : input.length);
43
- };
44
- const hasMissingIds = items == null ? void 0 : items.some((item) => typeof (item == null ? void 0 : item[idKey]) === "undefined" || (item == null ? void 0 : item[idKey]) === null || (item == null ? void 0 : item[idKey]) === "");
45
- if (hasDuplicates(allIds) && (items == null ? void 0 : items.length) > 0 || hasMissingIds) {
46
- const newItems = [...items].map((item, index) => ({
47
- ...item,
48
- [idKey]: index + 1
49
- }));
50
- onChange(newItems);
51
- }
52
- };
53
- export {
54
- arrayMoveMultiple,
55
- fixIds
56
- };
@@ -1,123 +0,0 @@
1
- var functionDebounce = debounce$1;
2
- function debounce$1(fn, wait, callFirst) {
3
- var timeout = null;
4
- var debouncedFn = null;
5
- var clear = function() {
6
- if (timeout) {
7
- clearTimeout(timeout);
8
- debouncedFn = null;
9
- timeout = null;
10
- }
11
- };
12
- var flush = function() {
13
- var call = debouncedFn;
14
- clear();
15
- if (call) {
16
- call();
17
- }
18
- };
19
- var debounceWrapper = function() {
20
- if (!wait) {
21
- return fn.apply(this, arguments);
22
- }
23
- var context = this;
24
- var args = arguments;
25
- var callNow = callFirst && !timeout;
26
- clear();
27
- debouncedFn = function() {
28
- fn.apply(context, args);
29
- };
30
- timeout = setTimeout(function() {
31
- timeout = null;
32
- if (!callNow) {
33
- var call = debouncedFn;
34
- debouncedFn = null;
35
- return call();
36
- }
37
- }, wait);
38
- if (callNow) {
39
- return debouncedFn();
40
- }
41
- };
42
- debounceWrapper.cancel = clear;
43
- debounceWrapper.flush = flush;
44
- return debounceWrapper;
45
- }
46
- var functionThrottle = throttle$1;
47
- function throttle$1(fn, interval, options) {
48
- var timeoutId = null;
49
- var throttledFn = null;
50
- var leading = options && options.leading;
51
- var trailing = options && options.trailing;
52
- if (leading == null) {
53
- leading = true;
54
- }
55
- if (trailing == null) {
56
- trailing = !leading;
57
- }
58
- if (leading == true) {
59
- trailing = false;
60
- }
61
- var cancel = function() {
62
- if (timeoutId) {
63
- clearTimeout(timeoutId);
64
- timeoutId = null;
65
- }
66
- };
67
- var flush = function() {
68
- var call = throttledFn;
69
- cancel();
70
- if (call) {
71
- call();
72
- }
73
- };
74
- var throttleWrapper = function() {
75
- var callNow = leading && !timeoutId;
76
- var context = this;
77
- var args = arguments;
78
- throttledFn = function() {
79
- return fn.apply(context, args);
80
- };
81
- if (!timeoutId) {
82
- timeoutId = setTimeout(function() {
83
- timeoutId = null;
84
- if (trailing) {
85
- return throttledFn();
86
- }
87
- }, interval);
88
- }
89
- if (callNow) {
90
- callNow = false;
91
- return throttledFn();
92
- }
93
- };
94
- throttleWrapper.cancel = cancel;
95
- throttleWrapper.flush = flush;
96
- return throttleWrapper;
97
- }
98
- /**
99
- * Debounces the provided function.
100
- * For more information, check [this blog post](https://davidwalsh.name/javascript-debounce-function).
101
- *
102
- * @param {function} func - Callback to apply.
103
- * @param {number} wait - Number of milliseconds for the delay of the callback function. Default is 200ms.
104
- *
105
- * @access public
106
- *
107
- * @return {function} Debounced callback.
108
- *
109
- * Usage:
110
- * ```js
111
- * debounce(() => {
112
- * // callback function.
113
- * }, 250);
114
- * ```
115
- *
116
- * @preserve
117
- */
118
- const debounce = (func, wait = 250) => functionDebounce(func, wait);
119
- const throttle = (func, wait = 250, after = false) => functionThrottle(func, wait, { leading: !after, trailing: after });
120
- export {
121
- debounce,
122
- throttle
123
- };
@@ -1,376 +0,0 @@
1
- var stringKebabCase = kebabCase$1;
2
- var wordSeparators = /[\s\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`{|}~]+/;
3
- var capital_plus_lower = /[A-ZÀ-Ý\u00C0-\u00D6\u00D9-\u00DD][a-zà-ÿ]/g;
4
- var capitals = /[A-ZÀ-Ý\u00C0-\u00D6\u00D9-\u00DD]+/g;
5
- function kebabCase$1(str) {
6
- str = str.replace(capital_plus_lower, function(match) {
7
- return " " + (match[0].toLowerCase() || match[0]) + match[1];
8
- });
9
- str = str.replace(capitals, function(match) {
10
- return " " + match.toLowerCase();
11
- });
12
- return str.trim().split(wordSeparators).join("-").replace(/^-/, "").replace(/-\s*$/, "");
13
- }
14
- var stringCamelCase = camelCase$1;
15
- var wordSeparatorsRegEx = /[\s\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`{|}~]+/;
16
- var basicCamelRegEx = /^[a-z\u00E0-\u00FCA-Z\u00C0-\u00DC][\d|a-z\u00E0-\u00FCA-Z\u00C0-\u00DC]*$/;
17
- var fourOrMoreConsecutiveCapsRegEx = /([A-Z\u00C0-\u00DC]{4,})/g;
18
- var allCapsRegEx = /^[A-Z\u00C0-\u00DC]+$/;
19
- function camelCase$1(str) {
20
- var words = str.split(wordSeparatorsRegEx);
21
- var len = words.length;
22
- var mappedWords = new Array(len);
23
- for (var i = 0; i < len; i++) {
24
- var word = words[i];
25
- if (word === "") {
26
- continue;
27
- }
28
- var isCamelCase = basicCamelRegEx.test(word) && !allCapsRegEx.test(word);
29
- if (isCamelCase) {
30
- word = word.replace(fourOrMoreConsecutiveCapsRegEx, function(match, p1, offset) {
31
- return deCap(match, word.length - offset - match.length == 0);
32
- });
33
- }
34
- var firstLetter = word[0];
35
- firstLetter = i > 0 ? firstLetter.toUpperCase() : firstLetter.toLowerCase();
36
- mappedWords[i] = firstLetter + (!isCamelCase ? word.slice(1).toLowerCase() : word.slice(1));
37
- }
38
- return mappedWords.join("");
39
- }
40
- function deCap(match, endOfWord) {
41
- var arr = match.split("");
42
- var first = arr.shift().toUpperCase();
43
- var last = endOfWord ? arr.pop().toLowerCase() : arr.pop();
44
- return first + arr.join("").toLowerCase() + last;
45
- }
46
- var objectIsEmpty = isEmpty$1;
47
- function isEmpty$1(obj) {
48
- if (obj == null) {
49
- return true;
50
- }
51
- if (Array.isArray(obj)) {
52
- return !obj.length;
53
- }
54
- if (typeof obj == "string") {
55
- return !obj.length;
56
- }
57
- var type = {}.toString.call(obj);
58
- if (type == "[object Object]") {
59
- return !Object.keys(obj).length && !Object.getOwnPropertySymbols(obj).length;
60
- }
61
- if (type == "[object Map]" || type == "[object Set]") {
62
- return !obj.size;
63
- }
64
- return Object(obj) !== obj || !Object.keys(obj).length;
65
- }
66
- var objectHas = has$1;
67
- function has$1(obj, propsArg) {
68
- if (!obj) {
69
- return false;
70
- }
71
- var props, prop;
72
- if (Array.isArray(propsArg)) {
73
- props = propsArg.slice(0);
74
- }
75
- if (typeof propsArg == "string") {
76
- props = propsArg.split(".");
77
- }
78
- if (typeof propsArg == "symbol") {
79
- props = [propsArg];
80
- }
81
- if (!Array.isArray(props)) {
82
- throw new Error("props arg must be an array, a string or a symbol");
83
- }
84
- while (props.length) {
85
- prop = props.shift();
86
- if (obj == null) {
87
- return false;
88
- }
89
- if (!Object.prototype.hasOwnProperty.call(obj, prop)) {
90
- return false;
91
- }
92
- if (props.length === 0) {
93
- return true;
94
- }
95
- obj = obj[prop];
96
- }
97
- return false;
98
- }
99
- /**
100
- * Returns a camelCase-formatted string.
101
- *
102
- * @param {string} input - String to convert.
103
- *
104
- * @access public
105
- *
106
- * @return {string} *camelCase*-formatted string.
107
- *
108
- * @example
109
- * camelCase('New super Test-title') // => 'newSuperTestTitle'
110
- * camelCase(null) // => ''
111
- *
112
- * @preserve
113
- */
114
- const camelCase = (input) => lowerFirst(stringCamelCase(input ?? ""));
115
- /**
116
- * Returns a PascalCase-formatted string.
117
- *
118
- * @param {string} input - String to convert.
119
- *
120
- * @access public
121
- *
122
- * @return {string} *PascalCase*-formatted string.
123
- *
124
- * Usage:
125
- * ```js
126
- * pascalCase('New super Test-title') // => 'NewSuperTestTitle'
127
- * pascalCase(null) // => ''
128
- * ```
129
- *
130
- * @preserve
131
- */
132
- const pascalCase = (input) => upperFirst(stringCamelCase(input ?? ""));
133
- /**
134
- * Returns a snake_case-formatted string.
135
- *
136
- * @param {string} input - String to convert.
137
- *
138
- * @access public
139
- *
140
- * @return {string} *snake_case*-formatted string.
141
- *
142
- * Usage:
143
- * ```js
144
- * snakeCase('New super Test-title') // => 'new_super_test_title'
145
- * snakeCase(null) // => ''
146
- * ```
147
- *
148
- * @preserve
149
- */
150
- const snakeCase = (input) => kebabCase(input ?? "").replaceAll("-", "_");
151
- const kebabCase = (input) => stringKebabCase(input ?? "");
152
- /**
153
- * Checks if value is an empty object or collection.
154
- *
155
- * @param {*} input - Value to check.
156
- *
157
- * @returns true if the object is empty, false otherwise.
158
- *
159
- * Usage:
160
- * ```js
161
- * isEmpty({}) // => true
162
- * isEmpty([]) // => true
163
- * isEmpty('') // => true
164
- * isEmpty({ a: 1 }) // => false
165
- * isEmpty([1, 2, 3]) // => false
166
- * ```
167
- *
168
- * @preserve
169
- */
170
- const isEmpty = (input) => objectIsEmpty(input);
171
- /**
172
- * Returns the string with its first character converted to uppercase.
173
- *
174
- * @param {string} input - String to convert.
175
- *
176
- * @return {string} string with its first character converted to uppercase.
177
- *
178
- * @example
179
- * upperFirst('new super Test-title') // => 'New super Test-title'
180
- *
181
- * @preserve
182
- */
183
- const upperFirst = (input) => {
184
- if (typeof input === "undefined") {
185
- return "";
186
- }
187
- if (input === true) {
188
- return "True";
189
- } else if (input === false) {
190
- return "False";
191
- }
192
- if (input.length < 2) {
193
- return input.toUpperCase();
194
- }
195
- return input.charAt(0).toUpperCase() + input.slice(1);
196
- };
197
- /**
198
- * Returns the string with its first character converted to lowercase.
199
- *
200
- * @param {string} input - String to convert.
201
- *
202
- * @return {string} string with its first character converted to lowercase.
203
- *
204
- * @example
205
- * lowerFirst('New super Test-title') // => 'new super Test-title'
206
- *
207
- * @preserve
208
- */
209
- const lowerFirst = (input) => {
210
- if (typeof input === "undefined") {
211
- return "";
212
- }
213
- if (input === true) {
214
- return "true";
215
- } else if (input === false) {
216
- return "false";
217
- }
218
- if ((input == null ? void 0 : input.length) < 2) {
219
- return input.toLowerCase();
220
- }
221
- return input.charAt(0).toLowerCase() + input.slice(1);
222
- };
223
- /**
224
- * Checks if `key` is a direct property of `object`. Key may be a path of a value separated by `.`
225
- *
226
- * @param {object} obj - Object to check.
227
- * @param {string} key - Key to check.
228
- *
229
- * @return {boolean} true if key is a direct property, false otherwise.
230
- *
231
- * Usage:
232
- * ```js
233
- * has({ a: 1 }, 'a') // => true
234
- * has({ a: 1 }, 'b') // => false
235
- * has({ a: { b: 2 } }, 'a.b') // => true
236
- * has({ a: { b: 3 } }, 'a.c') // => false
237
- * ```
238
- *
239
- * @preserve
240
- */
241
- const has = (obj, key) => objectHas(obj, key);
242
- /*
243
- * Checks if value is a plain object, that is, an object created by the Object constructor or one with a `[[Prototype]]` of `null`.
244
- *
245
- * @param {*} value - Value to check.
246
- * @returns {boolean} true if value is a plain object, false otherwise.
247
- *
248
- * Usage:
249
- * ```js
250
- * isPlainObject({ a: 2 }) // => true
251
- * isPlainObject('Lorem') // => false
252
- * isPlainObject([]) // => false
253
- * isPlainObject(new Boolean()) // => false
254
- * ```
255
- *
256
- * @preserve
257
- */
258
- const isPlainObject = (value) => {
259
- if (typeof value !== "object" || value === null) {
260
- return false;
261
- }
262
- if (Object.prototype.toString.call(value) !== "[object Object]") {
263
- return false;
264
- }
265
- const proto = Object.getPrototypeOf(value);
266
- if (proto === null) {
267
- return true;
268
- }
269
- const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor;
270
- return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value);
271
- };
272
- /**
273
- * Checks if value is the language type of `Object`. (e.g. arrays, functions, objects, regexes, new Number(0), and new String(’’))
274
- *
275
- * @param {*} input - Value to check.
276
- *
277
- * @returns {boolean} true if value is an array, false otherwise.
278
- *
279
- * Usage:
280
- * ```js
281
- * isObject({}) // => true
282
- * isObject([1, 2, 3]) // => true
283
- * isObject(() => {}) // => true
284
- * isObject(null) // => false
285
- * ```
286
- *
287
- * @preserve
288
- */
289
- const isObject = (input) => input instanceof Object;
290
- /**
291
- * Performs a deep comparison between two values to determine if they are equivalent.
292
- *
293
- * **Note**: works for simple types, arrays, and objects. Might not work for all the types the lodash version supports.
294
- *
295
- * @param {*} first First value to compare.
296
- * @param {*} second Second value to compare.
297
- *
298
- * @returns true if the values are equivalent, false otherwise.
299
- *
300
- * Usage:
301
- * ```js
302
- * isEqual({ a: 1 }, { a: 1 }) // => true
303
- * isEqual({ a: 1 }, { a: 2 }) // => false
304
- * isEqual({ a: 1 }, 'b') // => false
305
- * ```
306
- *
307
- * @preserve
308
- */
309
- const isEqual = (first, second) => {
310
- if (first === second) {
311
- return true;
312
- }
313
- if ((first === void 0 || second === void 0 || first === null || second === null) && (first || second)) {
314
- return false;
315
- }
316
- const firstType = first == null ? void 0 : first.constructor.name;
317
- const secondType = second == null ? void 0 : second.constructor.name;
318
- if (firstType !== secondType) {
319
- return false;
320
- }
321
- if (firstType === "Array") {
322
- if (first.length !== second.length) {
323
- return false;
324
- }
325
- let equal = true;
326
- for (let i = 0; i < first.length; i++) {
327
- if (!isEqual(first[i], second[i])) {
328
- equal = false;
329
- break;
330
- }
331
- }
332
- return equal;
333
- }
334
- if (firstType === "Object") {
335
- let equal = true;
336
- const fKeys = Object.keys(first);
337
- const sKeys = Object.keys(second);
338
- if (fKeys.length !== sKeys.length) {
339
- return false;
340
- }
341
- for (let i = 0; i < fKeys.length; i++) {
342
- if (first[fKeys[i]] && second[fKeys[i]]) {
343
- if (first[fKeys[i]] === second[fKeys[i]]) {
344
- continue;
345
- }
346
- if (first[fKeys[i]] && (first[fKeys[i]].constructor.name === "Array" || first[fKeys[i]].constructor.name === "Object")) {
347
- equal = isEqual(first[fKeys[i]], second[fKeys[i]]);
348
- if (!equal) {
349
- break;
350
- }
351
- } else if (first[fKeys[i]] !== second[fKeys[i]]) {
352
- equal = false;
353
- break;
354
- }
355
- } else if (first[fKeys[i]] && !second[fKeys[i]] || !first[fKeys[i]] && second[fKeys[i]]) {
356
- equal = false;
357
- break;
358
- }
359
- }
360
- return equal;
361
- }
362
- return first === second;
363
- };
364
- export {
365
- camelCase,
366
- has,
367
- isEmpty,
368
- isEqual,
369
- isObject,
370
- isPlainObject,
371
- kebabCase,
372
- lowerFirst,
373
- pascalCase,
374
- snakeCase,
375
- upperFirst
376
- };
@@ -1,27 +0,0 @@
1
- import { arrayMoveMultiple, fixIds } from "./array-helpers.js";
2
- import { camelCase, has, isEmpty, isEqual, isObject, isPlainObject, kebabCase, lowerFirst, pascalCase, snakeCase, upperFirst } from "./es-dash.js";
3
- import { truncate, truncateEnd, truncateMiddle, unescapeHTML } from "./text-helpers.js";
4
- import { debounce, throttle } from "./debounce-throttle.js";
5
- import { c } from "../lite-DVmmD_-j.js";
6
- export {
7
- arrayMoveMultiple,
8
- camelCase,
9
- c as clsx,
10
- debounce,
11
- fixIds,
12
- has,
13
- isEmpty,
14
- isEqual,
15
- isObject,
16
- isPlainObject,
17
- kebabCase,
18
- lowerFirst,
19
- pascalCase,
20
- snakeCase,
21
- throttle,
22
- truncate,
23
- truncateEnd,
24
- truncateMiddle,
25
- unescapeHTML,
26
- upperFirst
27
- };