@zenkigen-inc/component-ui 1.15.1 → 1.15.2

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.
Files changed (97) hide show
  1. package/dist/index.d.mts +434 -0
  2. package/dist/index.d.ts +434 -27
  3. package/dist/index.js +1602 -1701
  4. package/dist/index.mjs +1915 -0
  5. package/package.json +18 -8
  6. package/tsup.config.ts +13 -0
  7. package/vitest.config.ts +11 -0
  8. package/vitest.setup.ts +1 -0
  9. package/dist/avatar/avatar.d.ts +0 -10
  10. package/dist/avatar/index.d.ts +0 -1
  11. package/dist/breadcrumb/breadcrumb-item.d.ts +0 -2
  12. package/dist/breadcrumb/breadcrumb.d.ts +0 -5
  13. package/dist/breadcrumb/index.d.ts +0 -1
  14. package/dist/button/button.d.ts +0 -22
  15. package/dist/button/index.d.ts +0 -1
  16. package/dist/checkbox/checkbox.d.ts +0 -14
  17. package/dist/checkbox/checked-icon.d.ts +0 -1
  18. package/dist/checkbox/index.d.ts +0 -1
  19. package/dist/checkbox/minus-icon.d.ts +0 -1
  20. package/dist/dropdown/dropdown-context.d.ts +0 -14
  21. package/dist/dropdown/dropdown-item.d.ts +0 -7
  22. package/dist/dropdown/dropdown-menu.d.ts +0 -10
  23. package/dist/dropdown/dropdown.d.ts +0 -26
  24. package/dist/dropdown/index.d.ts +0 -2
  25. package/dist/dropdown/type.d.ts +0 -9
  26. package/dist/evaluation-star/evaluation-star.d.ts +0 -8
  27. package/dist/evaluation-star/index.d.ts +0 -1
  28. package/dist/heading/heading.d.ts +0 -10
  29. package/dist/heading/index.d.ts +0 -1
  30. package/dist/hooks/index.d.ts +0 -1
  31. package/dist/hooks/use-outside-click.d.ts +0 -2
  32. package/dist/icon/icon.d.ts +0 -13
  33. package/dist/icon/index.d.ts +0 -1
  34. package/dist/icon-button/icon-button.d.ts +0 -19
  35. package/dist/icon-button/index.d.ts +0 -1
  36. package/dist/index.esm.js +0 -2147
  37. package/dist/index.esm.js.map +0 -1
  38. package/dist/index.js.map +0 -1
  39. package/dist/loading/index.d.ts +0 -1
  40. package/dist/loading/loading.d.ts +0 -7
  41. package/dist/modal/body-scroll-lock.d.ts +0 -27
  42. package/dist/modal/index.d.ts +0 -1
  43. package/dist/modal/modal-body.d.ts +0 -2
  44. package/dist/modal/modal-context.d.ts +0 -5
  45. package/dist/modal/modal-footer.d.ts +0 -7
  46. package/dist/modal/modal-header.d.ts +0 -6
  47. package/dist/modal/modal.d.ts +0 -18
  48. package/dist/notification-inline/index.d.ts +0 -1
  49. package/dist/notification-inline/notification-inline.d.ts +0 -13
  50. package/dist/pagination/index.d.ts +0 -1
  51. package/dist/pagination/pagination-button.d.ts +0 -6
  52. package/dist/pagination/pagination-context.d.ts +0 -6
  53. package/dist/pagination/pagination.d.ts +0 -12
  54. package/dist/pagination-select/index.d.ts +0 -1
  55. package/dist/pagination-select/pagination-select.d.ts +0 -22
  56. package/dist/radio/index.d.ts +0 -1
  57. package/dist/radio/radio.d.ts +0 -12
  58. package/dist/search/index.d.ts +0 -1
  59. package/dist/search/search.d.ts +0 -12
  60. package/dist/select/index.d.ts +0 -2
  61. package/dist/select/select-context.d.ts +0 -11
  62. package/dist/select/select-item.d.ts +0 -6
  63. package/dist/select/select-list.d.ts +0 -6
  64. package/dist/select/select.d.ts +0 -22
  65. package/dist/select/type.d.ts +0 -7
  66. package/dist/select-sort/index.d.ts +0 -2
  67. package/dist/select-sort/select-item.d.ts +0 -7
  68. package/dist/select-sort/select-list.d.ts +0 -10
  69. package/dist/select-sort/select-sort.d.ts +0 -15
  70. package/dist/select-sort/type.d.ts +0 -1
  71. package/dist/tab/index.d.ts +0 -2
  72. package/dist/tab/tab-item.d.ts +0 -10
  73. package/dist/tab/tab.d.ts +0 -15
  74. package/dist/table/index.d.ts +0 -3
  75. package/dist/table/table-cell.d.ts +0 -8
  76. package/dist/table/table-row.d.ts +0 -7
  77. package/dist/table/table.d.ts +0 -16
  78. package/dist/tag/delete-icon.d.ts +0 -8
  79. package/dist/tag/index.d.ts +0 -2
  80. package/dist/tag/tag.d.ts +0 -17
  81. package/dist/tag/type.d.ts +0 -3
  82. package/dist/text-area/index.d.ts +0 -1
  83. package/dist/text-area/text-area.d.ts +0 -8
  84. package/dist/text-input/index.d.ts +0 -1
  85. package/dist/text-input/text-input.d.ts +0 -7
  86. package/dist/toast/index.d.ts +0 -2
  87. package/dist/toast/toast-provider.d.ts +0 -13
  88. package/dist/toast/toast.d.ts +0 -12
  89. package/dist/toast/type.d.ts +0 -1
  90. package/dist/toggle/index.d.ts +0 -1
  91. package/dist/toggle/toggle.d.ts +0 -12
  92. package/dist/tooltip/index.d.ts +0 -1
  93. package/dist/tooltip/tail-icon.d.ts +0 -8
  94. package/dist/tooltip/tooltip-content.d.ts +0 -11
  95. package/dist/tooltip/tooltip.d.ts +0 -13
  96. package/dist/tooltip/tooltip.hook.d.ts +0 -11
  97. package/dist/tooltip/type.d.ts +0 -13
