@ceed/ads 1.15.0 → 1.16.0-next.4

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.
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import type { FilterableCheckboxGroupItem } from '../types';
3
+ interface FilterableCheckboxGroupProps extends FilterableCheckboxGroupItem {
4
+ onChange?: (value: string[]) => void;
5
+ }
6
+ declare function FilterableCheckboxGroup(props: FilterableCheckboxGroupProps): React.JSX.Element | null;
7
+ declare namespace FilterableCheckboxGroup {
8
+ var displayName: string;
9
+ }
10
+ export { FilterableCheckboxGroup };
11
+ export default FilterableCheckboxGroup;
@@ -2,6 +2,7 @@ import type { DateRangePickerProps } from '../DateRangePicker';
2
2
  import type { CurrencyInputProps } from '../CurrencyInput';
3
3
  import type { PercentageInputProps } from '../PercentageInput';
4
4
  import type { AutocompleteProps } from '../Autocomplete';
5
+ import type { FilterableCheckboxGroupProps } from '../FilterableCheckboxGroup';
5
6
  type DateTime = string;
6
7
  export interface FilterBaseItem<V = never> {
7
8
  id: string;
@@ -17,6 +18,13 @@ export interface FilterCheckboxGroupItem extends FilterBaseItem<(string | number
17
18
  value: string | number;
18
19
  }[];
19
20
  }
