@eightshift/ui-components 1.4.6 → 1.4.7

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.
@@ -108,6 +108,7 @@ const ComponentToggle = (props) => {
108
108
  }
109
109
  ),
110
110
  disabled: !useComponent || expandButtonDisabled,
111
+ noFocusHandling: true,
111
112
  children: !expandButtonDisabled && /* @__PURE__ */ jsx("div", { className: contentClassName, children })
112
113
  }
113
114
  );
@@ -1755,6 +1755,7 @@ const LinkInput = (props) => {
1755
1755
  } = props;
1756
1756
  const triggerRef = useRef(null);
1757
1757
  const suggestionList = $f86e6c1ec7da6ebb$export$bc3384a35de93d66({
1758
+ initialFilterText: url,
1758
1759
  async load({ signal, filterText }) {
1759
1760
  const items = await fetchSuggestions(filterText, signal);
1760
1761
  return {
@@ -236,7 +236,7 @@ const NumberPicker = ({
236
236
  {
237
237
  onFocus: () => setIsInputFocused(true),
238
238
  onBlur: () => setIsInputFocused(false),
239
- className: "es-uic-col-start-2 es-uic-row-span-2 es-uic-bg-transparent es-uic-py-1 es-uic-text-sm es-uic-tabular-nums selection:es-uic-bg-teal-500/20 selection:es-uic-text-teal-950 focus:es-uic-outline-none",
239
+ className: "es-uic-col-start-2 es-uic-row-span-2 !es-uic-border-none es-uic-bg-transparent !es-uic-px-0 !es-uic-py-1 es-uic-text-sm es-uic-tabular-nums !es-uic-shadow-none !es-uic-outline-none selection:es-uic-bg-teal-500/20 selection:es-uic-text-teal-950 focus:!es-uic-shadow-none focus:es-uic-outline-none",
240
240
  placeholder,
241
241
  style: {
242
242
  width: fixedWidth ? `${fixedWidth}ch` : `calc(${min < 0 ? "0.75ch + " : ""}${(_d = (_c = max ?? 1e3) == null ? void 0 : _c.toString()) == null ? void 0 : _d.length} * 1ch)`
@@ -5082,7 +5082,7 @@ const Repeater = (props) => {
5082
5082
  const [items, setItems] = useState(fixIds(rawItems));
5083
5083
  const [canDelete, setCanDelete] = useState(false);
5084
5084
  const [isPanelOpen, setIsPanelOpen] = useState({});
5085
- const isAnyPanelOpen = ((_a3 = Object.keys(isPanelOpen)) == null ? void 0 : _a3.length) < 1 ? false : Object.entries(isPanelOpen).every(([_2, v2]) => v2 === true);
5085
+ const isAnyPanelOpen = ((_a3 = Object.keys(isPanelOpen)) == null ? void 0 : _a3.length) < 1 ? false : Object.entries(isPanelOpen).some(([_2, v2]) => v2 === true);
5086
5086
  if (canDelete && items.length < (minItems ?? 1)) {
5087
5087
  setCanDelete(false);
5088
5088
  }
@@ -1,6 +1,6 @@
1
1
  import { arrayMoveMultiple, fixIds } from "./array-helpers.js";
2
2
  import { camelCase, has, isEmpty, isEqual, isObject, isPlainObject, kebabCase, lowerFirst, pascalCase, snakeCase, upperFirst } from "./es-dash.js";
3
- import { truncate, truncateMiddle, unescapeHTML } from "./text-helpers.js";
3
+ import { truncate, truncateEnd, truncateMiddle, unescapeHTML } from "./text-helpers.js";
4
4
  import { debounce, throttle } from "./debounce-throttle.js";
5
5
  import { c } from "../lite-DVmmD_-j.js";
6
6
  export {
@@ -20,6 +20,7 @@ export {
20
20
  snakeCase,
21
21
  throttle,
22
22
  truncate,
23
+ truncateEnd,
23
24
  truncateMiddle,
24
25
  unescapeHTML,
25
26
  upperFirst
@@ -85,8 +85,46 @@ const truncate = (input, maxLength, separator = "...") => {
85
85
  const leftPart = input.slice(0, maxStringLength).trim();
86
86
  return `${leftPart}${separator}`;
87
87
  };
88
+ /**
89
+ * Slices the string at the end and inputs the provided separator so that the string is maxLength characters long.
90
+ *
91
+ * @param {string} input - String to slice.
92
+ * @param {number} maxLength - Maximum allowed string length.
93
+ * @param {string} [separator='...'] - Separator to insert.
94
+ *
95
+ * @access public
96
+ *
97
+ * @returns {string|Error} Truncated string or error if separator length exceeds maxLength.
98
+ *
99
+ * Usage:
100
+ * ```js
101
+ * truncateMiddle('https://eightshift.com/contact/', 22);
102
+ * ```
103
+ *
104
+ * Output:
105
+ * ```js
106
+ * "https://ei.../contact/"
107
+ *
108
+ * @preserve
109
+ */
110
+ const truncateEnd = (input, maxLength, separator = "...") => {
111
+ if (!input) {
112
+ return null;
113
+ }
114
+ if ((input == null ? void 0 : input.length) <= maxLength) {
115
+ return input;
116
+ }
117
+ if (separator.length + 1 > maxLength) {
118
+ throw new Error("Separator length exceeds the passed maximum length, string wouldn't be visible.");
119
+ }
120
+ const maxStringLength = maxLength - separator.length;
121
+ const leftPartLength = Math.ceil(maxStringLength);
122
+ const leftPart = input.slice(0, leftPartLength).trim();
123
+ return `${leftPart}${separator}`;
124
+ };
88
125
  export {
89
126
  truncate,
127
+ truncateEnd,
90
128
  truncateMiddle,
91
129
  unescapeHTML
92
130
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eightshift/ui-components",
3
- "version": "1.4.6",
3
+ "version": "1.4.7",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",