@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.
@@ -1,4 +1,4 @@
1
- import { ReactNode, ReactText } from 'react';
2
- export declare const childToString: (child?: ReactText | boolean | {} | null) => string;
1
+ import { ReactNode } from 'react';
2
+ export declare const childToString: (child?: number | string | boolean | {} | null) => string;
3
3
  export declare const onlyText: (children: ReactNode) => string;
4
4
  //# sourceMappingURL=helper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../../src/components/TextEllipsis/helper.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,SAAS,EACT,SAAS,EACV,MAAM,OAAO,CAAA;AAQd,eAAO,MAAM,aAAa,WAEhB,SAAS,GAAG,OAAO,GAAG,EAAE,GAAG,IAAI,KACtC,MAcF,CAAA;AAED,eAAO,MAAM,QAAQ,aAAc,SAAS,KAAG,MAqB9C,CAAA"}
1
+ {"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../../src/components/TextEllipsis/helper.ts"],"names":[],"mappings":"AAEA,OAAO,EAA0C,SAAS,EAAE,MAAM,OAAO,CAAA;AAQzE,eAAO,MAAM,aAAa,WAEhB,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,EAAE,GAAG,IAAI,KAC5C,MAcF,CAAA;AAED,eAAO,MAAM,QAAQ,aAAc,SAAS,KAAG,MAqB9C,CAAA"}
@@ -4,9 +4,4 @@ interface Props {
4
4
  }
5
5
  export { DotsIcon as default };
6
6
  declare function DotsIcon({ size }: Props): import("react/jsx-runtime").JSX.Element;
7
- declare namespace DotsIcon {
8
- var defaultProps: {
9
- size: number;
10
- };
11
- }
12
7
  //# sourceMappingURL=DotsIcon.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DotsIcon.d.ts","sourceRoot":"","sources":["../../../src/components/icons/DotsIcon.tsx"],"names":[],"mappings":"AAEA,UAAU,KAAK;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,OAAO,EAAE,QAAQ,IAAI,OAAO,EAAE,CAAA;AAE9B,iBAAS,QAAQ,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,2CAehC;kBAfQ,QAAQ"}
1
+ {"version":3,"file":"DotsIcon.d.ts","sourceRoot":"","sources":["../../../src/components/icons/DotsIcon.tsx"],"names":[],"mappings":"AAEA,UAAU,KAAK;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,OAAO,EAAE,QAAQ,IAAI,OAAO,EAAE,CAAA;AAE9B,iBAAS,QAAQ,CAAC,EAAE,IAAS,EAAE,EAAE,KAAK,2CAerC"}
@@ -8,13 +8,6 @@ interface Props {
8
8
  size?: number | string;
9
9
  direction: WedgeDirection;
10
10
  }
11
- declare function WedgeIcon({ size, direction }: Props): import("react/jsx-runtime").JSX.Element;
12
- declare namespace WedgeIcon {
13
- var defaultProps: {
14
- size: number;
15
- white: boolean;
16
- lightGray: boolean;
17
- };
18
- }
19
- export default WedgeIcon;
11
+ export default function WedgeIcon({ size, direction }: Props): import("react/jsx-runtime").JSX.Element;
12
+ export {};
20
13
  //# sourceMappingURL=WedgeIcon.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WedgeIcon.d.ts","sourceRoot":"","sources":["../../../src/components/icons/WedgeIcon.tsx"],"names":[],"mappings":"AAIA,oBAAY,cAAc;IACxB,EAAE,OAAO;IACT,IAAI,SAAS;IACb,IAAI,SAAS;IACb,KAAK,UAAU;CAChB;AAED,UAAU,KAAK;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,SAAS,EAAE,cAAc,CAAA;CAC1B;AAED,iBAAwB,SAAS,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,KAAK,2CAW3D;kBAXuB,SAAS;;;;;;;eAAT,SAAS"}
1
+ {"version":3,"file":"WedgeIcon.d.ts","sourceRoot":"","sources":["../../../src/components/icons/WedgeIcon.tsx"],"names":[],"mappings":"AAIA,oBAAY,cAAc;IACxB,EAAE,OAAO;IACT,IAAI,SAAS;IACb,IAAI,SAAS;IACb,KAAK,UAAU;CAChB;AAED,UAAU,KAAK;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,SAAS,EAAE,cAAc,CAAA;CAC1B;AAED,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAAE,IAAS,EAAE,SAAS,EAAE,EAAE,KAAK,2CAWhE"}
@@ -19,7 +19,7 @@ export interface ElementSize {
19
19
  width: number;
20
20
  height: number;
21
21
  }
