cetec-design-system 4.0.1-0 → 4.1.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.
- package/dist/index.js +84 -41
- package/dist/index.js.map +1 -1
- package/dist/panda.buildinfo.json +4 -1
- package/dist/preset.js +42 -9
- package/dist/preset.js.map +1 -1
- package/dist/specs/recipes.json +7 -2
- package/dist/styles.css +35 -8
- package/dist/types/index.d.ts +47 -6
- package/package.json +1 -1
- package/src/recipes/listItem.ts +11 -0
- package/src/recipes/select.ts +26 -4
package/dist/index.js
CHANGED
|
@@ -2710,6 +2710,10 @@ const listItemSlotNames = [
|
|
|
2710
2710
|
"beforeSlot",
|
|
2711
2711
|
"listItem__beforeSlot"
|
|
2712
2712
|
],
|
|
2713
|
+
[
|
|
2714
|
+
"beforeContent",
|
|
2715
|
+
"listItem__beforeContent"
|
|
2716
|
+
],
|
|
2713
2717
|
[
|
|
2714
2718
|
"afterSlot",
|
|
2715
2719
|
"listItem__afterSlot"
|
|
@@ -3160,6 +3164,10 @@ const selectSlotNames = [
|
|
|
3160
3164
|
"chips",
|
|
3161
3165
|
"select__chips"
|
|
3162
3166
|
],
|
|
3167
|
+
[
|
|
3168
|
+
"before",
|
|
3169
|
+
"select__before"
|
|
3170
|
+
],
|
|
3163
3171
|
[
|
|
3164
3172
|
"icon",
|
|
3165
3173
|
"select__icon"
|
|
@@ -3171,6 +3179,7 @@ const selectFn = memo((props = {}) => {
|
|
|
3171
3179
|
});
|
|
3172
3180
|
const selectVariantKeys = [
|
|
3173
3181
|
"size",
|
|
3182
|
+
"before",
|
|
3174
3183
|
"multiple",
|
|
3175
3184
|
"autoSize"
|
|
3176
3185
|
];
|
|
@@ -3188,6 +3197,9 @@ const select = /* @__PURE__ */ Object.assign(selectFn, {
|
|
|
3188
3197
|
"lg",
|
|
3189
3198
|
"xl"
|
|
3190
3199
|
],
|
|
3200
|
+
"before": [
|
|
3201
|
+
"true"
|
|
3202
|
+
],
|
|
3191
3203
|
"multiple": [
|
|
3192
3204
|
"true"
|
|
3193
3205
|
],
|
|
@@ -15727,7 +15739,15 @@ const Breadcrumbs = (props) => {
|
|
|
15727
15739
|
className: cx(classes.wrapper, className),
|
|
15728
15740
|
...otherProps,
|
|
15729
15741
|
children: items == null ? void 0 : items.map((item, index2) => /* @__PURE__ */ jsxs(Text, { as: "li", children: [
|
|
15730
|
-
item.href ? /* @__PURE__ */ jsx(
|
|
15742
|
+
item.href ? /* @__PURE__ */ jsx(
|
|
15743
|
+
Link,
|
|
15744
|
+
{
|
|
15745
|
+
href: item.href,
|
|
15746
|
+
onClick: item.onClick,
|
|
15747
|
+
className: classes.linkSegment,
|
|
15748
|
+
children: item.label
|
|
15749
|
+
}
|
|
15750
|
+
) : /* @__PURE__ */ jsx(Text, { className: classes.currentSegment, children: item.label }),
|
|
15731
15751
|
index2 < (items == null ? void 0 : items.length) - 1 && /* @__PURE__ */ jsx(Text, { className: classes.slash, children: "/" })
|
|
15732
15752
|
] }, item.id))
|
|
15733
15753
|
}
|
|
@@ -20644,7 +20664,14 @@ const ListItem = (props) => {
|
|
|
20644
20664
|
"data-row-id": rowId,
|
|
20645
20665
|
...otherProps,
|
|
20646
20666
|
children: hasCustomChildren ? children : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
20647
|
-
before && /* @__PURE__ */ jsx(
|
|
20667
|
+
before && /* @__PURE__ */ jsx(
|
|
20668
|
+
Box,
|
|
20669
|
+
{
|
|
20670
|
+
className: cx(classes.beforeSlot, classes.beforeContent),
|
|
20671
|
+
"aria-hidden": true,
|
|
20672
|
+
children: before
|
|
20673
|
+
}
|
|
20674
|
+
),
|
|
20648
20675
|
variant === "checkbox" && /* @__PURE__ */ jsx(
|
|
20649
20676
|
Checkbox,
|
|
20650
20677
|
{
|
|
@@ -24017,6 +24044,7 @@ const getSelectedOptions = (options, value, multiple) => {
|
|
|
24017
24044
|
return options.filter((option) => selectedValueSet.has(option.props.value));
|
|
24018
24045
|
};
|
|
24019
24046
|
const Select = (props) => {
|
|
24047
|
+
var _a;
|
|
24020
24048
|
const floatingLayer = useFloatingLayer();
|
|
24021
24049
|
const {
|
|
24022
24050
|
value: controlledValue,
|
|
@@ -24037,6 +24065,8 @@ const Select = (props) => {
|
|
|
24037
24065
|
size: size2 = "md",
|
|
24038
24066
|
density = defaultDensity,
|
|
24039
24067
|
autoSize = false,
|
|
24068
|
+
before,
|
|
24069
|
+
clearable = true,
|
|
24040
24070
|
"data-ds-component": dsComponentName,
|
|
24041
24071
|
...rest
|
|
24042
24072
|
} = props;
|
|
@@ -24130,11 +24160,11 @@ const Select = (props) => {
|
|
|
24130
24160
|
const labelsRef = useRef([]);
|
|
24131
24161
|
const { isPositioned } = floating;
|
|
24132
24162
|
useLayoutEffect(() => {
|
|
24133
|
-
var
|
|
24163
|
+
var _a2;
|
|
24134
24164
|
if (!isOpen || !isPositioned || initialActiveIndex === null) {
|
|
24135
24165
|
return;
|
|
24136
24166
|
}
|
|
24137
|
-
(
|
|
24167
|
+
(_a2 = itemRefs.current[initialActiveIndex]) == null ? void 0 : _a2.scrollIntoView({ block: "nearest" });
|
|
24138
24168
|
}, [isOpen, isPositioned]);
|
|
24139
24169
|
const click = useClick(floating.context, {
|
|
24140
24170
|
enabled: !disabled
|
|
@@ -24166,7 +24196,9 @@ const Select = (props) => {
|
|
|
24166
24196
|
placeholder
|
|
24167
24197
|
);
|
|
24168
24198
|
const selectedOptions = getSelectedOptions(options, value, multiple);
|
|
24169
|
-
const
|
|
24199
|
+
const resolvedBefore = before ?? (multiple ? void 0 : (_a = options.find((option) => option.props.value === value)) == null ? void 0 : _a.props.before);
|
|
24200
|
+
const hasBefore = resolvedBefore !== void 0 && resolvedBefore !== null && resolvedBefore !== false;
|
|
24201
|
+
const classes = select({ size: size2, multiple, autoSize, before: hasBefore });
|
|
24170
24202
|
const menuClasses = menu({
|
|
24171
24203
|
density,
|
|
24172
24204
|
layer: floatingLayer,
|
|
@@ -24184,7 +24216,7 @@ const Select = (props) => {
|
|
|
24184
24216
|
setOpenedByKeyboard(true);
|
|
24185
24217
|
setOpenState(true);
|
|
24186
24218
|
}
|
|
24187
|
-
if (!multiple && hasValue && (event.key === "Backspace" || event.key === "Delete")) {
|
|
24219
|
+
if (!multiple && clearable && hasValue && (event.key === "Backspace" || event.key === "Delete")) {
|
|
24188
24220
|
event.preventDefault();
|
|
24189
24221
|
handleValueChange(null);
|
|
24190
24222
|
}
|
|
@@ -24197,7 +24229,9 @@ const Select = (props) => {
|
|
|
24197
24229
|
return;
|
|
24198
24230
|
}
|
|
24199
24231
|
if (value === optionValue) {
|
|
24200
|
-
|
|
24232
|
+
if (clearable) {
|
|
24233
|
+
handleValueChange(null);
|
|
24234
|
+
}
|
|
24201
24235
|
setOpenState(false);
|
|
24202
24236
|
return;
|
|
24203
24237
|
}
|
|
@@ -24226,7 +24260,7 @@ const Select = (props) => {
|
|
|
24226
24260
|
},
|
|
24227
24261
|
selectedValue
|
|
24228
24262
|
)),
|
|
24229
|
-
/* @__PURE__ */
|
|
24263
|
+
/* @__PURE__ */ jsxs(
|
|
24230
24264
|
Box,
|
|
24231
24265
|
{
|
|
24232
24266
|
as: "div",
|
|
@@ -24251,37 +24285,40 @@ const Select = (props) => {
|
|
|
24251
24285
|
onKeyDown: handleTriggerKeyDown
|
|
24252
24286
|
}),
|
|
24253
24287
|
...otherProps,
|
|
24254
|
-
children:
|
|
24255
|
-
Box,
|
|
24256
|
-
{
|
|
24257
|
-
|
|
24258
|
-
|
|
24259
|
-
event
|
|
24260
|
-
|
|
24261
|
-
|
|
24262
|
-
|
|
24288
|
+
children: [
|
|
24289
|
+
hasBefore && /* @__PURE__ */ jsx(Box, { className: classes.before, "aria-hidden": true, children: resolvedBefore }),
|
|
24290
|
+
multiple && selectedOptions.length > 0 ? /* @__PURE__ */ jsx(Box, { className: cx(classes.content, classes.chips), children: selectedOptions.map((option) => /* @__PURE__ */ jsx(
|
|
24291
|
+
Box,
|
|
24292
|
+
{
|
|
24293
|
+
onMouseDown: (event) => {
|
|
24294
|
+
event.preventDefault();
|
|
24295
|
+
event.stopPropagation();
|
|
24296
|
+
},
|
|
24297
|
+
onClick: (event) => {
|
|
24298
|
+
event.stopPropagation();
|
|
24299
|
+
},
|
|
24300
|
+
children: /* @__PURE__ */ jsx(
|
|
24301
|
+
Chip,
|
|
24302
|
+
{
|
|
24303
|
+
size: chipSize,
|
|
24304
|
+
dismissable: true,
|
|
24305
|
+
onDismiss: () => handleChipDismiss(option.props.value),
|
|
24306
|
+
children: option.props.label
|
|
24307
|
+
}
|
|
24308
|
+
)
|
|
24263
24309
|
},
|
|
24264
|
-
|
|
24265
|
-
|
|
24266
|
-
|
|
24267
|
-
|
|
24268
|
-
|
|
24269
|
-
|
|
24270
|
-
|
|
24271
|
-
|
|
24272
|
-
|
|
24273
|
-
|
|
24274
|
-
|
|
24275
|
-
|
|
24276
|
-
Box,
|
|
24277
|
-
{
|
|
24278
|
-
className: cx(
|
|
24279
|
-
classes.content,
|
|
24280
|
-
hasValue ? classes.value : classes.placeholder
|
|
24281
|
-
),
|
|
24282
|
-
children: displayValue
|
|
24283
|
-
}
|
|
24284
|
-
)
|
|
24310
|
+
option.props.value
|
|
24311
|
+
)) }) : /* @__PURE__ */ jsx(
|
|
24312
|
+
Box,
|
|
24313
|
+
{
|
|
24314
|
+
className: cx(
|
|
24315
|
+
classes.content,
|
|
24316
|
+
hasValue ? classes.value : classes.placeholder
|
|
24317
|
+
),
|
|
24318
|
+
children: displayValue
|
|
24319
|
+
}
|
|
24320
|
+
)
|
|
24321
|
+
]
|
|
24285
24322
|
}
|
|
24286
24323
|
),
|
|
24287
24324
|
/* @__PURE__ */ jsx(
|
|
@@ -24331,6 +24368,10 @@ const Select = (props) => {
|
|
|
24331
24368
|
const optionLabel = getOptionText(option);
|
|
24332
24369
|
const isSelected = multiple ? selectedValueSet.has(option.props.value) : value === option.props.value;
|
|
24333
24370
|
const isPointed = !option.props.disabled && hasNavigated && activeIndex === index2;
|
|
24371
|
+
const showClearIcon = clearable && isSelected && isPointed;
|
|
24372
|
+
const optionBefore = option.props.before;
|
|
24373
|
+
const hasOptionBefore = optionBefore !== void 0 && optionBefore !== null && optionBefore !== false;
|
|
24374
|
+
const selectionIcon = showClearIcon ? "x" : "check";
|
|
24334
24375
|
return /* @__PURE__ */ jsx(
|
|
24335
24376
|
ListItem,
|
|
24336
24377
|
{
|
|
@@ -24344,9 +24385,11 @@ const Select = (props) => {
|
|
|
24344
24385
|
variant: multiple ? "checkbox" : "default",
|
|
24345
24386
|
label: optionLabel,
|
|
24346
24387
|
description: option.props.description,
|
|
24347
|
-
|
|
24348
|
-
|
|
24349
|
-
|
|
24388
|
+
before: hasOptionBefore ? optionBefore : void 0,
|
|
24389
|
+
iconBefore: hasOptionBefore ? void 0 : !multiple ? showClearIcon ? "x" : option.props.iconLeft ?? "check" : option.props.iconLeft,
|
|
24390
|
+
iconBeforeFill: hasOptionBefore ? void 0 : !multiple ? isSelected ? "icon" : option.props.iconLeft ? void 0 : "transparent" : void 0,
|
|
24391
|
+
iconAfter: hasOptionBefore && !multiple ? selectionIcon : option.props.iconRight,
|
|
24392
|
+
iconAfterFill: hasOptionBefore && !multiple ? isSelected ? "icon" : "transparent" : void 0,
|
|
24350
24393
|
...getItemProps({
|
|
24351
24394
|
onClick: () => {
|
|
24352
24395
|
if (!option.props.disabled) {
|