@eightshift/ui-components 1.4.5 → 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.
- package/dist/assets/style.css +1 -1
- package/dist/components/animated-visibility/animated-visibility.js +132 -162
- package/dist/components/component-toggle/component-toggle.js +1 -0
- package/dist/components/link-input/link-input.js +3 -2
- package/dist/components/menu/menu.js +1 -2
- package/dist/components/number-picker/number-picker.js +1 -1
- package/dist/components/option-select/option-select.js +3 -2
- package/dist/components/popover/popover.js +8 -2
- package/dist/components/repeater/repeater.js +1 -1
- package/dist/components/select/async-multi-select.js +6 -3
- package/dist/components/select/async-single-select.js +4 -1
- package/dist/components/select/multi-select.js +11 -4
- package/dist/components/select/shared.js +7 -56
- package/dist/components/select/single-select.js +9 -2
- package/dist/utilities/index.js +2 -1
- package/dist/utilities/text-helpers.js +38 -0
- package/package.json +9 -9
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { S as StateManagedSelect$1 } from "../../react-select.esm-DkSeQzOP.js";
|
|
3
3
|
import { CustomSelectDefaultDropdownIndicator, CustomSelectDefaultClearIndicator } from "./custom-select-default-components.js";
|
|
4
|
-
import { getValue
|
|
4
|
+
import { getValue } from "./shared.js";
|
|
5
5
|
import { BaseControl } from "../base-control/base-control.js";
|
|
6
6
|
import { eightshiftSelectClasses } from "./styles.js";
|
|
7
7
|
import { c as components } from "../../index-a301f526.esm-B9tWL9yi.js";
|
|
@@ -95,7 +95,14 @@ const Select = (props) => {
|
|
|
95
95
|
unstyled: true,
|
|
96
96
|
options,
|
|
97
97
|
value: getValue(simpleValue, value, options),
|
|
98
|
-
onChange: (v) =>
|
|
98
|
+
onChange: (v) => {
|
|
99
|
+
if (simpleValue) {
|
|
100
|
+
onChange(v == null ? void 0 : v.value);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
delete v.id;
|
|
104
|
+
onChange(v);
|
|
105
|
+
},
|
|
99
106
|
closeMenuOnSelect: !keepMenuOpenAfterSelect,
|
|
100
107
|
isClearable: clearable,
|
|
101
108
|
isSearchable: !noSearch,
|
package/dist/utilities/index.js
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "1.4.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -53,29 +53,29 @@
|
|
|
53
53
|
"@dnd-kit/utilities": "^3.2.2",
|
|
54
54
|
"@eslint/compat": "^1.1.1",
|
|
55
55
|
"@react-stately/collections": "^3.10.9",
|
|
56
|
-
"@stylistic/eslint-plugin-js": "^2.
|
|
56
|
+
"@stylistic/eslint-plugin-js": "^2.6.1",
|
|
57
57
|
"@types/react": "^18.3.3",
|
|
58
58
|
"@types/react-dom": "^18.3.0",
|
|
59
59
|
"@vitejs/plugin-react-swc": "^3.7.0",
|
|
60
60
|
"@wordpress/i18n": "^5.4.0",
|
|
61
|
-
"autoprefixer": "^10.4.
|
|
61
|
+
"autoprefixer": "^10.4.20",
|
|
62
62
|
"clsx": "^2.1.1",
|
|
63
63
|
"css-gradient-parser": "^0.0.16",
|
|
64
|
-
"eslint": "^9.
|
|
64
|
+
"eslint": "^9.8.0",
|
|
65
65
|
"eslint-config-prettier": "^9.1.0",
|
|
66
|
-
"eslint-plugin-jsdoc": "^
|
|
66
|
+
"eslint-plugin-jsdoc": "^50.0.0",
|
|
67
67
|
"eslint-plugin-prettier": "^5.2.1",
|
|
68
|
-
"framer-motion": "^11.3.
|
|
68
|
+
"framer-motion": "^11.3.22",
|
|
69
69
|
"glob": "^11.0.0",
|
|
70
|
-
"globals": "^15.
|
|
70
|
+
"globals": "^15.9.0",
|
|
71
71
|
"just-camel-case": "^6.2.0",
|
|
72
72
|
"just-debounce-it": "^3.2.0",
|
|
73
73
|
"just-has": "^2.3.0",
|
|
74
74
|
"just-is-empty": "^3.4.1",
|
|
75
75
|
"just-kebab-case": "^4.2.0",
|
|
76
76
|
"just-throttle": "^4.2.0",
|
|
77
|
-
"lightningcss": "^1.
|
|
78
|
-
"postcss": "^8.4.
|
|
77
|
+
"lightningcss": "^1.26.0",
|
|
78
|
+
"postcss": "^8.4.41",
|
|
79
79
|
"prettier": "^3.3.3",
|
|
80
80
|
"prettier-plugin-tailwindcss": "^0.6.5",
|
|
81
81
|
"react-aria": "^3.34.1",
|