@ceed/cds 1.18.0-next.1 → 1.18.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.cjs CHANGED
@@ -444,11 +444,6 @@ var itemHeightMap = {
444
444
  md: { default: 36, secondary: 55 },
445
445
  lg: { default: 44, secondary: 65 }
446
446
  };
447
- var optionPaddingMap = {
448
- sm: { px: "8px", py: "3px" },
449
- md: { px: "12px", py: "4px" },
450
- lg: { px: "16px", py: "6px" }
451
- };
452
447
  var AutocompleteListBox = import_react6.default.forwardRef((props, ref) => {
453
448
  const {
454
449
  anchorEl,
@@ -493,7 +488,7 @@ var AutocompleteListBox = import_react6.default.forwardRef((props, ref) => {
493
488
  virtualizer.measure();
494
489
  }
495
490
  }, [open, virtualizer]);
496
- return /* @__PURE__ */ import_react6.default.createElement(AutocompletePopper, { ref, anchorEl, open, modifiers }, /* @__PURE__ */ import_react6.default.createElement(import_joy10.AutocompleteListbox, { ...innerProps }, /* @__PURE__ */ import_react6.default.createElement("div", { ref: parentRef, style: { overflow: "auto" } }, /* @__PURE__ */ import_react6.default.createElement(
491
+ return /* @__PURE__ */ import_react6.default.createElement(AutocompletePopper, { ref, anchorEl, open, modifiers }, /* @__PURE__ */ import_react6.default.createElement(import_joy10.AutocompleteListbox, { ...innerProps, size: fontSize }, /* @__PURE__ */ import_react6.default.createElement("div", { ref: parentRef, style: { overflow: "auto" } }, /* @__PURE__ */ import_react6.default.createElement(
497
492
  "div",
498
493
  {
499
494
  style: {
@@ -550,6 +545,12 @@ var AutocompleteTagDelete = (0, import_joy10.styled)(IconButton_default, {
550
545
  minHeight: autocompleteDeleteSize[size],
551
546
  borderRadius: "50%"
552
547
  }));
548
+ var autocompleteFilterOptions = (0, import_base.createFilterOptions)({
549
+ stringify: (option) => {
550
+ return option.secondaryText ? `${option.label} ${option.secondaryText}` : option.label;
551
+ }
552
+ });
553
+ var getOptionLabel = (option) => `${option.label ?? ""}`;
553
554
  function Autocomplete(props) {
554
555
  const {
555
556
  label,
@@ -625,6 +626,14 @@ function Autocomplete(props) {
625
626
  () => applySize(value?.endDecorator || props.endDecorator),
626
627
  [value, applySize, props.endDecorator]
627
628
  );
629
+ const slotProps = (0, import_react6.useMemo)(
630
+ () => ({
631
+ listbox: {
632
+ hasSecondaryText: options.some((opt) => opt.secondaryText)
633
+ }
634
+ }),
635
+ [options]
636
+ );
628
637
  const handleChange = (0, import_react6.useCallback)(
629
638
  (event, value2) => {
630
639
  const newValue = value2;
@@ -655,7 +664,7 @@ function Autocomplete(props) {
655
664
  disabled,
656
665
  startDecorator,
657
666
  endDecorator,
658
- getOptionLabel: (option) => `${option.label ?? ""}`,
667
+ getOptionLabel,
659
668
  renderTags: (tags, getTagProps) => tags.map((tag, index) => {
660
669
  const { onClick, ...rest } = getTagProps({ index });
661
670
  return applySize(
@@ -667,18 +676,9 @@ function Autocomplete(props) {
667
676
  slots: {
668
677
  listbox: AutocompleteListBox
669
678
  },
670
- slotProps: {
671
- listbox: {
672
- hasSecondaryText: options.some((opt) => opt.secondaryText)
673
- }
674
- },
675
- filterOptions: (0, import_base.createFilterOptions)({
676
- stringify: (option) => {
677
- const opt = option;
678
- return opt.secondaryText ? `${opt.label} ${opt.secondaryText}` : opt.label;
679
- }
680
- }),
681
- renderOption: (props2, option) => /* @__PURE__ */ import_react6.default.createElement(import_joy10.AutocompleteOption, { ...props2, sx: optionPaddingMap[size ?? "md"] }, option.startDecorator && /* @__PURE__ */ import_react6.default.createElement(
679
+ slotProps,
680
+ filterOptions: autocompleteFilterOptions,
681
+ renderOption: (props2, option) => /* @__PURE__ */ import_react6.default.createElement(import_joy10.AutocompleteOption, { ...props2 }, option.startDecorator && /* @__PURE__ */ import_react6.default.createElement(
682
682
  import_joy10.ListItemDecorator,
683
683
  {
684
684
  sx: (theme) => ({
package/dist/index.js CHANGED
@@ -357,11 +357,6 @@ var itemHeightMap = {
357
357
  md: { default: 36, secondary: 55 },
358
358
  lg: { default: 44, secondary: 65 }
359
359
  };
360
- var optionPaddingMap = {
361
- sm: { px: "8px", py: "3px" },
362
- md: { px: "12px", py: "4px" },
363
- lg: { px: "16px", py: "6px" }
364
- };
365
360
  var AutocompleteListBox = React5.forwardRef((props, ref) => {
366
361
  const {
367
362
  anchorEl,
@@ -406,7 +401,7 @@ var AutocompleteListBox = React5.forwardRef((props, ref) => {
406
401
  virtualizer.measure();
407
402
  }
408
403
  }, [open, virtualizer]);
409
- return /* @__PURE__ */ React5.createElement(AutocompletePopper, { ref, anchorEl, open, modifiers }, /* @__PURE__ */ React5.createElement(JoyAutocompleteListbox, { ...innerProps }, /* @__PURE__ */ React5.createElement("div", { ref: parentRef, style: { overflow: "auto" } }, /* @__PURE__ */ React5.createElement(
404
+ return /* @__PURE__ */ React5.createElement(AutocompletePopper, { ref, anchorEl, open, modifiers }, /* @__PURE__ */ React5.createElement(JoyAutocompleteListbox, { ...innerProps, size: fontSize }, /* @__PURE__ */ React5.createElement("div", { ref: parentRef, style: { overflow: "auto" } }, /* @__PURE__ */ React5.createElement(
410
405
  "div",
411
406
  {
412
407
  style: {
@@ -463,6 +458,12 @@ var AutocompleteTagDelete = styled3(IconButton_default, {
463
458
  minHeight: autocompleteDeleteSize[size],
464
459
  borderRadius: "50%"
465
460
  }));
461
+ var autocompleteFilterOptions = createFilterOptions({
462
+ stringify: (option) => {
463
+ return option.secondaryText ? `${option.label} ${option.secondaryText}` : option.label;
464
+ }
465
+ });
466
+ var getOptionLabel = (option) => `${option.label ?? ""}`;
466
467
  function Autocomplete(props) {
467
468
  const {
468
469
  label,
@@ -538,6 +539,14 @@ function Autocomplete(props) {
538
539
  () => applySize(value?.endDecorator || props.endDecorator),
539
540
  [value, applySize, props.endDecorator]
540
541
  );
542
+ const slotProps = useMemo(
543
+ () => ({
544
+ listbox: {
545
+ hasSecondaryText: options.some((opt) => opt.secondaryText)
546
+ }
547
+ }),
548
+ [options]
549
+ );
541
550
  const handleChange = useCallback2(
542
551
  (event, value2) => {
543
552
  const newValue = value2;
@@ -568,7 +577,7 @@ function Autocomplete(props) {
568
577
  disabled,
569
578
  startDecorator,
570
579
  endDecorator,
571
- getOptionLabel: (option) => `${option.label ?? ""}`,
580
+ getOptionLabel,
572
581
  renderTags: (tags, getTagProps) => tags.map((tag, index) => {
573
582
  const { onClick, ...rest } = getTagProps({ index });
574
583
  return applySize(
@@ -580,18 +589,9 @@ function Autocomplete(props) {
580
589
  slots: {
581
590
  listbox: AutocompleteListBox
582
591
  },
583
- slotProps: {
584
- listbox: {
585
- hasSecondaryText: options.some((opt) => opt.secondaryText)
586
- }
587
- },
588
- filterOptions: createFilterOptions({
589
- stringify: (option) => {
590
- const opt = option;
591
- return opt.secondaryText ? `${opt.label} ${opt.secondaryText}` : opt.label;
592
- }
593
- }),
594
- renderOption: (props2, option) => /* @__PURE__ */ React5.createElement(JoyAutocompleteOption, { ...props2, sx: optionPaddingMap[size ?? "md"] }, option.startDecorator && /* @__PURE__ */ React5.createElement(
592
+ slotProps,
593
+ filterOptions: autocompleteFilterOptions,
594
+ renderOption: (props2, option) => /* @__PURE__ */ React5.createElement(JoyAutocompleteOption, { ...props2 }, option.startDecorator && /* @__PURE__ */ React5.createElement(
595
595
  ListItemDecorator,
596
596
  {
597
597
  sx: (theme) => ({