@charcoal-ui/react-sandbox 2.0.0-alpha.1 → 2.0.0-alpha.10
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/components/Carousel/index.d.ts.map +1 -1
- package/dist/index.cjs +1877 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +1759 -93
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +1827 -1
- package/dist/index.module.js.map +1 -1
- package/package.json +8 -8
- package/src/components/Carousel/index.tsx +2 -5
package/dist/index.modern.js
CHANGED
|
@@ -1,4 +1,126 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, { useMemo, useState, useLayoutEffect, useDebugValue, useReducer, useRef, useCallback, useContext, isValidElement, Children as Children$1, useEffect, useImperativeHandle } from 'react';
|
|
2
|
+
import styled, { css, useTheme, createGlobalStyle, keyframes } 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
|
+
import { transparentize } from 'polished';
|
|
12
|
+
|
|
13
|
+
function _extends() {
|
|
14
|
+
_extends = Object.assign || function (target) {
|
|
15
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
16
|
+
var source = arguments[i];
|
|
17
|
+
|
|
18
|
+
for (var key in source) {
|
|
19
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
20
|
+
target[key] = source[key];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return target;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return _extends.apply(this, arguments);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
32
|
+
if (source == null) return {};
|
|
33
|
+
var target = {};
|
|
34
|
+
var sourceKeys = Object.keys(source);
|
|
35
|
+
var key, i;
|
|
36
|
+
|
|
37
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
38
|
+
key = sourceKeys[i];
|
|
39
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
40
|
+
target[key] = source[key];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return target;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
let _$e = t => t,
|
|
47
|
+
_t$f,
|
|
48
|
+
_t2$b,
|
|
49
|
+
_t3$a,
|
|
50
|
+
_t4$8,
|
|
51
|
+
_t5$6,
|
|
52
|
+
_t6$5,
|
|
53
|
+
_t7$5,
|
|
54
|
+
_t8$5,
|
|
55
|
+
_t9$5;
|
|
56
|
+
|
|
57
|
+
const _excluded$3 = ["onClick", "children", "active", "hover", "reactive"];
|
|
58
|
+
const FilterButton = React.forwardRef(function FilterButton({
|
|
59
|
+
onClick,
|
|
60
|
+
children,
|
|
61
|
+
active = false,
|
|
62
|
+
hover,
|
|
63
|
+
reactive = false
|
|
64
|
+
}, ref) {
|
|
65
|
+
return /*#__PURE__*/React.createElement(ButtonLike, {
|
|
66
|
+
active: active,
|
|
67
|
+
reactive: reactive,
|
|
68
|
+
hover: hover,
|
|
69
|
+
onClick: active && !reactive ? undefined : onClick,
|
|
70
|
+
ref: ref
|
|
71
|
+
}, children);
|
|
72
|
+
});
|
|
73
|
+
const FilterIconButton = React.forwardRef(function FilterIconButton({
|
|
74
|
+
onClick,
|
|
75
|
+
children,
|
|
76
|
+
active = false,
|
|
77
|
+
hover,
|
|
78
|
+
reactive = false,
|
|
79
|
+
width,
|
|
80
|
+
height
|
|
81
|
+
}, ref) {
|
|
82
|
+
return /*#__PURE__*/React.createElement(StyledButtonLike, {
|
|
83
|
+
active: active,
|
|
84
|
+
reactive: reactive,
|
|
85
|
+
hover: hover,
|
|
86
|
+
onClick: active && !reactive ? undefined : onClick,
|
|
87
|
+
ref: ref,
|
|
88
|
+
buttonWidth: width,
|
|
89
|
+
buttonHeight: height
|
|
90
|
+
}, children);
|
|
91
|
+
});
|
|
92
|
+
const FilterLink = React.forwardRef(function FilterLink(_ref, ref) {
|
|
93
|
+
let {
|
|
94
|
+
onClick,
|
|
95
|
+
children,
|
|
96
|
+
active = false,
|
|
97
|
+
hover,
|
|
98
|
+
reactive = false
|
|
99
|
+
} = _ref,
|
|
100
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
101
|
+
|
|
102
|
+
const {
|
|
103
|
+
Link
|
|
104
|
+
} = useComponentAbstraction();
|
|
105
|
+
|
|
106
|
+
if (active && !reactive) {
|
|
107
|
+
return /*#__PURE__*/React.createElement(PlainElement, {
|
|
108
|
+
active: true,
|
|
109
|
+
hover: hover,
|
|
110
|
+
ref: ref
|
|
111
|
+
}, children);
|
|
112
|
+
} else {
|
|
113
|
+
return /*#__PURE__*/React.createElement(Link, _extends({}, props, {
|
|
114
|
+
onClick: onClick
|
|
115
|
+
}), /*#__PURE__*/React.createElement(PlainElement, {
|
|
116
|
+
active: active,
|
|
117
|
+
reactive: reactive,
|
|
118
|
+
hover: hover,
|
|
119
|
+
ref: ref
|
|
120
|
+
}, children));
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
const buttonCss = css(_t$f || (_t$f = _$e`
|
|
2
124
|
display: block;
|
|
3
125
|
outline: none;
|
|
4
126
|
border: none;
|
|
@@ -26,30 +148,82 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
26
148
|
@media ${0} {
|
|
27
149
|
padding: 5px 16px;
|
|
28
150
|
}
|
|
29
|
-
`),({
|
|
151
|
+
`), ({
|
|
152
|
+
theme
|
|
153
|
+
}) => theme.color.text3, ({
|
|
154
|
+
theme
|
|
155
|
+
}) => theme.color.text2, ({
|
|
156
|
+
hover: _hover = false
|
|
157
|
+
}) => _hover && css(_t2$b || (_t2$b = _$e`
|
|
30
158
|
color: ${0};
|
|
31
|
-
`),({
|
|
159
|
+
`), ({
|
|
160
|
+
theme
|
|
161
|
+
}) => theme.color.text2), ({
|
|
162
|
+
active: _active = false
|
|
163
|
+
}) => _active && css(_t3$a || (_t3$a = _$e`
|
|
32
164
|
background-color: ${0};
|
|
33
165
|
color: ${0};
|
|
34
|
-
`),({
|
|
166
|
+
`), ({
|
|
167
|
+
theme
|
|
168
|
+
}) => theme.color.surface3, ({
|
|
169
|
+
theme
|
|
170
|
+
}) => theme.color.text2), ({
|
|
171
|
+
active: _active2 = false,
|
|
172
|
+
reactive: _reactive = false
|
|
173
|
+
}) => _active2 && !_reactive && css(_t4$8 || (_t4$8 = _$e`
|
|
35
174
|
cursor: default;
|
|
36
|
-
`)),({
|
|
175
|
+
`)), ({
|
|
176
|
+
theme
|
|
177
|
+
}) => maxWidth(theme.breakpoint.screen1));
|
|
178
|
+
const padding0Css = css(_t5$6 || (_t5$6 = _$e`
|
|
37
179
|
padding: 0;
|
|
38
180
|
|
|
39
181
|
@media ${0} {
|
|
40
182
|
padding: 0;
|
|
41
183
|
}
|
|
42
|
-
`),({
|
|
184
|
+
`), ({
|
|
185
|
+
theme
|
|
186
|
+
}) => maxWidth(theme.breakpoint.screen1));
|
|
187
|
+
const ButtonLike = styled.button(_t6$5 || (_t6$5 = _$e`
|
|
43
188
|
${0}
|
|
44
|
-
`),
|
|
189
|
+
`), buttonCss);
|
|
190
|
+
const PlainElement = styled.span(_t7$5 || (_t7$5 = _$e`
|
|
45
191
|
${0}
|
|
46
|
-
`),
|
|
192
|
+
`), buttonCss);
|
|
193
|
+
const StyledButtonLike = styled(ButtonLike)(_t8$5 || (_t8$5 = _$e`
|
|
47
194
|
${0};
|
|
48
195
|
${0}
|
|
49
196
|
${0}
|
|
50
|
-
`),
|
|
197
|
+
`), padding0Css, p => p.buttonWidth !== undefined && `width: ${p.buttonWidth}px;`, p => p.buttonHeight !== undefined && `height: ${p.buttonHeight}px;`);
|
|
198
|
+
const Filter = styled.div(_t9$5 || (_t9$5 = _$e`
|
|
51
199
|
display: flex;
|
|
52
|
-
`))
|
|
200
|
+
`));
|
|
201
|
+
|
|
202
|
+
const theme = createTheme(styled);
|
|
203
|
+
|
|
204
|
+
let _$d = t => t,
|
|
205
|
+
_t$e;
|
|
206
|
+
function IconBase({
|
|
207
|
+
size = 24,
|
|
208
|
+
viewBoxSize,
|
|
209
|
+
currentColor,
|
|
210
|
+
path,
|
|
211
|
+
transform,
|
|
212
|
+
fillRule,
|
|
213
|
+
clipRule
|
|
214
|
+
}) {
|
|
215
|
+
return /*#__PURE__*/React.createElement(Icon$3, {
|
|
216
|
+
viewBox: `0 0 ${viewBoxSize} ${viewBoxSize}`,
|
|
217
|
+
size: size,
|
|
218
|
+
currentColor: currentColor
|
|
219
|
+
}, /*#__PURE__*/React.createElement(IconBasePath, {
|
|
220
|
+
path: path,
|
|
221
|
+
transform: transform,
|
|
222
|
+
fillRule: fillRule,
|
|
223
|
+
clipRule: clipRule
|
|
224
|
+
}));
|
|
225
|
+
}
|
|
226
|
+
const Icon$3 = styled.svg(_t$e || (_t$e = _$d`
|
|
53
227
|
stroke: none;
|
|
54
228
|
fill: ${0};
|
|
55
229
|
width: ${0}px;
|
|
@@ -57,10 +231,68 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
57
231
|
line-height: 0;
|
|
58
232
|
font-size: 0;
|
|
59
233
|
vertical-align: middle;
|
|
60
|
-
`),
|
|
234
|
+
`), ({
|
|
235
|
+
currentColor: _currentColor = false,
|
|
236
|
+
theme
|
|
237
|
+
}) => _currentColor ? 'currentColor' : theme.color.text2, props => props.size, props => props.size);
|
|
238
|
+
const IconBasePath = ({
|
|
239
|
+
path,
|
|
240
|
+
transform,
|
|
241
|
+
fillRule,
|
|
242
|
+
clipRule
|
|
243
|
+
}) => {
|
|
244
|
+
if (typeof path === 'string') {
|
|
245
|
+
return /*#__PURE__*/React.createElement("path", {
|
|
246
|
+
d: path,
|
|
247
|
+
transform: transform,
|
|
248
|
+
fillRule: fillRule,
|
|
249
|
+
clipRule: clipRule
|
|
250
|
+
});
|
|
251
|
+
} else {
|
|
252
|
+
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
253
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, path);
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
let _$c = t => t,
|
|
258
|
+
_t$d;
|
|
259
|
+
const size$1 = 16;
|
|
260
|
+
function InfoIcon() {
|
|
261
|
+
const path = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("path", {
|
|
262
|
+
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"
|
|
263
|
+
}), /*#__PURE__*/React.createElement(Path, {
|
|
264
|
+
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"
|
|
265
|
+
}));
|
|
266
|
+
return /*#__PURE__*/React.createElement(IconBase, {
|
|
267
|
+
viewBoxSize: size$1,
|
|
268
|
+
size: size$1,
|
|
269
|
+
currentColor: true,
|
|
270
|
+
path: path
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
const Path = styled.path(_t$d || (_t$d = _$c`
|
|
61
274
|
fill: ${0};
|
|
62
275
|
fill-rule: evenodd;
|
|
63
|
-
`),
|
|
276
|
+
`), ({
|
|
277
|
+
theme
|
|
278
|
+
}) => theme.color.surface1);
|
|
279
|
+
|
|
280
|
+
let _$b = t => t,
|
|
281
|
+
_t$c,
|
|
282
|
+
_t2$a,
|
|
283
|
+
_t3$9,
|
|
284
|
+
_t4$7;
|
|
285
|
+
function HintText({
|
|
286
|
+
children,
|
|
287
|
+
context,
|
|
288
|
+
className
|
|
289
|
+
}) {
|
|
290
|
+
return /*#__PURE__*/React.createElement(Container$2, {
|
|
291
|
+
className: className,
|
|
292
|
+
context: context
|
|
293
|
+
}, /*#__PURE__*/React.createElement(IconWrap, null, /*#__PURE__*/React.createElement(InfoIcon, null)), /*#__PURE__*/React.createElement(Text$2, null, children));
|
|
294
|
+
}
|
|
295
|
+
const Container$2 = styled.div.attrs(styledProps)(_t$c || (_t$c = _$b`
|
|
64
296
|
${0}
|
|
65
297
|
|
|
66
298
|
@media ${0} {
|
|
@@ -70,18 +302,252 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
70
302
|
display: flex;
|
|
71
303
|
align-items: flex-start;
|
|
72
304
|
${0}
|
|
73
|
-
`),
|
|
305
|
+
`), p => theme(o => [o.bg.surface3, o.borderRadius(8), o.padding.vertical(p.default.vertical), o.padding.horizontal(p.default.horizontal)]), ({
|
|
306
|
+
theme: t
|
|
307
|
+
}) => 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$a || (_t2$a = _$b`
|
|
74
308
|
justify-content: center;
|
|
75
|
-
`)))
|
|
309
|
+
`)));
|
|
310
|
+
const IconWrap = styled.div(_t3$9 || (_t3$9 = _$b`
|
|
76
311
|
display: flex;
|
|
77
312
|
align-items: center;
|
|
78
313
|
color: ${0};
|
|
79
314
|
height: 22px;
|
|
80
315
|
margin: -4px 4px -4px 0;
|
|
81
|
-
`),
|
|
316
|
+
`), p => p.theme.color.text4);
|
|
317
|
+
const Text$2 = styled.p(_t4$7 || (_t4$7 = _$b`
|
|
82
318
|
${0}
|
|
83
319
|
margin: 0;
|
|
84
|
-
`),
|
|
320
|
+
`), theme(o => [o.font.text2, o.typography(14)]));
|
|
321
|
+
|
|
322
|
+
function styledProps(props) {
|
|
323
|
+
return _extends({}, props, contextToProps(props.context));
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
function contextToProps(context) {
|
|
327
|
+
switch (context) {
|
|
328
|
+
case 'page':
|
|
329
|
+
return {
|
|
330
|
+
default: {
|
|
331
|
+
horizontal: 40,
|
|
332
|
+
vertical: 24
|
|
333
|
+
},
|
|
334
|
+
screen1: {
|
|
335
|
+
horizontal: 16,
|
|
336
|
+
vertical: 16
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
case 'section':
|
|
341
|
+
return {
|
|
342
|
+
default: {
|
|
343
|
+
horizontal: 16,
|
|
344
|
+
vertical: 16
|
|
345
|
+
},
|
|
346
|
+
screen1: {
|
|
347
|
+
horizontal: 16,
|
|
348
|
+
vertical: 16
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
const MAIN_COLUMN_HORIZONTAL_MIN_MARGIN = 72;
|
|
355
|
+
const RESPONSIVE_LEFT_WIDTH = columnSystem(2, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT;
|
|
356
|
+
const RESPONSIVE_MAIN_MAX_WIDTH = columnSystem(12, COLUMN_UNIT, GUTTER_UNIT);
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* 現在の画面幅がモバイル幅かどうかを返す
|
|
360
|
+
*/
|
|
361
|
+
|
|
362
|
+
function useMediaScreen1() {
|
|
363
|
+
return useMedia(maxWidth(useTheme().breakpoint.screen1));
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Returns a dynamically-updating media query result.
|
|
367
|
+
*
|
|
368
|
+
* When the media query's matching state changes, this hook's result
|
|
369
|
+
* will update with sync priority.
|
|
370
|
+
*
|
|
371
|
+
* @param query A full media query (the string written between `@media` and the `{` in CSS)
|
|
372
|
+
* @returns true if the query matches, false if it doesn't
|
|
373
|
+
*/
|
|
374
|
+
|
|
375
|
+
function useMedia(query) {
|
|
376
|
+
const matcher = useMemo(() => __TEST__ ? {
|
|
377
|
+
matches: false,
|
|
378
|
+
addListener: () => {// do nothing
|
|
379
|
+
},
|
|
380
|
+
removeListener: () => {// do nothing
|
|
381
|
+
}
|
|
382
|
+
} : matchMedia(query), [query]);
|
|
383
|
+
const [matches, setMatches] = useState(matcher.matches); // can only happen if/when the query changes
|
|
384
|
+
|
|
385
|
+
if (matcher.matches !== matches) {
|
|
386
|
+
setMatches(matcher.matches);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
const callback = e => {
|
|
390
|
+
// We're not on a React event listener, so React doesn't know the priority of the setState call
|
|
391
|
+
// Media query updates _are_ very high priority to avoid FOUC
|
|
392
|
+
// so we need to emit a sync priority update
|
|
393
|
+
try {
|
|
394
|
+
// However, flushSync may throw if the matcher is triggered by a
|
|
395
|
+
// forced relayout that happens during a React lifecycle handler.
|
|
396
|
+
// Try to be resilient and retry without flushSync if flushSync throws.
|
|
397
|
+
ReactDOM.flushSync(() => {
|
|
398
|
+
setMatches(e.matches);
|
|
399
|
+
});
|
|
400
|
+
} catch (_unused) {
|
|
401
|
+
setMatches(e.matches);
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
useLayoutEffect(() => {
|
|
406
|
+
matcher.addListener(callback); // sync update
|
|
407
|
+
|
|
408
|
+
setMatches(matcher.matches);
|
|
409
|
+
return () => {
|
|
410
|
+
matcher.removeListener(callback);
|
|
411
|
+
};
|
|
412
|
+
}, [matcher]);
|
|
413
|
+
useDebugValue(`${query}: ${matches.toString()}`);
|
|
414
|
+
return matches;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
function measure(ref) {
|
|
418
|
+
return ref !== null ? ref.getBoundingClientRect() : undefined;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
function useElementSize(ref, // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
422
|
+
deps = []) {
|
|
423
|
+
// _don't_ call measure synchronously here even if you somehow can
|
|
424
|
+
// measurement has to be done outside the render phase, either
|
|
425
|
+
// as the resize observer callback or as a layout effect
|
|
426
|
+
const [size, setSize] = useReducer((state, next) => {
|
|
427
|
+
// width, height, etc are not own properties but getters in the prototype
|
|
428
|
+
// can't use shallowEqual or other iterative checks
|
|
429
|
+
if (state === undefined || next === undefined) {
|
|
430
|
+
return next;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
if (state.height === next.height && state.width === next.width) {
|
|
434
|
+
return state;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
return next;
|
|
438
|
+
}, undefined);
|
|
439
|
+
const [watch, setWatch] = useState(null);
|
|
440
|
+
useLayoutEffect(() => {
|
|
441
|
+
if (watch === null) {
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
const observer = new ResizeObserver(() => {
|
|
446
|
+
// NOTE: the ResizeObserverCallback receives a rect,
|
|
447
|
+
// but it's not measured in the same way as getBoundingClientRect,
|
|
448
|
+
// which causes unstable layout
|
|
449
|
+
const newSize = measure(watch);
|
|
450
|
+
setSize(newSize);
|
|
451
|
+
}); // The ResizeObserver is supposed to call handleResize on observe
|
|
452
|
+
|
|
453
|
+
observer.observe(watch);
|
|
454
|
+
return () => {
|
|
455
|
+
// this will correctly unobserve if either the observer
|
|
456
|
+
// or the current changes, and even on unmount
|
|
457
|
+
// no need for an observer.disconnect() 🎉
|
|
458
|
+
observer.unobserve(watch);
|
|
459
|
+
setSize(undefined);
|
|
460
|
+
};
|
|
461
|
+
}, [watch]); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
462
|
+
|
|
463
|
+
useLayoutEffect(() => {
|
|
464
|
+
if (ref.current !== watch) {
|
|
465
|
+
setWatch(ref.current);
|
|
466
|
+
}
|
|
467
|
+
});
|
|
468
|
+
useLayoutEffect(() => {
|
|
469
|
+
if (deps.length > 0) {
|
|
470
|
+
// Sync measuring
|
|
471
|
+
setSize(measure(ref.current));
|
|
472
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
473
|
+
|
|
474
|
+
}, deps);
|
|
475
|
+
useDebugValue(size);
|
|
476
|
+
return size;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Debounce version of setState with `requestAnimationFrame`
|
|
480
|
+
*
|
|
481
|
+
* @param defaultValue Default value for `useState`
|
|
482
|
+
*/
|
|
483
|
+
|
|
484
|
+
function useDebounceAnimationState(defaultValue) {
|
|
485
|
+
const [state, setState] = useState(defaultValue);
|
|
486
|
+
const timer = useRef(); // typescript bug? (any when omitting type annotation)
|
|
487
|
+
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
488
|
+
|
|
489
|
+
const setDebounceState = useCallback((value, force = false) => {
|
|
490
|
+
if (force) {
|
|
491
|
+
setState(value);
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
if (timer.current !== undefined) {
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
timer.current = requestAnimationFrame(() => {
|
|
500
|
+
setState(value);
|
|
501
|
+
|
|
502
|
+
if (timer.current !== undefined) {
|
|
503
|
+
timer.current = undefined;
|
|
504
|
+
}
|
|
505
|
+
});
|
|
506
|
+
}, []);
|
|
507
|
+
return [state, setDebounceState];
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
let _$a = t => t,
|
|
511
|
+
_t$b,
|
|
512
|
+
_t2$9,
|
|
513
|
+
_t3$8,
|
|
514
|
+
_t4$6,
|
|
515
|
+
_t5$5,
|
|
516
|
+
_t6$4,
|
|
517
|
+
_t7$4,
|
|
518
|
+
_t8$4,
|
|
519
|
+
_t9$4,
|
|
520
|
+
_t10$4,
|
|
521
|
+
_t11$1,
|
|
522
|
+
_t12$1,
|
|
523
|
+
_t13$1,
|
|
524
|
+
_t14,
|
|
525
|
+
_t15;
|
|
526
|
+
const LayoutConfigContext = React.createContext({
|
|
527
|
+
wide: false,
|
|
528
|
+
center: false,
|
|
529
|
+
withLeft: false
|
|
530
|
+
});
|
|
531
|
+
function Layout({
|
|
532
|
+
menu,
|
|
533
|
+
children,
|
|
534
|
+
header,
|
|
535
|
+
center = false,
|
|
536
|
+
wide,
|
|
537
|
+
isHeaderTopMenu = false
|
|
538
|
+
}) {
|
|
539
|
+
const config = {
|
|
540
|
+
center,
|
|
541
|
+
wide: center ? true : wide != null ? wide : false,
|
|
542
|
+
withLeft: menu != null && !isHeaderTopMenu
|
|
543
|
+
};
|
|
544
|
+
return /*#__PURE__*/React.createElement(LayoutRoot, null, /*#__PURE__*/React.createElement(LayoutConfigContext.Provider, {
|
|
545
|
+
value: config
|
|
546
|
+
}, config.withLeft && /*#__PURE__*/React.createElement(LeftArea, null, menu), /*#__PURE__*/React.createElement(MainArea, {
|
|
547
|
+
center: center
|
|
548
|
+
}, 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));
|
|
549
|
+
}
|
|
550
|
+
const HeaderTopMenuContainer = styled.div(_t$b || (_t$b = _$a`
|
|
85
551
|
margin-bottom: 40px;
|
|
86
552
|
overflow-x: auto;
|
|
87
553
|
word-break: keep-all;
|
|
@@ -92,7 +558,12 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
92
558
|
padding-bottom: 16px;
|
|
93
559
|
background-color: ${0};
|
|
94
560
|
}
|
|
95
|
-
`),({
|
|
561
|
+
`), ({
|
|
562
|
+
theme
|
|
563
|
+
}) => maxWidth(theme.breakpoint.screen1), ({
|
|
564
|
+
theme
|
|
565
|
+
}) => theme.color.surface2);
|
|
566
|
+
const GlobalStyle = createGlobalStyle(_t2$9 || (_t2$9 = _$a`
|
|
96
567
|
:root {
|
|
97
568
|
background-color: ${0};
|
|
98
569
|
|
|
@@ -100,14 +571,28 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
100
571
|
background-color: ${0};
|
|
101
572
|
}
|
|
102
573
|
}
|
|
103
|
-
`),({
|
|
574
|
+
`), ({
|
|
575
|
+
theme
|
|
576
|
+
}) => theme.color.background2, ({
|
|
577
|
+
theme
|
|
578
|
+
}) => maxWidth(theme.breakpoint.screen1), ({
|
|
579
|
+
theme
|
|
580
|
+
}) => theme.color.background1);
|
|
581
|
+
const LayoutRoot = styled.div(_t3$8 || (_t3$8 = _$a`
|
|
104
582
|
display: flex;
|
|
105
583
|
background-color: ${0};
|
|
106
584
|
|
|
107
585
|
@media ${0} {
|
|
108
586
|
background-color: ${0};
|
|
109
587
|
}
|
|
110
|
-
`),({
|
|
588
|
+
`), ({
|
|
589
|
+
theme
|
|
590
|
+
}) => theme.color.background2, ({
|
|
591
|
+
theme
|
|
592
|
+
}) => maxWidth(theme.breakpoint.screen1), ({
|
|
593
|
+
theme
|
|
594
|
+
}) => theme.color.background1);
|
|
595
|
+
const LeftArea = styled.div(_t4$6 || (_t4$6 = _$a`
|
|
111
596
|
min-width: ${0}px;
|
|
112
597
|
padding: 40px 0 40px ${0}px;
|
|
113
598
|
box-sizing: border-box;
|
|
@@ -115,7 +600,10 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
115
600
|
@media ${0} {
|
|
116
601
|
display: none;
|
|
117
602
|
}
|
|
118
|
-
`),
|
|
603
|
+
`), RESPONSIVE_LEFT_WIDTH, GUTTER_UNIT, ({
|
|
604
|
+
theme
|
|
605
|
+
}) => theme.breakpoint.screen3);
|
|
606
|
+
const MainArea = styled.div(_t5$5 || (_t5$5 = _$a`
|
|
119
607
|
flex-grow: 1;
|
|
120
608
|
/* https://www.w3.org/TR/css-flexbox-1/#min-size-auto */
|
|
121
609
|
min-width: 0;
|
|
@@ -128,7 +616,10 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
128
616
|
@media ${0} {
|
|
129
617
|
padding: 0;
|
|
130
618
|
}
|
|
131
|
-
`),
|
|
619
|
+
`), p => p.center ? columnSystem(6, COLUMN_UNIT, GUTTER_UNIT) : RESPONSIVE_MAIN_MAX_WIDTH, MAIN_COLUMN_HORIZONTAL_MIN_MARGIN, ({
|
|
620
|
+
theme
|
|
621
|
+
}) => maxWidth(theme.breakpoint.screen1));
|
|
622
|
+
const Header = styled.div(_t6$4 || (_t6$4 = _$a`
|
|
132
623
|
font-weight: bold;
|
|
133
624
|
margin-bottom: 12px;
|
|
134
625
|
font-size: 20px;
|
|
@@ -144,7 +635,14 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
144
635
|
justify-content: center;
|
|
145
636
|
background-color: ${0};
|
|
146
637
|
}
|
|
147
|
-
`),({
|
|
638
|
+
`), ({
|
|
639
|
+
theme
|
|
640
|
+
}) => theme.color.text2, ({
|
|
641
|
+
theme
|
|
642
|
+
}) => maxWidth(theme.breakpoint.screen1), ({
|
|
643
|
+
theme
|
|
644
|
+
}) => theme.color.surface2);
|
|
645
|
+
const Grid = styled.div(_t7$4 || (_t7$4 = _$a`
|
|
148
646
|
display: grid;
|
|
149
647
|
gap: ${0}px;
|
|
150
648
|
grid-template-columns: 1fr;
|
|
@@ -156,7 +654,25 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
156
654
|
background-color: ${0};
|
|
157
655
|
padding-bottom: 60px;
|
|
158
656
|
}
|
|
159
|
-
`),
|
|
657
|
+
`), GUTTER_UNIT, ({
|
|
658
|
+
theme
|
|
659
|
+
}) => maxWidth(theme.breakpoint.screen1), ({
|
|
660
|
+
theme
|
|
661
|
+
}) => theme.color.background1);
|
|
662
|
+
const LayoutItem = React.forwardRef(function LayoutItem({
|
|
663
|
+
span,
|
|
664
|
+
children
|
|
665
|
+
}, ref) {
|
|
666
|
+
const {
|
|
667
|
+
withLeft
|
|
668
|
+
} = useContext(LayoutConfigContext);
|
|
669
|
+
return /*#__PURE__*/React.createElement(StyledLayoutItem, {
|
|
670
|
+
span: span,
|
|
671
|
+
withLeft: withLeft,
|
|
672
|
+
ref: ref
|
|
673
|
+
}, children);
|
|
674
|
+
});
|
|
675
|
+
const StyledLayoutItem = styled.div(_t8$4 || (_t8$4 = _$a`
|
|
160
676
|
grid-column-start: auto;
|
|
161
677
|
grid-column-end: span ${0};
|
|
162
678
|
border-radius: 24px;
|
|
@@ -175,11 +691,30 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
175
691
|
border-radius: 0;
|
|
176
692
|
padding-bottom: 40px;
|
|
177
693
|
}
|
|
178
|
-
`),
|
|
694
|
+
`), p => p.span, ({
|
|
695
|
+
theme
|
|
696
|
+
}) => theme.color.text2, ({
|
|
697
|
+
theme
|
|
698
|
+
}) => theme.color.background1, p => p.withLeft ? p.theme.breakpoint.screen4 : p.theme.breakpoint.screen3, p => p.span > 2 && css(_t9$4 || (_t9$4 = _$a`
|
|
179
699
|
grid-column-end: span 2;
|
|
180
|
-
`)),({
|
|
700
|
+
`)), ({
|
|
701
|
+
theme
|
|
702
|
+
}) => maxWidth(theme.breakpoint.screen1), p => p.span > 1 && css(_t10$4 || (_t10$4 = _$a`
|
|
181
703
|
grid-column-end: span 1;
|
|
182
|
-
`)));
|
|
704
|
+
`)));
|
|
705
|
+
function LayoutItemHeader({
|
|
706
|
+
children
|
|
707
|
+
}) {
|
|
708
|
+
const {
|
|
709
|
+
wide,
|
|
710
|
+
center
|
|
711
|
+
} = useContext(LayoutConfigContext);
|
|
712
|
+
return /*#__PURE__*/React.createElement(StyledLayoutItemHeader, {
|
|
713
|
+
wide: wide,
|
|
714
|
+
center: center
|
|
715
|
+
}, children);
|
|
716
|
+
}
|
|
717
|
+
const StyledLayoutItemHeader = styled.div(_t11$1 || (_t11$1 = _$a`
|
|
183
718
|
padding: 0 ${0}px;
|
|
184
719
|
height: ${0}px;
|
|
185
720
|
display: grid;
|
|
@@ -200,12 +735,57 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
200
735
|
border-radius: unset;
|
|
201
736
|
${0}
|
|
202
737
|
}
|
|
203
|
-
`),
|
|
738
|
+
`), p => p.wide ? 40 : 24, p => p.wide ? 64 : 48, ({
|
|
739
|
+
theme
|
|
740
|
+
}) => theme.color.surface2, ({
|
|
741
|
+
theme
|
|
742
|
+
}) => theme.color.text2, p => p.center && css(_t12$1 || (_t12$1 = _$a`
|
|
204
743
|
justify-content: center;
|
|
205
|
-
`)),({
|
|
744
|
+
`)), ({
|
|
745
|
+
theme
|
|
746
|
+
}) => maxWidth(theme.breakpoint.screen1), p => p.wide && css(_t13$1 || (_t13$1 = _$a`
|
|
206
747
|
height: 48px;
|
|
207
748
|
margin-top: 0;
|
|
208
|
-
`)))
|
|
749
|
+
`)));
|
|
750
|
+
const LAYOUT_ITEM_BODY_PADDING = {
|
|
751
|
+
wide: {
|
|
752
|
+
x: 40,
|
|
753
|
+
y: 40
|
|
754
|
+
},
|
|
755
|
+
default: {
|
|
756
|
+
x: 24,
|
|
757
|
+
y: 24
|
|
758
|
+
},
|
|
759
|
+
column1: {
|
|
760
|
+
x: 16,
|
|
761
|
+
y: 16
|
|
762
|
+
},
|
|
763
|
+
narrow: {
|
|
764
|
+
x: 24,
|
|
765
|
+
yTop: 12,
|
|
766
|
+
yBottom: 20
|
|
767
|
+
},
|
|
768
|
+
narrowColumn1: {
|
|
769
|
+
x: 16,
|
|
770
|
+
yTop: 4,
|
|
771
|
+
yBottom: 0
|
|
772
|
+
}
|
|
773
|
+
};
|
|
774
|
+
function LayoutItemBody({
|
|
775
|
+
children,
|
|
776
|
+
horizontal = false,
|
|
777
|
+
narrow = false
|
|
778
|
+
}) {
|
|
779
|
+
const {
|
|
780
|
+
wide
|
|
781
|
+
} = useContext(LayoutConfigContext);
|
|
782
|
+
return /*#__PURE__*/React.createElement(StyledLayoutItemBody, {
|
|
783
|
+
wide: wide,
|
|
784
|
+
horizontal: horizontal,
|
|
785
|
+
narrow: narrow
|
|
786
|
+
}, children);
|
|
787
|
+
}
|
|
788
|
+
const StyledLayoutItemBody = styled.div(_t14 || (_t14 = _$a`
|
|
209
789
|
padding: ${0};
|
|
210
790
|
|
|
211
791
|
@media ${0} {
|
|
@@ -214,7 +794,30 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
214
794
|
|
|
215
795
|
width: 100%;
|
|
216
796
|
box-sizing: border-box;
|
|
217
|
-
`),
|
|
797
|
+
`), 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`, ({
|
|
798
|
+
theme
|
|
799
|
+
}) => 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}`);
|
|
800
|
+
function useLayoutItemBodyPadding() {
|
|
801
|
+
const {
|
|
802
|
+
wide
|
|
803
|
+
} = useContext(LayoutConfigContext);
|
|
804
|
+
return useMediaScreen1() ? LAYOUT_ITEM_BODY_PADDING.column1 : wide ? LAYOUT_ITEM_BODY_PADDING.wide : LAYOUT_ITEM_BODY_PADDING.default;
|
|
805
|
+
}
|
|
806
|
+
function CancelLayoutItemBodyPadding({
|
|
807
|
+
children,
|
|
808
|
+
cancelTop
|
|
809
|
+
}) {
|
|
810
|
+
const {
|
|
811
|
+
wide
|
|
812
|
+
} = useContext(LayoutConfigContext);
|
|
813
|
+
return /*#__PURE__*/React.createElement(StyledCancelLayoutItemBodyPadding, {
|
|
814
|
+
wide: wide,
|
|
815
|
+
cancelTop: cancelTop
|
|
816
|
+
}, children);
|
|
817
|
+
}
|
|
818
|
+
/* eslint-disable max-len */
|
|
819
|
+
|
|
820
|
+
const StyledCancelLayoutItemBodyPadding = styled.div(_t15 || (_t15 = _$a`
|
|
218
821
|
margin: 0 -${0}px;
|
|
219
822
|
margin-top: -${0}px;
|
|
220
823
|
|
|
@@ -222,23 +825,134 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
222
825
|
margin: 0 -${0}px;
|
|
223
826
|
margin-top: -${0}px;
|
|
224
827
|
}
|
|
225
|
-
`),
|
|
828
|
+
`), p => p.wide ? LAYOUT_ITEM_BODY_PADDING.wide.x : LAYOUT_ITEM_BODY_PADDING.default.x, ({
|
|
829
|
+
cancelTop: _cancelTop = false,
|
|
830
|
+
wide
|
|
831
|
+
}) => !_cancelTop ? 0 : wide ? LAYOUT_ITEM_BODY_PADDING.wide.y : LAYOUT_ITEM_BODY_PADDING.default.y, ({
|
|
832
|
+
theme
|
|
833
|
+
}) => maxWidth(theme.breakpoint.screen1), LAYOUT_ITEM_BODY_PADDING.column1.x, ({
|
|
834
|
+
cancelTop: _cancelTop2 = false
|
|
835
|
+
}) => !_cancelTop2 ? 0 : LAYOUT_ITEM_BODY_PADDING.column1.x);
|
|
836
|
+
/* eslint-enable max-len */
|
|
837
|
+
|
|
838
|
+
// https://github.com/fernandopasik/react-children-utilities/blob/971d8a0324e6183734d8d1af9a65dbad18ab3d00/src/lib/onlyText.ts
|
|
839
|
+
|
|
840
|
+
const hasChildren = element => isValidElement(element) && Boolean(element.props.children);
|
|
841
|
+
|
|
842
|
+
const childToString = ( // eslint-disable-next-line @typescript-eslint/ban-types
|
|
843
|
+
child) => {
|
|
844
|
+
if (typeof child === 'undefined' || child === null || typeof child === 'boolean') {
|
|
845
|
+
return '';
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
if (JSON.stringify(child) === '{}') {
|
|
849
|
+
return '';
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
return child.toString();
|
|
853
|
+
};
|
|
854
|
+
const onlyText = children => {
|
|
855
|
+
if (!Array.isArray(children) && !isValidElement(children)) {
|
|
856
|
+
return childToString(children);
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
return Children$1.toArray(children).reduce((text, child) => {
|
|
860
|
+
let newText = '';
|
|
861
|
+
|
|
862
|
+
if (isValidElement(child) && hasChildren(child)) {
|
|
863
|
+
newText = onlyText(child.props.children);
|
|
864
|
+
} else if (isValidElement(child) && !hasChildren(child)) {
|
|
865
|
+
newText = '';
|
|
866
|
+
} else {
|
|
867
|
+
newText = childToString(child);
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
return text.concat(newText);
|
|
871
|
+
}, '');
|
|
872
|
+
};
|
|
873
|
+
|
|
874
|
+
let _$9 = t => t,
|
|
875
|
+
_t$a,
|
|
876
|
+
_t2$8,
|
|
877
|
+
_t3$7;
|
|
878
|
+
/**
|
|
879
|
+
* 複数行のテキストに表示行数制限を設けて`...`で省略する
|
|
880
|
+
*/
|
|
881
|
+
|
|
882
|
+
const TextEllipsis = styled.div.attrs(({
|
|
883
|
+
children,
|
|
884
|
+
title: _title = onlyText(children)
|
|
885
|
+
}) => ({
|
|
886
|
+
title: _title !== '' ? _title : undefined
|
|
887
|
+
}))(_t$a || (_t$a = _$9`
|
|
226
888
|
overflow: hidden;
|
|
227
889
|
line-height: ${0}px;
|
|
228
890
|
/* For english */
|
|
229
891
|
overflow-wrap: break-word;
|
|
230
892
|
|
|
231
893
|
${0}
|
|
232
|
-
`),
|
|
894
|
+
`), props => props.lineHeight, ({
|
|
895
|
+
lineLimit: _lineLimit = 1,
|
|
896
|
+
lineHeight
|
|
897
|
+
}) => _lineLimit === 1 ? css(_t2$8 || (_t2$8 = _$9`
|
|
233
898
|
text-overflow: ellipsis;
|
|
234
899
|
white-space: nowrap;
|
|
235
|
-
`)):
|
|
900
|
+
`)) : css(_t3$7 || (_t3$7 = _$9`
|
|
236
901
|
display: -webkit-box;
|
|
237
902
|
-webkit-box-orient: vertical;
|
|
238
903
|
-webkit-line-clamp: ${0};
|
|
239
904
|
/* Fallback for -webkit-line-clamp */
|
|
240
905
|
max-height: ${0}px;
|
|
241
|
-
`),
|
|
906
|
+
`), _lineLimit, lineHeight * _lineLimit));
|
|
907
|
+
|
|
908
|
+
const _excluded$2 = ["link", "onClick", "disabled", "primary", "secondary", "gtmClass", "noHover", "children"],
|
|
909
|
+
_excluded2 = ["icon", "primary"],
|
|
910
|
+
_excluded3 = ["icon", "primary"];
|
|
911
|
+
|
|
912
|
+
let _$8 = t => t,
|
|
913
|
+
_t$9,
|
|
914
|
+
_t2$7,
|
|
915
|
+
_t3$6,
|
|
916
|
+
_t4$5,
|
|
917
|
+
_t5$4,
|
|
918
|
+
_t6$3,
|
|
919
|
+
_t7$3,
|
|
920
|
+
_t8$3,
|
|
921
|
+
_t9$3,
|
|
922
|
+
_t10$3;
|
|
923
|
+
const MenuListItemContext = React.createContext({
|
|
924
|
+
padding: 24
|
|
925
|
+
});
|
|
926
|
+
function MenuListItem({
|
|
927
|
+
primary,
|
|
928
|
+
secondary,
|
|
929
|
+
onClick,
|
|
930
|
+
disabled = false,
|
|
931
|
+
noHover = false,
|
|
932
|
+
gtmClass,
|
|
933
|
+
children
|
|
934
|
+
}) {
|
|
935
|
+
const {
|
|
936
|
+
padding
|
|
937
|
+
} = useContext(MenuListItemContext);
|
|
938
|
+
return /*#__PURE__*/React.createElement(Item, {
|
|
939
|
+
hasSubLabel: secondary !== undefined,
|
|
940
|
+
onClick: e => !disabled && onClick && onClick(e),
|
|
941
|
+
sidePadding: padding,
|
|
942
|
+
noHover: noHover,
|
|
943
|
+
noClick: onClick === undefined,
|
|
944
|
+
"aria-disabled": disabled,
|
|
945
|
+
role: onClick !== undefined ? 'button' : undefined,
|
|
946
|
+
className: gtmClass !== undefined ? `gtm-${gtmClass}` : undefined
|
|
947
|
+
}, /*#__PURE__*/React.createElement(Labels, null, /*#__PURE__*/React.createElement(PrimaryText, null, /*#__PURE__*/React.createElement(TextEllipsis, {
|
|
948
|
+
lineHeight: 22,
|
|
949
|
+
lineLimit: 1
|
|
950
|
+
}, primary)), secondary !== undefined && /*#__PURE__*/React.createElement(SecondaryText, null, /*#__PURE__*/React.createElement(TextEllipsis, {
|
|
951
|
+
lineHeight: 22,
|
|
952
|
+
lineLimit: 1
|
|
953
|
+
}, secondary))), children);
|
|
954
|
+
}
|
|
955
|
+
const Item = styled.div(_t$9 || (_t$9 = _$8`
|
|
242
956
|
display: flex;
|
|
243
957
|
height: ${0}px;
|
|
244
958
|
align-items: center;
|
|
@@ -262,44 +976,145 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
262
976
|
background-color: unset;
|
|
263
977
|
}
|
|
264
978
|
}
|
|
265
|
-
`),
|
|
979
|
+
`), p => p.hasSubLabel ? 56 : 40, p => p.sidePadding, p => p.noClick ? 'default' : 'pointer', p => !p.noHover && css(_t2$7 || (_t2$7 = _$8`
|
|
266
980
|
background-color: ${0};
|
|
267
|
-
`),({
|
|
981
|
+
`), ({
|
|
982
|
+
theme
|
|
983
|
+
}) => theme.color.surface3), theme(o => o.disabled), disabledSelector);
|
|
984
|
+
const Labels = styled.div(_t3$6 || (_t3$6 = _$8`
|
|
268
985
|
display: flex;
|
|
269
986
|
flex-direction: column;
|
|
270
|
-
`))
|
|
987
|
+
`));
|
|
988
|
+
const PrimaryText = styled.div(_t4$5 || (_t4$5 = _$8`
|
|
271
989
|
color: ${0};
|
|
272
990
|
line-height: 22px;
|
|
273
991
|
font-size: 14px;
|
|
274
992
|
display: grid;
|
|
275
|
-
`),
|
|
993
|
+
`), p => p.theme.color.text2);
|
|
994
|
+
const SecondaryText = styled.div(_t5$4 || (_t5$4 = _$8`
|
|
276
995
|
color: ${0};
|
|
277
996
|
line-height: 18px;
|
|
278
997
|
font-size: 10px;
|
|
279
|
-
`),
|
|
998
|
+
`), p => p.theme.color.text3);
|
|
999
|
+
function MenuListLinkItem(_ref) {
|
|
1000
|
+
let {
|
|
1001
|
+
link,
|
|
1002
|
+
onClick,
|
|
1003
|
+
disabled = false,
|
|
1004
|
+
primary,
|
|
1005
|
+
secondary,
|
|
1006
|
+
gtmClass,
|
|
1007
|
+
noHover,
|
|
1008
|
+
children
|
|
1009
|
+
} = _ref,
|
|
1010
|
+
linkProps = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
1011
|
+
|
|
1012
|
+
const {
|
|
1013
|
+
Link
|
|
1014
|
+
} = useComponentAbstraction();
|
|
1015
|
+
const props = {
|
|
1016
|
+
disabled,
|
|
1017
|
+
primary,
|
|
1018
|
+
secondary,
|
|
1019
|
+
gtmClass,
|
|
1020
|
+
noHover,
|
|
1021
|
+
children
|
|
1022
|
+
};
|
|
1023
|
+
return disabled ? /*#__PURE__*/React.createElement("span", {
|
|
1024
|
+
onClick: onClick
|
|
1025
|
+
}, /*#__PURE__*/React.createElement(MenuListItem, props)) : /*#__PURE__*/React.createElement(A, _extends({
|
|
1026
|
+
as: Link,
|
|
1027
|
+
to: link,
|
|
1028
|
+
onClick: onClick
|
|
1029
|
+
}, linkProps), /*#__PURE__*/React.createElement(MenuListItem, _extends({
|
|
1030
|
+
onClick: () => void 0
|
|
1031
|
+
}, props)));
|
|
1032
|
+
}
|
|
1033
|
+
const A = styled.a(_t6$3 || (_t6$3 = _$8`
|
|
280
1034
|
display: block;
|
|
281
|
-
`));
|
|
1035
|
+
`));
|
|
1036
|
+
function MenuListLinkItemWithIcon(_ref2) {
|
|
1037
|
+
let {
|
|
1038
|
+
icon,
|
|
1039
|
+
primary: text
|
|
1040
|
+
} = _ref2,
|
|
1041
|
+
props = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
1042
|
+
|
|
1043
|
+
const primary = /*#__PURE__*/React.createElement(IconContainer, null, /*#__PURE__*/React.createElement(Icon$2, null, icon), text);
|
|
1044
|
+
return /*#__PURE__*/React.createElement(MenuListLinkItem, _extends({
|
|
1045
|
+
primary: primary
|
|
1046
|
+
}, props));
|
|
1047
|
+
}
|
|
1048
|
+
function MenuListItemWithIcon(_ref3) {
|
|
1049
|
+
let {
|
|
1050
|
+
icon,
|
|
1051
|
+
primary: text
|
|
1052
|
+
} = _ref3,
|
|
1053
|
+
props = _objectWithoutPropertiesLoose(_ref3, _excluded3);
|
|
1054
|
+
|
|
1055
|
+
const primary = /*#__PURE__*/React.createElement(IconContainer, null, /*#__PURE__*/React.createElement(Icon$2, null, icon), text);
|
|
1056
|
+
return /*#__PURE__*/React.createElement(MenuListItem, _extends({
|
|
1057
|
+
primary: primary
|
|
1058
|
+
}, props));
|
|
1059
|
+
}
|
|
1060
|
+
const IconContainer = styled.div(_t7$3 || (_t7$3 = _$8`
|
|
282
1061
|
display: grid;
|
|
283
1062
|
gap: 8px;
|
|
284
1063
|
grid-auto-flow: column;
|
|
285
1064
|
align-items: center;
|
|
286
|
-
`))
|
|
1065
|
+
`));
|
|
1066
|
+
const Icon$2 = styled.div(_t8$3 || (_t8$3 = _$8`
|
|
287
1067
|
color: ${0};
|
|
288
1068
|
display: flex;
|
|
289
|
-
`),({
|
|
1069
|
+
`), ({
|
|
1070
|
+
theme
|
|
1071
|
+
}) => theme.color.text3);
|
|
1072
|
+
const MenuListSpacer = styled.div(_t9$3 || (_t9$3 = _$8`
|
|
290
1073
|
height: 24px;
|
|
291
|
-
`))
|
|
1074
|
+
`));
|
|
1075
|
+
const MenuListLabel = styled.div(_t10$3 || (_t10$3 = _$8`
|
|
292
1076
|
padding: 0 16px;
|
|
293
1077
|
font-size: 12px;
|
|
294
1078
|
line-height: 16px;
|
|
295
1079
|
color: ${0};
|
|
296
1080
|
margin-top: -2px;
|
|
297
1081
|
margin-bottom: 6px;
|
|
298
|
-
`),
|
|
1082
|
+
`), ({
|
|
1083
|
+
theme
|
|
1084
|
+
}) => theme.color.text3);
|
|
1085
|
+
|
|
1086
|
+
let _$7 = t => t,
|
|
1087
|
+
_t$8,
|
|
1088
|
+
_t2$6;
|
|
1089
|
+
function LeftMenu({
|
|
1090
|
+
links,
|
|
1091
|
+
active
|
|
1092
|
+
}) {
|
|
1093
|
+
const {
|
|
1094
|
+
Link
|
|
1095
|
+
} = useComponentAbstraction();
|
|
1096
|
+
return /*#__PURE__*/React.createElement(Container$1, null, links.map((link, index) => /*#__PURE__*/React.createElement(Link, {
|
|
1097
|
+
to: link.to,
|
|
1098
|
+
key: index
|
|
1099
|
+
}, /*#__PURE__*/React.createElement(LinkItem, {
|
|
1100
|
+
"aria-current": link.id === active || undefined
|
|
1101
|
+
}, link.text))));
|
|
1102
|
+
}
|
|
1103
|
+
function LeftMenuContent({
|
|
1104
|
+
links
|
|
1105
|
+
}) {
|
|
1106
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, links.map((link, index) => /*#__PURE__*/React.createElement(MenuListLinkItem, {
|
|
1107
|
+
link: link.to,
|
|
1108
|
+
key: index,
|
|
1109
|
+
primary: link.text
|
|
1110
|
+
})));
|
|
1111
|
+
}
|
|
1112
|
+
const Container$1 = styled.div(_t$8 || (_t$8 = _$7`
|
|
299
1113
|
display: flex;
|
|
300
1114
|
flex-direction: column;
|
|
301
1115
|
align-items: flex-start;
|
|
302
|
-
`))
|
|
1116
|
+
`));
|
|
1117
|
+
const LinkItem = styled.div(_t2$6 || (_t2$6 = _$7`
|
|
303
1118
|
display: flex;
|
|
304
1119
|
align-items: center;
|
|
305
1120
|
color: ${0};
|
|
@@ -318,13 +1133,59 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
318
1133
|
color: ${0};
|
|
319
1134
|
background-color: ${0};
|
|
320
1135
|
}
|
|
321
|
-
`),
|
|
1136
|
+
`), ({
|
|
1137
|
+
theme
|
|
1138
|
+
}) => theme.color.text3, ({
|
|
1139
|
+
theme
|
|
1140
|
+
}) => theme.color.text2, ({
|
|
1141
|
+
theme
|
|
1142
|
+
}) => theme.color.text2, ({
|
|
1143
|
+
theme
|
|
1144
|
+
}) => theme.color.surface3);
|
|
1145
|
+
|
|
1146
|
+
let _$6 = t => t,
|
|
1147
|
+
_t$7,
|
|
1148
|
+
_t2$5,
|
|
1149
|
+
_t3$5,
|
|
1150
|
+
_t4$4,
|
|
1151
|
+
_t5$3,
|
|
1152
|
+
_t6$2,
|
|
1153
|
+
_t7$2,
|
|
1154
|
+
_t8$2,
|
|
1155
|
+
_t9$2,
|
|
1156
|
+
_t10$2;
|
|
1157
|
+
|
|
1158
|
+
const _excluded$1 = ["gtmClass", "flex", "rowReverse", "children", "disabled"];
|
|
1159
|
+
var index$2 = React.forwardRef(function SwitchCheckbox(_ref, ref) {
|
|
1160
|
+
let {
|
|
1161
|
+
gtmClass,
|
|
1162
|
+
flex = false,
|
|
1163
|
+
rowReverse = false,
|
|
1164
|
+
children,
|
|
1165
|
+
disabled
|
|
1166
|
+
} = _ref,
|
|
1167
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
1168
|
+
|
|
1169
|
+
return /*#__PURE__*/React.createElement(Label, {
|
|
1170
|
+
className: gtmClass !== undefined ? `gtm-${gtmClass}` : '',
|
|
1171
|
+
flex: flex,
|
|
1172
|
+
rowReverse: rowReverse,
|
|
1173
|
+
"aria-disabled": disabled
|
|
1174
|
+
}, /*#__PURE__*/React.createElement(SwitchOuter, null, /*#__PURE__*/React.createElement(SwitchInput, _extends({}, props, {
|
|
1175
|
+
disabled: disabled,
|
|
1176
|
+
ref: ref
|
|
1177
|
+
})), /*#__PURE__*/React.createElement(SwitchInner, null, /*#__PURE__*/React.createElement(SwitchInnerKnob, null))), children != null && /*#__PURE__*/React.createElement(Children, {
|
|
1178
|
+
rowReverse: rowReverse
|
|
1179
|
+
}, children));
|
|
1180
|
+
});
|
|
1181
|
+
const Children = styled.span(_t$7 || (_t$7 = _$6`
|
|
322
1182
|
${0}
|
|
323
|
-
`),
|
|
1183
|
+
`), p => p.rowReverse ? css(_t2$5 || (_t2$5 = _$6`
|
|
324
1184
|
margin-right: 8px;
|
|
325
|
-
`):
|
|
1185
|
+
`)) : css(_t3$5 || (_t3$5 = _$6`
|
|
326
1186
|
margin-left: 8px;
|
|
327
|
-
`)))
|
|
1187
|
+
`)));
|
|
1188
|
+
const Label = styled.label(_t4$4 || (_t4$4 = _$6`
|
|
328
1189
|
display: inline-flex;
|
|
329
1190
|
align-items: center;
|
|
330
1191
|
${0}
|
|
@@ -335,16 +1196,22 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
335
1196
|
&[aria-disabled='true'] {
|
|
336
1197
|
cursor: auto;
|
|
337
1198
|
}
|
|
338
|
-
`),({
|
|
1199
|
+
`), ({
|
|
1200
|
+
flex
|
|
1201
|
+
}) => flex && css(_t5$3 || (_t5$3 = _$6`
|
|
339
1202
|
display: flex;
|
|
340
1203
|
justify-content: space-between;
|
|
341
|
-
`)),({
|
|
1204
|
+
`)), ({
|
|
1205
|
+
rowReverse
|
|
1206
|
+
}) => css(_t6$2 || (_t6$2 = _$6`
|
|
342
1207
|
flex-direction: ${0};
|
|
343
|
-
`),
|
|
1208
|
+
`), rowReverse ? 'row-reverse' : 'row'));
|
|
1209
|
+
const SwitchOuter = styled.span(_t7$2 || (_t7$2 = _$6`
|
|
344
1210
|
display: inline-flex;
|
|
345
1211
|
position: relative;
|
|
346
1212
|
z-index: 0;
|
|
347
|
-
`))
|
|
1213
|
+
`));
|
|
1214
|
+
const SwitchInner = styled.div(_t8$2 || (_t8$2 = _$6`
|
|
348
1215
|
position: relative;
|
|
349
1216
|
box-sizing: border-box;
|
|
350
1217
|
width: 28px;
|
|
@@ -353,7 +1220,10 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
353
1220
|
border: 2px solid transparent;
|
|
354
1221
|
background: ${0};
|
|
355
1222
|
transition: box-shadow 0.2s, background-color 0.2s;
|
|
356
|
-
`),({
|
|
1223
|
+
`), ({
|
|
1224
|
+
theme
|
|
1225
|
+
}) => theme.color.text4);
|
|
1226
|
+
const SwitchInnerKnob = styled.div(_t9$2 || (_t9$2 = _$6`
|
|
357
1227
|
position: absolute;
|
|
358
1228
|
display: block;
|
|
359
1229
|
top: 0;
|
|
@@ -364,7 +1234,12 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
364
1234
|
border-radius: 50%;
|
|
365
1235
|
transform: translateX(0);
|
|
366
1236
|
transition: transform 0.2s;
|
|
367
|
-
`),({
|
|
1237
|
+
`), ({
|
|
1238
|
+
theme
|
|
1239
|
+
}) => theme.color.text5);
|
|
1240
|
+
const SwitchInput = styled.input.attrs({
|
|
1241
|
+
type: 'checkbox'
|
|
1242
|
+
})(_t10$2 || (_t10$2 = _$6`
|
|
368
1243
|
position: absolute;
|
|
369
1244
|
/* NOTE: this is contained by the GraphicCheckboxOuter */
|
|
370
1245
|
z-index: 1;
|
|
@@ -403,41 +1278,113 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
403
1278
|
${0};
|
|
404
1279
|
}
|
|
405
1280
|
}
|
|
406
|
-
`),
|
|
1281
|
+
`), SwitchInner, ({
|
|
1282
|
+
theme
|
|
1283
|
+
}) => theme.color.brand, SwitchInnerKnob, SwitchInner, ({
|
|
1284
|
+
theme
|
|
1285
|
+
}) => theme.elementEffect.disabled.opacity, SwitchInner, ({
|
|
1286
|
+
theme
|
|
1287
|
+
}) => applyEffect(theme.color.brand, theme.elementEffect.disabled));
|
|
1288
|
+
|
|
1289
|
+
let _$5 = t => t,
|
|
1290
|
+
_t$6,
|
|
1291
|
+
_t2$4,
|
|
1292
|
+
_t3$4,
|
|
1293
|
+
_t4$3,
|
|
1294
|
+
_t5$2,
|
|
1295
|
+
_t6$1,
|
|
1296
|
+
_t7$1,
|
|
1297
|
+
_t8$1,
|
|
1298
|
+
_t9$1,
|
|
1299
|
+
_t10$1,
|
|
1300
|
+
_t11,
|
|
1301
|
+
_t12,
|
|
1302
|
+
_t13;
|
|
1303
|
+
var index$1 = React.memo(function WithIcon({
|
|
1304
|
+
children,
|
|
1305
|
+
icon,
|
|
1306
|
+
show = true,
|
|
1307
|
+
prefix: pre = false,
|
|
1308
|
+
width,
|
|
1309
|
+
fit = false,
|
|
1310
|
+
fixed = false
|
|
1311
|
+
}) {
|
|
1312
|
+
const node = fit ? width === undefined ? /*#__PURE__*/React.createElement(AutoWidthIconAnchor, {
|
|
1313
|
+
show: show,
|
|
1314
|
+
pre: pre
|
|
1315
|
+
}, icon) : /*#__PURE__*/React.createElement(IconAnchor, {
|
|
1316
|
+
width: width,
|
|
1317
|
+
show: show,
|
|
1318
|
+
pre: pre
|
|
1319
|
+
}, /*#__PURE__*/React.createElement(Icon$1, null, icon)) : /*#__PURE__*/React.createElement(IconAnchorNaive, {
|
|
1320
|
+
show: show,
|
|
1321
|
+
pre: pre
|
|
1322
|
+
}, /*#__PURE__*/React.createElement(IconNaive, null, icon));
|
|
1323
|
+
return /*#__PURE__*/React.createElement(Root, null, pre && node, /*#__PURE__*/React.createElement(Text$1, {
|
|
1324
|
+
fixed: fixed
|
|
1325
|
+
}, children), !pre && node);
|
|
1326
|
+
});
|
|
1327
|
+
const Root = styled.div(_t$6 || (_t$6 = _$5`
|
|
407
1328
|
display: flex;
|
|
408
1329
|
align-items: center;
|
|
409
|
-
`))
|
|
1330
|
+
`));
|
|
1331
|
+
const Text$1 = styled.div(_t2$4 || (_t2$4 = _$5`
|
|
410
1332
|
${0}
|
|
411
1333
|
white-space: nowrap;
|
|
412
1334
|
text-overflow: ellipsis;
|
|
413
|
-
`),
|
|
1335
|
+
`), p => !p.fixed && css(_t3$4 || (_t3$4 = _$5`
|
|
414
1336
|
min-width: 0;
|
|
415
1337
|
overflow: hidden;
|
|
416
|
-
`)));
|
|
1338
|
+
`)));
|
|
1339
|
+
|
|
1340
|
+
function AutoWidthIconAnchor({
|
|
1341
|
+
children,
|
|
1342
|
+
show,
|
|
1343
|
+
pre
|
|
1344
|
+
}) {
|
|
1345
|
+
var _useElementSize$width, _useElementSize;
|
|
1346
|
+
|
|
1347
|
+
const ref = useRef(null); // depsを空配列にしないことで初回だけ同期で幅を計算させるテクニック
|
|
1348
|
+
|
|
1349
|
+
const width = (_useElementSize$width = (_useElementSize = useElementSize(ref, [null])) == null ? void 0 : _useElementSize.width) != null ? _useElementSize$width : 0;
|
|
1350
|
+
return /*#__PURE__*/React.createElement(IconAnchor, {
|
|
1351
|
+
width: width,
|
|
1352
|
+
show: show,
|
|
1353
|
+
pre: pre
|
|
1354
|
+
}, /*#__PURE__*/React.createElement(Icon$1, {
|
|
1355
|
+
ref: ref
|
|
1356
|
+
}, children));
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
const forceCenteringCss = css(_t4$3 || (_t4$3 = _$5`
|
|
417
1360
|
> svg {
|
|
418
1361
|
display: block;
|
|
419
1362
|
}
|
|
420
|
-
`))
|
|
1363
|
+
`));
|
|
1364
|
+
const iconAnchorCss = css(_t5$2 || (_t5$2 = _$5`
|
|
421
1365
|
${0};
|
|
422
1366
|
${0}
|
|
423
|
-
`),
|
|
1367
|
+
`), p => p.show === 'collapse' ? css(_t6$1 || (_t6$1 = _$5`
|
|
424
1368
|
display: none;
|
|
425
|
-
`)):
|
|
1369
|
+
`)) : css(_t7$1 || (_t7$1 = _$5`
|
|
426
1370
|
visibility: ${0};
|
|
427
|
-
`),
|
|
1371
|
+
`), p.show ? 'visible' : 'hidden'), p => p.pre ? css(_t8$1 || (_t8$1 = _$5`
|
|
428
1372
|
margin-right: 4px;
|
|
429
|
-
`):
|
|
1373
|
+
`)) : css(_t9$1 || (_t9$1 = _$5`
|
|
430
1374
|
margin-left: 4px;
|
|
431
|
-
`)))
|
|
1375
|
+
`)));
|
|
1376
|
+
const IconAnchorNaive = styled.div(_t10$1 || (_t10$1 = _$5`
|
|
432
1377
|
display: flex;
|
|
433
1378
|
align-items: center;
|
|
434
1379
|
|
|
435
1380
|
${0}
|
|
436
|
-
`),
|
|
1381
|
+
`), iconAnchorCss);
|
|
1382
|
+
const IconNaive = styled.div(_t11 || (_t11 = _$5`
|
|
437
1383
|
display: inline-flex;
|
|
438
1384
|
|
|
439
1385
|
${0}
|
|
440
|
-
`),
|
|
1386
|
+
`), forceCenteringCss);
|
|
1387
|
+
const IconAnchor = styled.div(_t12 || (_t12 = _$5`
|
|
441
1388
|
display: flex;
|
|
442
1389
|
position: relative;
|
|
443
1390
|
/* Iconをline-heightに関与させない */
|
|
@@ -446,13 +1393,138 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
446
1393
|
width: ${0}px;
|
|
447
1394
|
|
|
448
1395
|
${0}
|
|
449
|
-
`),
|
|
1396
|
+
`), p => p.width, iconAnchorCss);
|
|
1397
|
+
const Icon$1 = styled.div(_t13 || (_t13 = _$5`
|
|
450
1398
|
display: inline-flex;
|
|
451
1399
|
position: absolute;
|
|
452
1400
|
transform: translateY(-50%);
|
|
453
1401
|
|
|
454
1402
|
${0}
|
|
455
|
-
`),
|
|
1403
|
+
`), forceCenteringCss);
|
|
1404
|
+
|
|
1405
|
+
var passiveEventsResult; // eslint-disable-line no-var
|
|
1406
|
+
|
|
1407
|
+
function passiveEvents() {
|
|
1408
|
+
if (passiveEventsResult !== undefined) {
|
|
1409
|
+
return passiveEventsResult;
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
passiveEventsResult = false;
|
|
1413
|
+
|
|
1414
|
+
try {
|
|
1415
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
1416
|
+
const options = Object.defineProperty({}, 'passive', {
|
|
1417
|
+
get() {
|
|
1418
|
+
return passiveEventsResult = true;
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
});
|
|
1422
|
+
window.addEventListener('test', test, options);
|
|
1423
|
+
window.removeEventListener('test', test);
|
|
1424
|
+
} catch (_unused) {// test fail
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1427
|
+
return passiveEventsResult;
|
|
1428
|
+
|
|
1429
|
+
function test() {
|
|
1430
|
+
/* empty */
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
const isEdge = () => navigator.userAgent.includes('Edge/');
|
|
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 _$4 = t => t,
|
|
1485
|
+
_t$5,
|
|
1486
|
+
_t2$3,
|
|
1487
|
+
_t3$3,
|
|
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$5 || (_t$5 = _$4`
|
|
456
1528
|
display: flex;
|
|
457
1529
|
align-items: center;
|
|
458
1530
|
justify-content: center;
|
|
@@ -462,7 +1534,12 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
462
1534
|
background-color: ${0};
|
|
463
1535
|
transition: 0.4s visibility, 0.4s opacity, 0.2s background-color, 0.2s color;
|
|
464
1536
|
color: ${0};
|
|
465
|
-
`),
|
|
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$3 || (_t2$3 = _$4`
|
|
466
1543
|
position: absolute;
|
|
467
1544
|
top: 0;
|
|
468
1545
|
bottom: 0;
|
|
@@ -490,11 +1567,20 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
490
1567
|
}
|
|
491
1568
|
|
|
492
1569
|
${0}
|
|
493
|
-
`),
|
|
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$3 || (_t3$3 = _$4`
|
|
494
1579
|
visibility: hidden;
|
|
495
1580
|
opacity: 0;
|
|
496
1581
|
pointer-events: none;
|
|
497
|
-
`)));
|
|
1582
|
+
`)));
|
|
1583
|
+
styled(CarouselButtonIcon)(_t4$2 || (_t4$2 = _$4`
|
|
498
1584
|
cursor: pointer;
|
|
499
1585
|
|
|
500
1586
|
&:hover {
|
|
@@ -506,11 +1592,280 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
506
1592
|
background-color: ${0};
|
|
507
1593
|
color: ${0};
|
|
508
1594
|
}
|
|
509
|
-
`),({
|
|
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 = _$4`
|
|
510
1605
|
@media (hover: none) and (pointer: coarse) {
|
|
511
1606
|
display: none;
|
|
512
1607
|
}
|
|
513
|
-
`));
|
|
1608
|
+
`));
|
|
1609
|
+
|
|
1610
|
+
let _$3 = t => t,
|
|
1611
|
+
_t$4,
|
|
1612
|
+
_t2$2,
|
|
1613
|
+
_t3$2,
|
|
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
|
+
useLayoutEffect(() => {
|
|
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
|
+
useLayoutEffect(() => {
|
|
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
|
+
useLayoutEffect(() => {
|
|
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$4 || (_t$4 = _$3`
|
|
514
1869
|
vertical-align: top;
|
|
515
1870
|
overflow: hidden;
|
|
516
1871
|
list-style: none;
|
|
@@ -521,17 +1876,21 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
521
1876
|
box-sizing: border-box;
|
|
522
1877
|
|
|
523
1878
|
${0}
|
|
524
|
-
`),({
|
|
1879
|
+
`), ({
|
|
1880
|
+
centerItems: _centerItems = false
|
|
1881
|
+
}) => _centerItems ? css(_t2$2 || (_t2$2 = _$3`
|
|
525
1882
|
display: flex;
|
|
526
1883
|
width: max-content;
|
|
527
1884
|
margin: 0 auto;
|
|
528
|
-
`):
|
|
1885
|
+
`)) : css(_t3$2 || (_t3$2 = _$3`
|
|
529
1886
|
display: inline-flex;
|
|
530
1887
|
margin: 0;
|
|
531
|
-
`)))
|
|
1888
|
+
`)));
|
|
1889
|
+
const ButtonsContainer = styled.div(_t4$1 || (_t4$1 = _$3`
|
|
532
1890
|
opacity: 0;
|
|
533
1891
|
transition: 0.4s opacity;
|
|
534
|
-
`))
|
|
1892
|
+
`));
|
|
1893
|
+
const Container = styled.div(_t5 || (_t5 = _$3`
|
|
535
1894
|
&:hover ${0} {
|
|
536
1895
|
opacity: 1;
|
|
537
1896
|
}
|
|
@@ -539,7 +1898,8 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
539
1898
|
/* CarouselButtonの中にz-index:1があるのでここでコンテキストを切る */
|
|
540
1899
|
position: relative;
|
|
541
1900
|
z-index: 0;
|
|
542
|
-
`),
|
|
1901
|
+
`), ButtonsContainer);
|
|
1902
|
+
const ScrollArea = styled(animated.div)(_t6 || (_t6 = _$3`
|
|
543
1903
|
overflow-x: auto;
|
|
544
1904
|
padding: 0;
|
|
545
1905
|
margin: 0;
|
|
@@ -549,7 +1909,8 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
549
1909
|
}
|
|
550
1910
|
|
|
551
1911
|
scrollbar-width: none;
|
|
552
|
-
`))
|
|
1912
|
+
`));
|
|
1913
|
+
const GradientContainer = styled.div(_t7 || (_t7 = _$3`
|
|
553
1914
|
/* NOTE: LeftGradientがはみ出るためhidden */
|
|
554
1915
|
overflow: hidden;
|
|
555
1916
|
${0}
|
|
@@ -559,18 +1920,20 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
559
1920
|
${0} {
|
|
560
1921
|
padding-right: ${0}px;
|
|
561
1922
|
}
|
|
562
|
-
`),
|
|
1923
|
+
`), p => !p.fadeInGradient && css(_t8 || (_t8 = _$3`
|
|
563
1924
|
margin-left: ${0}px;
|
|
564
1925
|
${0} {
|
|
565
1926
|
padding-left: ${0}px;
|
|
566
1927
|
}
|
|
567
|
-
`)
|
|
1928
|
+
`), -GRADIENT_WIDTH, CarouselContainer, GRADIENT_WIDTH), -GRADIENT_WIDTH, CarouselContainer, GRADIENT_WIDTH);
|
|
1929
|
+
const RightGradient = styled.div(_t9 || (_t9 = _$3`
|
|
568
1930
|
mask-image: linear-gradient(
|
|
569
1931
|
to right,
|
|
570
1932
|
#000 calc(100% - ${0}px),
|
|
571
1933
|
transparent
|
|
572
1934
|
);
|
|
573
|
-
`),
|
|
1935
|
+
`), GRADIENT_WIDTH);
|
|
1936
|
+
const LeftGradient = styled.div(_t10 || (_t10 = _$3`
|
|
574
1937
|
/* NOTE: mask-position が left → negative px の時、right → abs(negative px) の位置に表示されるため */
|
|
575
1938
|
margin-right: ${0}px;
|
|
576
1939
|
padding-right: ${0}px;
|
|
@@ -578,18 +1941,249 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
578
1941
|
transition: 0.2s all ease-in;
|
|
579
1942
|
mask: linear-gradient(to right, transparent, #000 ${0}px)
|
|
580
1943
|
${0}px 0;
|
|
581
|
-
`)
|
|
1944
|
+
`), -GRADIENT_WIDTH, GRADIENT_WIDTH, GRADIENT_WIDTH, p => p.show ? 0 : -GRADIENT_WIDTH);
|
|
1945
|
+
|
|
1946
|
+
let _$2 = t => t,
|
|
1947
|
+
_t$3;
|
|
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$3 || (_t$3 = _$2`
|
|
582
1972
|
fill: currentColor;
|
|
583
|
-
`));
|
|
1973
|
+
`));
|
|
1974
|
+
|
|
1975
|
+
let _$1 = t => t,
|
|
1976
|
+
_t$2;
|
|
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$2 || (_t$2 = _$1`
|
|
584
2031
|
fill: none;
|
|
585
2032
|
stroke-linejoin: round;
|
|
586
2033
|
stroke-linecap: round;
|
|
587
2034
|
stroke: currentColor;
|
|
588
|
-
`));
|
|
2035
|
+
`));
|
|
2036
|
+
|
|
2037
|
+
let _2 = t => t,
|
|
2038
|
+
_t$1,
|
|
2039
|
+
_t2$1,
|
|
2040
|
+
_t3$1,
|
|
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$1 || (_t$1 = _2`
|
|
589
2182
|
display: flex;
|
|
590
2183
|
justify-content: center;
|
|
591
2184
|
align-items: center;
|
|
592
|
-
`))
|
|
2185
|
+
`));
|
|
2186
|
+
const CircleButton = styled.button(_t2$1 || (_t2$1 = _2`
|
|
593
2187
|
font-size: 1rem;
|
|
594
2188
|
line-height: calc(1em + 8px);
|
|
595
2189
|
text-decoration: none;
|
|
@@ -642,17 +2236,59 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
642
2236
|
}
|
|
643
2237
|
|
|
644
2238
|
${0}
|
|
645
|
-
`),({
|
|
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$1 || (_t3$1 = _2`
|
|
646
2256
|
/* stylelint-disable-next-line no-duplicate-selectors */
|
|
647
2257
|
&:hover {
|
|
648
2258
|
background: transparent;
|
|
649
2259
|
}
|
|
650
|
-
`)))
|
|
2260
|
+
`)));
|
|
2261
|
+
const Spacer = styled(CircleButton).attrs({
|
|
2262
|
+
type: 'button',
|
|
2263
|
+
disabled: true
|
|
2264
|
+
})(_t4 || (_t4 = _2`
|
|
651
2265
|
&& {
|
|
652
2266
|
color: ${0};
|
|
653
2267
|
background: none;
|
|
654
2268
|
}
|
|
655
|
-
`),
|
|
2269
|
+
`), ({
|
|
2270
|
+
theme
|
|
2271
|
+
}) => theme.color.text3);
|
|
2272
|
+
const Text = 'span';
|
|
2273
|
+
|
|
2274
|
+
let _ = t => t,
|
|
2275
|
+
_t,
|
|
2276
|
+
_t2,
|
|
2277
|
+
_t3;
|
|
2278
|
+
function Spinner({
|
|
2279
|
+
size = 48,
|
|
2280
|
+
padding = 16,
|
|
2281
|
+
transparent = false
|
|
2282
|
+
}) {
|
|
2283
|
+
return /*#__PURE__*/React.createElement(SpinnerRoot, {
|
|
2284
|
+
size: size,
|
|
2285
|
+
padding: padding,
|
|
2286
|
+
transparent: transparent
|
|
2287
|
+
}, /*#__PURE__*/React.createElement(SpinnerIcon, null));
|
|
2288
|
+
}
|
|
2289
|
+
const SpinnerRoot = styled.div.attrs({
|
|
2290
|
+
role: 'progressbar'
|
|
2291
|
+
})(_t || (_t = _`
|
|
656
2292
|
margin: auto;
|
|
657
2293
|
padding: ${0}px;
|
|
658
2294
|
border-radius: 8px;
|
|
@@ -661,7 +2297,13 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
661
2297
|
height: ${0}px;
|
|
662
2298
|
background-color: ${0};
|
|
663
2299
|
color: ${0};
|
|
664
|
-
`),
|
|
2300
|
+
`), props => props.padding, props => props.size, props => props.size, props => props.size, ({
|
|
2301
|
+
theme,
|
|
2302
|
+
transparent
|
|
2303
|
+
}) => transparent ? 'transparent' : transparentize(0.32, theme.color.background1), ({
|
|
2304
|
+
theme
|
|
2305
|
+
}) => theme.color.text4);
|
|
2306
|
+
const scaleout = keyframes(_t2 || (_t2 = _`
|
|
665
2307
|
from {
|
|
666
2308
|
transform: scale(0);
|
|
667
2309
|
opacity: 1;
|
|
@@ -671,7 +2313,10 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
671
2313
|
transform: scale(1);
|
|
672
2314
|
opacity: 0;
|
|
673
2315
|
}
|
|
674
|
-
`))
|
|
2316
|
+
`));
|
|
2317
|
+
const Icon = styled.div.attrs({
|
|
2318
|
+
role: 'presentation'
|
|
2319
|
+
})(_t3 || (_t3 = _`
|
|
675
2320
|
width: 1em;
|
|
676
2321
|
height: 1em;
|
|
677
2322
|
border-radius: 1em;
|
|
@@ -682,5 +2327,26 @@ import e,{useMemo as t,useState as n,useLayoutEffect as r,useDebugValue as o,use
|
|
|
682
2327
|
&[data-reset-animation] {
|
|
683
2328
|
animation: none;
|
|
684
2329
|
}
|
|
685
|
-
`),
|
|
2330
|
+
`), scaleout, p => p.once ? 1 : 'infinite');
|
|
2331
|
+
const SpinnerIcon = React.forwardRef(function SpinnerIcon({
|
|
2332
|
+
once = false
|
|
2333
|
+
}, ref) {
|
|
2334
|
+
const iconRef = useRef(null);
|
|
2335
|
+
useImperativeHandle(ref, () => ({
|
|
2336
|
+
restart: () => {
|
|
2337
|
+
if (!iconRef.current) {
|
|
2338
|
+
return;
|
|
2339
|
+
}
|
|
2340
|
+
|
|
2341
|
+
iconRef.current.dataset.resetAnimation = 'true'; // Force reflow hack!
|
|
2342
|
+
delete iconRef.current.dataset.resetAnimation;
|
|
2343
|
+
}
|
|
2344
|
+
}));
|
|
2345
|
+
return /*#__PURE__*/React.createElement(Icon, {
|
|
2346
|
+
ref: iconRef,
|
|
2347
|
+
once: once
|
|
2348
|
+
});
|
|
2349
|
+
});
|
|
2350
|
+
|
|
2351
|
+
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, Spinner, SpinnerIcon, StyledCancelLayoutItemBodyPadding, StyledLayoutItemBody, index$2 as SwitchCheckbox, TextEllipsis, index$1 as WithIcon, useElementSize, useLayoutItemBodyPadding, useMedia, useMediaScreen1 };
|
|
686
2352
|
//# sourceMappingURL=index.modern.js.map
|