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