@charcoal-ui/react-sandbox 5.0.0-beta.2 → 5.0.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js DELETED
@@ -1,1450 +0,0 @@
1
- "use client";
2
- "use strict";
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __export = (target, all) => {
10
- for (var name in all)
11
- __defProp(target, name, { get: all[name], enumerable: true });
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from))
16
- if (!__hasOwnProp.call(to, key) && key !== except)
17
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
- }
19
- return to;
20
- };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
-
31
- // src/index.ts
32
- var src_exports = {};
33
- __export(src_exports, {
34
- CancelLayoutItemBodyPadding: () => CancelLayoutItemBodyPadding,
35
- Carousel: () => Carousel,
36
- ComponentAbstraction: () => ComponentAbstraction,
37
- Filter: () => Filter_default,
38
- FilterButton: () => FilterButton,
39
- FilterIconButton: () => FilterIconButton,
40
- FilterLink: () => FilterLink,
41
- HintText: () => HintText,
42
- LAYOUT_ITEM_BODY_PADDING: () => LAYOUT_ITEM_BODY_PADDING,
43
- Layout: () => Layout,
44
- LayoutItem: () => LayoutItem,
45
- LayoutItemBody: () => LayoutItemBody,
46
- LayoutItemHeader: () => LayoutItemHeader,
47
- LeftMenu: () => LeftMenu,
48
- LeftMenuContent: () => LeftMenuContent,
49
- LinkPager: () => LinkPager,
50
- MAIN_COLUMN_HORIZONTAL_MIN_MARGIN: () => MAIN_COLUMN_HORIZONTAL_MIN_MARGIN,
51
- MenuListItem: () => MenuListItem,
52
- MenuListItemContext: () => MenuListItemContext,
53
- MenuListItemWithIcon: () => MenuListItemWithIcon,
54
- MenuListLabel: () => MenuListLabel,
55
- MenuListLinkItem: () => MenuListLinkItem,
56
- MenuListLinkItemWithIcon: () => MenuListLinkItemWithIcon,
57
- MenuListSpacer: () => MenuListSpacer,
58
- Pager: () => Pager_default,
59
- RESPONSIVE_LEFT_WIDTH: () => RESPONSIVE_LEFT_WIDTH,
60
- RESPONSIVE_MAIN_MAX_WIDTH: () => RESPONSIVE_MAIN_MAX_WIDTH,
61
- StyledCancelLayoutItemBodyPadding: () => StyledCancelLayoutItemBodyPadding,
62
- StyledLayoutItemBody: () => StyledLayoutItemBody,
63
- SwitchCheckbox: () => SwitchCheckbox_default,
64
- TextEllipsis: () => TextEllipsis,
65
- WithIcon: () => WithIcon_default,
66
- useComponentAbstraction: () => useComponentAbstraction,
67
- useElementSize: () => useElementSize,
68
- useLayoutItemBodyPadding: () => useLayoutItemBodyPadding,
69
- useMedia: () => useMedia,
70
- useMediaScreen1: () => useMediaScreen1
71
- });
72
- module.exports = __toCommonJS(src_exports);
73
-
74
- // src/components/Filter/index.tsx
75
- var React2 = __toESM(require("react"));
76
- var import_styled_components = __toESM(require("styled-components"));
77
- var import_utils = require("@charcoal-ui/utils");
78
-
79
- // src/_lib/ComponentAbstraction.tsx
80
- var import_react = require("react");
81
- var React = __toESM(require("react"));
82
- var import_jsx_runtime = require("react/jsx-runtime");
83
- var DefaultLink = React.forwardRef(function DefaultLink2({
84
- to,
85
- children,
86
- ...rest
87
- }, ref) {
88
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: to, ref, ...rest, children });
89
- });
90
- var DefaultValue = {
91
- Link: DefaultLink
92
- };
93
- var ComponentAbstractionContext = React.createContext(DefaultValue);
94
- function ComponentAbstraction({
95
- children,
96
- components
97
- }) {
98
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ComponentAbstractionContext.Provider, { value: {
99
- ...DefaultValue,
100
- ...components
101
- }, children });
102
- }
103
- function useComponentAbstraction() {
104
- return (0, import_react.useContext)(ComponentAbstractionContext);
105
- }
106
-
107
- // src/components/Filter/index.tsx
108
- var import_jsx_runtime2 = require("react/jsx-runtime");
109
- var FilterButton = React2.forwardRef(function FilterButton2({
110
- onClick,
111
- children,
112
- active = false,
113
- hover,
114
- reactive = false
115
- }, ref) {
116
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ButtonLike, { active, reactive, hover, onClick: active && !reactive ? void 0 : onClick, ref, children });
117
- });
118
- var FilterIconButton = React2.forwardRef(function FilterIconButton2({
119
- onClick,
120
- children,
121
- active = false,
122
- hover,
123
- reactive = false,
124
- width,
125
- height
126
- }, ref) {
127
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(StyledButtonLike, { active, reactive, hover, onClick: active && !reactive ? void 0 : onClick, ref, buttonWidth: width, buttonHeight: height, children });
128
- });
129
- var FilterLink = React2.forwardRef(function FilterLink2({
130
- onClick,
131
- children,
132
- active = false,
133
- hover,
134
- reactive = false,
135
- ...props
136
- }, ref) {
137
- const {
138
- Link
139
- } = useComponentAbstraction();
140
- if (active && !reactive) {
141
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PlainElement, { active: true, hover, ref, children });
142
- } else {
143
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Link, { ...props, onClick, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PlainElement, { active, reactive, hover, ref, children }) });
144
- }
145
- });
146
- var buttonCss = (0, import_styled_components.css)(["display:block;outline:none;border:none;padding:9px 24px;font-size:14px;line-height:22px;font-weight:bold;border-radius:2000px;transition:color 0.2s;color:", ";cursor:pointer;user-select:none;background-color:transparent;&:hover{color:", ";}", " ", " ", " @media ", "{padding:5px 16px;}"], ({
147
- theme: theme2
148
- }) => theme2.color.text3, ({
149
- theme: theme2
150
- }) => theme2.color.text2, ({
151
- hover = false
152
- }) => hover && (0, import_styled_components.css)(["color:", ";"], ({
153
- theme: theme2
154
- }) => theme2.color.text2), ({
155
- active = false
156
- }) => active && (0, import_styled_components.css)(["background-color:", ";color:", ";"], ({
157
- theme: theme2
158
- }) => theme2.color.surface3, ({
159
- theme: theme2
160
- }) => theme2.color.text2), ({
161
- active = false,
162
- reactive = false
163
- }) => active && !reactive && (0, import_styled_components.css)(["cursor:default;"]), ({
164
- theme: theme2
165
- }) => (0, import_utils.maxWidth)(theme2.breakpoint.screen1));
166
- var padding0Css = (0, import_styled_components.css)(["padding:0;@media ", "{padding:0;}"], ({
167
- theme: theme2
168
- }) => (0, import_utils.maxWidth)(theme2.breakpoint.screen1));
169
- var ButtonLike = import_styled_components.default.button.withConfig({
170
- componentId: "ccl__sc-g0cfzt-0"
171
- })(["", ""], buttonCss);
172
- var PlainElement = import_styled_components.default.span.withConfig({
173
- componentId: "ccl__sc-g0cfzt-1"
174
- })(["", ""], buttonCss);
175
- var StyledButtonLike = (0, import_styled_components.default)(ButtonLike).withConfig({
176
- componentId: "ccl__sc-g0cfzt-2"
177
- })(["", ";", " ", ""], padding0Css, (p) => p.buttonWidth !== void 0 && `width: ${p.buttonWidth}px;`, (p) => p.buttonHeight !== void 0 && `height: ${p.buttonHeight}px;`);
178
- var Filter = import_styled_components.default.div.withConfig({
179
- componentId: "ccl__sc-g0cfzt-3"
180
- })(["display:flex;"]);
181
- var Filter_default = Filter;
182
-
183
- // src/components/HintText/index.tsx
184
- var import_styled_components5 = __toESM(require("styled-components"));
185
-
186
- // src/styled.ts
187
- var import_styled_components2 = __toESM(require("styled-components"));
188
- var import_styled = require("@charcoal-ui/styled");
189
- var theme = (0, import_styled.createTheme)(import_styled_components2.default);
190
-
191
- // src/components/icons/InfoIcon.tsx
192
- var import_styled_components4 = __toESM(require("styled-components"));
193
-
194
- // src/components/icons/Base.tsx
195
- var import_styled_components3 = __toESM(require("styled-components"));
196
- var import_jsx_runtime3 = require("react/jsx-runtime");
197
- function IconBase({
198
- size: size3 = 24,
199
- viewBoxSize,
200
- currentColor,
201
- path: path2,
202
- transform,
203
- fillRule,
204
- clipRule
205
- }) {
206
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, { viewBox: `0 0 ${viewBoxSize} ${viewBoxSize}`, size: size3, currentColor, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(IconBasePath, { path: path2, transform, fillRule, clipRule }) });
207
- }
208
- var Icon = import_styled_components3.default.svg.withConfig({
209
- componentId: "ccl__sc-ifc22c-0"
210
- })(["stroke:none;fill:", ";width:", "px;height:", "px;line-height:0;font-size:0;vertical-align:middle;"], ({
211
- currentColor = false,
212
- theme: theme2
213
- }) => currentColor ? "currentColor" : theme2.color.text2, (props) => props.size, (props) => props.size);
214
- var IconBasePath = ({
215
- path: path2,
216
- transform,
217
- fillRule,
218
- clipRule
219
- }) => {
220
- if (typeof path2 === "string") {
221
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: path2, transform, fillRule, clipRule });
222
- } else {
223
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: path2 });
224
- }
225
- };
226
-
227
- // src/components/icons/InfoIcon.tsx
228
- var import_jsx_runtime4 = require("react/jsx-runtime");
229
- var size = 16;
230
- function InfoIcon() {
231
- const path2 = /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
232
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { 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" }),
233
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Path, { 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" })
234
- ] });
235
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IconBase, { viewBoxSize: size, size, currentColor: true, path: path2 });
236
- }
237
- var Path = import_styled_components4.default.path.withConfig({
238
- componentId: "ccl__sc-1yb63qx-0"
239
- })(["fill:", ";fill-rule:evenodd;"], ({
240
- theme: theme2
241
- }) => theme2.color.surface1);
242
-
243
- // src/components/HintText/index.tsx
244
- var import_utils2 = require("@charcoal-ui/utils");
245
- var import_jsx_runtime5 = require("react/jsx-runtime");
246
- function HintText({
247
- children,
248
- context,
249
- className
250
- }) {
251
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Container, { className, ...styledProps({
252
- children,
253
- context,
254
- className
255
- }), children: [
256
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IconWrap, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(InfoIcon, {}) }),
257
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { children })
258
- ] });
259
- }
260
- var Container = import_styled_components5.default.div.withConfig({
261
- componentId: "ccl__sc-nb0aj3-0"
262
- })(["", " @media ", "{", "}display:flex;align-items:flex-start;", ""], (p) => theme((o) => [o.bg.surface3, o.borderRadius(8), o.padding.vertical(p.default.vertical), o.padding.horizontal(p.default.horizontal)]), ({
263
- theme: t
264
- }) => (0, import_utils2.maxWidth)(t.breakpoint.screen1), (p) => theme((o) => [o.padding.vertical(p.screen1.vertical), o.padding.horizontal(p.screen1.horizontal)]), (p) => p.context === "page" && (0, import_styled_components5.css)(["justify-content:center;"]));
265
- var IconWrap = import_styled_components5.default.div.withConfig({
266
- componentId: "ccl__sc-nb0aj3-1"
267
- })(["display:flex;align-items:center;color:", ";height:22px;margin:-4px 4px -4px 0;"], (p) => p.theme.color.text4);
268
- var Text = import_styled_components5.default.p.withConfig({
269
- componentId: "ccl__sc-nb0aj3-2"
270
- })(["", " margin:0;min-width:0;overflow-wrap:break-word;"], theme((o) => [o.font.text2, o.typography(14)]));
271
- function styledProps(props) {
272
- return {
273
- ...props,
274
- ...contextToProps(props.context)
275
- };
276
- }
277
- function contextToProps(context) {
278
- switch (context) {
279
- case "page":
280
- return {
281
- default: {
282
- horizontal: 40,
283
- vertical: 24
284
- },
285
- screen1: {
286
- horizontal: 16,
287
- vertical: 16
288
- }
289
- };
290
- case "section":
291
- return {
292
- default: {
293
- horizontal: 16,
294
- vertical: 16
295
- },
296
- screen1: {
297
- horizontal: 16,
298
- vertical: 16
299
- }
300
- };
301
- }
302
- }
303
-
304
- // src/components/Layout/index.tsx
305
- var import_react3 = require("react");
306
- var React3 = __toESM(require("react"));
307
- var import_styled_components7 = __toESM(require("styled-components"));
308
-
309
- // src/foundation/constants.ts
310
- var import_foundation = require("@charcoal-ui/foundation");
311
- var MAIN_COLUMN_HORIZONTAL_MIN_MARGIN = 72;
312
- var RESPONSIVE_LEFT_WIDTH = (0, import_foundation.columnSystem)(2, import_foundation.COLUMN_UNIT, import_foundation.GUTTER_UNIT) + import_foundation.GUTTER_UNIT;
313
- var RESPONSIVE_MAIN_MAX_WIDTH = (0, import_foundation.columnSystem)(12, import_foundation.COLUMN_UNIT, import_foundation.GUTTER_UNIT);
314
-
315
- // src/foundation/hooks.ts
316
- var import_react2 = require("react");
317
- var import_react_dom = __toESM(require("react-dom"));
318
- var import_styled_components6 = require("styled-components");
319
- var import_utils3 = require("@charcoal-ui/utils");
320
- function useMediaScreen1() {
321
- return useMedia((0, import_utils3.maxWidth)((0, import_styled_components6.useTheme)().breakpoint.screen1));
322
- }
323
- function useMedia(query) {
324
- const matcher = (0, import_react2.useMemo)(() => __TEST__ ? {
325
- matches: false,
326
- addListener: () => {
327
- },
328
- removeListener: () => {
329
- }
330
- } : matchMedia(query), [query]);
331
- const [matches, setMatches] = (0, import_react2.useState)(matcher.matches);
332
- if (matcher.matches !== matches) {
333
- setMatches(matcher.matches);
334
- }
335
- const callback = (e) => {
336
- try {
337
- import_react_dom.default.flushSync(() => {
338
- setMatches(e.matches);
339
- });
340
- } catch {
341
- setMatches(e.matches);
342
- }
343
- };
344
- (0, import_react2.useLayoutEffect)(() => {
345
- matcher.addListener(callback);
346
- setMatches(matcher.matches);
347
- return () => {
348
- matcher.removeListener(callback);
349
- };
350
- }, [matcher]);
351
- (0, import_react2.useDebugValue)(`${query}: ${matches.toString()}`);
352
- return matches;
353
- }
354
- function measure(ref) {
355
- return ref !== null ? ref.getBoundingClientRect() : void 0;
356
- }
357
- function useElementSize(ref, deps = []) {
358
- const [size3, setSize] = (0, import_react2.useReducer)((state, next) => {
359
- if (state === void 0 || next === void 0) {
360
- return next;
361
- }
362
- if (state.height === next.height && state.width === next.width) {
363
- return state;
364
- }
365
- return next;
366
- }, void 0);
367
- const [watch, setWatch] = (0, import_react2.useState)(null);
368
- (0, import_react2.useLayoutEffect)(() => {
369
- if (watch === null) {
370
- return;
371
- }
372
- const observer = new ResizeObserver(() => {
373
- const newSize = measure(watch);
374
- setSize(newSize);
375
- });
376
- observer.observe(watch);
377
- return () => {
378
- observer.unobserve(watch);
379
- setSize(void 0);
380
- };
381
- }, [watch]);
382
- (0, import_react2.useLayoutEffect)(() => {
383
- if (ref.current !== watch) {
384
- setWatch(ref.current);
385
- }
386
- });
387
- (0, import_react2.useLayoutEffect)(() => {
388
- if (deps.length > 0) {
389
- setSize(measure(ref.current));
390
- }
391
- }, deps);
392
- (0, import_react2.useDebugValue)(size3);
393
- return size3;
394
- }
395
- function useDebounceAnimationState(defaultValue) {
396
- const [state, setState] = (0, import_react2.useState)(defaultValue);
397
- const timer = (0, import_react2.useRef)(void 0);
398
- const setDebounceState = (0, import_react2.useCallback)((value, force = false) => {
399
- if (force) {
400
- setState(value);
401
- return;
402
- }
403
- if (timer.current !== void 0) {
404
- return;
405
- }
406
- timer.current = requestAnimationFrame(() => {
407
- setState(value);
408
- if (timer.current !== void 0) {
409
- timer.current = void 0;
410
- }
411
- });
412
- }, []);
413
- return [state, setDebounceState];
414
- }
415
-
416
- // src/components/Layout/index.tsx
417
- var import_foundation2 = require("@charcoal-ui/foundation");
418
- var import_utils4 = require("@charcoal-ui/utils");
419
- var import_jsx_runtime6 = require("react/jsx-runtime");
420
- var LayoutConfigContext = React3.createContext({
421
- wide: false,
422
- center: false,
423
- withLeft: false
424
- });
425
- function Layout({
426
- menu,
427
- children,
428
- header,
429
- center = false,
430
- wide,
431
- isHeaderTopMenu = false
432
- }) {
433
- const config = {
434
- center,
435
- wide: center ? true : wide ?? false,
436
- withLeft: menu != null && !isHeaderTopMenu
437
- };
438
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(LayoutRoot, { children: [
439
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(LayoutConfigContext.Provider, { value: config, children: [
440
- config.withLeft && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(LeftArea, { children: menu }),
441
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(MainArea, { center, children: [
442
- header != null && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Header, { children: header }),
443
- isHeaderTopMenu && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(HeaderTopMenuContainer, { children: menu }),
444
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Grid, { children })
445
- ] })
446
- ] }),
447
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(GlobalStyle, {})
448
- ] });
449
- }
450
- var HeaderTopMenuContainer = import_styled_components7.default.div.withConfig({
451
- componentId: "ccl__sc-j6bt5m-0"
452
- })(["margin-bottom:40px;overflow-x:auto;word-break:keep-all;@media ", "{margin-bottom:0;padding-left:16px;padding-bottom:16px;background-color:", ";}"], ({
453
- theme: theme2
454
- }) => (0, import_utils4.maxWidth)(theme2.breakpoint.screen1), ({
455
- theme: theme2
456
- }) => theme2.color.surface2);
457
- var GlobalStyle = (0, import_styled_components7.createGlobalStyle)([":root{background-color:", ";@media ", "{background-color:", ";}}"], ({
458
- theme: theme2
459
- }) => theme2.color.background2, ({
460
- theme: theme2
461
- }) => (0, import_utils4.maxWidth)(theme2.breakpoint.screen1), ({
462
- theme: theme2
463
- }) => theme2.color.background1);
464
- var LayoutRoot = import_styled_components7.default.div.withConfig({
465
- componentId: "ccl__sc-j6bt5m-1"
466
- })(["display:flex;background-color:", ";@media ", "{background-color:", ";}"], ({
467
- theme: theme2
468
- }) => theme2.color.background2, ({
469
- theme: theme2
470
- }) => (0, import_utils4.maxWidth)(theme2.breakpoint.screen1), ({
471
- theme: theme2
472
- }) => theme2.color.background1);
473
- var LeftArea = import_styled_components7.default.div.withConfig({
474
- componentId: "ccl__sc-j6bt5m-2"
475
- })(["min-width:", "px;padding:40px 0 40px ", "px;box-sizing:border-box;@media ", "{display:none;}"], RESPONSIVE_LEFT_WIDTH, import_foundation2.GUTTER_UNIT, ({
476
- theme: theme2
477
- }) => theme2.breakpoint.screen3);
478
- var MainArea = import_styled_components7.default.div.withConfig({
479
- componentId: "ccl__sc-j6bt5m-3"
480
- })(["flex-grow:1;min-width:0;max-width:", "px;padding:40px ", "px;margin:0 auto;display:flex;flex-direction:column;@media ", "{padding:0;}"], (p) => p.center ? (0, import_foundation2.columnSystem)(6, import_foundation2.COLUMN_UNIT, import_foundation2.GUTTER_UNIT) : RESPONSIVE_MAIN_MAX_WIDTH, MAIN_COLUMN_HORIZONTAL_MIN_MARGIN, ({
481
- theme: theme2
482
- }) => (0, import_utils4.maxWidth)(theme2.breakpoint.screen1));
483
- var Header = import_styled_components7.default.div.withConfig({
484
- componentId: "ccl__sc-j6bt5m-4"
485
- })(["font-weight:bold;margin-bottom:12px;font-size:20px;line-height:28px;color:", ";@media ", "{margin-bottom:0;padding:12px;font-size:16px;line-height:24px;display:flex;justify-content:center;background-color:", ";}"], ({
486
- theme: theme2
487
- }) => theme2.color.text2, ({
488
- theme: theme2
489
- }) => (0, import_utils4.maxWidth)(theme2.breakpoint.screen1), ({
490
- theme: theme2
491
- }) => theme2.color.surface2);
492
- var Grid = import_styled_components7.default.div.withConfig({
493
- componentId: "ccl__sc-j6bt5m-5"
494
- })(["display:grid;gap:", "px;grid-template-columns:1fr;grid-auto-columns:1fr;grid-auto-rows:auto;@media ", "{gap:0;background-color:", ";padding-bottom:60px;}"], import_foundation2.GUTTER_UNIT, ({
495
- theme: theme2
496
- }) => (0, import_utils4.maxWidth)(theme2.breakpoint.screen1), ({
497
- theme: theme2
498
- }) => theme2.color.background1);
499
- var LayoutItem = React3.forwardRef(function LayoutItem2({
500
- span,
501
- children
502
- }, ref) {
503
- const {
504
- withLeft
505
- } = (0, import_react3.useContext)(LayoutConfigContext);
506
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(StyledLayoutItem, { span, withLeft, ref, children });
507
- });
508
- var StyledLayoutItem = import_styled_components7.default.div.withConfig({
509
- componentId: "ccl__sc-j6bt5m-6"
510
- })(["grid-column-start:auto;grid-column-end:span ", ";border-radius:24px;color:", ";background-color:", ";min-width:0;@media ", "{", "}@media ", "{", " border-radius:0;padding-bottom:40px;}"], (p) => p.span, ({
511
- theme: theme2
512
- }) => theme2.color.text2, ({
513
- theme: theme2
514
- }) => theme2.color.background1, (p) => p.withLeft ? p.theme.breakpoint.screen4 : p.theme.breakpoint.screen3, (p) => p.span > 2 && (0, import_styled_components7.css)(["grid-column-end:span 2;"]), ({
515
- theme: theme2
516
- }) => (0, import_utils4.maxWidth)(theme2.breakpoint.screen1), (p) => p.span > 1 && (0, import_styled_components7.css)(["grid-column-end:span 1;"]));
517
- function LayoutItemHeader({
518
- children
519
- }) {
520
- const {
521
- wide,
522
- center
523
- } = (0, import_react3.useContext)(LayoutConfigContext);
524
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(StyledLayoutItemHeader, { wide, center, children });
525
- }
526
- var StyledLayoutItemHeader = import_styled_components7.default.div.withConfig({
527
- componentId: "ccl__sc-j6bt5m-7"
528
- })(["padding:0 ", "px;height:", "px;display:grid;align-items:center;font-size:16px;line-height:24px;font-weight:bold;background-color:", ";color:", ";border-radius:24px 24px 0 0;", " @media ", "{margin-top:4px;padding:0 16px;background:none;overflow-x:auto;border-radius:unset;", "}"], (p) => p.wide ? 40 : 24, (p) => p.wide ? 64 : 48, ({
529
- theme: theme2
530
- }) => theme2.color.surface2, ({
531
- theme: theme2
532
- }) => theme2.color.text2, (p) => p.center && (0, import_styled_components7.css)(["justify-content:center;"]), ({
533
- theme: theme2
534
- }) => (0, import_utils4.maxWidth)(theme2.breakpoint.screen1), (p) => p.wide && (0, import_styled_components7.css)(["height:48px;margin-top:0;"]));
535
- var LAYOUT_ITEM_BODY_PADDING = {
536
- wide: {
537
- x: 40,
538
- y: 40
539
- },
540
- default: {
541
- x: 24,
542
- y: 24
543
- },
544
- column1: {
545
- x: 16,
546
- y: 16
547
- },
548
- narrow: {
549
- x: 24,
550
- yTop: 12,
551
- yBottom: 20
552
- },
553
- narrowColumn1: {
554
- x: 16,
555
- yTop: 4,
556
- yBottom: 0
557
- }
558
- };
559
- function LayoutItemBody({
560
- children,
561
- horizontal = false,
562
- narrow = false
563
- }) {
564
- const {
565
- wide
566
- } = (0, import_react3.useContext)(LayoutConfigContext);
567
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(StyledLayoutItemBody, { wide, horizontal, narrow, children });
568
- }
569
- var StyledLayoutItemBody = import_styled_components7.default.div.withConfig({
570
- componentId: "ccl__sc-j6bt5m-8"
571
- })(["padding:", ";@media ", "{padding:", ";}width:100%;box-sizing:border-box;"], (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`, ({
572
- theme: theme2
573
- }) => (0, import_utils4.maxWidth)(theme2.breakpoint.screen1), (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}`);
574
- function useLayoutItemBodyPadding() {
575
- const {
576
- wide
577
- } = (0, import_react3.useContext)(LayoutConfigContext);
578
- return useMediaScreen1() ? LAYOUT_ITEM_BODY_PADDING.column1 : wide ? LAYOUT_ITEM_BODY_PADDING.wide : LAYOUT_ITEM_BODY_PADDING.default;
579
- }
580
- function CancelLayoutItemBodyPadding({
581
- children,
582
- cancelTop
583
- }) {
584
- const {
585
- wide
586
- } = (0, import_react3.useContext)(LayoutConfigContext);
587
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(StyledCancelLayoutItemBodyPadding, { wide, cancelTop, children });
588
- }
589
- var StyledCancelLayoutItemBodyPadding = import_styled_components7.default.div.withConfig({
590
- componentId: "ccl__sc-j6bt5m-9"
591
- })(["margin:0 -", "px;margin-top:-", "px;@media ", "{margin:0 -", "px;margin-top:-", "px;}"], (p) => p.wide ? LAYOUT_ITEM_BODY_PADDING.wide.x : LAYOUT_ITEM_BODY_PADDING.default.x, ({
592
- cancelTop = false,
593
- wide
594
- }) => !cancelTop ? 0 : wide ? LAYOUT_ITEM_BODY_PADDING.wide.y : LAYOUT_ITEM_BODY_PADDING.default.y, ({
595
- theme: theme2
596
- }) => (0, import_utils4.maxWidth)(theme2.breakpoint.screen1), LAYOUT_ITEM_BODY_PADDING.column1.x, ({
597
- cancelTop = false
598
- }) => !cancelTop ? 0 : LAYOUT_ITEM_BODY_PADDING.column1.x);
599
-
600
- // src/components/LeftMenu/index.tsx
601
- var import_styled_components10 = __toESM(require("styled-components"));
602
-
603
- // src/components/MenuListItem/index.tsx
604
- var import_react5 = require("react");
605
- var React4 = __toESM(require("react"));
606
- var import_styled_components9 = __toESM(require("styled-components"));
607
-
608
- // src/components/TextEllipsis/index.tsx
609
- var import_styled_components8 = __toESM(require("styled-components"));
610
-
611
- // src/components/TextEllipsis/helper.ts
612
- var import_react4 = require("react");
613
- var hasChildren = (element) => (0, import_react4.isValidElement)(element) && Boolean(element.props.children);
614
- var childToString = (child) => {
615
- if (typeof child === "undefined" || child === null || typeof child === "boolean") {
616
- return "";
617
- }
618
- if (JSON.stringify(child) === "{}") {
619
- return "";
620
- }
621
- return child.toString();
622
- };
623
- var onlyText = (children) => {
624
- if (!Array.isArray(children) && !(0, import_react4.isValidElement)(children)) {
625
- return childToString(children);
626
- }
627
- return import_react4.Children.toArray(children).reduce((text, child) => {
628
- let newText = "";
629
- if ((0, import_react4.isValidElement)(child) && hasChildren(child)) {
630
- newText = onlyText(child.props.children);
631
- } else if ((0, import_react4.isValidElement)(child) && !hasChildren(child)) {
632
- newText = "";
633
- } else {
634
- newText = childToString(child);
635
- }
636
- return text.concat(newText);
637
- }, "");
638
- };
639
-
640
- // src/components/TextEllipsis/index.tsx
641
- var TextEllipsis = import_styled_components8.default.div.attrs(({
642
- children,
643
- title = onlyText(children)
644
- }) => ({
645
- title: title !== "" ? title : void 0
646
- })).withConfig({
647
- componentId: "ccl__sc-1pyqrbe-0"
648
- })(["overflow:hidden;line-height:", "px;overflow-wrap:break-word;", ""], (props) => props.lineHeight, ({
649
- lineLimit = 1,
650
- lineHeight
651
- }) => lineLimit === 1 ? (0, import_styled_components8.css)(["text-overflow:ellipsis;white-space:nowrap;"]) : (0, import_styled_components8.css)(["display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:", ";max-height:", "px;"], lineLimit, lineHeight * lineLimit));
652
-
653
- // src/components/MenuListItem/index.tsx
654
- var import_utils5 = require("@charcoal-ui/utils");
655
- var import_jsx_runtime7 = require("react/jsx-runtime");
656
- var MenuListItemContext = React4.createContext({
657
- padding: 24
658
- });
659
- function MenuListItem({
660
- primary,
661
- secondary,
662
- onClick,
663
- disabled = false,
664
- noHover = false,
665
- gtmClass,
666
- children
667
- }) {
668
- const {
669
- padding
670
- } = (0, import_react5.useContext)(MenuListItemContext);
671
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Item, { hasSubLabel: secondary !== void 0, onClick: (e) => !disabled && onClick && onClick(e), sidePadding: padding, noHover, noClick: onClick === void 0, "aria-disabled": disabled, role: onClick !== void 0 ? "button" : void 0, className: gtmClass !== void 0 ? `gtm-${gtmClass}` : void 0, children: [
672
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Labels, { children: [
673
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PrimaryText, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TextEllipsis, { lineHeight: 22, lineLimit: 1, children: primary }) }),
674
- secondary !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SecondaryText, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TextEllipsis, { lineHeight: 22, lineLimit: 1, children: secondary }) })
675
- ] }),
676
- children
677
- ] });
678
- }
679
- var Item = import_styled_components9.default.div.withConfig({
680
- componentId: "ccl__sc-1sufjh-0"
681
- })(["display:flex;height:", "px;align-items:center;justify-content:space-between;padding:0 ", "px;user-select:none;cursor:", ";transition:0.2s background-color;&:hover{", "}", " ", "{cursor:default;pointer-events:none;&:hover{background-color:unset;}}"], (p) => p.hasSubLabel ? 56 : 40, (p) => p.sidePadding, (p) => p.noClick ? "default" : "pointer", (p) => !p.noHover && (0, import_styled_components9.css)(["background-color:", ";"], ({
682
- theme: theme2
683
- }) => theme2.color.surface3), theme((o) => o.disabled), import_utils5.disabledSelector);
684
- var Labels = import_styled_components9.default.div.withConfig({
685
- componentId: "ccl__sc-1sufjh-1"
686
- })(["display:flex;flex-direction:column;"]);
687
- var PrimaryText = import_styled_components9.default.div.withConfig({
688
- componentId: "ccl__sc-1sufjh-2"
689
- })(["color:", ";line-height:22px;font-size:14px;display:grid;"], (p) => p.theme.color.text2);
690
- var SecondaryText = import_styled_components9.default.div.withConfig({
691
- componentId: "ccl__sc-1sufjh-3"
692
- })(["color:", ";line-height:18px;font-size:10px;"], (p) => p.theme.color.text3);
693
- function MenuListLinkItem({
694
- link,
695
- onClick,
696
- disabled = false,
697
- primary,
698
- secondary,
699
- gtmClass,
700
- noHover,
701
- children,
702
- ...linkProps
703
- }) {
704
- const {
705
- Link
706
- } = useComponentAbstraction();
707
- const props = {
708
- disabled,
709
- primary,
710
- secondary,
711
- gtmClass,
712
- noHover,
713
- children
714
- };
715
- return disabled ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { onClick, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MenuListItem, { ...props }) }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(A, { as: Link, to: link, onClick, ...linkProps, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MenuListItem, { onClick: () => void 0, ...props }) });
716
- }
717
- var A = import_styled_components9.default.a.withConfig({
718
- componentId: "ccl__sc-1sufjh-4"
719
- })(["display:block;"]);
720
- function MenuListLinkItemWithIcon({
721
- icon,
722
- primary: text,
723
- ...props
724
- }) {
725
- const primary = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(IconContainer, { children: [
726
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon2, { children: icon }),
727
- text
728
- ] });
729
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MenuListLinkItem, { primary, ...props });
730
- }
731
- function MenuListItemWithIcon({
732
- icon,
733
- primary: text,
734
- ...props
735
- }) {
736
- const primary = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(IconContainer, { children: [
737
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon2, { children: icon }),
738
- text
739
- ] });
740
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MenuListItem, { primary, ...props });
741
- }
742
- var IconContainer = import_styled_components9.default.div.withConfig({
743
- componentId: "ccl__sc-1sufjh-5"
744
- })(["display:grid;gap:8px;grid-auto-flow:column;align-items:center;"]);
745
- var Icon2 = import_styled_components9.default.div.withConfig({
746
- componentId: "ccl__sc-1sufjh-6"
747
- })(["color:", ";display:flex;"], ({
748
- theme: theme2
749
- }) => theme2.color.text3);
750
- var MenuListSpacer = import_styled_components9.default.div.withConfig({
751
- componentId: "ccl__sc-1sufjh-7"
752
- })(["height:24px;"]);
753
- var MenuListLabel = import_styled_components9.default.div.withConfig({
754
- componentId: "ccl__sc-1sufjh-8"
755
- })(["padding:0 16px;font-size:12px;line-height:16px;color:", ";margin-top:-2px;margin-bottom:6px;"], ({
756
- theme: theme2
757
- }) => theme2.color.text3);
758
-
759
- // src/components/LeftMenu/index.tsx
760
- var import_jsx_runtime8 = require("react/jsx-runtime");
761
- function LeftMenu({
762
- links,
763
- active
764
- }) {
765
- const {
766
- Link
767
- } = useComponentAbstraction();
768
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Container2, { children: links.map((link, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Link, { to: link.to, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(LinkItem, { "aria-current": link.id === active || void 0, children: link.text }) }, index)) });
769
- }
770
- function LeftMenuContent({
771
- links
772
- }) {
773
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: links.map((link, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MenuListLinkItem, { link: link.to, primary: link.text }, index)) });
774
- }
775
- var Container2 = import_styled_components10.default.div.withConfig({
776
- componentId: "ccl__sc-t7vwxn-0"
777
- })(["display:flex;flex-direction:column;align-items:flex-start;"]);
778
- var LinkItem = import_styled_components10.default.div.withConfig({
779
- componentId: "ccl__sc-t7vwxn-1"
780
- })(["display:flex;align-items:center;color:", ";border-radius:24px;font-weight:bold;font-size:14px;line-height:22px;padding:0 16px;height:40px;transition:0.2s color;&:hover{transition:0.2s color;color:", ";}&[aria-current]{color:", ";background-color:", ";}"], ({
781
- theme: theme2
782
- }) => theme2.color.text3, ({
783
- theme: theme2
784
- }) => theme2.color.text2, ({
785
- theme: theme2
786
- }) => theme2.color.text2, ({
787
- theme: theme2
788
- }) => theme2.color.surface3);
789
-
790
- // src/components/SwitchCheckbox/index.tsx
791
- var React5 = __toESM(require("react"));
792
- var import_styled_components11 = __toESM(require("styled-components"));
793
- var import_utils6 = require("@charcoal-ui/utils");
794
- var import_jsx_runtime9 = require("react/jsx-runtime");
795
- var SwitchCheckbox_default = React5.forwardRef(function SwitchCheckbox({
796
- gtmClass,
797
- flex = false,
798
- rowReverse = false,
799
- children,
800
- disabled,
801
- ...props
802
- }, ref) {
803
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Label, { className: gtmClass !== void 0 ? `gtm-${gtmClass}` : "", flex, rowReverse, "aria-disabled": disabled, children: [
804
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(SwitchOuter, { children: [
805
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SwitchInput, { ...props, disabled, ref }),
806
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SwitchInner, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SwitchInnerKnob, {}) })
807
- ] }),
808
- children != null && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Children2, { rowReverse, children })
809
- ] });
810
- });
811
- var Children2 = import_styled_components11.default.span.withConfig({
812
- componentId: "ccl__sc-vg0z5k-0"
813
- })(["", ""], (p) => p.rowReverse ? (0, import_styled_components11.css)(["margin-right:8px;"]) : (0, import_styled_components11.css)(["margin-left:8px;"]));
814
- var Label = import_styled_components11.default.label.withConfig({
815
- componentId: "ccl__sc-vg0z5k-1"
816
- })(["display:inline-flex;align-items:center;", " ", " cursor:pointer;outline:0;&[aria-disabled='true']{cursor:auto;}"], ({
817
- flex
818
- }) => flex && (0, import_styled_components11.css)(["display:flex;justify-content:space-between;"]), ({
819
- rowReverse
820
- }) => (0, import_styled_components11.css)(["flex-direction:", ";"], rowReverse ? "row-reverse" : "row"));
821
- var SwitchOuter = import_styled_components11.default.span.withConfig({
822
- componentId: "ccl__sc-vg0z5k-2"
823
- })(["display:inline-flex;position:relative;z-index:0;"]);
824
- var SwitchInner = import_styled_components11.default.div.withConfig({
825
- componentId: "ccl__sc-vg0z5k-3"
826
- })(["position:relative;box-sizing:border-box;width:28px;height:16px;border-radius:16px;border:2px solid transparent;background:", ";transition:box-shadow 0.2s,background-color 0.2s;"], ({
827
- theme: theme2
828
- }) => theme2.color.text4);
829
- var SwitchInnerKnob = import_styled_components11.default.div.withConfig({
830
- componentId: "ccl__sc-vg0z5k-4"
831
- })(["position:absolute;display:block;top:0;left:0;width:12px;height:12px;background-color:", ";border-radius:50%;transform:translateX(0);transition:transform 0.2s;"], ({
832
- theme: theme2
833
- }) => theme2.color.text5);
834
- var SwitchInput = import_styled_components11.default.input.attrs({
835
- type: "checkbox"
836
- }).withConfig({
837
- componentId: "ccl__sc-vg0z5k-5"
838
- })(["position:absolute;z-index:1;top:0;left:0;width:100%;height:100%;border-radius:16px;opacity:0;appearance:none;outline:none;cursor:pointer;&:checked{~ ", "{background-color:", ";", "{transform:translateX(12px);}}}&:disabled{cursor:auto;~ ", "{opacity:", ";}}&:not(:disabled):focus{~ ", "{box-shadow:0 0 0 4px ", ";}}"], SwitchInner, ({
839
- theme: theme2
840
- }) => theme2.color.brand, SwitchInnerKnob, SwitchInner, ({
841
- theme: theme2
842
- }) => theme2.elementEffect.disabled.opacity, SwitchInner, ({
843
- theme: theme2
844
- }) => (0, import_utils6.applyEffect)(theme2.color.brand, theme2.elementEffect.disabled));
845
-
846
- // src/components/WithIcon/index.tsx
847
- var import_react6 = require("react");
848
- var React6 = __toESM(require("react"));
849
- var import_styled_components12 = __toESM(require("styled-components"));
850
- var import_jsx_runtime10 = require("react/jsx-runtime");
851
- var WithIcon_default = React6.memo(function WithIcon({
852
- children,
853
- icon,
854
- show = true,
855
- prefix: pre = false,
856
- width,
857
- fit = false,
858
- fixed = false
859
- }) {
860
- const node = fit ? width === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(AutoWidthIconAnchor, { show, pre, children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(IconAnchor, { width, show, pre, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon3, { children: icon }) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(IconAnchorNaive, { show, pre, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(IconNaive, { children: icon }) });
861
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Root, { children: [
862
- pre && node,
863
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text2, { fixed, children }),
864
- !pre && node
865
- ] });
866
- });
867
- var Root = import_styled_components12.default.div.withConfig({
868
- componentId: "ccl__sc-12w6fz6-0"
869
- })(["display:flex;align-items:center;"]);
870
- var Text2 = import_styled_components12.default.div.withConfig({
871
- componentId: "ccl__sc-12w6fz6-1"
872
- })(["", " white-space:nowrap;text-overflow:ellipsis;"], (p) => !p.fixed && (0, import_styled_components12.css)(["min-width:0;overflow:hidden;"]));
873
- function AutoWidthIconAnchor({
874
- children,
875
- show,
876
- pre
877
- }) {
878
- const ref = (0, import_react6.useRef)(null);
879
- const width = useElementSize(ref, [null])?.width ?? 0;
880
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(IconAnchor, { width, show, pre, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon3, { ref, children }) });
881
- }
882
- var forceCenteringCss = (0, import_styled_components12.css)(["> svg{display:block;}"]);
883
- var iconAnchorCss = (0, import_styled_components12.css)(["", ";", ""], (p) => p.show === "collapse" ? (0, import_styled_components12.css)(["display:none;"]) : (0, import_styled_components12.css)(["visibility:", ";"], p.show ? "visible" : "hidden"), (p) => p.pre ? (0, import_styled_components12.css)(["margin-right:4px;"]) : (0, import_styled_components12.css)(["margin-left:4px;"]));
884
- var IconAnchorNaive = import_styled_components12.default.div.withConfig({
885
- componentId: "ccl__sc-12w6fz6-2"
886
- })(["display:flex;align-items:center;", ""], iconAnchorCss);
887
- var IconNaive = import_styled_components12.default.div.withConfig({
888
- componentId: "ccl__sc-12w6fz6-3"
889
- })(["display:inline-flex;", ""], forceCenteringCss);
890
- var IconAnchor = import_styled_components12.default.div.withConfig({
891
- componentId: "ccl__sc-12w6fz6-4"
892
- })(["display:flex;position:relative;height:0;width:", "px;", ""], (p) => p.width, iconAnchorCss);
893
- var Icon3 = import_styled_components12.default.div.withConfig({
894
- componentId: "ccl__sc-12w6fz6-5"
895
- })(["display:inline-flex;position:absolute;transform:translateY(-50%);", ""], forceCenteringCss);
896
-
897
- // src/components/Carousel/index.tsx
898
- var import_react8 = require("react");
899
- var import_react_spring = require("react-spring");
900
- var import_styled_components14 = __toESM(require("styled-components"));
901
-
902
- // src/foundation/support.ts
903
- var passiveEventsResult;
904
- function passiveEvents() {
905
- if (passiveEventsResult !== void 0) {
906
- return passiveEventsResult;
907
- }
908
- passiveEventsResult = false;
909
- try {
910
- const options = Object.defineProperty({}, "passive", {
911
- get() {
912
- return passiveEventsResult = true;
913
- }
914
- });
915
- window.addEventListener("test", test, options);
916
- window.removeEventListener("test", test);
917
- } catch {
918
- }
919
- return passiveEventsResult;
920
- function test() {
921
- }
922
- }
923
- var isEdge = () => navigator.userAgent.includes("Edge/");
924
-
925
- // src/hooks/index.ts
926
- var import_react7 = require("react");
927
- var useIsomorphicLayoutEffect = typeof window !== "undefined" ? import_react7.useLayoutEffect : import_react7.useEffect;
928
-
929
- // src/components/CarouselButton/index.tsx
930
- var import_styled_components13 = __toESM(require("styled-components"));
931
-
932
- // src/foundation/utils.ts
933
- function unreachable(value) {
934
- throw new Error(arguments.length === 0 ? "unreachable" : `unreachable (${JSON.stringify(value)})`);
935
- }
936
-
937
- // src/components/icons/NextIcon.tsx
938
- var import_jsx_runtime11 = require("react/jsx-runtime");
939
- 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`;
940
- var size2 = 24;
941
- function NextIcon({
942
- direction
943
- }) {
944
- const transform = directionToTransform(direction);
945
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(IconBase, { viewBoxSize: size2, size: size2, currentColor: true, path, transform });
946
- }
947
- function directionToTransform(direction) {
948
- switch (direction) {
949
- case "up" /* Up */:
950
- return "rotate(270 12 12)";
951
- case "down" /* Down */:
952
- return "rotate(90 12 12)";
953
- case "left" /* Left */:
954
- return "rotate(180 12 12)";
955
- case "right" /* Right */:
956
- return void 0;
957
- default:
958
- return unreachable(direction);
959
- }
960
- }
961
-
962
- // src/components/CarouselButton/index.tsx
963
- var import_utils9 = require("@charcoal-ui/utils");
964
- var import_jsx_runtime12 = require("react/jsx-runtime");
965
- function CarouselButton({
966
- direction,
967
- show,
968
- offset = 0,
969
- padding = 0,
970
- bottomOffset: bottom = 0,
971
- gradient = false,
972
- onClick
973
- }) {
974
- const offsetStyle = direction === "left" /* Left */ ? {
975
- left: gradient ? offset - 72 : offset,
976
- paddingLeft: Math.max(padding, 0),
977
- paddingBottom: bottom
978
- } : {
979
- right: gradient ? offset - 72 : offset,
980
- paddingRight: Math.max(padding, 0),
981
- paddingBottom: bottom
982
- };
983
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(_StyledButton, { type: "button", onClick, hide: !show, style: offsetStyle, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CarouselButtonIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(NextIcon, { direction: direction === "right" /* Right */ ? "right" /* Right */ : (
984
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
985
- direction === "left" /* Left */ ? "left" /* Left */ : unreachable()
986
- ) }) }) });
987
- }
988
- var CAROUSEL_BUTTON_SIZE = 40;
989
- var CarouselButtonIcon = import_styled_components13.default.div`
990
- display: flex;
991
- align-items: center;
992
- justify-content: center;
993
- width: ${CAROUSEL_BUTTON_SIZE}px;
994
- height: ${CAROUSEL_BUTTON_SIZE}px;
995
- border-radius: 50%;
996
- background-color: ${({
997
- theme: theme2
998
- }) => theme2.color.surface4};
999
- transition: 0.4s visibility, 0.4s opacity, 0.2s background-color, 0.2s color;
1000
- color: ${({
1001
- theme: theme2
1002
- }) => theme2.color.text5};
1003
- `;
1004
- var Button = import_styled_components13.default.button`
1005
- position: absolute;
1006
- top: 0;
1007
- bottom: 0;
1008
- display: flex;
1009
- align-items: center;
1010
- padding: 0;
1011
- min-width: 40px;
1012
- border: none;
1013
- outline: 0;
1014
- background: transparent;
1015
- cursor: pointer;
1016
- transition: 0.4s visibility, 0.4s opacity;
1017
- /* つらい */
1018
- /* このコンポーネントはCarouselでしか使われてないのでそっちでコンテキストで切る */
1019
- z-index: 1;
1020
-
1021
- &:hover ${CarouselButtonIcon} {
1022
- background-color: ${({
1023
- theme: theme2
1024
- }) => (0, import_utils9.applyEffect)(theme2.color.surface4, theme2.effect.hover)};
1025
- color: ${({
1026
- theme: theme2
1027
- }) => (0, import_utils9.applyEffect)(theme2.color.text5, theme2.effect.hover)};
1028
- }
1029
-
1030
- &:active ${CarouselButtonIcon} {
1031
- background-color: ${({
1032
- theme: theme2
1033
- }) => (0, import_utils9.applyEffect)(theme2.color.surface4, theme2.effect.press)};
1034
- color: ${({
1035
- theme: theme2
1036
- }) => (0, import_utils9.applyEffect)(theme2.color.text5, theme2.effect.press)};
1037
- }
1038
-
1039
- ${(p) => p.hide && (0, import_styled_components13.css)(["visibility:hidden;opacity:0;pointer-events:none;"])}
1040
- `;
1041
- var _StyledButton = (0, import_styled_components13.default)(Button).withConfig({
1042
- componentId: "ccl__sc-gjlnt0-0"
1043
- })(["", ""], onlyNonTouchDevice);
1044
- var ScrollHintIcon = (0, import_styled_components13.default)(CarouselButtonIcon)`
1045
- cursor: pointer;
1046
-
1047
- &:hover {
1048
- background-color: ${({
1049
- theme: theme2
1050
- }) => (0, import_utils9.applyEffect)(theme2.color.surface4, theme2.effect.hover)};
1051
- color: ${({
1052
- theme: theme2
1053
- }) => (0, import_utils9.applyEffect)(theme2.color.text5, theme2.effect.hover)};
1054
- }
1055
-
1056
- &:active {
1057
- background-color: ${({
1058
- theme: theme2
1059
- }) => (0, import_utils9.applyEffect)(theme2.color.surface4, theme2.effect.press)};
1060
- color: ${({
1061
- theme: theme2
1062
- }) => (0, import_utils9.applyEffect)(theme2.color.text5, theme2.effect.press)};
1063
- }
1064
- `;
1065
- var onlyNonTouchDevice = (0, import_styled_components13.css)(["@media (hover:none) and (pointer:coarse){display:none;}"]);
1066
-
1067
- // src/components/Carousel/index.tsx
1068
- var import_jsx_runtime13 = require("react/jsx-runtime");
1069
- var GRADIENT_WIDTH = 72;
1070
- var SCROLL_AMOUNT_COEF = 0.75;
1071
- function Carousel({
1072
- buttonOffset = 0,
1073
- buttonPadding = 16,
1074
- bottomOffset = 0,
1075
- defaultScroll: {
1076
- align = "left",
1077
- offset: scrollOffset = 0
1078
- } = {},
1079
- onScroll,
1080
- onResize,
1081
- children,
1082
- centerItems,
1083
- onScrollStateChange,
1084
- scrollAmountCoef = SCROLL_AMOUNT_COEF,
1085
- ...options
1086
- }) {
1087
- const [scrollLeft, setScrollLeft] = useDebounceAnimationState(0);
1088
- const animation = (0, import_react8.useRef)(false);
1089
- const [maxScrollLeft, setMaxScrollLeft] = (0, import_react8.useState)(0);
1090
- const [leftShow, setLeftShow] = (0, import_react8.useState)(false);
1091
- const [rightShow, setRightShow] = (0, import_react8.useState)(false);
1092
- const [styles, set] = (0, import_react_spring.useSpring)(() => ({
1093
- scroll: 0
1094
- }));
1095
- const ref = (0, import_react8.useRef)(null);
1096
- const visibleAreaRef = (0, import_react8.useRef)(null);
1097
- const innerRef = (0, import_react8.useRef)(null);
1098
- const handleRight = (0, import_react8.useCallback)(() => {
1099
- if (visibleAreaRef.current === null) {
1100
- return;
1101
- }
1102
- const {
1103
- clientWidth
1104
- } = visibleAreaRef.current;
1105
- const scroll = Math.min(scrollLeft + clientWidth * scrollAmountCoef, maxScrollLeft);
1106
- setScrollLeft(scroll, true);
1107
- void set({
1108
- scroll,
1109
- from: {
1110
- scroll: scrollLeft
1111
- },
1112
- reset: !animation.current
1113
- });
1114
- animation.current = true;
1115
- }, [animation, maxScrollLeft, scrollLeft, set, scrollAmountCoef, setScrollLeft]);
1116
- const handleLeft = (0, import_react8.useCallback)(() => {
1117
- if (visibleAreaRef.current === null) {
1118
- return;
1119
- }
1120
- const {
1121
- clientWidth
1122
- } = visibleAreaRef.current;
1123
- const scroll = Math.max(scrollLeft - clientWidth * scrollAmountCoef, 0);
1124
- setScrollLeft(scroll, true);
1125
- void set({
1126
- scroll,
1127
- from: {
1128
- scroll: scrollLeft
1129
- },
1130
- reset: !animation.current
1131
- });
1132
- animation.current = true;
1133
- }, [animation, scrollLeft, set, scrollAmountCoef, setScrollLeft]);
1134
- (0, import_react8.useEffect)(() => {
1135
- const newLeftShow = scrollLeft > 0;
1136
- const newRightShow = scrollLeft < maxScrollLeft && maxScrollLeft > 0;
1137
- if (newLeftShow !== leftShow || newRightShow !== rightShow) {
1138
- setLeftShow(newLeftShow);
1139
- setRightShow(newRightShow);
1140
- onScrollStateChange?.(newLeftShow || newRightShow);
1141
- }
1142
- }, [leftShow, maxScrollLeft, onScrollStateChange, rightShow, scrollLeft]);
1143
- const handleScroll = (0, import_react8.useCallback)(() => {
1144
- if (ref.current === null) {
1145
- return;
1146
- }
1147
- if (animation.current) {
1148
- styles.scroll.stop();
1149
- animation.current = false;
1150
- }
1151
- const manualScrollLeft = ref.current.scrollLeft;
1152
- setScrollLeft(manualScrollLeft);
1153
- }, [animation, setScrollLeft, styles]);
1154
- const handleResize = (0, import_react8.useCallback)(() => {
1155
- if (ref.current === null) {
1156
- return;
1157
- }
1158
- const {
1159
- clientWidth,
1160
- scrollWidth
1161
- } = ref.current;
1162
- const newMaxScrollLeft = scrollWidth - clientWidth;
1163
- setMaxScrollLeft(newMaxScrollLeft);
1164
- if (onResize) {
1165
- onResize(clientWidth);
1166
- }
1167
- }, [onResize]);
1168
- useIsomorphicLayoutEffect(() => {
1169
- const elm = ref.current;
1170
- const innerElm = innerRef.current;
1171
- if (elm === null || innerElm === null) {
1172
- return;
1173
- }
1174
- elm.addEventListener("wheel", handleScroll, passiveEvents() && {
1175
- passive: true
1176
- });
1177
- const resizeObserver = new ResizeObserver(handleResize);
1178
- resizeObserver.observe(elm);
1179
- const resizeObserverInner = new ResizeObserver(handleResize);
1180
- resizeObserverInner.observe(innerElm);
1181
- return () => {
1182
- elm.removeEventListener("wheel", handleScroll);
1183
- resizeObserver.disconnect();
1184
- resizeObserverInner.disconnect();
1185
- };
1186
- }, [handleResize, handleScroll]);
1187
- useIsomorphicLayoutEffect(() => {
1188
- if (align !== "left" || scrollOffset !== 0) {
1189
- const scroll = ref.current;
1190
- if (scroll !== null) {
1191
- const scrollLength = Math.max(0, Math.min(align === "left" && scrollOffset > 0 ? scrollOffset : align === "center" ? maxScrollLeft / 2 + scrollOffset : align === "right" && scrollOffset <= maxScrollLeft ? maxScrollLeft - scrollOffset / 2 : 0, maxScrollLeft));
1192
- scroll.scrollLeft = scrollLength;
1193
- setScrollLeft(scrollLength, true);
1194
- }
1195
- }
1196
- }, [ref.current]);
1197
- const handleScrollMove = (0, import_react8.useCallback)(() => {
1198
- if (ref.current === null) {
1199
- return;
1200
- }
1201
- if (onScroll) {
1202
- onScroll(ref.current.scrollLeft);
1203
- }
1204
- }, [onScroll]);
1205
- const [disableGradient, setDisableGradient] = (0, import_react8.useState)(false);
1206
- useIsomorphicLayoutEffect(() => {
1207
- if (isEdge()) {
1208
- setDisableGradient(true);
1209
- }
1210
- }, []);
1211
- if (!disableGradient && options.hasGradient === true) {
1212
- const fadeInGradient = options.fadeInGradient ?? false;
1213
- const overflowGradient = !fadeInGradient;
1214
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Container3, { ref: visibleAreaRef, children: [
1215
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(GradientContainer, { fadeInGradient, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(RightGradient, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LeftGradient, { show: overflowGradient || scrollLeft > 0, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ScrollArea, { ref, scrollLeft: styles.scroll, onScroll: handleScrollMove, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CarouselContainer, { ref: innerRef, centerItems, children }) }) }) }) }),
1216
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(ButtonsContainer, { children: [
1217
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CarouselButton, { direction: "left" /* Left */, show: leftShow, offset: buttonOffset, bottomOffset, padding: buttonPadding, gradient: overflowGradient, onClick: handleLeft }),
1218
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CarouselButton, { direction: "right" /* Right */, show: rightShow, offset: buttonOffset, bottomOffset, padding: buttonPadding, gradient: true, onClick: handleRight })
1219
- ] })
1220
- ] });
1221
- }
1222
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Container3, { ref: visibleAreaRef, children: [
1223
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ScrollArea, { ref, scrollLeft: styles.scroll, onScroll: handleScrollMove, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CarouselContainer, { ref: innerRef, centerItems, children }) }),
1224
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(ButtonsContainer, { children: [
1225
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CarouselButton, { direction: "left" /* Left */, show: leftShow, offset: buttonOffset, bottomOffset, padding: buttonPadding, onClick: handleLeft }),
1226
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CarouselButton, { direction: "right" /* Right */, show: rightShow, offset: buttonOffset, bottomOffset, padding: buttonPadding, onClick: handleRight })
1227
- ] })
1228
- ] });
1229
- }
1230
- var CarouselContainer = import_styled_components14.default.ul.withConfig({
1231
- componentId: "ccl__sc-1qkjnfo-0"
1232
- })(["vertical-align:top;overflow:hidden;list-style:none;padding:0;min-width:100%;box-sizing:border-box;", ""], ({
1233
- centerItems = false
1234
- }) => centerItems ? (0, import_styled_components14.css)(["display:flex;width:max-content;margin:0 auto;"]) : (0, import_styled_components14.css)(["display:inline-flex;margin:0;"]));
1235
- var ButtonsContainer = import_styled_components14.default.div.withConfig({
1236
- componentId: "ccl__sc-1qkjnfo-1"
1237
- })(["opacity:0;transition:0.4s opacity;"]);
1238
- var Container3 = import_styled_components14.default.div.withConfig({
1239
- componentId: "ccl__sc-1qkjnfo-2"
1240
- })(["&:hover ", "{opacity:1;}position:relative;z-index:0;"], ButtonsContainer);
1241
- var ScrollArea = (0, import_styled_components14.default)(import_react_spring.animated.div).withConfig({
1242
- componentId: "ccl__sc-1qkjnfo-3"
1243
- })(["overflow-x:auto;padding:0;margin:0;&::-webkit-scrollbar{display:none;}scrollbar-width:none;"]);
1244
- var GradientContainer = import_styled_components14.default.div.withConfig({
1245
- componentId: "ccl__sc-1qkjnfo-4"
1246
- })(["overflow:hidden;", " margin-right:", "px;", "{padding-right:", "px;}"], (p) => !p.fadeInGradient && (0, import_styled_components14.css)(["margin-left:", "px;", "{padding-left:", "px;}"], -GRADIENT_WIDTH, CarouselContainer, GRADIENT_WIDTH), -GRADIENT_WIDTH, CarouselContainer, GRADIENT_WIDTH);
1247
- var RightGradient = import_styled_components14.default.div.withConfig({
1248
- componentId: "ccl__sc-1qkjnfo-5"
1249
- })(["mask-image:linear-gradient( to right,#000 calc(100% - ", "px),transparent );"], GRADIENT_WIDTH);
1250
- var LeftGradient = import_styled_components14.default.div.withConfig({
1251
- componentId: "ccl__sc-1qkjnfo-6"
1252
- })(["margin-right:", "px;padding-right:", "px;transition:0.2s all ease-in;mask:linear-gradient(to right,transparent,#000 ", "px) ", "px 0;"], -GRADIENT_WIDTH, GRADIENT_WIDTH, GRADIENT_WIDTH, (p) => p.show ? 0 : -GRADIENT_WIDTH);
1253
-
1254
- // src/components/Pager/index.tsx
1255
- var import_react9 = require("react");
1256
- var import_styled_components17 = __toESM(require("styled-components"));
1257
- var import_warning = __toESM(require("warning"));
1258
-
1259
- // src/components/icons/DotsIcon.tsx
1260
- var import_styled_components15 = __toESM(require("styled-components"));
1261
- var import_jsx_runtime14 = require("react/jsx-runtime");
1262
- function DotsIcon({
1263
- size: size3 = 16
1264
- }) {
1265
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(StyledSVG, { viewBox: "0 0 20 6", width: size3, height: size3, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { fillRule: "evenodd", 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
1266
- 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
1267
- C10.6192881,14.5 9.5,13.3807119 9.5,12 C9.5,10.6192881 10.6192881,9.5 12,9.5
1268
- 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
1269
- C17.6192881,14.5 16.5,13.3807119 16.5,12 C16.5,10.6192881 17.6192881,9.5 19,9.5
1270
- C20.3807119,9.5 21.5,10.6192881 21.5,12 C21.5,13.3807119 20.3807119,14.5 19,14.5 Z`, transform: "translate(-2 -9)" }) });
1271
- }
1272
- var StyledSVG = import_styled_components15.default.svg.withConfig({
1273
- componentId: "ccl__sc-1ma336a-0"
1274
- })(["fill:currentColor;"]);
1275
-
1276
- // src/components/icons/WedgeIcon.tsx
1277
- var import_styled_components16 = __toESM(require("styled-components"));
1278
- var import_jsx_runtime15 = require("react/jsx-runtime");
1279
- function WedgeIcon({
1280
- size: size3 = 16,
1281
- direction
1282
- }) {
1283
- return (
1284
- // NOTE: directionToTransform depends on the value of viewBox
1285
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("svg", { viewBox: "0 0 10 8", width: size3, height: size3, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StyledPolyline, { strokeWidth: "2", points: "1,2 5,6 9,2", transform: directionToTransform2(direction) }) })
1286
- );
1287
- }
1288
- function directionToTransform2(direction) {
1289
- switch (direction) {
1290
- case "up" /* Up */:
1291
- return "rotate(180 5 4)";
1292
- case "down" /* Down */:
1293
- return void 0;
1294
- case "left" /* Left */:
1295
- return "rotate(90 5 4)";
1296
- case "right" /* Right */:
1297
- return "rotate(-90 5 4)";
1298
- default:
1299
- return unreachable(direction);
1300
- }
1301
- }
1302
- var StyledPolyline = import_styled_components16.default.polyline.withConfig({
1303
- componentId: "ccl__sc-617sjj-0"
1304
- })(["fill:none;stroke-linejoin:round;stroke-linecap:round;stroke:currentColor;"]);
1305
-
1306
- // src/components/Pager/index.tsx
1307
- var import_jsx_runtime16 = require("react/jsx-runtime");
1308
- function usePagerWindow(page, pageCount, pageRangeDisplayed = 7) {
1309
- if (process.env.NODE_ENV !== "production") {
1310
- (0, import_warning.default)((page | 0) === page, `\`page\` must be integer (${page})`);
1311
- (0, import_warning.default)((pageCount | 0) === pageCount, `\`pageCount\` must be integer (${pageCount})`);
1312
- (0, import_warning.default)((pageRangeDisplayed | 0) === pageRangeDisplayed, `\`pageRangeDisplayed\` must be integer (${pageRangeDisplayed})`);
1313
- (0, import_warning.default)(pageRangeDisplayed > 2, `\`windowSize\` must be greater than 2`);
1314
- }
1315
- const window2 = (0, import_react9.useMemo)(() => {
1316
- const visibleFirstPage = 1;
1317
- const visibleLastPage = Math.min(pageCount, Math.max(page + Math.floor(pageRangeDisplayed / 2), pageRangeDisplayed));
1318
- if (visibleLastPage <= pageRangeDisplayed) {
1319
- return Array.from({
1320
- length: 1 + visibleLastPage - visibleFirstPage
1321
- }, (_, i) => visibleFirstPage + i);
1322
- } else {
1323
- const start = visibleLastPage - (pageRangeDisplayed - 1) + 2;
1324
- return [
1325
- // 表示範囲が1-7ページを超えるなら、
1326
- // - 1ページ目は固定で表示する
1327
- visibleFirstPage,
1328
- // - 2ページ目から現在のページの直前までは省略する
1329
- "...",
1330
- ...Array.from({
1331
- length: 1 + visibleLastPage - start
1332
- }, (_, i) => start + i)
1333
- ];
1334
- }
1335
- }, [page, pageCount, pageRangeDisplayed]);
1336
- (0, import_react9.useDebugValue)(window2);
1337
- return window2;
1338
- }
1339
- var Pager_default = (0, import_react9.memo)(function Pager({
1340
- page,
1341
- pageCount,
1342
- pageRangeDisplayed,
1343
- onChange
1344
- }) {
1345
- const window2 = usePagerWindow(page, pageCount, pageRangeDisplayed);
1346
- const makeClickHandler = (0, import_react9.useCallback)((value) => () => {
1347
- onChange(value);
1348
- }, [onChange]);
1349
- const hasNext = page < pageCount;
1350
- const hasPrev = page > 1;
1351
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(PagerContainer, { children: [
1352
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CircleButton, { type: "button", hidden: !hasPrev, disabled: !hasPrev, onClick: makeClickHandler(Math.max(1, page - 1)), noBackground: true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(WedgeIcon, { size: 16, direction: "left" /* Left */ }) }),
1353
- window2.map((p) => p === "..." ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Spacer, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DotsIcon, { size: 20 }) }, p) : p === page ? (
1354
- // we remove the onClick but don't mark it as disabled to preserve keyboard focus
1355
- // not doing so causes the focus ring to flicker in and out of existence
1356
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CircleButton, { type: "button", "aria-current": true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text3, { children: p }) }, p)
1357
- ) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CircleButton, { type: "button", onClick: makeClickHandler(p), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text3, { children: p }) }, p)),
1358
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CircleButton, { type: "button", hidden: !hasNext, disabled: !hasNext, onClick: makeClickHandler(Math.min(pageCount, page + 1)), noBackground: true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(WedgeIcon, { size: 16, direction: "right" /* Right */ }) })
1359
- ] });
1360
- });
1361
- function LinkPager({
1362
- page,
1363
- pageCount,
1364
- pageRangeDisplayed,
1365
- makeUrl
1366
- }) {
1367
- const {
1368
- Link
1369
- } = useComponentAbstraction();
1370
- const window2 = usePagerWindow(page, pageCount, pageRangeDisplayed);
1371
- const hasNext = page < pageCount;
1372
- const hasPrev = page > 1;
1373
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(PagerContainer, { children: [
1374
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Link, { to: makeUrl(Math.max(1, page - 1)), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CircleButton, { hidden: !hasPrev, "aria-disabled": !hasPrev, noBackground: true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(WedgeIcon, { size: 16, direction: "left" /* Left */ }) }) }),
1375
- window2.map((p) => p === "..." ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Spacer, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DotsIcon, { size: 20, subLink: true }) }, p) : p === page ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CircleButton, { type: "button", "aria-current": true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text3, { children: p }) }, p) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Link, { to: makeUrl(p), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CircleButton, { type: "button", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text3, { children: p }) }) }, p)),
1376
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Link, { to: makeUrl(Math.min(pageCount, page + 1)), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CircleButton, { hidden: !hasNext, "aria-disabled": !hasNext, noBackground: true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(WedgeIcon, { size: 16, direction: "right" /* Right */ }) }) })
1377
- ] });
1378
- }
1379
- var PagerContainer = import_styled_components17.default.nav.withConfig({
1380
- componentId: "ccl__sc-1bh6g9v-0"
1381
- })(["display:flex;justify-content:center;align-items:center;"]);
1382
- var CircleButton = import_styled_components17.default.button.withConfig({
1383
- componentId: "ccl__sc-1bh6g9v-1"
1384
- })(["font-size:1rem;line-height:calc(1em + 8px);text-decoration:none;border:none;outline:none;touch-action:manipulation;user-select:none;transition:box-shadow 0.2s ease 0s,color 0.2s ease 0s,background 0.2s ease 0s,opacity 0.2s ease 0s;display:flex;justify-content:center;align-items:center;box-sizing:content-box;min-width:24px;min-height:24px;padding:8px;cursor:pointer;font-weight:bold;-webkit-transform:translateZ(0);&[hidden]{visibility:hidden;display:block;}border-radius:48px;background:transparent;color:", ";&:hover{background:", ";color:", ";}&[aria-current]{background-color:", ";color:", ";}&[aria-current]:hover{background-color:", ";color:", ";}", ""], ({
1385
- theme: theme2
1386
- }) => theme2.color.text3, ({
1387
- theme: theme2
1388
- }) => theme2.color.surface3, ({
1389
- theme: theme2
1390
- }) => theme2.color.text2, ({
1391
- theme: theme2
1392
- }) => theme2.color.surface6, ({
1393
- theme: theme2
1394
- }) => theme2.color.text5, ({
1395
- theme: theme2
1396
- }) => theme2.color.surface6, ({
1397
- theme: theme2
1398
- }) => theme2.color.text5, ({
1399
- noBackground = false
1400
- }) => noBackground && (0, import_styled_components17.css)(["&:hover{background:transparent;}"]));
1401
- var Spacer = (0, import_styled_components17.default)(CircleButton).attrs({
1402
- type: "button",
1403
- disabled: true
1404
- }).withConfig({
1405
- componentId: "ccl__sc-1bh6g9v-2"
1406
- })(["&&{color:", ";background:none;}"], ({
1407
- theme: theme2
1408
- }) => theme2.color.text3);
1409
- var Text3 = "span";
1410
- // Annotate the CommonJS export names for ESM import in node:
1411
- 0 && (module.exports = {
1412
- CancelLayoutItemBodyPadding,
1413
- Carousel,
1414
- ComponentAbstraction,
1415
- Filter,
1416
- FilterButton,
1417
- FilterIconButton,
1418
- FilterLink,
1419
- HintText,
1420
- LAYOUT_ITEM_BODY_PADDING,
1421
- Layout,
1422
- LayoutItem,
1423
- LayoutItemBody,
1424
- LayoutItemHeader,
1425
- LeftMenu,
1426
- LeftMenuContent,
1427
- LinkPager,
1428
- MAIN_COLUMN_HORIZONTAL_MIN_MARGIN,
1429
- MenuListItem,
1430
- MenuListItemContext,
1431
- MenuListItemWithIcon,
1432
- MenuListLabel,
1433
- MenuListLinkItem,
1434
- MenuListLinkItemWithIcon,
1435
- MenuListSpacer,
1436
- Pager,
1437
- RESPONSIVE_LEFT_WIDTH,
1438
- RESPONSIVE_MAIN_MAX_WIDTH,
1439
- StyledCancelLayoutItemBodyPadding,
1440
- StyledLayoutItemBody,
1441
- SwitchCheckbox,
1442
- TextEllipsis,
1443
- WithIcon,
1444
- useComponentAbstraction,
1445
- useElementSize,
1446
- useLayoutItemBodyPadding,
1447
- useMedia,
1448
- useMediaScreen1
1449
- });
1450
- //# sourceMappingURL=index.cjs.js.map