22
- export declare function useElementSize(ref: React.RefObject<Element>, deps?: any[]): ElementSize | undefined;
22
+ export declare function useElementSize(ref: React.RefObject<Element | null>, deps?: any[]): ElementSize | undefined;
23
23
  /**
24
24
  * Debounce version of setState with `requestAnimationFrame`
25
25
  *
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/foundation/hooks.ts"],"names":[],"mappings":"AAeA,OAAO,QAAQ,WAAW,CAAC;IACzB,SAAgB,SAAS,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,CAAA;CACnD;AAED;;GAEG;AACH,wBAAgB,eAAe,YAE9B;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,WAmDrC;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf;AAMD,wBAAgB,cAAc,CAC5B,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,EAE7B,IAAI,GAAE,GAAG,EAAO,2BAmEjB;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,eAKb,CAAC,UAAS,OAAO,WAgB/D"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/foundation/hooks.ts"],"names":[],"mappings":"AAeA,OAAO,QAAQ,WAAW,CAAC;IACzB,SAAgB,SAAS,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,CAAA;CACnD;AAED;;GAEG;AACH,wBAAgB,eAAe,YAE9B;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,WAmDrC;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf;AAMD,wBAAgB,cAAc,CAC5B,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC,EAEpC,IAAI,GAAE,GAAG,EAAO,2BAmEjB;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,eAOb,CAAC,UAAS,OAAO,WAgB/D"}
package/dist/index.cjs.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  "use strict";
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
@@ -18,6 +19,10 @@ var __copyProps = (to, from, except, desc) => {
18
19
  return to;
19
20
  };
20
21
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
26
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
27
  mod
23
28
  ));
@@ -389,7 +394,7 @@ function useElementSize(ref, deps = []) {
389
394
  }
390
395
  function useDebounceAnimationState(defaultValue) {
391
396
  const [state, setState] = (0, import_react2.useState)(defaultValue);
392
- const timer = (0, import_react2.useRef)();
397
+ const timer = (0, import_react2.useRef)(void 0);
393
398
  const setDebounceState = (0, import_react2.useCallback)((value, force = false) => {
394
399
  if (force) {
395
400
  setState(value);
@@ -975,41 +980,88 @@ function CarouselButton({
975
980
  paddingRight: Math.max(padding, 0),
976
981
  paddingBottom: bottom
977
982
  };
978
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(_StyledButton, { type: "button", onClick, hide: !show, style: offsetStyle, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CarouselButtonIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(NextIcon, { direction: direction === "right" /* Right */ ? "right" /* Right */ : direction === "left" /* Left */ ? "left" /* Left */ : unreachable() }) }) });
983
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(_StyledButton, { type: "button", onClick, hide: !show, style: offsetStyle, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CarouselButtonIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(NextIcon, { direction: direction === "right" /* Right */ ? "right" /* Right */ : (
984
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
985
+ direction === "left" /* Left */ ? "left" /* Left */ : unreachable()
986
+ ) }) }) });
979
987
  }
980
988
  var CAROUSEL_BUTTON_SIZE = 40;