package/dist/index.esm.js DELETED
@@ -1,2147 +0,0 @@
1
- import { userColors, buttonColors, focusVisible, iconColors, typography, tagColors, tagLightColors } from '@zenkigen-inc/component-theme';
2
- import clsx$1, { clsx } from 'clsx';
3
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
- import { useState, useCallback, useEffect, createContext, useContext, useRef, useLayoutEffect, forwardRef } from 'react';
5
- import { createPortal } from 'react-dom';
6
- import { iconElements } from '@zenkigen-inc/component-icons';
7
-
8
- function _extends() {
9
- return _extends = Object.assign ? Object.assign.bind() : function (n) {
10
- for (var e = 1; e < arguments.length; e++) {
11
- var t = arguments[e];
12
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
13
- }
14
- return n;
15
- }, _extends.apply(null, arguments);
16
- }
17
- function _objectWithoutPropertiesLoose(r, e) {
18
- if (null == r) return {};
19
- var t = {};
20
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
21
- if (-1 !== e.indexOf(n)) continue;
22
- t[n] = r[n];
23
- }
24
- return t;
25
- }
26
-
27
- var _excluded$8 = ["size"];
28
- var isAsciiString = function isAsciiString(str) {
29
- return str.charCodeAt(0) < 256;
30
- };
31
- function Avatar(_ref) {
32
- var _props$userId, _props$isDisabled, _clsx;
33
- var _ref$size = _ref.size,
34
- size = _ref$size === void 0 ? 'medium' : _ref$size,
35
- props = _objectWithoutPropertiesLoose(_ref, _excluded$8);
36
- var classes = clsx('flex items-center justify-center rounded-full text-textOnColor', (_clsx = {
37
- 'w-16 h-16 typography-label16regular': size === 'x-large',
38
- 'w-12 h-12 typography-label14regular': size === 'large',
39
- 'w-10 h-10 typography-label14regular': size === 'medium',
40
- 'w-8 h-8 typography-label11regular': size === 'small',
41
- 'w-6 h-6 typography-label11regular': size === 'x-small',
42
- 'bg-disabled01': props.isDisabled,
43
- 'bg-icon01': props.userId == null
44
- }, _clsx[userColors[((_props$userId = props.userId) != null ? _props$userId : 0) % userColors.length]] = props.userId != null && !((_props$isDisabled = props.isDisabled) != null ? _props$isDisabled : false), _clsx));
45
- var trimmedFirstName = props.firstName.replace(' ', ' ').trim();
46
- var trimmedLastName = props.lastName.replace(' ', ' ').trim().trim();
47
- var nameOnIcon = isAsciiString(trimmedLastName) ? trimmedFirstName.slice(0, 1).toUpperCase() + trimmedLastName.slice(0, 1).toUpperCase() : (trimmedLastName + trimmedFirstName).slice(0, 2);
48
- return /*#__PURE__*/jsx("span", {
49
- className: classes,
50
- children: nameOnIcon
51
- });
52
- }
53
-
54
- var BreadcrumbItem = function BreadcrumbItem(_ref) {
55
- var children = _ref.children;
56
- return /*#__PURE__*/jsx("li", {
57
- className: "flex gap-2 after:content-['/'] last:after:content-none [&_a]:text-interactive02 [&_a]:hover:underline",
58
- children: children
59
- });
60
- };
61
-
62
- function Breadcrumb(_ref) {
63
- var children = _ref.children;
64
- return /*#__PURE__*/jsx("nav", {
65
- "aria-label": "breadcrumb",
66
- children: /*#__PURE__*/jsx("ul", {
67
- className: "typography-label14regular flex flex-wrap gap-2 whitespace-nowrap text-text01",
68
- children: children
69
- })
70
- });
71
- }
72
- Breadcrumb.Item = BreadcrumbItem;
73
-
74
- var _excluded$7 = ["size", "variant", "isDisabled", "isSelected", "width", "borderRadius", "justifyContent", "before", "after", "elementAs", "children"];
75
- var Button = function Button(_ref) {
76
- var _clsx;
77
- var _ref$size = _ref.size,
78
- size = _ref$size === void 0 ? 'medium' : _ref$size,
79
- _ref$variant = _ref.variant,
80
- variant = _ref$variant === void 0 ? 'fill' : _ref$variant,
81
- isDisabled = _ref.isDisabled,
82
- _ref$isSelected = _ref.isSelected,
83
- isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
84
- width = _ref.width,
85
- borderRadius = _ref.borderRadius,
86
- _ref$justifyContent = _ref.justifyContent,
87
- justifyContent = _ref$justifyContent === void 0 ? 'center' : _ref$justifyContent,
88
- before = _ref.before,
89
- after = _ref.after,
90
- elementAs = _ref.elementAs,
91
- children = _ref.children,
92
- props = _objectWithoutPropertiesLoose(_ref, _excluded$7);
93
- var baseClasses = clsx('flex shrink-0 items-center gap-1', buttonColors[variant].hover, buttonColors[variant].active, buttonColors[variant].disabled, focusVisible.normal, (_clsx = {
94
- 'h-6 px-2.5': size === 'small',
95
- 'h-8 px-3': size === 'medium',
96
- 'h-10 px-4 leading-[24px]': size === 'large',
97
- 'inline-flex': elementAs === 'a'
98
- }, _clsx[buttonColors[variant].selected] = isSelected, _clsx[buttonColors[variant].base] = !isSelected, _clsx['hover:text-textOnColor active:text-textOnColor [&:hover>*]:fill-iconOnColor [&:active>*]:fill-iconOnColor'] = isSelected && variant !== 'outline' && variant !== 'text', _clsx['pointer-events-none'] = isDisabled, _clsx['rounded-button'] = borderRadius == null, _clsx['justify-start'] = justifyContent === 'start', _clsx['justify-center'] = justifyContent === 'center', _clsx['typography-label16regular'] = size === 'large', _clsx['typography-label14regular'] = size !== 'large', _clsx));
99
- var Component = elementAs != null ? elementAs : 'button';
100
- return /*#__PURE__*/jsxs(Component, _extends({
101
- className: baseClasses,
102
- style: {
103
- width: width,
104
- borderRadius: borderRadius
105
- },
106
- disabled: isDisabled
107
- }, props, {
108
- children: [before, children, after]
109
- }));
110
- };
111
-
112
- var CheckedIcon = function CheckedIcon() {
113
- return /*#__PURE__*/jsx("svg", {
114
- viewBox: "0 0 20 20",
115
- xmlns: "http://www.w3.org/2000/svg",
116
- className: "absolute z-10 size-5 rounded-sm fill-iconOnColor hover:rounded-sm",
117
- children: /*#__PURE__*/jsx("path", {
118
- fillRule: "evenodd",
119
- clipRule: "evenodd",
120
- d: "M16.2887 5.38099C16.0069 5.09924 15.5518 5.09924 15.2701 5.38099L7.55461 13.0893L4.72993 10.2646C4.44818 9.98283 3.99305 9.98283 3.71131 10.2646C3.42956 10.5463 3.42956 11.0014 3.71131 11.2832L7.04891 14.6208C7.1934 14.7653 7.374 14.8303 7.56183 14.8303C7.74966 14.8303 7.93027 14.7581 8.07475 14.6208L16.2887 6.40683C16.5704 6.12508 16.5704 5.66273 16.2887 5.38099Z"
121
- })
122
- });
123
- };
124
-
125
- var MinusIcon = function MinusIcon() {
126
- return /*#__PURE__*/jsx("svg", {
127
- viewBox: "0 0 20 20",
128
- xmlns: "http://www.w3.org/2000/svg",
129
- className: "absolute z-10 size-5 rounded-sm fill-iconOnColor hover:rounded-sm",
130
- children: /*#__PURE__*/jsx("path", {
131
- d: "M4.94723 10.5028H9.49726H10.5028H15.0528C15.3293 10.5028 15.5556 10.2766 15.5556 10C15.5556 9.72352 15.3293 9.49725 15.0528 9.49725H10.5028H9.49726H4.94723C4.67071 9.49725 4.44446 9.72352 4.44446 10C4.44446 10.2766 4.67071 10.5028 4.94723 10.5028Z"
132
- })
133
- });
134
- };
135
-
136
- function Checkbox(_ref) {
137
- var name = _ref.name,
138
- value = _ref.value,
139
- id = _ref.id,
140
- _ref$isChecked = _ref.isChecked,
141
- isChecked = _ref$isChecked === void 0 ? false : _ref$isChecked,
142
- _ref$isIndeterminate = _ref.isIndeterminate,
143
- isIndeterminate = _ref$isIndeterminate === void 0 ? false : _ref$isIndeterminate,
144
- _ref$isDisabled = _ref.isDisabled,
145
- isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
146
- onChange = _ref.onChange,
147
- label = _ref.label,
148
- _ref$color = _ref.color,
149
- color = _ref$color === void 0 ? 'default' : _ref$color;
150
- var _useState = useState(false),
151
- isMouseOver = _useState[0],
152
- setIsMouseOver = _useState[1];
153
- var handleMouseOverInput = useCallback(function () {
154
- setIsMouseOver(true);
155
- }, []);
156
- var handleMouseOutInput = useCallback(function () {
157
- setIsMouseOver(false);
158
- }, []);
159
- var handleChange = useCallback(function (e) {
160
- return !isDisabled && (onChange == null ? void 0 : onChange(e));
161
- }, [isDisabled, onChange]);
162
- var baseInputClasses = clsx$1('peer absolute z-[1] size-5 opacity-0', {
163
- 'cursor-not-allowed': isDisabled,
164
- 'cursor-pointer': !isDisabled
165
- });
166
- var boxClasses = clsx$1('inline-flex size-5 items-center justify-center rounded-sm border bg-white', focusVisible.normalPeer, {
167
- 'border-disabled01': isDisabled,
168
- 'border-hoverUiBorder': !isDisabled && isMouseOver && color === 'default',
169
- 'border-uiBorder03': !isDisabled && !isMouseOver && color === 'default',
170
- 'border-interactive02': !isDisabled && !isMouseOver && color === 'gray',
171
- 'border-hoverError': !isDisabled && isMouseOver && color === 'error',
172
- 'border-supportError': !isDisabled && !isMouseOver && color === 'error'
173
- });
174
- var indicatorClasses = clsx$1('relative flex size-5 flex-[0_0_auto] items-center justify-center', {
175
- 'bg-disabled01': isDisabled && isChecked,
176
- 'border-disabled01': isDisabled
177
- });
178
- var afterClasses = clsx$1('absolute inset-0 m-auto block rounded-sm', {
179
- 'bg-disabled01': isDisabled && isChecked,
180
- 'bg-hover01': !(isDisabled && isChecked) && isMouseOver,
181
- 'bg-interactive01': !(isDisabled && isChecked) && !isMouseOver,
182
- 'bg-hover02Dark': !(isDisabled && isChecked) && isMouseOver && color === 'gray',
183
- 'bg-interactive02': !(isDisabled && isChecked) && !isMouseOver && color === 'gray',
184
- 'bg-hoverError': !(isDisabled && isChecked) && isMouseOver && color === 'error',
185
- 'bg-supportError': !(isDisabled && isChecked) && !isMouseOver && color === 'error',
186
- 'scale-0': !isChecked,
187
- 'scale-100': isChecked
188
- });
189
- var hoverIndicatorClasses = clsx$1('inline-block size-3 rounded-[1px]', {
190
- 'bg-hoverUi': !isDisabled && !isChecked && isMouseOver
191
- });
192
- var labelClasses = clsx$1('typography-label14regular ml-2 flex-[1_0_0] break-all', {
193
- 'pointer-events-none cursor-not-allowed text-disabled01': isDisabled,
194
- 'cursor-pointer text-text01': !isDisabled
195
- });
196
- return /*#__PURE__*/jsxs("div", {
197
- className: "flex items-center",
198
- children: [/*#__PURE__*/jsxs("div", {
199
- className: "relative flex size-6 items-center justify-center",
200
- children: [/*#__PURE__*/jsx("input", {
201
- type: "checkbox",
202
- value: value,
203
- name: name,
204
- id: id,
205
- checked: isChecked,
206
- disabled: isDisabled,
207
- onChange: handleChange,
208
- onMouseOver: handleMouseOverInput,
209
- onMouseLeave: handleMouseOutInput,
210
- className: baseInputClasses
211
- }), /*#__PURE__*/jsx("div", {
212
- className: boxClasses,
213
- children: /*#__PURE__*/jsxs("div", {
214
- className: indicatorClasses,
215
- children: [/*#__PURE__*/jsxs("span", {
216
- className: afterClasses,
217
- children: [isChecked && !isIndeterminate && /*#__PURE__*/jsx(CheckedIcon, {}), isIndeterminate && /*#__PURE__*/jsx(MinusIcon, {})]
218
- }), /*#__PURE__*/jsx("span", {
219
- className: hoverIndicatorClasses
220
- })]
221
- })
222
- })]
223
- }), label != null && /*#__PURE__*/jsx("label", {
224
- htmlFor: id,
225
- className: labelClasses,
226
- children: label
227
- })]
228
- });
229
- }
230
-
231
- var useOutsideClick = function useOutsideClick(ref, handler, enabled) {
232
- if (enabled === void 0) {
233
- enabled = true;
234
- }
235
- useEffect(function () {
236
- var listener = function listener(event) {
237
- var _event$target;
238
- var element = ref == null ? void 0 : ref.current;
239
- if (element == null || Boolean(element.contains((_event$target = event == null ? void 0 : event.target) != null ? _event$target : null))) {
240
- return;
241
- }
242
- handler(event);
243
- };
244
- if (enabled) {
245
- document.addEventListener('click', listener);
246
- }
247
- return function () {
248
- return document.removeEventListener('click', listener);
249
- };
250
- }, [ref, enabled, handler]);
251
- };
252
-
253
- var _excluded$6 = ["size", "isDisabled"];
254
- var Icon = function Icon(_ref) {
255
- var _clsx;
256
- var _ref$size = _ref.size,
257
- size = _ref$size === void 0 ? 'medium' : _ref$size,
258
- _ref$isDisabled = _ref.isDisabled,
259
- isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
260
- props = _objectWithoutPropertiesLoose(_ref, _excluded$6);
261
- var classes = clsx('inline-block shrink-0', (_clsx = {
262
- 'fill-disabled01': isDisabled
263
- }, _clsx[iconColors.icon01] = !isDisabled && props.color === 'icon01', _clsx[iconColors.icon02] = !isDisabled && props.color === 'icon02', _clsx[iconColors.icon03] = !isDisabled && props.color === 'icon03', _clsx[iconColors.iconOnColor] = !isDisabled && props.color === 'iconOnColor', _clsx['w-3 h-3'] = size === 'x-small', _clsx['w-4 h-4'] = size === 'small', _clsx['w-6 h-6'] = size === 'medium', _clsx['w-8 h-8'] = size === 'large', _clsx['w-10 h-10'] = size === 'x-large', _clsx), props.className);
264
- return /*#__PURE__*/jsx("span", {
265
- className: classes,
266
- children: iconElements[props.name]
267
- });
268
- };
269
-
270
- var DropdownContext = /*#__PURE__*/createContext({
271
- isVisible: false,
272
- setIsVisible: function setIsVisible() {
273
- return false;
274
- },
275
- isDisabled: false,
276
- targetDimensions: {
277
- width: 0,
278
- height: 0
279
- },
280
- variant: 'outline'
281
- });
282
-
283
- function DropdownItem(_ref) {
284
- var children = _ref.children,
285
- _ref$color = _ref.color,
286
- color = _ref$color === void 0 ? 'gray' : _ref$color,
287
- onClick = _ref.onClick;
288
- var _useContext = useContext(DropdownContext),
289
- setIsVisible = _useContext.setIsVisible;
290
- var handleClickItem = function handleClickItem(event) {
291
- setIsVisible(false);
292
- onClick == null || onClick(event);
293
- };
294
- var itemClasses = clsx$1('typography-label14regular flex h-8 w-full items-center px-3 hover:bg-hover02 active:bg-active02', focusVisible.inset, {
295
- 'bg-uiBackground01 fill-icon01 text-interactive02': color === 'gray',
296
- 'fill-supportDanger text-supportDanger': color === 'red'
297
- });
298
- return /*#__PURE__*/jsx("li", {
299
- className: "flex w-full items-center",
300
- children: /*#__PURE__*/jsx("button", {
301
- className: itemClasses,
302
- type: "button",
303
- onClick: handleClickItem,
304
- children: children
305
- })
306
- });
307
- }
308
-
309
- function DropdownMenu(_ref) {
310
- var children = _ref.children,
311
- maxHeight = _ref.maxHeight,
312
- _ref$isNoPadding = _ref.isNoPadding,
313
- isNoPadding = _ref$isNoPadding === void 0 ? false : _ref$isNoPadding,
314
- _ref$verticalPosition = _ref.verticalPosition,
315
- verticalPosition = _ref$verticalPosition === void 0 ? 'bottom' : _ref$verticalPosition,
316
- _ref$horizontalAlign = _ref.horizontalAlign,
317
- horizontalAlign = _ref$horizontalAlign === void 0 ? 'left' : _ref$horizontalAlign;
318
- var _useContext = useContext(DropdownContext),
319
- isVisible = _useContext.isVisible,
320
- isDisabled = _useContext.isDisabled,
321
- targetDimensions = _useContext.targetDimensions,
322
- variant = _useContext.variant,
323
- portalTargetRef = _useContext.portalTargetRef;
324
- var wrapperClasses = clsx$1('z-dropdown w-max overflow-y-auto rounded bg-uiBackground01 shadow-floatingShadow', {
325
- absolute: !portalTargetRef,
326
- 'border-solid border border-uiBorder01': variant === 'outline',
327
- 'py-1': !isNoPadding,
328
- 'left-0': horizontalAlign === 'left',
329
- 'right-0': horizontalAlign === 'right',
330
- 'left-auto': horizontalAlign === 'center'
331
- });
332
- return isVisible && !isDisabled && /*#__PURE__*/jsx("ul", {
333
- className: wrapperClasses,
334
- style: {
335
- top: !portalTargetRef && verticalPosition === 'bottom' ? targetDimensions.height + 4 + "px" : 'unset',
336
- bottom: !portalTargetRef && verticalPosition === 'top' ? targetDimensions.height + 4 + "px" : 'unset',
337
- maxHeight: maxHeight
338
- },
339
- children: children
340
- });
341
- }
342
-
343
- function Dropdown(_ref) {
344
- var children = _ref.children,
345
- target = _ref.target,
346
- label = _ref.label,
347
- icon = _ref.icon,
348
- _ref$size = _ref.size,
349
- size = _ref$size === void 0 ? 'medium' : _ref$size,
350
- _ref$variant = _ref.variant,
351
- variant = _ref$variant === void 0 ? 'outline' : _ref$variant,
352
- title = _ref.title,
353
- _ref$isDisabled = _ref.isDisabled,
354
- isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
355
- _ref$isArrowHidden = _ref.isArrowHidden,
356
- isArrowHidden = _ref$isArrowHidden === void 0 ? false : _ref$isArrowHidden,
357
- portalTargetRef = _ref.portalTargetRef;
358
- var _useState = useState(false),
359
- isVisible = _useState[0],
360
- setIsVisible = _useState[1];
361
- var _useState2 = useState({
362
- width: 0,
363
- height: 0
364
- }),
365
- targetDimensions = _useState2[0],
366
- setTargetDimensions = _useState2[1];
367
- var targetRef = useRef(null);
368
- useOutsideClick(targetRef, function () {
369
- return setIsVisible(false);
370
- });
371
- var handleToggle = useCallback(function () {
372
- if (targetRef.current === null) {
373
- return;
374
- }
375
- if (isVisible) {
376
- setIsVisible(false);
377
- } else {
378
- var dimensions = targetRef.current.getBoundingClientRect();
379
- var calculatedDimensions = {
380
- width: dimensions.right - dimensions.left,
381
- height: dimensions.bottom - dimensions.top
382
- };
383
- setTargetDimensions(calculatedDimensions);
384
- setIsVisible(true);
385
- }
386
- }, [isVisible]);
387
- var wrapperClasses = clsx$1('relative flex shrink-0 items-center gap-1 rounded', {
388
- 'cursor-not-allowed': isDisabled
389
- });
390
- var childrenButtonClasses = clsx$1('flex items-center justify-center rounded bg-uiBackground01 p-1 hover:bg-hover02 active:bg-active02', focusVisible.normal, {
391
- 'pointer-events-none': isDisabled,
392
- 'border border-uiBorder02': variant === 'outline'
393
- });
394
- var buttonClasses = clsx$1('flex items-center rounded bg-uiBackground01', buttonColors[variant].base, buttonColors[variant].hover, buttonColors[variant].active, buttonColors[variant].disabled, focusVisible.normal, {
395
- 'pointer-events-none': isDisabled,
396
- 'h-6 px-2': size === 'x-small' || size === 'small',
397
- 'h-8 px-4': size === 'medium',
398
- 'h-10 px-4': size === 'large'
399
- });
400
- var labelClasses = clsx$1('flex items-center', {
401
- 'mr-1': !isArrowHidden && size === 'x-small',
402
- 'mr-2': !isArrowHidden && size !== 'x-small',
403
- 'typography-label12regular': size === 'x-small',
404
- 'typography-label14regular': size === 'small' || size === 'medium',
405
- 'typography-label16regular': size === 'large'
406
- });
407
- return /*#__PURE__*/jsx(DropdownContext.Provider, {
408
- value: {
409
- isVisible: isVisible,
410
- setIsVisible: setIsVisible,
411
- isDisabled: isDisabled,
412
- targetDimensions: targetDimensions,
413
- variant: variant,
414
- portalTargetRef: portalTargetRef
415
- },
416
- children: /*#__PURE__*/jsxs("div", {
417
- ref: targetRef,
418
- className: wrapperClasses,
419
- children: [target ? /*#__PURE__*/jsxs("button", {
420
- type: "button",
421
- title: title,
422
- className: childrenButtonClasses,
423
- onClick: handleToggle,
424
- disabled: isDisabled,
425
- children: [target, !isArrowHidden && /*#__PURE__*/jsx("div", {
426
- className: "ml-2 flex items-center fill-icon01",
427
- children: /*#__PURE__*/jsx(Icon, {
428
- name: isVisible ? 'angle-small-up' : 'angle-small-down',
429
- size: size === 'large' ? 'medium' : 'small'
430
- })
431
- })]
432
- }) : /*#__PURE__*/jsxs("button", {
433
- type: "button",
434
- title: title,
435
- className: buttonClasses,
436
- onClick: handleToggle,
437
- disabled: isDisabled,
438
- children: [icon && /*#__PURE__*/jsx("span", {
439
- className: "mr-1 flex",
440
- children: /*#__PURE__*/jsx(Icon, {
441
- name: icon,
442
- size: size === 'large' ? 'medium' : 'small'
443
- })
444
- }), /*#__PURE__*/jsx("span", {
445
- className: labelClasses,
446
- children: label
447
- }), !isArrowHidden && /*#__PURE__*/jsx("div", {
448
- className: "ml-auto flex items-center",
449
- children: /*#__PURE__*/jsx(Icon, {
450
- name: isVisible ? 'angle-small-up' : 'angle-small-down',
451
- size: "small"
452
- })
453
- })]
454
- }), !portalTargetRef ? children : portalTargetRef != null && portalTargetRef.current && /*#__PURE__*/createPortal(children, portalTargetRef.current)]
455
- })
456
- });
457
- }
458
- Dropdown.Menu = DropdownMenu;
459
- Dropdown.Item = DropdownItem;
460
-
461
- function EvaluationStar(_ref) {
462
- var value = _ref.value,
463
- _ref$isEditable = _ref.isEditable,
464
- isEditable = _ref$isEditable === void 0 ? false : _ref$isEditable,
465
- onChangeRating = _ref.onChangeRating,
466
- _ref$size = _ref.size,
467
- size = _ref$size === void 0 ? 'medium' : _ref$size;
468
- var maxRating = 5;
469
- var _useState = useState(value),
470
- currentRating = _useState[0],
471
- setCurrentRating = _useState[1];
472
- var handleChangeRating = useCallback(function (newRating) {
473
- if (isEditable) {
474
- setCurrentRating(newRating);
475
- if (onChangeRating) {
476
- onChangeRating(newRating);
477
- }
478
- }
479
- }, [isEditable, onChangeRating]);
480
- var starClasses = clsx$1(focusVisible.inset, {
481
- 'w-6 h-6': size === 'large',
482
- 'w-4 h-4': size === 'medium'
483
- });
484
- // 各評価のレンダリングロジックを分離(React Hooksのルールに準拠)
485
- var renderStar = function renderStar(rating) {
486
- var color = rating <= currentRating ? 'fill-yellow-yellow50' : 'fill-icon03';
487
- return /*#__PURE__*/jsx("button", {
488
- type: "button",
489
- onClick: function onClick() {
490
- return handleChangeRating(rating);
491
- },
492
- className: clsx$1(color, starClasses),
493
- disabled: !isEditable,
494
- children: iconElements['star-filled']
495
- }, rating);
496
- };
497
- // 宣言的な方法で評価の配列を生成
498
- var ratingStars = Array.from({
499
- length: maxRating
500
- }, function (_, index) {
501
- return renderStar(index + 1);
502
- });
503
- return /*#__PURE__*/jsx("span", {
504
- className: "flex flex-row",
505
- children: ratingStars
506
- });
507
- }
508
-
509
- function Heading(props) {
510
- var TagName = "h" + props.level;
511
- var classes = clsx("flex items-center text-text01", typography.heading[TagName], {
512
- 'gap-2': props.level === 1,
513
- 'gap-1': props.level > 1
514
- });
515
- return /*#__PURE__*/jsxs(TagName, {
516
- className: classes,
517
- children: [props.before, props.children, props.after]
518
- });
519
- }
520
-
521
- var _excluded$5 = ["size", "variant", "isNoPadding", "isDisabled"];
522
- function IconButton(_ref) {
523
- var _ref$size = _ref.size,
524
- size = _ref$size === void 0 ? 'medium' : _ref$size,
525
- _ref$variant = _ref.variant,
526
- variant = _ref$variant === void 0 ? 'outline' : _ref$variant,
527
- _ref$isNoPadding = _ref.isNoPadding,
528
- isNoPadding = _ref$isNoPadding === void 0 ? false : _ref$isNoPadding,
529
- _ref$isDisabled = _ref.isDisabled,
530
- isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
531
- props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
532
- var baseClasses = clsx('typography-label16regular flex items-center justify-center gap-1 rounded', buttonColors[variant].base, buttonColors[variant].hover, buttonColors[variant].active, buttonColors[variant].disabled, focusVisible.normal, {
533
- 'h-4 w-4': size === 'small' && isNoPadding,
534
- 'h-6 w-6': size === 'small' && !isNoPadding || (size === 'medium' || size === 'large') && isNoPadding,
535
- 'h-8 w-8': size === 'medium' && !isNoPadding,
536
- 'h-10 w-10': size === 'large' && !isNoPadding,
537
- 'inline-flex': props.isAnchor,
538
- 'pointer-events-none': isDisabled
539
- });
540
- var iconSize = size === 'small' ? 'small' : 'medium';
541
- if (props.isAnchor === true) {
542
- return /*#__PURE__*/jsx("a", {
543
- className: baseClasses,
544
- href: props.href,
545
- target: props.target,
546
- children: /*#__PURE__*/jsx(Icon, {
547
- name: props.icon,
548
- size: iconSize
549
- })
550
- });
551
- } else {
552
- return /*#__PURE__*/jsx("button", {
553
- type: "button",
554
- className: baseClasses,
555
- disabled: isDisabled,
556
- onClick: props.onClick,
557
- children: /*#__PURE__*/jsx(Icon, {
558
- name: props.icon,
559
- size: iconSize
560
- })
561
- });
562
- }
563
- }
564
-
565
- function Loading(_ref) {
566
- var _ref$size = _ref.size,
567
- size = _ref$size === void 0 ? 'medium' : _ref$size,
568
- _ref$position = _ref.position,
569
- position = _ref$position === void 0 ? 'fixed' : _ref$position,
570
- _ref$height = _ref.height,
571
- height = _ref$height === void 0 ? '100%' : _ref$height;
572
- var wrapperClasses = clsx$1(position, 'left-0 top-0 z-20 flex w-full items-center justify-center');
573
- var svgClasses = clsx$1({
574
- 'h-4 w-4': size === 'small',
575
- 'h-8 w-8': size === 'medium',
576
- 'h-16 w-16': size === 'large'
577
- });
578
- return /*#__PURE__*/jsx(Fragment, {
579
- children: /*#__PURE__*/jsxs("div", {
580
- className: wrapperClasses,
581
- style: {
582
- height: height
583
- },
584
- children: [size === 'small' && /*#__PURE__*/jsx("svg", {
585
- className: svgClasses,
586
- viewBox: "0 0 16 16",
587
- fill: "none",
588
- xmlns: "http://www.w3.org/2000/svg",
589
- children: /*#__PURE__*/jsx("circle", {
590
- className: "origin-center animate-circular-small-move stroke-interactive01",
591
- cx: "8",
592
- cy: "8",
593
- r: "7",
594
- stroke: "currentColor",
595
- strokeWidth: "1.5",
596
- fill: "none"
597
- })
598
- }), size === 'medium' && /*#__PURE__*/jsx("svg", {
599
- className: svgClasses,
600
- viewBox: "0 0 32 32",
601
- fill: "none",
602
- xmlns: "http://www.w3.org/2000/svg",
603
- children: /*#__PURE__*/jsx("circle", {
604
- className: "origin-center animate-circular-medium-move stroke-interactive01",
605
- cx: "16",
606
- cy: "16",
607
- r: "15",
608
- stroke: "currentColor",
609
- strokeWidth: "2",
610
- fill: "none"
611
- })
612
- }), size === 'large' && /*#__PURE__*/jsx("svg", {
613
- className: svgClasses,
614
- viewBox: "0 0 64 64",
615
- fill: "none",
616
- xmlns: "http://www.w3.org/2000/svg",
617
- children: /*#__PURE__*/jsx("circle", {
618
- className: "origin-center animate-circular-large-move stroke-interactive01",
619
- cx: "32",
620
- cy: "32",
621
- r: "30",
622
- stroke: "currentColor",
623
- strokeWidth: "3",
624
- fill: "none"
625
- })
626
- })]
627
- })
628
- });
629
- }
630
-
631
- /**
632
- * モーダル表示時にバックグラウンドのスクロールを防止するコンポーネント。
633
- * コンポーネントがマウントされている間、position: fixedアプローチを使用して
634
- * body要素にスクロールロックを適用します。
635
- * 縦横両方のスクロール位置を保存し、コンポーネントのアンマウント時に復元します。
636
- * スクロールバーの有無を検出し、その幅を考慮してレイアウトシフトを防止します。
637
- * position、top、left、width、overflow、padding-rightを変更し、
638
- * 最小限の変更でスクロールを防止します。
639
- * グローバルCSSに依存せず、すべてインラインスタイルで実装されています。
640
- * このコンポーネントは実際のDOM要素をレンダリングせず、効果のみを適用します。
641
- *
642
- * @example
643
- * // モーダルコンポーネント内で使用する例
644
- * const Modal = ({ isOpen, children }) => {
645
- * return (
646
- * <>
647
- * {isOpen && <BodyScrollLock />}
648
- * {isOpen && (
649
- * <div className="modal">
650
- * {children}
651
- * </div>
652
- * )}
653
- * </>
654
- * );
655
- * };
656
- */
657
- var BodyScrollLock = function BodyScrollLock() {
658
- useLayoutEffect(function () {
659
- // 現在の縦横スクロール位置を記録
660
- var _window = window,
661
- scrollX = _window.scrollX,
662
- scrollY = _window.scrollY;
663
- var _document = document,
664
- body = _document.body;
665
- // スクロールバーの有無と幅を検出
666
- var hasVerticalScrollbar = document.documentElement.scrollHeight > document.documentElement.clientHeight;
667
- var scrollbarWidth = hasVerticalScrollbar ? window.innerWidth - document.documentElement.clientWidth : 0;
668
- // 元のインラインスタイルの値を保存
669
- var originalInlineStyles = {
670
- position: body.style.position,
671
- top: body.style.top,
672
- left: body.style.left,
673
- width: body.style.width,
674
- overflow: body.style.overflow,
675
- paddingRight: body.style.paddingRight
676
- };
677
- // スクロールロックスタイルを適用
678
- body.style.position = 'fixed';
679
- body.style.top = "-" + scrollY + "px";
680
- body.style.left = "-" + scrollX + "px";
681
- body.style.width = '100%';
682
- body.style.overflow = 'hidden';
683
- // スクロールバーがある場合、その幅分だけpadding-rightを調整
684
- if (hasVerticalScrollbar && scrollbarWidth > 0) {
685
- // 現在のpadding-rightの値を取得
686
- var _window$getComputedSt = window.getComputedStyle(body),
687
- paddingRight = _window$getComputedSt.paddingRight;
688
- var paddingRightValue = paddingRight !== '' ? parseInt(paddingRight, 10) : 0;
689
- // スクロールバーの幅を加算
690
- body.style.paddingRight = paddingRightValue + scrollbarWidth + "px";
691
- }
692
- // クリーンアップ関数
693
- return function () {
694
- // 元のスタイル値を取得
695
- var position = originalInlineStyles.position,
696
- top = originalInlineStyles.top,
697
- left = originalInlineStyles.left,
698
- width = originalInlineStyles.width,
699
- overflow = originalInlineStyles.overflow,
700
- paddingRight = originalInlineStyles.paddingRight;
701
- // プロパティごとに元の値を復元
702
- restoreProperty(body, 'position', position);
703
- restoreProperty(body, 'top', top);
704
- restoreProperty(body, 'left', left);
705
- restoreProperty(body, 'width', width);
706
- restoreProperty(body, 'overflow', overflow);
707
- restoreProperty(body, 'padding-right', paddingRight);
708
- // スクロール位置を復元
709
- window.scrollTo(scrollX, scrollY);
710
- };
711
- }, []); // 空の依存配列を指定して初回のみ実行
712
- // DOM要素をレンダリングせず、nullを返す
713
- return null;
714
- };
715
- /**
716
- * 元のスタイル値を復元するヘルパー関数
717
- * @param element スタイルを復元する要素
718
- * @param property 復元するCSSプロパティ名
719
- * @param value 復元する値
720
- */
721
- function restoreProperty(element, property, value) {
722
- if (value !== '') {
723
- element.style.setProperty(property, value);
724
- } else {
725
- element.style.removeProperty(property);
726
- }
727
- }
728
-
729
- function ModalBody(_ref) {
730
- var children = _ref.children;
731
- return /*#__PURE__*/jsx("div", {
732
- className: "overflow-y-auto",
733
- children: children
734
- });
735
- }
736
-
737
- var ModalContext = /*#__PURE__*/createContext({
738
- onClose: function onClose() {
739
- return null;
740
- }
741
- });
742
-
743
- function ModalFooter(_ref) {
744
- var children = _ref.children,
745
- _ref$isNoBorder = _ref.isNoBorder,
746
- isNoBorder = _ref$isNoBorder === void 0 ? false : _ref$isNoBorder;
747
- var wrapperClasses = clsx$1('flex w-full shrink-0 items-center rounded-b-lg px-6 py-4', {
748
- 'border-t-[1px] border-uiBorder01': !isNoBorder
749
- });
750
- return /*#__PURE__*/jsx("div", {
751
- className: wrapperClasses,
752
- children: children
753
- });
754
- }
755
-
756
- function ModalHeader(_ref) {
757
- var children = _ref.children,
758
- _ref$isNoBorder = _ref.isNoBorder,
759
- isNoBorder = _ref$isNoBorder === void 0 ? false : _ref$isNoBorder;
760
- var _useContext = useContext(ModalContext),
761
- onClose = _useContext.onClose;
762
- var headerClasses = clsx$1('typography-h5 flex w-full shrink-0 items-center justify-between rounded-t-lg px-6 text-text01', {
763
- 'border-b border-uiBorder01': !isNoBorder,
764
- 'h-14': !onClose,
765
- 'h-12': onClose
766
- });
767
- return /*#__PURE__*/jsxs("div", {
768
- className: headerClasses,
769
- children: [/*#__PURE__*/jsx("div", {
770
- children: children
771
- }), onClose && /*#__PURE__*/jsx(IconButton, {
772
- icon: "close",
773
- size: "small",
774
- variant: "text",
775
- onClick: onClose
776
- })]
777
- });
778
- }
779
-
780
- var LIMIT_WIDTH = 320;
781
- var LIMIT_HEIGHT = 184;
782
- function Modal(_ref) {
783
- var children = _ref.children,
784
- _ref$width = _ref.width,
785
- width = _ref$width === void 0 ? 480 : _ref$width,
786
- height = _ref.height,
787
- isOpen = _ref.isOpen,
788
- onClose = _ref.onClose,
789
- portalTargetRef = _ref.portalTargetRef;
790
- var _useState = useState(false),
791
- isMounted = _useState[0],
792
- setIsMounted = _useState[1];
793
- var renderWidth = typeof width === 'number' ? Math.max(width, LIMIT_WIDTH) : width;
794
- var renderHeight = typeof height === 'number' ? Math.max(height, LIMIT_HEIGHT) : height;
795
- useEffect(function () {
796
- setIsMounted(true);
797
- }, []);
798
- return isMounted && isOpen ? /*#__PURE__*/jsxs(Fragment, {
799
- children: [/*#__PURE__*/jsx(BodyScrollLock, {}), /*#__PURE__*/createPortal(/*#__PURE__*/jsx(ModalContext.Provider, {
800
- value: {
801
- onClose: onClose
802
- },
803
- children: /*#__PURE__*/jsx("div", {
804
- className: "fixed left-0 top-0 z-overlay flex size-full items-center justify-center bg-backgroundOverlayBlack py-4",
805
- children: /*#__PURE__*/jsx("div", {
806
- className: "grid max-h-full min-h-[120px] grid-rows-[max-content_1fr_max-content] flex-col rounded-lg bg-uiBackground01 shadow-modalShadow",
807
- style: {
808
- width: renderWidth,
809
- height: renderHeight
810
- },
811
- children: children
812
- })
813
- })
814
- }), (portalTargetRef == null ? void 0 : portalTargetRef.current) != null ? portalTargetRef.current : document.body)]
815
- }) : null;
816
- }
817
- Modal.Body = ModalBody;
818
- Modal.Header = ModalHeader;
819
- Modal.Footer = ModalFooter;
820
-
821
- var _excluded$4 = ["state", "size"];
822
- function NotificationInline(_ref) {
823
- var _ref$state = _ref.state,
824
- state = _ref$state === void 0 ? 'default' : _ref$state,
825
- _ref$size = _ref.size,
826
- size = _ref$size === void 0 ? 'medium' : _ref$size,
827
- props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
828
- var wrapperClasses = clsx('typography-body13regular flex items-center gap-1 rounded text-text01', {
829
- 'bg-uiBackgroundError': state === 'attention',
830
- 'bg-uiBackgroundWarning': state === 'warning',
831
- 'bg-uiBackgroundBlue': state === 'information',
832
- 'bg-uiBackgroundSuccess': state === 'success',
833
- 'bg-uiBackgroundGray': state === 'default',
834
- 'p-2': size === 'small',
835
- 'p-3': size === 'medium'
836
- });
837
- var iconClasses = clsx('flex items-center', {
838
- 'fill-supportError': state === 'attention',
839
- 'fill-supportWarning': state === 'warning',
840
- 'fill-blue-blue50': state === 'information',
841
- 'fill-supportSuccess': state === 'success'
842
- });
843
- var iconName = {
844
- attention: 'attention',
845
- success: 'success-filled',
846
- warning: 'warning',
847
- information: 'information-filled'
848
- };
849
- var iconSize = {
850
- small: 'small',
851
- medium: 'medium'
852
- };
853
- return /*#__PURE__*/jsxs("div", {
854
- className: wrapperClasses,
855
- children: [state !== 'default' && /*#__PURE__*/jsx("div", {
856
- className: iconClasses,
857
- children: /*#__PURE__*/jsx(Icon, {
858
- name: iconName[state],
859
- size: iconSize[size]
860
- })
861
- }), /*#__PURE__*/jsx("p", {
862
- className: "flex-1",
863
- children: props.children
864
- }), props.showClose === true && /*#__PURE__*/jsx("div", {
865
- className: "flex items-center",
866
- children: /*#__PURE__*/jsx(IconButton, {
867
- icon: "close",
868
- size: "small",
869
- variant: "text"
870
- })
871
- })]
872
- });
873
- }
874
-
875
- var PaginationContext = /*#__PURE__*/createContext({
876
- currentPage: 0
877
- });
878
-
879
- function PaginationButton(_ref) {
880
- var page = _ref.page,
881
- _onClick = _ref.onClick;
882
- var _useContext = useContext(PaginationContext),
883
- currentPage = _useContext.currentPage;
884
- var buttonClasses = clsx('flex h-8 min-w-8 items-center justify-center rounded fill-icon01 px-1', 'typography-label14regular', 'text-interactive02', 'hover:bg-hover02', {
885
- 'border border-uiBorder02': page === currentPage
886
- }, {
887
- 'border-transparent': page !== currentPage
888
- });
889
- return /*#__PURE__*/jsx("button", {
890
- type: "button",
891
- className: buttonClasses,
892
- onClick: function onClick() {
893
- return _onClick(page);
894
- },
895
- children: page
896
- });
897
- }
898
-
899
- var START_PAGE = 1;
900
- function Pagination(_ref) {
901
- var currentPage = _ref.currentPage,
902
- totalPage = _ref.totalPage,
903
- _ref$sideNumPagesToSh = _ref.sideNumPagesToShow,
904
- sideNumPagesToShow = _ref$sideNumPagesToSh === void 0 ? 3 : _ref$sideNumPagesToSh,
905
- _onClick = _ref.onClick;
906
- var center = Math.max(currentPage, START_PAGE + 1);
907
- center = Math.min(center, totalPage - 1);
908
- var start = Math.max(center - sideNumPagesToShow, START_PAGE + 1);
909
- var end = Math.min(center + sideNumPagesToShow, totalPage - 1);
910
- var offsetStart = center + sideNumPagesToShow >= totalPage ? totalPage - center - sideNumPagesToShow : 0;
911
- var offsetEnd = center <= sideNumPagesToShow ? sideNumPagesToShow - center + 1 : 0;
912
- var pageList = [];
913
- for (var i = start + offsetStart; i <= end + offsetEnd; i++) {
914
- pageList.push(i);
915
- }
916
- var threeDotIconClasses = 'flex h-8 w-8 items-center justify-center gap-1 fill-icon01';
917
- return /*#__PURE__*/jsx(PaginationContext.Provider, {
918
- value: {
919
- currentPage: currentPage
920
- },
921
- children: /*#__PURE__*/jsxs("ul", {
922
- className: "flex gap-1",
923
- children: [/*#__PURE__*/jsx("li", {
924
- className: "flex items-center",
925
- children: /*#__PURE__*/jsx(IconButton, {
926
- isDisabled: currentPage === START_PAGE,
927
- variant: "text",
928
- icon: "angle-left",
929
- size: "small",
930
- onClick: function onClick() {
931
- return _onClick(currentPage - 1);
932
- }
933
- })
934
- }), /*#__PURE__*/jsx("li", {
935
- children: /*#__PURE__*/jsx(PaginationButton, {
936
- onClick: function onClick() {
937
- return _onClick(START_PAGE);
938
- },
939
- page: START_PAGE
940
- })
941
- }), pageList.length !== 0 && pageList[0] !== 2 && /*#__PURE__*/jsx("li", {
942
- className: threeDotIconClasses,
943
- children: /*#__PURE__*/jsx(Icon, {
944
- name: "more",
945
- size: "small"
946
- })
947
- }), pageList.map(function (page, index) {
948
- return /*#__PURE__*/jsx("li", {
949
- children: /*#__PURE__*/jsx(PaginationButton, {
950
- onClick: function onClick() {
951
- return _onClick(page);
952
- },
953
- page: page
954
- })
955
- }, index);
956
- }), pageList.length !== 0 && pageList[pageList.length - 1] !== totalPage - 1 && /*#__PURE__*/jsx("li", {
957
- className: threeDotIconClasses,
958
- children: /*#__PURE__*/jsx(Icon, {
959
- name: "more",
960
- size: "small"
961
- })
962
- }), /*#__PURE__*/jsx("li", {
963
- children: /*#__PURE__*/jsx(PaginationButton, {
964
- onClick: function onClick() {
965
- return _onClick(totalPage);
966
- },
967
- page: totalPage
968
- })
969
- }), /*#__PURE__*/jsx("li", {
970
- className: "flex items-center",
971
- children: /*#__PURE__*/jsx(IconButton, {
972
- isDisabled: currentPage === totalPage,
973
- variant: "text",
974
- icon: "angle-right",
975
- size: "small",
976
- onClick: function onClick() {
977
- return _onClick(currentPage + 1);
978
- }
979
- })
980
- })]
981
- })
982
- });
983
- }
984
-
985
- var SelectContext = /*#__PURE__*/createContext({
986
- size: 'medium',
987
- setIsOptionListOpen: function setIsOptionListOpen() {
988
- return false;
989
- },
990
- variant: 'outline'
991
- });
992
-
993
- function SelectItem$1(_ref) {
994
- var option = _ref.option;
995
- var _useContext = useContext(SelectContext),
996
- setIsOptionListOpen = _useContext.setIsOptionListOpen,
997
- selectedOption = _useContext.selectedOption,
998
- onChange = _useContext.onChange;
999
- var handleClickItem = function handleClickItem(option) {
1000
- onChange == null || onChange(option);
1001
- setIsOptionListOpen(false);
1002
- };
1003
- var itemClasses = clsx$1('typography-label14regular flex h-8 w-full items-center px-3 hover:bg-hover02 active:bg-active02', focusVisible.inset, {
1004
- 'text-interactive01 fill-interactive01 bg-selectedUi': option.id === (selectedOption == null ? void 0 : selectedOption.id),
1005
- 'text-interactive02 fill-icon01 bg-uiBackground01': option.id !== (selectedOption == null ? void 0 : selectedOption.id)
1006
- });
1007
- return /*#__PURE__*/jsx("li", {
1008
- className: "flex w-full items-center",
1009
- "data-id": option.id,
1010
- children: /*#__PURE__*/jsxs("button", {
1011
- className: itemClasses,
1012
- type: "button",
1013
- onClick: function onClick() {
1014
- return handleClickItem(option);
1015
- },
1016
- children: [option.icon && /*#__PURE__*/jsx(Icon, {
1017
- name: option.icon,
1018
- size: "small"
1019
- }), /*#__PURE__*/jsx("span", {
1020
- className: "ml-1 mr-6",
1021
- children: option.label
1022
- }), option.id === (selectedOption == null ? void 0 : selectedOption.id) && /*#__PURE__*/jsx("div", {
1023
- className: "ml-auto flex items-center",
1024
- children: /*#__PURE__*/jsx(Icon, {
1025
- name: "check",
1026
- size: "small"
1027
- })
1028
- })]
1029
- })
1030
- }, option.id);
1031
- }
1032
-
1033
- function SelectList$1(_ref) {
1034
- var children = _ref.children,
1035
- maxHeight = _ref.maxHeight;
1036
- var ref = useRef(null);
1037
- var _useContext = useContext(SelectContext),
1038
- size = _useContext.size,
1039
- selectedOption = _useContext.selectedOption,
1040
- setIsOptionListOpen = _useContext.setIsOptionListOpen,
1041
- variant = _useContext.variant,
1042
- placeholder = _useContext.placeholder,
1043
- onChange = _useContext.onChange;
1044
- var handleClickDeselect = function handleClickDeselect() {
1045
- onChange == null || onChange(null);
1046
- setIsOptionListOpen(false);
1047
- };
1048
- useLayoutEffect(function () {
1049
- if (maxHeight != null && ref.current) {
1050
- var _ref$current$children;
1051
- var element = Array.from((_ref$current$children = ref.current.children) != null ? _ref$current$children : []).find(function (item) {
1052
- return item.getAttribute('data-id') === (selectedOption == null ? void 0 : selectedOption.id);
1053
- });
1054
- if (element != null && ref.current.scroll != null) {
1055
- var wrapRect = ref.current.getBoundingClientRect();
1056
- var rect = element.getBoundingClientRect();
1057
- ref.current.scroll(0, rect.top - wrapRect.top - wrapRect.height / 2 + rect.height / 2);
1058
- }
1059
- }
1060
- // eslint-disable-next-line react-hooks/exhaustive-deps
1061
- }, []);
1062
- var listClasses = clsx$1('absolute z-dropdown w-max overflow-y-auto rounded bg-uiBackground01 py-2 shadow-floatingShadow', {
1063
- 'top-7': size === 'x-small' || size === 'small',
1064
- 'top-9': size === 'medium',
1065
- 'top-11': size === 'large',
1066
- 'border-solid border border-uiBorder01': variant === 'outline'
1067
- });
1068
- var deselectButtonClasses = clsx$1('typography-label14regular flex h-8 w-full items-center px-3 text-interactive02 hover:bg-hover02 active:bg-active02', focusVisible.inset);
1069
- return /*#__PURE__*/jsxs("ul", {
1070
- className: listClasses,
1071
- style: {
1072
- maxHeight: maxHeight
1073
- },
1074
- ref: ref,
1075
- children: [children, placeholder != null && selectedOption !== null && /*#__PURE__*/jsx("li", {
1076
- children: /*#__PURE__*/jsx("button", {
1077
- className: deselectButtonClasses,
1078
- type: "button",
1079
- onClick: handleClickDeselect,
1080
- children: "\u9078\u629E\u89E3\u9664"
1081
- })
1082
- })]
1083
- });
1084
- }
1085
-
1086
- function Select(_ref) {
1087
- var _clsx;
1088
- var children = _ref.children,
1089
- _ref$size = _ref.size,
1090
- size = _ref$size === void 0 ? 'medium' : _ref$size,
1091
- _ref$variant = _ref.variant,
1092
- variant = _ref$variant === void 0 ? 'outline' : _ref$variant,
1093
- width = _ref.width,
1094
- maxWidth = _ref.maxWidth,
1095
- placeholder = _ref.placeholder,
1096
- placeholderIcon = _ref.placeholderIcon,
1097
- _ref$selectedOption = _ref.selectedOption,
1098
- selectedOption = _ref$selectedOption === void 0 ? null : _ref$selectedOption,
1099
- _ref$isDisabled = _ref.isDisabled,
1100
- isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
1101
- _ref$isOptionSelected = _ref.isOptionSelected,
1102
- isOptionSelected = _ref$isOptionSelected === void 0 ? false : _ref$isOptionSelected,
1103
- onChange = _ref.onChange,
1104
- optionListMaxHeight = _ref.optionListMaxHeight;
1105
- var _useState = useState(false),
1106
- isOptionListOpen = _useState[0],
1107
- setIsOptionListOpen = _useState[1];
1108
- var targetRef = useRef(null);
1109
- useOutsideClick(targetRef, function () {
1110
- return setIsOptionListOpen(false);
1111
- });
1112
- var handleClickToggle = function handleClickToggle() {
1113
- return setIsOptionListOpen(function (prev) {
1114
- return !prev;
1115
- });
1116
- };
1117
- var wrapperClasses = clsx$1('relative flex shrink-0 items-center gap-1 rounded bg-uiBackground01', {
1118
- 'h-6': size === 'x-small' || size === 'small',
1119
- 'h-8': size === 'medium',
1120
- 'h-10': size === 'large',
1121
- 'cursor-not-allowed': isDisabled
1122
- });
1123
- var buttonClasses = clsx$1('flex size-full items-center rounded', buttonColors[variant].hover, buttonColors[variant].active, buttonColors[variant].disabled, focusVisible.normal, (_clsx = {}, _clsx[buttonColors[variant].selected] = isOptionSelected && !isDisabled && selectedOption, _clsx[buttonColors[variant].base] = !(isOptionSelected && !isDisabled && selectedOption), _clsx['px-2'] = size === 'x-small' || size === 'small', _clsx['px-4'] = size === 'medium' || size === 'large', _clsx['pointer-events-none'] = isDisabled, _clsx));
1124
- var labelClasses = clsx$1('overflow-hidden', {
1125
- 'mr-1': size === 'x-small',
1126
- 'mr-2': size !== 'x-small',
1127
- 'typography-label12regular': size === 'x-small',
1128
- 'typography-label14regular': size === 'small' || size === 'medium',
1129
- 'typography-label16regular': size === 'large'
1130
- });
1131
- return /*#__PURE__*/jsx(SelectContext.Provider, {
1132
- value: {
1133
- size: size,
1134
- variant: variant,
1135
- placeholder: placeholder,
1136
- setIsOptionListOpen: setIsOptionListOpen,
1137
- selectedOption: selectedOption,
1138
- onChange: onChange
1139
- },
1140
- children: /*#__PURE__*/jsxs("div", {
1141
- className: wrapperClasses,
1142
- style: {
1143
- width: width,
1144
- maxWidth: maxWidth
1145
- },
1146
- ref: targetRef,
1147
- children: [/*#__PURE__*/jsxs("button", {
1148
- className: buttonClasses,
1149
- type: "button",
1150
- onClick: handleClickToggle,
1151
- disabled: isDisabled,
1152
- children: [selectedOption != null && selectedOption.icon ? /*#__PURE__*/jsx("div", {
1153
- className: "mr-1 flex",
1154
- children: /*#__PURE__*/jsx(Icon, {
1155
- name: selectedOption.icon,
1156
- size: size === 'large' ? 'medium' : 'small'
1157
- })
1158
- }) : placeholder != null && placeholderIcon && /*#__PURE__*/jsx("div", {
1159
- className: "mr-1 flex",
1160
- children: /*#__PURE__*/jsx(Icon, {
1161
- name: placeholderIcon,
1162
- size: size === 'large' ? 'medium' : 'small'
1163
- })
1164
- }), /*#__PURE__*/jsx("div", {
1165
- className: labelClasses,
1166
- children: /*#__PURE__*/jsx("div", {
1167
- className: "truncate",
1168
- children: selectedOption ? selectedOption.label : placeholder != null && placeholder
1169
- })
1170
- }), /*#__PURE__*/jsx("div", {
1171
- className: "ml-auto flex items-center",
1172
- children: /*#__PURE__*/jsx(Icon, {
1173
- name: isOptionListOpen ? 'angle-small-up' : 'angle-small-down',
1174
- size: size === 'large' ? 'medium' : 'small'
1175
- })
1176
- })]
1177
- }), isOptionListOpen && !isDisabled && /*#__PURE__*/jsx(SelectList$1, {
1178
- maxHeight: optionListMaxHeight,
1179
- children: children
1180
- })]
1181
- })
1182
- });
1183
- }
1184
- Select.Option = SelectItem$1;
1185
-
1186
- function PaginationSelect(_ref) {
1187
- var totalSize = _ref.totalSize,
1188
- currentPage = _ref.currentPage,
1189
- sizePerPage = _ref.sizePerPage,
1190
- _ref$countLabel = _ref.countLabel,
1191
- countLabel = _ref$countLabel === void 0 ? '件' : _ref$countLabel,
1192
- _ref$pageLabel = _ref.pageLabel,
1193
- pageLabel = _ref$pageLabel === void 0 ? 'ページ' : _ref$pageLabel,
1194
- _ref$optionListMaxHei = _ref.optionListMaxHeight,
1195
- optionListMaxHeight = _ref$optionListMaxHei === void 0 ? 190 : _ref$optionListMaxHei,
1196
- onClickPrevButton = _ref.onClickPrevButton,
1197
- onClickNextButton = _ref.onClickNextButton,
1198
- _onChange = _ref.onChange;
1199
- var pageMax = Math.ceil(totalSize / sizePerPage);
1200
- var optionsList = [].concat(Array(pageMax)).map(function (_, index) {
1201
- var value = (index + 1).toString();
1202
- return {
1203
- id: value,
1204
- value: value,
1205
- label: value
1206
- };
1207
- });
1208
- var minCount = totalSize ? (currentPage - 1) * sizePerPage + 1 : 0;
1209
- var maxCount = currentPage * sizePerPage > totalSize ? totalSize : currentPage * sizePerPage;
1210
- return /*#__PURE__*/jsxs("nav", {
1211
- "aria-label": "pagination",
1212
- className: "flex items-center gap-x-1",
1213
- children: [/*#__PURE__*/jsxs("div", {
1214
- className: "flex items-center gap-x-2",
1215
- children: [/*#__PURE__*/jsxs("div", {
1216
- className: "typography-label14regular text-text01",
1217
- children: [minCount > 0 && minCount + " - ", maxCount, countLabel]
1218
- }), /*#__PURE__*/jsx(Select, {
1219
- size: "medium",
1220
- variant: "outline",
1221
- selectedOption: optionsList.find(function (option) {
1222
- return option.value === currentPage.toString();
1223
- }),
1224
- optionListMaxHeight: optionListMaxHeight,
1225
- onChange: function onChange(option) {
1226
- return option && _onChange(Number(option.value));
1227
- },
1228
- isDisabled: pageMax === 0,
1229
- children: optionsList.map(function (option) {
1230
- return /*#__PURE__*/jsx(Select.Option, {
1231
- option: option
1232
- }, option.id);
1233
- })
1234
- }), /*#__PURE__*/jsxs("div", {
1235
- className: "typography-label14regular text-text03",
1236
- children: ["/ ", pageMax, pageLabel]
1237
- })]
1238
- }), /*#__PURE__*/jsxs("div", {
1239
- className: "flex items-center",
1240
- children: [/*#__PURE__*/jsx(IconButton, {
1241
- variant: "text",
1242
- icon: "angle-left",
1243
- size: "small",
1244
- isDisabled: currentPage === 1,
1245
- onClick: onClickPrevButton
1246
- }), /*#__PURE__*/jsx(IconButton, {
1247
- variant: "text",
1248
- icon: "angle-right",
1249
- size: "small",
1250
- isDisabled: currentPage === pageMax || pageMax === 0,
1251
- onClick: onClickNextButton
1252
- })]
1253
- })]
1254
- });
1255
- }
1256
-
1257
- function Radio(_ref) {
1258
- var name = _ref.name,
1259
- value = _ref.value,
1260
- id = _ref.id,
1261
- label = _ref.label,
1262
- _ref$isChecked = _ref.isChecked,
1263
- isChecked = _ref$isChecked === void 0 ? false : _ref$isChecked,
1264
- _ref$isDisabled = _ref.isDisabled,
1265
- isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
1266
- onChange = _ref.onChange;
1267
- var _useState = useState(false),
1268
- isMouseOver = _useState[0],
1269
- setIsMouseOver = _useState[1];
1270
- var handleMouseOverInput = useCallback(function () {
1271
- setIsMouseOver(true);
1272
- }, []);
1273
- var handleMouseOutInput = useCallback(function () {
1274
- setIsMouseOver(false);
1275
- }, []);
1276
- var handleChange = useCallback(function (e) {
1277
- return !isDisabled && (onChange == null ? void 0 : onChange(e));
1278
- }, [isDisabled, onChange]);
1279
- var inputClasses = clsx$1('peer absolute z-[1] size-6 opacity-0', {
1280
- 'cursor-not-allowed': isDisabled,
1281
- 'cursor-pointer': !isDisabled
1282
- });
1283
- var boxClasses = clsx$1('inline-flex size-5 items-center justify-center rounded-full border border-solid bg-white', focusVisible.normalPeer, {
1284
- 'border-disabled01 hover:border-disabled01': isDisabled && !isMouseOver,
1285
- 'border-hoverUiBorder': !isDisabled && isMouseOver,
1286
- 'border-uiBorder03': !isDisabled,
1287
- 'cursor-not-allowed': isDisabled,
1288
- 'cursor-pointer': !isDisabled
1289
- });
1290
- var afterClasses = clsx$1('absolute inset-0 m-auto block size-3 rounded-full', {
1291
- 'bg-disabled01': isDisabled && isChecked,
1292
- 'bg-activeSelectedUi': !isDisabled && isChecked,
1293
- 'scale-0': !isChecked,
1294
- 'scale-100': isChecked
1295
- });
1296
- var hoverIndicatorClasses = clsx$1('inline-block size-3 rounded-full', {
1297
- 'bg-hoverUi': !isDisabled && !isChecked && isMouseOver
1298
- });
1299
- var labelClasses = clsx$1('typography-label14regular ml-2 flex-[1_0_0] select-none break-all', {
1300
- 'pointer-events-none cursor-not-allowed text-disabled01': isDisabled,
1301
- 'cursor-pointer text-text01': !isDisabled
1302
- });
1303
- return /*#__PURE__*/jsxs("div", {
1304
- className: "flex items-center",
1305
- children: [/*#__PURE__*/jsxs("div", {
1306
- className: "flex size-6 items-center justify-center",
1307
- children: [/*#__PURE__*/jsx("input", {
1308
- type: "checkbox",
1309
- value: value,
1310
- name: name,
1311
- id: id,
1312
- checked: isChecked,
1313
- disabled: isDisabled,
1314
- onChange: handleChange,
1315
- onMouseOver: handleMouseOverInput,
1316
- onMouseLeave: handleMouseOutInput,
1317
- className: inputClasses
1318
- }), /*#__PURE__*/jsx("div", {
1319
- className: boxClasses,
1320
- children: /*#__PURE__*/jsxs("div", {
1321
- className: "relative flex size-5 flex-[0_0_auto] items-center justify-center",
1322
- children: [/*#__PURE__*/jsx("span", {
1323
- className: afterClasses
1324
- }), /*#__PURE__*/jsx("span", {
1325
- className: hoverIndicatorClasses
1326
- })]
1327
- })
1328
- })]
1329
- }), /*#__PURE__*/jsx("label", {
1330
- htmlFor: id,
1331
- className: labelClasses,
1332
- children: label
1333
- })]
1334
- });
1335
- }
1336
-
1337
- var _excluded$3 = ["width", "size"];
1338
- var Search = /*#__PURE__*/forwardRef(function (_ref, ref) {
1339
- var _clsx;
1340
- var _ref$width = _ref.width,
1341
- width = _ref$width === void 0 ? '100%' : _ref$width,
1342
- _ref$size = _ref.size,
1343
- size = _ref$size === void 0 ? 'medium' : _ref$size,
1344
- props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
1345
- var classes = clsx('flex items-center rounded-full border border-uiBorder02 bg-uiBackground01 focus-within:border-activeInput', {
1346
- 'h-8 px-3': size === 'medium'
1347
- }, {
1348
- 'h-10 px-4': size === 'large'
1349
- });
1350
- var inputClasses = clsx('mx-2 h-full flex-1 text-text01 outline-0 placeholder:text-textPlaceholder', (_clsx = {}, _clsx['typography-label14regular'] = size === 'medium', _clsx['typography-label16regular'] = size === 'large', _clsx));
1351
- return /*#__PURE__*/jsx("div", {
1352
- className: "relative",
1353
- ref: ref,
1354
- children: /*#__PURE__*/jsx("form", {
1355
- onSubmit: props.onSubmit,
1356
- children: /*#__PURE__*/jsxs("div", {
1357
- className: classes,
1358
- style: {
1359
- width: width
1360
- },
1361
- children: [/*#__PURE__*/jsx(Icon, {
1362
- name: "search",
1363
- color: "icon01",
1364
- size: "medium"
1365
- }), /*#__PURE__*/jsx("input", {
1366
- type: "text",
1367
- size: 1,
1368
- value: props.value,
1369
- className: inputClasses,
1370
- placeholder: props.placeholder,
1371
- onChange: props.onChange
1372
- }), props.onClickClearButton && props.value && props.value.length !== 0 && /*#__PURE__*/jsx(IconButton, {
1373
- variant: "text",
1374
- icon: "close",
1375
- size: size === 'medium' ? 'small' : 'medium',
1376
- isNoPadding: true,
1377
- onClick: props.onClickClearButton
1378
- })]
1379
- })
1380
- })
1381
- });
1382
- });
1383
- Search.displayName = 'Search';
1384
-
1385
- function SelectItem(_ref) {
1386
- var children = _ref.children,
1387
- isSortKey = _ref.isSortKey,
1388
- onClickItem = _ref.onClickItem;
1389
- var itemClasses = clsx$1('typography-label14regular flex h-8 w-full items-center px-3 hover:bg-hover02 active:bg-active02', focusVisible.inset, {
1390
- 'bg-selectedUi fill-interactive01 text-interactive01': isSortKey,
1391
- 'bg-uiBackground01 fill-icon01 text-interactive02': !isSortKey
1392
- });
1393
- return /*#__PURE__*/jsx("li", {
1394
- className: "flex w-full items-center",
1395
- onClick: onClickItem,
1396
- children: /*#__PURE__*/jsxs("button", {
1397
- className: itemClasses,
1398
- type: "button",
1399
- children: [/*#__PURE__*/jsx("span", {
1400
- className: "ml-1 mr-6",
1401
- children: children
1402
- }), isSortKey && /*#__PURE__*/jsx("div", {
1403
- className: "ml-auto flex items-center",
1404
- children: /*#__PURE__*/jsx(Icon, {
1405
- name: "check",
1406
- size: "small"
1407
- })
1408
- })]
1409
- })
1410
- });
1411
- }
1412
-
1413
- function SelectList(_ref) {
1414
- var size = _ref.size,
1415
- variant = _ref.variant,
1416
- sortOrder = _ref.sortOrder,
1417
- _onClickItem = _ref.onClickItem,
1418
- onClickDeselect = _ref.onClickDeselect;
1419
- var listClasses = clsx$1('absolute z-dropdown w-max overflow-y-auto rounded bg-uiBackground01 py-2 shadow-floatingShadow', {
1420
- 'top-7': size === 'x-small' || size === 'small',
1421
- 'top-9': size === 'medium',
1422
- 'top-11': size === 'large',
1423
- 'border-solid border border-uiBorder01': variant === 'outline'
1424
- });
1425
- var deselectButtonClasses = clsx$1('typography-label14regular flex h-8 w-full items-center px-3 text-interactive02 hover:bg-hover02 active:bg-active02', focusVisible.inset);
1426
- return /*#__PURE__*/jsxs("ul", {
1427
- className: listClasses,
1428
- children: [/*#__PURE__*/jsx(SelectItem, {
1429
- isSortKey: sortOrder === 'ascend',
1430
- onClickItem: function onClickItem() {
1431
- return _onClickItem('ascend');
1432
- },
1433
- children: "\u6607\u9806\u3067\u4E26\u3073\u66FF\u3048"
1434
- }), /*#__PURE__*/jsx(SelectItem, {
1435
- isSortKey: sortOrder === 'descend',
1436
- onClickItem: function onClickItem() {
1437
- return _onClickItem('descend');
1438
- },
1439
- children: "\u964D\u9806\u3067\u4E26\u3073\u66FF\u3048"
1440
- }), sortOrder !== null && onClickDeselect && /*#__PURE__*/jsx("li", {
1441
- children: /*#__PURE__*/jsx("button", {
1442
- className: deselectButtonClasses,
1443
- type: "button",
1444
- onClick: onClickDeselect,
1445
- children: "\u9078\u629E\u89E3\u9664"
1446
- })
1447
- })]
1448
- });
1449
- }
1450
-
1451
- function SelectSort(_ref) {
1452
- var _clsx;
1453
- var _ref$size = _ref.size,
1454
- size = _ref$size === void 0 ? 'medium' : _ref$size,
1455
- _ref$variant = _ref.variant,
1456
- variant = _ref$variant === void 0 ? 'outline' : _ref$variant,
1457
- width = _ref.width,
1458
- label = _ref.label,
1459
- sortOrder = _ref.sortOrder,
1460
- _ref$isDisabled = _ref.isDisabled,
1461
- isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
1462
- _ref$isSortKey = _ref.isSortKey,
1463
- isSortKey = _ref$isSortKey === void 0 ? false : _ref$isSortKey,
1464
- onChange = _ref.onChange,
1465
- onClickDeselect = _ref.onClickDeselect;
1466
- var _useState = useState(false),
1467
- isOptionListOpen = _useState[0],
1468
- setIsOptionListOpen = _useState[1];
1469
- var targetRef = useRef(null);
1470
- useOutsideClick(targetRef, function () {
1471
- return setIsOptionListOpen(false);
1472
- });
1473
- var handleClickToggle = function handleClickToggle() {
1474
- return setIsOptionListOpen(function (prev) {
1475
- return !prev;
1476
- });
1477
- };
1478
- var handleClickItem = useCallback(function (value) {
1479
- onChange == null || onChange(value);
1480
- setIsOptionListOpen(false);
1481
- }, [onChange]);
1482
- var wrapperClasses = clsx$1('relative flex shrink-0 items-center gap-1 rounded', {
1483
- 'h-6': size === 'x-small' || size === 'small',
1484
- 'h-8': size === 'medium',
1485
- 'h-10': size === 'large',
1486
- 'cursor-not-allowed': isDisabled
1487
- });
1488
- var buttonClasses = clsx$1('flex size-full items-center rounded', buttonColors[variant].hover, buttonColors[variant].active, buttonColors[variant].disabled, focusVisible.normal, (_clsx = {}, _clsx[buttonColors[variant].selected] = isSortKey, _clsx[buttonColors[variant].base] = !isSortKey, _clsx['px-2'] = size === 'x-small' || size === 'small', _clsx['px-4'] = size === 'medium' || size === 'large', _clsx['pointer-events-none'] = isDisabled, _clsx));
1489
- var labelClasses = clsx$1('truncate', {
1490
- 'typography-label12regular': size === 'x-small',
1491
- 'typography-label14regular': size === 'small' || size === 'medium',
1492
- 'typography-label16regular': size === 'large',
1493
- 'mr-1': size === 'x-small',
1494
- 'mr-2': size !== 'x-small'
1495
- });
1496
- return /*#__PURE__*/jsxs("div", {
1497
- className: wrapperClasses,
1498
- style: {
1499
- width: width
1500
- },
1501
- ref: targetRef,
1502
- children: [/*#__PURE__*/jsxs("button", {
1503
- className: buttonClasses,
1504
- type: "button",
1505
- onClick: handleClickToggle,
1506
- disabled: isDisabled,
1507
- children: [/*#__PURE__*/jsx("div", {
1508
- className: labelClasses,
1509
- children: label
1510
- }), /*#__PURE__*/jsx("div", {
1511
- className: "ml-auto flex items-center",
1512
- children: isSortKey ? /*#__PURE__*/jsx(Icon, {
1513
- name: sortOrder === 'ascend' ? 'arrow-up' : 'arrow-down',
1514
- size: size === 'large' ? 'medium' : 'small'
1515
- }) : /*#__PURE__*/jsx(Icon, {
1516
- name: isOptionListOpen ? 'angle-small-up' : 'angle-small-down',
1517
- size: size === 'large' ? 'medium' : 'small'
1518
- })
1519
- })]
1520
- }), isOptionListOpen && !isDisabled && /*#__PURE__*/jsx(SelectList, {
1521
- size: size,
1522
- variant: variant,
1523
- sortOrder: sortOrder,
1524
- onClickItem: handleClickItem,
1525
- onClickDeselect: onClickDeselect
1526
- })]
1527
- });
1528
- }
1529
-
1530
- var _excluded$2 = ["isSelected"];
1531
- var TabItem = function TabItem(_ref) {
1532
- var _ref$isSelected = _ref.isSelected,
1533
- isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
1534
- props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
1535
- var classes = clsx('relative z-0 flex py-2 leading-[24px] before:absolute before:inset-x-0 before:bottom-0 before:h-px hover:text-text01 disabled:pointer-events-none disabled:text-disabled01', {
1536
- 'typography-label14regular': !isSelected,
1537
- 'text-interactive02 hover:before:bg-uiBorder04': !isSelected,
1538
- 'typography-label14bold': isSelected,
1539
- 'before:bg-interactive01 hover:before:bg-interactive01 pointer-events-none': isSelected
1540
- });
1541
- return /*#__PURE__*/jsx("button", {
1542
- type: "button",
1543
- role: "tab",
1544
- "aria-selected": isSelected,
1545
- className: classes,
1546
- disabled: props.isDisabled,
1547
- onClick: function onClick() {
1548
- return props.onClick(props.id);
1549
- },
1550
- children: props.children
1551
- });
1552
- };
1553
-
1554
- function Tab(_ref) {
1555
- var children = _ref.children;
1556
- return /*#__PURE__*/jsx("div", {
1557
- role: "tablist",
1558
- className: "relative flex gap-4 px-6 before:absolute before:inset-x-0 before:bottom-0 before:h-px before:bg-uiBorder01",
1559
- children: children
1560
- });
1561
- }
1562
- Tab.Item = TabItem;
1563
-
1564
- function TableCell(_ref) {
1565
- var children = _ref.children,
1566
- className = _ref.className,
1567
- _ref$isHeader = _ref.isHeader,
1568
- isHeader = _ref$isHeader === void 0 ? false : _ref$isHeader;
1569
- var classes = clsx$1('border-b border-uiBorder01', {
1570
- 'sticky top-0 z-10 bg-white': isHeader
1571
- }, className);
1572
- return /*#__PURE__*/jsx("div", {
1573
- className: classes,
1574
- children: children
1575
- });
1576
- }
1577
-
1578
- function TableRow(_ref) {
1579
- var children = _ref.children,
1580
- _ref$isHoverBackgroun = _ref.isHoverBackgroundVisible,
1581
- isHoverBackgroundVisible = _ref$isHoverBackgroun === void 0 ? false : _ref$isHoverBackgroun;
1582
- var rowClasses = clsx$1('contents', isHoverBackgroundVisible && '[&:hover>div]:bg-hoverUi02');
1583
- return /*#__PURE__*/jsx("div", {
1584
- className: rowClasses,
1585
- children: children
1586
- });
1587
- }
1588
-
1589
- function Table(_ref) {
1590
- var width = _ref.width,
1591
- templateRows = _ref.templateRows,
1592
- templateColumns = _ref.templateColumns,
1593
- autoColumns = _ref.autoColumns,
1594
- autoRows = _ref.autoRows,
1595
- children = _ref.children;
1596
- return /*#__PURE__*/jsx("div", {
1597
- className: "grid",
1598
- style: {
1599
- width: width,
1600
- gridTemplateRows: templateRows,
1601
- gridTemplateColumns: templateColumns,
1602
- gridAutoColumns: autoColumns,
1603
- gridAutoRows: autoRows
1604
- },
1605
- children: children
1606
- });
1607
- }
1608
- Table.Row = TableRow;
1609
- Table.Cell = TableCell;
1610
-
1611
- var DeleteIcon = function DeleteIcon(_ref) {
1612
- var color = _ref.color,
1613
- variant = _ref.variant,
1614
- onClick = _ref.onClick;
1615
- var deleteButtonClasses = clsx$1('group ml-2 size-[14px] rounded-full p-0.5 hover:cursor-pointer hover:bg-iconOnColor focus-visible:bg-iconOnColor', focusVisible.normal);
1616
- var deletePathClasses = clsx$1({
1617
- 'fill-interactive02': color === 'gray' || variant === 'light',
1618
- 'group-hover:fill-interactive02 group-focus-visible:fill-interactive02 fill-iconOnColor': color !== 'gray'
1619
- });
1620
- return /*#__PURE__*/jsx("button", {
1621
- type: "button",
1622
- className: deleteButtonClasses,
1623
- onClick: onClick,
1624
- children: /*#__PURE__*/jsx("svg", {
1625
- viewBox: "0 0 24 24",
1626
- xmlns: "http://www.w3.org/2000/svg",
1627
- children: /*#__PURE__*/jsx("path", {
1628
- fillRule: "evenodd",
1629
- clipRule: "evenodd",
1630
- d: "M19.7745 4.21818C19.384 3.82765 18.7508 3.82765 18.3603 4.21818L11.9963 10.5821L5.6324 4.21818C5.24187 3.82765 4.60871 3.82765 4.21818 4.21818C3.82766 4.6087 3.82766 5.24187 4.21818 5.63239L10.5821 11.9964L4.21818 18.3603C3.82766 18.7508 3.82766 19.384 4.21818 19.7745C4.60871 20.1651 5.24187 20.165 5.6324 19.7745L11.9963 13.4106L18.3603 19.7745C18.7508 20.165 19.384 20.1651 19.7745 19.7745C20.165 19.384 20.165 18.7508 19.7745 18.3603L13.4106 11.9964L19.7745 5.63239C20.165 5.24187 20.165 4.6087 19.7745 4.21818Z",
1631
- className: deletePathClasses
1632
- })
1633
- })
1634
- });
1635
- };
1636
-
1637
- function Tag(_ref) {
1638
- var _clsx;
1639
- var id = _ref.id,
1640
- children = _ref.children,
1641
- color = _ref.color,
1642
- _ref$variant = _ref.variant,
1643
- variant = _ref$variant === void 0 ? 'normal' : _ref$variant,
1644
- _ref$size = _ref.size,
1645
- size = _ref$size === void 0 ? 'medium' : _ref$size,
1646
- isEditable = _ref.isEditable,
1647
- onDelete = _ref.onDelete;
1648
- var wrapperClasses = clsx$1('flex', 'items-center', 'justify-center', (_clsx = {}, _clsx[tagColors[color]] = variant === 'normal', _clsx[tagLightColors[color]] = variant === 'light', _clsx['h-[14px] typography-label11regular'] = !isEditable && size === 'x-small', _clsx['h-4 typography-label12regular'] = !isEditable && size === 'small', _clsx['h-[18px] typography-label14regular'] = !isEditable && size === 'medium', _clsx['h-[22px] typography-label14regular'] = isEditable && size === 'medium', _clsx['rounded-full'] = isEditable, _clsx.rounded = !isEditable, _clsx['py-0.5 px-1'] = !isEditable, _clsx['py-1 px-2'] = isEditable, _clsx));
1649
- return /*#__PURE__*/jsxs("div", {
1650
- className: wrapperClasses,
1651
- children: [children, isEditable ? /*#__PURE__*/jsx(DeleteIcon, {
1652
- onClick: function onClick() {
1653
- return onDelete(id);
1654
- },
1655
- color: color,
1656
- variant: variant
1657
- }) : null]
1658
- });
1659
- }
1660
-
1661
- var _excluded$1 = ["size", "isResizable", "isError", "disabled"];
1662
- var TextArea = /*#__PURE__*/forwardRef(function (_ref, ref) {
1663
- var _clsx;
1664
- var _ref$size = _ref.size,
1665
- size = _ref$size === void 0 ? 'medium' : _ref$size,
1666
- _ref$isResizable = _ref.isResizable,
1667
- isResizable = _ref$isResizable === void 0 ? false : _ref$isResizable,
1668
- _ref$isError = _ref.isError,
1669
- isError = _ref$isError === void 0 ? false : _ref$isError,
1670
- _ref$disabled = _ref.disabled,
1671
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
1672
- props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
1673
- var classes = clsx('w-full rounded border outline-0 placeholder:text-textPlaceholder disabled:text-textPlaceholder', (_clsx = {
1674
- 'border-supportError': isError && !disabled,
1675
- 'hover:border-hoverInput': !disabled && !isError,
1676
- 'border-uiBorder02 hover:focus-within:border-activeInput focus-within:border-activeInput text-text01': !isError,
1677
- 'bg-disabled02 border-disabled01': disabled
1678
- }, _clsx['typography-body14regular px-2 pt-1.5 pb-2'] = size === 'medium', _clsx['text-4 leading-normal px-3.5 py-2.5'] = size === 'large', _clsx['text-supportError'] = isError, _clsx['resize-none'] = !isResizable, _clsx));
1679
- return /*#__PURE__*/jsx("div", {
1680
- className: "flex",
1681
- children: /*#__PURE__*/jsx("textarea", _extends({
1682
- ref: ref,
1683
- className: classes
1684
- }, props, {
1685
- disabled: disabled,
1686
- style: {
1687
- height: props.height
1688
- }
1689
- }))
1690
- });
1691
- });
1692
- TextArea.displayName = 'TextArea';
1693
-
1694
- var _excluded = ["size", "isError", "disabled", "onClickClearButton"];
1695
- var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
1696
- var _clsx;
1697
- var _ref$size = _ref.size,
1698
- size = _ref$size === void 0 ? 'medium' : _ref$size,
1699
- _ref$isError = _ref.isError,
1700
- isError = _ref$isError === void 0 ? false : _ref$isError,
1701
- _ref$disabled = _ref.disabled,
1702
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
1703
- onClickClearButton = _ref.onClickClearButton,
1704
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
1705
- var isShowClearButton = !!onClickClearButton && props.value.length !== 0 && !disabled;
1706
- var inputWrapClasses = clsx('relative flex items-center gap-2 overflow-hidden rounded border', {
1707
- 'border-uiBorder02': !isError && !disabled,
1708
- 'border-supportError': isError && !disabled,
1709
- 'hover:border-hoverInput': !disabled && !isError,
1710
- 'hover:focus-within:border-activeInput': !isError,
1711
- 'focus-within:border-activeInput': !isError,
1712
- 'bg-disabled02 border-disabled01': disabled,
1713
- 'pr-2': size === 'medium' && isShowClearButton,
1714
- 'pr-3': size === 'large' && isShowClearButton
1715
- });
1716
- var inputClasses = clsx('flex-1 outline-0 placeholder:text-textPlaceholder disabled:text-textPlaceholder', (_clsx = {}, _clsx['typography-label14regular min-h-8 px-2'] = size === 'medium', _clsx['typography-label16regular min-h-10 px-3'] = size === 'large', _clsx['text-text01'] = !isError, _clsx['text-supportError'] = isError, _clsx['pr-0'] = isShowClearButton, _clsx));
1717
- return /*#__PURE__*/jsxs("div", {
1718
- className: inputWrapClasses,
1719
- children: [/*#__PURE__*/jsx("input", _extends({
1720
- ref: ref,
1721
- size: 1,
1722
- className: inputClasses,
1723
- disabled: disabled,
1724
- onChange: props.onChange
1725
- }, props)), isShowClearButton && /*#__PURE__*/jsx(IconButton, {
1726
- variant: "text",
1727
- icon: "close",
1728
- size: "small",
1729
- onClick: onClickClearButton
1730
- })]
1731
- });
1732
- });
1733
- TextInput.displayName = 'TextInput';
1734
-
1735
- var CLOSE_TIME_MSEC = 5000;
1736
- function Toast(_ref) {
1737
- var _clsx;
1738
- var _ref$state = _ref.state,
1739
- state = _ref$state === void 0 ? 'information' : _ref$state,
1740
- _ref$width = _ref.width,
1741
- width = _ref$width === void 0 ? 'auto' : _ref$width,
1742
- _ref$isAutoClose = _ref.isAutoClose,
1743
- isAutoClose = _ref$isAutoClose === void 0 ? false : _ref$isAutoClose,
1744
- _ref$isAnimation = _ref.isAnimation,
1745
- isAnimation = _ref$isAnimation === void 0 ? false : _ref$isAnimation,
1746
- children = _ref.children,
1747
- onClickClose = _ref.onClickClose;
1748
- var _useState = useState(false),
1749
- isRemoving = _useState[0],
1750
- setIsRemoving = _useState[1];
1751
- var handleClose = useCallback(function () {
1752
- if (isAnimation) {
1753
- setIsRemoving(true);
1754
- } else {
1755
- onClickClose();
1756
- }
1757
- }, [isAnimation, onClickClose]);
1758
- var handleAnimationEnd = function handleAnimationEnd(e) {
1759
- return window.getComputedStyle(e.currentTarget).opacity === '0' && onClickClose();
1760
- };
1761
- var wrapperClasses = clsx$1('pointer-events-auto flex items-start gap-1 bg-white p-4 shadow-floatingShadow', (_clsx = {}, _clsx['animate-toast-in'] = isAnimation && !isRemoving, _clsx['animate-toast-out opacity-0'] = isAnimation && isRemoving, _clsx));
1762
- var iconClasses = clsx$1('flex items-center', {
1763
- 'fill-supportSuccess': state === 'success',
1764
- 'fill-supportError': state === 'error',
1765
- 'fill-supportWarning': state === 'warning',
1766
- 'fill-supportInfo': state === 'information'
1767
- });
1768
- var textClasses = clsx$1('typography-body13regular flex-1 pt-[3px]', {
1769
- 'text-supportError': state === 'error',
1770
- 'text-text01': state === 'success' || state === 'warning' || state === 'information'
1771
- });
1772
- var iconName = {
1773
- success: 'success-filled',
1774
- error: 'attention',
1775
- warning: 'warning',
1776
- information: 'information-filled'
1777
- };
1778
- useEffect(function () {
1779
- var timer = window.setTimeout(function () {
1780
- if (isAutoClose) {
1781
- setIsRemoving(true);
1782
- }
1783
- }, CLOSE_TIME_MSEC);
1784
- return function () {
1785
- return window.clearTimeout(timer);
1786
- };
1787
- }, [isAutoClose]);
1788
- return /*#__PURE__*/jsxs("div", {
1789
- className: wrapperClasses,
1790
- style: {
1791
- width: width
1792
- },
1793
- onAnimationEnd: handleAnimationEnd,
1794
- children: [/*#__PURE__*/jsx("div", {
1795
- className: iconClasses,
1796
- children: /*#__PURE__*/jsx(Icon, {
1797
- name: iconName[state]
1798
- })
1799
- }), /*#__PURE__*/jsx("p", {
1800
- className: textClasses,
1801
- children: children
1802
- }), /*#__PURE__*/jsx(IconButton, {
1803
- icon: "close",
1804
- size: "medium",
1805
- variant: "text",
1806
- onClick: handleClose,
1807
- isNoPadding: true
1808
- })]
1809
- });
1810
- }
1811
-
1812
- var ToastContext = /*#__PURE__*/createContext({});
1813
- var ToastProvider = function ToastProvider(_ref) {
1814
- var children = _ref.children;
1815
- var _useState = useState(false),
1816
- isClientRender = _useState[0],
1817
- setIsClientRender = _useState[1];
1818
- var _useState2 = useState([]),
1819
- toasts = _useState2[0],
1820
- setToasts = _useState2[1];
1821
- var addToast = useCallback(function (_ref2) {
1822
- var message = _ref2.message,
1823
- state = _ref2.state;
1824
- setToasts(function (prev) {
1825
- return [].concat(prev, [{
1826
- id: Math.trunc(Math.random() * 100000),
1827
- message: message,
1828
- state: state
1829
- }]);
1830
- });
1831
- }, []);
1832
- var removeToast = useCallback(function (id) {
1833
- setToasts(function (prev) {
1834
- return prev.filter(function (snackbar) {
1835
- return snackbar.id !== id;
1836
- });
1837
- });
1838
- }, []);
1839
- useEffect(function () {
1840
- setIsClientRender(true);
1841
- }, []);
1842
- return /*#__PURE__*/jsxs(ToastContext.Provider, {
1843
- value: {
1844
- addToast: addToast,
1845
- removeToast: removeToast
1846
- },
1847
- children: [children, isClientRender && /*#__PURE__*/createPortal(/*#__PURE__*/jsx("div", {
1848
- className: "pointer-events-none fixed bottom-0 left-0 z-toast mb-4 ml-4 flex w-full flex-col-reverse gap-[16px]",
1849
- children: toasts.map(function (_ref3) {
1850
- var id = _ref3.id,
1851
- message = _ref3.message,
1852
- state = _ref3.state;
1853
- return /*#__PURE__*/jsx(Toast, {
1854
- state: state,
1855
- isAutoClose: true,
1856
- isAnimation: true,
1857
- onClickClose: function onClickClose() {
1858
- return removeToast(id);
1859
- },
1860
- width: 475,
1861
- children: message
1862
- }, id);
1863
- })
1864
- }), document.body)]
1865
- });
1866
- };
1867
- var useToast = function useToast() {
1868
- return useContext(ToastContext);
1869
- };
1870
-
1871
- function Toggle(_ref) {
1872
- var id = _ref.id,
1873
- _ref$size = _ref.size,
1874
- size = _ref$size === void 0 ? 'medium' : _ref$size,
1875
- isChecked = _ref.isChecked,
1876
- onChange = _ref.onChange,
1877
- label = _ref.label,
1878
- _ref$labelPosition = _ref.labelPosition,
1879
- labelPosition = _ref$labelPosition === void 0 ? 'right' : _ref$labelPosition,
1880
- _ref$isDisabled = _ref.isDisabled,
1881
- isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled;
1882
- var baseClasses = clsx$1('relative flex items-center rounded-full', {
1883
- 'bg-disabledOn': isDisabled && isChecked,
1884
- 'bg-disabled01': isDisabled && !isChecked,
1885
- 'bg-interactive01 peer-hover:bg-hover01': !isDisabled && isChecked,
1886
- 'bg-interactive02 peer-hover:bg-hoverGray': !isDisabled && !isChecked,
1887
- 'w-8 h-4 px-[3px]': size === 'small',
1888
- 'w-12 h-6 px-1': size === 'medium' || size === 'large'
1889
- });
1890
- var inputClasses = clsx$1('peer absolute inset-0 z-[1] opacity-0', isDisabled ? 'cursor-not-allowed' : 'cursor-pointer');
1891
- var indicatorClasses = clsx$1('rounded-full bg-iconOnColor', {
1892
- 'w-2.5 h-2.5': size === 'small',
1893
- 'w-4 h-4': size === 'medium' || size === 'large',
1894
- 'ml-auto': isChecked
1895
- });
1896
- var labelClasses = clsx$1('break-all', {
1897
- 'mr-2': labelPosition === 'left',
1898
- 'ml-2': labelPosition === 'right',
1899
- 'typography-label14regular': size === 'small' || size === 'medium',
1900
- 'typography-label16regular': size === 'large',
1901
- 'pointer-events-none cursor-not-allowed text-disabled01': isDisabled,
1902
- 'cursor-pointer text-text01': !isDisabled
1903
- });
1904
- return /*#__PURE__*/jsxs("div", {
1905
- className: "relative flex flex-[0_0_auto] items-center",
1906
- children: [label != null && labelPosition === 'left' && /*#__PURE__*/jsx("label", {
1907
- htmlFor: id,
1908
- className: labelClasses,
1909
- children: label
1910
- }), /*#__PURE__*/jsx("input", {
1911
- className: inputClasses,
1912
- type: "checkbox",
1913
- name: id,
1914
- id: id,
1915
- checked: isChecked,
1916
- onChange: onChange,
1917
- disabled: isDisabled
1918
- }), /*#__PURE__*/jsx("div", {
1919
- className: baseClasses,
1920
- children: /*#__PURE__*/jsx("span", {
1921
- className: indicatorClasses
1922
- })
1923
- }), label != null && labelPosition === 'right' && /*#__PURE__*/jsx("label", {
1924
- htmlFor: id,
1925
- className: labelClasses,
1926
- children: label
1927
- })]
1928
- });
1929
- }
1930
-
1931
- var useTooltip = function useTooltip() {
1932
- var calculatePosition = useCallback(function (args) {
1933
- var _args$maxWidth;
1934
- var result = {
1935
- maxWidth: 'none',
1936
- width: 'auto',
1937
- left: '0px',
1938
- top: '0px',
1939
- bottom: '0px',
1940
- translateX: '0',
1941
- translateY: '0'
1942
- };
1943
- result.maxWidth = (_args$maxWidth = args.maxWidth) != null ? _args$maxWidth : 'none';
1944
- var offsetH = args.tooltipSize === 'small' ? 11 : 22;
1945
- var targetHorizontalCenter = args.dimensions.right - (args.dimensions.right - args.dimensions.left) / 2;
1946
- var targetLeft = args.dimensions.left;
1947
- var targetRight = args.dimensions.right;
1948
- var targetWidth = args.dimensions.width;
1949
- switch (args.horizontalAlign) {
1950
- case 'center':
1951
- result.left = targetHorizontalCenter + "px";
1952
- result.translateX = '-50%';
1953
- break;
1954
- case 'left':
1955
- result.left = targetLeft - offsetH + "px";
1956
- result.translateX = targetWidth / 2 + "px";
1957
- break;
1958
- case 'right':
1959
- result.left = targetRight + offsetH + "px";
1960
- result.translateX = "-" + targetWidth / 2 + "px";
1961
- break;
1962
- }
1963
- switch (args.verticalPosition) {
1964
- case 'bottom':
1965
- result.top = args.dimensions.top + args.dimensions.height + window.scrollY + "px";
1966
- result.bottom = 'unset';
1967
- break;
1968
- case 'top':
1969
- result.top = args.dimensions.top + window.scrollY + "px";
1970
- result.bottom = 'unset';
1971
- result.translateY = '-100%';
1972
- break;
1973
- }
1974
- return result;
1975
- }, []);
1976
- return {
1977
- calculatePosition: calculatePosition
1978
- };
1979
- };
1980
-
1981
- var TailIcon = function TailIcon(props) {
1982
- var tailClasses = clsx$1('absolute fill-uiBackgroundTooltip', {
1983
- 'rotate-180': props.verticalPosition === 'bottom',
1984
- 'rotate-0': props.verticalPosition !== 'bottom',
1985
- '-top-1': props.verticalPosition === 'bottom' && props.size === 'small',
1986
- '-top-2': props.verticalPosition === 'bottom' && props.size !== 'small',
1987
- '-bottom-1': props.verticalPosition !== 'bottom' && props.size === 'small',
1988
- '-bottom-2': props.verticalPosition !== 'bottom' && props.size !== 'small',
1989
- 'right-2': props.horizontalAlign === 'right' && props.size === 'small',
1990
- 'right-4': props.horizontalAlign === 'right' && props.size !== 'small',
1991
- 'left-2': props.horizontalAlign === 'left' && props.size === 'small',
1992
- 'left-4': props.horizontalAlign === 'left' && props.size !== 'small',
1993
- 'left-1/2 -translate-x-1': props.horizontalAlign === 'center' && props.size === 'small',
1994
- 'left-1/2 -translate-x-2': props.horizontalAlign === 'center' && props.size !== 'small'
1995
- });
1996
- if (props.size === 'small') {
1997
- return /*#__PURE__*/jsx("svg", {
1998
- className: tailClasses,
1999
- width: "8",
2000
- height: "4",
2001
- viewBox: "0 0 8 4",
2002
- xmlns: "http://www.w3.org/2000/svg",
2003
- children: /*#__PURE__*/jsx("path", {
2004
- d: "M4 4L0 0H8L4 4Z"
2005
- })
2006
- });
2007
- } else {
2008
- return /*#__PURE__*/jsx("svg", {
2009
- className: tailClasses,
2010
- width: "14",
2011
- height: "8",
2012
- viewBox: "0 0 14 8",
2013
- fill: "none",
2014
- xmlns: "http://www.w3.org/2000/svg",
2015
- children: /*#__PURE__*/jsx("path", {
2016
- d: "M7 8L0 0H14L7 8Z"
2017
- })
2018
- });
2019
- }
2020
- };
2021
-
2022
- var TooltipContent = function TooltipContent(_ref) {
2023
- var content = _ref.content,
2024
- horizontalAlign = _ref.horizontalAlign,
2025
- verticalPosition = _ref.verticalPosition,
2026
- size = _ref.size,
2027
- tooltipPosition = _ref.tooltipPosition,
2028
- maxWidth = _ref.maxWidth,
2029
- _ref$isPortal = _ref.isPortal,
2030
- isPortal = _ref$isPortal === void 0 ? false : _ref$isPortal;
2031
- var tooltipWrapperClasses = clsx$1('absolute z-tooltip m-auto flex', {
2032
- 'top-0': !isPortal && verticalPosition === 'top',
2033
- 'bottom-0': !isPortal && verticalPosition === 'bottom',
2034
- 'justify-start': horizontalAlign === 'left',
2035
- 'justify-center': horizontalAlign === 'center',
2036
- 'justify-end': horizontalAlign === 'right',
2037
- 'w-[24px]': size === 'small',
2038
- 'w-[46px]': size !== 'small'
2039
- });
2040
- var tooltipBodyClasses = clsx$1('absolute z-tooltip inline-block w-max rounded bg-uiBackgroundTooltip text-textOnColor', {
2041
- 'typography-body12regular': size === 'small',
2042
- 'typography-body13regular': size === 'medium',
2043
- 'px-2 pb-1 pt-1.5': size === 'small',
2044
- 'px-4 py-3': size === 'medium',
2045
- 'bottom-2': verticalPosition !== 'bottom' && size === 'small',
2046
- 'bottom-3': verticalPosition !== 'bottom' && size === 'medium',
2047
- 'top-2': verticalPosition === 'bottom' && size === 'small',
2048
- 'top-3': verticalPosition === 'bottom' && size === 'medium'
2049
- });
2050
- var tooltipWrapperStyle = isPortal ? _extends({
2051
- transform: "translate(" + tooltipPosition.translateX + ", " + tooltipPosition.translateY + ")"
2052
- }, tooltipPosition) : {};
2053
- return /*#__PURE__*/jsx("div", {
2054
- className: tooltipWrapperClasses,
2055
- style: tooltipWrapperStyle,
2056
- children: /*#__PURE__*/jsxs("div", {
2057
- className: tooltipBodyClasses,
2058
- style: {
2059
- maxWidth: maxWidth
2060
- },
2061
- children: [content, /*#__PURE__*/jsx(TailIcon, {
2062
- size: size,
2063
- verticalPosition: verticalPosition,
2064
- horizontalAlign: horizontalAlign
2065
- })]
2066
- })
2067
- });
2068
- };
2069
-
2070
- function Tooltip(_ref) {
2071
- var children = _ref.children,
2072
- content = _ref.content,
2073
- _ref$size = _ref.size,
2074
- size = _ref$size === void 0 ? 'small' : _ref$size,
2075
- maxWidth = _ref.maxWidth,
2076
- _ref$verticalPosition = _ref.verticalPosition,
2077
- verticalPosition = _ref$verticalPosition === void 0 ? 'bottom' : _ref$verticalPosition,
2078
- _ref$horizontalAlign = _ref.horizontalAlign,
2079
- horizontalAlign = _ref$horizontalAlign === void 0 ? 'center' : _ref$horizontalAlign,
2080
- _ref$isDisabledHover = _ref.isDisabledHover,
2081
- isDisabledHover = _ref$isDisabledHover === void 0 ? false : _ref$isDisabledHover,
2082
- portalTarget = _ref.portalTarget;
2083
- var _useTooltip = useTooltip(),
2084
- calculatePosition = _useTooltip.calculatePosition;
2085
- var _useState = useState(false),
2086
- isVisible = _useState[0],
2087
- setIsVisible = _useState[1];
2088
- var _useState2 = useState({
2089
- maxWidth: 'none',
2090
- width: 'auto',
2091
- left: '0px',
2092
- top: '0px',
2093
- bottom: '0px',
2094
- translateX: '0',
2095
- translateY: '0'
2096
- }),
2097
- tooltipPosition = _useState2[0],
2098
- setTooltipPosition = _useState2[1];
2099
- var targetRef = useRef(null);
2100
- var handleMouseOverWrapper = useCallback(function () {
2101
- if (isDisabledHover) {
2102
- return;
2103
- }
2104
- setIsVisible(true);
2105
- }, [isDisabledHover]);
2106
- var handleMouseOutWrapper = useCallback(function () {
2107
- setIsVisible(false);
2108
- }, []);
2109
- useEffect(function () {
2110
- var _targetRef$current;
2111
- if (targetRef.current === null) return;
2112
- var dimensions = (_targetRef$current = targetRef.current) == null ? void 0 : _targetRef$current.getBoundingClientRect();
2113
- var position = calculatePosition({
2114
- dimensions: dimensions,
2115
- maxWidth: maxWidth,
2116
- verticalPosition: verticalPosition,
2117
- horizontalAlign: horizontalAlign,
2118
- tooltipSize: size
2119
- });
2120
- setTooltipPosition(position);
2121
- }, [calculatePosition, horizontalAlign, maxWidth, size, verticalPosition]);
2122
- return /*#__PURE__*/jsxs("div", {
2123
- ref: targetRef,
2124
- className: "relative flex items-center justify-center",
2125
- onMouseOver: handleMouseOverWrapper,
2126
- onMouseLeave: handleMouseOutWrapper,
2127
- children: [children, isVisible && (portalTarget == null ? /*#__PURE__*/jsx(TooltipContent, {
2128
- content: content,
2129
- size: size,
2130
- maxWidth: maxWidth,
2131
- verticalPosition: verticalPosition,
2132
- horizontalAlign: horizontalAlign,
2133
- tooltipPosition: tooltipPosition
2134
- }) : (/*#__PURE__*/createPortal(/*#__PURE__*/jsx(TooltipContent, {
2135
- isPortal: true,
2136
- content: content,
2137
- size: size,
2138
- maxWidth: maxWidth,
2139
- verticalPosition: verticalPosition,
2140
- horizontalAlign: horizontalAlign,
2141
- tooltipPosition: tooltipPosition
2142
- }), portalTarget)))]
2143
- });
2144
- }
2145
-
2146
- export { Avatar, Breadcrumb, Button, Checkbox, Dropdown, EvaluationStar, Heading, Icon, IconButton, Loading, Modal, NotificationInline, Pagination, PaginationSelect, Radio, Search, Select, SelectSort, Tab, TabItem, Table, TableCell, TableRow, Tag, TextArea, TextInput, Toast, ToastProvider, Toggle, Tooltip, useOutsideClick, useToast };
2147
- //# sourceMappingURL=index.esm.js.map