21
+ export interface FilterableCheckboxGroupItem extends FilterBaseItem<string[]>, Pick<FilterableCheckboxGroupProps, 'placeholder' | 'maxHeight'> {
22
+ type: 'filterable-checkbox-group';
23
+ options: {
24
+ label: string;
25
+ value: string;
26
+ }[];
27
+ }
20
28
  export interface FilterRadioGroupItem extends FilterBaseItem<string | number> {
21
29
  type: 'radio-group';
22
30
  options: {
@@ -42,5 +50,5 @@ export interface FilterPercentageRangeItem extends FilterBaseItem<[number, numbe
42
50
  export interface FilterAutocompleteItem extends FilterBaseItem<string | number>, Pick<AutocompleteProps<any, boolean>, 'options' | 'multiple' | 'placeholder'> {
43
51
  type: 'autocomplete';
44
52
  }
45
- export type FilterItem = FilterCheckboxGroupItem | FilterRadioGroupItem | FilterDateRangeItem | FilterCurrencyInputItem | FilterCurrencyRangeItem | FilterPercentageInputItem | FilterPercentageRangeItem | FilterAutocompleteItem;
53
+ export type FilterItem = FilterCheckboxGroupItem | FilterableCheckboxGroupItem | FilterRadioGroupItem | FilterDateRangeItem | FilterCurrencyInputItem | FilterCurrencyRangeItem | FilterPercentageInputItem | FilterPercentageRangeItem | FilterAutocompleteItem;
46
54
  export {};
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ interface FilterableCheckboxGroupOption {
3
+ value: string;
4
+ label: string;
5
+ }
6
+ export type FilterableCheckboxGroupProps = {
7
+ value?: string[];
8
+ options: FilterableCheckboxGroupOption[];
9
+ label?: React.ReactNode;
10
+ placeholder?: string;
11
+ helperText?: React.ReactNode;
12
+ size?: 'sm' | 'md' | 'lg';
13
+ required?: boolean;
14
+ onChange?: (value: string[]) => void;
15
+ maxHeight?: string | number;
16
+ };
17
+ declare function FilterableCheckboxGroup(props: FilterableCheckboxGroupProps): React.JSX.Element;
18
+ declare namespace FilterableCheckboxGroup {
19
+ var displayName: string;
20
+ }
21
+ export { FilterableCheckboxGroup };
@@ -0,0 +1,3 @@
1
+ import { FilterableCheckboxGroup } from './FilterableCheckboxGroup';
2
+ export * from './FilterableCheckboxGroup';
3
+ export default FilterableCheckboxGroup;
@@ -26,7 +26,7 @@ interface BaseProfileMenuProps {
26
26
  src: string;
27
27
  alt: string;
28
28
  };
29
- caption?: string;
29
+ caption?: React.ReactNode;
30
30
  chip?: string;
31
31
  };
32
32
  menuItems: ({
@@ -22,6 +22,7 @@ export { DialogFrame } from './DialogFrame';
22
22
  export { Divider } from './Divider';
23
23
  export { InsetDrawer } from './InsetDrawer';
24
24
  export { Dropdown } from './Dropdown';
25
+ export { FilterableCheckboxGroup } from './FilterableCheckboxGroup';
25
26
  export { FilterMenu } from './FilterMenu';
26
27
  export type * from './FilterMenu';
27
28
  export { Uploader } from './Uploader';
@@ -0,0 +1,179 @@
1
+ # FilterableCheckboxGroup
2
+
3
+ ## Introduction
4
+
5
+ FilterableCheckboxGroup 컴포넌트는 대량의 옵션 중에서 여러 항목을 선택할 수 있는 검색 가능한 체크박스 그룹입니다. 검색 필터링과 가상 스크롤링을 통해 많은 수의 옵션을 효율적으로 처리할 수 있으며, "Select all" 기능으로 일괄 선택이 가능합니다. 필터링, 다중 선택 폼, 설정 화면 등에서 유용하게 사용됩니다.
6
+
7
+ ```tsx
8
+ <FilterableCheckboxGroup
9
+ label="Select Fruits"
10
+ placeholder="Search fruits..."
11
+ options={defaultOptions}
12
+ />
13
+ ```
14
+
15
+ | Field | Description | Default |
16
+ | ----------- | ----------- | ------- |
17
+ | size | — | — |
18
+ | label | — | — |
19
+ | helperText | — | — |
20
+ | required | — | — |
21
+ | value | — | — |
22
+ | onChange | — | — |
23
+ | placeholder | — | — |
24
+ | options | — | — |
25
+ | maxHeight | — | — |
26
+
27
+ ## Usage
28
+
29
+ ```tsx
30
+ import { FilterableCheckboxGroup } from '@ceed/ads';
31
+
32
+ function MyComponent() {
33
+ const [selectedValues, setSelectedValues] = useState<string[]>([]);
34
+
35
+ const options = [
36
+ { value: 'apple', label: 'Apple' },
37
+ { value: 'banana', label: 'Banana' },
38
+ { value: 'cherry', label: 'Cherry' },
39
+ ];
40
+
41
+ return (
42
+ <FilterableCheckboxGroup
43
+ label="Select Fruits"
44
+ placeholder="Search fruits..."
45
+ options={options}
46
+ value={selectedValues}
47
+ onChange={setSelectedValues}
48
+ />
49
+ );
50
+ }
51
+ ```
52
+
53
+ ## Examples
54
+
55
+ ### Sizes
56
+
57
+ 다양한 크기의 FilterableCheckboxGroup을 사용할 수 있습니다.
58
+
59
+ ```tsx
60
+ <Stack spacing={3}>
61
+ <FilterableCheckboxGroup {...args} size="lg" label="Large" />
62
+ <FilterableCheckboxGroup {...args} size="md" label="Medium" />
63
+ <FilterableCheckboxGroup {...args} size="sm" label="Small" />
64
+ </Stack>
65
+ ```
66
+
67
+ ### With Label
68
+
69
+ 라벨을 추가할 수 있습니다.
70
+
71
+ ```tsx
72
+ <FilterableCheckboxGroup
73
+ label="Select your favorite fruits"
74
+ placeholder="Search fruits..."
75
+ options={defaultOptions}
76
+ />
77
+ ```
78
+
79
+ ### With Helper Text
80
+
81
+ 도움말 텍스트를 추가할 수 있습니다.
82
+
83
+ ```tsx
84
+ <FilterableCheckboxGroup
85
+ label="Select Fruits"
86
+ placeholder="Search fruits..."
87
+ helperText="You can select multiple options"
88
+ options={defaultOptions}
89
+ />
90
+ ```
91
+
92
+ ### Required Field
93
+
94
+ 필수 입력 필드로 표시할 수 있습니다.
95
+
96
+ ```tsx
97
+ <FilterableCheckboxGroup
98
+ label="Required Field"
99
+ placeholder="Search..."
100
+ required
101
+ helperText="This field is required"
102
+ options={defaultOptions}
103
+ />
104
+ ```
105
+
106
+ ### Custom Max Height
107
+
108
+ 목록의 최대 높이를 커스터마이징할 수 있습니다.
109
+
110
+ ```tsx
111
+ <Stack spacing={3}>
112
+ <FilterableCheckboxGroup label="Custom Height (150px)" placeholder="Search..." options={defaultOptions} maxHeight={150} />
113
+ <FilterableCheckboxGroup label="Default Height (300px)" placeholder="Search..." options={defaultOptions} />
114
+ </Stack>
115
+ ```
116
+
117
+ ### Long List
118
+
119
+ 많은 수의 옵션을 가상 스크롤링으로 효율적으로 표시합니다.
120
+
121
+ ```tsx
122
+ <FilterableCheckboxGroup
123
+ label="Countries"
124
+ placeholder="Search countries..."
125
+ options={countryNames.map(name => ({
126
+ value: name.toLowerCase().replace(/ /g, '-'),
127
+ label: name
128
+ }))}
129
+ />
130
+ ```
131
+
132
+ ### No Options
133
+
134
+ 옵션이 없을 때의 상태입니다.
135
+
136
+ ```tsx
137
+ <FilterableCheckboxGroup
138
+ label="No Options Available"
139
+ placeholder="Search..."
140
+ options={[]}
141
+ />
142
+ ```
143
+
144
+ ### Controlled
145
+
146
+ 외부에서 값을 제어하는 예제입니다.
147
+
148
+ ```tsx
149
+ <Stack spacing={2}>
150
+ <FilterableCheckboxGroup label="Select Fruits" placeholder="Search fruits..." options={defaultOptions} value={value} onChange={setValue} />
151
+ <Typography level="body-sm">
152
+ Selected:{' '}
153
+ {value.length > 0 ? value.map(v => defaultOptions.find(o => o.value === v)?.label).join(', ') : 'None'}
154
+ </Typography>
155
+ </Stack>
156
+ ```
157
+
158
+ ### Sorting
159
+
160
+ 정렬 동작을 확인할 수 있는 예제입니다. 초기 렌더링 시 선택된 항목이 먼저 표시되고, 그 다음 알파벳 순으로 정렬됩니다.
161
+
162
+ ```tsx
163
+ <Stack spacing={2}>
164
+ <button type="button" onClick={() => {
165
+ setKey(prev => prev + 1);
166
+ }} style={{
167
+ padding: '4px 12px',
168
+ cursor: 'pointer'
169
+ }}>
170
+ Force Re-render
171
+ </button>
172
+ <FilterableCheckboxGroup key={key} label="Sorting Demo" placeholder="Search..." helperText="Initial sort: Selected (C,B,A,3,2,1) first, then unselected (X,Y,Z,7,8,9)" options={sortingOptions} value={value} onChange={setValue} />
173
+ <Typography level="body-sm" sx={{
174
+ whiteSpace: 'pre-line'
175
+ }}>
176
+ {`Selected: ${value.length > 0 ? value.join(', ') : 'None'}\n\nClick "Force Re-render" button to remount the component.\nOrder should remain the same (sorted only on initial mount).`}
177
+ </Typography>
178
+ </Stack>
179
+ ```
@@ -10,6 +10,7 @@
10
10
  - [CurrencyInput](./CurrencyInput.md)
11
11
  - [DatePicker](./DatePicker.md)
12
12
  - [DateRangePicker](./DateRangePicker.md)
13
+ - [FilterableCheckboxGroup](./FilterableCheckboxGroup.md)
13
14
  - [FilterMenu](./FilterMenu.md)
14
15
  - [IconButton](./IconButton.md)
15
16
  - [Input](./Input.md)