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