@eightshift/ui-components 0.0.1

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 (112) hide show
  1. package/README.md +27 -0
  2. package/dist/Checkbox-BLcVbhiO.js +178 -0
  3. package/dist/ColorSwatch-Cmlex_kT.js +66 -0
  4. package/dist/FieldError-wtMA4667.js +42 -0
  5. package/dist/FocusScope-1u9yyfIN.js +725 -0
  6. package/dist/Form-Cq3fu75_.js +5 -0
  7. package/dist/GridList-BZPXp3_O.js +1256 -0
  8. package/dist/Group-DyqpTRPe.js +49 -0
  9. package/dist/Input-jsbb4ugq.js +130 -0
  10. package/dist/Label-BPzS-sR7.js +17 -0
  11. package/dist/ListBox-w9gDaJkV.js +4423 -0
  12. package/dist/LiveAnnouncer-IsokfWQ5.js +73 -0
  13. package/dist/NumberFormatter-LzoKy975.js +160 -0
  14. package/dist/RSPContexts-CrNYmadY.js +14 -0
  15. package/dist/Select-49a62830.esm-C-RFtLiD.js +2541 -0
  16. package/dist/SelectionManager-mefd0ThJ.js +2155 -0
  17. package/dist/Separator-DHn0CwdK.js +325 -0
  18. package/dist/Slider-Pyh2V4bY.js +885 -0
  19. package/dist/Text-BM136LvS.js +17 -0
  20. package/dist/VisuallyHidden-BYRI1Lfo.js +51 -0
  21. package/dist/_commonjsHelpers-CUmg6egw.js +6 -0
  22. package/dist/ariaHideOutside-ByKBPHmX.js +113 -0
  23. package/dist/assets/style.css +1 -0
  24. package/dist/button-BkkdyHfJ.js +307 -0
  25. package/dist/components/animated-visibility/animated-visibility.js +7165 -0
  26. package/dist/components/base-control/base-control.js +97 -0
  27. package/dist/components/breakpoint-preview/breakpoint-preview.js +218 -0
  28. package/dist/components/button/button.js +10 -0
  29. package/dist/components/checkbox/checkbox.js +119 -0
  30. package/dist/components/color-pickers/color-picker.js +242 -0
  31. package/dist/components/color-pickers/color-swatch.js +62 -0
  32. package/dist/components/color-pickers/gradient-editor.js +516 -0
  33. package/dist/components/color-pickers/solid-color-picker.js +1633 -0
  34. package/dist/components/component-toggle/component-toggle.js +71 -0
  35. package/dist/components/container-panel/container-panel.js +39 -0
  36. package/dist/components/expandable/expandable.js +144 -0
  37. package/dist/components/input-field/input-field.js +224 -0
  38. package/dist/components/link-input/link-input.js +937 -0
  39. package/dist/components/list-box/list-box.js +152 -0
  40. package/dist/components/matrix-align/matrix-align.js +185 -0
  41. package/dist/components/menu/menu.js +1608 -0
  42. package/dist/components/notice/notice.js +119 -0
  43. package/dist/components/number-picker/number-picker.js +277 -0
  44. package/dist/components/popover/popover.js +9 -0
  45. package/dist/components/radio/radio.js +552 -0
  46. package/dist/components/repeater/repeater-item.js +127 -0
  47. package/dist/components/repeater/repeater.js +248 -0
  48. package/dist/components/responsive/responsive-legacy.js +326 -0
  49. package/dist/components/responsive/responsive.js +499 -0
  50. package/dist/components/responsive-preview/responsive-preview.js +119 -0
  51. package/dist/components/rich-label/rich-label.js +56 -0
  52. package/dist/components/select/async-multi-select.js +144 -0
  53. package/dist/components/select/async-single-select.js +126 -0
  54. package/dist/components/select/custom-select-default-components.js +38 -0
  55. package/dist/components/select/multi-select-components.js +8 -0
  56. package/dist/components/select/multi-select.js +134 -0
  57. package/dist/components/select/react-select-component-wrappers.js +90 -0
  58. package/dist/components/select/shared.js +45 -0
  59. package/dist/components/select/single-select.js +116 -0
  60. package/dist/components/select/styles.js +55 -0
  61. package/dist/components/slider/column-config-slider.js +225 -0
  62. package/dist/components/slider/slider.js +362 -0
  63. package/dist/components/slider/utils.js +45 -0
  64. package/dist/components/spacer/spacer.js +93 -0
  65. package/dist/components/tabs/tabs.js +626 -0
  66. package/dist/components/toggle/switch.js +140 -0
  67. package/dist/components/toggle/toggle.js +58 -0
  68. package/dist/components/toggle-button/toggle-button.js +206 -0
  69. package/dist/components/tooltip/tooltip.js +10 -0
  70. package/dist/context-jMy6xdVq.js +98 -0
  71. package/dist/default-i18n-BhE-OUmt.js +873 -0
  72. package/dist/filterDOMProps-DG2RfOUr.js +30 -0
  73. package/dist/focusSafely-C3K8zAKj.js +743 -0
  74. package/dist/hooks/use-cell-edit-mode.js +35 -0
  75. package/dist/icons/block-icon.js +42 -0
  76. package/dist/icons/generic-color-swatch.js +21 -0
  77. package/dist/icons/icons.js +3636 -0
  78. package/dist/index-Bfb9bWcb.js +28844 -0
  79. package/dist/index-a301f526.esm-Bioi4cGX.js +3576 -0
  80. package/dist/index.js +109 -0
  81. package/dist/intlStrings-CUhoK9EN.js +2484 -0
  82. package/dist/isScrollable-PcyglExV.js +10 -0
  83. package/dist/modifiers.esm-BuJQPI1X.js +31 -0
  84. package/dist/multi-select-components-CjVpCNko.js +3677 -0
  85. package/dist/number-rWqELA8W.js +39 -0
  86. package/dist/popover-Dx3vKXUX.js +1061 -0
  87. package/dist/react-select-async.esm-TFb_ZX6C.js +111 -0
  88. package/dist/react-select.esm-BjRWqf0E.js +15 -0
  89. package/dist/style.js +1 -0
  90. package/dist/textSelection-BosCCRVE.js +89 -0
  91. package/dist/tooltip-CkCndvTI.js +1094 -0
  92. package/dist/useButton-CuG5UzUw.js +74 -0
  93. package/dist/useEvent-DHv-yhOH.js +24 -0
  94. package/dist/useFocusRing-Cc-4eouh.js +41 -0
  95. package/dist/useFocusable-5q1Gek1J.js +81 -0
  96. package/dist/useFormReset-Buc9YJcv.js +23 -0
  97. package/dist/useFormValidationState-BAPPNXic.js +238 -0
  98. package/dist/useHasTabbableChild-D3uUNhJ0.js +37 -0
  99. package/dist/useLabel-CGlkoFG0.js +28 -0
  100. package/dist/useLabels-Dg62M_3P.js +25 -0
  101. package/dist/useListData-BelKu4kx.js +211 -0
  102. package/dist/useListState-Domq0blV.js +137 -0
  103. package/dist/useLocalizedStringFormatter-Prmz0h0A.js +130 -0
  104. package/dist/useNumberFieldState-BLU3uhSR.js +1253 -0
  105. package/dist/useNumberFormatter-BLc2xjZn.js +13 -0
  106. package/dist/usePress-BQgVor4T.js +698 -0
  107. package/dist/useToggle-C9ETOBaZ.js +58 -0
  108. package/dist/useToggleState-DJ_z5E2S.js +21 -0
  109. package/dist/utilities/classnames.js +16 -0
  110. package/dist/utilities/text-helpers.js +79 -0
  111. package/dist/utils-BsiH7-5Y.js +488 -0
  112. package/package.json +71 -0
