@charcoal-ui/react-sandbox 2.5.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/_lib/compat.d.ts +14 -14
  2. package/dist/components/Carousel/index.d.ts +39 -39
  3. package/dist/components/Carousel/index.d.ts.map +1 -1
  4. package/dist/components/Carousel/index.story.d.ts +6 -6
  5. package/dist/components/CarouselButton/index.d.ts +20 -20
  6. package/dist/components/CarouselButton/index.story.d.ts +9 -9
  7. package/dist/components/Filter/index.d.ts +19 -19
  8. package/dist/components/Filter/index.story.d.ts +8 -8
  9. package/dist/components/HintText/index.d.ts +9 -9
  10. package/dist/components/HintText/index.d.ts.map +1 -1
  11. package/dist/components/HintText/index.story.d.ts +11 -11
  12. package/dist/components/Layout/index.d.ts +67 -67
  13. package/dist/components/Layout/index.story.d.ts +13 -13
  14. package/dist/components/LeftMenu/index.d.ts +11 -11
  15. package/dist/components/MenuListItem/index.d.ts +34 -34
  16. package/dist/components/MenuListItem/index.story.d.ts +17 -17
  17. package/dist/components/Pager/index.d.ts +14 -14
  18. package/dist/components/Pager/index.story.d.ts +31 -31
  19. package/dist/components/SwitchCheckbox/index.d.ts +8 -8
  20. package/dist/components/SwitchCheckbox/index.story.d.ts +10 -10
  21. package/dist/components/TextEllipsis/helper.d.ts +3 -3
  22. package/dist/components/TextEllipsis/index.d.ts +10 -10
  23. package/dist/components/TextEllipsis/index.story.d.ts +8 -8
  24. package/dist/components/WithIcon/index.d.ts +27 -27
  25. package/dist/components/WithIcon/index.story.d.ts +14 -14
  26. package/dist/components/icons/Base.d.ts +15 -15
  27. package/dist/components/icons/Base.d.ts.map +1 -1
  28. package/dist/components/icons/DotsIcon.d.ts +11 -11
  29. package/dist/components/icons/InfoIcon.d.ts +1 -1
  30. package/dist/components/icons/NextIcon.d.ts +11 -11
  31. package/dist/components/icons/WedgeIcon.d.ts +19 -19
  32. package/dist/foundation/contants.d.ts +3 -3
  33. package/dist/foundation/hooks.d.ts +28 -28
  34. package/dist/foundation/support.d.ts +2 -2
  35. package/dist/foundation/utils.d.ts +22 -22
  36. package/dist/hooks/index.d.ts +2 -2
  37. package/dist/index.cjs.js +1871 -0
  38. package/dist/index.cjs.js.map +1 -0
  39. package/dist/index.d.ts +13 -13
  40. package/dist/index.esm.js +1816 -0
  41. package/dist/index.esm.js.map +1 -0
  42. package/dist/misc/storybook-helper.d.ts +2 -2
  43. package/dist/styled.d.ts +94 -94
  44. package/package.json +18 -18
  45. package/dist/index.cjs +0 -1816
  46. package/dist/index.cjs.map +0 -1
  47. package/dist/index.modern.js +0 -2275
  48. package/dist/index.modern.js.map +0 -1
  49. package/dist/index.module.js +0 -1768
  50. package/dist/index.module.js.map +0 -1
