@charcoal-ui/react-sandbox 2.5.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/_lib/compat.d.ts +14 -14
  2. package/dist/components/Carousel/index.d.ts +39 -39
  3. package/dist/components/Carousel/index.d.ts.map +1 -1
  4. package/dist/components/Carousel/index.story.d.ts +6 -6
  5. package/dist/components/CarouselButton/index.d.ts +20 -20
  6. package/dist/components/CarouselButton/index.story.d.ts +9 -9
  7. package/dist/components/Filter/index.d.ts +19 -19
  8. package/dist/components/Filter/index.story.d.ts +8 -8
  9. package/dist/components/HintText/index.d.ts +9 -9
  10. package/dist/components/HintText/index.d.ts.map +1 -1
  11. package/dist/components/HintText/index.story.d.ts +11 -11
  12. package/dist/components/Layout/index.d.ts +67 -67
  13. package/dist/components/Layout/index.story.d.ts +13 -13
  14. package/dist/components/LeftMenu/index.d.ts +11 -11
  15. package/dist/components/MenuListItem/index.d.ts +34 -34
  16. package/dist/components/MenuListItem/index.story.d.ts +17 -17
  17. package/dist/components/Pager/index.d.ts +14 -14
  18. package/dist/components/Pager/index.story.d.ts +31 -31
  19. package/dist/components/SwitchCheckbox/index.d.ts +8 -8
  20. package/dist/components/SwitchCheckbox/index.story.d.ts +10 -10
  21. package/dist/components/TextEllipsis/helper.d.ts +3 -3
  22. package/dist/components/TextEllipsis/index.d.ts +10 -10
  23. package/dist/components/TextEllipsis/index.story.d.ts +8 -8
  24. package/dist/components/WithIcon/index.d.ts +27 -27
  25. package/dist/components/WithIcon/index.story.d.ts +14 -14
  26. package/dist/components/icons/Base.d.ts +15 -15
  27. package/dist/components/icons/Base.d.ts.map +1 -1
  28. package/dist/components/icons/DotsIcon.d.ts +11 -11
  29. package/dist/components/icons/InfoIcon.d.ts +1 -1
  30. package/dist/components/icons/NextIcon.d.ts +11 -11
  31. package/dist/components/icons/WedgeIcon.d.ts +19 -19
  32. package/dist/foundation/contants.d.ts +3 -3
  33. package/dist/foundation/hooks.d.ts +28 -28
  34. package/dist/foundation/support.d.ts +2 -2
  35. package/dist/foundation/utils.d.ts +22 -22
  36. package/dist/hooks/index.d.ts +2 -2
  37. package/dist/index.cjs.js +1871 -0
  38. package/dist/index.cjs.js.map +1 -0
  39. package/dist/index.d.ts +13 -13
  40. package/dist/index.esm.js +1816 -0
  41. package/dist/index.esm.js.map +1 -0
  42. package/dist/misc/storybook-helper.d.ts +2 -2
  43. package/dist/styled.d.ts +94 -94
  44. package/package.json +18 -18
  45. package/dist/index.cjs +0 -1816
  46. package/dist/index.cjs.map +0 -1
  47. package/dist/index.modern.js +0 -2275
  48. package/dist/index.modern.js.map +0 -1
  49. package/dist/index.module.js +0 -1768
  50. package/dist/index.module.js.map +0 -1