@@ -0,0 +1,35 @@
1
+ import { useRef, useEffect } from "react";
2
+ function useCellEditMode() {
3
+ const isFocusedRef = useRef(false);
4
+ const isEditModeRef = useRef(false);
5
+ useEffect(() => {
6
+ const handler = (e) => {
7
+ if (isFocusedRef.current) {
8
+ if (e.code === "Enter") {
9
+ isEditModeRef.current = true;
10
+ } else if (e.code === "Escape" || e.code === "Tab") {
11
+ isEditModeRef.current = false;
12
+ }
13
+ if (isEditModeRef.current) {
14
+ e.stopPropagation();
15
+ }
16
+ }
17
+ };
18
+ window.addEventListener("keydown", handler, true);
19
+ return () => {
20
+ window.removeEventListener("keydown", handler, true);
21
+ };
22
+ }, []);
23
+ const setFocus = (should) => isFocusedRef.current = should;
24
+ const preventProps = {
25
+ onFocus: () => setFocus(true),
26
+ onBlur: () => setFocus(false),
27
+ onClick: () => {
28
+ isEditModeRef.current = true;
29
+ }
30
+ };
31
+ return preventProps;
32
+ }
33
+ export {
34
+ useCellEditMode
35
+ };
@@ -0,0 +1,42 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { blockIcons } from "./icons.js";
3
+ /**
4
+ * A component that displays a block icon.
5
+ *
6
+ * Usage:
7
+ *
8
+ * ```jsx
9
+ * import { BlockIcon } from '@eightshift/frontend-libs/scripts';
10
+ *
11
+ * <BlockIcon iconName='es-button' />
12
+ * ```
13
+ *
14
+ * Output:
15
+ *
16
+ * Selected block icon displayed inline.
17
+ * ```html
18
+ * <i><svg ...> ... </svg></i>
19
+ * ```
20
+ *
21
+ * @param {object} props - BlockIcon options.
22
+ * @param {string} props.iconName - Name of the block icon to display.
23
+ *
24
+ * @access public
25
+ *
26
+ * @returns {JSX.Element} The BlockIcon component.
27
+ *
28
+ * @preserve
29
+ */
30
+ const BlockIcon = (props) => {
31
+ const { iconName } = props;
32
+ return /* @__PURE__ */ jsx(
33
+ "i",
34
+ {
35
+ dangerouslySetInnerHTML: { __html: blockIcons[iconName] },
36
+ style: { lineHeight: 0 }
37
+ }
38
+ );
39
+ };
40
+ export {
41
+ BlockIcon
42
+ };
@@ -0,0 +1,21 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useId } from "react";
3
+ const GenericColorSwatch = ({ style }) => {
4
+ const clipId = useId();
5
+ return /* @__PURE__ */ jsxs("svg", { style, width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
6
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: `genericColorSwatchShape-${clipId}`, children: /* @__PURE__ */ jsx("rect", { className: "generic-swatch-icon-color-mask", x: "1", y: "1", width: "18", height: "18", rx: "2" }) }) }),
7
+ /* @__PURE__ */ jsxs("g", { opacity: "var(--checkerboard-opacity, 0)", clipPath: `url(#genericColorSwatchShape-${clipId})`, className: "generic-swatch-icon-checkerboard-group", children: [
8
+ /* @__PURE__ */ jsx("path", { fill: "#CCC", d: "M1 1h3v3H1V1zm0 6h3v3H1zm0 6h3v3H1zM7 1h3v3H7zm0 6h3v3H7zm0 6h3v3H7zm6-12h3v3h-3zm0 6h3v3h-3zm0 6h3v3h-3z" }),
9
+ /* @__PURE__ */ jsx("path", { fill: "#fff", d: "M4 1h3v3H4zm0 6h3v3H4zm0 6h3v3H4zm6-12h3v3h-3zm0 6h3v3h-3zm0 6h3v3h-3zm6-12h3v3h-3V1zm0 6h3v3h-3zm0 6h3v3h-3z" }),
10
+ /* @__PURE__ */ jsx("path", { fill: "#CCC", d: "M4 4h3v3H4zm0 6h3v3H4zm0 6h3v3H4zm6-12h3v3h-3zm0 6h3v3h-3zm0 6h3v3h-3zm6-12h3v3h-3zm0 6h3v3h-3zm0 6h3v3h-3v-3z" }),
11
+ /* @__PURE__ */ jsx("path", { fill: "#fff", d: "M1 4h3v3H1zm0 6h3v3H1zm0 6h3v3H1v-3zM7 4h3v3H7zm0 6h3v3H7zm0 6h3v3H7zm6-12h3v3h-3zm0 6h3v3h-3zm0 6h3v3h-3z" })
12
+ ] }),
13
+ /* @__PURE__ */ jsx("rect", { className: "generic-swatch-icon-color", x: "1", y: "1", width: "18", height: "18", rx: "2", fill: "var(--selected-color, currentColor)", stroke: "gray" }),
14
+ /* @__PURE__ */ jsx("path", { opacity: "var(--selected-opacity, 0)", d: "M4 16 16 4", stroke: "gray", strokeLinejoin: "round", fill: "none" }),
15
+ /* @__PURE__ */ jsx("circle", { opacity: "var(--current-opacity, 0)", cx: "10", cy: "10", r: "4.5", fill: "#fff" }),
16
+ /* @__PURE__ */ jsx("circle", { opacity: "var(--current-opacity, 0)", cx: "10", cy: "10", r: "2.5", fill: "#000" })
17
+ ] });
18
+ };
19
+ export {
20
+ GenericColorSwatch
21
+ };