@charcoal-ui/react-sandbox 4.2.1 → 4.3.0-beta.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/components/TextEllipsis/helper.d.ts +2 -2
- package/dist/components/TextEllipsis/helper.d.ts.map +1 -1
- package/dist/components/icons/DotsIcon.d.ts +0 -5
- package/dist/components/icons/DotsIcon.d.ts.map +1 -1
- package/dist/components/icons/WedgeIcon.d.ts +2 -9
- package/dist/components/icons/WedgeIcon.d.ts.map +1 -1
- package/dist/foundation/hooks.d.ts +1 -1
- package/dist/foundation/hooks.d.ts.map +1 -1
- package/dist/index.cjs.js +88 -34
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +87 -36
- package/dist/index.esm.js.map +1 -1
- package/package.json +9 -8
- package/src/components/Carousel/index.story.tsx +34 -0
- package/src/components/Filter/index.story.tsx +22 -0
- package/src/components/Layout/index.story.tsx +17 -0
- package/src/components/LeftMenu/index.story.tsx +22 -0
- package/src/components/Pager/index.story.tsx +17 -0
- package/src/components/SwitchCheckbox/index.story.tsx +13 -0
- package/src/components/TextEllipsis/helper.ts +2 -8
- package/src/components/WithIcon/index.story.tsx +31 -0
- package/src/components/icons/DotsIcon.tsx +1 -4
- package/src/components/icons/WedgeIcon.tsx +1 -6
- package/src/foundation/hooks.ts +4 -2
package/dist/index.esm.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
1
3
|
// src/components/Filter/index.tsx
|
|
2
4
|
import * as React2 from "react";
|
|
3
5
|
import styled, { css } from "styled-components";
|
|
@@ -321,7 +323,7 @@ function useElementSize(ref, deps = []) {
|
|
|
321
323
|
}
|
|
322
324
|
function useDebounceAnimationState(defaultValue) {
|
|
323
325
|
const [state, setState] = useState(defaultValue);
|
|
324
|
-
const timer = useRef();
|
|
326
|
+
const timer = useRef(void 0);
|
|
325
327
|
const setDebounceState = useCallback((value, force = false) => {
|
|
326
328
|
if (force) {
|
|
327
329
|
setState(value);
|
|
@@ -854,7 +856,7 @@ import { useLayoutEffect as useLayoutEffect2, useEffect } from "react";
|
|
|
854
856
|
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect2 : useEffect;
|
|
855
857
|
|
|
856
858
|
// src/components/CarouselButton/index.tsx
|
|
857
|
-
import styled12, { css as css8 } from "styled-components";
|
|
859
|
+
import styled12, { css as css8, default as _styled } from "styled-components";
|
|
858
860
|
|
|
859
861
|
// src/foundation/utils.ts
|
|
860
862
|
function unreachable(value) {
|
|
@@ -907,41 +909,88 @@ function CarouselButton({
|
|
|
907
909
|
paddingRight: Math.max(padding, 0),
|
|
908
910
|
paddingBottom: bottom
|
|
909
911
|
};
|
|
910
|
-
return /* @__PURE__ */ jsx12(_StyledButton, { type: "button", onClick, hide: !show, style: offsetStyle, children: /* @__PURE__ */ jsx12(CarouselButtonIcon, { children: /* @__PURE__ */ jsx12(NextIcon, { direction: direction === "right" /* Right */ ? "right" /* Right */ :
|
|
912
|
+
return /* @__PURE__ */ jsx12(_StyledButton, { type: "button", onClick, hide: !show, style: offsetStyle, children: /* @__PURE__ */ jsx12(CarouselButtonIcon, { children: /* @__PURE__ */ jsx12(NextIcon, { direction: direction === "right" /* Right */ ? "right" /* Right */ : (
|
|
913
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
914
|
+
direction === "left" /* Left */ ? "left" /* Left */ : unreachable()
|
|
915
|
+
) }) }) });
|
|
911
916
|
}
|
|
912
917
|
var CAROUSEL_BUTTON_SIZE = 40;
|
|
913
|
-
var CarouselButtonIcon = styled12.div
|
|
914
|
-
|
|
915
|
-
|
|
918
|
+
var CarouselButtonIcon = styled12.div`
|
|
919
|
+
display: flex;
|
|
920
|
+
align-items: center;
|
|
921
|
+
justify-content: center;
|
|
922
|
+
width: ${CAROUSEL_BUTTON_SIZE}px;
|
|
923
|
+
height: ${CAROUSEL_BUTTON_SIZE}px;
|
|
924
|
+
border-radius: 50%;
|
|
925
|
+
background-color: ${({
|
|
916
926
|
theme: theme2
|
|
917
|
-
}) => theme2.color.surface4
|
|
927
|
+
}) => theme2.color.surface4};
|
|
928
|
+
transition: 0.4s visibility, 0.4s opacity, 0.2s background-color, 0.2s color;
|
|
929
|
+
color: ${({
|
|
918
930
|
theme: theme2
|
|
919
|
-
}) => theme2.color.text5
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
931
|
+
}) => theme2.color.text5};
|
|
932
|
+
`;
|
|
933
|
+
var Button = styled12.button`
|
|
934
|
+
position: absolute;
|
|
935
|
+
top: 0;
|
|
936
|
+
bottom: 0;
|
|
937
|
+
display: flex;
|
|
938
|
+
align-items: center;
|
|
939
|
+
padding: 0;
|
|
940
|
+
min-width: 40px;
|
|
941
|
+
border: none;
|
|
942
|
+
outline: 0;
|
|
943
|
+
background: transparent;
|
|
944
|
+
cursor: pointer;
|
|
945
|
+
transition: 0.4s visibility, 0.4s opacity;
|
|
946
|
+
/* つらい */
|
|
947
|
+
/* このコンポーネントはCarouselでしか使われてないのでそっちでコンテキストで切る */
|
|
948
|
+
z-index: 1;
|
|
949
|
+
|
|
950
|
+
&:hover ${CarouselButtonIcon} {
|
|
951
|
+
background-color: ${({
|
|
923
952
|
theme: theme2
|
|
924
|
-
}) => applyEffect2(theme2.color.surface4, theme2.effect.hover)
|
|
953
|
+
}) => applyEffect2(theme2.color.surface4, theme2.effect.hover)};
|
|
954
|
+
color: ${({
|
|
925
955
|
theme: theme2
|
|
926
|
-
}) => applyEffect2(theme2.color.text5, theme2.effect.hover)
|
|
956
|
+
}) => applyEffect2(theme2.color.text5, theme2.effect.hover)};
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
&:active ${CarouselButtonIcon} {
|
|
960
|
+
background-color: ${({
|
|
927
961
|
theme: theme2
|
|
928
|
-
}) => applyEffect2(theme2.color.surface4, theme2.effect.press)
|
|
962
|
+
}) => applyEffect2(theme2.color.surface4, theme2.effect.press)};
|
|
963
|
+
color: ${({
|
|
929
964
|
theme: theme2
|
|
930
|
-
}) => applyEffect2(theme2.color.text5, theme2.effect.press)
|
|
931
|
-
|
|
932
|
-
|
|
965
|
+
}) => applyEffect2(theme2.color.text5, theme2.effect.press)};
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
${(p) => p.hide && css8(["visibility:hidden;opacity:0;pointer-events:none;"])}
|
|
969
|
+
`;
|
|
970
|
+
var _StyledButton = _styled(Button).withConfig({
|
|
971
|
+
componentId: "ccl__sc-gjlnt0-0"
|
|
933
972
|
})(["", ""], onlyNonTouchDevice);
|
|
934
|
-
var ScrollHintIcon = styled12(CarouselButtonIcon)
|
|
935
|
-
|
|
936
|
-
|
|
973
|
+
var ScrollHintIcon = styled12(CarouselButtonIcon)`
|
|
974
|
+
cursor: pointer;
|
|
975
|
+
|
|
976
|
+
&:hover {
|
|
977
|
+
background-color: ${({
|
|
937
978
|
theme: theme2
|
|
938
|
-
}) => applyEffect2(theme2.color.surface4, theme2.effect.hover)
|
|
979
|
+
}) => applyEffect2(theme2.color.surface4, theme2.effect.hover)};
|
|
980
|
+
color: ${({
|
|
939
981
|
theme: theme2
|
|
940
|
-
}) => applyEffect2(theme2.color.text5, theme2.effect.hover)
|
|
982
|
+
}) => applyEffect2(theme2.color.text5, theme2.effect.hover)};
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
&:active {
|
|
986
|
+
background-color: ${({
|
|
941
987
|
theme: theme2
|
|
942
|
-
}) => applyEffect2(theme2.color.surface4, theme2.effect.press)
|
|
988
|
+
}) => applyEffect2(theme2.color.surface4, theme2.effect.press)};
|
|
989
|
+
color: ${({
|
|
943
990
|
theme: theme2
|
|
944
|
-
}) => applyEffect2(theme2.color.text5, theme2.effect.press)
|
|
991
|
+
}) => applyEffect2(theme2.color.text5, theme2.effect.press)};
|
|
992
|
+
}
|
|
993
|
+
`;
|
|
945
994
|
var onlyNonTouchDevice = css8(["@media (hover:none) and (pointer:coarse){display:none;}"]);
|
|
946
995
|
|
|
947
996
|
// src/components/Carousel/index.tsx
|
|
@@ -1140,7 +1189,7 @@ import warning from "warning";
|
|
|
1140
1189
|
import styled14 from "styled-components";
|
|
1141
1190
|
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
1142
1191
|
function DotsIcon({
|
|
1143
|
-
size: size3
|
|
1192
|
+
size: size3 = 16
|
|
1144
1193
|
}) {
|
|
1145
1194
|
return /* @__PURE__ */ jsx14(StyledSVG, { viewBox: "0 0 20 6", width: size3, height: size3, children: /* @__PURE__ */ jsx14("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
|
|
1146
1195
|
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
|
|
@@ -1149,9 +1198,6 @@ function DotsIcon({
|
|
|
1149
1198
|
C17.6192881,14.5 16.5,13.3807119 16.5,12 C16.5,10.6192881 17.6192881,9.5 19,9.5
|
|
1150
1199
|
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)" }) });
|
|
1151
1200
|
}
|
|
1152
|
-
DotsIcon.defaultProps = {
|
|
1153
|
-
size: 16
|
|
1154
|
-
};
|
|
1155
1201
|
var StyledSVG = styled14.svg.withConfig({
|
|
1156
1202
|
componentId: "ccl__sc-1ma336a-0"
|
|
1157
1203
|
})(["fill:currentColor;"]);
|
|
@@ -1160,16 +1206,14 @@ var StyledSVG = styled14.svg.withConfig({
|
|
|
1160
1206
|
import styled15 from "styled-components";
|
|
1161
1207
|
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1162
1208
|
function WedgeIcon({
|
|
1163
|
-
size: size3,
|
|
1209
|
+
size: size3 = 16,
|
|
1164
1210
|
direction
|
|
1165
1211
|
}) {
|
|
1166
|
-
return
|
|
1212
|
+
return (
|
|
1213
|
+
// NOTE: directionToTransform depends on the value of viewBox
|
|
1214
|
+
/* @__PURE__ */ jsx15("svg", { viewBox: "0 0 10 8", width: size3, height: size3, children: /* @__PURE__ */ jsx15(StyledPolyline, { strokeWidth: "2", points: "1,2 5,6 9,2", transform: directionToTransform2(direction) }) })
|
|
1215
|
+
);
|
|
1167
1216
|
}
|
|
1168
|
-
WedgeIcon.defaultProps = {
|
|
1169
|
-
size: 16,
|
|
1170
|
-
white: false,
|
|
1171
|
-
lightGray: false
|
|
1172
|
-
};
|
|
1173
1217
|
function directionToTransform2(direction) {
|
|
1174
1218
|
switch (direction) {
|
|
1175
1219
|
case "up" /* Up */:
|
|
@@ -1207,7 +1251,10 @@ function usePagerWindow(page, pageCount, pageRangeDisplayed = 7) {
|
|
|
1207
1251
|
} else {
|
|
1208
1252
|
const start = visibleLastPage - (pageRangeDisplayed - 1) + 2;
|
|
1209
1253
|
return [
|
|
1254
|
+
// 表示範囲が1-7ページを超えるなら、
|
|
1255
|
+
// - 1ページ目は固定で表示する
|
|
1210
1256
|
visibleFirstPage,
|
|
1257
|
+
// - 2ページ目から現在のページの直前までは省略する
|
|
1211
1258
|
"...",
|
|
1212
1259
|
...Array.from({
|
|
1213
1260
|
length: 1 + visibleLastPage - start
|
|
@@ -1232,7 +1279,11 @@ var Pager_default = memo2(function Pager({
|
|
|
1232
1279
|
const hasPrev = page > 1;
|
|
1233
1280
|
return /* @__PURE__ */ jsxs8(PagerContainer, { children: [
|
|
1234
1281
|
/* @__PURE__ */ jsx16(CircleButton, { type: "button", hidden: !hasPrev, disabled: !hasPrev, onClick: makeClickHandler(Math.max(1, page - 1)), noBackground: true, children: /* @__PURE__ */ jsx16(WedgeIcon, { size: 16, direction: "left" /* Left */ }) }),
|
|
1235
|
-
window2.map((p) => p === "..." ? /* @__PURE__ */ jsx16(Spacer, { children: /* @__PURE__ */ jsx16(DotsIcon, { size: 20 }) }, p) : p === page ?
|
|
1282
|
+
window2.map((p) => p === "..." ? /* @__PURE__ */ jsx16(Spacer, { children: /* @__PURE__ */ jsx16(DotsIcon, { size: 20 }) }, p) : p === page ? (
|
|
1283
|
+
// we remove the onClick but don't mark it as disabled to preserve keyboard focus
|
|
1284
|
+
// not doing so causes the focus ring to flicker in and out of existence
|
|
1285
|
+
/* @__PURE__ */ jsx16(CircleButton, { type: "button", "aria-current": true, children: /* @__PURE__ */ jsx16(Text3, { children: p }) }, p)
|
|
1286
|
+
) : /* @__PURE__ */ jsx16(CircleButton, { type: "button", onClick: makeClickHandler(p), children: /* @__PURE__ */ jsx16(Text3, { children: p }) }, p)),
|
|
1236
1287
|
/* @__PURE__ */ jsx16(CircleButton, { type: "button", hidden: !hasNext, disabled: !hasNext, onClick: makeClickHandler(Math.min(pageCount, page + 1)), noBackground: true, children: /* @__PURE__ */ jsx16(WedgeIcon, { size: 16, direction: "right" /* Right */ }) })
|
|
1237
1288
|
] });
|
|
1238
1289
|
});
|