981
- var CarouselButtonIcon = import_styled_components13.default.div.withConfig({
982
- componentId: "ccl__sc-gjlnt0-0"
983
- })(["display:flex;align-items:center;justify-content:center;width:", "px;height:", "px;border-radius:50%;background-color:", ";transition:0.4s visibility,0.4s opacity,0.2s background-color,0.2s color;color:", ";"], CAROUSEL_BUTTON_SIZE, CAROUSEL_BUTTON_SIZE, ({
989
+ var CarouselButtonIcon = import_styled_components13.default.div`
990
+ display: flex;
991
+ align-items: center;
992
+ justify-content: center;
993
+ width: ${CAROUSEL_BUTTON_SIZE}px;
994
+ height: ${CAROUSEL_BUTTON_SIZE}px;
995
+ border-radius: 50%;
996
+ background-color: ${({
984
997
  theme: theme2
985
- }) => theme2.color.surface4, ({
998
+ }) => theme2.color.surface4};
999
+ transition: 0.4s visibility, 0.4s opacity, 0.2s background-color, 0.2s color;
1000
+ color: ${({
986
1001
  theme: theme2
987
- }) => theme2.color.text5);
988
- var Button = import_styled_components13.default.button.withConfig({
989
- componentId: "ccl__sc-gjlnt0-1"
990
- })(["position:absolute;top:0;bottom:0;display:flex;align-items:center;padding:0;min-width:40px;border:none;outline:0;background:transparent;cursor:pointer;transition:0.4s visibility,0.4s opacity;z-index:1;&:hover ", "{background-color:", ";color:", ";}&:active ", "{background-color:", ";color:", ";}", ""], CarouselButtonIcon, ({
1002
+ }) => theme2.color.text5};
1003
+ `;
1004
+ var Button = import_styled_components13.default.button`
1005
+ position: absolute;
1006
+ top: 0;
1007
+ bottom: 0;
1008
+ display: flex;
1009
+ align-items: center;
1010
+ padding: 0;
1011
+ min-width: 40px;
1012
+ border: none;
1013
+ outline: 0;
1014
+ background: transparent;
1015
+ cursor: pointer;
1016
+ transition: 0.4s visibility, 0.4s opacity;
1017
+ /* つらい */
1018
+ /* このコンポーネントはCarouselでしか使われてないのでそっちでコンテキストで切る */
1019
+ z-index: 1;
1020
+
1021
+ &:hover ${CarouselButtonIcon} {
1022
+ background-color: ${({
991
1023
  theme: theme2
992
- }) => (0, import_utils9.applyEffect)(theme2.color.surface4, theme2.effect.hover), ({
1024
+ }) => (0, import_utils9.applyEffect)(theme2.color.surface4, theme2.effect.hover)};
1025
+ color: ${({
993
1026
  theme: theme2
994
- }) => (0, import_utils9.applyEffect)(theme2.color.text5, theme2.effect.hover), CarouselButtonIcon, ({
1027
+ }) => (0, import_utils9.applyEffect)(theme2.color.text5, theme2.effect.hover)};
1028
+ }
1029
+
1030
+ &:active ${CarouselButtonIcon} {
1031
+ background-color: ${({
995
1032
  theme: theme2
996
- }) => (0, import_utils9.applyEffect)(theme2.color.surface4, theme2.effect.press), ({
1033
+ }) => (0, import_utils9.applyEffect)(theme2.color.surface4, theme2.effect.press)};
1034
+ color: ${({
997
1035
  theme: theme2
998
- }) => (0, import_utils9.applyEffect)(theme2.color.text5, theme2.effect.press), (p) => p.hide && (0, import_styled_components13.css)(["visibility:hidden;opacity:0;pointer-events:none;"]));
1036
+ }) => (0, import_utils9.applyEffect)(theme2.color.text5, theme2.effect.press)};
1037
+ }
1038
+
1039
+ ${(p) => p.hide && (0, import_styled_components13.css)(["visibility:hidden;opacity:0;pointer-events:none;"])}
1040
+ `;
999
1041
  var _StyledButton = (0, import_styled_components13.default)(Button).withConfig({
1000
- componentId: "ccl__sc-gjlnt0-2"
1042
+ componentId: "ccl__sc-gjlnt0-0"
1001
1043
  })(["", ""], onlyNonTouchDevice);
1002
- var ScrollHintIcon = (0, import_styled_components13.default)(CarouselButtonIcon).withConfig({
1003
- componentId: "ccl__sc-gjlnt0-3"
1004
- })(["cursor:pointer;&:hover{background-color:", ";color:", ";}&:active{background-color:", ";color:", ";}"], ({
1044
+ var ScrollHintIcon = (0, import_styled_components13.default)(CarouselButtonIcon)`
1045
+ cursor: pointer;
1046
+
1047
+ &:hover {
1048
+ background-color: ${({
1005
1049
  theme: theme2
1006
- }) => (0, import_utils9.applyEffect)(theme2.color.surface4, theme2.effect.hover), ({
1050
+ }) => (0, import_utils9.applyEffect)(theme2.color.surface4, theme2.effect.hover)};
1051
+ color: ${({
1007
1052
  theme: theme2
1008
- }) => (0, import_utils9.applyEffect)(theme2.color.text5, theme2.effect.hover), ({
1053
+ }) => (0, import_utils9.applyEffect)(theme2.color.text5, theme2.effect.hover)};
1054
+ }
1055
+
1056
+ &:active {
1057
+ background-color: ${({
1009
1058
  theme: theme2
1010
- }) => (0, import_utils9.applyEffect)(theme2.color.surface4, theme2.effect.press), ({
1059
+ }) => (0, import_utils9.applyEffect)(theme2.color.surface4, theme2.effect.press)};
1060
+ color: ${({
1011
1061
  theme: theme2
1012
- }) => (0, import_utils9.applyEffect)(theme2.color.text5, theme2.effect.press));
1062
+ }) => (0, import_utils9.applyEffect)(theme2.color.text5, theme2.effect.press)};
1063
+ }
1064
+ `;
1013
1065
  var onlyNonTouchDevice = (0, import_styled_components13.css)(["@media (hover:none) and (pointer:coarse){display:none;}"]);
1014
1066
 
1015
1067
  // src/components/Carousel/index.tsx
@@ -1208,7 +1260,7 @@ var import_warning = __toESM(require("warning"));
1208
1260
  var import_styled_components15 = __toESM(require("styled-components"));
1209
1261
  var import_jsx_runtime14 = require("react/jsx-runtime");
1210
1262
  function DotsIcon({
1211
- size: size3
1263
+ size: size3 = 16
1212
1264
  }) {
1213
1265
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(StyledSVG, { viewBox: "0 0 20 6", width: size3, height: size3, children: /* @__PURE__ */ (0, import_jsx_runtime14.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
1214
1266
  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
@@ -1217,9 +1269,6 @@ function DotsIcon({
1217
1269
  C17.6192881,14.5 16.5,13.3807119 16.5,12 C16.5,10.6192881 17.6192881,9.5 19,9.5
1218
1270
  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)" }) });
1219
1271
  }
1220
- DotsIcon.defaultProps = {
1221
- size: 16
1222
- };
1223
1272
  var StyledSVG = import_styled_components15.default.svg.withConfig({
1224
1273
  componentId: "ccl__sc-1ma336a-0"
1225
1274
  })(["fill:currentColor;"]);
@@ -1228,16 +1277,14 @@ var StyledSVG = import_styled_components15.default.svg.withConfig({
1228
1277
  var import_styled_components16 = __toESM(require("styled-components"));
1229
1278
  var import_jsx_runtime15 = require("react/jsx-runtime");
1230
1279
  function WedgeIcon({
1231
- size: size3,
1280
+ size: size3 = 16,
1232
1281
  direction
1233
1282
  }) {
1234
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("svg", { viewBox: "0 0 10 8", width: size3, height: size3, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StyledPolyline, { strokeWidth: "2", points: "1,2 5,6 9,2", transform: directionToTransform2(direction) }) });
1283
+ return (
1284
+ // NOTE: directionToTransform depends on the value of viewBox
1285
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("svg", { viewBox: "0 0 10 8", width: size3, height: size3, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StyledPolyline, { strokeWidth: "2", points: "1,2 5,6 9,2", transform: directionToTransform2(direction) }) })
1286
+ );
1235
1287
  }
1236
- WedgeIcon.defaultProps = {
1237
- size: 16,
1238
- white: false,
1239
- lightGray: false
1240
- };
1241
1288
  function directionToTransform2(direction) {
1242
1289
  switch (direction) {
1243
1290
  case "up" /* Up */:
@@ -1275,7 +1322,10 @@ function usePagerWindow(page, pageCount, pageRangeDisplayed = 7) {
1275
1322
  } else {
1276
1323
  const start = visibleLastPage - (pageRangeDisplayed - 1) + 2;
1277
1324
  return [
1325
+ // 表示範囲が1-7ページを超えるなら、
1326
+ // - 1ページ目は固定で表示する
1278
1327
  visibleFirstPage,
1328
+ // - 2ページ目から現在のページの直前までは省略する
1279
1329
  "...",
1280
1330
  ...Array.from({
1281
1331
  length: 1 + visibleLastPage - start
@@ -1300,7 +1350,11 @@ var Pager_default = (0, import_react9.memo)(function Pager({
1300
1350
  const hasPrev = page > 1;
1301
1351
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(PagerContainer, { children: [
1302
1352
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CircleButton, { type: "button", hidden: !hasPrev, disabled: !hasPrev, onClick: makeClickHandler(Math.max(1, page - 1)), noBackground: true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(WedgeIcon, { size: 16, direction: "left" /* Left */ }) }),
1303
- window2.map((p) => p === "..." ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Spacer, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DotsIcon, { size: 20 }) }, p) : p === page ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CircleButton, { type: "button", "aria-current": true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text3, { children: p }) }, p) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CircleButton, { type: "button", onClick: makeClickHandler(p), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text3, { children: p }) }, p)),
1353
+ window2.map((p) => p === "..." ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Spacer, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DotsIcon, { size: 20 }) }, p) : p === page ? (
1354
+ // we remove the onClick but don't mark it as disabled to preserve keyboard focus
1355
+ // not doing so causes the focus ring to flicker in and out of existence
1356
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CircleButton, { type: "button", "aria-current": true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text3, { children: p }) }, p)
1357
+ ) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CircleButton, { type: "button", onClick: makeClickHandler(p), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text3, { children: p }) }, p)),
1304
1358
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CircleButton, { type: "button", hidden: !hasNext, disabled: !hasNext, onClick: makeClickHandler(Math.min(pageCount, page + 1)), noBackground: true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(WedgeIcon, { size: 16, direction: "right" /* Right */ }) })
1305
1359
  ] });
1306
1360
  });