@charcoal-ui/react-sandbox 2.5.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +2 -2
- 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 -94
- package/package.json +18 -18
- package/dist/index.cjs +0 -1816
- package/dist/index.cjs.map +0 -1
- package/dist/index.modern.js +0 -2275
- package/dist/index.modern.js.map +0 -1
- package/dist/index.module.js +0 -1768
- package/dist/index.module.js.map +0 -1
|
@@ -0,0 +1,1816 @@
|
|
|
1
|
+
// src/components/Filter/index.tsx
|
|
2
|
+
import React from "react";
|
|
3
|
+
import styled, { css } from "styled-components";
|
|
4
|
+
import { useComponentAbstraction } from "@charcoal-ui/react";
|
|
5
|
+
import { maxWidth } from "@charcoal-ui/utils";
|
|
6
|
+
var FilterButton = React.forwardRef(function FilterButton2({
|
|
7
|
+
onClick,
|
|
8
|
+
children,
|
|
9
|
+
active = false,
|
|
10
|
+
hover,
|
|
11
|
+
reactive = false
|
|
12
|
+
}, ref) {
|
|
13
|
+
return /* @__PURE__ */ React.createElement(
|
|
14
|
+
ButtonLike,
|
|
15
|
+
{
|
|
16
|
+
active,
|
|
17
|
+
reactive,
|
|
18
|
+
hover,
|
|
19
|
+
onClick: active && !reactive ? void 0 : onClick,
|
|
20
|
+
ref
|
|
21
|
+
},
|
|
22
|
+
children
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
var FilterIconButton = React.forwardRef(function FilterIconButton2({
|
|
26
|
+
onClick,
|
|
27
|
+
children,
|
|
28
|
+
active = false,
|
|
29
|
+
hover,
|
|
30
|
+
reactive = false,
|
|
31
|
+
width,
|
|
32
|
+
height
|
|
33
|
+
}, ref) {
|
|
34
|
+
return /* @__PURE__ */ React.createElement(
|
|
35
|
+
StyledButtonLike,
|
|
36
|
+
{
|
|
37
|
+
active,
|
|
38
|
+
reactive,
|
|
39
|
+
hover,
|
|
40
|
+
onClick: active && !reactive ? void 0 : onClick,
|
|
41
|
+
ref,
|
|
42
|
+
buttonWidth: width,
|
|
43
|
+
buttonHeight: height
|
|
44
|
+
},
|
|
45
|
+
children
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
var FilterLink = React.forwardRef(function FilterLink2({
|
|
49
|
+
onClick,
|
|
50
|
+
children,
|
|
51
|
+
active = false,
|
|
52
|
+
hover,
|
|
53
|
+
reactive = false,
|
|
54
|
+
...props
|
|
55
|
+
}, ref) {
|
|
56
|
+
const { Link } = useComponentAbstraction();
|
|
57
|
+
if (active && !reactive) {
|
|
58
|
+
return /* @__PURE__ */ React.createElement(PlainElement, { active: true, hover, ref }, children);
|
|
59
|
+
} else {
|
|
60
|
+
return /* @__PURE__ */ React.createElement(Link, { ...props, onClick }, /* @__PURE__ */ React.createElement(
|
|
61
|
+
PlainElement,
|
|
62
|
+
{
|
|
63
|
+
active,
|
|
64
|
+
reactive,
|
|
65
|
+
hover,
|
|
66
|
+
ref
|
|
67
|
+
},
|
|
68
|
+
children
|
|
69
|
+
));
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
var buttonCss = css`
|
|
73
|
+
display: block;
|
|
74
|
+
outline: none;
|
|
75
|
+
border: none;
|
|
76
|
+
padding: 9px 24px;
|
|
77
|
+
font-size: 14px;
|
|
78
|
+
line-height: 22px;
|
|
79
|
+
font-weight: bold;
|
|
80
|
+
border-radius: /* absurd radius, but ensures rounded corners */ 2000px;
|
|
81
|
+
transition: color 0.2s;
|
|
82
|
+
color: ${({ theme: theme2 }) => theme2.color.text3};
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
user-select: none;
|
|
85
|
+
background-color: transparent;
|
|
86
|
+
|
|
87
|
+
&:hover {
|
|
88
|
+
color: ${({ theme: theme2 }) => theme2.color.text2};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
${({ hover = false }) => hover && css`
|
|
92
|
+
color: ${({ theme: theme2 }) => theme2.color.text2};
|
|
93
|
+
`}
|
|
94
|
+
|
|
95
|
+
${({ active = false }) => active && css`
|
|
96
|
+
background-color: ${({ theme: theme2 }) => theme2.color.surface3};
|
|
97
|
+
color: ${({ theme: theme2 }) => theme2.color.text2};
|
|
98
|
+
`}
|
|
99
|
+
|
|
100
|
+
${({ active = false, reactive = false }) => active && !reactive && css`
|
|
101
|
+
cursor: default;
|
|
102
|
+
`}
|
|
103
|
+
|
|
104
|
+
@media ${({ theme: theme2 }) => maxWidth(theme2.breakpoint.screen1)} {
|
|
105
|
+
padding: 5px 16px;
|
|
106
|
+
}
|
|
107
|
+
`;
|
|
108
|
+
var padding0Css = css`
|
|
109
|
+
padding: 0;
|
|
110
|
+
|
|
111
|
+
@media ${({ theme: theme2 }) => maxWidth(theme2.breakpoint.screen1)} {
|
|
112
|
+
padding: 0;
|
|
113
|
+
}
|
|
114
|
+
`;
|
|
115
|
+
var ButtonLike = styled.button`
|
|
116
|
+
${buttonCss}
|
|
117
|
+
`;
|
|
118
|
+
var PlainElement = styled.span`
|
|
119
|
+
${buttonCss}
|
|
120
|
+
`;
|
|
121
|
+
var StyledButtonLike = styled(ButtonLike)`
|
|
122
|
+
${padding0Css};
|
|
123
|
+
${(p) => p.buttonWidth !== void 0 && `width: ${p.buttonWidth}px;`}
|
|
124
|
+
${(p) => p.buttonHeight !== void 0 && `height: ${p.buttonHeight}px;`}
|
|
125
|
+
`;
|
|
126
|
+
var Filter = styled.div`
|
|
127
|
+
display: flex;
|
|
128
|
+
`;
|
|
129
|
+
var Filter_default = Filter;
|
|
130
|
+
|
|
131
|
+
// src/components/HintText/index.tsx
|
|
132
|
+
import React4 from "react";
|
|
133
|
+
import styled5, { css as css2 } from "styled-components";
|
|
134
|
+
|
|
135
|
+
// src/styled.ts
|
|
136
|
+
import styled2 from "styled-components";
|
|
137
|
+
import { createTheme } from "@charcoal-ui/styled";
|
|
138
|
+
var theme = createTheme(styled2);
|
|
139
|
+
|
|
140
|
+
// src/components/icons/InfoIcon.tsx
|
|
141
|
+
import React3 from "react";
|
|
142
|
+
import styled4 from "styled-components";
|
|
143
|
+
|
|
144
|
+
// src/components/icons/Base.tsx
|
|
145
|
+
import React2 from "react";
|
|
146
|
+
import styled3 from "styled-components";
|
|
147
|
+
function IconBase({
|
|
148
|
+
size: size3 = 24,
|
|
149
|
+
viewBoxSize,
|
|
150
|
+
currentColor,
|
|
151
|
+
path: path2,
|
|
152
|
+
transform,
|
|
153
|
+
fillRule,
|
|
154
|
+
clipRule
|
|
155
|
+
}) {
|
|
156
|
+
return /* @__PURE__ */ React2.createElement(
|
|
157
|
+
Icon,
|
|
158
|
+
{
|
|
159
|
+
viewBox: `0 0 ${viewBoxSize} ${viewBoxSize}`,
|
|
160
|
+
size: size3,
|
|
161
|
+
currentColor
|
|
162
|
+
},
|
|
163
|
+
/* @__PURE__ */ React2.createElement(
|
|
164
|
+
IconBasePath,
|
|
165
|
+
{
|
|
166
|
+
path: path2,
|
|
167
|
+
transform,
|
|
168
|
+
fillRule,
|
|
169
|
+
clipRule
|
|
170
|
+
}
|
|
171
|
+
)
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
var Icon = styled3.svg`
|
|
175
|
+
stroke: none;
|
|
176
|
+
fill: ${({ currentColor = false, theme: theme2 }) => currentColor ? "currentColor" : theme2.color.text2};
|
|
177
|
+
width: ${(props) => props.size}px;
|
|
178
|
+
height: ${(props) => props.size}px;
|
|
179
|
+
line-height: 0;
|
|
180
|
+
font-size: 0;
|
|
181
|
+
vertical-align: middle;
|
|
182
|
+
`;
|
|
183
|
+
var IconBasePath = ({
|
|
184
|
+
path: path2,
|
|
185
|
+
transform,
|
|
186
|
+
fillRule,
|
|
187
|
+
clipRule
|
|
188
|
+
}) => {
|
|
189
|
+
if (typeof path2 === "string") {
|
|
190
|
+
return /* @__PURE__ */ React2.createElement(
|
|
191
|
+
"path",
|
|
192
|
+
{
|
|
193
|
+
d: path2,
|
|
194
|
+
transform,
|
|
195
|
+
fillRule,
|
|
196
|
+
clipRule
|
|
197
|
+
}
|
|
198
|
+
);
|
|
199
|
+
} else {
|
|
200
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, path2);
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
// src/components/icons/InfoIcon.tsx
|
|
205
|
+
var size = 16;
|
|
206
|
+
function InfoIcon() {
|
|
207
|
+
const path2 = /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(
|
|
208
|
+
"path",
|
|
209
|
+
{
|
|
210
|
+
d: "M8 16C3.58172 16 0 12.4183 0 8C0 3.58172 3.58172 0 8 0C12.4183\n 0 16 3.58172 16 8C16 12.4183 12.4183 16 8 16Z"
|
|
211
|
+
}
|
|
212
|
+
), /* @__PURE__ */ React3.createElement(
|
|
213
|
+
Path,
|
|
214
|
+
{
|
|
215
|
+
d: "M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629\n 4.68629 2 8 2C11.3137 2 14 4.68629 14 8ZM8 6.25C8.69036 6.25 9.25 5.69036\n 9.25 5C9.25 4.30964 8.69036 3.75 8 3.75C7.30964 3.75 6.75 4.30964 6.75\n 5C6.75 5.69036 7.30964 6.25 8 6.25ZM7 7.75V11.25C7 11.8023 7.44772 12.25\n 8 12.25C8.55228 12.25 9 11.8023 9 11.25V7.75C9 7.19772 8.55228 6.75 8\n 6.75C7.44772 6.75 7 7.19772 7 7.75Z"
|
|
216
|
+
}
|
|
217
|
+
));
|
|
218
|
+
return /* @__PURE__ */ React3.createElement(IconBase, { viewBoxSize: size, size, currentColor: true, path: path2 });
|
|
219
|
+
}
|
|
220
|
+
var Path = styled4.path`
|
|
221
|
+
fill: ${({ theme: theme2 }) => theme2.color.surface1};
|
|
222
|
+
fill-rule: evenodd;
|
|
223
|
+
`;
|
|
224
|
+
|
|
225
|
+
// src/components/HintText/index.tsx
|
|
226
|
+
import { maxWidth as maxWidth2 } from "@charcoal-ui/utils";
|
|
227
|
+
function HintText({ children, context, className }) {
|
|
228
|
+
return /* @__PURE__ */ React4.createElement(Container, { className, context }, /* @__PURE__ */ React4.createElement(IconWrap, null, /* @__PURE__ */ React4.createElement(InfoIcon, null)), /* @__PURE__ */ React4.createElement(Text, null, children));
|
|
229
|
+
}
|
|
230
|
+
var Container = styled5.div.attrs(
|
|
231
|
+
styledProps
|
|
232
|
+
)`
|
|
233
|
+
${(p) => theme((o) => [
|
|
234
|
+
o.bg.surface3,
|
|
235
|
+
o.borderRadius(8),
|
|
236
|
+
o.padding.vertical(p.default.vertical),
|
|
237
|
+
o.padding.horizontal(p.default.horizontal)
|
|
238
|
+
])}
|
|
239
|
+
|
|
240
|
+
@media ${({ theme: t }) => maxWidth2(t.breakpoint.screen1)} {
|
|
241
|
+
${(p) => theme((o) => [
|
|
242
|
+
o.padding.vertical(p.screen1.vertical),
|
|
243
|
+
o.padding.horizontal(p.screen1.horizontal)
|
|
244
|
+
])}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
display: flex;
|
|
248
|
+
align-items: flex-start;
|
|
249
|
+
${(p) => p.context === "page" && css2`
|
|
250
|
+
justify-content: center;
|
|
251
|
+
`}
|
|
252
|
+
`;
|
|
253
|
+
var IconWrap = styled5.div`
|
|
254
|
+
display: flex;
|
|
255
|
+
align-items: center;
|
|
256
|
+
color: ${(p) => p.theme.color.text4};
|
|
257
|
+
height: 22px;
|
|
258
|
+
margin: -4px 4px -4px 0;
|
|
259
|
+
`;
|
|
260
|
+
var Text = styled5.p`
|
|
261
|
+
${theme((o) => [o.font.text2, o.typography(14)])}
|
|
262
|
+
margin: 0;
|
|
263
|
+
`;
|
|
264
|
+
function styledProps(props) {
|
|
265
|
+
return { ...props, ...contextToProps(props.context) };
|
|
266
|
+
}
|
|
267
|
+
function contextToProps(context) {
|
|
268
|
+
switch (context) {
|
|
269
|
+
case "page":
|
|
270
|
+
return {
|
|
271
|
+
default: {
|
|
272
|
+
horizontal: 40,
|
|
273
|
+
vertical: 24
|
|
274
|
+
},
|
|
275
|
+
screen1: {
|
|
276
|
+
horizontal: 16,
|
|
277
|
+
vertical: 16
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
case "section":
|
|
281
|
+
return {
|
|
282
|
+
default: {
|
|
283
|
+
horizontal: 16,
|
|
284
|
+
vertical: 16
|
|
285
|
+
},
|
|
286
|
+
screen1: {
|
|
287
|
+
horizontal: 16,
|
|
288
|
+
vertical: 16
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// src/components/Layout/index.tsx
|
|
295
|
+
import React5, { useContext } from "react";
|
|
296
|
+
import styled6, { createGlobalStyle, css as css3 } from "styled-components";
|
|
297
|
+
|
|
298
|
+
// src/foundation/contants.ts
|
|
299
|
+
import { columnSystem, COLUMN_UNIT, GUTTER_UNIT } from "@charcoal-ui/foundation";
|
|
300
|
+
var MAIN_COLUMN_HORIZONTAL_MIN_MARGIN = 72;
|
|
301
|
+
var RESPONSIVE_LEFT_WIDTH = columnSystem(2, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT;
|
|
302
|
+
var RESPONSIVE_MAIN_MAX_WIDTH = columnSystem(
|
|
303
|
+
12,
|
|
304
|
+
COLUMN_UNIT,
|
|
305
|
+
GUTTER_UNIT
|
|
306
|
+
);
|
|
307
|
+
|
|
308
|
+
// src/foundation/hooks.ts
|
|
309
|
+
import {
|
|
310
|
+
useCallback,
|
|
311
|
+
useDebugValue,
|
|
312
|
+
useLayoutEffect,
|
|
313
|
+
useMemo,
|
|
314
|
+
useReducer,
|
|
315
|
+
useRef,
|
|
316
|
+
useState
|
|
317
|
+
} from "react";
|
|
318
|
+
import ReactDOM from "react-dom";
|
|
319
|
+
import { useTheme } from "styled-components";
|
|
320
|
+
import { maxWidth as maxWidth3 } from "@charcoal-ui/utils";
|
|
321
|
+
function useMediaScreen1() {
|
|
322
|
+
return useMedia(maxWidth3(useTheme().breakpoint.screen1));
|
|
323
|
+
}
|
|
324
|
+
function useMedia(query) {
|
|
325
|
+
const matcher = useMemo(
|
|
326
|
+
() => __TEST__ ? {
|
|
327
|
+
matches: false,
|
|
328
|
+
addListener: () => {
|
|
329
|
+
},
|
|
330
|
+
removeListener: () => {
|
|
331
|
+
}
|
|
332
|
+
} : matchMedia(query),
|
|
333
|
+
[query]
|
|
334
|
+
);
|
|
335
|
+
const [matches, setMatches] = useState(matcher.matches);
|
|
336
|
+
if (matcher.matches !== matches) {
|
|
337
|
+
setMatches(matcher.matches);
|
|
338
|
+
}
|
|
339
|
+
const callback = (e) => {
|
|
340
|
+
try {
|
|
341
|
+
ReactDOM.flushSync(() => {
|
|
342
|
+
setMatches(e.matches);
|
|
343
|
+
});
|
|
344
|
+
} catch {
|
|
345
|
+
setMatches(e.matches);
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
useLayoutEffect(() => {
|
|
349
|
+
matcher.addListener(callback);
|
|
350
|
+
setMatches(matcher.matches);
|
|
351
|
+
return () => {
|
|
352
|
+
matcher.removeListener(callback);
|
|
353
|
+
};
|
|
354
|
+
}, [matcher]);
|
|
355
|
+
useDebugValue(`${query}: ${matches.toString()}`);
|
|
356
|
+
return matches;
|
|
357
|
+
}
|
|
358
|
+
function measure(ref) {
|
|
359
|
+
return ref !== null ? ref.getBoundingClientRect() : void 0;
|
|
360
|
+
}
|
|
361
|
+
function useElementSize(ref, deps = []) {
|
|
362
|
+
const [size3, setSize] = useReducer(
|
|
363
|
+
(state, next) => {
|
|
364
|
+
if (state === void 0 || next === void 0) {
|
|
365
|
+
return next;
|
|
366
|
+
}
|
|
367
|
+
if (state.height === next.height && state.width === next.width) {
|
|
368
|
+
return state;
|
|
369
|
+
}
|
|
370
|
+
return next;
|
|
371
|
+
},
|
|
372
|
+
void 0
|
|
373
|
+
);
|
|
374
|
+
const [watch, setWatch] = useState(null);
|
|
375
|
+
useLayoutEffect(() => {
|
|
376
|
+
if (watch === null) {
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
const observer = new ResizeObserver(() => {
|
|
380
|
+
const newSize = measure(watch);
|
|
381
|
+
setSize(newSize);
|
|
382
|
+
});
|
|
383
|
+
observer.observe(watch);
|
|
384
|
+
return () => {
|
|
385
|
+
observer.unobserve(watch);
|
|
386
|
+
setSize(void 0);
|
|
387
|
+
};
|
|
388
|
+
}, [watch]);
|
|
389
|
+
useLayoutEffect(() => {
|
|
390
|
+
if (ref.current !== watch) {
|
|
391
|
+
setWatch(ref.current);
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
useLayoutEffect(() => {
|
|
395
|
+
if (deps.length > 0) {
|
|
396
|
+
setSize(measure(ref.current));
|
|
397
|
+
}
|
|
398
|
+
}, deps);
|
|
399
|
+
useDebugValue(size3);
|
|
400
|
+
return size3;
|
|
401
|
+
}
|
|
402
|
+
function useDebounceAnimationState(defaultValue) {
|
|
403
|
+
const [state, setState] = useState(defaultValue);
|
|
404
|
+
const timer = useRef();
|
|
405
|
+
const setDebounceState = useCallback((value, force = false) => {
|
|
406
|
+
if (force) {
|
|
407
|
+
setState(value);
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
if (timer.current !== void 0) {
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
timer.current = requestAnimationFrame(() => {
|
|
414
|
+
setState(value);
|
|
415
|
+
if (timer.current !== void 0) {
|
|
416
|
+
timer.current = void 0;
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
}, []);
|
|
420
|
+
return [state, setDebounceState];
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
// src/components/Layout/index.tsx
|
|
424
|
+
import { columnSystem as columnSystem2, COLUMN_UNIT as COLUMN_UNIT2, GUTTER_UNIT as GUTTER_UNIT2 } from "@charcoal-ui/foundation";
|
|
425
|
+
import { maxWidth as maxWidth4 } from "@charcoal-ui/utils";
|
|
426
|
+
var LayoutConfigContext = React5.createContext({
|
|
427
|
+
wide: false,
|
|
428
|
+
center: false,
|
|
429
|
+
withLeft: false
|
|
430
|
+
});
|
|
431
|
+
function Layout({
|
|
432
|
+
menu,
|
|
433
|
+
children,
|
|
434
|
+
header,
|
|
435
|
+
center = false,
|
|
436
|
+
wide,
|
|
437
|
+
isHeaderTopMenu = false
|
|
438
|
+
}) {
|
|
439
|
+
const config = {
|
|
440
|
+
center,
|
|
441
|
+
wide: center ? true : wide ?? false,
|
|
442
|
+
withLeft: menu != null && !isHeaderTopMenu
|
|
443
|
+
};
|
|
444
|
+
return /* @__PURE__ */ React5.createElement(LayoutRoot, null, /* @__PURE__ */ React5.createElement(LayoutConfigContext.Provider, { value: config }, config.withLeft && /* @__PURE__ */ React5.createElement(LeftArea, null, menu), /* @__PURE__ */ React5.createElement(MainArea, { center }, header != null && /* @__PURE__ */ React5.createElement(Header, null, header), isHeaderTopMenu && /* @__PURE__ */ React5.createElement(HeaderTopMenuContainer, null, menu), /* @__PURE__ */ React5.createElement(Grid, null, children))), /* @__PURE__ */ React5.createElement(GlobalStyle, null));
|
|
445
|
+
}
|
|
446
|
+
var HeaderTopMenuContainer = styled6.div`
|
|
447
|
+
margin-bottom: 40px;
|
|
448
|
+
overflow-x: auto;
|
|
449
|
+
word-break: keep-all;
|
|
450
|
+
|
|
451
|
+
@media ${({ theme: theme2 }) => maxWidth4(theme2.breakpoint.screen1)} {
|
|
452
|
+
margin-bottom: 0;
|
|
453
|
+
padding-left: 16px;
|
|
454
|
+
padding-bottom: 16px;
|
|
455
|
+
background-color: ${({ theme: theme2 }) => theme2.color.surface2};
|
|
456
|
+
}
|
|
457
|
+
`;
|
|
458
|
+
var GlobalStyle = createGlobalStyle`
|
|
459
|
+
:root {
|
|
460
|
+
background-color: ${({ theme: theme2 }) => theme2.color.background2};
|
|
461
|
+
|
|
462
|
+
@media ${({ theme: theme2 }) => maxWidth4(theme2.breakpoint.screen1)} {
|
|
463
|
+
background-color: ${({ theme: theme2 }) => theme2.color.background1};
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
`;
|
|
467
|
+
var LayoutRoot = styled6.div`
|
|
468
|
+
display: flex;
|
|
469
|
+
background-color: ${({ theme: theme2 }) => theme2.color.background2};
|
|
470
|
+
|
|
471
|
+
@media ${({ theme: theme2 }) => maxWidth4(theme2.breakpoint.screen1)} {
|
|
472
|
+
background-color: ${({ theme: theme2 }) => theme2.color.background1};
|
|
473
|
+
}
|
|
474
|
+
`;
|
|
475
|
+
var LeftArea = styled6.div`
|
|
476
|
+
min-width: ${RESPONSIVE_LEFT_WIDTH}px;
|
|
477
|
+
padding: 40px 0 40px ${GUTTER_UNIT2}px;
|
|
478
|
+
box-sizing: border-box;
|
|
479
|
+
|
|
480
|
+
@media ${({ theme: theme2 }) => theme2.breakpoint.screen3} {
|
|
481
|
+
display: none;
|
|
482
|
+
}
|
|
483
|
+
`;
|
|
484
|
+
var MainArea = styled6.div`
|
|
485
|
+
flex-grow: 1;
|
|
486
|
+
/* https://www.w3.org/TR/css-flexbox-1/#min-size-auto */
|
|
487
|
+
min-width: 0;
|
|
488
|
+
max-width: ${(p) => p.center ? columnSystem2(6, COLUMN_UNIT2, GUTTER_UNIT2) : RESPONSIVE_MAIN_MAX_WIDTH}px;
|
|
489
|
+
padding: 40px ${MAIN_COLUMN_HORIZONTAL_MIN_MARGIN}px;
|
|
490
|
+
margin: 0 auto;
|
|
491
|
+
display: flex;
|
|
492
|
+
flex-direction: column;
|
|
493
|
+
|
|
494
|
+
@media ${({ theme: theme2 }) => maxWidth4(theme2.breakpoint.screen1)} {
|
|
495
|
+
padding: 0;
|
|
496
|
+
}
|
|
497
|
+
`;
|
|
498
|
+
var Header = styled6.div`
|
|
499
|
+
font-weight: bold;
|
|
500
|
+
margin-bottom: 12px;
|
|
501
|
+
font-size: 20px;
|
|
502
|
+
line-height: 28px;
|
|
503
|
+
color: ${({ theme: theme2 }) => theme2.color.text2};
|
|
504
|
+
|
|
505
|
+
@media ${({ theme: theme2 }) => maxWidth4(theme2.breakpoint.screen1)} {
|
|
506
|
+
margin-bottom: 0;
|
|
507
|
+
padding: 12px;
|
|
508
|
+
font-size: 16px;
|
|
509
|
+
line-height: 24px;
|
|
510
|
+
display: flex;
|
|
511
|
+
justify-content: center;
|
|
512
|
+
background-color: ${({ theme: theme2 }) => theme2.color.surface2};
|
|
513
|
+
}
|
|
514
|
+
`;
|
|
515
|
+
var Grid = styled6.div`
|
|
516
|
+
display: grid;
|
|
517
|
+
gap: ${GUTTER_UNIT2}px;
|
|
518
|
+
grid-template-columns: 1fr;
|
|
519
|
+
grid-auto-columns: 1fr;
|
|
520
|
+
grid-auto-rows: auto;
|
|
521
|
+
|
|
522
|
+
@media ${({ theme: theme2 }) => maxWidth4(theme2.breakpoint.screen1)} {
|
|
523
|
+
gap: 0;
|
|
524
|
+
background-color: ${({ theme: theme2 }) => theme2.color.background1};
|
|
525
|
+
padding-bottom: 60px;
|
|
526
|
+
}
|
|
527
|
+
`;
|
|
528
|
+
var LayoutItem = React5.forwardRef(
|
|
529
|
+
function LayoutItem2({ span, children }, ref) {
|
|
530
|
+
const { withLeft } = useContext(LayoutConfigContext);
|
|
531
|
+
return /* @__PURE__ */ React5.createElement(StyledLayoutItem, { span, withLeft, ref }, children);
|
|
532
|
+
}
|
|
533
|
+
);
|
|
534
|
+
var StyledLayoutItem = styled6.div`
|
|
535
|
+
grid-column-start: auto;
|
|
536
|
+
grid-column-end: span ${(p) => p.span};
|
|
537
|
+
border-radius: 24px;
|
|
538
|
+
color: ${({ theme: theme2 }) => theme2.color.text2};
|
|
539
|
+
background-color: ${({ theme: theme2 }) => theme2.color.background1};
|
|
540
|
+
/* https://www.w3.org/TR/css-grid-1/#min-size-auto */
|
|
541
|
+
min-width: 0;
|
|
542
|
+
|
|
543
|
+
@media ${(p) => p.withLeft ? p.theme.breakpoint.screen4 : p.theme.breakpoint.screen3} {
|
|
544
|
+
${(p) => p.span > 2 && css3`
|
|
545
|
+
grid-column-end: span 2;
|
|
546
|
+
`}
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
@media ${({ theme: theme2 }) => maxWidth4(theme2.breakpoint.screen1)} {
|
|
550
|
+
${(p) => p.span > 1 && css3`
|
|
551
|
+
grid-column-end: span 1;
|
|
552
|
+
`}
|
|
553
|
+
|
|
554
|
+
border-radius: 0;
|
|
555
|
+
padding-bottom: 40px;
|
|
556
|
+
}
|
|
557
|
+
`;
|
|
558
|
+
function LayoutItemHeader({ children }) {
|
|
559
|
+
const { wide, center } = useContext(LayoutConfigContext);
|
|
560
|
+
return /* @__PURE__ */ React5.createElement(StyledLayoutItemHeader, { wide, center }, children);
|
|
561
|
+
}
|
|
562
|
+
var StyledLayoutItemHeader = styled6.div`
|
|
563
|
+
padding: 0 ${(p) => p.wide ? 40 : 24}px;
|
|
564
|
+
height: ${(p) => p.wide ? 64 : 48}px;
|
|
565
|
+
display: grid;
|
|
566
|
+
align-items: center;
|
|
567
|
+
font-size: 16px;
|
|
568
|
+
line-height: 24px;
|
|
569
|
+
font-weight: bold;
|
|
570
|
+
background-color: ${({ theme: theme2 }) => theme2.color.surface2};
|
|
571
|
+
color: ${({ theme: theme2 }) => theme2.color.text2};
|
|
572
|
+
border-radius: 24px 24px 0 0;
|
|
573
|
+
${(p) => p.center && css3`
|
|
574
|
+
justify-content: center;
|
|
575
|
+
`}
|
|
576
|
+
|
|
577
|
+
@media ${({ theme: theme2 }) => maxWidth4(theme2.breakpoint.screen1)} {
|
|
578
|
+
margin-top: 4px;
|
|
579
|
+
padding: 0 16px;
|
|
580
|
+
background: none;
|
|
581
|
+
overflow-x: auto;
|
|
582
|
+
border-radius: unset;
|
|
583
|
+
${(p) => p.wide && css3`
|
|
584
|
+
height: 48px;
|
|
585
|
+
margin-top: 0;
|
|
586
|
+
`}
|
|
587
|
+
}
|
|
588
|
+
`;
|
|
589
|
+
var LAYOUT_ITEM_BODY_PADDING = {
|
|
590
|
+
wide: {
|
|
591
|
+
x: 40,
|
|
592
|
+
y: 40
|
|
593
|
+
},
|
|
594
|
+
default: {
|
|
595
|
+
x: 24,
|
|
596
|
+
y: 24
|
|
597
|
+
},
|
|
598
|
+
column1: {
|
|
599
|
+
x: 16,
|
|
600
|
+
y: 16
|
|
601
|
+
},
|
|
602
|
+
narrow: {
|
|
603
|
+
x: 24,
|
|
604
|
+
yTop: 12,
|
|
605
|
+
yBottom: 20
|
|
606
|
+
},
|
|
607
|
+
narrowColumn1: {
|
|
608
|
+
x: 16,
|
|
609
|
+
yTop: 4,
|
|
610
|
+
yBottom: 0
|
|
611
|
+
}
|
|
612
|
+
};
|
|
613
|
+
function LayoutItemBody({
|
|
614
|
+
children,
|
|
615
|
+
horizontal = false,
|
|
616
|
+
narrow = false
|
|
617
|
+
}) {
|
|
618
|
+
const { wide } = useContext(LayoutConfigContext);
|
|
619
|
+
return /* @__PURE__ */ React5.createElement(StyledLayoutItemBody, { wide, horizontal, narrow }, children);
|
|
620
|
+
}
|
|
621
|
+
var StyledLayoutItemBody = styled6.div`
|
|
622
|
+
padding: ${(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`};
|
|
623
|
+
|
|
624
|
+
@media ${({ theme: theme2 }) => maxWidth4(theme2.breakpoint.screen1)} {
|
|
625
|
+
padding: ${(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}`};
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
width: 100%;
|
|
629
|
+
box-sizing: border-box;
|
|
630
|
+
`;
|
|
631
|
+
function useLayoutItemBodyPadding() {
|
|
632
|
+
const { wide } = useContext(LayoutConfigContext);
|
|
633
|
+
return useMediaScreen1() ? LAYOUT_ITEM_BODY_PADDING.column1 : wide ? LAYOUT_ITEM_BODY_PADDING.wide : LAYOUT_ITEM_BODY_PADDING.default;
|
|
634
|
+
}
|
|
635
|
+
function CancelLayoutItemBodyPadding({
|
|
636
|
+
children,
|
|
637
|
+
cancelTop
|
|
638
|
+
}) {
|
|
639
|
+
const { wide } = useContext(LayoutConfigContext);
|
|
640
|
+
return /* @__PURE__ */ React5.createElement(StyledCancelLayoutItemBodyPadding, { wide, cancelTop }, children);
|
|
641
|
+
}
|
|
642
|
+
var StyledCancelLayoutItemBodyPadding = styled6.div`
|
|
643
|
+
margin: 0 -${(p) => p.wide ? LAYOUT_ITEM_BODY_PADDING.wide.x : LAYOUT_ITEM_BODY_PADDING.default.x}px;
|
|
644
|
+
margin-top: -${({ cancelTop = false, wide }) => !cancelTop ? 0 : wide ? LAYOUT_ITEM_BODY_PADDING.wide.y : LAYOUT_ITEM_BODY_PADDING.default.y}px;
|
|
645
|
+
|
|
646
|
+
@media ${({ theme: theme2 }) => maxWidth4(theme2.breakpoint.screen1)} {
|
|
647
|
+
margin: 0 -${LAYOUT_ITEM_BODY_PADDING.column1.x}px;
|
|
648
|
+
margin-top: -${({ cancelTop = false }) => !cancelTop ? 0 : LAYOUT_ITEM_BODY_PADDING.column1.x}px;
|
|
649
|
+
}
|
|
650
|
+
`;
|
|
651
|
+
|
|
652
|
+
// src/components/LeftMenu/index.tsx
|
|
653
|
+
import React7 from "react";
|
|
654
|
+
import styled9 from "styled-components";
|
|
655
|
+
|
|
656
|
+
// src/components/MenuListItem/index.tsx
|
|
657
|
+
import React6, { useContext as useContext2 } from "react";
|
|
658
|
+
import styled8, { css as css5 } from "styled-components";
|
|
659
|
+
|
|
660
|
+
// src/components/TextEllipsis/index.tsx
|
|
661
|
+
import styled7, { css as css4 } from "styled-components";
|
|
662
|
+
|
|
663
|
+
// src/components/TextEllipsis/helper.ts
|
|
664
|
+
import {
|
|
665
|
+
Children,
|
|
666
|
+
isValidElement
|
|
667
|
+
} from "react";
|
|
668
|
+
var hasChildren = (element) => isValidElement(element) && Boolean(element.props.children);
|
|
669
|
+
var childToString = (child) => {
|
|
670
|
+
if (typeof child === "undefined" || child === null || typeof child === "boolean") {
|
|
671
|
+
return "";
|
|
672
|
+
}
|
|
673
|
+
if (JSON.stringify(child) === "{}") {
|
|
674
|
+
return "";
|
|
675
|
+
}
|
|
676
|
+
return child.toString();
|
|
677
|
+
};
|
|
678
|
+
var onlyText = (children) => {
|
|
679
|
+
if (!Array.isArray(children) && !isValidElement(children)) {
|
|
680
|
+
return childToString(children);
|
|
681
|
+
}
|
|
682
|
+
return Children.toArray(children).reduce(
|
|
683
|
+
(text, child) => {
|
|
684
|
+
let newText = "";
|
|
685
|
+
if (isValidElement(child) && hasChildren(child)) {
|
|
686
|
+
newText = onlyText(child.props.children);
|
|
687
|
+
} else if (isValidElement(child) && !hasChildren(child)) {
|
|
688
|
+
newText = "";
|
|
689
|
+
} else {
|
|
690
|
+
newText = childToString(child);
|
|
691
|
+
}
|
|
692
|
+
return text.concat(newText);
|
|
693
|
+
},
|
|
694
|
+
""
|
|
695
|
+
);
|
|
696
|
+
};
|
|
697
|
+
|
|
698
|
+
// src/components/TextEllipsis/index.tsx
|
|
699
|
+
var TextEllipsis = styled7.div.attrs(
|
|
700
|
+
({ children, title = onlyText(children) }) => ({
|
|
701
|
+
title: title !== "" ? title : void 0
|
|
702
|
+
})
|
|
703
|
+
)`
|
|
704
|
+
overflow: hidden;
|
|
705
|
+
line-height: ${(props) => props.lineHeight}px;
|
|
706
|
+
/* For english */
|
|
707
|
+
overflow-wrap: break-word;
|
|
708
|
+
|
|
709
|
+
${({ lineLimit = 1, lineHeight }) => lineLimit === 1 ? css4`
|
|
710
|
+
text-overflow: ellipsis;
|
|
711
|
+
white-space: nowrap;
|
|
712
|
+
` : css4`
|
|
713
|
+
display: -webkit-box;
|
|
714
|
+
-webkit-box-orient: vertical;
|
|
715
|
+
-webkit-line-clamp: ${lineLimit};
|
|
716
|
+
/* Fallback for -webkit-line-clamp */
|
|
717
|
+
max-height: ${lineHeight * lineLimit}px;
|
|
718
|
+
`}
|
|
719
|
+
`;
|
|
720
|
+
|
|
721
|
+
// src/components/MenuListItem/index.tsx
|
|
722
|
+
import { useComponentAbstraction as useComponentAbstraction2 } from "@charcoal-ui/react";
|
|
723
|
+
import { disabledSelector } from "@charcoal-ui/utils";
|
|
724
|
+
var MenuListItemContext = React6.createContext({ padding: 24 });
|
|
725
|
+
function MenuListItem({
|
|
726
|
+
primary,
|
|
727
|
+
secondary,
|
|
728
|
+
onClick,
|
|
729
|
+
disabled = false,
|
|
730
|
+
noHover = false,
|
|
731
|
+
gtmClass,
|
|
732
|
+
children
|
|
733
|
+
}) {
|
|
734
|
+
const { padding } = useContext2(MenuListItemContext);
|
|
735
|
+
return /* @__PURE__ */ React6.createElement(
|
|
736
|
+
Item,
|
|
737
|
+
{
|
|
738
|
+
hasSubLabel: secondary !== void 0,
|
|
739
|
+
onClick: (e) => !disabled && onClick && onClick(e),
|
|
740
|
+
sidePadding: padding,
|
|
741
|
+
noHover,
|
|
742
|
+
noClick: onClick === void 0,
|
|
743
|
+
"aria-disabled": disabled,
|
|
744
|
+
role: onClick !== void 0 ? "button" : void 0,
|
|
745
|
+
className: gtmClass !== void 0 ? `gtm-${gtmClass}` : void 0
|
|
746
|
+
},
|
|
747
|
+
/* @__PURE__ */ React6.createElement(Labels, null, /* @__PURE__ */ React6.createElement(PrimaryText, null, /* @__PURE__ */ React6.createElement(TextEllipsis, { lineHeight: 22, lineLimit: 1 }, primary)), secondary !== void 0 && /* @__PURE__ */ React6.createElement(SecondaryText, null, /* @__PURE__ */ React6.createElement(TextEllipsis, { lineHeight: 22, lineLimit: 1 }, secondary))),
|
|
748
|
+
children
|
|
749
|
+
);
|
|
750
|
+
}
|
|
751
|
+
var Item = styled8.div`
|
|
752
|
+
display: flex;
|
|
753
|
+
height: ${(p) => p.hasSubLabel ? 56 : 40}px;
|
|
754
|
+
align-items: center;
|
|
755
|
+
justify-content: space-between;
|
|
756
|
+
padding: 0 ${(p) => p.sidePadding}px;
|
|
757
|
+
user-select: none;
|
|
758
|
+
cursor: ${(p) => p.noClick ? "default" : "pointer"};
|
|
759
|
+
transition: 0.2s background-color;
|
|
760
|
+
|
|
761
|
+
&:hover {
|
|
762
|
+
${(p) => !p.noHover && css5`
|
|
763
|
+
background-color: ${({ theme: theme2 }) => theme2.color.surface3};
|
|
764
|
+
`}
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
${theme((o) => o.disabled)}
|
|
768
|
+
|
|
769
|
+
${disabledSelector} {
|
|
770
|
+
cursor: default;
|
|
771
|
+
pointer-events: none;
|
|
772
|
+
|
|
773
|
+
&:hover {
|
|
774
|
+
background-color: unset;
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
`;
|
|
778
|
+
var Labels = styled8.div`
|
|
779
|
+
display: flex;
|
|
780
|
+
flex-direction: column;
|
|
781
|
+
`;
|
|
782
|
+
var PrimaryText = styled8.div`
|
|
783
|
+
color: ${(p) => p.theme.color.text2};
|
|
784
|
+
line-height: 22px;
|
|
785
|
+
font-size: 14px;
|
|
786
|
+
display: grid;
|
|
787
|
+
`;
|
|
788
|
+
var SecondaryText = styled8.div`
|
|
789
|
+
color: ${(p) => p.theme.color.text3};
|
|
790
|
+
line-height: 18px;
|
|
791
|
+
font-size: 10px;
|
|
792
|
+
`;
|
|
793
|
+
function MenuListLinkItem({
|
|
794
|
+
link,
|
|
795
|
+
onClick,
|
|
796
|
+
disabled = false,
|
|
797
|
+
primary,
|
|
798
|
+
secondary,
|
|
799
|
+
gtmClass,
|
|
800
|
+
noHover,
|
|
801
|
+
children,
|
|
802
|
+
...linkProps
|
|
803
|
+
}) {
|
|
804
|
+
const { Link } = useComponentAbstraction2();
|
|
805
|
+
const props = {
|
|
806
|
+
disabled,
|
|
807
|
+
primary,
|
|
808
|
+
secondary,
|
|
809
|
+
gtmClass,
|
|
810
|
+
noHover,
|
|
811
|
+
children
|
|
812
|
+
};
|
|
813
|
+
return disabled ? /* @__PURE__ */ React6.createElement("span", { onClick }, /* @__PURE__ */ React6.createElement(MenuListItem, { ...props })) : /* @__PURE__ */ React6.createElement(A, { as: Link, to: link, onClick, ...linkProps }, /* @__PURE__ */ React6.createElement(MenuListItem, { onClick: () => void 0, ...props }));
|
|
814
|
+
}
|
|
815
|
+
var A = styled8.a`
|
|
816
|
+
display: block;
|
|
817
|
+
`;
|
|
818
|
+
function MenuListLinkItemWithIcon({
|
|
819
|
+
icon,
|
|
820
|
+
primary: text,
|
|
821
|
+
...props
|
|
822
|
+
}) {
|
|
823
|
+
const primary = /* @__PURE__ */ React6.createElement(IconContainer, null, /* @__PURE__ */ React6.createElement(Icon2, null, icon), text);
|
|
824
|
+
return /* @__PURE__ */ React6.createElement(MenuListLinkItem, { primary, ...props });
|
|
825
|
+
}
|
|
826
|
+
function MenuListItemWithIcon({
|
|
827
|
+
icon,
|
|
828
|
+
primary: text,
|
|
829
|
+
...props
|
|
830
|
+
}) {
|
|
831
|
+
const primary = /* @__PURE__ */ React6.createElement(IconContainer, null, /* @__PURE__ */ React6.createElement(Icon2, null, icon), text);
|
|
832
|
+
return /* @__PURE__ */ React6.createElement(MenuListItem, { primary, ...props });
|
|
833
|
+
}
|
|
834
|
+
var IconContainer = styled8.div`
|
|
835
|
+
display: grid;
|
|
836
|
+
gap: 8px;
|
|
837
|
+
grid-auto-flow: column;
|
|
838
|
+
align-items: center;
|
|
839
|
+
`;
|
|
840
|
+
var Icon2 = styled8.div`
|
|
841
|
+
color: ${({ theme: theme2 }) => theme2.color.text3};
|
|
842
|
+
display: flex;
|
|
843
|
+
`;
|
|
844
|
+
var MenuListSpacer = styled8.div`
|
|
845
|
+
height: 24px;
|
|
846
|
+
`;
|
|
847
|
+
var MenuListLabel = styled8.div`
|
|
848
|
+
padding: 0 16px;
|
|
849
|
+
font-size: 12px;
|
|
850
|
+
line-height: 16px;
|
|
851
|
+
color: ${({ theme: theme2 }) => theme2.color.text3};
|
|
852
|
+
margin-top: -2px;
|
|
853
|
+
margin-bottom: 6px;
|
|
854
|
+
`;
|
|
855
|
+
|
|
856
|
+
// src/components/LeftMenu/index.tsx
|
|
857
|
+
import { useComponentAbstraction as useComponentAbstraction3 } from "@charcoal-ui/react";
|
|
858
|
+
function LeftMenu({
|
|
859
|
+
links,
|
|
860
|
+
active
|
|
861
|
+
}) {
|
|
862
|
+
const { Link } = useComponentAbstraction3();
|
|
863
|
+
return /* @__PURE__ */ React7.createElement(Container2, null, links.map((link, index) => /* @__PURE__ */ React7.createElement(Link, { to: link.to, key: index }, /* @__PURE__ */ React7.createElement(LinkItem, { "aria-current": link.id === active || void 0 }, link.text))));
|
|
864
|
+
}
|
|
865
|
+
function LeftMenuContent({ links }) {
|
|
866
|
+
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, links.map((link, index) => /* @__PURE__ */ React7.createElement(MenuListLinkItem, { link: link.to, key: index, primary: link.text })));
|
|
867
|
+
}
|
|
868
|
+
var Container2 = styled9.div`
|
|
869
|
+
display: flex;
|
|
870
|
+
flex-direction: column;
|
|
871
|
+
align-items: flex-start;
|
|
872
|
+
`;
|
|
873
|
+
var LinkItem = styled9.div`
|
|
874
|
+
display: flex;
|
|
875
|
+
align-items: center;
|
|
876
|
+
color: ${({ theme: theme2 }) => theme2.color.text3};
|
|
877
|
+
border-radius: 24px;
|
|
878
|
+
font-weight: bold;
|
|
879
|
+
font-size: 14px;
|
|
880
|
+
line-height: 22px;
|
|
881
|
+
padding: 0 16px;
|
|
882
|
+
height: 40px;
|
|
883
|
+
transition: 0.2s color;
|
|
884
|
+
&:hover {
|
|
885
|
+
transition: 0.2s color;
|
|
886
|
+
color: ${({ theme: theme2 }) => theme2.color.text2};
|
|
887
|
+
}
|
|
888
|
+
&[aria-current] {
|
|
889
|
+
color: ${({ theme: theme2 }) => theme2.color.text2};
|
|
890
|
+
background-color: ${({ theme: theme2 }) => theme2.color.surface3};
|
|
891
|
+
}
|
|
892
|
+
`;
|
|
893
|
+
|
|
894
|
+
// src/components/SwitchCheckbox/index.tsx
|
|
895
|
+
import React8 from "react";
|
|
896
|
+
import styled10, { css as css6 } from "styled-components";
|
|
897
|
+
import { applyEffect } from "@charcoal-ui/utils";
|
|
898
|
+
var SwitchCheckbox_default = React8.forwardRef(function SwitchCheckbox({
|
|
899
|
+
gtmClass,
|
|
900
|
+
flex = false,
|
|
901
|
+
rowReverse = false,
|
|
902
|
+
children,
|
|
903
|
+
disabled,
|
|
904
|
+
...props
|
|
905
|
+
}, ref) {
|
|
906
|
+
return /* @__PURE__ */ React8.createElement(
|
|
907
|
+
Label,
|
|
908
|
+
{
|
|
909
|
+
className: gtmClass !== void 0 ? `gtm-${gtmClass}` : "",
|
|
910
|
+
flex,
|
|
911
|
+
rowReverse,
|
|
912
|
+
"aria-disabled": disabled
|
|
913
|
+
},
|
|
914
|
+
/* @__PURE__ */ React8.createElement(SwitchOuter, null, /* @__PURE__ */ React8.createElement(SwitchInput, { ...props, disabled, ref }), /* @__PURE__ */ React8.createElement(SwitchInner, null, /* @__PURE__ */ React8.createElement(SwitchInnerKnob, null))),
|
|
915
|
+
children != null && /* @__PURE__ */ React8.createElement(Children2, { rowReverse }, children)
|
|
916
|
+
);
|
|
917
|
+
});
|
|
918
|
+
var Children2 = styled10.span`
|
|
919
|
+
${(p) => p.rowReverse ? css6`
|
|
920
|
+
margin-right: 8px;
|
|
921
|
+
` : css6`
|
|
922
|
+
margin-left: 8px;
|
|
923
|
+
`}
|
|
924
|
+
`;
|
|
925
|
+
var Label = styled10.label`
|
|
926
|
+
display: inline-flex;
|
|
927
|
+
align-items: center;
|
|
928
|
+
${({ flex }) => flex && css6`
|
|
929
|
+
display: flex;
|
|
930
|
+
justify-content: space-between;
|
|
931
|
+
`}
|
|
932
|
+
${({ rowReverse }) => css6`
|
|
933
|
+
flex-direction: ${rowReverse ? "row-reverse" : "row"};
|
|
934
|
+
`}
|
|
935
|
+
cursor: pointer;
|
|
936
|
+
outline: 0;
|
|
937
|
+
|
|
938
|
+
&[aria-disabled='true'] {
|
|
939
|
+
cursor: auto;
|
|
940
|
+
}
|
|
941
|
+
`;
|
|
942
|
+
var SwitchOuter = styled10.span`
|
|
943
|
+
display: inline-flex;
|
|
944
|
+
position: relative;
|
|
945
|
+
z-index: 0;
|
|
946
|
+
`;
|
|
947
|
+
var SwitchInner = styled10.div`
|
|
948
|
+
position: relative;
|
|
949
|
+
box-sizing: border-box;
|
|
950
|
+
width: 28px;
|
|
951
|
+
height: 16px;
|
|
952
|
+
border-radius: 16px;
|
|
953
|
+
border: 2px solid transparent;
|
|
954
|
+
background: ${({ theme: theme2 }) => theme2.color.text4};
|
|
955
|
+
transition: box-shadow 0.2s, background-color 0.2s;
|
|
956
|
+
`;
|
|
957
|
+
var SwitchInnerKnob = styled10.div`
|
|
958
|
+
position: absolute;
|
|
959
|
+
display: block;
|
|
960
|
+
top: 0;
|
|
961
|
+
left: 0;
|
|
962
|
+
width: 12px;
|
|
963
|
+
height: 12px;
|
|
964
|
+
background-color: ${({ theme: theme2 }) => theme2.color.text5};
|
|
965
|
+
border-radius: 50%;
|
|
966
|
+
transform: translateX(0);
|
|
967
|
+
transition: transform 0.2s;
|
|
968
|
+
`;
|
|
969
|
+
var SwitchInput = styled10.input.attrs({
|
|
970
|
+
type: "checkbox"
|
|
971
|
+
})`
|
|
972
|
+
position: absolute;
|
|
973
|
+
/* NOTE: this is contained by the GraphicCheckboxOuter */
|
|
974
|
+
z-index: 1;
|
|
975
|
+
top: 0;
|
|
976
|
+
left: 0;
|
|
977
|
+
width: 100%;
|
|
978
|
+
height: 100%;
|
|
979
|
+
/* just to control the clickable area if used standalone */
|
|
980
|
+
border-radius: 16px;
|
|
981
|
+
opacity: 0;
|
|
982
|
+
appearance: none;
|
|
983
|
+
outline: none;
|
|
984
|
+
cursor: pointer;
|
|
985
|
+
|
|
986
|
+
&:checked {
|
|
987
|
+
~ ${SwitchInner} {
|
|
988
|
+
background-color: ${({ theme: theme2 }) => theme2.color.brand};
|
|
989
|
+
|
|
990
|
+
${SwitchInnerKnob} {
|
|
991
|
+
transform: translateX(12px);
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
&:disabled {
|
|
997
|
+
cursor: auto;
|
|
998
|
+
|
|
999
|
+
~ ${SwitchInner} {
|
|
1000
|
+
opacity: ${({ theme: theme2 }) => theme2.elementEffect.disabled.opacity};
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
&:not(:disabled):focus {
|
|
1005
|
+
~ ${SwitchInner} {
|
|
1006
|
+
box-shadow: 0 0 0 4px
|
|
1007
|
+
${({ theme: theme2 }) => applyEffect(theme2.color.brand, theme2.elementEffect.disabled)};
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
`;
|
|
1011
|
+
|
|
1012
|
+
// src/components/WithIcon/index.tsx
|
|
1013
|
+
import React9, { useRef as useRef2 } from "react";
|
|
1014
|
+
import styled11, { css as css7 } from "styled-components";
|
|
1015
|
+
var WithIcon_default = React9.memo(function WithIcon({
|
|
1016
|
+
children,
|
|
1017
|
+
icon,
|
|
1018
|
+
show = true,
|
|
1019
|
+
prefix: pre = false,
|
|
1020
|
+
width,
|
|
1021
|
+
fit = false,
|
|
1022
|
+
fixed = false
|
|
1023
|
+
}) {
|
|
1024
|
+
const node = fit ? width === void 0 ? /* @__PURE__ */ React9.createElement(AutoWidthIconAnchor, { show, pre }, icon) : /* @__PURE__ */ React9.createElement(IconAnchor, { width, show, pre }, /* @__PURE__ */ React9.createElement(Icon3, null, icon)) : /* @__PURE__ */ React9.createElement(IconAnchorNaive, { show, pre }, /* @__PURE__ */ React9.createElement(IconNaive, null, icon));
|
|
1025
|
+
return /* @__PURE__ */ React9.createElement(Root, null, pre && node, /* @__PURE__ */ React9.createElement(Text2, { fixed }, children), !pre && node);
|
|
1026
|
+
});
|
|
1027
|
+
var Root = styled11.div`
|
|
1028
|
+
display: flex;
|
|
1029
|
+
align-items: center;
|
|
1030
|
+
`;
|
|
1031
|
+
var Text2 = styled11.div`
|
|
1032
|
+
${(p) => !p.fixed && css7`
|
|
1033
|
+
min-width: 0;
|
|
1034
|
+
overflow: hidden;
|
|
1035
|
+
`}
|
|
1036
|
+
white-space: nowrap;
|
|
1037
|
+
text-overflow: ellipsis;
|
|
1038
|
+
`;
|
|
1039
|
+
function AutoWidthIconAnchor({
|
|
1040
|
+
children,
|
|
1041
|
+
show,
|
|
1042
|
+
pre
|
|
1043
|
+
}) {
|
|
1044
|
+
const ref = useRef2(null);
|
|
1045
|
+
const width = useElementSize(ref, [null])?.width ?? 0;
|
|
1046
|
+
return /* @__PURE__ */ React9.createElement(IconAnchor, { width, show, pre }, /* @__PURE__ */ React9.createElement(Icon3, { ref }, children));
|
|
1047
|
+
}
|
|
1048
|
+
var forceCenteringCss = css7`
|
|
1049
|
+
> svg {
|
|
1050
|
+
display: block;
|
|
1051
|
+
}
|
|
1052
|
+
`;
|
|
1053
|
+
var iconAnchorCss = css7`
|
|
1054
|
+
${(p) => p.show === "collapse" ? css7`
|
|
1055
|
+
display: none;
|
|
1056
|
+
` : css7`
|
|
1057
|
+
visibility: ${p.show ? "visible" : "hidden"};
|
|
1058
|
+
`};
|
|
1059
|
+
${(p) => p.pre ? css7`
|
|
1060
|
+
margin-right: 4px;
|
|
1061
|
+
` : css7`
|
|
1062
|
+
margin-left: 4px;
|
|
1063
|
+
`}
|
|
1064
|
+
`;
|
|
1065
|
+
var IconAnchorNaive = styled11.div`
|
|
1066
|
+
display: flex;
|
|
1067
|
+
align-items: center;
|
|
1068
|
+
|
|
1069
|
+
${iconAnchorCss}
|
|
1070
|
+
`;
|
|
1071
|
+
var IconNaive = styled11.div`
|
|
1072
|
+
display: inline-flex;
|
|
1073
|
+
|
|
1074
|
+
${forceCenteringCss}
|
|
1075
|
+
`;
|
|
1076
|
+
var IconAnchor = styled11.div`
|
|
1077
|
+
display: flex;
|
|
1078
|
+
position: relative;
|
|
1079
|
+
/* Iconをline-heightに関与させない */
|
|
1080
|
+
height: 0;
|
|
1081
|
+
/* 横方向の領域は確保する */
|
|
1082
|
+
width: ${(p) => p.width}px;
|
|
1083
|
+
|
|
1084
|
+
${iconAnchorCss}
|
|
1085
|
+
`;
|
|
1086
|
+
var Icon3 = styled11.div`
|
|
1087
|
+
display: inline-flex;
|
|
1088
|
+
position: absolute;
|
|
1089
|
+
transform: translateY(-50%);
|
|
1090
|
+
|
|
1091
|
+
${forceCenteringCss}
|
|
1092
|
+
`;
|
|
1093
|
+
|
|
1094
|
+
// src/index.ts
|
|
1095
|
+
import {
|
|
1096
|
+
ComponentAbstraction,
|
|
1097
|
+
useComponentAbstraction as useComponentAbstraction5
|
|
1098
|
+
} from "@charcoal-ui/react";
|
|
1099
|
+
|
|
1100
|
+
// src/components/Carousel/index.tsx
|
|
1101
|
+
import React12, { useEffect as useEffect2, useState as useState2, useCallback as useCallback2, useRef as useRef3 } from "react";
|
|
1102
|
+
import { animated, useSpring } from "react-spring";
|
|
1103
|
+
import styled13, { css as css9 } from "styled-components";
|
|
1104
|
+
|
|
1105
|
+
// src/foundation/support.ts
|
|
1106
|
+
var passiveEventsResult;
|
|
1107
|
+
function passiveEvents() {
|
|
1108
|
+
if (passiveEventsResult !== void 0) {
|
|
1109
|
+
return passiveEventsResult;
|
|
1110
|
+
}
|
|
1111
|
+
passiveEventsResult = false;
|
|
1112
|
+
try {
|
|
1113
|
+
const options = Object.defineProperty({}, "passive", {
|
|
1114
|
+
get() {
|
|
1115
|
+
return passiveEventsResult = true;
|
|
1116
|
+
}
|
|
1117
|
+
});
|
|
1118
|
+
window.addEventListener("test", test, options);
|
|
1119
|
+
window.removeEventListener("test", test);
|
|
1120
|
+
} catch {
|
|
1121
|
+
}
|
|
1122
|
+
return passiveEventsResult;
|
|
1123
|
+
function test() {
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
var isEdge = () => navigator.userAgent.includes("Edge/");
|
|
1127
|
+
|
|
1128
|
+
// src/hooks/index.ts
|
|
1129
|
+
import { useLayoutEffect as useLayoutEffect2, useEffect } from "react";
|
|
1130
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect2 : useEffect;
|
|
1131
|
+
|
|
1132
|
+
// src/components/CarouselButton/index.tsx
|
|
1133
|
+
import React11 from "react";
|
|
1134
|
+
import styled12, { css as css8 } from "styled-components";
|
|
1135
|
+
|
|
1136
|
+
// src/foundation/utils.ts
|
|
1137
|
+
function unreachable(value) {
|
|
1138
|
+
throw new Error(
|
|
1139
|
+
arguments.length === 0 ? "unreachable" : `unreachable (${JSON.stringify(value)})`
|
|
1140
|
+
);
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
// src/components/icons/NextIcon.tsx
|
|
1144
|
+
import React10 from "react";
|
|
1145
|
+
var path = `M8.08579 16.5858C7.30474 17.3668 7.30474 18.6332 8.08579 19.4142C8.86684 20.1953 10.1332 20.1953 10.9142 19.4142L18.3284 12L10.9142 4.58579C10.1332 3.80474 8.86684 3.80474 8.08579 4.58579C7.30474 5.36684 7.30474 6.63317 8.08579 7.41421L12.6716 12L8.08579 16.5858Z`;
|
|
1146
|
+
var size2 = 24;
|
|
1147
|
+
function NextIcon({ direction }) {
|
|
1148
|
+
const transform = directionToTransform(direction);
|
|
1149
|
+
return /* @__PURE__ */ React10.createElement(
|
|
1150
|
+
IconBase,
|
|
1151
|
+
{
|
|
1152
|
+
viewBoxSize: size2,
|
|
1153
|
+
size: size2,
|
|
1154
|
+
currentColor: true,
|
|
1155
|
+
path,
|
|
1156
|
+
transform
|
|
1157
|
+
}
|
|
1158
|
+
);
|
|
1159
|
+
}
|
|
1160
|
+
function directionToTransform(direction) {
|
|
1161
|
+
switch (direction) {
|
|
1162
|
+
case "up" /* Up */:
|
|
1163
|
+
return "rotate(270 12 12)";
|
|
1164
|
+
case "down" /* Down */:
|
|
1165
|
+
return "rotate(90 12 12)";
|
|
1166
|
+
case "left" /* Left */:
|
|
1167
|
+
return "rotate(180 12 12)";
|
|
1168
|
+
case "right" /* Right */:
|
|
1169
|
+
return void 0;
|
|
1170
|
+
default:
|
|
1171
|
+
return unreachable(direction);
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
// src/components/CarouselButton/index.tsx
|
|
1176
|
+
import { applyEffect as applyEffect2 } from "@charcoal-ui/utils";
|
|
1177
|
+
function CarouselButton({
|
|
1178
|
+
direction,
|
|
1179
|
+
show,
|
|
1180
|
+
offset = 0,
|
|
1181
|
+
padding = 0,
|
|
1182
|
+
bottomOffset: bottom = 0,
|
|
1183
|
+
gradient = false,
|
|
1184
|
+
onClick
|
|
1185
|
+
}) {
|
|
1186
|
+
const offsetStyle = direction === "left" /* Left */ ? {
|
|
1187
|
+
left: gradient ? offset - 72 : offset,
|
|
1188
|
+
paddingLeft: Math.max(padding, 0),
|
|
1189
|
+
paddingBottom: bottom
|
|
1190
|
+
} : {
|
|
1191
|
+
right: gradient ? offset - 72 : offset,
|
|
1192
|
+
paddingRight: Math.max(padding, 0),
|
|
1193
|
+
paddingBottom: bottom
|
|
1194
|
+
};
|
|
1195
|
+
return /* @__PURE__ */ React11.createElement(
|
|
1196
|
+
Button,
|
|
1197
|
+
{
|
|
1198
|
+
type: "button",
|
|
1199
|
+
onClick,
|
|
1200
|
+
hide: !show,
|
|
1201
|
+
style: offsetStyle,
|
|
1202
|
+
css: onlyNonTouchDevice
|
|
1203
|
+
},
|
|
1204
|
+
/* @__PURE__ */ React11.createElement(CarouselButtonIcon, null, /* @__PURE__ */ React11.createElement(
|
|
1205
|
+
NextIcon,
|
|
1206
|
+
{
|
|
1207
|
+
direction: direction === "right" /* Right */ ? "right" /* Right */ : direction === "left" /* Left */ ? "left" /* Left */ : unreachable()
|
|
1208
|
+
}
|
|
1209
|
+
))
|
|
1210
|
+
);
|
|
1211
|
+
}
|
|
1212
|
+
var CAROUSEL_BUTTON_SIZE = 40;
|
|
1213
|
+
var CarouselButtonIcon = styled12.div`
|
|
1214
|
+
display: flex;
|
|
1215
|
+
align-items: center;
|
|
1216
|
+
justify-content: center;
|
|
1217
|
+
width: ${CAROUSEL_BUTTON_SIZE}px;
|
|
1218
|
+
height: ${CAROUSEL_BUTTON_SIZE}px;
|
|
1219
|
+
border-radius: 50%;
|
|
1220
|
+
background-color: ${({ theme: theme2 }) => theme2.color.surface4};
|
|
1221
|
+
transition: 0.4s visibility, 0.4s opacity, 0.2s background-color, 0.2s color;
|
|
1222
|
+
color: ${({ theme: theme2 }) => theme2.color.text5};
|
|
1223
|
+
`;
|
|
1224
|
+
var Button = styled12.button`
|
|
1225
|
+
position: absolute;
|
|
1226
|
+
top: 0;
|
|
1227
|
+
bottom: 0;
|
|
1228
|
+
display: flex;
|
|
1229
|
+
align-items: center;
|
|
1230
|
+
padding: 0;
|
|
1231
|
+
min-width: 40px;
|
|
1232
|
+
border: none;
|
|
1233
|
+
outline: 0;
|
|
1234
|
+
background: transparent;
|
|
1235
|
+
cursor: pointer;
|
|
1236
|
+
transition: 0.4s visibility, 0.4s opacity;
|
|
1237
|
+
/* つらい */
|
|
1238
|
+
/* このコンポーネントはCarouselでしか使われてないのでそっちでコンテキストで切る */
|
|
1239
|
+
z-index: 1;
|
|
1240
|
+
|
|
1241
|
+
&:hover ${CarouselButtonIcon} {
|
|
1242
|
+
background-color: ${({ theme: theme2 }) => applyEffect2(theme2.color.surface4, theme2.effect.hover)};
|
|
1243
|
+
color: ${({ theme: theme2 }) => applyEffect2(theme2.color.text5, theme2.effect.hover)};
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
&:active ${CarouselButtonIcon} {
|
|
1247
|
+
background-color: ${({ theme: theme2 }) => applyEffect2(theme2.color.surface4, theme2.effect.press)};
|
|
1248
|
+
color: ${({ theme: theme2 }) => applyEffect2(theme2.color.text5, theme2.effect.press)};
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
${(p) => p.hide && css8`
|
|
1252
|
+
visibility: hidden;
|
|
1253
|
+
opacity: 0;
|
|
1254
|
+
pointer-events: none;
|
|
1255
|
+
`}
|
|
1256
|
+
`;
|
|
1257
|
+
var ScrollHintIcon = styled12(CarouselButtonIcon)`
|
|
1258
|
+
cursor: pointer;
|
|
1259
|
+
|
|
1260
|
+
&:hover {
|
|
1261
|
+
background-color: ${({ theme: theme2 }) => applyEffect2(theme2.color.surface4, theme2.effect.hover)};
|
|
1262
|
+
color: ${({ theme: theme2 }) => applyEffect2(theme2.color.text5, theme2.effect.hover)};
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
&:active {
|
|
1266
|
+
background-color: ${({ theme: theme2 }) => applyEffect2(theme2.color.surface4, theme2.effect.press)};
|
|
1267
|
+
color: ${({ theme: theme2 }) => applyEffect2(theme2.color.text5, theme2.effect.press)};
|
|
1268
|
+
}
|
|
1269
|
+
`;
|
|
1270
|
+
var onlyNonTouchDevice = css8`
|
|
1271
|
+
@media (hover: none) and (pointer: coarse) {
|
|
1272
|
+
display: none;
|
|
1273
|
+
}
|
|
1274
|
+
`;
|
|
1275
|
+
|
|
1276
|
+
// src/components/Carousel/index.tsx
|
|
1277
|
+
var GRADIENT_WIDTH = 72;
|
|
1278
|
+
var SCROLL_AMOUNT_COEF = 0.75;
|
|
1279
|
+
function Carousel({
|
|
1280
|
+
buttonOffset = 0,
|
|
1281
|
+
buttonPadding = 16,
|
|
1282
|
+
bottomOffset = 0,
|
|
1283
|
+
defaultScroll: { align = "left", offset: scrollOffset = 0 } = {},
|
|
1284
|
+
onScroll,
|
|
1285
|
+
onResize,
|
|
1286
|
+
children,
|
|
1287
|
+
centerItems,
|
|
1288
|
+
onScrollStateChange,
|
|
1289
|
+
scrollAmountCoef = SCROLL_AMOUNT_COEF,
|
|
1290
|
+
...options
|
|
1291
|
+
}) {
|
|
1292
|
+
const [scrollLeft, setScrollLeft] = useDebounceAnimationState(0);
|
|
1293
|
+
const animation = useRef3(false);
|
|
1294
|
+
const [maxScrollLeft, setMaxScrollLeft] = useState2(0);
|
|
1295
|
+
const [leftShow, setLeftShow] = useState2(false);
|
|
1296
|
+
const [rightShow, setRightShow] = useState2(false);
|
|
1297
|
+
const [styles, set] = useSpring(() => ({ scroll: 0 }));
|
|
1298
|
+
const ref = useRef3(null);
|
|
1299
|
+
const visibleAreaRef = useRef3(null);
|
|
1300
|
+
const innerRef = useRef3(null);
|
|
1301
|
+
const handleRight = useCallback2(() => {
|
|
1302
|
+
if (visibleAreaRef.current === null) {
|
|
1303
|
+
return;
|
|
1304
|
+
}
|
|
1305
|
+
const { clientWidth } = visibleAreaRef.current;
|
|
1306
|
+
const scroll = Math.min(
|
|
1307
|
+
scrollLeft + clientWidth * scrollAmountCoef,
|
|
1308
|
+
maxScrollLeft
|
|
1309
|
+
);
|
|
1310
|
+
setScrollLeft(scroll, true);
|
|
1311
|
+
set({ scroll, from: { scroll: scrollLeft }, reset: !animation.current });
|
|
1312
|
+
animation.current = true;
|
|
1313
|
+
}, [
|
|
1314
|
+
animation,
|
|
1315
|
+
maxScrollLeft,
|
|
1316
|
+
scrollLeft,
|
|
1317
|
+
set,
|
|
1318
|
+
scrollAmountCoef,
|
|
1319
|
+
setScrollLeft
|
|
1320
|
+
]);
|
|
1321
|
+
const handleLeft = useCallback2(() => {
|
|
1322
|
+
if (visibleAreaRef.current === null) {
|
|
1323
|
+
return;
|
|
1324
|
+
}
|
|
1325
|
+
const { clientWidth } = visibleAreaRef.current;
|
|
1326
|
+
const scroll = Math.max(scrollLeft - clientWidth * scrollAmountCoef, 0);
|
|
1327
|
+
setScrollLeft(scroll, true);
|
|
1328
|
+
set({ scroll, from: { scroll: scrollLeft }, reset: !animation.current });
|
|
1329
|
+
animation.current = true;
|
|
1330
|
+
}, [animation, scrollLeft, set, scrollAmountCoef, setScrollLeft]);
|
|
1331
|
+
useEffect2(() => {
|
|
1332
|
+
const newleftShow = scrollLeft > 0;
|
|
1333
|
+
const newrightShow = scrollLeft < maxScrollLeft && maxScrollLeft > 0;
|
|
1334
|
+
if (newleftShow !== leftShow || newrightShow !== rightShow) {
|
|
1335
|
+
setLeftShow(newleftShow);
|
|
1336
|
+
setRightShow(newrightShow);
|
|
1337
|
+
onScrollStateChange?.(newleftShow || newrightShow);
|
|
1338
|
+
}
|
|
1339
|
+
}, [leftShow, maxScrollLeft, onScrollStateChange, rightShow, scrollLeft]);
|
|
1340
|
+
const handleScroll = useCallback2(() => {
|
|
1341
|
+
if (ref.current === null) {
|
|
1342
|
+
return;
|
|
1343
|
+
}
|
|
1344
|
+
if (animation.current) {
|
|
1345
|
+
styles.scroll.stop();
|
|
1346
|
+
animation.current = false;
|
|
1347
|
+
}
|
|
1348
|
+
const manualScrollLeft = ref.current.scrollLeft;
|
|
1349
|
+
setScrollLeft(manualScrollLeft);
|
|
1350
|
+
}, [animation, setScrollLeft, styles]);
|
|
1351
|
+
const handleResize = useCallback2(() => {
|
|
1352
|
+
if (ref.current === null) {
|
|
1353
|
+
return;
|
|
1354
|
+
}
|
|
1355
|
+
const { clientWidth, scrollWidth } = ref.current;
|
|
1356
|
+
const newMaxScrollLeft = scrollWidth - clientWidth;
|
|
1357
|
+
setMaxScrollLeft(newMaxScrollLeft);
|
|
1358
|
+
if (onResize) {
|
|
1359
|
+
onResize(clientWidth);
|
|
1360
|
+
}
|
|
1361
|
+
}, [onResize]);
|
|
1362
|
+
useIsomorphicLayoutEffect(() => {
|
|
1363
|
+
const elm = ref.current;
|
|
1364
|
+
const innerElm = innerRef.current;
|
|
1365
|
+
if (elm === null || innerElm === null) {
|
|
1366
|
+
return;
|
|
1367
|
+
}
|
|
1368
|
+
elm.addEventListener(
|
|
1369
|
+
"wheel",
|
|
1370
|
+
handleScroll,
|
|
1371
|
+
passiveEvents() && { passive: true }
|
|
1372
|
+
);
|
|
1373
|
+
const resizeObserver = new ResizeObserver(handleResize);
|
|
1374
|
+
resizeObserver.observe(elm);
|
|
1375
|
+
const resizeObserverInner = new ResizeObserver(handleResize);
|
|
1376
|
+
resizeObserverInner.observe(innerElm);
|
|
1377
|
+
return () => {
|
|
1378
|
+
elm.removeEventListener("wheel", handleScroll);
|
|
1379
|
+
resizeObserver.disconnect();
|
|
1380
|
+
resizeObserverInner.disconnect();
|
|
1381
|
+
};
|
|
1382
|
+
}, [handleResize, handleScroll]);
|
|
1383
|
+
useIsomorphicLayoutEffect(() => {
|
|
1384
|
+
if (align !== "left" || scrollOffset !== 0) {
|
|
1385
|
+
const scroll = ref.current;
|
|
1386
|
+
if (scroll !== null) {
|
|
1387
|
+
const scrollLength = Math.max(
|
|
1388
|
+
0,
|
|
1389
|
+
Math.min(
|
|
1390
|
+
align === "left" && scrollOffset > 0 ? scrollOffset : align === "center" ? maxScrollLeft / 2 + scrollOffset : align === "right" && scrollOffset <= maxScrollLeft ? maxScrollLeft - scrollOffset / 2 : 0,
|
|
1391
|
+
maxScrollLeft
|
|
1392
|
+
)
|
|
1393
|
+
);
|
|
1394
|
+
scroll.scrollLeft = scrollLength;
|
|
1395
|
+
setScrollLeft(scrollLength, true);
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
}, [ref.current]);
|
|
1399
|
+
const handleScrollMove = useCallback2(() => {
|
|
1400
|
+
if (ref.current === null) {
|
|
1401
|
+
return;
|
|
1402
|
+
}
|
|
1403
|
+
if (onScroll) {
|
|
1404
|
+
onScroll(ref.current.scrollLeft);
|
|
1405
|
+
}
|
|
1406
|
+
}, [onScroll]);
|
|
1407
|
+
const [disableGradient, setDisableGradient] = useState2(false);
|
|
1408
|
+
useIsomorphicLayoutEffect(() => {
|
|
1409
|
+
if (isEdge()) {
|
|
1410
|
+
setDisableGradient(true);
|
|
1411
|
+
}
|
|
1412
|
+
}, []);
|
|
1413
|
+
if (!disableGradient && options.hasGradient === true) {
|
|
1414
|
+
const fadeInGradient = options.fadeInGradient ?? false;
|
|
1415
|
+
const overflowGradient = !fadeInGradient;
|
|
1416
|
+
return /* @__PURE__ */ React12.createElement(Container3, { ref: visibleAreaRef }, /* @__PURE__ */ React12.createElement(GradientContainer, { fadeInGradient }, /* @__PURE__ */ React12.createElement(RightGradient, null, /* @__PURE__ */ React12.createElement(LeftGradient, { show: overflowGradient || scrollLeft > 0 }, /* @__PURE__ */ React12.createElement(
|
|
1417
|
+
ScrollArea,
|
|
1418
|
+
{
|
|
1419
|
+
ref,
|
|
1420
|
+
scrollLeft: styles.scroll,
|
|
1421
|
+
onScroll: handleScrollMove
|
|
1422
|
+
},
|
|
1423
|
+
/* @__PURE__ */ React12.createElement(CarouselContainer, { ref: innerRef, centerItems }, children)
|
|
1424
|
+
)))), /* @__PURE__ */ React12.createElement(ButtonsContainer, null, /* @__PURE__ */ React12.createElement(
|
|
1425
|
+
CarouselButton,
|
|
1426
|
+
{
|
|
1427
|
+
direction: "left" /* Left */,
|
|
1428
|
+
show: leftShow,
|
|
1429
|
+
offset: buttonOffset,
|
|
1430
|
+
bottomOffset,
|
|
1431
|
+
padding: buttonPadding,
|
|
1432
|
+
gradient: overflowGradient,
|
|
1433
|
+
onClick: handleLeft
|
|
1434
|
+
}
|
|
1435
|
+
), /* @__PURE__ */ React12.createElement(
|
|
1436
|
+
CarouselButton,
|
|
1437
|
+
{
|
|
1438
|
+
direction: "right" /* Right */,
|
|
1439
|
+
show: rightShow,
|
|
1440
|
+
offset: buttonOffset,
|
|
1441
|
+
bottomOffset,
|
|
1442
|
+
padding: buttonPadding,
|
|
1443
|
+
gradient: true,
|
|
1444
|
+
onClick: handleRight
|
|
1445
|
+
}
|
|
1446
|
+
)));
|
|
1447
|
+
}
|
|
1448
|
+
return /* @__PURE__ */ React12.createElement(Container3, { ref: visibleAreaRef }, /* @__PURE__ */ React12.createElement(
|
|
1449
|
+
ScrollArea,
|
|
1450
|
+
{
|
|
1451
|
+
ref,
|
|
1452
|
+
scrollLeft: styles.scroll,
|
|
1453
|
+
onScroll: handleScrollMove
|
|
1454
|
+
},
|
|
1455
|
+
/* @__PURE__ */ React12.createElement(CarouselContainer, { ref: innerRef, centerItems }, children)
|
|
1456
|
+
), /* @__PURE__ */ React12.createElement(ButtonsContainer, null, /* @__PURE__ */ React12.createElement(
|
|
1457
|
+
CarouselButton,
|
|
1458
|
+
{
|
|
1459
|
+
direction: "left" /* Left */,
|
|
1460
|
+
show: leftShow,
|
|
1461
|
+
offset: buttonOffset,
|
|
1462
|
+
bottomOffset,
|
|
1463
|
+
padding: buttonPadding,
|
|
1464
|
+
onClick: handleLeft
|
|
1465
|
+
}
|
|
1466
|
+
), /* @__PURE__ */ React12.createElement(
|
|
1467
|
+
CarouselButton,
|
|
1468
|
+
{
|
|
1469
|
+
direction: "right" /* Right */,
|
|
1470
|
+
show: rightShow,
|
|
1471
|
+
offset: buttonOffset,
|
|
1472
|
+
bottomOffset,
|
|
1473
|
+
padding: buttonPadding,
|
|
1474
|
+
onClick: handleRight
|
|
1475
|
+
}
|
|
1476
|
+
)));
|
|
1477
|
+
}
|
|
1478
|
+
var CarouselContainer = styled13.ul`
|
|
1479
|
+
vertical-align: top;
|
|
1480
|
+
overflow: hidden;
|
|
1481
|
+
list-style: none;
|
|
1482
|
+
padding: 0;
|
|
1483
|
+
|
|
1484
|
+
/* 最小幅を100%にして親要素にぴったりくっつけることで子要素で要素を均等に割り付けるなどを出来るようにしてある */
|
|
1485
|
+
min-width: 100%;
|
|
1486
|
+
box-sizing: border-box;
|
|
1487
|
+
|
|
1488
|
+
${({ centerItems = false }) => centerItems ? css9`
|
|
1489
|
+
display: flex;
|
|
1490
|
+
width: max-content;
|
|
1491
|
+
margin: 0 auto;
|
|
1492
|
+
` : css9`
|
|
1493
|
+
display: inline-flex;
|
|
1494
|
+
margin: 0;
|
|
1495
|
+
`}
|
|
1496
|
+
`;
|
|
1497
|
+
var ButtonsContainer = styled13.div`
|
|
1498
|
+
opacity: 0;
|
|
1499
|
+
transition: 0.4s opacity;
|
|
1500
|
+
`;
|
|
1501
|
+
var Container3 = styled13.div`
|
|
1502
|
+
&:hover ${ButtonsContainer} {
|
|
1503
|
+
opacity: 1;
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
/* CarouselButtonの中にz-index:1があるのでここでコンテキストを切る */
|
|
1507
|
+
position: relative;
|
|
1508
|
+
z-index: 0;
|
|
1509
|
+
`;
|
|
1510
|
+
var ScrollArea = styled13(animated.div)`
|
|
1511
|
+
overflow-x: auto;
|
|
1512
|
+
padding: 0;
|
|
1513
|
+
margin: 0;
|
|
1514
|
+
|
|
1515
|
+
&::-webkit-scrollbar {
|
|
1516
|
+
display: none;
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
scrollbar-width: none;
|
|
1520
|
+
`;
|
|
1521
|
+
var GradientContainer = styled13.div`
|
|
1522
|
+
/* NOTE: LeftGradientがはみ出るためhidden */
|
|
1523
|
+
overflow: hidden;
|
|
1524
|
+
${(p) => !p.fadeInGradient && css9`
|
|
1525
|
+
margin-left: ${-GRADIENT_WIDTH}px;
|
|
1526
|
+
${CarouselContainer} {
|
|
1527
|
+
padding-left: ${GRADIENT_WIDTH}px;
|
|
1528
|
+
}
|
|
1529
|
+
`}
|
|
1530
|
+
|
|
1531
|
+
margin-right: ${-GRADIENT_WIDTH}px;
|
|
1532
|
+
/* stylelint-disable-next-line no-duplicate-selectors */
|
|
1533
|
+
${CarouselContainer} {
|
|
1534
|
+
padding-right: ${GRADIENT_WIDTH}px;
|
|
1535
|
+
}
|
|
1536
|
+
`;
|
|
1537
|
+
var RightGradient = styled13.div`
|
|
1538
|
+
mask-image: linear-gradient(
|
|
1539
|
+
to right,
|
|
1540
|
+
#000 calc(100% - ${GRADIENT_WIDTH}px),
|
|
1541
|
+
transparent
|
|
1542
|
+
);
|
|
1543
|
+
`;
|
|
1544
|
+
var LeftGradient = styled13.div`
|
|
1545
|
+
/* NOTE: mask-position が left → negative px の時、right → abs(negative px) の位置に表示されるため */
|
|
1546
|
+
margin-right: ${-GRADIENT_WIDTH}px;
|
|
1547
|
+
padding-right: ${GRADIENT_WIDTH}px;
|
|
1548
|
+
/* NOTE: mask-position に transition をつけたいが vender prefixes 対策で all につける */
|
|
1549
|
+
transition: 0.2s all ease-in;
|
|
1550
|
+
mask: linear-gradient(to right, transparent, #000 ${GRADIENT_WIDTH}px)
|
|
1551
|
+
${(p) => p.show ? 0 : -GRADIENT_WIDTH}px 0;
|
|
1552
|
+
`;
|
|
1553
|
+
|
|
1554
|
+
// src/components/Pager/index.tsx
|
|
1555
|
+
import React15, { useCallback as useCallback3, useDebugValue as useDebugValue2, useMemo as useMemo2 } from "react";
|
|
1556
|
+
import styled16, { css as css10 } from "styled-components";
|
|
1557
|
+
import warning from "warning";
|
|
1558
|
+
|
|
1559
|
+
// src/components/icons/DotsIcon.tsx
|
|
1560
|
+
import React13 from "react";
|
|
1561
|
+
import styled14 from "styled-components";
|
|
1562
|
+
function DotsIcon({ size: size3 }) {
|
|
1563
|
+
return /* @__PURE__ */ React13.createElement(StyledSVG, { viewBox: "0 0 20 6", width: size3, height: size3 }, /* @__PURE__ */ React13.createElement(
|
|
1564
|
+
"path",
|
|
1565
|
+
{
|
|
1566
|
+
fillRule: "evenodd",
|
|
1567
|
+
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
|
|
1568
|
+
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
|
|
1569
|
+
C10.6192881,14.5 9.5,13.3807119 9.5,12 C9.5,10.6192881 10.6192881,9.5 12,9.5
|
|
1570
|
+
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
|
|
1571
|
+
C17.6192881,14.5 16.5,13.3807119 16.5,12 C16.5,10.6192881 17.6192881,9.5 19,9.5
|
|
1572
|
+
C20.3807119,9.5 21.5,10.6192881 21.5,12 C21.5,13.3807119 20.3807119,14.5 19,14.5 Z`,
|
|
1573
|
+
transform: "translate(-2 -9)"
|
|
1574
|
+
}
|
|
1575
|
+
));
|
|
1576
|
+
}
|
|
1577
|
+
DotsIcon.defaultProps = {
|
|
1578
|
+
size: 16
|
|
1579
|
+
};
|
|
1580
|
+
var StyledSVG = styled14.svg`
|
|
1581
|
+
fill: currentColor;
|
|
1582
|
+
`;
|
|
1583
|
+
|
|
1584
|
+
// src/components/icons/WedgeIcon.tsx
|
|
1585
|
+
import React14 from "react";
|
|
1586
|
+
import styled15 from "styled-components";
|
|
1587
|
+
function WedgeIcon({ size: size3, direction }) {
|
|
1588
|
+
return /* @__PURE__ */ React14.createElement("svg", { viewBox: "0 0 10 8", width: size3, height: size3 }, /* @__PURE__ */ React14.createElement(
|
|
1589
|
+
StyledPolyline,
|
|
1590
|
+
{
|
|
1591
|
+
strokeWidth: "2",
|
|
1592
|
+
points: "1,2 5,6 9,2",
|
|
1593
|
+
transform: directionToTransform2(direction)
|
|
1594
|
+
}
|
|
1595
|
+
));
|
|
1596
|
+
}
|
|
1597
|
+
WedgeIcon.defaultProps = {
|
|
1598
|
+
size: 16,
|
|
1599
|
+
white: false,
|
|
1600
|
+
lightGray: false
|
|
1601
|
+
};
|
|
1602
|
+
function directionToTransform2(direction) {
|
|
1603
|
+
switch (direction) {
|
|
1604
|
+
case "up" /* Up */:
|
|
1605
|
+
return "rotate(180 5 4)";
|
|
1606
|
+
case "down" /* Down */:
|
|
1607
|
+
return void 0;
|
|
1608
|
+
case "left" /* Left */:
|
|
1609
|
+
return "rotate(90 5 4)";
|
|
1610
|
+
case "right" /* Right */:
|
|
1611
|
+
return "rotate(-90 5 4)";
|
|
1612
|
+
default:
|
|
1613
|
+
return unreachable(direction);
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
var StyledPolyline = styled15.polyline`
|
|
1617
|
+
fill: none;
|
|
1618
|
+
stroke-linejoin: round;
|
|
1619
|
+
stroke-linecap: round;
|
|
1620
|
+
stroke: currentColor;
|
|
1621
|
+
`;
|
|
1622
|
+
|
|
1623
|
+
// src/components/Pager/index.tsx
|
|
1624
|
+
import { useComponentAbstraction as useComponentAbstraction4 } from "@charcoal-ui/react";
|
|
1625
|
+
function usePagerWindow(page, pageCount, windowSize = 7) {
|
|
1626
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1627
|
+
warning((page | 0) === page, `\`page\` must be interger (${page})`);
|
|
1628
|
+
warning(
|
|
1629
|
+
(pageCount | 0) === pageCount,
|
|
1630
|
+
`\`pageCount\` must be interger (${pageCount})`
|
|
1631
|
+
);
|
|
1632
|
+
}
|
|
1633
|
+
const window2 = useMemo2(() => {
|
|
1634
|
+
const visibleFirstPage = 1;
|
|
1635
|
+
const visibleLastPage = Math.min(
|
|
1636
|
+
pageCount,
|
|
1637
|
+
Math.max(page + Math.floor(windowSize / 2), windowSize)
|
|
1638
|
+
);
|
|
1639
|
+
if (visibleLastPage <= windowSize) {
|
|
1640
|
+
return Array.from(
|
|
1641
|
+
{ length: 1 + visibleLastPage - visibleFirstPage },
|
|
1642
|
+
(_, i) => visibleFirstPage + i
|
|
1643
|
+
);
|
|
1644
|
+
} else {
|
|
1645
|
+
const start = visibleLastPage - (windowSize - 1) + 2;
|
|
1646
|
+
return [
|
|
1647
|
+
visibleFirstPage,
|
|
1648
|
+
"...",
|
|
1649
|
+
...Array.from(
|
|
1650
|
+
{ length: 1 + visibleLastPage - start },
|
|
1651
|
+
(_, i) => start + i
|
|
1652
|
+
)
|
|
1653
|
+
];
|
|
1654
|
+
}
|
|
1655
|
+
}, [page, pageCount, windowSize]);
|
|
1656
|
+
useDebugValue2(window2);
|
|
1657
|
+
return window2;
|
|
1658
|
+
}
|
|
1659
|
+
var Pager_default = React15.memo(function Pager({
|
|
1660
|
+
page,
|
|
1661
|
+
pageCount,
|
|
1662
|
+
onChange
|
|
1663
|
+
}) {
|
|
1664
|
+
const window2 = usePagerWindow(page, pageCount);
|
|
1665
|
+
const makeClickHandler = useCallback3(
|
|
1666
|
+
(value) => () => {
|
|
1667
|
+
onChange(value);
|
|
1668
|
+
},
|
|
1669
|
+
[onChange]
|
|
1670
|
+
);
|
|
1671
|
+
const hasNext = page < pageCount;
|
|
1672
|
+
const hasPrev = page > 1;
|
|
1673
|
+
return /* @__PURE__ */ React15.createElement(PagerContainer, null, /* @__PURE__ */ React15.createElement(
|
|
1674
|
+
CircleButton,
|
|
1675
|
+
{
|
|
1676
|
+
type: "button",
|
|
1677
|
+
hidden: !hasPrev,
|
|
1678
|
+
disabled: !hasPrev,
|
|
1679
|
+
onClick: makeClickHandler(Math.max(1, page - 1)),
|
|
1680
|
+
noBackground: true
|
|
1681
|
+
},
|
|
1682
|
+
/* @__PURE__ */ React15.createElement(WedgeIcon, { size: 16, direction: "left" /* Left */ })
|
|
1683
|
+
), window2.map(
|
|
1684
|
+
(p) => p === "..." ? /* @__PURE__ */ React15.createElement(Spacer, { key: p }, /* @__PURE__ */ React15.createElement(DotsIcon, { size: 20 })) : p === page ? /* @__PURE__ */ React15.createElement(CircleButton, { key: p, type: "button", "aria-current": true }, /* @__PURE__ */ React15.createElement(Text3, null, p)) : /* @__PURE__ */ React15.createElement(CircleButton, { key: p, type: "button", onClick: makeClickHandler(p) }, /* @__PURE__ */ React15.createElement(Text3, null, p))
|
|
1685
|
+
), /* @__PURE__ */ React15.createElement(
|
|
1686
|
+
CircleButton,
|
|
1687
|
+
{
|
|
1688
|
+
type: "button",
|
|
1689
|
+
hidden: !hasNext,
|
|
1690
|
+
disabled: !hasNext,
|
|
1691
|
+
onClick: makeClickHandler(Math.min(pageCount, page + 1)),
|
|
1692
|
+
noBackground: true
|
|
1693
|
+
},
|
|
1694
|
+
/* @__PURE__ */ React15.createElement(WedgeIcon, { size: 16, direction: "right" /* Right */ })
|
|
1695
|
+
));
|
|
1696
|
+
});
|
|
1697
|
+
function LinkPager({ page, pageCount, makeUrl }) {
|
|
1698
|
+
const { Link } = useComponentAbstraction4();
|
|
1699
|
+
const window2 = usePagerWindow(page, pageCount);
|
|
1700
|
+
const hasNext = page < pageCount;
|
|
1701
|
+
const hasPrev = page > 1;
|
|
1702
|
+
return /* @__PURE__ */ React15.createElement(PagerContainer, null, /* @__PURE__ */ React15.createElement(Link, { to: makeUrl(Math.max(1, page - 1)) }, /* @__PURE__ */ React15.createElement(CircleButton, { hidden: !hasPrev, "aria-disabled": !hasPrev, noBackground: true }, /* @__PURE__ */ React15.createElement(WedgeIcon, { size: 16, direction: "left" /* Left */ }))), window2.map(
|
|
1703
|
+
(p) => p === "..." ? /* @__PURE__ */ React15.createElement(Spacer, { key: p }, /* @__PURE__ */ React15.createElement(DotsIcon, { size: 20, subLink: true })) : p === page ? /* @__PURE__ */ React15.createElement(CircleButton, { key: p, type: "button", "aria-current": true }, /* @__PURE__ */ React15.createElement(Text3, null, p)) : /* @__PURE__ */ React15.createElement(Link, { key: p, to: makeUrl(p) }, /* @__PURE__ */ React15.createElement(CircleButton, { type: "button" }, /* @__PURE__ */ React15.createElement(Text3, null, p)))
|
|
1704
|
+
), /* @__PURE__ */ React15.createElement(Link, { to: makeUrl(Math.min(pageCount, page + 1)) }, /* @__PURE__ */ React15.createElement(CircleButton, { hidden: !hasNext, "aria-disabled": !hasNext, noBackground: true }, /* @__PURE__ */ React15.createElement(WedgeIcon, { size: 16, direction: "right" /* Right */ }))));
|
|
1705
|
+
}
|
|
1706
|
+
var PagerContainer = styled16.nav`
|
|
1707
|
+
display: flex;
|
|
1708
|
+
justify-content: center;
|
|
1709
|
+
align-items: center;
|
|
1710
|
+
`;
|
|
1711
|
+
var CircleButton = styled16.button`
|
|
1712
|
+
font-size: 1rem;
|
|
1713
|
+
line-height: calc(1em + 8px);
|
|
1714
|
+
text-decoration: none;
|
|
1715
|
+
border: none;
|
|
1716
|
+
outline: none;
|
|
1717
|
+
touch-action: manipulation;
|
|
1718
|
+
user-select: none;
|
|
1719
|
+
transition: box-shadow 0.2s ease 0s, color 0.2s ease 0s,
|
|
1720
|
+
background 0.2s ease 0s, opacity 0.2s ease 0s;
|
|
1721
|
+
|
|
1722
|
+
display: flex;
|
|
1723
|
+
justify-content: center;
|
|
1724
|
+
align-items: center;
|
|
1725
|
+
box-sizing: content-box;
|
|
1726
|
+
min-width: 24px;
|
|
1727
|
+
min-height: 24px;
|
|
1728
|
+
padding: 8px;
|
|
1729
|
+
cursor: pointer;
|
|
1730
|
+
font-weight: bold;
|
|
1731
|
+
/* HACK:
|
|
1732
|
+
* Safari doesn't correctly repaint the elements when they're reordered in response to interaction.
|
|
1733
|
+
* This forces it to repaint them. This doesn't work if put on the parents either, has to be here.
|
|
1734
|
+
*/
|
|
1735
|
+
/* stylelint-disable-next-line property-no-vendor-prefix */
|
|
1736
|
+
-webkit-transform: translateZ(0);
|
|
1737
|
+
|
|
1738
|
+
&[hidden] {
|
|
1739
|
+
visibility: hidden;
|
|
1740
|
+
display: block;
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
border-radius: 48px;
|
|
1744
|
+
|
|
1745
|
+
background: transparent;
|
|
1746
|
+
color: ${({ theme: theme2 }) => theme2.color.text3};
|
|
1747
|
+
|
|
1748
|
+
&:hover {
|
|
1749
|
+
background: ${({ theme: theme2 }) => theme2.color.surface3};
|
|
1750
|
+
color: ${({ theme: theme2 }) => theme2.color.text2};
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
&[aria-current] {
|
|
1754
|
+
background-color: ${({ theme: theme2 }) => theme2.color.surface6};
|
|
1755
|
+
color: ${({ theme: theme2 }) => theme2.color.text5};
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1758
|
+
&[aria-current]:hover {
|
|
1759
|
+
background-color: ${({ theme: theme2 }) => theme2.color.surface6};
|
|
1760
|
+
color: ${({ theme: theme2 }) => theme2.color.text5};
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
${({ noBackground = false }) => noBackground && css10`
|
|
1764
|
+
/* stylelint-disable-next-line no-duplicate-selectors */
|
|
1765
|
+
&:hover {
|
|
1766
|
+
background: transparent;
|
|
1767
|
+
}
|
|
1768
|
+
`}
|
|
1769
|
+
`;
|
|
1770
|
+
var Spacer = styled16(CircleButton).attrs({ type: "button", disabled: true })`
|
|
1771
|
+
&& {
|
|
1772
|
+
color: ${({ theme: theme2 }) => theme2.color.text3};
|
|
1773
|
+
background: none;
|
|
1774
|
+
}
|
|
1775
|
+
`;
|
|
1776
|
+
var Text3 = "span";
|
|
1777
|
+
export {
|
|
1778
|
+
CancelLayoutItemBodyPadding,
|
|
1779
|
+
Carousel,
|
|
1780
|
+
ComponentAbstraction,
|
|
1781
|
+
Filter_default as Filter,
|
|
1782
|
+
FilterButton,
|
|
1783
|
+
FilterIconButton,
|
|
1784
|
+
FilterLink,
|
|
1785
|
+
HintText,
|
|
1786
|
+
LAYOUT_ITEM_BODY_PADDING,
|
|
1787
|
+
Layout,
|
|
1788
|
+
LayoutItem,
|
|
1789
|
+
LayoutItemBody,
|
|
1790
|
+
LayoutItemHeader,
|
|
1791
|
+
LeftMenu,
|
|
1792
|
+
LeftMenuContent,
|
|
1793
|
+
LinkPager,
|
|
1794
|
+
MAIN_COLUMN_HORIZONTAL_MIN_MARGIN,
|
|
1795
|
+
MenuListItem,
|
|
1796
|
+
MenuListItemContext,
|
|
1797
|
+
MenuListItemWithIcon,
|
|
1798
|
+
MenuListLabel,
|
|
1799
|
+
MenuListLinkItem,
|
|
1800
|
+
MenuListLinkItemWithIcon,
|
|
1801
|
+
MenuListSpacer,
|
|
1802
|
+
Pager_default as Pager,
|
|
1803
|
+
RESPONSIVE_LEFT_WIDTH,
|
|
1804
|
+
RESPONSIVE_MAIN_MAX_WIDTH,
|
|
1805
|
+
StyledCancelLayoutItemBodyPadding,
|
|
1806
|
+
StyledLayoutItemBody,
|
|
1807
|
+
SwitchCheckbox_default as SwitchCheckbox,
|
|
1808
|
+
TextEllipsis,
|
|
1809
|
+
WithIcon_default as WithIcon,
|
|
1810
|
+
useComponentAbstraction5 as useComponentAbstraction,
|
|
1811
|
+
useElementSize,
|
|
1812
|
+
useLayoutItemBodyPadding,
|
|
1813
|
+
useMedia,
|
|
1814
|
+
useMediaScreen1
|
|
1815
|
+
};
|
|
1816
|
+
//# sourceMappingURL=index.esm.js.map
|