@drivenets/design-system 0.18.0 → 0.18.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.
package/dist/index.js CHANGED
@@ -9030,13 +9030,8 @@ const DsDrawer = Object.assign(DsDrawerRoot, {
9030
9030
  //#region src/components/ds-tag-filter/ds-tag-filter.module.scss
9031
9031
  var ds_tag_filter_module_default = {
9032
9032
  "actionButton": "pHs_ea_actionButton",
9033
+ "actions": "pHs_ea_actions",
9033
9034
  "container": "pHs_ea_container",
9034
- "expanded": "pHs_ea_expanded",
9035
- "ghostButtonContent": "pHs_ea_ghostButtonContent",
9036
- "header": "pHs_ea_header",
9037
- "headerActions": "pHs_ea_headerActions",
9038
- "itemCheckbox": "pHs_ea_itemCheckbox",
9039
- "label": "pHs_ea_label",
9040
9035
  "measurementContainer": "pHs_ea_measurementContainer",
9041
9036
  "tagsArea": "pHs_ea_tagsArea"
9042
9037
  };
@@ -9086,14 +9081,11 @@ function getElementMeasurements(measurementContainer) {
9086
9081
  //#endregion
9087
9082
  //#region src/components/ds-tag-filter/hooks/use-tag-overflow-calculation.ts
9088
9083
  /**
9089
- * Custom hook to calculate how many tags fit in the available container width.
9090
- *
9091
- * Tags occupy the full container width. Non-tag elements (label, clear button,
9092
- * expand control) live in a separate header row and don't affect the calculation.
9084
+ * Custom hook to calculate how many tags fit on the first row of the tags-area.
9093
9085
  */
9094
9086
  const useTagOverflowCalculation = (t0) => {
9095
9087
  const $ = c(15);
9096
- const { containerRef, measurementRef, totalItems, expanded } = t0;
9088
+ const { tagsAreaRef, measurementRef, totalItems, expanded } = t0;
9097
9089
  let t1;
9098
9090
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
9099
9091
  t1 = {
@@ -9104,10 +9096,10 @@ const useTagOverflowCalculation = (t0) => {
9104
9096
  } else t1 = $[0];
9105
9097
  const [state, setState] = useState(t1);
9106
9098
  let t2;
9107
- if ($[1] !== containerRef || $[2] !== measurementRef) {
9099
+ if ($[1] !== measurementRef || $[2] !== tagsAreaRef) {
9108
9100
  t2 = () => {
9109
- if (!containerRef.current || !measurementRef.current) return;
9110
- const container = containerRef.current;
9101
+ if (!tagsAreaRef.current || !measurementRef.current) return;
9102
+ const tagsArea = tagsAreaRef.current;
9111
9103
  const measurementContainer = measurementRef.current;
9112
9104
  const { tagWidths, gap } = getElementMeasurements(measurementContainer);
9113
9105
  if (tagWidths.length === 0) {
@@ -9117,20 +9109,20 @@ const useTagOverflowCalculation = (t0) => {
9117
9109
  });
9118
9110
  return;
9119
9111
  }
9120
- const { count } = fitTagsInRow(tagWidths, getContainerAvailableWidth(container), gap);
9112
+ const { count } = fitTagsInRow(tagWidths, getContainerAvailableWidth(tagsArea), gap);
9121
9113
  const hasOverflow = count < tagWidths.length;
9122
9114
  setState({
9123
9115
  visibleTagCount: count,
9124
9116
  hasOverflow
9125
9117
  });
9126
9118
  };
9127
- $[1] = containerRef;
9128
- $[2] = measurementRef;
9119
+ $[1] = measurementRef;
9120
+ $[2] = tagsAreaRef;
9129
9121
  $[3] = t2;
9130
9122
  } else t2 = $[3];
9131
9123
  const calculateLayout = t2;
9132
9124
  let t3;
9133
- if ($[4] !== calculateLayout || $[5] !== containerRef) {
9125
+ if ($[4] !== calculateLayout || $[5] !== tagsAreaRef) {
9134
9126
  t3 = () => {
9135
9127
  const rafId = requestAnimationFrame(() => {
9136
9128
  calculateLayout();
@@ -9140,41 +9132,41 @@ const useTagOverflowCalculation = (t0) => {
9140
9132
  calculateLayout();
9141
9133
  });
9142
9134
  });
9143
- if (containerRef.current) resizeObserver.observe(containerRef.current);
9135
+ if (tagsAreaRef.current) resizeObserver.observe(tagsAreaRef.current);
9144
9136
  return () => {
9145
9137
  cancelAnimationFrame(rafId);
9146
9138
  resizeObserver.disconnect();
9147
9139
  };
9148
9140
  };
9149
9141
  $[4] = calculateLayout;
9150
- $[5] = containerRef;
9142
+ $[5] = tagsAreaRef;
9151
9143
  $[6] = t3;
9152
9144
  } else t3 = $[6];
9153
9145
  let t4;
9154
- if ($[7] !== calculateLayout || $[8] !== containerRef || $[9] !== expanded || $[10] !== measurementRef || $[11] !== totalItems) {
9146
+ if ($[7] !== calculateLayout || $[8] !== expanded || $[9] !== measurementRef || $[10] !== tagsAreaRef || $[11] !== totalItems) {
9155
9147
  t4 = [
9156
- containerRef,
9148
+ tagsAreaRef,
9157
9149
  measurementRef,
9158
9150
  totalItems,
9159
9151
  expanded,
9160
9152
  calculateLayout
9161
9153
  ];
9162
9154
  $[7] = calculateLayout;
9163
- $[8] = containerRef;
9164
- $[9] = expanded;
9165
- $[10] = measurementRef;
9155
+ $[8] = expanded;
9156
+ $[9] = measurementRef;
9157
+ $[10] = tagsAreaRef;
9166
9158
  $[11] = totalItems;
9167
9159
  $[12] = t4;
9168
9160
  } else t4 = $[12];
9169
9161
  useLayoutEffect(t3, t4);
9170
9162
  if (expanded) {
9171
9163
  let t5;
9172
- if ($[13] !== totalItems) {
9164
+ if ($[13] !== state) {
9173
9165
  t5 = {
9174
- visibleTagCount: totalItems,
9166
+ ...state,
9175
9167
  hasOverflow: true
9176
9168
  };
9177
- $[13] = totalItems;
9169
+ $[13] = state;
9178
9170
  $[14] = t5;
9179
9171
  } else t5 = $[14];
9180
9172
  return t5;
@@ -9185,13 +9177,9 @@ const useTagOverflowCalculation = (t0) => {
9185
9177
  //#region src/components/ds-tag-filter/ds-tag-filter.tsx
9186
9178
  /**
9187
9179
  * Design system TagFilter component
9188
- *
9189
- * A component for displaying active filters as tags with overflow handling.
9190
- * Non-tag elements (label, expand/collapse, clear) sit in a header row.
9191
- * Tags occupy the full width below, wrapping as needed.
9192
9180
  */
9193
9181
  const DsTagFilter = (t0) => {
9194
- const $ = c(62);
9182
+ const $ = c(55);
9195
9183
  const { items, locale: t1, className, style, onClearAll, onItemDelete, onItemSelect, onExpand } = t0;
9196
9184
  let t2;
9197
9185
  if ($[0] !== t1) {
@@ -9201,12 +9189,12 @@ const DsTagFilter = (t0) => {
9201
9189
  } else t2 = $[1];
9202
9190
  const locale = t2;
9203
9191
  const [expanded, setExpanded] = useState(false);
9204
- const containerRef = useRef(null);
9192
+ const tagsAreaRef = useRef(null);
9205
9193
  const measurementRef = useRef(null);
9206
9194
  let t3;
9207
9195
  if ($[2] !== expanded || $[3] !== items.length) {
9208
9196
  t3 = {
9209
- containerRef,
9197
+ tagsAreaRef,
9210
9198
  measurementRef,
9211
9199
  totalItems: items.length,
9212
9200
  expanded
@@ -9216,25 +9204,24 @@ const DsTagFilter = (t0) => {
9216
9204
  $[4] = t3;
9217
9205
  } else t3 = $[4];
9218
9206
  const { visibleTagCount, hasOverflow } = useTagOverflowCalculation(t3);
9219
- const { label: t4, clearButton: t5, showMore: t6, showLess: t7 } = locale;
9220
- const label = t4 === void 0 ? "Filtered by:" : t4;
9221
- const clearButton = t5 === void 0 ? "Clear all filters" : t5;
9222
- const showMore = t6 === void 0 ? "Show more" : t6;
9223
- const showLess = t7 === void 0 ? "Show less" : t7;
9224
- let t8;
9207
+ const { clearButton: t4, showMore: t5, showLess: t6 } = locale;
9208
+ const clearButton = t4 === void 0 ? "Clear all filters" : t4;
9209
+ const showMore = t5 === void 0 ? "Show more" : t5;
9210
+ const showLess = t6 === void 0 ? "Show less" : t6;
9211
+ let t7;
9225
9212
  if ($[5] !== expanded || $[6] !== items || $[7] !== visibleTagCount) {
9226
- t8 = expanded ? items : items.slice(0, visibleTagCount);
9213
+ t7 = expanded ? items : items.slice(0, visibleTagCount);
9227
9214
  $[5] = expanded;
9228
9215
  $[6] = items;
9229
9216
  $[7] = visibleTagCount;
9230
- $[8] = t8;
9231
- } else t8 = $[8];
9232
- const visibleTags = t8;
9217
+ $[8] = t7;
9218
+ } else t7 = $[8];
9219
+ const visibleTags = t7;
9233
9220
  const hiddenCount = items.length - visibleTagCount;
9234
9221
  if (items.length === 0) return null;
9235
- let t9;
9222
+ let t8;
9236
9223
  if ($[9] !== onItemDelete || $[10] !== onItemSelect) {
9237
- t9 = (item) => ({
9224
+ t8 = (item) => ({
9238
9225
  ...item.slotProps?.tag,
9239
9226
  label: item.label,
9240
9227
  selected: item.selected,
@@ -9243,180 +9230,159 @@ const DsTagFilter = (t0) => {
9243
9230
  });
9244
9231
  $[9] = onItemDelete;
9245
9232
  $[10] = onItemSelect;
9246
- $[11] = t9;
9247
- } else t9 = $[11];
9248
- const buildTagProps = t9;
9249
- let t10;
9233
+ $[11] = t8;
9234
+ } else t8 = $[11];
9235
+ const buildTagProps = t8;
9236
+ let t9;
9250
9237
  if ($[12] !== buildTagProps) {
9251
- t10 = (item_0) => /* @__PURE__ */ jsx(DsTag, { ...buildTagProps(item_0) }, item_0.id);
9238
+ t9 = (item_0) => /* @__PURE__ */ jsx(DsTag, { ...buildTagProps(item_0) }, item_0.id);
9252
9239
  $[12] = buildTagProps;
9253
- $[13] = t10;
9254
- } else t10 = $[13];
9255
- const renderTag = t10;
9256
- let t11;
9240
+ $[13] = t9;
9241
+ } else t9 = $[13];
9242
+ const renderTag = t9;
9243
+ let t10;
9257
9244
  if ($[14] !== expanded || $[15] !== onExpand) {
9258
- t11 = () => {
9245
+ t10 = () => {
9259
9246
  const newExpanded = !expanded;
9260
9247
  setExpanded(newExpanded);
9261
9248
  onExpand?.(newExpanded);
9262
9249
  };
9263
9250
  $[14] = expanded;
9264
9251
  $[15] = onExpand;
9265
- $[16] = t11;
9266
- } else t11 = $[16];
9267
- const handleExpandToggle = t11;
9268
- let t12;
9252
+ $[16] = t10;
9253
+ } else t10 = $[16];
9254
+ const handleExpandToggle = t10;
9255
+ let t11;
9269
9256
  if ($[17] !== buildTagProps || $[18] !== items) {
9270
- let t13;
9257
+ let t12;
9271
9258
  if ($[20] !== buildTagProps) {
9272
- t13 = (item_1) => /* @__PURE__ */ jsx(DsTag, {
9259
+ t12 = (item_1) => /* @__PURE__ */ jsx(DsTag, {
9273
9260
  "data-measure-tag": "",
9274
9261
  ...buildTagProps(item_1)
9275
9262
  }, item_1.id);
9276
9263
  $[20] = buildTagProps;
9277
- $[21] = t13;
9278
- } else t13 = $[21];
9279
- t12 = items.map(t13);
9264
+ $[21] = t12;
9265
+ } else t12 = $[21];
9266
+ t11 = items.map(t12);
9280
9267
  $[17] = buildTagProps;
9281
9268
  $[18] = items;
9282
- $[19] = t12;
9283
- } else t12 = $[19];
9284
- let t13;
9285
- if ($[22] !== t12) {
9286
- t13 = /* @__PURE__ */ jsx("div", {
9269
+ $[19] = t11;
9270
+ } else t11 = $[19];
9271
+ let t12;
9272
+ if ($[22] !== t11) {
9273
+ t12 = /* @__PURE__ */ jsx("div", {
9287
9274
  ref: measurementRef,
9288
9275
  className: ds_tag_filter_module_default.measurementContainer,
9289
9276
  "aria-hidden": "true",
9290
- children: t12
9277
+ children: t11
9291
9278
  });
9292
- $[22] = t12;
9293
- $[23] = t13;
9294
- } else t13 = $[23];
9295
- const measurementContainer = t13;
9296
- const t14 = expanded && ds_tag_filter_module_default.expanded;
9297
- let t15;
9298
- if ($[24] !== className || $[25] !== t14) {
9299
- t15 = classNames(ds_tag_filter_module_default.container, t14, className);
9279
+ $[22] = t11;
9280
+ $[23] = t12;
9281
+ } else t12 = $[23];
9282
+ const measurementContainer = t12;
9283
+ const toggleLabel = expanded ? showLess : showMore;
9284
+ let t13;
9285
+ if ($[24] !== className) {
9286
+ t13 = classNames(ds_tag_filter_module_default.container, className);
9300
9287
  $[24] = className;
9301
- $[25] = t14;
9302
- $[26] = t15;
9303
- } else t15 = $[26];
9288
+ $[25] = t13;
9289
+ } else t13 = $[25];
9290
+ let t14;
9291
+ if ($[26] !== renderTag || $[27] !== visibleTags) {
9292
+ let t15;
9293
+ if ($[29] !== renderTag) {
9294
+ t15 = (item_2) => renderTag(item_2);
9295
+ $[29] = renderTag;
9296
+ $[30] = t15;
9297
+ } else t15 = $[30];
9298
+ t14 = visibleTags.map(t15);
9299
+ $[26] = renderTag;
9300
+ $[27] = visibleTags;
9301
+ $[28] = t14;
9302
+ } else t14 = $[28];
9303
+ let t15;
9304
+ if ($[31] !== t14) {
9305
+ t15 = /* @__PURE__ */ jsx("div", {
9306
+ ref: tagsAreaRef,
9307
+ className: ds_tag_filter_module_default.tagsArea,
9308
+ "aria-live": "polite",
9309
+ children: t14
9310
+ });
9311
+ $[31] = t14;
9312
+ $[32] = t15;
9313
+ } else t15 = $[32];
9304
9314
  let t16;
9305
- if ($[27] !== label) {
9306
- t16 = label && /* @__PURE__ */ jsx(DsTypography, {
9307
- variant: "body-sm-reg",
9308
- className: ds_tag_filter_module_default.label,
9309
- children: label
9315
+ if ($[33] !== expanded || $[34] !== handleExpandToggle || $[35] !== hasOverflow || $[36] !== hiddenCount || $[37] !== toggleLabel) {
9316
+ t16 = hasOverflow && /* @__PURE__ */ jsxs(DsButtonV3, {
9317
+ variant: "tertiary",
9318
+ size: "small",
9319
+ className: ds_tag_filter_module_default.actionButton,
9320
+ "aria-expanded": expanded,
9321
+ onClick: handleExpandToggle,
9322
+ children: [`${toggleLabel} (${String(hiddenCount)})`, /* @__PURE__ */ jsx(DsIcon, {
9323
+ icon: expanded ? "keyboard_arrow_up" : "keyboard_arrow_down",
9324
+ size: "tiny",
9325
+ "aria-hidden": true
9326
+ })]
9310
9327
  });
9311
- $[27] = label;
9312
- $[28] = t16;
9313
- } else t16 = $[28];
9328
+ $[33] = expanded;
9329
+ $[34] = handleExpandToggle;
9330
+ $[35] = hasOverflow;
9331
+ $[36] = hiddenCount;
9332
+ $[37] = toggleLabel;
9333
+ $[38] = t16;
9334
+ } else t16 = $[38];
9314
9335
  let t17;
9315
- if ($[29] !== expanded || $[30] !== handleExpandToggle || $[31] !== hasOverflow || $[32] !== hiddenCount || $[33] !== showLess || $[34] !== showMore) {
9316
- t17 = hasOverflow && /* @__PURE__ */ jsxs(DsButton, {
9317
- design: "v1.2",
9318
- buttonType: "tertiary",
9319
- variant: "ghost",
9320
- className: ds_tag_filter_module_default.actionButton,
9321
- contentClassName: ds_tag_filter_module_default.ghostButtonContent,
9336
+ if ($[39] !== clearButton || $[40] !== onClearAll) {
9337
+ t17 = onClearAll && /* @__PURE__ */ jsx(DsButtonV3, {
9338
+ variant: "tertiary",
9322
9339
  size: "small",
9323
- onClick: handleExpandToggle,
9324
- children: [/* @__PURE__ */ jsx(DsIcon, { icon: expanded ? "keyboard_arrow_up" : "keyboard_arrow_down" }), expanded ? showLess : `${showMore} (${String(hiddenCount)})`]
9325
- });
9326
- $[29] = expanded;
9327
- $[30] = handleExpandToggle;
9328
- $[31] = hasOverflow;
9329
- $[32] = hiddenCount;
9330
- $[33] = showLess;
9331
- $[34] = showMore;
9332
- $[35] = t17;
9333
- } else t17 = $[35];
9334
- let t18;
9335
- if ($[36] !== clearButton || $[37] !== onClearAll) {
9336
- t18 = onClearAll && /* @__PURE__ */ jsxs(DsButton, {
9337
- design: "v1.2",
9338
- buttonType: "tertiary",
9339
- variant: "ghost",
9340
+ icon: "close",
9340
9341
  className: ds_tag_filter_module_default.actionButton,
9341
- contentClassName: ds_tag_filter_module_default.ghostButtonContent,
9342
- size: "small",
9343
9342
  onClick: onClearAll,
9344
- children: [/* @__PURE__ */ jsx(DsIcon, { icon: "close" }), clearButton]
9343
+ children: clearButton
9344
+ });
9345
+ $[39] = clearButton;
9346
+ $[40] = onClearAll;
9347
+ $[41] = t17;
9348
+ } else t17 = $[41];
9349
+ let t18;
9350
+ if ($[42] !== t16 || $[43] !== t17) {
9351
+ t18 = /* @__PURE__ */ jsxs("div", {
9352
+ className: ds_tag_filter_module_default.actions,
9353
+ children: [t16, t17]
9345
9354
  });
9346
- $[36] = clearButton;
9347
- $[37] = onClearAll;
9348
- $[38] = t18;
9349
- } else t18 = $[38];
9355
+ $[42] = t16;
9356
+ $[43] = t17;
9357
+ $[44] = t18;
9358
+ } else t18 = $[44];
9350
9359
  let t19;
9351
- if ($[39] !== t17 || $[40] !== t18) {
9360
+ if ($[45] !== style || $[46] !== t13 || $[47] !== t15 || $[48] !== t18) {
9352
9361
  t19 = /* @__PURE__ */ jsxs("div", {
9353
- className: ds_tag_filter_module_default.headerActions,
9354
- children: [t17, t18]
9362
+ className: t13,
9363
+ style,
9364
+ children: [t15, t18]
9355
9365
  });
9356
- $[39] = t17;
9357
- $[40] = t18;
9358
- $[41] = t19;
9359
- } else t19 = $[41];
9366
+ $[45] = style;
9367
+ $[46] = t13;
9368
+ $[47] = t15;
9369
+ $[48] = t18;
9370
+ $[49] = t19;
9371
+ } else t19 = $[49];
9360
9372
  let t20;
9361
- if ($[42] !== t16 || $[43] !== t19) {
9362
- t20 = /* @__PURE__ */ jsxs("div", {
9363
- className: ds_tag_filter_module_default.header,
9364
- children: [t16, t19]
9365
- });
9366
- $[42] = t16;
9367
- $[43] = t19;
9368
- $[44] = t20;
9369
- } else t20 = $[44];
9373
+ if ($[50] !== measurementContainer) {
9374
+ t20 = createPortal(measurementContainer, document.body);
9375
+ $[50] = measurementContainer;
9376
+ $[51] = t20;
9377
+ } else t20 = $[51];
9370
9378
  let t21;
9371
- if ($[45] !== renderTag || $[46] !== visibleTags) {
9372
- let t22;
9373
- if ($[48] !== renderTag) {
9374
- t22 = (item_2) => renderTag(item_2);
9375
- $[48] = renderTag;
9376
- $[49] = t22;
9377
- } else t22 = $[49];
9378
- t21 = visibleTags.map(t22);
9379
- $[45] = renderTag;
9380
- $[46] = visibleTags;
9381
- $[47] = t21;
9382
- } else t21 = $[47];
9383
- let t22;
9384
- if ($[50] !== t21) {
9385
- t22 = /* @__PURE__ */ jsx("div", {
9386
- className: ds_tag_filter_module_default.tagsArea,
9387
- children: t21
9388
- });
9389
- $[50] = t21;
9390
- $[51] = t22;
9391
- } else t22 = $[51];
9392
- let t23;
9393
- if ($[52] !== style || $[53] !== t15 || $[54] !== t20 || $[55] !== t22) {
9394
- t23 = /* @__PURE__ */ jsxs("div", {
9395
- ref: containerRef,
9396
- className: t15,
9397
- style,
9398
- children: [t20, t22]
9399
- });
9400
- $[52] = style;
9401
- $[53] = t15;
9402
- $[54] = t20;
9403
- $[55] = t22;
9404
- $[56] = t23;
9405
- } else t23 = $[56];
9406
- let t24;
9407
- if ($[57] !== measurementContainer) {
9408
- t24 = createPortal(measurementContainer, document.body);
9409
- $[57] = measurementContainer;
9410
- $[58] = t24;
9411
- } else t24 = $[58];
9412
- let t25;
9413
- if ($[59] !== t23 || $[60] !== t24) {
9414
- t25 = /* @__PURE__ */ jsxs(Fragment, { children: [t23, t24] });
9415
- $[59] = t23;
9416
- $[60] = t24;
9417
- $[61] = t25;
9418
- } else t25 = $[61];
9419
- return t25;
9379
+ if ($[52] !== t19 || $[53] !== t20) {
9380
+ t21 = /* @__PURE__ */ jsxs(Fragment, { children: [t19, t20] });
9381
+ $[52] = t19;
9382
+ $[53] = t20;
9383
+ $[54] = t21;
9384
+ } else t21 = $[54];
9385
+ return t21;
9420
9386
  };
9421
9387
  DsTagFilter.displayName = "DsTagFilter";
9422
9388
  //#endregion