cetec-design-system 4.8.0-0 → 4.9.1-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
@@ -22761,12 +22761,31 @@ const DrawerFooter = (props) => {
22761
22761
  const classes = drawer();
22762
22762
  return /* @__PURE__ */ jsx(Box, { className: cx(classes.footer, className), ...otherProps, children });
22763
22763
  };
22764
+ const useClipped = (text2, mode) => {
22765
+ const ref = useRef(null);
22766
+ const [clipped, setClipped] = useState(false);
22767
+ useLayoutEffect(() => {
22768
+ const node = ref.current;
22769
+ if (!node) {
22770
+ setClipped(false);
22771
+ return;
22772
+ }
22773
+ const check = () => setClipped(node.scrollWidth > node.clientWidth);
22774
+ check();
22775
+ if (typeof ResizeObserver === "undefined") return;
22776
+ const observer = new ResizeObserver(check);
22777
+ observer.observe(node);
22778
+ return () => observer.disconnect();
22779
+ }, [text2, mode]);
22780
+ return [ref, clipped];
22781
+ };
22764
22782
  const MAX_VISIBLE_VALUES = 2;
22765
22783
  const FilterToken = (props) => {
22766
22784
  const {
22767
22785
  field,
22768
22786
  operator,
22769
22787
  value,
22788
+ joined,
22770
22789
  state = "applied",
22771
22790
  tone = "default",
22772
22791
  operatorLocked,
@@ -22785,25 +22804,13 @@ const FilterToken = (props) => {
22785
22804
  const { labels } = useLocale();
22786
22805
  const values = Array.isArray(value) ? value : void 0;
22787
22806
  const fullValue = Array.isArray(value) ? value.join(", ") : value;
22788
- const hidden = values ? Math.max(0, values.length - MAX_VISIBLE_VALUES) : 0;
22789
- const shownValue = values ? values.slice(0, MAX_VISIBLE_VALUES).join(", ") : value;
22790
- const sentence = [field, operator, fullValue].filter(Boolean).join(" ");
22807
+ const maxVisible = editor !== void 0 ? Infinity : MAX_VISIBLE_VALUES;
22808
+ const hidden = values ? Math.max(0, values.length - maxVisible) : 0;
22809
+ const shownValue = values ? values.slice(0, maxVisible).join(", ") : value;
22810
+ const sentence = [field, operator, fullValue, joined == null ? void 0 : joined.operator, joined == null ? void 0 : joined.value].filter(Boolean).join(" ");
22791
22811
  const keepFocus = retainFocus ? (e) => e.preventDefault() : void 0;
22792
- const valueTextRef = useRef(null);
22793
- const [clipped, setClipped] = useState(false);
22794
- useLayoutEffect(() => {
22795
- const node = valueTextRef.current;
22796
- if (!node) {
22797
- setClipped(false);
22798
- return;
22799
- }
22800
- const check = () => setClipped(node.scrollWidth > node.clientWidth);
22801
- check();
22802
- if (typeof ResizeObserver === "undefined") return;
22803
- const observer = new ResizeObserver(check);
22804
- observer.observe(node);
22805
- return () => observer.disconnect();
22806
- }, [shownValue, editor]);
22812
+ const [valueTextRef, clipped] = useClipped(shownValue, editor);
22813
+ const [joinedTextRef, joinedClipped] = useClipped(joined == null ? void 0 : joined.value, editor);
22807
22814
  const part = (slot, content, onClick, extra) => onClick ? /* @__PURE__ */ jsx(
22808
22815
  Box,
22809
22816
  {
@@ -22833,6 +22840,13 @@ const FilterToken = (props) => {
22833
22840
  /* @__PURE__ */ jsx(Box, { as: "span", srOnly: true, children: fullValue })
22834
22841
  ] })
22835
22842
  ] });
22843
+ const joinedOperator = joined && part(
22844
+ classes.operator,
22845
+ joined.operator,
22846
+ operatorLocked ? void 0 : onOperatorClick,
22847
+ operatorLocked ? { "data-locked": true } : void 0
22848
+ );
22849
+ const joinedContent = joined && /* @__PURE__ */ jsx(Box, { as: "span", ref: joinedTextRef, className: classes.valueText, children: joined.value });
22836
22850
  return /* @__PURE__ */ jsxs(
22837
22851
  Box,
22838
22852
  {
@@ -22863,11 +22877,21 @@ const FilterToken = (props) => {
22863
22877
  inert: disabled || void 0,
22864
22878
  children: [
22865
22879
  shownValue && /* @__PURE__ */ jsx(Box, { as: "span", className: classes.value, children: valueContent }),
22880
+ joined && /* @__PURE__ */ jsxs(Fragment, { children: [
22881
+ part(classes.operator, joined.operator, void 0),
22882
+ /* @__PURE__ */ jsx(Box, { as: "span", className: classes.value, children: joinedContent })
22883
+ ] }),
22866
22884
  editor
22867
22885
  ]
22868
22886
  }
22869
22887
  )
22870
- ) : value !== void 0 && /* @__PURE__ */ jsx(Tooltip, { text: fullValue ?? "", disabled: hidden === 0 && !clipped, children: part(classes.value, valueContent, onValueClick) }),
22888
+ ) : /* @__PURE__ */ jsxs(Fragment, { children: [
22889
+ value !== void 0 && /* @__PURE__ */ jsx(Tooltip, { text: fullValue ?? "", disabled: hidden === 0 && !clipped, children: part(classes.value, valueContent, onValueClick) }),
22890
+ joined && /* @__PURE__ */ jsxs(Fragment, { children: [
22891
+ joinedOperator,
22892
+ /* @__PURE__ */ jsx(Tooltip, { text: joined.value, disabled: !joinedClipped, children: part(classes.value, joinedContent, onValueClick) })
22893
+ ] })
22894
+ ] }),
22871
22895
  onRemove && state !== "removing" && /* @__PURE__ */ jsx(
22872
22896
  Box,
22873
22897
  {