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