@charcoal-ui/react-sandbox 2.4.0 → 2.6.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.
- package/dist/_lib/compat.d.ts +14 -14
- package/dist/components/Carousel/index.d.ts +39 -39
- package/dist/components/Carousel/index.d.ts.map +1 -1
- package/dist/components/Carousel/index.story.d.ts +6 -6
- package/dist/components/CarouselButton/index.d.ts +20 -20
- package/dist/components/CarouselButton/index.story.d.ts +9 -9
- package/dist/components/Filter/index.d.ts +19 -19
- package/dist/components/Filter/index.story.d.ts +8 -8
- package/dist/components/HintText/index.d.ts +9 -9
- package/dist/components/HintText/index.d.ts.map +1 -1
- package/dist/components/HintText/index.story.d.ts +11 -11
- package/dist/components/Layout/index.d.ts +67 -67
- package/dist/components/Layout/index.story.d.ts +13 -13
- package/dist/components/LeftMenu/index.d.ts +11 -11
- package/dist/components/MenuListItem/index.d.ts +34 -34
- package/dist/components/MenuListItem/index.story.d.ts +17 -17
- package/dist/components/Pager/index.d.ts +14 -14
- package/dist/components/Pager/index.story.d.ts +31 -31
- package/dist/components/SwitchCheckbox/index.d.ts +8 -8
- package/dist/components/SwitchCheckbox/index.story.d.ts +10 -10
- package/dist/components/TextEllipsis/helper.d.ts +3 -3
- package/dist/components/TextEllipsis/index.d.ts +10 -10
- package/dist/components/TextEllipsis/index.story.d.ts +8 -8
- package/dist/components/WithIcon/index.d.ts +27 -27
- package/dist/components/WithIcon/index.story.d.ts +14 -14
- package/dist/components/icons/Base.d.ts +15 -15
- package/dist/components/icons/Base.d.ts.map +1 -1
- package/dist/components/icons/DotsIcon.d.ts +11 -11
- package/dist/components/icons/InfoIcon.d.ts +1 -1
- package/dist/components/icons/NextIcon.d.ts +11 -11
- package/dist/components/icons/WedgeIcon.d.ts +19 -19
- package/dist/foundation/contants.d.ts +3 -3
- package/dist/foundation/hooks.d.ts +28 -28
- package/dist/foundation/support.d.ts +2 -2
- package/dist/foundation/utils.d.ts +22 -22
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/index.cjs.js +1871 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +13 -13
- package/dist/index.esm.js +1816 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/misc/storybook-helper.d.ts +2 -2
- package/dist/styled.d.ts +94 -92
- package/dist/styled.d.ts.map +1 -1
- package/package.json +18 -18
- package/src/components/Carousel/index.tsx +5 -10
- package/src/hooks/index.ts +4 -0
- package/dist/index.cjs +0 -1814
- package/dist/index.cjs.map +0 -1
- package/dist/index.modern.js +0 -2273
- package/dist/index.modern.js.map +0 -1
- package/dist/index.module.js +0 -1766
- package/dist/index.module.js.map +0 -1
package/dist/index.modern.js
DELETED
|
@@ -1,2273 +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
|
-
function unreachable(value) {
|
|
1434
|
-
throw new Error(arguments.length === 0 ? 'unreachable' : `unreachable (${JSON.stringify(value)})`);
|
|
1435
|
-
}
|
|
1436
|
-
|
|
1437
|
-
var WedgeDirection$1;
|
|
1438
|
-
|
|
1439
|
-
(function (WedgeDirection) {
|
|
1440
|
-
WedgeDirection["Up"] = "up";
|
|
1441
|
-
WedgeDirection["Down"] = "down";
|
|
1442
|
-
WedgeDirection["Left"] = "left";
|
|
1443
|
-
WedgeDirection["Right"] = "right";
|
|
1444
|
-
})(WedgeDirection$1 || (WedgeDirection$1 = {})); // eslint-disable-next-line max-len
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
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`;
|
|
1448
|
-
const size = 24;
|
|
1449
|
-
function NextIcon({
|
|
1450
|
-
direction
|
|
1451
|
-
}) {
|
|
1452
|
-
const transform = directionToTransform$1(direction);
|
|
1453
|
-
return /*#__PURE__*/React.createElement(IconBase, {
|
|
1454
|
-
viewBoxSize: size,
|
|
1455
|
-
size: size,
|
|
1456
|
-
currentColor: true,
|
|
1457
|
-
path: path,
|
|
1458
|
-
transform: transform
|
|
1459
|
-
});
|
|
1460
|
-
}
|
|
1461
|
-
|
|
1462
|
-
function directionToTransform$1(direction) {
|
|
1463
|
-
// "5 4" is the center point of the "0 0 10 8" viewBox
|
|
1464
|
-
switch (direction) {
|
|
1465
|
-
case WedgeDirection$1.Up:
|
|
1466
|
-
return 'rotate(270 12 12)';
|
|
1467
|
-
|
|
1468
|
-
case WedgeDirection$1.Down:
|
|
1469
|
-
return 'rotate(90 12 12)';
|
|
1470
|
-
|
|
1471
|
-
case WedgeDirection$1.Left:
|
|
1472
|
-
return 'rotate(180 12 12)';
|
|
1473
|
-
|
|
1474
|
-
case WedgeDirection$1.Right:
|
|
1475
|
-
return undefined;
|
|
1476
|
-
|
|
1477
|
-
default:
|
|
1478
|
-
return unreachable(direction);
|
|
1479
|
-
}
|
|
1480
|
-
}
|
|
1481
|
-
|
|
1482
|
-
let _$3 = t => t,
|
|
1483
|
-
_t$4,
|
|
1484
|
-
_t2$2,
|
|
1485
|
-
_t3$2,
|
|
1486
|
-
_t4$2,
|
|
1487
|
-
_t5$1;
|
|
1488
|
-
var Direction;
|
|
1489
|
-
|
|
1490
|
-
(function (Direction) {
|
|
1491
|
-
Direction["Right"] = "right";
|
|
1492
|
-
Direction["Left"] = "left";
|
|
1493
|
-
})(Direction || (Direction = {}));
|
|
1494
|
-
|
|
1495
|
-
function CarouselButton({
|
|
1496
|
-
direction,
|
|
1497
|
-
show,
|
|
1498
|
-
offset = 0,
|
|
1499
|
-
padding = 0,
|
|
1500
|
-
bottomOffset: bottom = 0,
|
|
1501
|
-
gradient = false,
|
|
1502
|
-
onClick
|
|
1503
|
-
}) {
|
|
1504
|
-
const offsetStyle = direction === Direction.Left ? {
|
|
1505
|
-
left: gradient ? offset - 72 : offset,
|
|
1506
|
-
paddingLeft: Math.max(padding, 0),
|
|
1507
|
-
paddingBottom: bottom
|
|
1508
|
-
} : {
|
|
1509
|
-
right: gradient ? offset - 72 : offset,
|
|
1510
|
-
paddingRight: Math.max(padding, 0),
|
|
1511
|
-
paddingBottom: bottom
|
|
1512
|
-
};
|
|
1513
|
-
return /*#__PURE__*/React.createElement(Button, {
|
|
1514
|
-
type: "button",
|
|
1515
|
-
onClick: onClick,
|
|
1516
|
-
hide: !show,
|
|
1517
|
-
style: offsetStyle,
|
|
1518
|
-
css: onlyNonTouchDevice
|
|
1519
|
-
}, /*#__PURE__*/React.createElement(CarouselButtonIcon, null, /*#__PURE__*/React.createElement(NextIcon, {
|
|
1520
|
-
direction: direction === Direction.Right ? WedgeDirection$1.Right : // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
1521
|
-
direction === Direction.Left ? WedgeDirection$1.Left : unreachable()
|
|
1522
|
-
})));
|
|
1523
|
-
}
|
|
1524
|
-
const CAROUSEL_BUTTON_SIZE = 40;
|
|
1525
|
-
const CarouselButtonIcon = styled.div(_t$4 || (_t$4 = _$3`
|
|
1526
|
-
display: flex;
|
|
1527
|
-
align-items: center;
|
|
1528
|
-
justify-content: center;
|
|
1529
|
-
width: ${0}px;
|
|
1530
|
-
height: ${0}px;
|
|
1531
|
-
border-radius: 50%;
|
|
1532
|
-
background-color: ${0};
|
|
1533
|
-
transition: 0.4s visibility, 0.4s opacity, 0.2s background-color, 0.2s color;
|
|
1534
|
-
color: ${0};
|
|
1535
|
-
`), CAROUSEL_BUTTON_SIZE, CAROUSEL_BUTTON_SIZE, ({
|
|
1536
|
-
theme
|
|
1537
|
-
}) => theme.color.surface4, ({
|
|
1538
|
-
theme
|
|
1539
|
-
}) => theme.color.text5);
|
|
1540
|
-
const Button = styled.button(_t2$2 || (_t2$2 = _$3`
|
|
1541
|
-
position: absolute;
|
|
1542
|
-
top: 0;
|
|
1543
|
-
bottom: 0;
|
|
1544
|
-
display: flex;
|
|
1545
|
-
align-items: center;
|
|
1546
|
-
padding: 0;
|
|
1547
|
-
min-width: 40px;
|
|
1548
|
-
border: none;
|
|
1549
|
-
outline: 0;
|
|
1550
|
-
background: transparent;
|
|
1551
|
-
cursor: pointer;
|
|
1552
|
-
transition: 0.4s visibility, 0.4s opacity;
|
|
1553
|
-
/* つらい */
|
|
1554
|
-
/* このコンポーネントはCarouselでしか使われてないのでそっちでコンテキストで切る */
|
|
1555
|
-
z-index: 1;
|
|
1556
|
-
|
|
1557
|
-
&:hover ${0} {
|
|
1558
|
-
background-color: ${0};
|
|
1559
|
-
color: ${0};
|
|
1560
|
-
}
|
|
1561
|
-
|
|
1562
|
-
&:active ${0} {
|
|
1563
|
-
background-color: ${0};
|
|
1564
|
-
color: ${0};
|
|
1565
|
-
}
|
|
1566
|
-
|
|
1567
|
-
${0}
|
|
1568
|
-
`), CarouselButtonIcon, ({
|
|
1569
|
-
theme
|
|
1570
|
-
}) => applyEffect(theme.color.surface4, theme.effect.hover), ({
|
|
1571
|
-
theme
|
|
1572
|
-
}) => applyEffect(theme.color.text5, theme.effect.hover), CarouselButtonIcon, ({
|
|
1573
|
-
theme
|
|
1574
|
-
}) => applyEffect(theme.color.surface4, theme.effect.press), ({
|
|
1575
|
-
theme
|
|
1576
|
-
}) => applyEffect(theme.color.text5, theme.effect.press), p => p.hide && css(_t3$2 || (_t3$2 = _$3`
|
|
1577
|
-
visibility: hidden;
|
|
1578
|
-
opacity: 0;
|
|
1579
|
-
pointer-events: none;
|
|
1580
|
-
`)));
|
|
1581
|
-
styled(CarouselButtonIcon)(_t4$2 || (_t4$2 = _$3`
|
|
1582
|
-
cursor: pointer;
|
|
1583
|
-
|
|
1584
|
-
&:hover {
|
|
1585
|
-
background-color: ${0};
|
|
1586
|
-
color: ${0};
|
|
1587
|
-
}
|
|
1588
|
-
|
|
1589
|
-
&:active {
|
|
1590
|
-
background-color: ${0};
|
|
1591
|
-
color: ${0};
|
|
1592
|
-
}
|
|
1593
|
-
`), ({
|
|
1594
|
-
theme
|
|
1595
|
-
}) => applyEffect(theme.color.surface4, theme.effect.hover), ({
|
|
1596
|
-
theme
|
|
1597
|
-
}) => applyEffect(theme.color.text5, theme.effect.hover), ({
|
|
1598
|
-
theme
|
|
1599
|
-
}) => applyEffect(theme.color.surface4, theme.effect.press), ({
|
|
1600
|
-
theme
|
|
1601
|
-
}) => applyEffect(theme.color.text5, theme.effect.press));
|
|
1602
|
-
const onlyNonTouchDevice = css(_t5$1 || (_t5$1 = _$3`
|
|
1603
|
-
@media (hover: none) and (pointer: coarse) {
|
|
1604
|
-
display: none;
|
|
1605
|
-
}
|
|
1606
|
-
`));
|
|
1607
|
-
|
|
1608
|
-
let _$2 = t => t,
|
|
1609
|
-
_t$3,
|
|
1610
|
-
_t2$1,
|
|
1611
|
-
_t3$1,
|
|
1612
|
-
_t4$1,
|
|
1613
|
-
_t5,
|
|
1614
|
-
_t6,
|
|
1615
|
-
_t7,
|
|
1616
|
-
_t8,
|
|
1617
|
-
_t9,
|
|
1618
|
-
_t10;
|
|
1619
|
-
|
|
1620
|
-
const _excluded = ["buttonOffset", "buttonPadding", "bottomOffset", "defaultScroll", "onScroll", "onResize", "children", "centerItems", "onScrollStateChange", "scrollAmountCoef"];
|
|
1621
|
-
const GRADIENT_WIDTH = 72;
|
|
1622
|
-
/**
|
|
1623
|
-
* カルーセル系のスクロール量の定数
|
|
1624
|
-
*
|
|
1625
|
-
* @example
|
|
1626
|
-
* const scrollAmount = containerElm.clientWidth * SCROLL_AMOUNT_COEF
|
|
1627
|
-
*/
|
|
1628
|
-
|
|
1629
|
-
const SCROLL_AMOUNT_COEF = 0.75;
|
|
1630
|
-
function Carousel(_ref) {
|
|
1631
|
-
let {
|
|
1632
|
-
buttonOffset = 0,
|
|
1633
|
-
buttonPadding = 16,
|
|
1634
|
-
bottomOffset = 0,
|
|
1635
|
-
defaultScroll: {
|
|
1636
|
-
align = 'left',
|
|
1637
|
-
offset: scrollOffset = 0
|
|
1638
|
-
} = {},
|
|
1639
|
-
onScroll,
|
|
1640
|
-
onResize,
|
|
1641
|
-
children,
|
|
1642
|
-
centerItems,
|
|
1643
|
-
onScrollStateChange,
|
|
1644
|
-
scrollAmountCoef = SCROLL_AMOUNT_COEF
|
|
1645
|
-
} = _ref,
|
|
1646
|
-
options = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
1647
|
-
|
|
1648
|
-
// スクロール位置を保存する
|
|
1649
|
-
// アニメーション中の場合は、アニメーション終了時のスクロール位置が保存される
|
|
1650
|
-
const [scrollLeft, setScrollLeft] = useDebounceAnimationState(0); // アニメーション中かどうか
|
|
1651
|
-
|
|
1652
|
-
const animation = useRef(false); // スクロール可能な領域を保存する
|
|
1653
|
-
|
|
1654
|
-
const [maxScrollLeft, setMaxScrollLeft] = useState(0); // 左右のボタンの表示状態を保存する
|
|
1655
|
-
|
|
1656
|
-
const [leftShow, setLeftShow] = useState(false);
|
|
1657
|
-
const [rightShow, setRightShow] = useState(false); // const [props, set, stop] = useSpring(() => ({
|
|
1658
|
-
// scroll: 0
|
|
1659
|
-
// }))
|
|
1660
|
-
|
|
1661
|
-
const [styles, set] = useSpring(() => ({
|
|
1662
|
-
scroll: 0
|
|
1663
|
-
}));
|
|
1664
|
-
const ref = useRef(null);
|
|
1665
|
-
const visibleAreaRef = useRef(null);
|
|
1666
|
-
const innerRef = useRef(null);
|
|
1667
|
-
const handleRight = useCallback(() => {
|
|
1668
|
-
if (visibleAreaRef.current === null) {
|
|
1669
|
-
return;
|
|
1670
|
-
}
|
|
1671
|
-
|
|
1672
|
-
const {
|
|
1673
|
-
clientWidth
|
|
1674
|
-
} = visibleAreaRef.current; // スクロール領域を超えないように、アニメーションを開始
|
|
1675
|
-
// アニメーション中にアニメーションが開始されたときに、アニメーション終了予定の位置から再度計算するようにする
|
|
1676
|
-
|
|
1677
|
-
const scroll = Math.min(scrollLeft + clientWidth * scrollAmountCoef, maxScrollLeft);
|
|
1678
|
-
setScrollLeft(scroll, true);
|
|
1679
|
-
set({
|
|
1680
|
-
scroll,
|
|
1681
|
-
from: {
|
|
1682
|
-
scroll: scrollLeft
|
|
1683
|
-
},
|
|
1684
|
-
reset: !animation.current
|
|
1685
|
-
});
|
|
1686
|
-
animation.current = true;
|
|
1687
|
-
}, [animation, maxScrollLeft, scrollLeft, set, scrollAmountCoef, setScrollLeft]);
|
|
1688
|
-
const handleLeft = useCallback(() => {
|
|
1689
|
-
if (visibleAreaRef.current === null) {
|
|
1690
|
-
return;
|
|
1691
|
-
}
|
|
1692
|
-
|
|
1693
|
-
const {
|
|
1694
|
-
clientWidth
|
|
1695
|
-
} = visibleAreaRef.current;
|
|
1696
|
-
const scroll = Math.max(scrollLeft - clientWidth * scrollAmountCoef, 0);
|
|
1697
|
-
setScrollLeft(scroll, true);
|
|
1698
|
-
set({
|
|
1699
|
-
scroll,
|
|
1700
|
-
from: {
|
|
1701
|
-
scroll: scrollLeft
|
|
1702
|
-
},
|
|
1703
|
-
reset: !animation.current
|
|
1704
|
-
});
|
|
1705
|
-
animation.current = true;
|
|
1706
|
-
}, [animation, scrollLeft, set, scrollAmountCoef, setScrollLeft]); // スクロール可能な場合にボタンを表示する
|
|
1707
|
-
// scrollLeftが変化したときに処理する (アニメーション開始時 & 手動スクロール時)
|
|
1708
|
-
|
|
1709
|
-
useEffect(() => {
|
|
1710
|
-
const newleftShow = scrollLeft > 0;
|
|
1711
|
-
const newrightShow = scrollLeft < maxScrollLeft && maxScrollLeft > 0;
|
|
1712
|
-
|
|
1713
|
-
if (newleftShow !== leftShow || newrightShow !== rightShow) {
|
|
1714
|
-
setLeftShow(newleftShow);
|
|
1715
|
-
setRightShow(newrightShow);
|
|
1716
|
-
onScrollStateChange == null ? void 0 : onScrollStateChange(newleftShow || newrightShow);
|
|
1717
|
-
}
|
|
1718
|
-
}, [leftShow, maxScrollLeft, onScrollStateChange, rightShow, scrollLeft]);
|
|
1719
|
-
const handleScroll = useCallback(() => {
|
|
1720
|
-
if (ref.current === null) {
|
|
1721
|
-
return;
|
|
1722
|
-
} // 手動でスクロールが開始されたときにアニメーションを中断
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
if (animation.current) {
|
|
1726
|
-
styles.scroll.stop();
|
|
1727
|
-
animation.current = false;
|
|
1728
|
-
} // スクロール位置を保存 (アニメーションの基準になる)
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
const manualScrollLeft = ref.current.scrollLeft; // 過剰にsetStateが走らないようにDebouceする
|
|
1732
|
-
|
|
1733
|
-
setScrollLeft(manualScrollLeft);
|
|
1734
|
-
}, [animation, setScrollLeft, styles]); // リサイズが起きたときに、アニメーション用のスクロール領域 & ボタンの表示状態 を再計算する
|
|
1735
|
-
|
|
1736
|
-
const handleResize = useCallback(() => {
|
|
1737
|
-
if (ref.current === null) {
|
|
1738
|
-
return;
|
|
1739
|
-
}
|
|
1740
|
-
|
|
1741
|
-
const {
|
|
1742
|
-
clientWidth,
|
|
1743
|
-
scrollWidth
|
|
1744
|
-
} = ref.current;
|
|
1745
|
-
const newMaxScrollLeft = scrollWidth - clientWidth;
|
|
1746
|
-
setMaxScrollLeft(newMaxScrollLeft);
|
|
1747
|
-
|
|
1748
|
-
if (onResize) {
|
|
1749
|
-
onResize(clientWidth);
|
|
1750
|
-
}
|
|
1751
|
-
}, [onResize]);
|
|
1752
|
-
useLayoutEffect(() => {
|
|
1753
|
-
const elm = ref.current;
|
|
1754
|
-
const innerElm = innerRef.current;
|
|
1755
|
-
|
|
1756
|
-
if (elm === null || innerElm === null) {
|
|
1757
|
-
return;
|
|
1758
|
-
}
|
|
1759
|
-
|
|
1760
|
-
elm.addEventListener('wheel', handleScroll, passiveEvents() && {
|
|
1761
|
-
passive: true
|
|
1762
|
-
});
|
|
1763
|
-
const resizeObserver = new ResizeObserver(handleResize);
|
|
1764
|
-
resizeObserver.observe(elm);
|
|
1765
|
-
const resizeObserverInner = new ResizeObserver(handleResize);
|
|
1766
|
-
resizeObserverInner.observe(innerElm);
|
|
1767
|
-
return () => {
|
|
1768
|
-
elm.removeEventListener('wheel', handleScroll);
|
|
1769
|
-
resizeObserver.disconnect();
|
|
1770
|
-
resizeObserverInner.disconnect();
|
|
1771
|
-
};
|
|
1772
|
-
}, [handleResize, handleScroll]); // 初期スクロールを行う
|
|
1773
|
-
|
|
1774
|
-
useLayoutEffect(() => {
|
|
1775
|
-
if (align !== 'left' || scrollOffset !== 0) {
|
|
1776
|
-
const scroll = ref.current;
|
|
1777
|
-
|
|
1778
|
-
if (scroll !== null) {
|
|
1779
|
-
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));
|
|
1780
|
-
scroll.scrollLeft = scrollLength;
|
|
1781
|
-
setScrollLeft(scrollLength, true);
|
|
1782
|
-
}
|
|
1783
|
-
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1784
|
-
|
|
1785
|
-
}, [ref.current]);
|
|
1786
|
-
const handleScrollMove = useCallback(() => {
|
|
1787
|
-
if (ref.current === null) {
|
|
1788
|
-
return;
|
|
1789
|
-
}
|
|
1790
|
-
|
|
1791
|
-
if (onScroll) {
|
|
1792
|
-
onScroll(ref.current.scrollLeft);
|
|
1793
|
-
}
|
|
1794
|
-
}, [onScroll]);
|
|
1795
|
-
const [disableGradient, setDisableGradient] = useState(false);
|
|
1796
|
-
useLayoutEffect(() => {
|
|
1797
|
-
if (isEdge()) {
|
|
1798
|
-
setDisableGradient(true);
|
|
1799
|
-
}
|
|
1800
|
-
}, []); // NOTE: Edgeではmaskを使うと要素のレンダリングがバグる(場合によっては画像が表示されない)のでグラデーションを無効にする
|
|
1801
|
-
|
|
1802
|
-
if (!disableGradient && options.hasGradient === true) {
|
|
1803
|
-
var _options$fadeInGradie;
|
|
1804
|
-
|
|
1805
|
-
const fadeInGradient = (_options$fadeInGradie = options.fadeInGradient) != null ? _options$fadeInGradie : false;
|
|
1806
|
-
const overflowGradient = !fadeInGradient;
|
|
1807
|
-
return /*#__PURE__*/React.createElement(Container, {
|
|
1808
|
-
ref: visibleAreaRef
|
|
1809
|
-
}, /*#__PURE__*/React.createElement(GradientContainer, {
|
|
1810
|
-
fadeInGradient: fadeInGradient
|
|
1811
|
-
}, /*#__PURE__*/React.createElement(RightGradient, null, /*#__PURE__*/React.createElement(LeftGradient, {
|
|
1812
|
-
show: overflowGradient || scrollLeft > 0
|
|
1813
|
-
}, /*#__PURE__*/React.createElement(ScrollArea, {
|
|
1814
|
-
ref: ref,
|
|
1815
|
-
scrollLeft: styles.scroll,
|
|
1816
|
-
onScroll: handleScrollMove
|
|
1817
|
-
}, /*#__PURE__*/React.createElement(CarouselContainer, {
|
|
1818
|
-
ref: innerRef,
|
|
1819
|
-
centerItems: centerItems
|
|
1820
|
-
}, children))))), /*#__PURE__*/React.createElement(ButtonsContainer, null, /*#__PURE__*/React.createElement(CarouselButton, {
|
|
1821
|
-
direction: Direction.Left,
|
|
1822
|
-
show: leftShow,
|
|
1823
|
-
offset: buttonOffset,
|
|
1824
|
-
bottomOffset: bottomOffset,
|
|
1825
|
-
padding: buttonPadding,
|
|
1826
|
-
gradient: overflowGradient,
|
|
1827
|
-
onClick: handleLeft
|
|
1828
|
-
}), /*#__PURE__*/React.createElement(CarouselButton, {
|
|
1829
|
-
direction: Direction.Right,
|
|
1830
|
-
show: rightShow,
|
|
1831
|
-
offset: buttonOffset,
|
|
1832
|
-
bottomOffset: bottomOffset,
|
|
1833
|
-
padding: buttonPadding,
|
|
1834
|
-
gradient: true,
|
|
1835
|
-
onClick: handleRight
|
|
1836
|
-
})));
|
|
1837
|
-
}
|
|
1838
|
-
|
|
1839
|
-
return /*#__PURE__*/React.createElement(Container, {
|
|
1840
|
-
ref: visibleAreaRef
|
|
1841
|
-
}, /*#__PURE__*/React.createElement(ScrollArea // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1842
|
-
// @ts-expect-error
|
|
1843
|
-
, {
|
|
1844
|
-
ref: ref,
|
|
1845
|
-
scrollLeft: styles.scroll,
|
|
1846
|
-
onScroll: handleScrollMove
|
|
1847
|
-
}, /*#__PURE__*/React.createElement(CarouselContainer, {
|
|
1848
|
-
ref: innerRef,
|
|
1849
|
-
centerItems: centerItems
|
|
1850
|
-
}, children)), /*#__PURE__*/React.createElement(ButtonsContainer, null, /*#__PURE__*/React.createElement(CarouselButton, {
|
|
1851
|
-
direction: Direction.Left,
|
|
1852
|
-
show: leftShow,
|
|
1853
|
-
offset: buttonOffset,
|
|
1854
|
-
bottomOffset: bottomOffset,
|
|
1855
|
-
padding: buttonPadding,
|
|
1856
|
-
onClick: handleLeft
|
|
1857
|
-
}), /*#__PURE__*/React.createElement(CarouselButton, {
|
|
1858
|
-
direction: Direction.Right,
|
|
1859
|
-
show: rightShow,
|
|
1860
|
-
offset: buttonOffset,
|
|
1861
|
-
bottomOffset: bottomOffset,
|
|
1862
|
-
padding: buttonPadding,
|
|
1863
|
-
onClick: handleRight
|
|
1864
|
-
})));
|
|
1865
|
-
}
|
|
1866
|
-
const CarouselContainer = styled.ul(_t$3 || (_t$3 = _$2`
|
|
1867
|
-
vertical-align: top;
|
|
1868
|
-
overflow: hidden;
|
|
1869
|
-
list-style: none;
|
|
1870
|
-
padding: 0;
|
|
1871
|
-
|
|
1872
|
-
/* 最小幅を100%にして親要素にぴったりくっつけることで子要素で要素を均等に割り付けるなどを出来るようにしてある */
|
|
1873
|
-
min-width: 100%;
|
|
1874
|
-
box-sizing: border-box;
|
|
1875
|
-
|
|
1876
|
-
${0}
|
|
1877
|
-
`), ({
|
|
1878
|
-
centerItems: _centerItems = false
|
|
1879
|
-
}) => _centerItems ? css(_t2$1 || (_t2$1 = _$2`
|
|
1880
|
-
display: flex;
|
|
1881
|
-
width: max-content;
|
|
1882
|
-
margin: 0 auto;
|
|
1883
|
-
`)) : css(_t3$1 || (_t3$1 = _$2`
|
|
1884
|
-
display: inline-flex;
|
|
1885
|
-
margin: 0;
|
|
1886
|
-
`)));
|
|
1887
|
-
const ButtonsContainer = styled.div(_t4$1 || (_t4$1 = _$2`
|
|
1888
|
-
opacity: 0;
|
|
1889
|
-
transition: 0.4s opacity;
|
|
1890
|
-
`));
|
|
1891
|
-
const Container = styled.div(_t5 || (_t5 = _$2`
|
|
1892
|
-
&:hover ${0} {
|
|
1893
|
-
opacity: 1;
|
|
1894
|
-
}
|
|
1895
|
-
|
|
1896
|
-
/* CarouselButtonの中にz-index:1があるのでここでコンテキストを切る */
|
|
1897
|
-
position: relative;
|
|
1898
|
-
z-index: 0;
|
|
1899
|
-
`), ButtonsContainer);
|
|
1900
|
-
const ScrollArea = styled(animated.div)(_t6 || (_t6 = _$2`
|
|
1901
|
-
overflow-x: auto;
|
|
1902
|
-
padding: 0;
|
|
1903
|
-
margin: 0;
|
|
1904
|
-
|
|
1905
|
-
&::-webkit-scrollbar {
|
|
1906
|
-
display: none;
|
|
1907
|
-
}
|
|
1908
|
-
|
|
1909
|
-
scrollbar-width: none;
|
|
1910
|
-
`));
|
|
1911
|
-
const GradientContainer = styled.div(_t7 || (_t7 = _$2`
|
|
1912
|
-
/* NOTE: LeftGradientがはみ出るためhidden */
|
|
1913
|
-
overflow: hidden;
|
|
1914
|
-
${0}
|
|
1915
|
-
|
|
1916
|
-
margin-right: ${0}px;
|
|
1917
|
-
/* stylelint-disable-next-line no-duplicate-selectors */
|
|
1918
|
-
${0} {
|
|
1919
|
-
padding-right: ${0}px;
|
|
1920
|
-
}
|
|
1921
|
-
`), p => !p.fadeInGradient && css(_t8 || (_t8 = _$2`
|
|
1922
|
-
margin-left: ${0}px;
|
|
1923
|
-
${0} {
|
|
1924
|
-
padding-left: ${0}px;
|
|
1925
|
-
}
|
|
1926
|
-
`), -GRADIENT_WIDTH, CarouselContainer, GRADIENT_WIDTH), -GRADIENT_WIDTH, CarouselContainer, GRADIENT_WIDTH);
|
|
1927
|
-
const RightGradient = styled.div(_t9 || (_t9 = _$2`
|
|
1928
|
-
mask-image: linear-gradient(
|
|
1929
|
-
to right,
|
|
1930
|
-
#000 calc(100% - ${0}px),
|
|
1931
|
-
transparent
|
|
1932
|
-
);
|
|
1933
|
-
`), GRADIENT_WIDTH);
|
|
1934
|
-
const LeftGradient = styled.div(_t10 || (_t10 = _$2`
|
|
1935
|
-
/* NOTE: mask-position が left → negative px の時、right → abs(negative px) の位置に表示されるため */
|
|
1936
|
-
margin-right: ${0}px;
|
|
1937
|
-
padding-right: ${0}px;
|
|
1938
|
-
/* NOTE: mask-position に transition をつけたいが vender prefixes 対策で all につける */
|
|
1939
|
-
transition: 0.2s all ease-in;
|
|
1940
|
-
mask: linear-gradient(to right, transparent, #000 ${0}px)
|
|
1941
|
-
${0}px 0;
|
|
1942
|
-
`), -GRADIENT_WIDTH, GRADIENT_WIDTH, GRADIENT_WIDTH, p => p.show ? 0 : -GRADIENT_WIDTH);
|
|
1943
|
-
|
|
1944
|
-
let _$1 = t => t,
|
|
1945
|
-
_t$2;
|
|
1946
|
-
|
|
1947
|
-
function DotsIcon({
|
|
1948
|
-
size
|
|
1949
|
-
}) {
|
|
1950
|
-
return /*#__PURE__*/React.createElement(StyledSVG, {
|
|
1951
|
-
viewBox: "0 0 20 6",
|
|
1952
|
-
width: size,
|
|
1953
|
-
height: size
|
|
1954
|
-
}, /*#__PURE__*/React.createElement("path", {
|
|
1955
|
-
fillRule: "evenodd",
|
|
1956
|
-
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
|
|
1957
|
-
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
|
|
1958
|
-
C10.6192881,14.5 9.5,13.3807119 9.5,12 C9.5,10.6192881 10.6192881,9.5 12,9.5
|
|
1959
|
-
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
|
|
1960
|
-
C17.6192881,14.5 16.5,13.3807119 16.5,12 C16.5,10.6192881 17.6192881,9.5 19,9.5
|
|
1961
|
-
C20.3807119,9.5 21.5,10.6192881 21.5,12 C21.5,13.3807119 20.3807119,14.5 19,14.5 Z`,
|
|
1962
|
-
transform: "translate(-2 -9)"
|
|
1963
|
-
}));
|
|
1964
|
-
}
|
|
1965
|
-
|
|
1966
|
-
DotsIcon.defaultProps = {
|
|
1967
|
-
size: 16
|
|
1968
|
-
};
|
|
1969
|
-
const StyledSVG = styled.svg(_t$2 || (_t$2 = _$1`
|
|
1970
|
-
fill: currentColor;
|
|
1971
|
-
`));
|
|
1972
|
-
|
|
1973
|
-
let _ = t => t,
|
|
1974
|
-
_t$1;
|
|
1975
|
-
var WedgeDirection;
|
|
1976
|
-
|
|
1977
|
-
(function (WedgeDirection) {
|
|
1978
|
-
WedgeDirection["Up"] = "up";
|
|
1979
|
-
WedgeDirection["Down"] = "down";
|
|
1980
|
-
WedgeDirection["Left"] = "left";
|
|
1981
|
-
WedgeDirection["Right"] = "right";
|
|
1982
|
-
})(WedgeDirection || (WedgeDirection = {}));
|
|
1983
|
-
|
|
1984
|
-
function WedgeIcon({
|
|
1985
|
-
size,
|
|
1986
|
-
direction
|
|
1987
|
-
}) {
|
|
1988
|
-
return (
|
|
1989
|
-
/*#__PURE__*/
|
|
1990
|
-
// NOTE: directionToTransform depends on the value of viewBox
|
|
1991
|
-
React.createElement("svg", {
|
|
1992
|
-
viewBox: "0 0 10 8",
|
|
1993
|
-
width: size,
|
|
1994
|
-
height: size
|
|
1995
|
-
}, /*#__PURE__*/React.createElement(StyledPolyline, {
|
|
1996
|
-
strokeWidth: "2",
|
|
1997
|
-
points: "1,2 5,6 9,2",
|
|
1998
|
-
transform: directionToTransform(direction)
|
|
1999
|
-
}))
|
|
2000
|
-
);
|
|
2001
|
-
}
|
|
2002
|
-
WedgeIcon.defaultProps = {
|
|
2003
|
-
size: 16,
|
|
2004
|
-
white: false,
|
|
2005
|
-
lightGray: false
|
|
2006
|
-
};
|
|
2007
|
-
|
|
2008
|
-
function directionToTransform(direction) {
|
|
2009
|
-
// "5 4" is the center point of the "0 0 10 8" viewBox
|
|
2010
|
-
switch (direction) {
|
|
2011
|
-
case WedgeDirection.Up:
|
|
2012
|
-
return 'rotate(180 5 4)';
|
|
2013
|
-
|
|
2014
|
-
case WedgeDirection.Down:
|
|
2015
|
-
return undefined;
|
|
2016
|
-
|
|
2017
|
-
case WedgeDirection.Left:
|
|
2018
|
-
return 'rotate(90 5 4)';
|
|
2019
|
-
|
|
2020
|
-
case WedgeDirection.Right:
|
|
2021
|
-
return 'rotate(-90 5 4)';
|
|
2022
|
-
|
|
2023
|
-
default:
|
|
2024
|
-
return unreachable(direction);
|
|
2025
|
-
}
|
|
2026
|
-
}
|
|
2027
|
-
|
|
2028
|
-
const StyledPolyline = styled.polyline(_t$1 || (_t$1 = _`
|
|
2029
|
-
fill: none;
|
|
2030
|
-
stroke-linejoin: round;
|
|
2031
|
-
stroke-linecap: round;
|
|
2032
|
-
stroke: currentColor;
|
|
2033
|
-
`));
|
|
2034
|
-
|
|
2035
|
-
let _2 = t => t,
|
|
2036
|
-
_t,
|
|
2037
|
-
_t2,
|
|
2038
|
-
_t3,
|
|
2039
|
-
_t4;
|
|
2040
|
-
|
|
2041
|
-
function usePagerWindow(page, pageCount, windowSize = 7) {
|
|
2042
|
-
// ページャーのリンク生成例:
|
|
2043
|
-
//
|
|
2044
|
-
// < [ 1 ] [*2*] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] >
|
|
2045
|
-
//
|
|
2046
|
-
// < [ 1 ] [ 2 ] [ 3 ] [*4*] [ 5 ] [ 6 ] [ 7 ] >
|
|
2047
|
-
//
|
|
2048
|
-
// < [ 1 ] ... [ 4 ] [*5*] [ 6 ] [ 7 ] [ 8 ] >
|
|
2049
|
-
//
|
|
2050
|
-
// < [ 1 ] ... [ 99 ] [*100*] [ 101 ] [ 102 ] [ 103 ] >
|
|
2051
|
-
//
|
|
2052
|
-
// < [ 1 ] ... [ 99 ] [ 100 ] [ 101 ] [ 102 ] [*103*]
|
|
2053
|
-
//
|
|
2054
|
-
// [*1*] [ 2 ] >
|
|
2055
|
-
//
|
|
2056
|
-
// デザインの意図: 前後移動時のカーソル移動を最小限にする。
|
|
2057
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2058
|
-
warning((page | 0) === page, `\`page\` must be interger (${page})`);
|
|
2059
|
-
warning((pageCount | 0) === pageCount, `\`pageCount\` must be interger (${pageCount})`);
|
|
2060
|
-
}
|
|
2061
|
-
|
|
2062
|
-
const window = useMemo(() => {
|
|
2063
|
-
const visibleFirstPage = 1;
|
|
2064
|
-
const visibleLastPage = Math.min(pageCount, Math.max(page + Math.floor(windowSize / 2), windowSize));
|
|
2065
|
-
|
|
2066
|
-
if (visibleLastPage <= windowSize) {
|
|
2067
|
-
// 表示範囲が1-7ページなら省略は無い。
|
|
2068
|
-
return Array.from({
|
|
2069
|
-
length: 1 + visibleLastPage - visibleFirstPage
|
|
2070
|
-
}, (_, i) => visibleFirstPage + i);
|
|
2071
|
-
} else {
|
|
2072
|
-
const start = visibleLastPage - (windowSize - 1) + 2;
|
|
2073
|
-
return [// 表示範囲が1-7ページを超えるなら、
|
|
2074
|
-
// - 1ページ目は固定で表示する
|
|
2075
|
-
visibleFirstPage, // - 2ページ目から現在のページの直前までは省略する
|
|
2076
|
-
'...', ...Array.from({
|
|
2077
|
-
length: 1 + visibleLastPage - start
|
|
2078
|
-
}, (_, i) => start + i)];
|
|
2079
|
-
}
|
|
2080
|
-
}, [page, pageCount, windowSize]);
|
|
2081
|
-
useDebugValue(window);
|
|
2082
|
-
return window;
|
|
2083
|
-
} // this pager is just regular buttons; for links use LinkPager
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
var index = React.memo(function Pager({
|
|
2087
|
-
page,
|
|
2088
|
-
pageCount,
|
|
2089
|
-
onChange
|
|
2090
|
-
}) {
|
|
2091
|
-
// TODO: refactor Pager and LinkPager to use a common parent component
|
|
2092
|
-
const window = usePagerWindow(page, pageCount);
|
|
2093
|
-
const makeClickHandler = useCallback(value => () => {
|
|
2094
|
-
onChange(value);
|
|
2095
|
-
}, [onChange]);
|
|
2096
|
-
const hasNext = page < pageCount;
|
|
2097
|
-
const hasPrev = page > 1;
|
|
2098
|
-
return /*#__PURE__*/React.createElement(PagerContainer, null, /*#__PURE__*/React.createElement(CircleButton, {
|
|
2099
|
-
type: "button",
|
|
2100
|
-
hidden: !hasPrev,
|
|
2101
|
-
disabled: !hasPrev,
|
|
2102
|
-
onClick: makeClickHandler(Math.max(1, page - 1)),
|
|
2103
|
-
noBackground: true
|
|
2104
|
-
}, /*#__PURE__*/React.createElement(WedgeIcon, {
|
|
2105
|
-
size: 16,
|
|
2106
|
-
direction: WedgeDirection.Left
|
|
2107
|
-
})), window.map(p => p === '...' ? /*#__PURE__*/React.createElement(Spacer, {
|
|
2108
|
-
key: p
|
|
2109
|
-
}, /*#__PURE__*/React.createElement(DotsIcon, {
|
|
2110
|
-
size: 20
|
|
2111
|
-
})) : p === page ?
|
|
2112
|
-
/*#__PURE__*/
|
|
2113
|
-
// we remove the onClick but don't mark it as disabled to preserve keyboard focus
|
|
2114
|
-
// not doing so causes the focus ring to flicker in and out of existence
|
|
2115
|
-
React.createElement(CircleButton, {
|
|
2116
|
-
key: p,
|
|
2117
|
-
type: "button",
|
|
2118
|
-
"aria-current": true
|
|
2119
|
-
}, /*#__PURE__*/React.createElement(Text, null, p)) : /*#__PURE__*/React.createElement(CircleButton, {
|
|
2120
|
-
key: p,
|
|
2121
|
-
type: "button",
|
|
2122
|
-
onClick: makeClickHandler(p)
|
|
2123
|
-
}, /*#__PURE__*/React.createElement(Text, null, p))), /*#__PURE__*/React.createElement(CircleButton, {
|
|
2124
|
-
type: "button",
|
|
2125
|
-
hidden: !hasNext,
|
|
2126
|
-
disabled: !hasNext,
|
|
2127
|
-
onClick: makeClickHandler(Math.min(pageCount, page + 1)),
|
|
2128
|
-
noBackground: true
|
|
2129
|
-
}, /*#__PURE__*/React.createElement(WedgeIcon, {
|
|
2130
|
-
size: 16,
|
|
2131
|
-
direction: WedgeDirection.Right
|
|
2132
|
-
})));
|
|
2133
|
-
});
|
|
2134
|
-
function LinkPager({
|
|
2135
|
-
page,
|
|
2136
|
-
pageCount,
|
|
2137
|
-
makeUrl
|
|
2138
|
-
}) {
|
|
2139
|
-
const {
|
|
2140
|
-
Link
|
|
2141
|
-
} = useComponentAbstraction();
|
|
2142
|
-
const window = usePagerWindow(page, pageCount);
|
|
2143
|
-
const hasNext = page < pageCount;
|
|
2144
|
-
const hasPrev = page > 1;
|
|
2145
|
-
return /*#__PURE__*/React.createElement(PagerContainer, null, /*#__PURE__*/React.createElement(Link, {
|
|
2146
|
-
to: makeUrl(Math.max(1, page - 1))
|
|
2147
|
-
}, /*#__PURE__*/React.createElement(CircleButton, {
|
|
2148
|
-
hidden: !hasPrev,
|
|
2149
|
-
"aria-disabled": !hasPrev,
|
|
2150
|
-
noBackground: true
|
|
2151
|
-
}, /*#__PURE__*/React.createElement(WedgeIcon, {
|
|
2152
|
-
size: 16,
|
|
2153
|
-
direction: WedgeDirection.Left
|
|
2154
|
-
}))), window.map(p => p === '...' ? /*#__PURE__*/React.createElement(Spacer, {
|
|
2155
|
-
key: p
|
|
2156
|
-
}, /*#__PURE__*/React.createElement(DotsIcon, {
|
|
2157
|
-
size: 20,
|
|
2158
|
-
subLink: true
|
|
2159
|
-
})) : p === page ? /*#__PURE__*/React.createElement(CircleButton, {
|
|
2160
|
-
key: p,
|
|
2161
|
-
type: "button",
|
|
2162
|
-
"aria-current": true
|
|
2163
|
-
}, /*#__PURE__*/React.createElement(Text, null, p)) : /*#__PURE__*/React.createElement(Link, {
|
|
2164
|
-
key: p,
|
|
2165
|
-
to: makeUrl(p)
|
|
2166
|
-
}, /*#__PURE__*/React.createElement(CircleButton, {
|
|
2167
|
-
type: "button"
|
|
2168
|
-
}, /*#__PURE__*/React.createElement(Text, null, p)))), /*#__PURE__*/React.createElement(Link, {
|
|
2169
|
-
to: makeUrl(Math.min(pageCount, page + 1))
|
|
2170
|
-
}, /*#__PURE__*/React.createElement(CircleButton, {
|
|
2171
|
-
hidden: !hasNext,
|
|
2172
|
-
"aria-disabled": !hasNext,
|
|
2173
|
-
noBackground: true
|
|
2174
|
-
}, /*#__PURE__*/React.createElement(WedgeIcon, {
|
|
2175
|
-
size: 16,
|
|
2176
|
-
direction: WedgeDirection.Right
|
|
2177
|
-
}))));
|
|
2178
|
-
}
|
|
2179
|
-
const PagerContainer = styled.nav(_t || (_t = _2`
|
|
2180
|
-
display: flex;
|
|
2181
|
-
justify-content: center;
|
|
2182
|
-
align-items: center;
|
|
2183
|
-
`));
|
|
2184
|
-
const CircleButton = styled.button(_t2 || (_t2 = _2`
|
|
2185
|
-
font-size: 1rem;
|
|
2186
|
-
line-height: calc(1em + 8px);
|
|
2187
|
-
text-decoration: none;
|
|
2188
|
-
border: none;
|
|
2189
|
-
outline: none;
|
|
2190
|
-
touch-action: manipulation;
|
|
2191
|
-
user-select: none;
|
|
2192
|
-
transition: box-shadow 0.2s ease 0s, color 0.2s ease 0s,
|
|
2193
|
-
background 0.2s ease 0s, opacity 0.2s ease 0s;
|
|
2194
|
-
|
|
2195
|
-
display: flex;
|
|
2196
|
-
justify-content: center;
|
|
2197
|
-
align-items: center;
|
|
2198
|
-
box-sizing: content-box;
|
|
2199
|
-
min-width: 24px;
|
|
2200
|
-
min-height: 24px;
|
|
2201
|
-
padding: 8px;
|
|
2202
|
-
cursor: pointer;
|
|
2203
|
-
font-weight: bold;
|
|
2204
|
-
/* HACK:
|
|
2205
|
-
* Safari doesn't correctly repaint the elements when they're reordered in response to interaction.
|
|
2206
|
-
* This forces it to repaint them. This doesn't work if put on the parents either, has to be here.
|
|
2207
|
-
*/
|
|
2208
|
-
/* stylelint-disable-next-line property-no-vendor-prefix */
|
|
2209
|
-
-webkit-transform: translateZ(0);
|
|
2210
|
-
|
|
2211
|
-
&[hidden] {
|
|
2212
|
-
visibility: hidden;
|
|
2213
|
-
display: block;
|
|
2214
|
-
}
|
|
2215
|
-
|
|
2216
|
-
border-radius: 48px;
|
|
2217
|
-
|
|
2218
|
-
background: transparent;
|
|
2219
|
-
color: ${0};
|
|
2220
|
-
|
|
2221
|
-
&:hover {
|
|
2222
|
-
background: ${0};
|
|
2223
|
-
color: ${0};
|
|
2224
|
-
}
|
|
2225
|
-
|
|
2226
|
-
&[aria-current] {
|
|
2227
|
-
background-color: ${0};
|
|
2228
|
-
color: ${0};
|
|
2229
|
-
}
|
|
2230
|
-
|
|
2231
|
-
&[aria-current]:hover {
|
|
2232
|
-
background-color: ${0};
|
|
2233
|
-
color: ${0};
|
|
2234
|
-
}
|
|
2235
|
-
|
|
2236
|
-
${0}
|
|
2237
|
-
`), ({
|
|
2238
|
-
theme
|
|
2239
|
-
}) => theme.color.text3, ({
|
|
2240
|
-
theme
|
|
2241
|
-
}) => theme.color.surface3, ({
|
|
2242
|
-
theme
|
|
2243
|
-
}) => theme.color.text2, ({
|
|
2244
|
-
theme
|
|
2245
|
-
}) => theme.color.surface6, ({
|
|
2246
|
-
theme
|
|
2247
|
-
}) => theme.color.text5, ({
|
|
2248
|
-
theme
|
|
2249
|
-
}) => theme.color.surface6, ({
|
|
2250
|
-
theme
|
|
2251
|
-
}) => theme.color.text5, ({
|
|
2252
|
-
noBackground: _noBackground = false
|
|
2253
|
-
}) => _noBackground && css(_t3 || (_t3 = _2`
|
|
2254
|
-
/* stylelint-disable-next-line no-duplicate-selectors */
|
|
2255
|
-
&:hover {
|
|
2256
|
-
background: transparent;
|
|
2257
|
-
}
|
|
2258
|
-
`)));
|
|
2259
|
-
const Spacer = styled(CircleButton).attrs({
|
|
2260
|
-
type: 'button',
|
|
2261
|
-
disabled: true
|
|
2262
|
-
})(_t4 || (_t4 = _2`
|
|
2263
|
-
&& {
|
|
2264
|
-
color: ${0};
|
|
2265
|
-
background: none;
|
|
2266
|
-
}
|
|
2267
|
-
`), ({
|
|
2268
|
-
theme
|
|
2269
|
-
}) => theme.color.text3);
|
|
2270
|
-
const Text = 'span';
|
|
2271
|
-
|
|
2272
|
-
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 };
|
|
2273
|
-
//# sourceMappingURL=index.modern.js.map
|