@@ -1,2275 +0,0 @@
1
- import React, { useMemo, useState, useLayoutEffect, useDebugValue, useReducer, useRef, useCallback, useContext, isValidElement, Children as Children$1, useEffect } from 'react';
2
- import styled, { css, useTheme, createGlobalStyle } from 'styled-components';
3
- import { useComponentAbstraction } from '@charcoal-ui/react';
4
- export { ComponentAbstraction, useComponentAbstraction } from '@charcoal-ui/react';
5
- import { maxWidth, disabledSelector, applyEffect } from '@charcoal-ui/utils';
6
- import { createTheme } from '@charcoal-ui/styled';
7
- import { columnSystem, COLUMN_UNIT, GUTTER_UNIT } from '@charcoal-ui/foundation';
8
- import ReactDOM from 'react-dom';
9
- import { animated, useSpring } from 'react-spring';
10
- import warning from 'warning';
11
-
12
- function _extends() {
13
- _extends = Object.assign ? Object.assign.bind() : function (target) {
14
- for (var i = 1; i < arguments.length; i++) {
15
- var source = arguments[i];
16
-
17
- for (var key in source) {
18
- if (Object.prototype.hasOwnProperty.call(source, key)) {
19
- target[key] = source[key];
20
- }
21
- }
22
- }
23
-
24
- return target;
25
- };
26
- return _extends.apply(this, arguments);
27
- }
28
-
29
- function _objectWithoutPropertiesLoose(source, excluded) {
30
- if (source == null) return {};
31
- var target = {};
32
- var sourceKeys = Object.keys(source);
33
- var key, i;
34
-
35
- for (i = 0; i < sourceKeys.length; i++) {
36
- key = sourceKeys[i];
37
- if (excluded.indexOf(key) >= 0) continue;
38
- target[key] = source[key];
39
- }
40
-
41
- return target;
42
- }
43
-
44
- let _$d = t => t,
45
- _t$e,
46
- _t2$a,
47
- _t3$9,
48
- _t4$8,
49
- _t5$6,
50
- _t6$5,
51
- _t7$5,
52
- _t8$5,
53
- _t9$5;
54
-
55
- const _excluded$3 = ["onClick", "children", "active", "hover", "reactive"];
56
- const FilterButton = React.forwardRef(function FilterButton({
57
- onClick,
58
- children,
59
- active = false,
60
- hover,
61
- reactive = false
62
- }, ref) {
63
- return /*#__PURE__*/React.createElement(ButtonLike, {
64
- active: active,
65
- reactive: reactive,
66
- hover: hover,
67
- onClick: active && !reactive ? undefined : onClick,
68
- ref: ref
69
- }, children);
70
- });
71
- const FilterIconButton = React.forwardRef(function FilterIconButton({
72
- onClick,
73
- children,
74
- active = false,
75
- hover,
76
- reactive = false,
77
- width,
78
- height
79
- }, ref) {
80
- return /*#__PURE__*/React.createElement(StyledButtonLike, {
81
- active: active,
82
- reactive: reactive,
83
- hover: hover,
84
- onClick: active && !reactive ? undefined : onClick,
85
- ref: ref,
86
- buttonWidth: width,
87
- buttonHeight: height
88
- }, children);
89
- });
90
- const FilterLink = React.forwardRef(function FilterLink(_ref, ref) {
91
- let {
92
- onClick,
93
- children,
94
- active = false,
95
- hover,
96
- reactive = false
97
- } = _ref,
98
- props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
99
-
100
- const {
101
- Link
102
- } = useComponentAbstraction();
103
-
104
- if (active && !reactive) {
105
- return /*#__PURE__*/React.createElement(PlainElement, {
106
- active: true,
107
- hover: hover,
108
- ref: ref
109
- }, children);
110
- } else {
111
- return /*#__PURE__*/React.createElement(Link, _extends({}, props, {
112
- onClick: onClick
113
- }), /*#__PURE__*/React.createElement(PlainElement, {
114
- active: active,
115
- reactive: reactive,
116
- hover: hover,
117
- ref: ref
118
- }, children));
119
- }
120
- });
121
- const buttonCss = css(_t$e || (_t$e = _$d`
122
- display: block;
123
- outline: none;
124
- border: none;
125
- padding: 9px 24px;
126
- font-size: 14px;
127
- line-height: 22px;
128
- font-weight: bold;
129
- border-radius: /* absurd radius, but ensures rounded corners */ 2000px;
130
- transition: color 0.2s;
131
- color: ${0};
132
- cursor: pointer;
133
- user-select: none;
134
- background-color: transparent;
135
-
136
- &:hover {
137
- color: ${0};
138
- }
139
-
140
- ${0}
141
-
142
- ${0}
143
-
144
- ${0}
145
-
146
- @media ${0} {
147
- padding: 5px 16px;
148
- }
149
- `), ({
150
- theme
151
- }) => theme.color.text3, ({
152
- theme
153
- }) => theme.color.text2, ({
154
- hover: _hover = false
155
- }) => _hover && css(_t2$a || (_t2$a = _$d`
156
- color: ${0};
157
- `), ({
158
- theme
159
- }) => theme.color.text2), ({
160
- active: _active = false
161
- }) => _active && css(_t3$9 || (_t3$9 = _$d`
162
- background-color: ${0};
163
- color: ${0};
164
- `), ({
165
- theme
166
- }) => theme.color.surface3, ({
167
- theme
168
- }) => theme.color.text2), ({
169
- active: _active2 = false,
170
- reactive: _reactive = false
171
- }) => _active2 && !_reactive && css(_t4$8 || (_t4$8 = _$d`
172
- cursor: default;
173
- `)), ({
174
- theme
175
- }) => maxWidth(theme.breakpoint.screen1));
176
- const padding0Css = css(_t5$6 || (_t5$6 = _$d`
177
- padding: 0;
178
-
179
- @media ${0} {
180
- padding: 0;
181
- }
182
- `), ({
183
- theme
184
- }) => maxWidth(theme.breakpoint.screen1));
185
- const ButtonLike = styled.button(_t6$5 || (_t6$5 = _$d`
186
- ${0}
187
- `), buttonCss);
188
- const PlainElement = styled.span(_t7$5 || (_t7$5 = _$d`
189
- ${0}
190
- `), buttonCss);
191
- const StyledButtonLike = styled(ButtonLike)(_t8$5 || (_t8$5 = _$d`
192
- ${0};
193
- ${0}
194
- ${0}
195
- `), padding0Css, p => p.buttonWidth !== undefined && `width: ${p.buttonWidth}px;`, p => p.buttonHeight !== undefined && `height: ${p.buttonHeight}px;`);
196
- const Filter = styled.div(_t9$5 || (_t9$5 = _$d`
197
- display: flex;
198
- `));
199
-
200
- const theme = createTheme(styled);
201
-
202
- let _$c = t => t,
203
- _t$d;
204
- function IconBase({
205
- size = 24,
206
- viewBoxSize,
207
- currentColor,
208
- path,
209
- transform,
210
- fillRule,
211
- clipRule
212
- }) {
213
- return /*#__PURE__*/React.createElement(Icon$2, {
214
- viewBox: `0 0 ${viewBoxSize} ${viewBoxSize}`,
215
- size: size,
216
- currentColor: currentColor
217
- }, /*#__PURE__*/React.createElement(IconBasePath, {
218
- path: path,
219
- transform: transform,
220
- fillRule: fillRule,
221
- clipRule: clipRule
222
- }));
223
- }
224
- const Icon$2 = styled.svg(_t$d || (_t$d = _$c`
225
- stroke: none;
226
- fill: ${0};
227
- width: ${0}px;
228
- height: ${0}px;
229
- line-height: 0;
230
- font-size: 0;
231
- vertical-align: middle;
232
- `), ({
233
- currentColor: _currentColor = false,
234
- theme
235
- }) => _currentColor ? 'currentColor' : theme.color.text2, props => props.size, props => props.size);
236
- const IconBasePath = ({
237
- path,
238
- transform,
239
- fillRule,
240
- clipRule
241
- }) => {
242
- if (typeof path === 'string') {
243
- return /*#__PURE__*/React.createElement("path", {
244
- d: path,
245
- transform: transform,
246
- fillRule: fillRule,
247
- clipRule: clipRule
248
- });
249
- } else {
250
- // eslint-disable-next-line react/jsx-no-useless-fragment
251
- return /*#__PURE__*/React.createElement(React.Fragment, null, path);
252
- }
253
- };
254
-
255
- let _$b = t => t,
256
- _t$c;
257
- const size$1 = 16;
258
- function InfoIcon() {
259
- const path = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("path", {
260
- d: "M8 16C3.58172 16 0 12.4183 0 8C0 3.58172 3.58172 0 8 0C12.4183 0 16 3.58172 16 8C16 12.4183 12.4183 16 8 16Z"
261
- }), /*#__PURE__*/React.createElement(Path, {
262
- d: "M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8ZM8 6.25C8.69036 6.25 9.25 5.69036 9.25 5C9.25 4.30964 8.69036 3.75 8 3.75C7.30964 3.75 6.75 4.30964 6.75 5C6.75 5.69036 7.30964 6.25 8 6.25ZM7 7.75V11.25C7 11.8023 7.44772 12.25 8 12.25C8.55228 12.25 9 11.8023 9 11.25V7.75C9 7.19772 8.55228 6.75 8 6.75C7.44772 6.75 7 7.19772 7 7.75Z"
263
- }));
264
- return /*#__PURE__*/React.createElement(IconBase, {
265
- viewBoxSize: size$1,
266
- size: size$1,
267
- currentColor: true,
268
- path: path
269
- });
270
- }
271
- const Path = styled.path(_t$c || (_t$c = _$b`
272
- fill: ${0};
273
- fill-rule: evenodd;
274
- `), ({
275
- theme
276
- }) => theme.color.surface1);
277
-
278
- let _$a = t => t,
279
- _t$b,
280
- _t2$9,
281
- _t3$8,
282
- _t4$7;
283
- function HintText({
284
- children,
285
- context,
286
- className
287
- }) {
288
- return /*#__PURE__*/React.createElement(Container$2, {
289
- className: className,
290
- context: context
291
- }, /*#__PURE__*/React.createElement(IconWrap, null, /*#__PURE__*/React.createElement(InfoIcon, null)), /*#__PURE__*/React.createElement(Text$2, null, children));
292
- }
293
- const Container$2 = styled.div.attrs(styledProps)(_t$b || (_t$b = _$a`
294
- ${0}
295
-
296
- @media ${0} {
297
- ${0}
298
- }
299
-
300
- display: flex;
301
- align-items: flex-start;
302
- ${0}
303
- `), p => theme(o => [o.bg.surface3, o.borderRadius(8), o.padding.vertical(p.default.vertical), o.padding.horizontal(p.default.horizontal)]), ({
304
- theme: t
305
- }) => maxWidth(t.breakpoint.screen1), p => theme(o => [o.padding.vertical(p.screen1.vertical), o.padding.horizontal(p.screen1.horizontal)]), p => p.context === 'page' && css(_t2$9 || (_t2$9 = _$a`
306
- justify-content: center;
307
- `)));
308
- const IconWrap = styled.div(_t3$8 || (_t3$8 = _$a`
309
- display: flex;
310
- align-items: center;
311
- color: ${0};
312
- height: 22px;
313
- margin: -4px 4px -4px 0;
314
- `), p => p.theme.color.text4);
315
- const Text$2 = styled.p(_t4$7 || (_t4$7 = _$a`
316
- ${0}
317
- margin: 0;
318
- `), theme(o => [o.font.text2, o.typography(14)]));
319
-
320
- function styledProps(props) {
321
- return _extends({}, props, contextToProps(props.context));
322
- }
323
-
324
- function contextToProps(context) {
325
- switch (context) {
326
- case 'page':
327
- return {
328
- default: {
329
- horizontal: 40,
330
- vertical: 24
331
- },
332
- screen1: {
333
- horizontal: 16,
334
- vertical: 16
335
- }
336
- };
337
-
338
- case 'section':
339
- return {
340
- default: {
341
- horizontal: 16,
342
- vertical: 16
343
- },
344
- screen1: {
345
- horizontal: 16,
346
- vertical: 16
347
- }
348
- };
349
- }
350
- }
351
-
352
- const MAIN_COLUMN_HORIZONTAL_MIN_MARGIN = 72;
353
- const RESPONSIVE_LEFT_WIDTH = columnSystem(2, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT;
354
- const RESPONSIVE_MAIN_MAX_WIDTH = columnSystem(12, COLUMN_UNIT, GUTTER_UNIT);
355
-
356
- /**
357
- * 現在の画面幅がモバイル幅かどうかを返す
358
- */
359
-
360
- function useMediaScreen1() {
361
- return useMedia(maxWidth(useTheme().breakpoint.screen1));
362
- }
363
- /**
364
- * Returns a dynamically-updating media query result.
365
- *
366
- * When the media query's matching state changes, this hook's result
367
- * will update with sync priority.
368
- *
369
- * @param query A full media query (the string written between `@media` and the `{` in CSS)
370
- * @returns true if the query matches, false if it doesn't
371
- */
372
-
373
- function useMedia(query) {
374
- const matcher = useMemo(() => __TEST__ ? {
375
- matches: false,
376
- addListener: () => {// do nothing
377
- },
378
- removeListener: () => {// do nothing
379
- }
380
- } : matchMedia(query), [query]);
381
- const [matches, setMatches] = useState(matcher.matches); // can only happen if/when the query changes
382
-
383
- if (matcher.matches !== matches) {
384
- setMatches(matcher.matches);
385
- }
386
-
387
- const callback = e => {
388
- // We're not on a React event listener, so React doesn't know the priority of the setState call
389
- // Media query updates _are_ very high priority to avoid FOUC
390
- // so we need to emit a sync priority update
391
- try {
392
- // However, flushSync may throw if the matcher is triggered by a
393
- // forced relayout that happens during a React lifecycle handler.
394
- // Try to be resilient and retry without flushSync if flushSync throws.
395
- ReactDOM.flushSync(() => {
396
- setMatches(e.matches);
397
- });
398
- } catch (_unused) {
399
- setMatches(e.matches);
400
- }
401
- };
402
-
403
- useLayoutEffect(() => {
404
- matcher.addListener(callback); // sync update
405
-
406
- setMatches(matcher.matches);
407
- return () => {
408
- matcher.removeListener(callback);
409
- };
410
- }, [matcher]);
411
- useDebugValue(`${query}: ${matches.toString()}`);
412
- return matches;
413
- }
414
-
415
- function measure(ref) {
416
- return ref !== null ? ref.getBoundingClientRect() : undefined;
417
- }
418
-
419
- function useElementSize(ref, // eslint-disable-next-line @typescript-eslint/no-explicit-any
420
- deps = []) {
421
- // _don't_ call measure synchronously here even if you somehow can
422
- // measurement has to be done outside the render phase, either
423
- // as the resize observer callback or as a layout effect
424
- const [size, setSize] = useReducer((state, next) => {
425
- // width, height, etc are not own properties but getters in the prototype
426
- // can't use shallowEqual or other iterative checks
427
- if (state === undefined || next === undefined) {
428
- return next;
429
- }
430
-
431
- if (state.height === next.height && state.width === next.width) {
432
- return state;
433
- }
434
-
435
- return next;
436
- }, undefined);
437
- const [watch, setWatch] = useState(null);
438
- useLayoutEffect(() => {
439
- if (watch === null) {
440
- return;
441
- }
442
-
443
- const observer = new ResizeObserver(() => {
444
- // NOTE: the ResizeObserverCallback receives a rect,
445
- // but it's not measured in the same way as getBoundingClientRect,
446
- // which causes unstable layout
447
- const newSize = measure(watch);
448
- setSize(newSize);
449
- }); // The ResizeObserver is supposed to call handleResize on observe
450
-
451
- observer.observe(watch);
452
- return () => {
453
- // this will correctly unobserve if either the observer
454
- // or the current changes, and even on unmount
455
- // no need for an observer.disconnect() 🎉
456
- observer.unobserve(watch);
457
- setSize(undefined);
458
- };
459
- }, [watch]); // eslint-disable-next-line react-hooks/exhaustive-deps
460
-
461
- useLayoutEffect(() => {
462
- if (ref.current !== watch) {
463
- setWatch(ref.current);
464
- }
465
- });
466
- useLayoutEffect(() => {
467
- if (deps.length > 0) {
468
- // Sync measuring
469
- setSize(measure(ref.current));
470
- } // eslint-disable-next-line react-hooks/exhaustive-deps
471
-
472
- }, deps);
473
- useDebugValue(size);
474
- return size;
475
- }
476
- /**
477
- * Debounce version of setState with `requestAnimationFrame`
478
- *
479
- * @param defaultValue Default value for `useState`
480
- */
481
-
482
- function useDebounceAnimationState(defaultValue) {
483
- const [state, setState] = useState(defaultValue);
484
- const timer = useRef(); // typescript bug? (any when omitting type annotation)
485
- // eslint-disable-next-line @typescript-eslint/no-inferrable-types
486
-
487
- const setDebounceState = useCallback((value, force = false) => {
488
- if (force) {
489
- setState(value);
490
- return;
491
- }
492
-
493
- if (timer.current !== undefined) {
494
- return;
495
- }
496
-
497
- timer.current = requestAnimationFrame(() => {
498
- setState(value);
499
-
500
- if (timer.current !== undefined) {
501
- timer.current = undefined;
502
- }
503
- });
504
- }, []);
505
- return [state, setDebounceState];
506
- }
507
-
508
- let _$9 = t => t,
509
- _t$a,
510
- _t2$8,
511
- _t3$7,
512
- _t4$6,
513
- _t5$5,
514
- _t6$4,
515
- _t7$4,
516
- _t8$4,
517
- _t9$4,
518
- _t10$4,
519
- _t11$1,
520
- _t12$1,
521
- _t13$1,
522
- _t14,
523
- _t15;
524
- const LayoutConfigContext = React.createContext({
525
- wide: false,
526
- center: false,
527
- withLeft: false
528
- });
529
- function Layout({
530
- menu,
531
- children,
532
- header,
533
- center = false,
534
- wide,
535
- isHeaderTopMenu = false
536
- }) {
537
- const config = {
538
- center,
539
- wide: center ? true : wide != null ? wide : false,
540
- withLeft: menu != null && !isHeaderTopMenu
541
- };
542
- return /*#__PURE__*/React.createElement(LayoutRoot, null, /*#__PURE__*/React.createElement(LayoutConfigContext.Provider, {
543
- value: config
544
- }, config.withLeft && /*#__PURE__*/React.createElement(LeftArea, null, menu), /*#__PURE__*/React.createElement(MainArea, {
545
- center: center
546
- }, header != null && /*#__PURE__*/React.createElement(Header, null, header), isHeaderTopMenu && /*#__PURE__*/React.createElement(HeaderTopMenuContainer, null, menu), /*#__PURE__*/React.createElement(Grid, null, children))), /*#__PURE__*/React.createElement(GlobalStyle, null));
547
- }
548
- const HeaderTopMenuContainer = styled.div(_t$a || (_t$a = _$9`
549
- margin-bottom: 40px;
550
- overflow-x: auto;
551
- word-break: keep-all;
552
-
553
- @media ${0} {
554
- margin-bottom: 0;
555
- padding-left: 16px;
556
- padding-bottom: 16px;
557
- background-color: ${0};
558
- }
559
- `), ({
560
- theme
561
- }) => maxWidth(theme.breakpoint.screen1), ({
562
- theme
563
- }) => theme.color.surface2);
564
- const GlobalStyle = createGlobalStyle(_t2$8 || (_t2$8 = _$9`
565
- :root {
566
- background-color: ${0};
567
-
568
- @media ${0} {
569
- background-color: ${0};
570
- }
571
- }
572
- `), ({
573
- theme
574
- }) => theme.color.background2, ({
575
- theme
576
- }) => maxWidth(theme.breakpoint.screen1), ({
577
- theme
578
- }) => theme.color.background1);
579
- const LayoutRoot = styled.div(_t3$7 || (_t3$7 = _$9`
580
- display: flex;
581
- background-color: ${0};
582
-
583
- @media ${0} {
584
- background-color: ${0};
585
- }
586
- `), ({
587
- theme
588
- }) => theme.color.background2, ({
589
- theme
590
- }) => maxWidth(theme.breakpoint.screen1), ({
591
- theme
592
- }) => theme.color.background1);
593
- const LeftArea = styled.div(_t4$6 || (_t4$6 = _$9`
594
- min-width: ${0}px;
595
- padding: 40px 0 40px ${0}px;
596
- box-sizing: border-box;
597
-
598
- @media ${0} {
599
- display: none;
600
- }
601
- `), RESPONSIVE_LEFT_WIDTH, GUTTER_UNIT, ({
602
- theme
603
- }) => theme.breakpoint.screen3);
604
- const MainArea = styled.div(_t5$5 || (_t5$5 = _$9`
605
- flex-grow: 1;
606
- /* https://www.w3.org/TR/css-flexbox-1/#min-size-auto */
607
- min-width: 0;
608
- max-width: ${0}px;
609
- padding: 40px ${0}px;
610
- margin: 0 auto;
611
- display: flex;
612
- flex-direction: column;
613
-
614
- @media ${0} {
615
- padding: 0;
616
- }
617
- `), p => p.center ? columnSystem(6, COLUMN_UNIT, GUTTER_UNIT) : RESPONSIVE_MAIN_MAX_WIDTH, MAIN_COLUMN_HORIZONTAL_MIN_MARGIN, ({
618
- theme
619
- }) => maxWidth(theme.breakpoint.screen1));
620
- const Header = styled.div(_t6$4 || (_t6$4 = _$9`
621
- font-weight: bold;
622
- margin-bottom: 12px;
623
- font-size: 20px;
624
- line-height: 28px;
625
- color: ${0};
626
-
627
- @media ${0} {
628
- margin-bottom: 0;
629
- padding: 12px;
630
- font-size: 16px;
631
- line-height: 24px;
632
- display: flex;
633
- justify-content: center;
634
- background-color: ${0};
635
- }
636
- `), ({
637
- theme
638
- }) => theme.color.text2, ({
639
- theme
640
- }) => maxWidth(theme.breakpoint.screen1), ({
641
- theme
642
- }) => theme.color.surface2);
643
- const Grid = styled.div(_t7$4 || (_t7$4 = _$9`
644
- display: grid;
645
- gap: ${0}px;
646
- grid-template-columns: 1fr;
647
- grid-auto-columns: 1fr;
648
- grid-auto-rows: auto;
649
-
650
- @media ${0} {
651
- gap: 0;
652
- background-color: ${0};
653
- padding-bottom: 60px;
654
- }
655
- `), GUTTER_UNIT, ({
656
- theme
657
- }) => maxWidth(theme.breakpoint.screen1), ({
658
- theme
659
- }) => theme.color.background1);
660
- const LayoutItem = React.forwardRef(function LayoutItem({
661
- span,
662
- children
663
- }, ref) {
664
- const {
665
- withLeft
666
- } = useContext(LayoutConfigContext);
667
- return /*#__PURE__*/React.createElement(StyledLayoutItem, {
668
- span: span,
669
- withLeft: withLeft,
670
- ref: ref
671
- }, children);
672
- });
673
- const StyledLayoutItem = styled.div(_t8$4 || (_t8$4 = _$9`
674
- grid-column-start: auto;
675
- grid-column-end: span ${0};
676
- border-radius: 24px;
677
- color: ${0};
678
- background-color: ${0};
679
- /* https://www.w3.org/TR/css-grid-1/#min-size-auto */
680
- min-width: 0;
681
-
682
- @media ${0} {
683
- ${0}
684
- }
685
-
686
- @media ${0} {
687
- ${0}
688
-
689
- border-radius: 0;
690
- padding-bottom: 40px;
691
- }
692
- `), p => p.span, ({
693
- theme
694
- }) => theme.color.text2, ({
695
- theme
696
- }) => theme.color.background1, p => p.withLeft ? p.theme.breakpoint.screen4 : p.theme.breakpoint.screen3, p => p.span > 2 && css(_t9$4 || (_t9$4 = _$9`
697
- grid-column-end: span 2;
698
- `)), ({
699
- theme
700
- }) => maxWidth(theme.breakpoint.screen1), p => p.span > 1 && css(_t10$4 || (_t10$4 = _$9`
701
- grid-column-end: span 1;
702
- `)));
703
- function LayoutItemHeader({
704
- children
705
- }) {
706
- const {
707
- wide,
708
- center
709
- } = useContext(LayoutConfigContext);
710
- return /*#__PURE__*/React.createElement(StyledLayoutItemHeader, {
711
- wide: wide,
712
- center: center
713
- }, children);
714
- }
715
- const StyledLayoutItemHeader = styled.div(_t11$1 || (_t11$1 = _$9`
716
- padding: 0 ${0}px;
717
- height: ${0}px;
718
- display: grid;
719
- align-items: center;
720
- font-size: 16px;
721
- line-height: 24px;
722
- font-weight: bold;
723
- background-color: ${0};
724
- color: ${0};
725
- border-radius: 24px 24px 0 0;
726
- ${0}
727
-
728
- @media ${0} {
729
- margin-top: 4px;
730
- padding: 0 16px;
731
- background: none;
732
- overflow-x: auto;
733
- border-radius: unset;
734
- ${0}
735
- }
736
- `), p => p.wide ? 40 : 24, p => p.wide ? 64 : 48, ({
737
- theme
738
- }) => theme.color.surface2, ({
739
- theme
740
- }) => theme.color.text2, p => p.center && css(_t12$1 || (_t12$1 = _$9`
741
- justify-content: center;
742
- `)), ({
743
- theme
744
- }) => maxWidth(theme.breakpoint.screen1), p => p.wide && css(_t13$1 || (_t13$1 = _$9`
745
- height: 48px;
746
- margin-top: 0;
747
- `)));
748
- const LAYOUT_ITEM_BODY_PADDING = {
749
- wide: {
750
- x: 40,
751
- y: 40
752
- },
753
- default: {
754
- x: 24,
755
- y: 24
756
- },
757
- column1: {
758
- x: 16,
759
- y: 16
760
- },
761
- narrow: {
762
- x: 24,
763
- yTop: 12,
764
- yBottom: 20
765
- },
766
- narrowColumn1: {
767
- x: 16,
768
- yTop: 4,
769
- yBottom: 0
770
- }
771
- };
772
- function LayoutItemBody({
773
- children,
774
- horizontal = false,
775
- narrow = false
776
- }) {
777
- const {
778
- wide
779
- } = useContext(LayoutConfigContext);
780
- return /*#__PURE__*/React.createElement(StyledLayoutItemBody, {
781
- wide: wide,
782
- horizontal: horizontal,
783
- narrow: narrow
784
- }, children);
785
- }
786
- const StyledLayoutItemBody = styled.div(_t14 || (_t14 = _$9`
787
- padding: ${0};
788
-
789
- @media ${0} {
790
- padding: ${0};
791
- }
792
-
793
- width: 100%;
794
- box-sizing: border-box;
795
- `), 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`, ({
796
- theme
797
- }) => maxWidth(theme.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}`);
798
- function useLayoutItemBodyPadding() {
799
- const {
800
- wide
801
- } = useContext(LayoutConfigContext);
802
- return useMediaScreen1() ? LAYOUT_ITEM_BODY_PADDING.column1 : wide ? LAYOUT_ITEM_BODY_PADDING.wide : LAYOUT_ITEM_BODY_PADDING.default;
803
- }
804
- function CancelLayoutItemBodyPadding({
805
- children,
806
- cancelTop
807
- }) {
808
- const {
809
- wide
810
- } = useContext(LayoutConfigContext);
811
- return /*#__PURE__*/React.createElement(StyledCancelLayoutItemBodyPadding, {
812
- wide: wide,
813
- cancelTop: cancelTop
814
- }, children);
815
- }
816
- /* eslint-disable max-len */
817
-
818
- const StyledCancelLayoutItemBodyPadding = styled.div(_t15 || (_t15 = _$9`
819
- margin: 0 -${0}px;
820
- margin-top: -${0}px;
821
-
822
- @media ${0} {
823
- margin: 0 -${0}px;
824
- margin-top: -${0}px;
825
- }
826
- `), p => p.wide ? LAYOUT_ITEM_BODY_PADDING.wide.x : LAYOUT_ITEM_BODY_PADDING.default.x, ({
827
- cancelTop: _cancelTop = false,
828
- wide
829
- }) => !_cancelTop ? 0 : wide ? LAYOUT_ITEM_BODY_PADDING.wide.y : LAYOUT_ITEM_BODY_PADDING.default.y, ({
830
- theme
831
- }) => maxWidth(theme.breakpoint.screen1), LAYOUT_ITEM_BODY_PADDING.column1.x, ({
832
- cancelTop: _cancelTop2 = false
833
- }) => !_cancelTop2 ? 0 : LAYOUT_ITEM_BODY_PADDING.column1.x);
834
- /* eslint-enable max-len */
835
-
836
- // https://github.com/fernandopasik/react-children-utilities/blob/971d8a0324e6183734d8d1af9a65dbad18ab3d00/src/lib/onlyText.ts
837
-
838
- const hasChildren = element => isValidElement(element) && Boolean(element.props.children);
839
-
840
- const childToString = ( // eslint-disable-next-line @typescript-eslint/ban-types
841
- child) => {
842
- if (typeof child === 'undefined' || child === null || typeof child === 'boolean') {
843
- return '';
844
- }
845
-
846
- if (JSON.stringify(child) === '{}') {
847
- return '';
848
- }
849
-
850
- return child.toString();
851
- };
852
- const onlyText = children => {
853
- if (!Array.isArray(children) && !isValidElement(children)) {
854
- return childToString(children);
855
- }
856
-
857
- return Children$1.toArray(children).reduce((text, child) => {
858
- let newText = '';
859
-
860
- if (isValidElement(child) && hasChildren(child)) {
861
- newText = onlyText(child.props.children);
862
- } else if (isValidElement(child) && !hasChildren(child)) {
863
- newText = '';
864
- } else {
865
- newText = childToString(child);
866
- }
867
-
868
- return text.concat(newText);
869
- }, '');
870
- };
871
-
872
- let _$8 = t => t,
873
- _t$9,
874
- _t2$7,
875
- _t3$6;
876
- /**
877
- * 複数行のテキストに表示行数制限を設けて`...`で省略する
878
- */
879
-
880
- const TextEllipsis = styled.div.attrs(({
881
- children,
882
- title: _title = onlyText(children)
883
- }) => ({
884
- title: _title !== '' ? _title : undefined
885
- }))(_t$9 || (_t$9 = _$8`
886
- overflow: hidden;
887
- line-height: ${0}px;
888
- /* For english */
889
- overflow-wrap: break-word;
890
-
891
- ${0}
892
- `), props => props.lineHeight, ({
893
- lineLimit: _lineLimit = 1,
894
- lineHeight
895
- }) => _lineLimit === 1 ? css(_t2$7 || (_t2$7 = _$8`
896
- text-overflow: ellipsis;
897
- white-space: nowrap;
898
- `)) : css(_t3$6 || (_t3$6 = _$8`
899
- display: -webkit-box;
900
- -webkit-box-orient: vertical;
901
- -webkit-line-clamp: ${0};
902
- /* Fallback for -webkit-line-clamp */
903
- max-height: ${0}px;
904
- `), _lineLimit, lineHeight * _lineLimit));
905
-
906
- const _excluded$2 = ["link", "onClick", "disabled", "primary", "secondary", "gtmClass", "noHover", "children"],
907
- _excluded2 = ["icon", "primary"],
908
- _excluded3 = ["icon", "primary"];
909
-
910
- let _$7 = t => t,
911
- _t$8,
912
- _t2$6,
913
- _t3$5,
914
- _t4$5,
915
- _t5$4,
916
- _t6$3,
917
- _t7$3,
918
- _t8$3,
919
- _t9$3,
920
- _t10$3;
921
- const MenuListItemContext = React.createContext({
922
- padding: 24
923
- });
924
- function MenuListItem({
925
- primary,
926
- secondary,
927
- onClick,
928
- disabled = false,
929
- noHover = false,
930
- gtmClass,
931
- children
932
- }) {
933
- const {
934
- padding
935
- } = useContext(MenuListItemContext);
936
- return /*#__PURE__*/React.createElement(Item, {
937
- hasSubLabel: secondary !== undefined,
938
- onClick: e => !disabled && onClick && onClick(e),
939
- sidePadding: padding,
940
- noHover: noHover,
941
- noClick: onClick === undefined,
942
- "aria-disabled": disabled,
943
- role: onClick !== undefined ? 'button' : undefined,
944
- className: gtmClass !== undefined ? `gtm-${gtmClass}` : undefined
945
- }, /*#__PURE__*/React.createElement(Labels, null, /*#__PURE__*/React.createElement(PrimaryText, null, /*#__PURE__*/React.createElement(TextEllipsis, {
946
- lineHeight: 22,
947
- lineLimit: 1
948
- }, primary)), secondary !== undefined && /*#__PURE__*/React.createElement(SecondaryText, null, /*#__PURE__*/React.createElement(TextEllipsis, {
949
- lineHeight: 22,
950
- lineLimit: 1
951
- }, secondary))), children);
952
- }
953
- const Item = styled.div(_t$8 || (_t$8 = _$7`
954
- display: flex;
955
- height: ${0}px;
956
- align-items: center;
957
- justify-content: space-between;
958
- padding: 0 ${0}px;
959
- user-select: none;
960
- cursor: ${0};
961
- transition: 0.2s background-color;
962
-
963
- &:hover {
964
- ${0}
965
- }
966
-
967
- ${0}
968
-
969
- ${0} {
970
- cursor: default;
971
- pointer-events: none;
972
-
973
- &:hover {
974
- background-color: unset;
975
- }
976
- }
977
- `), p => p.hasSubLabel ? 56 : 40, p => p.sidePadding, p => p.noClick ? 'default' : 'pointer', p => !p.noHover && css(_t2$6 || (_t2$6 = _$7`
978
- background-color: ${0};
979
- `), ({
980
- theme
981
- }) => theme.color.surface3), theme(o => o.disabled), disabledSelector);
982
- const Labels = styled.div(_t3$5 || (_t3$5 = _$7`
983
- display: flex;
984
- flex-direction: column;
985
- `));
986
- const PrimaryText = styled.div(_t4$5 || (_t4$5 = _$7`
987
- color: ${0};
988
- line-height: 22px;
989
- font-size: 14px;
990
- display: grid;
991
- `), p => p.theme.color.text2);
992
- const SecondaryText = styled.div(_t5$4 || (_t5$4 = _$7`
993
- color: ${0};
994
- line-height: 18px;
995
- font-size: 10px;
996
- `), p => p.theme.color.text3);
997
- function MenuListLinkItem(_ref) {
998
- let {
999
- link,
1000
- onClick,
1001
- disabled = false,
1002
- primary,
1003
- secondary,
1004
- gtmClass,
1005
- noHover,
1006
- children
1007
- } = _ref,
1008
- linkProps = _objectWithoutPropertiesLoose(_ref, _excluded$2);
1009
-
1010
- const {
1011
- Link
1012
- } = useComponentAbstraction();
1013
- const props = {
1014
- disabled,
1015
- primary,
1016
- secondary,
1017
- gtmClass,
1018
- noHover,
1019
- children
1020
- };
1021
- return disabled ? /*#__PURE__*/React.createElement("span", {
1022
- onClick: onClick
1023
- }, /*#__PURE__*/React.createElement(MenuListItem, props)) : /*#__PURE__*/React.createElement(A, _extends({
1024
- as: Link,
1025
- to: link,
1026
- onClick: onClick
1027
- }, linkProps), /*#__PURE__*/React.createElement(MenuListItem, _extends({
1028
- onClick: () => void 0
1029
- }, props)));
1030
- }
1031
- const A = styled.a(_t6$3 || (_t6$3 = _$7`
1032
- display: block;
1033
- `));
1034
- function MenuListLinkItemWithIcon(_ref2) {
1035
- let {
1036
- icon,
1037
- primary: text
1038
- } = _ref2,
1039
- props = _objectWithoutPropertiesLoose(_ref2, _excluded2);
1040
-
1041
- const primary = /*#__PURE__*/React.createElement(IconContainer, null, /*#__PURE__*/React.createElement(Icon$1, null, icon), text);
1042
- return /*#__PURE__*/React.createElement(MenuListLinkItem, _extends({
1043
- primary: primary
1044
- }, props));
1045
- }
1046
- function MenuListItemWithIcon(_ref3) {
1047
- let {
1048
- icon,
1049
- primary: text
1050
- } = _ref3,
1051
- props = _objectWithoutPropertiesLoose(_ref3, _excluded3);
1052
-
1053
- const primary = /*#__PURE__*/React.createElement(IconContainer, null, /*#__PURE__*/React.createElement(Icon$1, null, icon), text);
1054
- return /*#__PURE__*/React.createElement(MenuListItem, _extends({
1055
- primary: primary
1056
- }, props));
1057
- }
1058
- const IconContainer = styled.div(_t7$3 || (_t7$3 = _$7`
1059
- display: grid;
1060
- gap: 8px;
1061
- grid-auto-flow: column;
1062
- align-items: center;
1063
- `));
1064
- const Icon$1 = styled.div(_t8$3 || (_t8$3 = _$7`
1065
- color: ${0};
1066
- display: flex;
1067
- `), ({
1068
- theme
1069
- }) => theme.color.text3);
1070
- const MenuListSpacer = styled.div(_t9$3 || (_t9$3 = _$7`
1071
- height: 24px;
1072
- `));
1073
- const MenuListLabel = styled.div(_t10$3 || (_t10$3 = _$7`
1074
- padding: 0 16px;
1075
- font-size: 12px;
1076
- line-height: 16px;
1077
- color: ${0};
1078
- margin-top: -2px;
1079
- margin-bottom: 6px;
1080
- `), ({
1081
- theme
1082
- }) => theme.color.text3);
1083
-
1084
- let _$6 = t => t,
1085
- _t$7,
1086
- _t2$5;
1087
- function LeftMenu({
1088
- links,
1089
- active
1090
- }) {
1091
- const {
1092
- Link
1093
- } = useComponentAbstraction();
1094
- return /*#__PURE__*/React.createElement(Container$1, null, links.map((link, index) => /*#__PURE__*/React.createElement(Link, {
1095
- to: link.to,
1096
- key: index
1097
- }, /*#__PURE__*/React.createElement(LinkItem, {
1098
- "aria-current": link.id === active || undefined
1099
- }, link.text))));
1100
- }
1101
- function LeftMenuContent({
1102
- links
1103
- }) {
1104
- return /*#__PURE__*/React.createElement(React.Fragment, null, links.map((link, index) => /*#__PURE__*/React.createElement(MenuListLinkItem, {
1105
- link: link.to,
1106
- key: index,
1107
- primary: link.text
1108
- })));
1109
- }
1110
- const Container$1 = styled.div(_t$7 || (_t$7 = _$6`
1111
- display: flex;
1112
- flex-direction: column;
1113
- align-items: flex-start;
1114
- `));
1115
- const LinkItem = styled.div(_t2$5 || (_t2$5 = _$6`
1116
- display: flex;
1117
- align-items: center;
1118
- color: ${0};
1119
- border-radius: 24px;
1120
- font-weight: bold;
1121
- font-size: 14px;
1122
- line-height: 22px;
1123
- padding: 0 16px;
1124
- height: 40px;
1125
- transition: 0.2s color;
1126
- &:hover {
1127
- transition: 0.2s color;
1128
- color: ${0};
1129
- }
1130
- &[aria-current] {
1131
- color: ${0};
1132
- background-color: ${0};
1133
- }
1134
- `), ({
1135
- theme
1136
- }) => theme.color.text3, ({
1137
- theme
1138
- }) => theme.color.text2, ({
1139
- theme
1140
- }) => theme.color.text2, ({
1141
- theme
1142
- }) => theme.color.surface3);
1143
-
1144
- let _$5 = t => t,
1145
- _t$6,
1146
- _t2$4,
1147
- _t3$4,
1148
- _t4$4,
1149
- _t5$3,
1150
- _t6$2,
1151
- _t7$2,
1152
- _t8$2,
1153
- _t9$2,
1154
- _t10$2;
1155
-
1156
- const _excluded$1 = ["gtmClass", "flex", "rowReverse", "children", "disabled"];
1157
- var index$2 = React.forwardRef(function SwitchCheckbox(_ref, ref) {
1158
- let {
1159
- gtmClass,
1160
- flex = false,
1161
- rowReverse = false,
1162
- children,
1163
- disabled
1164
- } = _ref,
1165
- props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
1166
-
1167
- return /*#__PURE__*/React.createElement(Label, {
1168
- className: gtmClass !== undefined ? `gtm-${gtmClass}` : '',
1169
- flex: flex,
1170
- rowReverse: rowReverse,
1171
- "aria-disabled": disabled
1172
- }, /*#__PURE__*/React.createElement(SwitchOuter, null, /*#__PURE__*/React.createElement(SwitchInput, _extends({}, props, {
1173
- disabled: disabled,
1174
- ref: ref
1175
- })), /*#__PURE__*/React.createElement(SwitchInner, null, /*#__PURE__*/React.createElement(SwitchInnerKnob, null))), children != null && /*#__PURE__*/React.createElement(Children, {
1176
- rowReverse: rowReverse
1177
- }, children));
1178
- });
1179
- const Children = styled.span(_t$6 || (_t$6 = _$5`
1180
- ${0}
1181
- `), p => p.rowReverse ? css(_t2$4 || (_t2$4 = _$5`
1182
- margin-right: 8px;
1183
- `)) : css(_t3$4 || (_t3$4 = _$5`
1184
- margin-left: 8px;
1185
- `)));
1186
- const Label = styled.label(_t4$4 || (_t4$4 = _$5`
1187
- display: inline-flex;
1188
- align-items: center;
1189
- ${0}
1190
- ${0}
1191
- cursor: pointer;
1192
- outline: 0;
1193
-
1194
- &[aria-disabled='true'] {
1195
- cursor: auto;
1196
- }
1197
- `), ({
1198
- flex
1199
- }) => flex && css(_t5$3 || (_t5$3 = _$5`
1200
- display: flex;
1201
- justify-content: space-between;
1202
- `)), ({
1203
- rowReverse
1204
- }) => css(_t6$2 || (_t6$2 = _$5`
1205
- flex-direction: ${0};
1206
- `), rowReverse ? 'row-reverse' : 'row'));
1207
- const SwitchOuter = styled.span(_t7$2 || (_t7$2 = _$5`
1208
- display: inline-flex;
1209
- position: relative;
1210
- z-index: 0;
1211
- `));
1212
- const SwitchInner = styled.div(_t8$2 || (_t8$2 = _$5`
1213
- position: relative;
1214
- box-sizing: border-box;
1215
- width: 28px;
1216
- height: 16px;
1217
- border-radius: 16px;
1218
- border: 2px solid transparent;
1219
- background: ${0};
1220
- transition: box-shadow 0.2s, background-color 0.2s;
1221
- `), ({
1222
- theme
1223
- }) => theme.color.text4);
1224
- const SwitchInnerKnob = styled.div(_t9$2 || (_t9$2 = _$5`
1225
- position: absolute;
1226
- display: block;
1227
- top: 0;
1228
- left: 0;
1229
- width: 12px;
1230
- height: 12px;
1231
- background-color: ${0};
1232
- border-radius: 50%;
1233
- transform: translateX(0);
1234
- transition: transform 0.2s;
1235
- `), ({
1236
- theme
1237
- }) => theme.color.text5);
1238
- const SwitchInput = styled.input.attrs({
1239
- type: 'checkbox'
1240
- })(_t10$2 || (_t10$2 = _$5`
1241
- position: absolute;
1242
- /* NOTE: this is contained by the GraphicCheckboxOuter */
1243
- z-index: 1;
1244
- top: 0;
1245
- left: 0;
1246
- width: 100%;
1247
- height: 100%;
1248
- /* just to control the clickable area if used standalone */
1249
- border-radius: 16px;
1250
- opacity: 0;
1251
- appearance: none;
1252
- outline: none;
1253
- cursor: pointer;
1254
-
1255
- &:checked {
1256
- ~ ${0} {
1257
- background-color: ${0};
1258
-
1259
- ${0} {
1260
- transform: translateX(12px);
1261
- }
1262
- }
1263
- }
1264
-
1265
- &:disabled {
1266
- cursor: auto;
1267
-
1268
- ~ ${0} {
1269
- opacity: ${0};
1270
- }
1271
- }
1272
-
1273
- &:not(:disabled):focus {
1274
- ~ ${0} {
1275
- box-shadow: 0 0 0 4px
1276
- ${0};
1277
- }
1278
- }
1279
- `), SwitchInner, ({
1280
- theme
1281
- }) => theme.color.brand, SwitchInnerKnob, SwitchInner, ({
1282
- theme
1283
- }) => theme.elementEffect.disabled.opacity, SwitchInner, ({
1284
- theme
1285
- }) => applyEffect(theme.color.brand, theme.elementEffect.disabled));
1286
-
1287
- let _$4 = t => t,
1288
- _t$5,
1289
- _t2$3,
1290
- _t3$3,
1291
- _t4$3,
1292
- _t5$2,
1293
- _t6$1,
1294
- _t7$1,
1295
- _t8$1,
1296
- _t9$1,
1297
- _t10$1,
1298
- _t11,
1299
- _t12,
1300
- _t13;
1301
- var index$1 = React.memo(function WithIcon({
1302
- children,
1303
- icon,
1304
- show = true,
1305
- prefix: pre = false,
1306
- width,
1307
- fit = false,
1308
- fixed = false
1309
- }) {
1310
- const node = fit ? width === undefined ? /*#__PURE__*/React.createElement(AutoWidthIconAnchor, {
1311
- show: show,
1312
- pre: pre
1313
- }, icon) : /*#__PURE__*/React.createElement(IconAnchor, {
1314
- width: width,
1315
- show: show,
1316
- pre: pre
1317
- }, /*#__PURE__*/React.createElement(Icon, null, icon)) : /*#__PURE__*/React.createElement(IconAnchorNaive, {
1318
- show: show,
1319
- pre: pre
1320
- }, /*#__PURE__*/React.createElement(IconNaive, null, icon));
1321
- return /*#__PURE__*/React.createElement(Root, null, pre && node, /*#__PURE__*/React.createElement(Text$1, {
1322
- fixed: fixed
1323
- }, children), !pre && node);
1324
- });
1325
- const Root = styled.div(_t$5 || (_t$5 = _$4`
1326
- display: flex;
1327
- align-items: center;
1328
- `));
1329
- const Text$1 = styled.div(_t2$3 || (_t2$3 = _$4`
1330
- ${0}
1331
- white-space: nowrap;
1332
- text-overflow: ellipsis;
1333
- `), p => !p.fixed && css(_t3$3 || (_t3$3 = _$4`
1334
- min-width: 0;
1335
- overflow: hidden;
1336
- `)));
1337
-
1338
- function AutoWidthIconAnchor({
1339
- children,
1340
- show,
1341
- pre
1342
- }) {
1343
- var _useElementSize$width, _useElementSize;
1344
-
1345
- const ref = useRef(null); // depsを空配列にしないことで初回だけ同期で幅を計算させるテクニック
1346
-
1347
- const width = (_useElementSize$width = (_useElementSize = useElementSize(ref, [null])) == null ? void 0 : _useElementSize.width) != null ? _useElementSize$width : 0;
1348
- return /*#__PURE__*/React.createElement(IconAnchor, {
1349
- width: width,
1350
- show: show,
1351
- pre: pre
1352
- }, /*#__PURE__*/React.createElement(Icon, {
1353
- ref: ref
1354
- }, children));
1355
- }
1356
-
1357
- const forceCenteringCss = css(_t4$3 || (_t4$3 = _$4`
1358
- > svg {
1359
- display: block;
1360
- }
1361
- `));
1362
- const iconAnchorCss = css(_t5$2 || (_t5$2 = _$4`
1363
- ${0};
1364
- ${0}
1365
- `), p => p.show === 'collapse' ? css(_t6$1 || (_t6$1 = _$4`
1366
- display: none;
1367
- `)) : css(_t7$1 || (_t7$1 = _$4`
1368
- visibility: ${0};
1369
- `), p.show ? 'visible' : 'hidden'), p => p.pre ? css(_t8$1 || (_t8$1 = _$4`
1370
- margin-right: 4px;
1371
- `)) : css(_t9$1 || (_t9$1 = _$4`
1372
- margin-left: 4px;
1373
- `)));
1374
- const IconAnchorNaive = styled.div(_t10$1 || (_t10$1 = _$4`
1375
- display: flex;
1376
- align-items: center;
1377
-
1378
- ${0}
1379
- `), iconAnchorCss);
1380
- const IconNaive = styled.div(_t11 || (_t11 = _$4`
1381
- display: inline-flex;
1382
-
1383
- ${0}
1384
- `), forceCenteringCss);
1385
- const IconAnchor = styled.div(_t12 || (_t12 = _$4`
1386
- display: flex;
1387
- position: relative;
1388
- /* Iconをline-heightに関与させない */
1389
- height: 0;
1390
- /* 横方向の領域は確保する */
1391
- width: ${0}px;
1392
-
1393
- ${0}
1394
- `), p => p.width, iconAnchorCss);
1395
- const Icon = styled.div(_t13 || (_t13 = _$4`
1396
- display: inline-flex;
1397
- position: absolute;
1398
- transform: translateY(-50%);
1399
-
1400
- ${0}
1401
- `), forceCenteringCss);
1402
-
1403
- var passiveEventsResult; // eslint-disable-line no-var
1404
-
1405
- function passiveEvents() {
1406
- if (passiveEventsResult !== undefined) {
1407
- return passiveEventsResult;
1408
- }
1409
-
1410
- passiveEventsResult = false;
1411
-
1412
- try {
1413
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
1414
- const options = Object.defineProperty({}, 'passive', {
1415
- get() {
1416
- return passiveEventsResult = true;
1417
- }
1418
-
1419
- });
1420
- window.addEventListener('test', test, options);
1421
- window.removeEventListener('test', test);
1422
- } catch (_unused) {// test fail
1423
- }
1424
-
1425
- return passiveEventsResult;
1426
-
1427
- function test() {
1428
- /* empty */
1429
- }
1430
- }
1431
- const isEdge = () => navigator.userAgent.includes('Edge/');
1432
-
1433
- const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
1434
-
1435
- function unreachable(value) {
1436
- throw new Error(arguments.length === 0 ? 'unreachable' : `unreachable (${JSON.stringify(value)})`);
1437
- }
1438
-
1439
- var WedgeDirection$1;
1440
-
1441
- (function (WedgeDirection) {
1442
- WedgeDirection["Up"] = "up";
1443
- WedgeDirection["Down"] = "down";
1444
- WedgeDirection["Left"] = "left";
1445
- WedgeDirection["Right"] = "right";
1446
- })(WedgeDirection$1 || (WedgeDirection$1 = {})); // eslint-disable-next-line max-len
1447
-
1448
-
1449
- const 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`;
1450
- const size = 24;
1451
- function NextIcon({
1452
- direction
1453
- }) {
1454
- const transform = directionToTransform$1(direction);
1455
- return /*#__PURE__*/React.createElement(IconBase, {
1456
- viewBoxSize: size,
1457
- size: size,
1458
- currentColor: true,
1459
- path: path,
1460
- transform: transform
1461
- });
1462
- }
1463
-
1464
- function directionToTransform$1(direction) {
1465
- // "5 4" is the center point of the "0 0 10 8" viewBox
1466
- switch (direction) {
1467
- case WedgeDirection$1.Up:
1468
- return 'rotate(270 12 12)';
1469
-
1470
- case WedgeDirection$1.Down:
1471
- return 'rotate(90 12 12)';
1472
-
1473
- case WedgeDirection$1.Left:
1474
- return 'rotate(180 12 12)';
1475
-
1476
- case WedgeDirection$1.Right:
1477
- return undefined;
1478
-
1479
- default:
1480
- return unreachable(direction);
1481
- }
1482
- }
1483
-
1484
- let _$3 = t => t,
1485
- _t$4,
1486
- _t2$2,
1487
- _t3$2,
1488
- _t4$2,
1489
- _t5$1;
1490
- var Direction;
1491
-
1492
- (function (Direction) {
1493
- Direction["Right"] = "right";
1494
- Direction["Left"] = "left";
1495
- })(Direction || (Direction = {}));
1496
-
1497
- function CarouselButton({
1498
- direction,
1499
- show,
1500
- offset = 0,
1501
- padding = 0,
1502
- bottomOffset: bottom = 0,
1503
- gradient = false,
1504
- onClick
1505
- }) {
1506
- const offsetStyle = direction === Direction.Left ? {
1507
- left: gradient ? offset - 72 : offset,
1508
- paddingLeft: Math.max(padding, 0),
1509
- paddingBottom: bottom
1510
- } : {
1511
- right: gradient ? offset - 72 : offset,
1512
- paddingRight: Math.max(padding, 0),
1513
- paddingBottom: bottom
1514
- };
1515
- return /*#__PURE__*/React.createElement(Button, {
1516
- type: "button",
1517
- onClick: onClick,
1518
- hide: !show,
1519
- style: offsetStyle,
1520
- css: onlyNonTouchDevice
1521
- }, /*#__PURE__*/React.createElement(CarouselButtonIcon, null, /*#__PURE__*/React.createElement(NextIcon, {
1522
- direction: direction === Direction.Right ? WedgeDirection$1.Right : // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
1523
- direction === Direction.Left ? WedgeDirection$1.Left : unreachable()
1524
- })));
1525
- }
1526
- const CAROUSEL_BUTTON_SIZE = 40;
1527
- const CarouselButtonIcon = styled.div(_t$4 || (_t$4 = _$3`
1528
- display: flex;
1529
- align-items: center;
1530
- justify-content: center;
1531
- width: ${0}px;
1532
- height: ${0}px;
1533
- border-radius: 50%;
1534
- background-color: ${0};
1535
- transition: 0.4s visibility, 0.4s opacity, 0.2s background-color, 0.2s color;
1536
- color: ${0};
1537
- `), CAROUSEL_BUTTON_SIZE, CAROUSEL_BUTTON_SIZE, ({
1538
- theme
1539
- }) => theme.color.surface4, ({
1540
- theme
1541
- }) => theme.color.text5);
1542
- const Button = styled.button(_t2$2 || (_t2$2 = _$3`
1543
- position: absolute;
1544
- top: 0;
1545
- bottom: 0;
1546
- display: flex;
1547
- align-items: center;
1548
- padding: 0;
1549
- min-width: 40px;
1550
- border: none;
1551
- outline: 0;
1552
- background: transparent;
1553
- cursor: pointer;
1554
- transition: 0.4s visibility, 0.4s opacity;
1555
- /* つらい */
1556
- /* このコンポーネントはCarouselでしか使われてないのでそっちでコンテキストで切る */
1557
- z-index: 1;
1558
-
1559
- &:hover ${0} {
1560
- background-color: ${0};
1561
- color: ${0};
1562
- }
1563
-
1564
- &:active ${0} {
1565
- background-color: ${0};
1566
- color: ${0};
1567
- }
1568
-
1569
- ${0}
1570
- `), CarouselButtonIcon, ({
1571
- theme
1572
- }) => applyEffect(theme.color.surface4, theme.effect.hover), ({
1573
- theme
1574
- }) => applyEffect(theme.color.text5, theme.effect.hover), CarouselButtonIcon, ({
1575
- theme
1576
- }) => applyEffect(theme.color.surface4, theme.effect.press), ({
1577
- theme
1578
- }) => applyEffect(theme.color.text5, theme.effect.press), p => p.hide && css(_t3$2 || (_t3$2 = _$3`
1579
- visibility: hidden;
1580
- opacity: 0;
1581
- pointer-events: none;
1582
- `)));
1583
- styled(CarouselButtonIcon)(_t4$2 || (_t4$2 = _$3`
1584
- cursor: pointer;
1585
-
1586
- &:hover {
1587
- background-color: ${0};
1588
- color: ${0};
1589
- }
1590
-
1591
- &:active {
1592
- background-color: ${0};
1593
- color: ${0};
1594
- }
1595
- `), ({
1596
- theme
1597
- }) => applyEffect(theme.color.surface4, theme.effect.hover), ({
1598
- theme
1599
- }) => applyEffect(theme.color.text5, theme.effect.hover), ({
1600
- theme
1601
- }) => applyEffect(theme.color.surface4, theme.effect.press), ({
1602
- theme
1603
- }) => applyEffect(theme.color.text5, theme.effect.press));
1604
- const onlyNonTouchDevice = css(_t5$1 || (_t5$1 = _$3`
1605
- @media (hover: none) and (pointer: coarse) {
1606
- display: none;
1607
- }
1608
- `));
1609
-
1610
- let _$2 = t => t,
1611
- _t$3,
1612
- _t2$1,
1613
- _t3$1,
1614
- _t4$1,
1615
- _t5,
1616
- _t6,
1617
- _t7,
1618
- _t8,
1619
- _t9,
1620
- _t10;
1621
-
1622
- const _excluded = ["buttonOffset", "buttonPadding", "bottomOffset", "defaultScroll", "onScroll", "onResize", "children", "centerItems", "onScrollStateChange", "scrollAmountCoef"];
1623
- const GRADIENT_WIDTH = 72;
1624
- /**
1625
- * カルーセル系のスクロール量の定数
1626
- *
1627
- * @example
1628
- * const scrollAmount = containerElm.clientWidth * SCROLL_AMOUNT_COEF
1629
- */
1630
-
1631
- const SCROLL_AMOUNT_COEF = 0.75;
1632
- function Carousel(_ref) {
1633
- let {
1634
- buttonOffset = 0,
1635
- buttonPadding = 16,
1636
- bottomOffset = 0,
1637
- defaultScroll: {
1638
- align = 'left',
1639
- offset: scrollOffset = 0
1640
- } = {},
1641
- onScroll,
1642
- onResize,
1643
- children,
1644
- centerItems,
1645
- onScrollStateChange,
1646
- scrollAmountCoef = SCROLL_AMOUNT_COEF
1647
- } = _ref,
1648
- options = _objectWithoutPropertiesLoose(_ref, _excluded);
1649
-
1650
- // スクロール位置を保存する
1651
- // アニメーション中の場合は、アニメーション終了時のスクロール位置が保存される
1652
- const [scrollLeft, setScrollLeft] = useDebounceAnimationState(0); // アニメーション中かどうか
1653
-
1654
- const animation = useRef(false); // スクロール可能な領域を保存する
1655
-
1656
- const [maxScrollLeft, setMaxScrollLeft] = useState(0); // 左右のボタンの表示状態を保存する
1657
-
1658
- const [leftShow, setLeftShow] = useState(false);
1659
- const [rightShow, setRightShow] = useState(false); // const [props, set, stop] = useSpring(() => ({
1660
- // scroll: 0
1661
- // }))
1662
-
1663
- const [styles, set] = useSpring(() => ({
1664
- scroll: 0
1665
- }));
1666
- const ref = useRef(null);
1667
- const visibleAreaRef = useRef(null);
1668
- const innerRef = useRef(null);
1669
- const handleRight = useCallback(() => {
1670
- if (visibleAreaRef.current === null) {
1671
- return;
1672
- }
1673
-
1674
- const {
1675
- clientWidth
1676
- } = visibleAreaRef.current; // スクロール領域を超えないように、アニメーションを開始
1677
- // アニメーション中にアニメーションが開始されたときに、アニメーション終了予定の位置から再度計算するようにする
1678
-
1679
- const scroll = Math.min(scrollLeft + clientWidth * scrollAmountCoef, maxScrollLeft);
1680
- setScrollLeft(scroll, true);
1681
- set({
1682
- scroll,
1683
- from: {
1684
- scroll: scrollLeft
1685
- },
1686
- reset: !animation.current
1687
- });
1688
- animation.current = true;
1689
- }, [animation, maxScrollLeft, scrollLeft, set, scrollAmountCoef, setScrollLeft]);
1690
- const handleLeft = useCallback(() => {
1691
- if (visibleAreaRef.current === null) {
1692
- return;
1693
- }
1694
-
1695
- const {
1696
- clientWidth
1697
- } = visibleAreaRef.current;
1698
- const scroll = Math.max(scrollLeft - clientWidth * scrollAmountCoef, 0);
1699
- setScrollLeft(scroll, true);
1700
- set({
1701
- scroll,
1702
- from: {
1703
- scroll: scrollLeft
1704
- },
1705
- reset: !animation.current
1706
- });
1707
- animation.current = true;
1708
- }, [animation, scrollLeft, set, scrollAmountCoef, setScrollLeft]); // スクロール可能な場合にボタンを表示する
1709
- // scrollLeftが変化したときに処理する (アニメーション開始時 & 手動スクロール時)
1710
-
1711
- useEffect(() => {
1712
- const newleftShow = scrollLeft > 0;
1713
- const newrightShow = scrollLeft < maxScrollLeft && maxScrollLeft > 0;
1714
-
1715
- if (newleftShow !== leftShow || newrightShow !== rightShow) {
1716
- setLeftShow(newleftShow);
1717
- setRightShow(newrightShow);
1718
- onScrollStateChange == null ? void 0 : onScrollStateChange(newleftShow || newrightShow);
1719
- }
1720
- }, [leftShow, maxScrollLeft, onScrollStateChange, rightShow, scrollLeft]);
1721
- const handleScroll = useCallback(() => {
1722
- if (ref.current === null) {
1723
- return;
1724
- } // 手動でスクロールが開始されたときにアニメーションを中断
1725
-
1726
-
1727
- if (animation.current) {
1728
- styles.scroll.stop();
1729
- animation.current = false;
1730
- } // スクロール位置を保存 (アニメーションの基準になる)
1731
-
1732
-
1733
- const manualScrollLeft = ref.current.scrollLeft; // 過剰にsetStateが走らないようにDebouceする
1734
-
1735
- setScrollLeft(manualScrollLeft);
1736
- }, [animation, setScrollLeft, styles]); // リサイズが起きたときに、アニメーション用のスクロール領域 & ボタンの表示状態 を再計算する
1737
-
1738
- const handleResize = useCallback(() => {
1739
- if (ref.current === null) {
1740
- return;
1741
- }
1742
-
1743
- const {
1744
- clientWidth,
1745
- scrollWidth
1746
- } = ref.current;
1747
- const newMaxScrollLeft = scrollWidth - clientWidth;
1748
- setMaxScrollLeft(newMaxScrollLeft);
1749
-
1750
- if (onResize) {
1751
- onResize(clientWidth);
1752
- }
1753
- }, [onResize]);
1754
- useIsomorphicLayoutEffect(() => {
1755
- const elm = ref.current;
1756
- const innerElm = innerRef.current;
1757
-
1758
- if (elm === null || innerElm === null) {
1759
- return;
1760
- }
1761
-
1762
- elm.addEventListener('wheel', handleScroll, passiveEvents() && {
1763
- passive: true
1764
- });
1765
- const resizeObserver = new ResizeObserver(handleResize);
1766
- resizeObserver.observe(elm);
1767
- const resizeObserverInner = new ResizeObserver(handleResize);
1768
- resizeObserverInner.observe(innerElm);
1769
- return () => {
1770
- elm.removeEventListener('wheel', handleScroll);
1771
- resizeObserver.disconnect();
1772
- resizeObserverInner.disconnect();
1773
- };
1774
- }, [handleResize, handleScroll]); // 初期スクロールを行う
1775
-
1776
- useIsomorphicLayoutEffect(() => {
1777
- if (align !== 'left' || scrollOffset !== 0) {
1778
- const scroll = ref.current;
1779
-
1780
- if (scroll !== null) {
1781
- 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));
1782
- scroll.scrollLeft = scrollLength;
1783
- setScrollLeft(scrollLength, true);
1784
- }
1785
- } // eslint-disable-next-line react-hooks/exhaustive-deps
1786
-
1787
- }, [ref.current]);
1788
- const handleScrollMove = useCallback(() => {
1789
- if (ref.current === null) {
1790
- return;
1791
- }
1792
-
1793
- if (onScroll) {
1794
- onScroll(ref.current.scrollLeft);
1795
- }
1796
- }, [onScroll]);
1797
- const [disableGradient, setDisableGradient] = useState(false);
1798
- useIsomorphicLayoutEffect(() => {
1799
- if (isEdge()) {
1800
- setDisableGradient(true);
1801
- }
1802
- }, []); // NOTE: Edgeではmaskを使うと要素のレンダリングがバグる(場合によっては画像が表示されない)のでグラデーションを無効にする
1803
-
1804
- if (!disableGradient && options.hasGradient === true) {
1805
- var _options$fadeInGradie;
1806
-
1807
- const fadeInGradient = (_options$fadeInGradie = options.fadeInGradient) != null ? _options$fadeInGradie : false;
1808
- const overflowGradient = !fadeInGradient;
1809
- return /*#__PURE__*/React.createElement(Container, {
1810
- ref: visibleAreaRef
1811
- }, /*#__PURE__*/React.createElement(GradientContainer, {
1812
- fadeInGradient: fadeInGradient
1813
- }, /*#__PURE__*/React.createElement(RightGradient, null, /*#__PURE__*/React.createElement(LeftGradient, {
1814
- show: overflowGradient || scrollLeft > 0
1815
- }, /*#__PURE__*/React.createElement(ScrollArea, {
1816
- ref: ref,
1817
- scrollLeft: styles.scroll,
1818
- onScroll: handleScrollMove
1819
- }, /*#__PURE__*/React.createElement(CarouselContainer, {
1820
- ref: innerRef,
1821
- centerItems: centerItems
1822
- }, children))))), /*#__PURE__*/React.createElement(ButtonsContainer, null, /*#__PURE__*/React.createElement(CarouselButton, {
1823
- direction: Direction.Left,
1824
- show: leftShow,
1825
- offset: buttonOffset,
1826
- bottomOffset: bottomOffset,
1827
- padding: buttonPadding,
1828
- gradient: overflowGradient,
1829
- onClick: handleLeft
1830
- }), /*#__PURE__*/React.createElement(CarouselButton, {
1831
- direction: Direction.Right,
1832
- show: rightShow,
1833
- offset: buttonOffset,
1834
- bottomOffset: bottomOffset,
1835
- padding: buttonPadding,
1836
- gradient: true,
1837
- onClick: handleRight
1838
- })));
1839
- }
1840
-
1841
- return /*#__PURE__*/React.createElement(Container, {
1842
- ref: visibleAreaRef
1843
- }, /*#__PURE__*/React.createElement(ScrollArea // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1844
- // @ts-expect-error
1845
- , {
1846
- ref: ref,
1847
- scrollLeft: styles.scroll,
1848
- onScroll: handleScrollMove
1849
- }, /*#__PURE__*/React.createElement(CarouselContainer, {
1850
- ref: innerRef,
1851
- centerItems: centerItems
1852
- }, children)), /*#__PURE__*/React.createElement(ButtonsContainer, null, /*#__PURE__*/React.createElement(CarouselButton, {
1853
- direction: Direction.Left,
1854
- show: leftShow,
1855
- offset: buttonOffset,
1856
- bottomOffset: bottomOffset,
1857
- padding: buttonPadding,
1858
- onClick: handleLeft
1859
- }), /*#__PURE__*/React.createElement(CarouselButton, {
1860
- direction: Direction.Right,
1861
- show: rightShow,
1862
- offset: buttonOffset,
1863
- bottomOffset: bottomOffset,
1864
- padding: buttonPadding,
1865
- onClick: handleRight
1866
- })));
1867
- }
1868
- const CarouselContainer = styled.ul(_t$3 || (_t$3 = _$2`
1869
- vertical-align: top;
1870
- overflow: hidden;
1871
- list-style: none;
1872
- padding: 0;
1873
-
1874
- /* 最小幅を100%にして親要素にぴったりくっつけることで子要素で要素を均等に割り付けるなどを出来るようにしてある */
1875
- min-width: 100%;
1876
- box-sizing: border-box;
1877
-
1878
- ${0}
1879
- `), ({
1880
- centerItems: _centerItems = false
1881
- }) => _centerItems ? css(_t2$1 || (_t2$1 = _$2`
1882
- display: flex;
1883
- width: max-content;
1884
- margin: 0 auto;
1885
- `)) : css(_t3$1 || (_t3$1 = _$2`
1886
- display: inline-flex;
1887
- margin: 0;
1888
- `)));
1889
- const ButtonsContainer = styled.div(_t4$1 || (_t4$1 = _$2`
1890
- opacity: 0;
1891
- transition: 0.4s opacity;
1892
- `));
1893
- const Container = styled.div(_t5 || (_t5 = _$2`
1894
- &:hover ${0} {
1895
- opacity: 1;
1896
- }
1897
-
1898
- /* CarouselButtonの中にz-index:1があるのでここでコンテキストを切る */
1899
- position: relative;
1900
- z-index: 0;
1901
- `), ButtonsContainer);
1902
- const ScrollArea = styled(animated.div)(_t6 || (_t6 = _$2`
1903
- overflow-x: auto;
1904
- padding: 0;
1905
- margin: 0;
1906
-
1907
- &::-webkit-scrollbar {
1908
- display: none;
1909
- }
1910
-
1911
- scrollbar-width: none;
1912
- `));
1913
- const GradientContainer = styled.div(_t7 || (_t7 = _$2`
1914
- /* NOTE: LeftGradientがはみ出るためhidden */
1915
- overflow: hidden;
1916
- ${0}
1917
-
1918
- margin-right: ${0}px;
1919
- /* stylelint-disable-next-line no-duplicate-selectors */
1920
- ${0} {
1921
- padding-right: ${0}px;
1922
- }
1923
- `), p => !p.fadeInGradient && css(_t8 || (_t8 = _$2`
1924
- margin-left: ${0}px;
1925
- ${0} {
1926
- padding-left: ${0}px;
1927
- }
1928
- `), -GRADIENT_WIDTH, CarouselContainer, GRADIENT_WIDTH), -GRADIENT_WIDTH, CarouselContainer, GRADIENT_WIDTH);
1929
- const RightGradient = styled.div(_t9 || (_t9 = _$2`
1930
- mask-image: linear-gradient(
1931
- to right,
1932
- #000 calc(100% - ${0}px),
1933
- transparent
1934
- );
1935
- `), GRADIENT_WIDTH);
1936
- const LeftGradient = styled.div(_t10 || (_t10 = _$2`
1937
- /* NOTE: mask-position が left → negative px の時、right → abs(negative px) の位置に表示されるため */
1938
- margin-right: ${0}px;
1939
- padding-right: ${0}px;
1940
- /* NOTE: mask-position に transition をつけたいが vender prefixes 対策で all につける */
1941
- transition: 0.2s all ease-in;
1942
- mask: linear-gradient(to right, transparent, #000 ${0}px)
1943
- ${0}px 0;
1944
- `), -GRADIENT_WIDTH, GRADIENT_WIDTH, GRADIENT_WIDTH, p => p.show ? 0 : -GRADIENT_WIDTH);
1945
-
1946
- let _$1 = t => t,
1947
- _t$2;
1948
-
1949
- function DotsIcon({
1950
- size
1951
- }) {
1952
- return /*#__PURE__*/React.createElement(StyledSVG, {
1953
- viewBox: "0 0 20 6",
1954
- width: size,
1955
- height: size
1956
- }, /*#__PURE__*/React.createElement("path", {
1957
- fillRule: "evenodd",
1958
- 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
1959
- 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
1960
- C10.6192881,14.5 9.5,13.3807119 9.5,12 C9.5,10.6192881 10.6192881,9.5 12,9.5
1961
- 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
1962
- C17.6192881,14.5 16.5,13.3807119 16.5,12 C16.5,10.6192881 17.6192881,9.5 19,9.5
1963
- C20.3807119,9.5 21.5,10.6192881 21.5,12 C21.5,13.3807119 20.3807119,14.5 19,14.5 Z`,
1964
- transform: "translate(-2 -9)"
1965
- }));
1966
- }
1967
-
1968
- DotsIcon.defaultProps = {
1969
- size: 16
1970
- };
1971
- const StyledSVG = styled.svg(_t$2 || (_t$2 = _$1`
1972
- fill: currentColor;
1973
- `));
1974
-
1975
- let _ = t => t,
1976
- _t$1;
1977
- var WedgeDirection;
1978
-
1979
- (function (WedgeDirection) {
1980
- WedgeDirection["Up"] = "up";
1981
- WedgeDirection["Down"] = "down";
1982
- WedgeDirection["Left"] = "left";
1983
- WedgeDirection["Right"] = "right";
1984
- })(WedgeDirection || (WedgeDirection = {}));
1985
-
1986
- function WedgeIcon({
1987
- size,
1988
- direction
1989
- }) {
1990
- return (
1991
- /*#__PURE__*/
1992
- // NOTE: directionToTransform depends on the value of viewBox
1993
- React.createElement("svg", {
1994
- viewBox: "0 0 10 8",
1995
- width: size,
1996
- height: size
1997
- }, /*#__PURE__*/React.createElement(StyledPolyline, {
1998
- strokeWidth: "2",
1999
- points: "1,2 5,6 9,2",
2000
- transform: directionToTransform(direction)
2001
- }))
2002
- );
2003
- }
2004
- WedgeIcon.defaultProps = {
2005
- size: 16,
2006
- white: false,
2007
- lightGray: false
2008
- };
2009
-
2010
- function directionToTransform(direction) {
2011
- // "5 4" is the center point of the "0 0 10 8" viewBox
2012
- switch (direction) {
2013
- case WedgeDirection.Up:
2014
- return 'rotate(180 5 4)';
2015
-
2016
- case WedgeDirection.Down:
2017
- return undefined;
2018
-
2019
- case WedgeDirection.Left:
2020
- return 'rotate(90 5 4)';
2021
-
2022
- case WedgeDirection.Right:
2023
- return 'rotate(-90 5 4)';
2024
-
2025
- default:
2026
- return unreachable(direction);
2027
- }
2028
- }
2029
-
2030
- const StyledPolyline = styled.polyline(_t$1 || (_t$1 = _`
2031
- fill: none;
2032
- stroke-linejoin: round;
2033
- stroke-linecap: round;
2034
- stroke: currentColor;
2035
- `));
2036
-
2037
- let _2 = t => t,
2038
- _t,
2039
- _t2,
2040
- _t3,
2041
- _t4;
2042
-
2043
- function usePagerWindow(page, pageCount, windowSize = 7) {
2044
- // ページャーのリンク生成例:
2045
- //
2046
- // < [ 1 ] [*2*] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] >
2047
- //
2048
- // < [ 1 ] [ 2 ] [ 3 ] [*4*] [ 5 ] [ 6 ] [ 7 ] >
2049
- //
2050
- // < [ 1 ] ... [ 4 ] [*5*] [ 6 ] [ 7 ] [ 8 ] >
2051
- //
2052
- // < [ 1 ] ... [ 99 ] [*100*] [ 101 ] [ 102 ] [ 103 ] >
2053
- //
2054
- // < [ 1 ] ... [ 99 ] [ 100 ] [ 101 ] [ 102 ] [*103*]
2055
- //
2056
- // [*1*] [ 2 ] >
2057
- //
2058
- // デザインの意図: 前後移動時のカーソル移動を最小限にする。
2059
- if (process.env.NODE_ENV !== 'production') {
2060
- warning((page | 0) === page, `\`page\` must be interger (${page})`);
2061
- warning((pageCount | 0) === pageCount, `\`pageCount\` must be interger (${pageCount})`);
2062
- }
2063
-
2064
- const window = useMemo(() => {
2065
- const visibleFirstPage = 1;
2066
- const visibleLastPage = Math.min(pageCount, Math.max(page + Math.floor(windowSize / 2), windowSize));
2067
-
2068
- if (visibleLastPage <= windowSize) {
2069
- // 表示範囲が1-7ページなら省略は無い。
2070
- return Array.from({
2071
- length: 1 + visibleLastPage - visibleFirstPage
2072
- }, (_, i) => visibleFirstPage + i);
2073
- } else {
2074
- const start = visibleLastPage - (windowSize - 1) + 2;
2075
- return [// 表示範囲が1-7ページを超えるなら、
2076
- // - 1ページ目は固定で表示する
2077
- visibleFirstPage, // - 2ページ目から現在のページの直前までは省略する
2078
- '...', ...Array.from({
2079
- length: 1 + visibleLastPage - start
2080
- }, (_, i) => start + i)];
2081
- }
2082
- }, [page, pageCount, windowSize]);
2083
- useDebugValue(window);
2084
- return window;
2085
- } // this pager is just regular buttons; for links use LinkPager
2086
-
2087
-
2088
- var index = React.memo(function Pager({
2089
- page,
2090
- pageCount,
2091
- onChange
2092
- }) {
2093
- // TODO: refactor Pager and LinkPager to use a common parent component
2094
- const window = usePagerWindow(page, pageCount);
2095
- const makeClickHandler = useCallback(value => () => {
2096
- onChange(value);
2097
- }, [onChange]);
2098
- const hasNext = page < pageCount;
2099
- const hasPrev = page > 1;
2100
- return /*#__PURE__*/React.createElement(PagerContainer, null, /*#__PURE__*/React.createElement(CircleButton, {
2101
- type: "button",
2102
- hidden: !hasPrev,
2103
- disabled: !hasPrev,
2104
- onClick: makeClickHandler(Math.max(1, page - 1)),
2105
- noBackground: true
2106
- }, /*#__PURE__*/React.createElement(WedgeIcon, {
2107
- size: 16,
2108
- direction: WedgeDirection.Left
2109
- })), window.map(p => p === '...' ? /*#__PURE__*/React.createElement(Spacer, {
2110
- key: p
2111
- }, /*#__PURE__*/React.createElement(DotsIcon, {
2112
- size: 20
2113
- })) : p === page ?
2114
- /*#__PURE__*/
2115
- // we remove the onClick but don't mark it as disabled to preserve keyboard focus
2116
- // not doing so causes the focus ring to flicker in and out of existence
2117
- React.createElement(CircleButton, {
2118
- key: p,
2119
- type: "button",
2120
- "aria-current": true
2121
- }, /*#__PURE__*/React.createElement(Text, null, p)) : /*#__PURE__*/React.createElement(CircleButton, {
2122
- key: p,
2123
- type: "button",
2124
- onClick: makeClickHandler(p)
2125
- }, /*#__PURE__*/React.createElement(Text, null, p))), /*#__PURE__*/React.createElement(CircleButton, {
2126
- type: "button",
2127
- hidden: !hasNext,
2128
- disabled: !hasNext,
2129
- onClick: makeClickHandler(Math.min(pageCount, page + 1)),
2130
- noBackground: true
2131
- }, /*#__PURE__*/React.createElement(WedgeIcon, {
2132
- size: 16,
2133
- direction: WedgeDirection.Right
2134
- })));
2135
- });
2136
- function LinkPager({
2137
- page,
2138
- pageCount,
2139
- makeUrl
2140
- }) {
2141
- const {
2142
- Link
2143
- } = useComponentAbstraction();
2144
- const window = usePagerWindow(page, pageCount);
2145
- const hasNext = page < pageCount;
2146
- const hasPrev = page > 1;
2147
- return /*#__PURE__*/React.createElement(PagerContainer, null, /*#__PURE__*/React.createElement(Link, {
2148
- to: makeUrl(Math.max(1, page - 1))
2149
- }, /*#__PURE__*/React.createElement(CircleButton, {
2150
- hidden: !hasPrev,
2151
- "aria-disabled": !hasPrev,
2152
- noBackground: true
2153
- }, /*#__PURE__*/React.createElement(WedgeIcon, {
2154
- size: 16,
2155
- direction: WedgeDirection.Left
2156
- }))), window.map(p => p === '...' ? /*#__PURE__*/React.createElement(Spacer, {
2157
- key: p
2158
- }, /*#__PURE__*/React.createElement(DotsIcon, {
2159
- size: 20,
2160
- subLink: true
2161
- })) : p === page ? /*#__PURE__*/React.createElement(CircleButton, {
2162
- key: p,
2163
- type: "button",
2164
- "aria-current": true
2165
- }, /*#__PURE__*/React.createElement(Text, null, p)) : /*#__PURE__*/React.createElement(Link, {
2166
- key: p,
2167
- to: makeUrl(p)
2168
- }, /*#__PURE__*/React.createElement(CircleButton, {
2169
- type: "button"
2170
- }, /*#__PURE__*/React.createElement(Text, null, p)))), /*#__PURE__*/React.createElement(Link, {
2171
- to: makeUrl(Math.min(pageCount, page + 1))
2172
- }, /*#__PURE__*/React.createElement(CircleButton, {
2173
- hidden: !hasNext,
2174
- "aria-disabled": !hasNext,
2175
- noBackground: true
2176
- }, /*#__PURE__*/React.createElement(WedgeIcon, {
2177
- size: 16,
2178
- direction: WedgeDirection.Right
2179
- }))));
2180
- }
2181
- const PagerContainer = styled.nav(_t || (_t = _2`
2182
- display: flex;
2183
- justify-content: center;
2184
- align-items: center;
2185
- `));
2186
- const CircleButton = styled.button(_t2 || (_t2 = _2`
2187
- font-size: 1rem;
2188
- line-height: calc(1em + 8px);
2189
- text-decoration: none;
2190
- border: none;
2191
- outline: none;
2192
- touch-action: manipulation;
2193
- user-select: none;
2194
- transition: box-shadow 0.2s ease 0s, color 0.2s ease 0s,
2195
- background 0.2s ease 0s, opacity 0.2s ease 0s;
2196
-
2197
- display: flex;
2198
- justify-content: center;
2199
- align-items: center;
2200
- box-sizing: content-box;
2201
- min-width: 24px;
2202
- min-height: 24px;
2203
- padding: 8px;
2204
- cursor: pointer;
2205
- font-weight: bold;
2206
- /* HACK:
2207
- * Safari doesn't correctly repaint the elements when they're reordered in response to interaction.
2208
- * This forces it to repaint them. This doesn't work if put on the parents either, has to be here.
2209
- */
2210
- /* stylelint-disable-next-line property-no-vendor-prefix */
2211
- -webkit-transform: translateZ(0);
2212
-
2213
- &[hidden] {
2214
- visibility: hidden;
2215
- display: block;
2216
- }
2217
-
2218
- border-radius: 48px;
2219
-
2220
- background: transparent;
2221
- color: ${0};
2222
-
2223
- &:hover {
2224
- background: ${0};
2225
- color: ${0};
2226
- }
2227
-
2228
- &[aria-current] {
2229
- background-color: ${0};
2230
- color: ${0};
2231
- }
2232
-
2233
- &[aria-current]:hover {
2234
- background-color: ${0};
2235
- color: ${0};
2236
- }
2237
-
2238
- ${0}
2239
- `), ({
2240
- theme
2241
- }) => theme.color.text3, ({
2242
- theme
2243
- }) => theme.color.surface3, ({
2244
- theme
2245
- }) => theme.color.text2, ({
2246
- theme
2247
- }) => theme.color.surface6, ({
2248
- theme
2249
- }) => theme.color.text5, ({
2250
- theme
2251
- }) => theme.color.surface6, ({
2252
- theme
2253
- }) => theme.color.text5, ({
2254
- noBackground: _noBackground = false
2255
- }) => _noBackground && css(_t3 || (_t3 = _2`
2256
- /* stylelint-disable-next-line no-duplicate-selectors */
2257
- &:hover {
2258
- background: transparent;
2259
- }
2260
- `)));
2261
- const Spacer = styled(CircleButton).attrs({
2262
- type: 'button',
2263
- disabled: true
2264
- })(_t4 || (_t4 = _2`
2265
- && {
2266
- color: ${0};
2267
- background: none;
2268
- }
2269
- `), ({
2270
- theme
2271
- }) => theme.color.text3);
2272
- const Text = 'span';
2273
-
2274
- export { CancelLayoutItemBodyPadding, Carousel, Filter, FilterButton, FilterIconButton, FilterLink, HintText, LAYOUT_ITEM_BODY_PADDING, Layout, LayoutItem, LayoutItemBody, LayoutItemHeader, LeftMenu, LeftMenuContent, LinkPager, MAIN_COLUMN_HORIZONTAL_MIN_MARGIN, MenuListItem, MenuListItemContext, MenuListItemWithIcon, MenuListLabel, MenuListLinkItem, MenuListLinkItemWithIcon, MenuListSpacer, index as Pager, RESPONSIVE_LEFT_WIDTH, RESPONSIVE_MAIN_MAX_WIDTH, StyledCancelLayoutItemBodyPadding, StyledLayoutItemBody, index$2 as SwitchCheckbox, TextEllipsis, index$1 as WithIcon, useElementSize, useLayoutItemBodyPadding, useMedia, useMediaScreen1 };
2275
- //# sourceMappingURL=index.modern.js.map