cetec-design-system 4.0.0-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 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(Link, { href: item.href, className: classes.linkSegment, children: item.label }) : /* @__PURE__ */ jsx(Text, { className: classes.currentSegment, children: item.label }),
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
  }
@@ -19239,8 +19259,11 @@ const Menu = (props) => {
19239
19259
  return;
19240
19260
  }
19241
19261
  const updateWrapperSize = () => {
19242
- const nextWidth = Math.ceil(sizeProbe.scrollWidth);
19243
- const nextHeight = Math.ceil(sizeProbe.scrollHeight);
19262
+ const rect = sizeProbe.getBoundingClientRect();
19263
+ const activeLevelEl = activeLevelRef.current;
19264
+ const scrollbarWidth = activeLevelEl && !shouldUsePanelDiginProbeFill ? activeLevelEl.offsetWidth - activeLevelEl.clientWidth : 0;
19265
+ const nextWidth = Math.ceil(rect.width) + scrollbarWidth;
19266
+ const nextHeight = Math.ceil(rect.height);
19244
19267
  setWrapperSize((previous) => {
19245
19268
  if (previous.width === nextWidth && previous.height === nextHeight) {
19246
19269
  return previous;
@@ -19254,6 +19277,9 @@ const Menu = (props) => {
19254
19277
  updateWrapperSize();
19255
19278
  const resizeObserver = new ResizeObserver(updateWrapperSize);
19256
19279
  resizeObserver.observe(sizeProbe);
19280
+ if (activeLevelRef.current) {
19281
+ resizeObserver.observe(activeLevelRef.current);
19282
+ }
19257
19283
  return () => {
19258
19284
  resizeObserver.disconnect();
19259
19285
  };
@@ -19265,7 +19291,8 @@ const Menu = (props) => {
19265
19291
  diginDepth,
19266
19292
  hasVisibleResults,
19267
19293
  isMenuVisible,
19268
- shouldUseDiginSizing
19294
+ shouldUseDiginSizing,
19295
+ shouldUsePanelDiginProbeFill
19269
19296
  ]);
19270
19297
  useLayoutEffect(() => {
19271
19298
  var _a2;
@@ -20637,7 +20664,14 @@ const ListItem = (props) => {
20637
20664
  "data-row-id": rowId,
20638
20665
  ...otherProps,
20639
20666
  children: hasCustomChildren ? children : /* @__PURE__ */ jsxs(Fragment, { children: [
20640
- before && /* @__PURE__ */ jsx(Box, { className: classes.beforeSlot, "aria-hidden": true, children: before }),
20667
+ before && /* @__PURE__ */ jsx(
20668
+ Box,
20669
+ {
20670
+ className: cx(classes.beforeSlot, classes.beforeContent),
20671
+ "aria-hidden": true,
20672
+ children: before
20673
+ }
20674
+ ),
20641
20675
  variant === "checkbox" && /* @__PURE__ */ jsx(
20642
20676
  Checkbox,
20643
20677
  {
@@ -24010,6 +24044,7 @@ const getSelectedOptions = (options, value, multiple) => {
24010
24044
  return options.filter((option) => selectedValueSet.has(option.props.value));
24011
24045
  };
24012
24046
  const Select = (props) => {
24047
+ var _a;
24013
24048
  const floatingLayer = useFloatingLayer();
24014
24049
  const {
24015
24050
  value: controlledValue,
@@ -24030,6 +24065,8 @@ const Select = (props) => {
24030
24065
  size: size2 = "md",
24031
24066
  density = defaultDensity,
24032
24067
  autoSize = false,
24068
+ before,
24069
+ clearable = true,
24033
24070
  "data-ds-component": dsComponentName,
24034
24071
  ...rest
24035
24072
  } = props;
@@ -24123,11 +24160,11 @@ const Select = (props) => {
24123
24160
  const labelsRef = useRef([]);
24124
24161
  const { isPositioned } = floating;
24125
24162
  useLayoutEffect(() => {
24126
- var _a;
24163
+ var _a2;
24127
24164
  if (!isOpen || !isPositioned || initialActiveIndex === null) {
24128
24165
  return;
24129
24166
  }
24130
- (_a = itemRefs.current[initialActiveIndex]) == null ? void 0 : _a.scrollIntoView({ block: "nearest" });
24167
+ (_a2 = itemRefs.current[initialActiveIndex]) == null ? void 0 : _a2.scrollIntoView({ block: "nearest" });
24131
24168
  }, [isOpen, isPositioned]);
24132
24169
  const click = useClick(floating.context, {
24133
24170
  enabled: !disabled
@@ -24159,7 +24196,9 @@ const Select = (props) => {
24159
24196
  placeholder
24160
24197
  );
24161
24198
  const selectedOptions = getSelectedOptions(options, value, multiple);
24162
- const classes = select({ size: size2, multiple, autoSize });
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 });
24163
24202
  const menuClasses = menu({
24164
24203
  density,
24165
24204
  layer: floatingLayer,
@@ -24177,7 +24216,7 @@ const Select = (props) => {
24177
24216
  setOpenedByKeyboard(true);
24178
24217
  setOpenState(true);
24179
24218
  }
24180
- if (!multiple && hasValue && (event.key === "Backspace" || event.key === "Delete")) {
24219
+ if (!multiple && clearable && hasValue && (event.key === "Backspace" || event.key === "Delete")) {
24181
24220
  event.preventDefault();
24182
24221
  handleValueChange(null);
24183
24222
  }
@@ -24190,7 +24229,9 @@ const Select = (props) => {
24190
24229
  return;
24191
24230
  }
24192
24231
  if (value === optionValue) {
24193
- handleValueChange(null);
24232
+ if (clearable) {
24233
+ handleValueChange(null);
24234
+ }
24194
24235
  setOpenState(false);
24195
24236
  return;
24196
24237
  }
@@ -24219,7 +24260,7 @@ const Select = (props) => {
24219
24260
  },
24220
24261
  selectedValue
24221
24262
  )),
24222
- /* @__PURE__ */ jsx(
24263
+ /* @__PURE__ */ jsxs(
24223
24264
  Box,
24224
24265
  {
24225
24266
  as: "div",
@@ -24244,37 +24285,40 @@ const Select = (props) => {
24244
24285
  onKeyDown: handleTriggerKeyDown
24245
24286
  }),
24246
24287
  ...otherProps,
24247
- children: multiple && selectedOptions.length > 0 ? /* @__PURE__ */ jsx(Box, { className: cx(classes.content, classes.chips), children: selectedOptions.map((option) => /* @__PURE__ */ jsx(
24248
- Box,
24249
- {
24250
- onMouseDown: (event) => {
24251
- event.preventDefault();
24252
- event.stopPropagation();
24253
- },
24254
- onClick: (event) => {
24255
- event.stopPropagation();
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
+ )
24256
24309
  },
24257
- children: /* @__PURE__ */ jsx(
24258
- Chip,
24259
- {
24260
- size: chipSize,
24261
- dismissable: true,
24262
- onDismiss: () => handleChipDismiss(option.props.value),
24263
- children: option.props.label
24264
- }
24265
- )
24266
- },
24267
- option.props.value
24268
- )) }) : /* @__PURE__ */ jsx(
24269
- Box,
24270
- {
24271
- className: cx(
24272
- classes.content,
24273
- hasValue ? classes.value : classes.placeholder
24274
- ),
24275
- children: displayValue
24276
- }
24277
- )
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
+ ]
24278
24322
  }
24279
24323
  ),
24280
24324
  /* @__PURE__ */ jsx(
@@ -24324,6 +24368,10 @@ const Select = (props) => {
24324
24368
  const optionLabel = getOptionText(option);
24325
24369
  const isSelected = multiple ? selectedValueSet.has(option.props.value) : value === option.props.value;
24326
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";
24327
24375
  return /* @__PURE__ */ jsx(
24328
24376
  ListItem,
24329
24377
  {
@@ -24337,9 +24385,11 @@ const Select = (props) => {
24337
24385
  variant: multiple ? "checkbox" : "default",
24338
24386
  label: optionLabel,
24339
24387
  description: option.props.description,
24340
- iconBefore: !multiple ? isSelected && isPointed ? "x" : option.props.iconLeft ?? "check" : option.props.iconLeft,
24341
- iconBeforeFill: !multiple ? isSelected ? "icon" : option.props.iconLeft ? void 0 : "transparent" : void 0,
24342
- iconAfter: option.props.iconRight,
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,
24343
24393
  ...getItemProps({
24344
24394
  onClick: () => {
24345
24395
  if (!option.props.disabled) {