@@ -0,0 +1,1871 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+
26
+ // src/index.ts
27
+ var src_exports = {};
28
+ __export(src_exports, {
29
+ CancelLayoutItemBodyPadding: () => CancelLayoutItemBodyPadding,
30
+ Carousel: () => Carousel,
31
+ ComponentAbstraction: () => import_react23.ComponentAbstraction,
32
+ Filter: () => Filter_default,
33
+ FilterButton: () => FilterButton,
34
+ FilterIconButton: () => FilterIconButton,
35
+ FilterLink: () => FilterLink,
36
+ HintText: () => HintText,
37
+ LAYOUT_ITEM_BODY_PADDING: () => LAYOUT_ITEM_BODY_PADDING,
38
+ Layout: () => Layout,
39
+ LayoutItem: () => LayoutItem,
40
+ LayoutItemBody: () => LayoutItemBody,
41
+ LayoutItemHeader: () => LayoutItemHeader,
42
+ LeftMenu: () => LeftMenu,
43
+ LeftMenuContent: () => LeftMenuContent,
44
+ LinkPager: () => LinkPager,
45
+ MAIN_COLUMN_HORIZONTAL_MIN_MARGIN: () => MAIN_COLUMN_HORIZONTAL_MIN_MARGIN,
46
+ MenuListItem: () => MenuListItem,
47
+ MenuListItemContext: () => MenuListItemContext,
48
+ MenuListItemWithIcon: () => MenuListItemWithIcon,
49
+ MenuListLabel: () => MenuListLabel,
50
+ MenuListLinkItem: () => MenuListLinkItem,
51
+ MenuListLinkItemWithIcon: () => MenuListLinkItemWithIcon,
52
+ MenuListSpacer: () => MenuListSpacer,
53
+ Pager: () => Pager_default,
54
+ RESPONSIVE_LEFT_WIDTH: () => RESPONSIVE_LEFT_WIDTH,
55
+ RESPONSIVE_MAIN_MAX_WIDTH: () => RESPONSIVE_MAIN_MAX_WIDTH,
56
+ StyledCancelLayoutItemBodyPadding: () => StyledCancelLayoutItemBodyPadding,
57
+ StyledLayoutItemBody: () => StyledLayoutItemBody,
58
+ SwitchCheckbox: () => SwitchCheckbox_default,
59
+ TextEllipsis: () => TextEllipsis,
60
+ WithIcon: () => WithIcon_default,
61
+ useComponentAbstraction: () => import_react23.useComponentAbstraction,
62
+ useElementSize: () => useElementSize,
63
+ useLayoutItemBodyPadding: () => useLayoutItemBodyPadding,
64
+ useMedia: () => useMedia,
65
+ useMediaScreen1: () => useMediaScreen1
66
+ });
67
+ module.exports = __toCommonJS(src_exports);
68
+
69
+ // src/components/Filter/index.tsx
70
+ var import_react = __toESM(require("react"));
71
+ var import_styled_components = __toESM(require("styled-components"));
72
+ var import_react2 = require("@charcoal-ui/react");
73
+ var import_utils = require("@charcoal-ui/utils");
74
+ var FilterButton = import_react.default.forwardRef(function FilterButton2({
75
+ onClick,
76
+ children,
77
+ active = false,
78
+ hover,
79
+ reactive = false
80
+ }, ref) {
81
+ return /* @__PURE__ */ import_react.default.createElement(
82
+ ButtonLike,
83
+ {
84
+ active,
85
+ reactive,
86
+ hover,
87
+ onClick: active && !reactive ? void 0 : onClick,
88
+ ref
89
+ },
90
+ children
91
+ );
92
+ });
93
+ var FilterIconButton = import_react.default.forwardRef(function FilterIconButton2({
94
+ onClick,
95
+ children,
96
+ active = false,
97
+ hover,
98
+ reactive = false,
99
+ width,
100
+ height
101
+ }, ref) {
102
+ return /* @__PURE__ */ import_react.default.createElement(
103
+ StyledButtonLike,
104
+ {
105
+ active,
106
+ reactive,
107
+ hover,
108
+ onClick: active && !reactive ? void 0 : onClick,
109
+ ref,
110
+ buttonWidth: width,
111
+ buttonHeight: height
112
+ },
113
+ children
114
+ );
115
+ });
116
+ var FilterLink = import_react.default.forwardRef(function FilterLink2({
117
+ onClick,
118
+ children,
119
+ active = false,
120
+ hover,
121
+ reactive = false,
122
+ ...props
123
+ }, ref) {
124
+ const { Link } = (0, import_react2.useComponentAbstraction)();
125
+ if (active && !reactive) {
126
+ return /* @__PURE__ */ import_react.default.createElement(PlainElement, { active: true, hover, ref }, children);
127
+ } else {
128
+ return /* @__PURE__ */ import_react.default.createElement(Link, { ...props, onClick }, /* @__PURE__ */ import_react.default.createElement(
129
+ PlainElement,
130
+ {
131
+ active,
132
+ reactive,
133
+ hover,
134
+ ref
135
+ },
136
+ children
137
+ ));
138
+ }
139
+ });
140
+ var buttonCss = import_styled_components.css`
141
+ display: block;
142
+ outline: none;
143
+ border: none;
144
+ padding: 9px 24px;
145
+ font-size: 14px;
146
+ line-height: 22px;
147
+ font-weight: bold;
148
+ border-radius: /* absurd radius, but ensures rounded corners */ 2000px;
149
+ transition: color 0.2s;
150
+ color: ${({ theme: theme2 }) => theme2.color.text3};
151
+ cursor: pointer;
152
+ user-select: none;
153
+ background-color: transparent;
154
+
155
+ &:hover {
156
+ color: ${({ theme: theme2 }) => theme2.color.text2};
157
+ }
158
+
159
+ ${({ hover = false }) => hover && import_styled_components.css`
160
+ color: ${({ theme: theme2 }) => theme2.color.text2};
161
+ `}
162
+
163
+ ${({ active = false }) => active && import_styled_components.css`
164
+ background-color: ${({ theme: theme2 }) => theme2.color.surface3};
165
+ color: ${({ theme: theme2 }) => theme2.color.text2};
166
+ `}
167
+
168
+ ${({ active = false, reactive = false }) => active && !reactive && import_styled_components.css`
169
+ cursor: default;
170
+ `}
171
+
172
+ @media ${({ theme: theme2 }) => (0, import_utils.maxWidth)(theme2.breakpoint.screen1)} {
173
+ padding: 5px 16px;
174
+ }
175
+ `;
176
+ var padding0Css = import_styled_components.css`
177
+ padding: 0;
178
+
179
+ @media ${({ theme: theme2 }) => (0, import_utils.maxWidth)(theme2.breakpoint.screen1)} {
180
+ padding: 0;
181
+ }
182
+ `;
183
+ var ButtonLike = import_styled_components.default.button`
184
+ ${buttonCss}
185
+ `;
186
+ var PlainElement = import_styled_components.default.span`
187
+ ${buttonCss}
188
+ `;
189
+ var StyledButtonLike = (0, import_styled_components.default)(ButtonLike)`
190
+ ${padding0Css};
191
+ ${(p) => p.buttonWidth !== void 0 && `width: ${p.buttonWidth}px;`}
192
+ ${(p) => p.buttonHeight !== void 0 && `height: ${p.buttonHeight}px;`}
193
+ `;
194
+ var Filter = import_styled_components.default.div`
195
+ display: flex;
196
+ `;
197
+ var Filter_default = Filter;
198
+
199
+ // src/components/HintText/index.tsx
200
+ var import_react5 = __toESM(require("react"));
201
+ var import_styled_components5 = __toESM(require("styled-components"));
202
+
203
+ // src/styled.ts
204
+ var import_styled_components2 = __toESM(require("styled-components"));
205
+ var import_styled = require("@charcoal-ui/styled");
206
+ var theme = (0, import_styled.createTheme)(import_styled_components2.default);
207
+
208
+ // src/components/icons/InfoIcon.tsx
209
+ var import_react4 = __toESM(require("react"));
210
+ var import_styled_components4 = __toESM(require("styled-components"));
211
+
212
+ // src/components/icons/Base.tsx
213
+ var import_react3 = __toESM(require("react"));
214
+ var import_styled_components3 = __toESM(require("styled-components"));
215
+ function IconBase({
216
+ size: size3 = 24,
217
+ viewBoxSize,
218
+ currentColor,
219
+ path: path2,
220
+ transform,
221
+ fillRule,
222
+ clipRule
223
+ }) {
224
+ return /* @__PURE__ */ import_react3.default.createElement(
225
+ Icon,
226
+ {
227
+ viewBox: `0 0 ${viewBoxSize} ${viewBoxSize}`,
228
+ size: size3,
229
+ currentColor
230
+ },
231
+ /* @__PURE__ */ import_react3.default.createElement(
232
+ IconBasePath,
233
+ {
234
+ path: path2,
235
+ transform,
236
+ fillRule,
237
+ clipRule
238
+ }
239
+ )
240
+ );
241
+ }
242
+ var Icon = import_styled_components3.default.svg`
243
+ stroke: none;
244
+ fill: ${({ currentColor = false, theme: theme2 }) => currentColor ? "currentColor" : theme2.color.text2};
245
+ width: ${(props) => props.size}px;
246
+ height: ${(props) => props.size}px;
247
+ line-height: 0;
248
+ font-size: 0;
249
+ vertical-align: middle;
250
+ `;
251
+ var IconBasePath = ({
252
+ path: path2,
253
+ transform,
254
+ fillRule,
255
+ clipRule
256
+ }) => {
257
+ if (typeof path2 === "string") {
258
+ return /* @__PURE__ */ import_react3.default.createElement(
259
+ "path",
260
+ {
261
+ d: path2,
262
+ transform,
263
+ fillRule,
264
+ clipRule
265
+ }
266
+ );
267
+ } else {
268
+ return /* @__PURE__ */ import_react3.default.createElement(import_react3.default.Fragment, null, path2);
269
+ }
270
+ };
271
+
272
+ // src/components/icons/InfoIcon.tsx
273
+ var size = 16;
274
+ function InfoIcon() {
275
+ const path2 = /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, /* @__PURE__ */ import_react4.default.createElement(
276
+ "path",
277
+ {
278
+ d: "M8 16C3.58172 16 0 12.4183 0 8C0 3.58172 3.58172 0 8 0C12.4183\n 0 16 3.58172 16 8C16 12.4183 12.4183 16 8 16Z"
279
+ }
280
+ ), /* @__PURE__ */ import_react4.default.createElement(
281
+ Path,
282
+ {
283
+ d: "M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629\n 4.68629 2 8 2C11.3137 2 14 4.68629 14 8ZM8 6.25C8.69036 6.25 9.25 5.69036\n 9.25 5C9.25 4.30964 8.69036 3.75 8 3.75C7.30964 3.75 6.75 4.30964 6.75\n 5C6.75 5.69036 7.30964 6.25 8 6.25ZM7 7.75V11.25C7 11.8023 7.44772 12.25\n 8 12.25C8.55228 12.25 9 11.8023 9 11.25V7.75C9 7.19772 8.55228 6.75 8\n 6.75C7.44772 6.75 7 7.19772 7 7.75Z"
284
+ }
285
+ ));
286
+ return /* @__PURE__ */ import_react4.default.createElement(IconBase, { viewBoxSize: size, size, currentColor: true, path: path2 });
287
+ }
288
+ var Path = import_styled_components4.default.path`
289
+ fill: ${({ theme: theme2 }) => theme2.color.surface1};
290
+ fill-rule: evenodd;
291
+ `;
292
+
293
+ // src/components/HintText/index.tsx
294
+ var import_utils2 = require("@charcoal-ui/utils");
295
+ function HintText({ children, context, className }) {
296
+ return /* @__PURE__ */ import_react5.default.createElement(Container, { className, context }, /* @__PURE__ */ import_react5.default.createElement(IconWrap, null, /* @__PURE__ */ import_react5.default.createElement(InfoIcon, null)), /* @__PURE__ */ import_react5.default.createElement(Text, null, children));
297
+ }
298
+ var Container = import_styled_components5.default.div.attrs(
299
+ styledProps
300
+ )`
301
+ ${(p) => theme((o) => [
302
+ o.bg.surface3,
303
+ o.borderRadius(8),
304
+ o.padding.vertical(p.default.vertical),
305
+ o.padding.horizontal(p.default.horizontal)
306
+ ])}
307
+
308
+ @media ${({ theme: t }) => (0, import_utils2.maxWidth)(t.breakpoint.screen1)} {
309
+ ${(p) => theme((o) => [
310
+ o.padding.vertical(p.screen1.vertical),
311
+ o.padding.horizontal(p.screen1.horizontal)
312
+ ])}
313
+ }
314
+
315
+ display: flex;
316
+ align-items: flex-start;
317
+ ${(p) => p.context === "page" && import_styled_components5.css`
318
+ justify-content: center;
319
+ `}
320
+ `;
321
+ var IconWrap = import_styled_components5.default.div`
322
+ display: flex;
323
+ align-items: center;
324
+ color: ${(p) => p.theme.color.text4};
325
+ height: 22px;
326
+ margin: -4px 4px -4px 0;
327
+ `;
328
+ var Text = import_styled_components5.default.p`
329
+ ${theme((o) => [o.font.text2, o.typography(14)])}
330
+ margin: 0;
331
+ `;
332
+ function styledProps(props) {
333
+ return { ...props, ...contextToProps(props.context) };
334
+ }
335
+ function contextToProps(context) {
336
+ switch (context) {
337
+ case "page":
338
+ return {
339
+ default: {
340
+ horizontal: 40,
341
+ vertical: 24
342
+ },
343
+ screen1: {
344
+ horizontal: 16,
345
+ vertical: 16
346
+ }
347
+ };
348
+ case "section":
349
+ return {
350
+ default: {
351
+ horizontal: 16,
352
+ vertical: 16
353
+ },
354
+ screen1: {
355
+ horizontal: 16,
356
+ vertical: 16
357
+ }
358
+ };
359
+ }
360
+ }
361
+
362
+ // src/components/Layout/index.tsx
363
+ var import_react7 = __toESM(require("react"));
364
+ var import_styled_components7 = __toESM(require("styled-components"));
365
+
366
+ // src/foundation/contants.ts
367
+ var import_foundation = require("@charcoal-ui/foundation");
368
+ var MAIN_COLUMN_HORIZONTAL_MIN_MARGIN = 72;
369
+ var RESPONSIVE_LEFT_WIDTH = (0, import_foundation.columnSystem)(2, import_foundation.COLUMN_UNIT, import_foundation.GUTTER_UNIT) + import_foundation.GUTTER_UNIT;
370
+ var RESPONSIVE_MAIN_MAX_WIDTH = (0, import_foundation.columnSystem)(
371
+ 12,
372
+ import_foundation.COLUMN_UNIT,
373
+ import_foundation.GUTTER_UNIT
374
+ );
375
+
376
+ // src/foundation/hooks.ts
377
+ var import_react6 = require("react");
378
+ var import_react_dom = __toESM(require("react-dom"));
379
+ var import_styled_components6 = require("styled-components");
380
+ var import_utils3 = require("@charcoal-ui/utils");
381
+ function useMediaScreen1() {
382
+ return useMedia((0, import_utils3.maxWidth)((0, import_styled_components6.useTheme)().breakpoint.screen1));
383
+ }
384
+ function useMedia(query) {
385
+ const matcher = (0, import_react6.useMemo)(
386
+ () => __TEST__ ? {
387
+ matches: false,
388
+ addListener: () => {
389
+ },
390
+ removeListener: () => {
391
+ }
392
+ } : matchMedia(query),
393
+ [query]
394
+ );
395
+ const [matches, setMatches] = (0, import_react6.useState)(matcher.matches);
396
+ if (matcher.matches !== matches) {
397
+ setMatches(matcher.matches);
398
+ }
399
+ const callback = (e) => {
400
+ try {
401
+ import_react_dom.default.flushSync(() => {
402
+ setMatches(e.matches);
403
+ });
404
+ } catch {
405
+ setMatches(e.matches);
406
+ }
407
+ };
408
+ (0, import_react6.useLayoutEffect)(() => {
409
+ matcher.addListener(callback);
410
+ setMatches(matcher.matches);
411
+ return () => {
412
+ matcher.removeListener(callback);
413
+ };
414
+ }, [matcher]);
415
+ (0, import_react6.useDebugValue)(`${query}: ${matches.toString()}`);
416
+ return matches;
417
+ }
418
+ function measure(ref) {
419
+ return ref !== null ? ref.getBoundingClientRect() : void 0;
420
+ }
421
+ function useElementSize(ref, deps = []) {
422
+ const [size3, setSize] = (0, import_react6.useReducer)(
423
+ (state, next) => {
424
+ if (state === void 0 || next === void 0) {
425
+ return next;
426
+ }
427
+ if (state.height === next.height && state.width === next.width) {
428
+ return state;
429
+ }
430
+ return next;
431
+ },
432
+ void 0
433
+ );
434
+ const [watch, setWatch] = (0, import_react6.useState)(null);
435
+ (0, import_react6.useLayoutEffect)(() => {
436
+ if (watch === null) {
437
+ return;
438
+ }
439
+ const observer = new ResizeObserver(() => {
440
+ const newSize = measure(watch);
441
+ setSize(newSize);
442
+ });
443
+ observer.observe(watch);
444
+ return () => {
445
+ observer.unobserve(watch);
446
+ setSize(void 0);
447
+ };
448
+ }, [watch]);
449
+ (0, import_react6.useLayoutEffect)(() => {
450
+ if (ref.current !== watch) {
451
+ setWatch(ref.current);
452
+ }
453
+ });
454
+ (0, import_react6.useLayoutEffect)(() => {
455
+ if (deps.length > 0) {
456
+ setSize(measure(ref.current));
457
+ }
458
+ }, deps);
459
+ (0, import_react6.useDebugValue)(size3);
460
+ return size3;
461
+ }
462
+ function useDebounceAnimationState(defaultValue) {
463
+ const [state, setState] = (0, import_react6.useState)(defaultValue);
464
+ const timer = (0, import_react6.useRef)();
465
+ const setDebounceState = (0, import_react6.useCallback)((value, force = false) => {
466
+ if (force) {
467
+ setState(value);
468
+ return;
469
+ }
470
+ if (timer.current !== void 0) {
471
+ return;
472
+ }
473
+ timer.current = requestAnimationFrame(() => {
474
+ setState(value);
475
+ if (timer.current !== void 0) {
476
+ timer.current = void 0;
477
+ }
478
+ });
479
+ }, []);
480
+ return [state, setDebounceState];
481
+ }
482
+
483
+ // src/components/Layout/index.tsx
484
+ var import_foundation2 = require("@charcoal-ui/foundation");
485
+ var import_utils4 = require("@charcoal-ui/utils");
486
+ var LayoutConfigContext = import_react7.default.createContext({
487
+ wide: false,
488
+ center: false,
489
+ withLeft: false
490
+ });
491
+ function Layout({
492
+ menu,
493
+ children,
494
+ header,
495
+ center = false,
496
+ wide,
497
+ isHeaderTopMenu = false
498
+ }) {
499
+ const config = {
500
+ center,
501
+ wide: center ? true : wide ?? false,
502
+ withLeft: menu != null && !isHeaderTopMenu
503
+ };
504
+ return /* @__PURE__ */ import_react7.default.createElement(LayoutRoot, null, /* @__PURE__ */ import_react7.default.createElement(LayoutConfigContext.Provider, { value: config }, config.withLeft && /* @__PURE__ */ import_react7.default.createElement(LeftArea, null, menu), /* @__PURE__ */ import_react7.default.createElement(MainArea, { center }, header != null && /* @__PURE__ */ import_react7.default.createElement(Header, null, header), isHeaderTopMenu && /* @__PURE__ */ import_react7.default.createElement(HeaderTopMenuContainer, null, menu), /* @__PURE__ */ import_react7.default.createElement(Grid, null, children))), /* @__PURE__ */ import_react7.default.createElement(GlobalStyle, null));
505
+ }
506
+ var HeaderTopMenuContainer = import_styled_components7.default.div`
507
+ margin-bottom: 40px;
508
+ overflow-x: auto;
509
+ word-break: keep-all;
510
+
511
+ @media ${({ theme: theme2 }) => (0, import_utils4.maxWidth)(theme2.breakpoint.screen1)} {
512
+ margin-bottom: 0;
513
+ padding-left: 16px;
514
+ padding-bottom: 16px;
515
+ background-color: ${({ theme: theme2 }) => theme2.color.surface2};
516
+ }
517
+ `;
518
+ var GlobalStyle = import_styled_components7.createGlobalStyle`
519
+ :root {
520
+ background-color: ${({ theme: theme2 }) => theme2.color.background2};
521
+
522
+ @media ${({ theme: theme2 }) => (0, import_utils4.maxWidth)(theme2.breakpoint.screen1)} {
523
+ background-color: ${({ theme: theme2 }) => theme2.color.background1};
524
+ }
525
+ }
526
+ `;
527
+ var LayoutRoot = import_styled_components7.default.div`
528
+ display: flex;
529
+ background-color: ${({ theme: theme2 }) => theme2.color.background2};
530
+
531
+ @media ${({ theme: theme2 }) => (0, import_utils4.maxWidth)(theme2.breakpoint.screen1)} {
532
+ background-color: ${({ theme: theme2 }) => theme2.color.background1};
533
+ }
534
+ `;
535
+ var LeftArea = import_styled_components7.default.div`
536
+ min-width: ${RESPONSIVE_LEFT_WIDTH}px;
537
+ padding: 40px 0 40px ${import_foundation2.GUTTER_UNIT}px;
538
+ box-sizing: border-box;
539
+
540
+ @media ${({ theme: theme2 }) => theme2.breakpoint.screen3} {
541
+ display: none;
542
+ }
543
+ `;
544
+ var MainArea = import_styled_components7.default.div`
545
+ flex-grow: 1;
546
+ /* https://www.w3.org/TR/css-flexbox-1/#min-size-auto */
547
+ min-width: 0;
548
+ max-width: ${(p) => p.center ? (0, import_foundation2.columnSystem)(6, import_foundation2.COLUMN_UNIT, import_foundation2.GUTTER_UNIT) : RESPONSIVE_MAIN_MAX_WIDTH}px;
549
+ padding: 40px ${MAIN_COLUMN_HORIZONTAL_MIN_MARGIN}px;
550
+ margin: 0 auto;
551
+ display: flex;
552
+ flex-direction: column;
553
+
554
+ @media ${({ theme: theme2 }) => (0, import_utils4.maxWidth)(theme2.breakpoint.screen1)} {
555
+ padding: 0;
556
+ }
557
+ `;
558
+ var Header = import_styled_components7.default.div`
559
+ font-weight: bold;
560
+ margin-bottom: 12px;
561
+ font-size: 20px;
562
+ line-height: 28px;
563
+ color: ${({ theme: theme2 }) => theme2.color.text2};
564
+
565
+ @media ${({ theme: theme2 }) => (0, import_utils4.maxWidth)(theme2.breakpoint.screen1)} {
566
+ margin-bottom: 0;
567
+ padding: 12px;
568
+ font-size: 16px;
569
+ line-height: 24px;
570
+ display: flex;
571
+ justify-content: center;
572
+ background-color: ${({ theme: theme2 }) => theme2.color.surface2};
573
+ }
574
+ `;
575
+ var Grid = import_styled_components7.default.div`
576
+ display: grid;
577
+ gap: ${import_foundation2.GUTTER_UNIT}px;
578
+ grid-template-columns: 1fr;
579
+ grid-auto-columns: 1fr;
580
+ grid-auto-rows: auto;
581
+
582
+ @media ${({ theme: theme2 }) => (0, import_utils4.maxWidth)(theme2.breakpoint.screen1)} {
583
+ gap: 0;
584
+ background-color: ${({ theme: theme2 }) => theme2.color.background1};
585
+ padding-bottom: 60px;
586
+ }
587
+ `;
588
+ var LayoutItem = import_react7.default.forwardRef(
589
+ function LayoutItem2({ span, children }, ref) {
590
+ const { withLeft } = (0, import_react7.useContext)(LayoutConfigContext);
591
+ return /* @__PURE__ */ import_react7.default.createElement(StyledLayoutItem, { span, withLeft, ref }, children);
592
+ }
593
+ );
594
+ var StyledLayoutItem = import_styled_components7.default.div`
595
+ grid-column-start: auto;
596
+ grid-column-end: span ${(p) => p.span};
597
+ border-radius: 24px;
598
+ color: ${({ theme: theme2 }) => theme2.color.text2};
599
+ background-color: ${({ theme: theme2 }) => theme2.color.background1};
600
+ /* https://www.w3.org/TR/css-grid-1/#min-size-auto */
601
+ min-width: 0;
602
+
603
+ @media ${(p) => p.withLeft ? p.theme.breakpoint.screen4 : p.theme.breakpoint.screen3} {
604
+ ${(p) => p.span > 2 && import_styled_components7.css`
605
+ grid-column-end: span 2;
606
+ `}
607
+ }
608
+
609
+ @media ${({ theme: theme2 }) => (0, import_utils4.maxWidth)(theme2.breakpoint.screen1)} {
610
+ ${(p) => p.span > 1 && import_styled_components7.css`
611
+ grid-column-end: span 1;
612
+ `}
613
+
614
+ border-radius: 0;
615
+ padding-bottom: 40px;
616
+ }
617
+ `;
618
+ function LayoutItemHeader({ children }) {
619
+ const { wide, center } = (0, import_react7.useContext)(LayoutConfigContext);
620
+ return /* @__PURE__ */ import_react7.default.createElement(StyledLayoutItemHeader, { wide, center }, children);
621
+ }
622
+ var StyledLayoutItemHeader = import_styled_components7.default.div`
623
+ padding: 0 ${(p) => p.wide ? 40 : 24}px;
624
+ height: ${(p) => p.wide ? 64 : 48}px;
625
+ display: grid;
626
+ align-items: center;
627
+ font-size: 16px;
628
+ line-height: 24px;
629
+ font-weight: bold;
630
+ background-color: ${({ theme: theme2 }) => theme2.color.surface2};
631
+ color: ${({ theme: theme2 }) => theme2.color.text2};
632
+ border-radius: 24px 24px 0 0;
633
+ ${(p) => p.center && import_styled_components7.css`
634
+ justify-content: center;
635
+ `}
636
+
637
+ @media ${({ theme: theme2 }) => (0, import_utils4.maxWidth)(theme2.breakpoint.screen1)} {
638
+ margin-top: 4px;
639
+ padding: 0 16px;
640
+ background: none;
641
+ overflow-x: auto;
642
+ border-radius: unset;
643
+ ${(p) => p.wide && import_styled_components7.css`
644
+ height: 48px;
645
+ margin-top: 0;
646
+ `}
647
+ }
648
+ `;
649
+ var LAYOUT_ITEM_BODY_PADDING = {
650
+ wide: {
651
+ x: 40,
652
+ y: 40
653
+ },
654
+ default: {
655
+ x: 24,
656
+ y: 24
657
+ },
658
+ column1: {
659
+ x: 16,
660
+ y: 16
661
+ },
662
+ narrow: {
663
+ x: 24,
664
+ yTop: 12,
665
+ yBottom: 20
666
+ },
667
+ narrowColumn1: {
668
+ x: 16,
669
+ yTop: 4,
670
+ yBottom: 0
671
+ }
672
+ };
673
+ function LayoutItemBody({
674
+ children,
675
+ horizontal = false,
676
+ narrow = false
677
+ }) {
678
+ const { wide } = (0, import_react7.useContext)(LayoutConfigContext);
679
+ return /* @__PURE__ */ import_react7.default.createElement(StyledLayoutItemBody, { wide, horizontal, narrow }, children);
680
+ }
681
+ var StyledLayoutItemBody = import_styled_components7.default.div`
682
+ padding: ${(p) => p.narrow ? `${LAYOUT_ITEM_BODY_PADDING.narrow.yTop}px ${p.horizontal ? 0 : LAYOUT_ITEM_BODY_PADDING.narrow.x}px ${LAYOUT_ITEM_BODY_PADDING.narrow.yBottom}px` : p.wide ? `${p.horizontal ? 0 : LAYOUT_ITEM_BODY_PADDING.wide.y}px ${LAYOUT_ITEM_BODY_PADDING.wide.x}px` : `${p.horizontal ? 0 : LAYOUT_ITEM_BODY_PADDING.default.y}px ${LAYOUT_ITEM_BODY_PADDING.default.x}px`};
683
+
684
+ @media ${({ theme: theme2 }) => (0, import_utils4.maxWidth)(theme2.breakpoint.screen1)} {
685
+ padding: ${(p) => p.narrow ? `${LAYOUT_ITEM_BODY_PADDING.narrowColumn1.yTop}px ${p.horizontal ? 0 : LAYOUT_ITEM_BODY_PADDING.narrowColumn1.x}px ${LAYOUT_ITEM_BODY_PADDING.narrowColumn1.yBottom}px` : `${LAYOUT_ITEM_BODY_PADDING.column1.y}px ${LAYOUT_ITEM_BODY_PADDING.column1.x}px ${0}`};
686
+ }
687
+
688
+ width: 100%;
689
+ box-sizing: border-box;
690
+ `;
691
+ function useLayoutItemBodyPadding() {
692
+ const { wide } = (0, import_react7.useContext)(LayoutConfigContext);
693
+ return useMediaScreen1() ? LAYOUT_ITEM_BODY_PADDING.column1 : wide ? LAYOUT_ITEM_BODY_PADDING.wide : LAYOUT_ITEM_BODY_PADDING.default;
694
+ }
695
+ function CancelLayoutItemBodyPadding({
696
+ children,
697
+ cancelTop
698
+ }) {
699
+ const { wide } = (0, import_react7.useContext)(LayoutConfigContext);
700
+ return /* @__PURE__ */ import_react7.default.createElement(StyledCancelLayoutItemBodyPadding, { wide, cancelTop }, children);
701
+ }
702
+ var StyledCancelLayoutItemBodyPadding = import_styled_components7.default.div`
703
+ margin: 0 -${(p) => p.wide ? LAYOUT_ITEM_BODY_PADDING.wide.x : LAYOUT_ITEM_BODY_PADDING.default.x}px;
704
+ margin-top: -${({ cancelTop = false, wide }) => !cancelTop ? 0 : wide ? LAYOUT_ITEM_BODY_PADDING.wide.y : LAYOUT_ITEM_BODY_PADDING.default.y}px;
705
+
706
+ @media ${({ theme: theme2 }) => (0, import_utils4.maxWidth)(theme2.breakpoint.screen1)} {
707
+ margin: 0 -${LAYOUT_ITEM_BODY_PADDING.column1.x}px;
708
+ margin-top: -${({ cancelTop = false }) => !cancelTop ? 0 : LAYOUT_ITEM_BODY_PADDING.column1.x}px;
709
+ }
710
+ `;
711
+
712
+ // src/components/LeftMenu/index.tsx
713
+ var import_react11 = __toESM(require("react"));
714
+ var import_styled_components10 = __toESM(require("styled-components"));
715
+
716
+ // src/components/MenuListItem/index.tsx
717
+ var import_react9 = __toESM(require("react"));
718
+ var import_styled_components9 = __toESM(require("styled-components"));
719
+
720
+ // src/components/TextEllipsis/index.tsx
721
+ var import_styled_components8 = __toESM(require("styled-components"));
722
+
723
+ // src/components/TextEllipsis/helper.ts
724
+ var import_react8 = require("react");
725
+ var hasChildren = (element) => (0, import_react8.isValidElement)(element) && Boolean(element.props.children);
726
+ var childToString = (child) => {
727
+ if (typeof child === "undefined" || child === null || typeof child === "boolean") {
728
+ return "";
729
+ }
730
+ if (JSON.stringify(child) === "{}") {
731
+ return "";
732
+ }
733
+ return child.toString();
734
+ };
735
+ var onlyText = (children) => {
736
+ if (!Array.isArray(children) && !(0, import_react8.isValidElement)(children)) {
737
+ return childToString(children);
738
+ }
739
+ return import_react8.Children.toArray(children).reduce(
740
+ (text, child) => {
741
+ let newText = "";
742
+ if ((0, import_react8.isValidElement)(child) && hasChildren(child)) {
743
+ newText = onlyText(child.props.children);
744
+ } else if ((0, import_react8.isValidElement)(child) && !hasChildren(child)) {
745
+ newText = "";
746
+ } else {
747
+ newText = childToString(child);
748
+ }
749
+ return text.concat(newText);
750
+ },
751
+ ""
752
+ );
753
+ };
754
+
755
+ // src/components/TextEllipsis/index.tsx
756
+ var TextEllipsis = import_styled_components8.default.div.attrs(
757
+ ({ children, title = onlyText(children) }) => ({
758
+ title: title !== "" ? title : void 0
759
+ })
760
+ )`
761
+ overflow: hidden;
762
+ line-height: ${(props) => props.lineHeight}px;
763
+ /* For english */
764
+ overflow-wrap: break-word;
765
+
766
+ ${({ lineLimit = 1, lineHeight }) => lineLimit === 1 ? import_styled_components8.css`
767
+ text-overflow: ellipsis;
768
+ white-space: nowrap;
769
+ ` : import_styled_components8.css`
770
+ display: -webkit-box;
771
+ -webkit-box-orient: vertical;
772
+ -webkit-line-clamp: ${lineLimit};
773
+ /* Fallback for -webkit-line-clamp */
774
+ max-height: ${lineHeight * lineLimit}px;
775
+ `}
776
+ `;
777
+
778
+ // src/components/MenuListItem/index.tsx
779
+ var import_react10 = require("@charcoal-ui/react");
780
+ var import_utils5 = require("@charcoal-ui/utils");
781
+ var MenuListItemContext = import_react9.default.createContext({ padding: 24 });
782
+ function MenuListItem({
783
+ primary,
784
+ secondary,
785
+ onClick,
786
+ disabled = false,
787
+ noHover = false,
788
+ gtmClass,
789
+ children
790
+ }) {
791
+ const { padding } = (0, import_react9.useContext)(MenuListItemContext);
792
+ return /* @__PURE__ */ import_react9.default.createElement(
793
+ Item,
794
+ {
795
+ hasSubLabel: secondary !== void 0,
796
+ onClick: (e) => !disabled && onClick && onClick(e),
797
+ sidePadding: padding,
798
+ noHover,
799
+ noClick: onClick === void 0,
800
+ "aria-disabled": disabled,
801
+ role: onClick !== void 0 ? "button" : void 0,
802
+ className: gtmClass !== void 0 ? `gtm-${gtmClass}` : void 0
803
+ },
804
+ /* @__PURE__ */ import_react9.default.createElement(Labels, null, /* @__PURE__ */ import_react9.default.createElement(PrimaryText, null, /* @__PURE__ */ import_react9.default.createElement(TextEllipsis, { lineHeight: 22, lineLimit: 1 }, primary)), secondary !== void 0 && /* @__PURE__ */ import_react9.default.createElement(SecondaryText, null, /* @__PURE__ */ import_react9.default.createElement(TextEllipsis, { lineHeight: 22, lineLimit: 1 }, secondary))),
805
+ children
806
+ );
807
+ }
808
+ var Item = import_styled_components9.default.div`
809
+ display: flex;
810
+ height: ${(p) => p.hasSubLabel ? 56 : 40}px;
811
+ align-items: center;
812
+ justify-content: space-between;
813
+ padding: 0 ${(p) => p.sidePadding}px;
814
+ user-select: none;
815
+ cursor: ${(p) => p.noClick ? "default" : "pointer"};
816
+ transition: 0.2s background-color;
817
+
818
+ &:hover {
819
+ ${(p) => !p.noHover && import_styled_components9.css`
820
+ background-color: ${({ theme: theme2 }) => theme2.color.surface3};
821
+ `}
822
+ }
823
+
824
+ ${theme((o) => o.disabled)}
825
+
826
+ ${import_utils5.disabledSelector} {
827
+ cursor: default;
828
+ pointer-events: none;
829
+
830
+ &:hover {
831
+ background-color: unset;
832
+ }
833
+ }
834
+ `;
835
+ var Labels = import_styled_components9.default.div`
836
+ display: flex;
837
+ flex-direction: column;
838
+ `;
839
+ var PrimaryText = import_styled_components9.default.div`
840
+ color: ${(p) => p.theme.color.text2};
841
+ line-height: 22px;
842
+ font-size: 14px;
843
+ display: grid;
844
+ `;
845
+ var SecondaryText = import_styled_components9.default.div`
846
+ color: ${(p) => p.theme.color.text3};
847
+ line-height: 18px;
848
+ font-size: 10px;
849
+ `;
850
+ function MenuListLinkItem({
851
+ link,
852
+ onClick,
853
+ disabled = false,
854
+ primary,
855
+ secondary,
856
+ gtmClass,
857
+ noHover,
858
+ children,
859
+ ...linkProps
860
+ }) {
861
+ const { Link } = (0, import_react10.useComponentAbstraction)();
862
+ const props = {
863
+ disabled,
864
+ primary,
865
+ secondary,
866
+ gtmClass,
867
+ noHover,
868
+ children
869
+ };
870
+ return disabled ? /* @__PURE__ */ import_react9.default.createElement("span", { onClick }, /* @__PURE__ */ import_react9.default.createElement(MenuListItem, { ...props })) : /* @__PURE__ */ import_react9.default.createElement(A, { as: Link, to: link, onClick, ...linkProps }, /* @__PURE__ */ import_react9.default.createElement(MenuListItem, { onClick: () => void 0, ...props }));
871
+ }
872
+ var A = import_styled_components9.default.a`
873
+ display: block;
874
+ `;
875
+ function MenuListLinkItemWithIcon({
876
+ icon,
877
+ primary: text,
878
+ ...props
879
+ }) {
880
+ const primary = /* @__PURE__ */ import_react9.default.createElement(IconContainer, null, /* @__PURE__ */ import_react9.default.createElement(Icon2, null, icon), text);
881
+ return /* @__PURE__ */ import_react9.default.createElement(MenuListLinkItem, { primary, ...props });
882
+ }
883
+ function MenuListItemWithIcon({
884
+ icon,
885
+ primary: text,
886
+ ...props
887
+ }) {
888
+ const primary = /* @__PURE__ */ import_react9.default.createElement(IconContainer, null, /* @__PURE__ */ import_react9.default.createElement(Icon2, null, icon), text);
889
+ return /* @__PURE__ */ import_react9.default.createElement(MenuListItem, { primary, ...props });
890
+ }
891
+ var IconContainer = import_styled_components9.default.div`
892
+ display: grid;
893
+ gap: 8px;
894
+ grid-auto-flow: column;
895
+ align-items: center;
896
+ `;
897
+ var Icon2 = import_styled_components9.default.div`
898
+ color: ${({ theme: theme2 }) => theme2.color.text3};
899
+ display: flex;
900
+ `;
901
+ var MenuListSpacer = import_styled_components9.default.div`
902
+ height: 24px;
903
+ `;
904
+ var MenuListLabel = import_styled_components9.default.div`
905
+ padding: 0 16px;
906
+ font-size: 12px;
907
+ line-height: 16px;
908
+ color: ${({ theme: theme2 }) => theme2.color.text3};
909
+ margin-top: -2px;
910
+ margin-bottom: 6px;
911
+ `;
912
+
913
+ // src/components/LeftMenu/index.tsx
914
+ var import_react12 = require("@charcoal-ui/react");
915
+ function LeftMenu({
916
+ links,
917
+ active
918
+ }) {
919
+ const { Link } = (0, import_react12.useComponentAbstraction)();
920
+ return /* @__PURE__ */ import_react11.default.createElement(Container2, null, links.map((link, index) => /* @__PURE__ */ import_react11.default.createElement(Link, { to: link.to, key: index }, /* @__PURE__ */ import_react11.default.createElement(LinkItem, { "aria-current": link.id === active || void 0 }, link.text))));
921
+ }
922
+ function LeftMenuContent({ links }) {
923
+ return /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, links.map((link, index) => /* @__PURE__ */ import_react11.default.createElement(MenuListLinkItem, { link: link.to, key: index, primary: link.text })));
924
+ }
925
+ var Container2 = import_styled_components10.default.div`
926
+ display: flex;
927
+ flex-direction: column;
928
+ align-items: flex-start;
929
+ `;
930
+ var LinkItem = import_styled_components10.default.div`
931
+ display: flex;
932
+ align-items: center;
933
+ color: ${({ theme: theme2 }) => theme2.color.text3};
934
+ border-radius: 24px;
935
+ font-weight: bold;
936
+ font-size: 14px;
937
+ line-height: 22px;
938
+ padding: 0 16px;
939
+ height: 40px;
940
+ transition: 0.2s color;
941
+ &:hover {
942
+ transition: 0.2s color;
943
+ color: ${({ theme: theme2 }) => theme2.color.text2};
944
+ }
945
+ &[aria-current] {
946
+ color: ${({ theme: theme2 }) => theme2.color.text2};
947
+ background-color: ${({ theme: theme2 }) => theme2.color.surface3};
948
+ }
949
+ `;
950
+
951
+ // src/components/SwitchCheckbox/index.tsx
952
+ var import_react13 = __toESM(require("react"));
953
+ var import_styled_components11 = __toESM(require("styled-components"));
954
+ var import_utils6 = require("@charcoal-ui/utils");
955
+ var SwitchCheckbox_default = import_react13.default.forwardRef(function SwitchCheckbox({
956
+ gtmClass,
957
+ flex = false,
958
+ rowReverse = false,
959
+ children,
960
+ disabled,
961
+ ...props
962
+ }, ref) {
963
+ return /* @__PURE__ */ import_react13.default.createElement(
964
+ Label,
965
+ {
966
+ className: gtmClass !== void 0 ? `gtm-${gtmClass}` : "",
967
+ flex,
968
+ rowReverse,
969
+ "aria-disabled": disabled
970
+ },
971
+ /* @__PURE__ */ import_react13.default.createElement(SwitchOuter, null, /* @__PURE__ */ import_react13.default.createElement(SwitchInput, { ...props, disabled, ref }), /* @__PURE__ */ import_react13.default.createElement(SwitchInner, null, /* @__PURE__ */ import_react13.default.createElement(SwitchInnerKnob, null))),
972
+ children != null && /* @__PURE__ */ import_react13.default.createElement(Children2, { rowReverse }, children)
973
+ );
974
+ });
975
+ var Children2 = import_styled_components11.default.span`
976
+ ${(p) => p.rowReverse ? import_styled_components11.css`
977
+ margin-right: 8px;
978
+ ` : import_styled_components11.css`
979
+ margin-left: 8px;
980
+ `}
981
+ `;
982
+ var Label = import_styled_components11.default.label`
983
+ display: inline-flex;
984
+ align-items: center;
985
+ ${({ flex }) => flex && import_styled_components11.css`
986
+ display: flex;
987
+ justify-content: space-between;
988
+ `}
989
+ ${({ rowReverse }) => import_styled_components11.css`
990
+ flex-direction: ${rowReverse ? "row-reverse" : "row"};
991
+ `}
992
+ cursor: pointer;
993
+ outline: 0;
994
+
995
+ &[aria-disabled='true'] {
996
+ cursor: auto;
997
+ }
998
+ `;
999
+ var SwitchOuter = import_styled_components11.default.span`
1000
+ display: inline-flex;
1001
+ position: relative;
1002
+ z-index: 0;
1003
+ `;
1004
+ var SwitchInner = import_styled_components11.default.div`
1005
+ position: relative;
1006
+ box-sizing: border-box;
1007
+ width: 28px;
1008
+ height: 16px;
1009
+ border-radius: 16px;
1010
+ border: 2px solid transparent;
1011
+ background: ${({ theme: theme2 }) => theme2.color.text4};
1012
+ transition: box-shadow 0.2s, background-color 0.2s;
1013
+ `;
1014
+ var SwitchInnerKnob = import_styled_components11.default.div`
1015
+ position: absolute;
1016
+ display: block;
1017
+ top: 0;
1018
+ left: 0;
1019
+ width: 12px;
1020
+ height: 12px;
1021
+ background-color: ${({ theme: theme2 }) => theme2.color.text5};
1022
+ border-radius: 50%;
1023
+ transform: translateX(0);
1024
+ transition: transform 0.2s;
1025
+ `;
1026
+ var SwitchInput = import_styled_components11.default.input.attrs({
1027
+ type: "checkbox"
1028
+ })`
1029
+ position: absolute;
1030
+ /* NOTE: this is contained by the GraphicCheckboxOuter */
1031
+ z-index: 1;
1032
+ top: 0;
1033
+ left: 0;
1034
+ width: 100%;
1035
+ height: 100%;
1036
+ /* just to control the clickable area if used standalone */
1037
+ border-radius: 16px;
1038
+ opacity: 0;
1039
+ appearance: none;
1040
+ outline: none;
1041
+ cursor: pointer;
1042
+
1043
+ &:checked {
1044
+ ~ ${SwitchInner} {
1045
+ background-color: ${({ theme: theme2 }) => theme2.color.brand};
1046
+
1047
+ ${SwitchInnerKnob} {
1048
+ transform: translateX(12px);
1049
+ }
1050
+ }
1051
+ }
1052
+
1053
+ &:disabled {
1054
+ cursor: auto;
1055
+
1056
+ ~ ${SwitchInner} {
1057
+ opacity: ${({ theme: theme2 }) => theme2.elementEffect.disabled.opacity};
1058
+ }
1059
+ }
1060
+
1061
+ &:not(:disabled):focus {
1062
+ ~ ${SwitchInner} {
1063
+ box-shadow: 0 0 0 4px
1064
+ ${({ theme: theme2 }) => (0, import_utils6.applyEffect)(theme2.color.brand, theme2.elementEffect.disabled)};
1065
+ }
1066
+ }
1067
+ `;
1068
+
1069
+ // src/components/WithIcon/index.tsx
1070
+ var import_react14 = __toESM(require("react"));
1071
+ var import_styled_components12 = __toESM(require("styled-components"));
1072
+ var WithIcon_default = import_react14.default.memo(function WithIcon({
1073
+ children,
1074
+ icon,
1075
+ show = true,
1076
+ prefix: pre = false,
1077
+ width,
1078
+ fit = false,
1079
+ fixed = false
1080
+ }) {
1081
+ const node = fit ? width === void 0 ? /* @__PURE__ */ import_react14.default.createElement(AutoWidthIconAnchor, { show, pre }, icon) : /* @__PURE__ */ import_react14.default.createElement(IconAnchor, { width, show, pre }, /* @__PURE__ */ import_react14.default.createElement(Icon3, null, icon)) : /* @__PURE__ */ import_react14.default.createElement(IconAnchorNaive, { show, pre }, /* @__PURE__ */ import_react14.default.createElement(IconNaive, null, icon));
1082
+ return /* @__PURE__ */ import_react14.default.createElement(Root, null, pre && node, /* @__PURE__ */ import_react14.default.createElement(Text2, { fixed }, children), !pre && node);
1083
+ });
1084
+ var Root = import_styled_components12.default.div`
1085
+ display: flex;
1086
+ align-items: center;
1087
+ `;
1088
+ var Text2 = import_styled_components12.default.div`
1089
+ ${(p) => !p.fixed && import_styled_components12.css`
1090
+ min-width: 0;
1091
+ overflow: hidden;
1092
+ `}
1093
+ white-space: nowrap;
1094
+ text-overflow: ellipsis;
1095
+ `;
1096
+ function AutoWidthIconAnchor({
1097
+ children,
1098
+ show,
1099
+ pre
1100
+ }) {
1101
+ const ref = (0, import_react14.useRef)(null);
1102
+ const width = useElementSize(ref, [null])?.width ?? 0;
1103
+ return /* @__PURE__ */ import_react14.default.createElement(IconAnchor, { width, show, pre }, /* @__PURE__ */ import_react14.default.createElement(Icon3, { ref }, children));
1104
+ }
1105
+ var forceCenteringCss = import_styled_components12.css`
1106
+ > svg {
1107
+ display: block;
1108
+ }
1109
+ `;
1110
+ var iconAnchorCss = import_styled_components12.css`
1111
+ ${(p) => p.show === "collapse" ? import_styled_components12.css`
1112
+ display: none;
1113
+ ` : import_styled_components12.css`
1114
+ visibility: ${p.show ? "visible" : "hidden"};
1115
+ `};
1116
+ ${(p) => p.pre ? import_styled_components12.css`
1117
+ margin-right: 4px;
1118
+ ` : import_styled_components12.css`
1119
+ margin-left: 4px;
1120
+ `}
1121
+ `;
1122
+ var IconAnchorNaive = import_styled_components12.default.div`
1123
+ display: flex;
1124
+ align-items: center;
1125
+
1126
+ ${iconAnchorCss}
1127
+ `;
1128
+ var IconNaive = import_styled_components12.default.div`
1129
+ display: inline-flex;
1130
+
1131
+ ${forceCenteringCss}
1132
+ `;
1133
+ var IconAnchor = import_styled_components12.default.div`
1134
+ display: flex;
1135
+ position: relative;
1136
+ /* Iconをline-heightに関与させない */
1137
+ height: 0;
1138
+ /* 横方向の領域は確保する */
1139
+ width: ${(p) => p.width}px;
1140
+
1141
+ ${iconAnchorCss}
1142
+ `;
1143
+ var Icon3 = import_styled_components12.default.div`
1144
+ display: inline-flex;
1145
+ position: absolute;
1146
+ transform: translateY(-50%);
1147
+
1148
+ ${forceCenteringCss}
1149
+ `;
1150
+
1151
+ // src/index.ts
1152
+ var import_react23 = require("@charcoal-ui/react");
1153
+
1154
+ // src/components/Carousel/index.tsx
1155
+ var import_react18 = __toESM(require("react"));
1156
+ var import_react_spring = require("react-spring");
1157
+ var import_styled_components14 = __toESM(require("styled-components"));
1158
+
1159
+ // src/foundation/support.ts
1160
+ var passiveEventsResult;
1161
+ function passiveEvents() {
1162
+ if (passiveEventsResult !== void 0) {
1163
+ return passiveEventsResult;
1164
+ }
1165
+ passiveEventsResult = false;
1166
+ try {
1167
+ const options = Object.defineProperty({}, "passive", {
1168
+ get() {
1169
+ return passiveEventsResult = true;
1170
+ }
1171
+ });
1172
+ window.addEventListener("test", test, options);
1173
+ window.removeEventListener("test", test);
1174
+ } catch {
1175
+ }
1176
+ return passiveEventsResult;
1177
+ function test() {
1178
+ }
1179
+ }
1180
+ var isEdge = () => navigator.userAgent.includes("Edge/");
1181
+
1182
+ // src/hooks/index.ts
1183
+ var import_react15 = require("react");
1184
+ var useIsomorphicLayoutEffect = typeof window !== "undefined" ? import_react15.useLayoutEffect : import_react15.useEffect;
1185
+
1186
+ // src/components/CarouselButton/index.tsx
1187
+ var import_react17 = __toESM(require("react"));
1188
+ var import_styled_components13 = __toESM(require("styled-components"));
1189
+
1190
+ // src/foundation/utils.ts
1191
+ function unreachable(value) {
1192
+ throw new Error(
1193
+ arguments.length === 0 ? "unreachable" : `unreachable (${JSON.stringify(value)})`
1194
+ );
1195
+ }
1196
+
1197
+ // src/components/icons/NextIcon.tsx
1198
+ var import_react16 = __toESM(require("react"));
1199
+ var path = `M8.08579 16.5858C7.30474 17.3668 7.30474 18.6332 8.08579 19.4142C8.86684 20.1953 10.1332 20.1953 10.9142 19.4142L18.3284 12L10.9142 4.58579C10.1332 3.80474 8.86684 3.80474 8.08579 4.58579C7.30474 5.36684 7.30474 6.63317 8.08579 7.41421L12.6716 12L8.08579 16.5858Z`;
1200
+ var size2 = 24;
1201
+ function NextIcon({ direction }) {
1202
+ const transform = directionToTransform(direction);
1203
+ return /* @__PURE__ */ import_react16.default.createElement(
1204
+ IconBase,
1205
+ {
1206
+ viewBoxSize: size2,
1207
+ size: size2,
1208
+ currentColor: true,
1209
+ path,
1210
+ transform
1211
+ }
1212
+ );
1213
+ }
1214
+ function directionToTransform(direction) {
1215
+ switch (direction) {
1216
+ case "up" /* Up */:
1217
+ return "rotate(270 12 12)";
1218
+ case "down" /* Down */:
1219
+ return "rotate(90 12 12)";
1220
+ case "left" /* Left */:
1221
+ return "rotate(180 12 12)";
1222
+ case "right" /* Right */:
1223
+ return void 0;
1224
+ default:
1225
+ return unreachable(direction);
1226
+ }
1227
+ }
1228
+
1229
+ // src/components/CarouselButton/index.tsx
1230
+ var import_utils9 = require("@charcoal-ui/utils");
1231
+ function CarouselButton({
1232
+ direction,
1233
+ show,
1234
+ offset = 0,
1235
+ padding = 0,
1236
+ bottomOffset: bottom = 0,
1237
+ gradient = false,
1238
+ onClick
1239
+ }) {
1240
+ const offsetStyle = direction === "left" /* Left */ ? {
1241
+ left: gradient ? offset - 72 : offset,
1242
+ paddingLeft: Math.max(padding, 0),
1243
+ paddingBottom: bottom
1244
+ } : {
1245
+ right: gradient ? offset - 72 : offset,
1246
+ paddingRight: Math.max(padding, 0),
1247
+ paddingBottom: bottom
1248
+ };
1249
+ return /* @__PURE__ */ import_react17.default.createElement(
1250
+ Button,
1251
+ {
1252
+ type: "button",
1253
+ onClick,
1254
+ hide: !show,
1255
+ style: offsetStyle,
1256
+ css: onlyNonTouchDevice
1257
+ },
1258
+ /* @__PURE__ */ import_react17.default.createElement(CarouselButtonIcon, null, /* @__PURE__ */ import_react17.default.createElement(
1259
+ NextIcon,
1260
+ {
1261
+ direction: direction === "right" /* Right */ ? "right" /* Right */ : direction === "left" /* Left */ ? "left" /* Left */ : unreachable()
1262
+ }
1263
+ ))
1264
+ );
1265
+ }
1266
+ var CAROUSEL_BUTTON_SIZE = 40;
1267
+ var CarouselButtonIcon = import_styled_components13.default.div`
1268
+ display: flex;
1269
+ align-items: center;
1270
+ justify-content: center;
1271
+ width: ${CAROUSEL_BUTTON_SIZE}px;
1272
+ height: ${CAROUSEL_BUTTON_SIZE}px;
1273
+ border-radius: 50%;
1274
+ background-color: ${({ theme: theme2 }) => theme2.color.surface4};
1275
+ transition: 0.4s visibility, 0.4s opacity, 0.2s background-color, 0.2s color;
1276
+ color: ${({ theme: theme2 }) => theme2.color.text5};
1277
+ `;
1278
+ var Button = import_styled_components13.default.button`
1279
+ position: absolute;
1280
+ top: 0;
1281
+ bottom: 0;
1282
+ display: flex;
1283
+ align-items: center;
1284
+ padding: 0;
1285
+ min-width: 40px;
1286
+ border: none;
1287
+ outline: 0;
1288
+ background: transparent;
1289
+ cursor: pointer;
1290
+ transition: 0.4s visibility, 0.4s opacity;
1291
+ /* つらい */
1292
+ /* このコンポーネントはCarouselでしか使われてないのでそっちでコンテキストで切る */
1293
+ z-index: 1;
1294
+
1295
+ &:hover ${CarouselButtonIcon} {
1296
+ background-color: ${({ theme: theme2 }) => (0, import_utils9.applyEffect)(theme2.color.surface4, theme2.effect.hover)};
1297
+ color: ${({ theme: theme2 }) => (0, import_utils9.applyEffect)(theme2.color.text5, theme2.effect.hover)};
1298
+ }
1299
+
1300
+ &:active ${CarouselButtonIcon} {
1301
+ background-color: ${({ theme: theme2 }) => (0, import_utils9.applyEffect)(theme2.color.surface4, theme2.effect.press)};
1302
+ color: ${({ theme: theme2 }) => (0, import_utils9.applyEffect)(theme2.color.text5, theme2.effect.press)};
1303
+ }
1304
+
1305
+ ${(p) => p.hide && import_styled_components13.css`
1306
+ visibility: hidden;
1307
+ opacity: 0;
1308
+ pointer-events: none;
1309
+ `}
1310
+ `;
1311
+ var ScrollHintIcon = (0, import_styled_components13.default)(CarouselButtonIcon)`
1312
+ cursor: pointer;
1313
+
1314
+ &:hover {
1315
+ background-color: ${({ theme: theme2 }) => (0, import_utils9.applyEffect)(theme2.color.surface4, theme2.effect.hover)};
1316
+ color: ${({ theme: theme2 }) => (0, import_utils9.applyEffect)(theme2.color.text5, theme2.effect.hover)};
1317
+ }
1318
+
1319
+ &:active {
1320
+ background-color: ${({ theme: theme2 }) => (0, import_utils9.applyEffect)(theme2.color.surface4, theme2.effect.press)};
1321
+ color: ${({ theme: theme2 }) => (0, import_utils9.applyEffect)(theme2.color.text5, theme2.effect.press)};
1322
+ }
1323
+ `;
1324
+ var onlyNonTouchDevice = import_styled_components13.css`
1325
+ @media (hover: none) and (pointer: coarse) {
1326
+ display: none;
1327
+ }
1328
+ `;
1329
+
1330
+ // src/components/Carousel/index.tsx
1331
+ var GRADIENT_WIDTH = 72;
1332
+ var SCROLL_AMOUNT_COEF = 0.75;
1333
+ function Carousel({
1334
+ buttonOffset = 0,
1335
+ buttonPadding = 16,
1336
+ bottomOffset = 0,
1337
+ defaultScroll: { align = "left", offset: scrollOffset = 0 } = {},
1338
+ onScroll,
1339
+ onResize,
1340
+ children,
1341
+ centerItems,
1342
+ onScrollStateChange,
1343
+ scrollAmountCoef = SCROLL_AMOUNT_COEF,
1344
+ ...options
1345
+ }) {
1346
+ const [scrollLeft, setScrollLeft] = useDebounceAnimationState(0);
1347
+ const animation = (0, import_react18.useRef)(false);
1348
+ const [maxScrollLeft, setMaxScrollLeft] = (0, import_react18.useState)(0);
1349
+ const [leftShow, setLeftShow] = (0, import_react18.useState)(false);
1350
+ const [rightShow, setRightShow] = (0, import_react18.useState)(false);
1351
+ const [styles, set] = (0, import_react_spring.useSpring)(() => ({ scroll: 0 }));
1352
+ const ref = (0, import_react18.useRef)(null);
1353
+ const visibleAreaRef = (0, import_react18.useRef)(null);
1354
+ const innerRef = (0, import_react18.useRef)(null);
1355
+ const handleRight = (0, import_react18.useCallback)(() => {
1356
+ if (visibleAreaRef.current === null) {
1357
+ return;
1358
+ }
1359
+ const { clientWidth } = visibleAreaRef.current;
1360
+ const scroll = Math.min(
1361
+ scrollLeft + clientWidth * scrollAmountCoef,
1362
+ maxScrollLeft
1363
+ );
1364
+ setScrollLeft(scroll, true);
1365
+ set({ scroll, from: { scroll: scrollLeft }, reset: !animation.current });
1366
+ animation.current = true;
1367
+ }, [
1368
+ animation,
1369
+ maxScrollLeft,
1370
+ scrollLeft,
1371
+ set,
1372
+ scrollAmountCoef,
1373
+ setScrollLeft
1374
+ ]);
1375
+ const handleLeft = (0, import_react18.useCallback)(() => {
1376
+ if (visibleAreaRef.current === null) {
1377
+ return;
1378
+ }
1379
+ const { clientWidth } = visibleAreaRef.current;
1380
+ const scroll = Math.max(scrollLeft - clientWidth * scrollAmountCoef, 0);
1381
+ setScrollLeft(scroll, true);
1382
+ set({ scroll, from: { scroll: scrollLeft }, reset: !animation.current });
1383
+ animation.current = true;
1384
+ }, [animation, scrollLeft, set, scrollAmountCoef, setScrollLeft]);
1385
+ (0, import_react18.useEffect)(() => {
1386
+ const newleftShow = scrollLeft > 0;
1387
+ const newrightShow = scrollLeft < maxScrollLeft && maxScrollLeft > 0;
1388
+ if (newleftShow !== leftShow || newrightShow !== rightShow) {
1389
+ setLeftShow(newleftShow);
1390
+ setRightShow(newrightShow);
1391
+ onScrollStateChange?.(newleftShow || newrightShow);
1392
+ }
1393
+ }, [leftShow, maxScrollLeft, onScrollStateChange, rightShow, scrollLeft]);
1394
+ const handleScroll = (0, import_react18.useCallback)(() => {
1395
+ if (ref.current === null) {
1396
+ return;
1397
+ }
1398
+ if (animation.current) {
1399
+ styles.scroll.stop();
1400
+ animation.current = false;
1401
+ }
1402
+ const manualScrollLeft = ref.current.scrollLeft;
1403
+ setScrollLeft(manualScrollLeft);
1404
+ }, [animation, setScrollLeft, styles]);
1405
+ const handleResize = (0, import_react18.useCallback)(() => {
1406
+ if (ref.current === null) {
1407
+ return;
1408
+ }
1409
+ const { clientWidth, scrollWidth } = ref.current;
1410
+ const newMaxScrollLeft = scrollWidth - clientWidth;
1411
+ setMaxScrollLeft(newMaxScrollLeft);
1412
+ if (onResize) {
1413
+ onResize(clientWidth);
1414
+ }
1415
+ }, [onResize]);
1416
+ useIsomorphicLayoutEffect(() => {
1417
+ const elm = ref.current;
1418
+ const innerElm = innerRef.current;
1419
+ if (elm === null || innerElm === null) {
1420
+ return;
1421
+ }
1422
+ elm.addEventListener(
1423
+ "wheel",
1424
+ handleScroll,
1425
+ passiveEvents() && { passive: true }
1426
+ );
1427
+ const resizeObserver = new ResizeObserver(handleResize);
1428
+ resizeObserver.observe(elm);
1429
+ const resizeObserverInner = new ResizeObserver(handleResize);
1430
+ resizeObserverInner.observe(innerElm);
1431
+ return () => {
1432
+ elm.removeEventListener("wheel", handleScroll);
1433
+ resizeObserver.disconnect();
1434
+ resizeObserverInner.disconnect();
1435
+ };
1436
+ }, [handleResize, handleScroll]);
1437
+ useIsomorphicLayoutEffect(() => {
1438
+ if (align !== "left" || scrollOffset !== 0) {
1439
+ const scroll = ref.current;
1440
+ if (scroll !== null) {
1441
+ const scrollLength = Math.max(
1442
+ 0,
1443
+ Math.min(
1444
+ align === "left" && scrollOffset > 0 ? scrollOffset : align === "center" ? maxScrollLeft / 2 + scrollOffset : align === "right" && scrollOffset <= maxScrollLeft ? maxScrollLeft - scrollOffset / 2 : 0,
1445
+ maxScrollLeft
1446
+ )
1447
+ );
1448
+ scroll.scrollLeft = scrollLength;
1449
+ setScrollLeft(scrollLength, true);
1450
+ }
1451
+ }
1452
+ }, [ref.current]);
1453
+ const handleScrollMove = (0, import_react18.useCallback)(() => {
1454
+ if (ref.current === null) {
1455
+ return;
1456
+ }
1457
+ if (onScroll) {
1458
+ onScroll(ref.current.scrollLeft);
1459
+ }
1460
+ }, [onScroll]);
1461
+ const [disableGradient, setDisableGradient] = (0, import_react18.useState)(false);
1462
+ useIsomorphicLayoutEffect(() => {
1463
+ if (isEdge()) {
1464
+ setDisableGradient(true);
1465
+ }
1466
+ }, []);
1467
+ if (!disableGradient && options.hasGradient === true) {
1468
+ const fadeInGradient = options.fadeInGradient ?? false;
1469
+ const overflowGradient = !fadeInGradient;
1470
+ return /* @__PURE__ */ import_react18.default.createElement(Container3, { ref: visibleAreaRef }, /* @__PURE__ */ import_react18.default.createElement(GradientContainer, { fadeInGradient }, /* @__PURE__ */ import_react18.default.createElement(RightGradient, null, /* @__PURE__ */ import_react18.default.createElement(LeftGradient, { show: overflowGradient || scrollLeft > 0 }, /* @__PURE__ */ import_react18.default.createElement(
1471
+ ScrollArea,
1472
+ {
1473
+ ref,
1474
+ scrollLeft: styles.scroll,
1475
+ onScroll: handleScrollMove
1476
+ },
1477
+ /* @__PURE__ */ import_react18.default.createElement(CarouselContainer, { ref: innerRef, centerItems }, children)
1478
+ )))), /* @__PURE__ */ import_react18.default.createElement(ButtonsContainer, null, /* @__PURE__ */ import_react18.default.createElement(
1479
+ CarouselButton,
1480
+ {
1481
+ direction: "left" /* Left */,
1482
+ show: leftShow,
1483
+ offset: buttonOffset,
1484
+ bottomOffset,
1485
+ padding: buttonPadding,
1486
+ gradient: overflowGradient,
1487
+ onClick: handleLeft
1488
+ }
1489
+ ), /* @__PURE__ */ import_react18.default.createElement(
1490
+ CarouselButton,
1491
+ {
1492
+ direction: "right" /* Right */,
1493
+ show: rightShow,
1494
+ offset: buttonOffset,
1495
+ bottomOffset,
1496
+ padding: buttonPadding,
1497
+ gradient: true,
1498
+ onClick: handleRight
1499
+ }
1500
+ )));
1501
+ }
1502
+ return /* @__PURE__ */ import_react18.default.createElement(Container3, { ref: visibleAreaRef }, /* @__PURE__ */ import_react18.default.createElement(
1503
+ ScrollArea,
1504
+ {
1505
+ ref,
1506
+ scrollLeft: styles.scroll,
1507
+ onScroll: handleScrollMove
1508
+ },
1509
+ /* @__PURE__ */ import_react18.default.createElement(CarouselContainer, { ref: innerRef, centerItems }, children)
1510
+ ), /* @__PURE__ */ import_react18.default.createElement(ButtonsContainer, null, /* @__PURE__ */ import_react18.default.createElement(
1511
+ CarouselButton,
1512
+ {
1513
+ direction: "left" /* Left */,
1514
+ show: leftShow,
1515
+ offset: buttonOffset,
1516
+ bottomOffset,
1517
+ padding: buttonPadding,
1518
+ onClick: handleLeft
1519
+ }
1520
+ ), /* @__PURE__ */ import_react18.default.createElement(
1521
+ CarouselButton,
1522
+ {
1523
+ direction: "right" /* Right */,
1524
+ show: rightShow,
1525
+ offset: buttonOffset,
1526
+ bottomOffset,
1527
+ padding: buttonPadding,
1528
+ onClick: handleRight
1529
+ }
1530
+ )));
1531
+ }
1532
+ var CarouselContainer = import_styled_components14.default.ul`
1533
+ vertical-align: top;
1534
+ overflow: hidden;
1535
+ list-style: none;
1536
+ padding: 0;
1537
+
1538
+ /* 最小幅を100%にして親要素にぴったりくっつけることで子要素で要素を均等に割り付けるなどを出来るようにしてある */
1539
+ min-width: 100%;
1540
+ box-sizing: border-box;
1541
+
1542
+ ${({ centerItems = false }) => centerItems ? import_styled_components14.css`
1543
+ display: flex;
1544
+ width: max-content;
1545
+ margin: 0 auto;
1546
+ ` : import_styled_components14.css`
1547
+ display: inline-flex;
1548
+ margin: 0;
1549
+ `}
1550
+ `;
1551
+ var ButtonsContainer = import_styled_components14.default.div`
1552
+ opacity: 0;
1553
+ transition: 0.4s opacity;
1554
+ `;
1555
+ var Container3 = import_styled_components14.default.div`
1556
+ &:hover ${ButtonsContainer} {
1557
+ opacity: 1;
1558
+ }
1559
+
1560
+ /* CarouselButtonの中にz-index:1があるのでここでコンテキストを切る */
1561
+ position: relative;
1562
+ z-index: 0;
1563
+ `;
1564
+ var ScrollArea = (0, import_styled_components14.default)(import_react_spring.animated.div)`
1565
+ overflow-x: auto;
1566
+ padding: 0;
1567
+ margin: 0;
1568
+
1569
+ &::-webkit-scrollbar {
1570
+ display: none;
1571
+ }
1572
+
1573
+ scrollbar-width: none;
1574
+ `;
1575
+ var GradientContainer = import_styled_components14.default.div`
1576
+ /* NOTE: LeftGradientがはみ出るためhidden */
1577
+ overflow: hidden;
1578
+ ${(p) => !p.fadeInGradient && import_styled_components14.css`
1579
+ margin-left: ${-GRADIENT_WIDTH}px;
1580
+ ${CarouselContainer} {
1581
+ padding-left: ${GRADIENT_WIDTH}px;
1582
+ }
1583
+ `}
1584
+
1585
+ margin-right: ${-GRADIENT_WIDTH}px;
1586
+ /* stylelint-disable-next-line no-duplicate-selectors */
1587
+ ${CarouselContainer} {
1588
+ padding-right: ${GRADIENT_WIDTH}px;
1589
+ }
1590
+ `;
1591
+ var RightGradient = import_styled_components14.default.div`
1592
+ mask-image: linear-gradient(
1593
+ to right,
1594
+ #000 calc(100% - ${GRADIENT_WIDTH}px),
1595
+ transparent
1596
+ );
1597
+ `;
1598
+ var LeftGradient = import_styled_components14.default.div`
1599
+ /* NOTE: mask-position が left → negative px の時、right → abs(negative px) の位置に表示されるため */
1600
+ margin-right: ${-GRADIENT_WIDTH}px;
1601
+ padding-right: ${GRADIENT_WIDTH}px;
1602
+ /* NOTE: mask-position に transition をつけたいが vender prefixes 対策で all につける */
1603
+ transition: 0.2s all ease-in;
1604
+ mask: linear-gradient(to right, transparent, #000 ${GRADIENT_WIDTH}px)
1605
+ ${(p) => p.show ? 0 : -GRADIENT_WIDTH}px 0;
1606
+ `;
1607
+
1608
+ // src/components/Pager/index.tsx
1609
+ var import_react21 = __toESM(require("react"));
1610
+ var import_styled_components17 = __toESM(require("styled-components"));
1611
+ var import_warning = __toESM(require("warning"));
1612
+
1613
+ // src/components/icons/DotsIcon.tsx
1614
+ var import_react19 = __toESM(require("react"));
1615
+ var import_styled_components15 = __toESM(require("styled-components"));
1616
+ function DotsIcon({ size: size3 }) {
1617
+ return /* @__PURE__ */ import_react19.default.createElement(StyledSVG, { viewBox: "0 0 20 6", width: size3, height: size3 }, /* @__PURE__ */ import_react19.default.createElement(
1618
+ "path",
1619
+ {
1620
+ fillRule: "evenodd",
1621
+ d: `M5,14.5 C3.61928813,14.5 2.5,13.3807119 2.5,12 C2.5,10.6192881 3.61928813,9.5 5,9.5
1622
+ C6.38071187,9.5 7.5,10.6192881 7.5,12 C7.5,13.3807119 6.38071187,14.5 5,14.5 Z M12,14.5
1623
+ C10.6192881,14.5 9.5,13.3807119 9.5,12 C9.5,10.6192881 10.6192881,9.5 12,9.5
1624
+ C13.3807119,9.5 14.5,10.6192881 14.5,12 C14.5,13.3807119 13.3807119,14.5 12,14.5 Z M19,14.5
1625
+ C17.6192881,14.5 16.5,13.3807119 16.5,12 C16.5,10.6192881 17.6192881,9.5 19,9.5
1626
+ C20.3807119,9.5 21.5,10.6192881 21.5,12 C21.5,13.3807119 20.3807119,14.5 19,14.5 Z`,
1627
+ transform: "translate(-2 -9)"
1628
+ }
1629
+ ));
1630
+ }
1631
+ DotsIcon.defaultProps = {
1632
+ size: 16
1633
+ };
1634
+ var StyledSVG = import_styled_components15.default.svg`
1635
+ fill: currentColor;
1636
+ `;
1637
+
1638
+ // src/components/icons/WedgeIcon.tsx
1639
+ var import_react20 = __toESM(require("react"));
1640
+ var import_styled_components16 = __toESM(require("styled-components"));
1641
+ function WedgeIcon({ size: size3, direction }) {
1642
+ return /* @__PURE__ */ import_react20.default.createElement("svg", { viewBox: "0 0 10 8", width: size3, height: size3 }, /* @__PURE__ */ import_react20.default.createElement(
1643
+ StyledPolyline,
1644
+ {
1645
+ strokeWidth: "2",
1646
+ points: "1,2 5,6 9,2",
1647
+ transform: directionToTransform2(direction)
1648
+ }
1649
+ ));
1650
+ }
1651
+ WedgeIcon.defaultProps = {
1652
+ size: 16,
1653
+ white: false,
1654
+ lightGray: false
1655
+ };
1656
+ function directionToTransform2(direction) {
1657
+ switch (direction) {
1658
+ case "up" /* Up */:
1659
+ return "rotate(180 5 4)";
1660
+ case "down" /* Down */:
1661
+ return void 0;
1662
+ case "left" /* Left */:
1663
+ return "rotate(90 5 4)";
1664
+ case "right" /* Right */:
1665
+ return "rotate(-90 5 4)";
1666
+ default:
1667
+ return unreachable(direction);
1668
+ }
1669
+ }
1670
+ var StyledPolyline = import_styled_components16.default.polyline`
1671
+ fill: none;
1672
+ stroke-linejoin: round;
1673
+ stroke-linecap: round;
1674
+ stroke: currentColor;
1675
+ `;
1676
+
1677
+ // src/components/Pager/index.tsx
1678
+ var import_react22 = require("@charcoal-ui/react");
1679
+ function usePagerWindow(page, pageCount, windowSize = 7) {
1680
+ if (process.env.NODE_ENV !== "production") {
1681
+ (0, import_warning.default)((page | 0) === page, `\`page\` must be interger (${page})`);
1682
+ (0, import_warning.default)(
1683
+ (pageCount | 0) === pageCount,
1684
+ `\`pageCount\` must be interger (${pageCount})`
1685
+ );
1686
+ }
1687
+ const window2 = (0, import_react21.useMemo)(() => {
1688
+ const visibleFirstPage = 1;
1689
+ const visibleLastPage = Math.min(
1690
+ pageCount,
1691
+ Math.max(page + Math.floor(windowSize / 2), windowSize)
1692
+ );
1693
+ if (visibleLastPage <= windowSize) {
1694
+ return Array.from(
1695
+ { length: 1 + visibleLastPage - visibleFirstPage },
1696
+ (_, i) => visibleFirstPage + i
1697
+ );
1698
+ } else {
1699
+ const start = visibleLastPage - (windowSize - 1) + 2;
1700
+ return [
1701
+ visibleFirstPage,
1702
+ "...",
1703
+ ...Array.from(
1704
+ { length: 1 + visibleLastPage - start },
1705
+ (_, i) => start + i
1706
+ )
1707
+ ];
1708
+ }
1709
+ }, [page, pageCount, windowSize]);
1710
+ (0, import_react21.useDebugValue)(window2);
1711
+ return window2;
1712
+ }
1713
+ var Pager_default = import_react21.default.memo(function Pager({
1714
+ page,
1715
+ pageCount,
1716
+ onChange
1717
+ }) {
1718
+ const window2 = usePagerWindow(page, pageCount);
1719
+ const makeClickHandler = (0, import_react21.useCallback)(
1720
+ (value) => () => {
1721
+ onChange(value);
1722
+ },
1723
+ [onChange]
1724
+ );
1725
+ const hasNext = page < pageCount;
1726
+ const hasPrev = page > 1;
1727
+ return /* @__PURE__ */ import_react21.default.createElement(PagerContainer, null, /* @__PURE__ */ import_react21.default.createElement(
1728
+ CircleButton,
1729
+ {
1730
+ type: "button",
1731
+ hidden: !hasPrev,
1732
+ disabled: !hasPrev,
1733
+ onClick: makeClickHandler(Math.max(1, page - 1)),
1734
+ noBackground: true
1735
+ },
1736
+ /* @__PURE__ */ import_react21.default.createElement(WedgeIcon, { size: 16, direction: "left" /* Left */ })
1737
+ ), window2.map(
1738
+ (p) => p === "..." ? /* @__PURE__ */ import_react21.default.createElement(Spacer, { key: p }, /* @__PURE__ */ import_react21.default.createElement(DotsIcon, { size: 20 })) : p === page ? /* @__PURE__ */ import_react21.default.createElement(CircleButton, { key: p, type: "button", "aria-current": true }, /* @__PURE__ */ import_react21.default.createElement(Text3, null, p)) : /* @__PURE__ */ import_react21.default.createElement(CircleButton, { key: p, type: "button", onClick: makeClickHandler(p) }, /* @__PURE__ */ import_react21.default.createElement(Text3, null, p))
1739
+ ), /* @__PURE__ */ import_react21.default.createElement(
1740
+ CircleButton,
1741
+ {
1742
+ type: "button",
1743
+ hidden: !hasNext,
1744
+ disabled: !hasNext,
1745
+ onClick: makeClickHandler(Math.min(pageCount, page + 1)),
1746
+ noBackground: true
1747
+ },
1748
+ /* @__PURE__ */ import_react21.default.createElement(WedgeIcon, { size: 16, direction: "right" /* Right */ })
1749
+ ));
1750
+ });
1751
+ function LinkPager({ page, pageCount, makeUrl }) {
1752
+ const { Link } = (0, import_react22.useComponentAbstraction)();
1753
+ const window2 = usePagerWindow(page, pageCount);
1754
+ const hasNext = page < pageCount;
1755
+ const hasPrev = page > 1;
1756
+ return /* @__PURE__ */ import_react21.default.createElement(PagerContainer, null, /* @__PURE__ */ import_react21.default.createElement(Link, { to: makeUrl(Math.max(1, page - 1)) }, /* @__PURE__ */ import_react21.default.createElement(CircleButton, { hidden: !hasPrev, "aria-disabled": !hasPrev, noBackground: true }, /* @__PURE__ */ import_react21.default.createElement(WedgeIcon, { size: 16, direction: "left" /* Left */ }))), window2.map(
1757
+ (p) => p === "..." ? /* @__PURE__ */ import_react21.default.createElement(Spacer, { key: p }, /* @__PURE__ */ import_react21.default.createElement(DotsIcon, { size: 20, subLink: true })) : p === page ? /* @__PURE__ */ import_react21.default.createElement(CircleButton, { key: p, type: "button", "aria-current": true }, /* @__PURE__ */ import_react21.default.createElement(Text3, null, p)) : /* @__PURE__ */ import_react21.default.createElement(Link, { key: p, to: makeUrl(p) }, /* @__PURE__ */ import_react21.default.createElement(CircleButton, { type: "button" }, /* @__PURE__ */ import_react21.default.createElement(Text3, null, p)))
1758
+ ), /* @__PURE__ */ import_react21.default.createElement(Link, { to: makeUrl(Math.min(pageCount, page + 1)) }, /* @__PURE__ */ import_react21.default.createElement(CircleButton, { hidden: !hasNext, "aria-disabled": !hasNext, noBackground: true }, /* @__PURE__ */ import_react21.default.createElement(WedgeIcon, { size: 16, direction: "right" /* Right */ }))));
1759
+ }
1760
+ var PagerContainer = import_styled_components17.default.nav`
1761
+ display: flex;
1762
+ justify-content: center;
1763
+ align-items: center;
1764
+ `;
1765
+ var CircleButton = import_styled_components17.default.button`
1766
+ font-size: 1rem;
1767
+ line-height: calc(1em + 8px);
1768
+ text-decoration: none;
1769
+ border: none;
1770
+ outline: none;
1771
+ touch-action: manipulation;
1772
+ user-select: none;
1773
+ transition: box-shadow 0.2s ease 0s, color 0.2s ease 0s,
1774
+ background 0.2s ease 0s, opacity 0.2s ease 0s;
1775
+
1776
+ display: flex;
1777
+ justify-content: center;
1778
+ align-items: center;
1779
+ box-sizing: content-box;
1780
+ min-width: 24px;
1781
+ min-height: 24px;
1782
+ padding: 8px;
1783
+ cursor: pointer;
1784
+ font-weight: bold;
1785
+ /* HACK:
1786
+ * Safari doesn't correctly repaint the elements when they're reordered in response to interaction.
1787
+ * This forces it to repaint them. This doesn't work if put on the parents either, has to be here.
1788
+ */
1789
+ /* stylelint-disable-next-line property-no-vendor-prefix */
1790
+ -webkit-transform: translateZ(0);
1791
+
1792
+ &[hidden] {
1793
+ visibility: hidden;
1794
+ display: block;
1795
+ }
1796
+
1797
+ border-radius: 48px;
1798
+
1799
+ background: transparent;
1800
+ color: ${({ theme: theme2 }) => theme2.color.text3};
1801
+
1802
+ &:hover {
1803
+ background: ${({ theme: theme2 }) => theme2.color.surface3};
1804
+ color: ${({ theme: theme2 }) => theme2.color.text2};
1805
+ }
1806
+
1807
+ &[aria-current] {
1808
+ background-color: ${({ theme: theme2 }) => theme2.color.surface6};
1809
+ color: ${({ theme: theme2 }) => theme2.color.text5};
1810
+ }
1811
+
1812
+ &[aria-current]:hover {
1813
+ background-color: ${({ theme: theme2 }) => theme2.color.surface6};
1814
+ color: ${({ theme: theme2 }) => theme2.color.text5};
1815
+ }
1816
+
1817
+ ${({ noBackground = false }) => noBackground && import_styled_components17.css`
1818
+ /* stylelint-disable-next-line no-duplicate-selectors */
1819
+ &:hover {
1820
+ background: transparent;
1821
+ }
1822
+ `}
1823
+ `;
1824
+ var Spacer = (0, import_styled_components17.default)(CircleButton).attrs({ type: "button", disabled: true })`
1825
+ && {
1826
+ color: ${({ theme: theme2 }) => theme2.color.text3};
1827
+ background: none;
1828
+ }
1829
+ `;
1830
+ var Text3 = "span";
1831
+ // Annotate the CommonJS export names for ESM import in node:
1832
+ 0 && (module.exports = {
1833
+ CancelLayoutItemBodyPadding,
1834
+ Carousel,
1835
+ ComponentAbstraction,
1836
+ Filter,
1837
+ FilterButton,
1838
+ FilterIconButton,
1839
+ FilterLink,
1840
+ HintText,
1841
+ LAYOUT_ITEM_BODY_PADDING,
1842
+ Layout,
1843
+ LayoutItem,
1844
+ LayoutItemBody,
1845
+ LayoutItemHeader,
1846
+ LeftMenu,
1847
+ LeftMenuContent,
1848
+ LinkPager,
1849
+ MAIN_COLUMN_HORIZONTAL_MIN_MARGIN,
1850
+ MenuListItem,
1851
+ MenuListItemContext,
1852
+ MenuListItemWithIcon,
1853
+ MenuListLabel,
1854
+ MenuListLinkItem,
1855
+ MenuListLinkItemWithIcon,
1856
+ MenuListSpacer,
1857
+ Pager,
1858
+ RESPONSIVE_LEFT_WIDTH,
1859
+ RESPONSIVE_MAIN_MAX_WIDTH,
1860
+ StyledCancelLayoutItemBodyPadding,
1861
+ StyledLayoutItemBody,
1862
+ SwitchCheckbox,
1863
+ TextEllipsis,
1864
+ WithIcon,
1865
+ useComponentAbstraction,
1866
+ useElementSize,
1867
+ useLayoutItemBodyPadding,
1868
+ useMedia,
1869
+ useMediaScreen1
1870
+ });
1871
+ //# sourceMappingURL=index.cjs.js.map