@ceed/cds 1.15.0-next.8 → 1.15.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
@@ -3466,10 +3466,8 @@ TableBody.displayName = "TableBody";
3466
3466
 
3467
3467
  // src/components/Pagination/Pagination.tsx
3468
3468
  import React24, { useCallback as useCallback10, useEffect as useEffect6 } from "react";
3469
- import PreviousIcon from "@mui/icons-material/ChevronLeftRounded";
3470
- import NextIcon from "@mui/icons-material/ChevronRightRounded";
3471
- import FirstPageIcon from "@mui/icons-material/FirstPageRounded";
3472
- import LastPageIcon from "@mui/icons-material/LastPageRounded";
3469
+ import PreviousIcon from "@mui/icons-material/ChevronLeft";
3470
+ import NextIcon from "@mui/icons-material/ChevronRight";
3473
3471
  import { styled as styled13 } from "@mui/joy";
3474
3472
  var PaginationButton = styled13(Button_default, {
3475
3473
  name: "Pagination",
@@ -3528,7 +3526,6 @@ function Pagination(props) {
3528
3526
  onPageChange,
3529
3527
  rowCount,
3530
3528
  size = "md",
3531
- variant = "standard",
3532
3529
  ...innerProps
3533
3530
  } = props;
3534
3531
  const [paginationModel, setPaginationModel] = useControlledState(
@@ -3555,87 +3552,6 @@ function Pagination(props) {
3555
3552
  setPaginationModel({ ...paginationModel, page: lastPage });
3556
3553
  }
3557
3554
  }, [rowCount, paginationModel, lastPage, setPaginationModel]);
3558
- const pageOptions = Array.from({ length: lastPage }, (_, i) => ({
3559
- label: `${i + 1}`,
3560
- value: `${i + 1}`
3561
- }));
3562
- if (variant === "compact") {
3563
- return /* @__PURE__ */ React24.createElement(PaginationRoot, { ...innerProps }, /* @__PURE__ */ React24.createElement(PaginationContainer, { direction: "row", size, alignItems: "center" }, /* @__PURE__ */ React24.createElement(Stack_default, { direction: "row" }, /* @__PURE__ */ React24.createElement(
3564
- PaginationIconButton,
3565
- {
3566
- size,
3567
- variant: "plain",
3568
- color: "neutral",
3569
- onClick: () => handlePageChange(firstPage),
3570
- disabled: paginationModel.page === firstPage,
3571
- "aria-label": "First page"
3572
- },
3573
- /* @__PURE__ */ React24.createElement(FirstPageIcon, null)
3574
- ), /* @__PURE__ */ React24.createElement(
3575
- PaginationIconButton,
3576
- {
3577
- size,
3578
- variant: "plain",
3579
- color: "neutral",
3580
- onClick: () => handlePageChange(paginationModel.page - 1),
3581
- disabled: paginationModel.page === firstPage,
3582
- "aria-label": "Previous page"
3583
- },
3584
- /* @__PURE__ */ React24.createElement(PreviousIcon, null)
3585
- )), /* @__PURE__ */ React24.createElement(
3586
- Autocomplete_default,
3587
- {
3588
- size,
3589
- value: `${paginationModel.page}`,
3590
- onChange: (event) => {
3591
- if (event.target.value) {
3592
- handlePageChange(parseInt(event.target.value, 10));
3593
- }
3594
- },
3595
- options: pageOptions,
3596
- sx: {
3597
- width: {
3598
- sm: "80px",
3599
- md: "100px",
3600
- lg: "120px"
3601
- }[size]
3602
- }
3603
- }
3604
- ), /* @__PURE__ */ React24.createElement(
3605
- Typography_default,
3606
- {
3607
- level: `body-${size}`,
3608
- sx: (theme) => ({
3609
- color: theme.palette.text.secondary,
3610
- fontWeight: 500
3611
- })
3612
- },
3613
- "/ ",
3614
- lastPage
3615
- ), /* @__PURE__ */ React24.createElement(Stack_default, { direction: "row" }, /* @__PURE__ */ React24.createElement(
3616
- PaginationIconButton,
3617
- {
3618
- size,
3619
- variant: "plain",
3620
- color: "neutral",
3621
- onClick: () => handlePageChange(paginationModel.page + 1),
3622
- disabled: paginationModel.page === lastPage,
3623
- "aria-label": "Next page"
3624
- },
3625
- /* @__PURE__ */ React24.createElement(NextIcon, null)
3626
- ), /* @__PURE__ */ React24.createElement(
3627
- PaginationIconButton,
3628
- {
3629
- size,
3630
- variant: "plain",
3631
- color: "neutral",
3632
- onClick: () => handlePageChange(lastPage),
3633
- disabled: paginationModel.page === lastPage,
3634
- "aria-label": "Last page"
3635
- },
3636
- /* @__PURE__ */ React24.createElement(LastPageIcon, null)
3637
- ))));
3638
- }
3639
3555
  return /* @__PURE__ */ React24.createElement(PaginationRoot, { ...innerProps }, /* @__PURE__ */ React24.createElement(PaginationContainer, { direction: "row", size, alignItems: "center" }, /* @__PURE__ */ React24.createElement(
3640
3556
  PaginationIconButton,
3641
3557
  {
@@ -3657,7 +3573,7 @@ function Pagination(props) {
3657
3573
  "aria-label": "More previous pages"
3658
3574
  },
3659
3575
  "..."
3660
- ), beforePages.map((p) => /* @__PURE__ */ React24.createElement(PaginationButton, { key: p, size, variant: "plain", color: "neutral", onClick: () => handlePageChange(p) }, p)), /* @__PURE__ */ React24.createElement(PaginationButton, { active: "true", size, "aria-current": "page" }, paginationModel.page), afterPages.map((p) => /* @__PURE__ */ React24.createElement(PaginationButton, { key: p, size, variant: "plain", color: "neutral", onClick: () => handlePageChange(p) }, p)), isMoreAfterPages && /* @__PURE__ */ React24.createElement(
3576
+ ), beforePages.map((p) => /* @__PURE__ */ React24.createElement(PaginationButton, { key: p, size, variant: "plain", color: "neutral", onClick: () => handlePageChange(p) }, p)), /* @__PURE__ */ React24.createElement(PaginationButton, { active: "active", size, "aria-current": "page" }, paginationModel.page), afterPages.map((p) => /* @__PURE__ */ React24.createElement(PaginationButton, { key: p, size, variant: "plain", color: "neutral", onClick: () => handlePageChange(p) }, p)), isMoreAfterPages && /* @__PURE__ */ React24.createElement(
3661
3577
  PaginationButton,
3662
3578
  {
3663
3579
  size,
@@ -4528,11 +4444,52 @@ var InsetDrawer = styled20(JoyDrawer2)(({ theme }) => ({
4528
4444
 
4529
4445
  // src/components/FilterableCheckboxGroup/FilterableCheckboxGroup.tsx
4530
4446
  import React31, { useCallback as useCallback13, useEffect as useEffect8, useMemo as useMemo12, useRef as useRef8, useState as useState10 } from "react";
4531
- import { Input as Input2, Stack as Stack2 } from "@mui/joy";
4532
4447
  import SearchIcon from "@mui/icons-material/Search";
4533
4448
  import { useVirtualizer as useVirtualizer3 } from "@tanstack/react-virtual";
4449
+ function LabelWithTooltip(props) {
4450
+ const { label, size } = props;
4451
+ const labelContentRef = useRef8(null);
4452
+ const [isOverflowing, setIsOverflowing] = useState10(false);
4453
+ const labelContent = /* @__PURE__ */ React31.createElement(
4454
+ "span",
4455
+ {
4456
+ ref: labelContentRef,
4457
+ style: {
4458
+ textOverflow: "ellipsis",
4459
+ overflow: "hidden",
4460
+ whiteSpace: "nowrap",
4461
+ display: "block",
4462
+ position: "relative",
4463
+ zIndex: 1,
4464
+ cursor: "pointer"
4465
+ }
4466
+ },
4467
+ label
4468
+ );
4469
+ useEffect8(() => {
4470
+ const element = labelContentRef.current;
4471
+ if (element) {
4472
+ setIsOverflowing(element.scrollWidth > element.clientWidth);
4473
+ }
4474
+ }, [label]);
4475
+ if (isOverflowing) {
4476
+ return /* @__PURE__ */ React31.createElement(Tooltip_default, { variant: "solid", size, title: label, placement: "bottom-start" }, labelContent);
4477
+ }
4478
+ return labelContent;
4479
+ }
4534
4480
  function FilterableCheckboxGroup(props) {
4535
- const { value, options, label, placeholder, helperText, size = "md", required, onChange, maxHeight = 300 } = props;
4481
+ const {
4482
+ value,
4483
+ options,
4484
+ label,
4485
+ placeholder,
4486
+ helperText,
4487
+ size = "md",
4488
+ required,
4489
+ onChange,
4490
+ maxHeight = 300,
4491
+ disabled
4492
+ } = props;
4536
4493
  const [searchTerm, setSearchTerm] = useState10("");
4537
4494
  const [sortedOptions, setSortedOptions] = useState10(options);
4538
4495
  const [internalValue, setInternalValue] = useControlledState(
@@ -4542,6 +4499,7 @@ function FilterableCheckboxGroup(props) {
4542
4499
  );
4543
4500
  const parentRef = useRef8(null);
4544
4501
  const isInitialSortRef = useRef8(false);
4502
+ const prevOptionsRef = useRef8([...options]);
4545
4503
  const filteredOptions = useMemo12(() => {
4546
4504
  if (!searchTerm) return sortedOptions;
4547
4505
  return sortedOptions.filter((option) => option.label.toLowerCase().includes(searchTerm.toLowerCase()));
@@ -4556,16 +4514,6 @@ function FilterableCheckboxGroup(props) {
4556
4514
  return 36;
4557
4515
  }
4558
4516
  }, [size]);
4559
- const noOptionsFontSize = useMemo12(() => {
4560
- switch (size) {
4561
- case "sm":
4562
- return "14px";
4563
- case "md":
4564
- return "16px";
4565
- case "lg":
4566
- return "18px";
4567
- }
4568
- }, [size]);
4569
4517
  const virtualizer = useVirtualizer3({
4570
4518
  count: filteredOptions.length,
4571
4519
  estimateSize: () => itemSize,
@@ -4575,27 +4523,34 @@ function FilterableCheckboxGroup(props) {
4575
4523
  });
4576
4524
  const items = virtualizer.getVirtualItems();
4577
4525
  useEffect8(() => {
4578
- if (isInitialSortRef.current) return;
4579
- const initialValue = value ?? [];
4580
- const sorted = [...options].sort((a, b) => {
4581
- const aSelected = initialValue.includes(a.value);
4582
- const bSelected = initialValue.includes(b.value);
4583
- if (aSelected !== bSelected) {
4584
- return aSelected ? -1 : 1;
4585
- }
4586
- const aIsAlpha = /^[a-zA-Z]/.test(a.label);
4587
- const bIsAlpha = /^[a-zA-Z]/.test(b.label);
4588
- if (aIsAlpha !== bIsAlpha) {
4589
- return aIsAlpha ? -1 : 1;
4526
+ const optionsChanged = prevOptionsRef.current.length !== options.length || prevOptionsRef.current.some(
4527
+ (prevOption, index) => prevOption.value !== options[index]?.value || prevOption.label !== options[index]?.label || prevOption.disabled !== options[index]?.disabled
4528
+ );
4529
+ if (!isInitialSortRef.current || optionsChanged) {
4530
+ const initialValue = value ?? [];
4531
+ const sorted = [...options].sort((a, b) => {
4532
+ const aSelected = initialValue.includes(a.value);
4533
+ const bSelected = initialValue.includes(b.value);
4534
+ if (aSelected !== bSelected) {
4535
+ return aSelected ? -1 : 1;
4536
+ }
4537
+ const aIsAlpha = /^[a-zA-Z]/.test(a.label);
4538
+ const bIsAlpha = /^[a-zA-Z]/.test(b.label);
4539
+ if (aIsAlpha !== bIsAlpha) {
4540
+ return aIsAlpha ? -1 : 1;
4541
+ }
4542
+ return a.label.localeCompare(b.label);
4543
+ });
4544
+ setSortedOptions(sorted);
4545
+ prevOptionsRef.current = [...options];
4546
+ if (!isInitialSortRef.current) {
4547
+ isInitialSortRef.current = true;
4590
4548
  }
4591
- return a.label.localeCompare(b.label);
4592
- });
4593
- setSortedOptions(sorted);
4594
- isInitialSortRef.current = true;
4549
+ }
4595
4550
  }, [options, value]);
4596
4551
  useEffect8(() => {
4597
4552
  virtualizer.measure();
4598
- }, [virtualizer, filteredOptions]);
4553
+ }, [virtualizer, filteredOptions, size]);
4599
4554
  const handleSearchChange = useCallback13((event) => {
4600
4555
  setSearchTerm(event.target.value);
4601
4556
  }, []);
@@ -4610,40 +4565,38 @@ function FilterableCheckboxGroup(props) {
4610
4565
  const handleSelectAll = useCallback13(
4611
4566
  (event) => {
4612
4567
  const checked = event.target.checked;
4568
+ const enabledOptions = filteredOptions.filter((option) => !option.disabled);
4569
+ const disabledSelectedValues = internalValue.filter(
4570
+ (v) => filteredOptions.some((opt) => opt.value === v && opt.disabled)
4571
+ );
4613
4572
  if (checked) {
4614
- setInternalValue(filteredOptions.map((option) => option.value));
4573
+ const enabledValues = enabledOptions.map((option) => option.value);
4574
+ setInternalValue([...disabledSelectedValues, ...enabledValues]);
4615
4575
  } else {
4616
- setInternalValue([]);
4576
+ setInternalValue(disabledSelectedValues);
4617
4577
  }
4618
4578
  },
4619
- [filteredOptions, setInternalValue]
4579
+ [filteredOptions, internalValue, setInternalValue]
4620
4580
  );
4621
- const isAllSelected = filteredOptions.length > 0 && filteredOptions.every((option) => internalValue.includes(option.value));
4622
- const isIndeterminate = !isAllSelected && filteredOptions.some((option) => internalValue.includes(option.value));
4623
- return /* @__PURE__ */ React31.createElement("div", { style: { width: "100%" } }, /* @__PURE__ */ React31.createElement(FormControl_default, { required, size }, label && /* @__PURE__ */ React31.createElement(FormLabel_default, null, label), /* @__PURE__ */ React31.createElement(
4624
- Input2,
4581
+ const enabledFilteredOptions = useMemo12(() => filteredOptions.filter((option) => !option.disabled), [filteredOptions]);
4582
+ const isAllSelected = enabledFilteredOptions.length > 0 && enabledFilteredOptions.every((option) => internalValue.includes(option.value));
4583
+ const isIndeterminate = !isAllSelected && enabledFilteredOptions.some((option) => internalValue.includes(option.value));
4584
+ return /* @__PURE__ */ React31.createElement("div", { style: { width: "100%" } }, /* @__PURE__ */ React31.createElement(
4585
+ Input_default,
4625
4586
  {
4587
+ label,
4588
+ helperText,
4589
+ required,
4626
4590
  variant: "outlined",
4627
4591
  color: "neutral",
4628
4592
  placeholder,
4629
4593
  value: searchTerm,
4630
4594
  onChange: handleSearchChange,
4631
4595
  size,
4596
+ disabled,
4632
4597
  endDecorator: /* @__PURE__ */ React31.createElement(SearchIcon, null)
4633
4598
  }
4634
- ), helperText && /* @__PURE__ */ React31.createElement(FormHelperText_default, null, helperText)), filteredOptions.length === 0 ? /* @__PURE__ */ React31.createElement(
4635
- Stack2,
4636
- {
4637
- sx: {
4638
- padding: "20px 12px",
4639
- justifyContent: "center",
4640
- alignItems: "center",
4641
- fontSize: noOptionsFontSize,
4642
- color: "#A2AAB8"
4643
- }
4644
- },
4645
- "No options found."
4646
- ) : /* @__PURE__ */ React31.createElement(
4599
+ ), filteredOptions.length === 0 ? /* @__PURE__ */ React31.createElement(Typography_default, { level: `body-${size}`, textColor: "neutral.softDisabledColor", padding: "20px 12px", textAlign: "center" }, "No options found.") : /* @__PURE__ */ React31.createElement(
4647
4600
  "div",
4648
4601
  {
4649
4602
  ref: parentRef,
@@ -4662,6 +4615,7 @@ function FilterableCheckboxGroup(props) {
4662
4615
  indeterminate: isIndeterminate,
4663
4616
  onChange: handleSelectAll,
4664
4617
  size,
4618
+ disabled,
4665
4619
  slotProps: {
4666
4620
  action: {
4667
4621
  sx: { top: 0, left: 0, bottom: 0, right: 0 }
@@ -4671,7 +4625,7 @@ function FilterableCheckboxGroup(props) {
4671
4625
  }
4672
4626
  ),
4673
4627
  /* @__PURE__ */ React31.createElement(
4674
- Stack2,
4628
+ Stack_default,
4675
4629
  {
4676
4630
  sx: {
4677
4631
  height: `${virtualizer.getTotalSize()}px`,
@@ -4684,13 +4638,15 @@ function FilterableCheckboxGroup(props) {
4684
4638
  Checkbox_default,
4685
4639
  {
4686
4640
  key: virtualRow.key,
4687
- label: option.label,
4641
+ label: /* @__PURE__ */ React31.createElement(LabelWithTooltip, { label: option.label, size }),
4688
4642
  checked: internalValue.includes(option.value),
4689
4643
  onChange: handleCheckboxChange(option.value),
4690
4644
  size,
4645
+ disabled: disabled || option.disabled,
4691
4646
  slotProps: {
4692
4647
  action: {
4693
4648
  sx: { top: 0, left: 0, bottom: 0, right: 0 }
4649
+ // NOTE: 불필요한 좌우 스크롤 방지
4694
4650
  }
4695
4651
  },
4696
4652
  sx: {
@@ -5375,7 +5331,7 @@ import {
5375
5331
  AccordionDetails as JoyAccordionDetails2,
5376
5332
  styled as styled23,
5377
5333
  accordionSummaryClasses,
5378
- Stack as Stack3
5334
+ Stack as Stack2
5379
5335
  } from "@mui/joy";
5380
5336
  var AccordionSummary2 = styled23(JoyAccordionSummary2, {
5381
5337
  name: "NavigationGroup",
@@ -5399,7 +5355,7 @@ var AccordionDetails2 = styled23(JoyAccordionDetails2, {
5399
5355
  }));
5400
5356
  function NavigationGroup(props) {
5401
5357
  const { title, children, startDecorator, level, ...rest } = props;
5402
- return /* @__PURE__ */ React37.createElement(JoyAccordion2, { ...rest }, /* @__PURE__ */ React37.createElement(AccordionSummary2, { useIcon: !!startDecorator, level }, /* @__PURE__ */ React37.createElement(Stack3, { direction: "row", gap: 4 }, startDecorator, title)), /* @__PURE__ */ React37.createElement(AccordionDetails2, null, children));
5358
+ return /* @__PURE__ */ React37.createElement(JoyAccordion2, { ...rest }, /* @__PURE__ */ React37.createElement(AccordionSummary2, { useIcon: !!startDecorator, level }, /* @__PURE__ */ React37.createElement(Stack2, { direction: "row", gap: 4 }, startDecorator, title)), /* @__PURE__ */ React37.createElement(AccordionDetails2, null, children));
5403
5359
  }
5404
5360
 
5405
5361
  // src/components/NavigationItem/NavigationItem.tsx
@@ -6062,7 +6018,7 @@ ThemeProvider.displayName = "ThemeProvider";
6062
6018
 
6063
6019
  // src/components/Uploader/Uploader.tsx
6064
6020
  import React46, { useCallback as useCallback17, useEffect as useEffect12, useMemo as useMemo15, useRef as useRef11, useState as useState15 } from "react";
6065
- import { styled as styled29, Input as Input3 } from "@mui/joy";
6021
+ import { styled as styled29, Input as Input2 } from "@mui/joy";
6066
6022
  import MuiFileUploadIcon from "@mui/icons-material/CloudUploadRounded";
6067
6023
  import MuiUploadFileIcon from "@mui/icons-material/UploadFileRounded";
6068
6024
  import MuiClearIcon from "@mui/icons-material/ClearRounded";
@@ -6084,7 +6040,7 @@ var esmFiles = {
6084
6040
  "@atlaskit/pragmatic-drag-and-drop/dist/esm/entry-point/prevent-unhandled.js"
6085
6041
  )
6086
6042
  };
6087
- var VisuallyHiddenInput = styled29(Input3)({
6043
+ var VisuallyHiddenInput = styled29(Input2)({
6088
6044
  width: "1px",
6089
6045
  height: "1px",
6090
6046
  overflow: "hidden",