@zenkigen-inc/component-ui 1.22.0 → 1.24.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.d.mts +40 -15
- package/dist/index.d.ts +40 -15
- package/dist/index.js +449 -226
- package/dist/index.mjs +342 -119
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1619,6 +1619,9 @@ function isElement(node) {
|
|
|
1619
1619
|
return node != null && typeof node === "object" && "type" in node;
|
|
1620
1620
|
}
|
|
1621
1621
|
|
|
1622
|
+
// src/utils/top-layer.ts
|
|
1623
|
+
var TOP_LAYER_ATTRIBUTE = "data-zenkigen-top-layer";
|
|
1624
|
+
|
|
1622
1625
|
// src/popover/popover-context.ts
|
|
1623
1626
|
var import_react21 = require("react");
|
|
1624
1627
|
var PopoverContext = (0, import_react21.createContext)(null);
|
|
@@ -1747,6 +1750,7 @@ var PopoverTrigger = (0, import_react24.forwardRef)(function PopoverTrigger2({ c
|
|
|
1747
1750
|
|
|
1748
1751
|
// src/popover/popover.tsx
|
|
1749
1752
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1753
|
+
var FLOATING_VIEWPORT_PADDING2 = 8;
|
|
1750
1754
|
function Popover({
|
|
1751
1755
|
isOpen,
|
|
1752
1756
|
children,
|
|
@@ -1756,6 +1760,14 @@ function Popover({
|
|
|
1756
1760
|
anchorRef
|
|
1757
1761
|
}) {
|
|
1758
1762
|
const triggerRef = (0, import_react26.useRef)(null);
|
|
1763
|
+
const middleware = (0, import_react26.useMemo)(
|
|
1764
|
+
() => [
|
|
1765
|
+
(0, import_react25.offset)(offsetValue),
|
|
1766
|
+
(0, import_react25.flip)({ padding: FLOATING_VIEWPORT_PADDING2, flipAlignment: false }),
|
|
1767
|
+
(0, import_react25.shift)({ padding: FLOATING_VIEWPORT_PADDING2 })
|
|
1768
|
+
],
|
|
1769
|
+
[offsetValue]
|
|
1770
|
+
);
|
|
1759
1771
|
const floating = (0, import_react25.useFloating)({
|
|
1760
1772
|
open: isOpen,
|
|
1761
1773
|
onOpenChange: (open) => {
|
|
@@ -1764,7 +1776,7 @@ function Popover({
|
|
|
1764
1776
|
}
|
|
1765
1777
|
},
|
|
1766
1778
|
placement,
|
|
1767
|
-
middleware
|
|
1779
|
+
middleware,
|
|
1768
1780
|
whileElementsMounted: import_react25.autoUpdate,
|
|
1769
1781
|
strategy: "fixed"
|
|
1770
1782
|
});
|
|
@@ -1812,27 +1824,83 @@ var import_react_day_picker2 = require("react-day-picker");
|
|
|
1812
1824
|
var import_clsx15 = require("clsx");
|
|
1813
1825
|
var import_react_day_picker = require("react-day-picker");
|
|
1814
1826
|
var defaultDayPickerClassNames = (0, import_react_day_picker.getDefaultClassNames)();
|
|
1815
|
-
var
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
+
var BASE_TOKENS = {
|
|
1828
|
+
triggerIcon: "small",
|
|
1829
|
+
dayPickerStyle: {
|
|
1830
|
+
"--rdp-nav-height": "30px",
|
|
1831
|
+
"--rdp-day-width": "30px",
|
|
1832
|
+
"--rdp-day-height": "30px",
|
|
1833
|
+
"--rdp-day_button-width": "28px",
|
|
1834
|
+
"--rdp-day_button-height": "28px",
|
|
1835
|
+
"--rdp-day_button-border": "1px solid transparent",
|
|
1836
|
+
"--rdp-weekday-padding": "0px",
|
|
1837
|
+
fontFamily: "Arial, 'Noto Sans JP', sans-serif",
|
|
1838
|
+
fontSize: "12px",
|
|
1839
|
+
fontWeight: 700
|
|
1840
|
+
},
|
|
1841
|
+
dayPickerClassNames: {
|
|
1842
|
+
month: (0, import_clsx15.clsx)(defaultDayPickerClassNames.month, "flex flex-col px-[7px] py-2")
|
|
1843
|
+
},
|
|
1844
|
+
dayButtonClass: "relative grid size-full place-items-center rounded-full !border !border-solid",
|
|
1845
|
+
dayButtonFontSize: "12px",
|
|
1846
|
+
monthCaptionClass: "flex items-center justify-between px-1 pb-0.5",
|
|
1847
|
+
monthCaptionTypography: "typography-label12bold",
|
|
1848
|
+
navIconButton: "small",
|
|
1849
|
+
weekdayClass: "m-0 size-7 p-0 text-center align-middle",
|
|
1850
|
+
footerIconButton: "medium",
|
|
1851
|
+
footerClearButton: "small",
|
|
1852
|
+
errorTypography: "typography-label11regular"
|
|
1853
|
+
};
|
|
1854
|
+
var LARGE_TOKENS = {
|
|
1855
|
+
...BASE_TOKENS,
|
|
1856
|
+
triggerIcon: "medium",
|
|
1857
|
+
errorTypography: "typography-label12regular"
|
|
1827
1858
|
};
|
|
1828
|
-
var
|
|
1829
|
-
|
|
1859
|
+
var X_LARGE_TOKENS = {
|
|
1860
|
+
triggerIcon: "medium",
|
|
1861
|
+
dayPickerStyle: {
|
|
1862
|
+
"--rdp-nav-height": "40px",
|
|
1863
|
+
"--rdp-day-width": "48px",
|
|
1864
|
+
"--rdp-day-height": "48px",
|
|
1865
|
+
"--rdp-day_button-width": "40px",
|
|
1866
|
+
"--rdp-day_button-height": "40px",
|
|
1867
|
+
"--rdp-day_button-border": "1px solid transparent",
|
|
1868
|
+
"--rdp-weekday-padding": "0px",
|
|
1869
|
+
fontFamily: "Arial, 'Noto Sans JP', sans-serif",
|
|
1870
|
+
fontSize: "16px",
|
|
1871
|
+
fontWeight: 700
|
|
1872
|
+
},
|
|
1873
|
+
dayPickerClassNames: {
|
|
1874
|
+
month: (0, import_clsx15.clsx)(defaultDayPickerClassNames.month, "flex flex-col px-[3px] pb-1 pt-2")
|
|
1875
|
+
},
|
|
1876
|
+
dayButtonClass: "relative grid size-10 place-items-center rounded-full !border !border-solid",
|
|
1877
|
+
dayButtonFontSize: "16px",
|
|
1878
|
+
// caption は height 固定(--rdp-nav-height: 40px)のため pb-2 は食い込みとして働き、
|
|
1879
|
+
// ナビボタンが上へ 4px はみ出して月ヘッダーと曜日行の視覚間隔が 8px になる(上部ブロックコメント参照)
|
|
1880
|
+
monthCaptionClass: "flex items-center justify-between px-1 pb-2",
|
|
1881
|
+
monthCaptionTypography: "typography-label16bold",
|
|
1882
|
+
// IconButton に x-large は無いが、large が 40px で Figma と一致する(内部アイコンも 24px になる)
|
|
1883
|
+
navIconButton: "large",
|
|
1884
|
+
weekdayClass: "m-0 size-12 p-0 text-center align-middle",
|
|
1885
|
+
footerIconButton: "large",
|
|
1886
|
+
footerClearButton: "large",
|
|
1887
|
+
errorTypography: "typography-label12regular"
|
|
1888
|
+
};
|
|
1889
|
+
var DATE_PICKER_SIZE_TOKENS = {
|
|
1890
|
+
small: BASE_TOKENS,
|
|
1891
|
+
medium: BASE_TOKENS,
|
|
1892
|
+
large: LARGE_TOKENS,
|
|
1893
|
+
"x-large": X_LARGE_TOKENS
|
|
1894
|
+
};
|
|
1895
|
+
var useDatePickerSizeTokens = (componentName = "DatePicker \u306E\u30AB\u30EC\u30F3\u30C0\u30FC") => {
|
|
1896
|
+
const context = useDatePickerCompoundContext(componentName);
|
|
1897
|
+
return { ...context, tokens: DATE_PICKER_SIZE_TOKENS[context.size] };
|
|
1830
1898
|
};
|
|
1831
|
-
var dayButtonBaseClass = "relative grid size-full place-items-center rounded-full !border !border-solid";
|
|
1832
1899
|
|
|
1833
1900
|
// src/date-picker/date-picker-day-button.tsx
|
|
1834
1901
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1835
1902
|
var CustomDayButton = ({ day, modifiers, className, style, ...buttonProps }) => {
|
|
1903
|
+
const { tokens } = useDatePickerSizeTokens();
|
|
1836
1904
|
const isSelected = Boolean(modifiers.selected);
|
|
1837
1905
|
const isOutside = Boolean(modifiers.outside);
|
|
1838
1906
|
const isMinMaxDisabled = Boolean(modifiers.minMaxDisabled);
|
|
@@ -1845,10 +1913,10 @@ var CustomDayButton = ({ day, modifiers, className, style, ...buttonProps }) =>
|
|
|
1845
1913
|
...buttonProps,
|
|
1846
1914
|
day,
|
|
1847
1915
|
modifiers,
|
|
1848
|
-
style: { ...style, fontSize:
|
|
1916
|
+
style: { ...style, fontSize: tokens.dayButtonFontSize },
|
|
1849
1917
|
className: (0, import_clsx16.clsx)(
|
|
1850
1918
|
className,
|
|
1851
|
-
|
|
1919
|
+
tokens.dayButtonClass,
|
|
1852
1920
|
// 共通: フォーカスリング(有効な日のみ)
|
|
1853
1921
|
// react-day-picker の rdp-day_button クラスが outline: none を設定しているため、!important で上書き
|
|
1854
1922
|
!isDisabledDay && import_component_theme6.focusVisible.normalImportant,
|
|
@@ -1874,8 +1942,8 @@ var import_react28 = require("react");
|
|
|
1874
1942
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1875
1943
|
var DatePickerErrorMessage = (0, import_react28.forwardRef)(
|
|
1876
1944
|
({ "aria-live": ariaLive = "assertive", ...props }, ref) => {
|
|
1877
|
-
const {
|
|
1878
|
-
const typographyClass =
|
|
1945
|
+
const { isError, tokens } = useDatePickerSizeTokens("DatePicker.ErrorMessage");
|
|
1946
|
+
const typographyClass = tokens.errorTypography;
|
|
1879
1947
|
if (isError !== true) {
|
|
1880
1948
|
return null;
|
|
1881
1949
|
}
|
|
@@ -1956,11 +2024,12 @@ var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
|
1956
2024
|
var CustomMonthCaption = ({ calendarMonth, className, displayIndex, style, ...props }) => {
|
|
1957
2025
|
void displayIndex;
|
|
1958
2026
|
const { goToMonth, nextMonth, previousMonth } = (0, import_react_day_picker3.useDayPicker)();
|
|
2027
|
+
const { tokens } = useDatePickerSizeTokens();
|
|
1959
2028
|
const captionMonth = calendarMonth.date;
|
|
1960
2029
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1961
2030
|
"div",
|
|
1962
2031
|
{
|
|
1963
|
-
className: (0, import_clsx18.clsx)(
|
|
2032
|
+
className: (0, import_clsx18.clsx)(tokens.monthCaptionClass, className),
|
|
1964
2033
|
style: { ...style, fontSize: "inherit", fontWeight: "inherit" },
|
|
1965
2034
|
...props,
|
|
1966
2035
|
children: [
|
|
@@ -1968,19 +2037,19 @@ var CustomMonthCaption = ({ calendarMonth, className, displayIndex, style, ...pr
|
|
|
1968
2037
|
IconButton,
|
|
1969
2038
|
{
|
|
1970
2039
|
icon: "angle-left",
|
|
1971
|
-
size:
|
|
2040
|
+
size: tokens.navIconButton,
|
|
1972
2041
|
variant: "text",
|
|
1973
2042
|
isDisabled: !previousMonth,
|
|
1974
2043
|
"aria-label": "\u524D\u306E\u6708",
|
|
1975
2044
|
onClick: () => previousMonth && goToMonth(previousMonth)
|
|
1976
2045
|
}
|
|
1977
2046
|
),
|
|
1978
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "
|
|
2047
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: (0, import_clsx18.clsx)(tokens.monthCaptionTypography, "text-text02"), children: formatMonthLabel(captionMonth) }),
|
|
1979
2048
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1980
2049
|
IconButton,
|
|
1981
2050
|
{
|
|
1982
2051
|
icon: "angle-right",
|
|
1983
|
-
size:
|
|
2052
|
+
size: tokens.navIconButton,
|
|
1984
2053
|
variant: "text",
|
|
1985
2054
|
isDisabled: !nextMonth,
|
|
1986
2055
|
"aria-label": "\u6B21\u306E\u6708",
|
|
@@ -1996,11 +2065,12 @@ var CustomMonthCaption = ({ calendarMonth, className, displayIndex, style, ...pr
|
|
|
1996
2065
|
var import_clsx19 = require("clsx");
|
|
1997
2066
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1998
2067
|
var CustomWeekday = ({ className, children, style, ...props }) => {
|
|
2068
|
+
const { tokens } = useDatePickerSizeTokens();
|
|
1999
2069
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2000
2070
|
"th",
|
|
2001
2071
|
{
|
|
2002
2072
|
...props,
|
|
2003
|
-
className: (0, import_clsx19.clsx)(className, "
|
|
2073
|
+
className: (0, import_clsx19.clsx)(className, tokens.weekdayClass, "text-text02"),
|
|
2004
2074
|
style: { ...style, fontSize: "inherit", fontWeight: "bold" },
|
|
2005
2075
|
children
|
|
2006
2076
|
}
|
|
@@ -2135,7 +2205,7 @@ var DatePicker = ({
|
|
|
2135
2205
|
formatWeekdayName: (date) => weekdayFormatter.format(date)
|
|
2136
2206
|
};
|
|
2137
2207
|
}, []);
|
|
2138
|
-
const
|
|
2208
|
+
const tokens = DATE_PICKER_SIZE_TOKENS[size];
|
|
2139
2209
|
const displayText = value ? formatDisplayDate(value, timeZone) : placeholder;
|
|
2140
2210
|
const displayTextClasses = "min-w-0 truncate";
|
|
2141
2211
|
const errorIds = [];
|
|
@@ -2183,7 +2253,7 @@ var DatePicker = ({
|
|
|
2183
2253
|
size,
|
|
2184
2254
|
variant: isError ? "outlineDanger" : "outline",
|
|
2185
2255
|
isDisabled,
|
|
2186
|
-
before: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Icon, { name: "calendar", size:
|
|
2256
|
+
before: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Icon, { name: "calendar", size: tokens.triggerIcon }),
|
|
2187
2257
|
justifyContent: "start",
|
|
2188
2258
|
onClick: handleTriggerClick,
|
|
2189
2259
|
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: displayTextClasses, children: displayText })
|
|
@@ -2197,7 +2267,7 @@ var DatePicker = ({
|
|
|
2197
2267
|
showOutsideDays: true,
|
|
2198
2268
|
hideNavigation: true,
|
|
2199
2269
|
weekStartsOn: 0,
|
|
2200
|
-
style: dayPickerStyle,
|
|
2270
|
+
style: tokens.dayPickerStyle,
|
|
2201
2271
|
month: displayMonth,
|
|
2202
2272
|
onMonthChange: setDisplayMonth,
|
|
2203
2273
|
selected: selectedDate,
|
|
@@ -2205,7 +2275,7 @@ var DatePicker = ({
|
|
|
2205
2275
|
today: todayForCalendar,
|
|
2206
2276
|
disabled: disabledDays,
|
|
2207
2277
|
modifiers: { minMaxDisabled: isMinMaxDisabled },
|
|
2208
|
-
classNames: dayPickerClassNames,
|
|
2278
|
+
classNames: tokens.dayPickerClassNames,
|
|
2209
2279
|
formatters,
|
|
2210
2280
|
fixedWeeks: true,
|
|
2211
2281
|
components: { MonthCaption: CustomMonthCaption, DayButton: CustomDayButton, Weekday: CustomWeekday }
|
|
@@ -2216,14 +2286,14 @@ var DatePicker = ({
|
|
|
2216
2286
|
IconButton,
|
|
2217
2287
|
{
|
|
2218
2288
|
icon: "calendar-today",
|
|
2219
|
-
size:
|
|
2289
|
+
size: tokens.footerIconButton,
|
|
2220
2290
|
variant: "text",
|
|
2221
2291
|
"aria-label": "\u4ECA\u65E5\u306B\u623B\u308B",
|
|
2222
2292
|
iconAccentColor: "supportInfo",
|
|
2223
2293
|
onClick: handleClickToday
|
|
2224
2294
|
}
|
|
2225
2295
|
),
|
|
2226
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button, { type: "button", size:
|
|
2296
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button, { type: "button", size: tokens.footerClearButton, variant: "text", onClick: handleClear, children: "\u30AF\u30EA\u30A2" })
|
|
2227
2297
|
] })
|
|
2228
2298
|
] }) })
|
|
2229
2299
|
] });
|
|
@@ -2903,7 +2973,8 @@ function Loading({ size = "medium", position = "fixed", height = "100%" }) {
|
|
|
2903
2973
|
}
|
|
2904
2974
|
|
|
2905
2975
|
// src/modal/modal.tsx
|
|
2906
|
-
var import_react40 = require("react");
|
|
2976
|
+
var import_react40 = require("@floating-ui/react");
|
|
2977
|
+
var import_react41 = require("react");
|
|
2907
2978
|
var import_react_dom2 = require("react-dom");
|
|
2908
2979
|
|
|
2909
2980
|
// src/modal/body-scroll-lock.tsx
|
|
@@ -2980,7 +3051,13 @@ var import_clsx28 = __toESM(require("clsx"));
|
|
|
2980
3051
|
var import_react39 = require("react");
|
|
2981
3052
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2982
3053
|
function ModalHeader({ children, isNoBorder = false }) {
|
|
2983
|
-
const { onClose } = (0, import_react39.useContext)(ModalContext);
|
|
3054
|
+
const { onClose, titleId, setHasTitle } = (0, import_react39.useContext)(ModalContext);
|
|
3055
|
+
(0, import_react39.useLayoutEffect)(() => {
|
|
3056
|
+
setHasTitle?.(true);
|
|
3057
|
+
return () => {
|
|
3058
|
+
setHasTitle?.(false);
|
|
3059
|
+
};
|
|
3060
|
+
}, [setHasTitle]);
|
|
2984
3061
|
const headerClasses = (0, import_clsx28.default)(
|
|
2985
3062
|
"typography-h5 flex w-full shrink-0 items-center justify-between rounded-t-lg px-6 text-text01",
|
|
2986
3063
|
{
|
|
@@ -2990,7 +3067,7 @@ function ModalHeader({ children, isNoBorder = false }) {
|
|
|
2990
3067
|
}
|
|
2991
3068
|
);
|
|
2992
3069
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: headerClasses, children: [
|
|
2993
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { children }),
|
|
3070
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { id: titleId, children }),
|
|
2994
3071
|
onClose && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(IconButton, { icon: "close", size: "small", variant: "text", onClick: onClose })
|
|
2995
3072
|
] });
|
|
2996
3073
|
}
|
|
@@ -2999,6 +3076,9 @@ function ModalHeader({ children, isNoBorder = false }) {
|
|
|
2999
3076
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
3000
3077
|
var LIMIT_WIDTH = 320;
|
|
3001
3078
|
var LIMIT_HEIGHT = 184;
|
|
3079
|
+
var MODAL_OVERLAY_ATTRIBUTE = "data-zenkigen-modal-overlay";
|
|
3080
|
+
var FOLLOWING_INSIDE_SELECTOR = `[data-floating-ui-portal],[${MODAL_OVERLAY_ATTRIBUTE}],[data-floating-ui-focus-guard]`;
|
|
3081
|
+
var isFollowing = (base, target) => (base.compareDocumentPosition(target) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0;
|
|
3002
3082
|
function Modal({
|
|
3003
3083
|
children,
|
|
3004
3084
|
width = 480,
|
|
@@ -3008,13 +3088,33 @@ function Modal({
|
|
|
3008
3088
|
onClose,
|
|
3009
3089
|
portalTargetRef
|
|
3010
3090
|
}) {
|
|
3011
|
-
const [isMounted, setIsMounted] = (0,
|
|
3091
|
+
const [isMounted, setIsMounted] = (0, import_react41.useState)(false);
|
|
3092
|
+
const overlayRef = (0, import_react41.useRef)(null);
|
|
3093
|
+
const titleId = (0, import_react41.useId)();
|
|
3094
|
+
const [hasTitle, setHasTitle] = (0, import_react41.useState)(false);
|
|
3095
|
+
const { refs, context } = (0, import_react40.useFloating)({ open: isOpen });
|
|
3096
|
+
const returnFocusRef = (0, import_react41.useRef)(null);
|
|
3097
|
+
(0, import_react41.useLayoutEffect)(() => {
|
|
3098
|
+
if (isOpen) {
|
|
3099
|
+
returnFocusRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
3100
|
+
}
|
|
3101
|
+
}, [isOpen]);
|
|
3102
|
+
const getInsideElements = () => {
|
|
3103
|
+
const overlay = overlayRef.current;
|
|
3104
|
+
const topLayers = Array.from(document.querySelectorAll(`[${TOP_LAYER_ATTRIBUTE}]`));
|
|
3105
|
+
const following = overlay == null ? [] : Array.from(document.querySelectorAll(FOLLOWING_INSIDE_SELECTOR)).filter(
|
|
3106
|
+
(element) => isFollowing(overlay, element)
|
|
3107
|
+
);
|
|
3108
|
+
return [...topLayers, ...following].filter(
|
|
3109
|
+
(element) => element !== document.body && element !== document.documentElement
|
|
3110
|
+
);
|
|
3111
|
+
};
|
|
3012
3112
|
const renderWidth = typeof width === "number" ? Math.max(width, LIMIT_WIDTH) : width;
|
|
3013
3113
|
const renderHeight = typeof height === "number" ? Math.max(height, LIMIT_HEIGHT) : height;
|
|
3014
|
-
(0,
|
|
3114
|
+
(0, import_react41.useEffect)(() => {
|
|
3015
3115
|
setIsMounted(true);
|
|
3016
3116
|
}, []);
|
|
3017
|
-
(0,
|
|
3117
|
+
(0, import_react41.useEffect)(() => {
|
|
3018
3118
|
if (isOpen) {
|
|
3019
3119
|
window.dispatchEvent(new CustomEvent(MODAL_OPEN_EVENT));
|
|
3020
3120
|
}
|
|
@@ -3022,16 +3122,36 @@ function Modal({
|
|
|
3022
3122
|
return isMounted && isOpen ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
|
|
3023
3123
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(BodyScrollLock, {}),
|
|
3024
3124
|
(0, import_react_dom2.createPortal)(
|
|
3025
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ModalContext.Provider, { value: { onClose
|
|
3026
|
-
|
|
3125
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ModalContext.Provider, { value: { onClose, titleId, setHasTitle }, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3126
|
+
import_react40.FloatingFocusManager,
|
|
3027
3127
|
{
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3128
|
+
context,
|
|
3129
|
+
initialFocus: refs.floating,
|
|
3130
|
+
returnFocus: returnFocusRef,
|
|
3131
|
+
outsideElementsInert: true,
|
|
3132
|
+
getInsideElements,
|
|
3133
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3134
|
+
"div",
|
|
3135
|
+
{
|
|
3136
|
+
ref: overlayRef,
|
|
3137
|
+
...{ [MODAL_OVERLAY_ATTRIBUTE]: "" },
|
|
3138
|
+
className: "fixed left-0 top-0 z-overlay flex size-full items-center justify-center bg-backgroundOverlayBlack py-4",
|
|
3139
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3140
|
+
"div",
|
|
3141
|
+
{
|
|
3142
|
+
ref: refs.setFloating,
|
|
3143
|
+
role: "dialog",
|
|
3144
|
+
"aria-modal": "true",
|
|
3145
|
+
...hasTitle && { "aria-labelledby": titleId },
|
|
3146
|
+
className: "grid max-h-full min-h-[120px] grid-rows-[max-content_1fr_max-content] flex-col rounded-lg bg-uiBackground01 shadow-modalShadow outline-none",
|
|
3147
|
+
style: { width: renderWidth, height: renderHeight, maxWidth },
|
|
3148
|
+
children
|
|
3149
|
+
}
|
|
3150
|
+
)
|
|
3151
|
+
}
|
|
3152
|
+
)
|
|
3033
3153
|
}
|
|
3034
|
-
) })
|
|
3154
|
+
) }),
|
|
3035
3155
|
portalTargetRef?.current != null ? portalTargetRef.current : document.body
|
|
3036
3156
|
)
|
|
3037
3157
|
] }) : null;
|
|
@@ -3070,7 +3190,8 @@ function NotificationInline({ state = "default", size = "medium", variant = "def
|
|
|
3070
3190
|
"fill-supportSuccess": state === "success"
|
|
3071
3191
|
});
|
|
3072
3192
|
const textClasses = (0, import_clsx29.clsx)("flex-1", {
|
|
3073
|
-
"pt-[
|
|
3193
|
+
"pt-[3px]": size === "medium" && state !== "default",
|
|
3194
|
+
"pt-[1px]": size === "small" && state !== "default"
|
|
3074
3195
|
});
|
|
3075
3196
|
const iconName = {
|
|
3076
3197
|
attention: "attention",
|
|
@@ -3093,18 +3214,18 @@ function NotificationInline({ state = "default", size = "medium", variant = "def
|
|
|
3093
3214
|
|
|
3094
3215
|
// src/pagination/pagination-button.tsx
|
|
3095
3216
|
var import_clsx30 = require("clsx");
|
|
3096
|
-
var
|
|
3217
|
+
var import_react43 = require("react");
|
|
3097
3218
|
|
|
3098
3219
|
// src/pagination/pagination-context.ts
|
|
3099
|
-
var
|
|
3100
|
-
var PaginationContext = (0,
|
|
3220
|
+
var import_react42 = require("react");
|
|
3221
|
+
var PaginationContext = (0, import_react42.createContext)({
|
|
3101
3222
|
currentPage: 0
|
|
3102
3223
|
});
|
|
3103
3224
|
|
|
3104
3225
|
// src/pagination/pagination-button.tsx
|
|
3105
3226
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
3106
3227
|
function PaginationButton({ page, onClick }) {
|
|
3107
|
-
const { currentPage } = (0,
|
|
3228
|
+
const { currentPage } = (0, import_react43.useContext)(PaginationContext);
|
|
3108
3229
|
const buttonClasses = (0, import_clsx30.clsx)(
|
|
3109
3230
|
"flex h-8 min-w-8 items-center justify-center rounded fill-icon01 px-1",
|
|
3110
3231
|
"typography-label14regular",
|
|
@@ -3191,15 +3312,16 @@ function Pagination({ currentPage, totalPage, sideNumPagesToShow = 3, onClick })
|
|
|
3191
3312
|
}
|
|
3192
3313
|
|
|
3193
3314
|
// src/select/select.tsx
|
|
3194
|
-
var
|
|
3315
|
+
var import_react47 = require("@floating-ui/react");
|
|
3195
3316
|
var import_component_theme13 = require("@zenkigen-inc/component-theme");
|
|
3196
3317
|
var import_clsx33 = __toESM(require("clsx"));
|
|
3197
|
-
var
|
|
3318
|
+
var import_react48 = require("react");
|
|
3198
3319
|
|
|
3199
3320
|
// src/select/select-context.ts
|
|
3200
|
-
var
|
|
3201
|
-
var SelectContext = (0,
|
|
3321
|
+
var import_react44 = require("react");
|
|
3322
|
+
var SelectContext = (0, import_react44.createContext)({
|
|
3202
3323
|
size: "medium",
|
|
3324
|
+
isDeselectVisible: false,
|
|
3203
3325
|
setIsOptionListOpen: () => false,
|
|
3204
3326
|
variant: "outline",
|
|
3205
3327
|
isError: false
|
|
@@ -3208,10 +3330,10 @@ var SelectContext = (0, import_react43.createContext)({
|
|
|
3208
3330
|
// src/select/select-item.tsx
|
|
3209
3331
|
var import_component_theme11 = require("@zenkigen-inc/component-theme");
|
|
3210
3332
|
var import_clsx31 = __toESM(require("clsx"));
|
|
3211
|
-
var
|
|
3333
|
+
var import_react45 = require("react");
|
|
3212
3334
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
3213
3335
|
function SelectItem({ option }) {
|
|
3214
|
-
const { setIsOptionListOpen, selectedOption, onChange, isError, size } = (0,
|
|
3336
|
+
const { setIsOptionListOpen, selectedOption, onChange, isError, size } = (0, import_react45.useContext)(SelectContext);
|
|
3215
3337
|
const handleClickItem = (option2) => {
|
|
3216
3338
|
onChange?.(option2);
|
|
3217
3339
|
setIsOptionListOpen(false);
|
|
@@ -3238,31 +3360,43 @@ function SelectItem({ option }) {
|
|
|
3238
3360
|
// src/select/select-list.tsx
|
|
3239
3361
|
var import_component_theme12 = require("@zenkigen-inc/component-theme");
|
|
3240
3362
|
var import_clsx32 = __toESM(require("clsx"));
|
|
3241
|
-
var
|
|
3363
|
+
var import_react46 = require("react");
|
|
3242
3364
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
3243
|
-
var SelectList = (0,
|
|
3244
|
-
const {
|
|
3365
|
+
var SelectList = (0, import_react46.forwardRef)(({ children, maxHeight }, ref) => {
|
|
3366
|
+
const {
|
|
3367
|
+
selectedOption,
|
|
3368
|
+
setIsOptionListOpen,
|
|
3369
|
+
variant,
|
|
3370
|
+
isDeselectVisible,
|
|
3371
|
+
onChange,
|
|
3372
|
+
floatingStyles,
|
|
3373
|
+
floatingRef,
|
|
3374
|
+
size
|
|
3375
|
+
} = (0, import_react46.useContext)(SelectContext);
|
|
3245
3376
|
const handleClickDeselect = () => {
|
|
3246
3377
|
onChange?.(null);
|
|
3247
3378
|
setIsOptionListOpen(false);
|
|
3248
3379
|
};
|
|
3249
|
-
(0,
|
|
3250
|
-
if (
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
container.scrollTo({
|
|
3261
|
-
top: Math.max(0, scrollTop)
|
|
3262
|
-
});
|
|
3263
|
-
}
|
|
3264
|
-
}
|
|
3380
|
+
(0, import_react46.useLayoutEffect)(() => {
|
|
3381
|
+
if (selectedOption == null) {
|
|
3382
|
+
return;
|
|
3383
|
+
}
|
|
3384
|
+
const container = floatingRef?.current;
|
|
3385
|
+
if (container == null || container.scrollHeight <= container.clientHeight) {
|
|
3386
|
+
return;
|
|
3387
|
+
}
|
|
3388
|
+
const element = container.querySelector(`[data-id="${selectedOption.id}"]`);
|
|
3389
|
+
if (element == null) {
|
|
3390
|
+
return;
|
|
3265
3391
|
}
|
|
3392
|
+
const htmlElement = element;
|
|
3393
|
+
const elementTop = htmlElement.offsetTop;
|
|
3394
|
+
const elementHeight = htmlElement.offsetHeight;
|
|
3395
|
+
const containerHeight = container.clientHeight;
|
|
3396
|
+
const scrollTop = elementTop - (containerHeight - elementHeight) / 2;
|
|
3397
|
+
container.scrollTo({
|
|
3398
|
+
top: Math.max(0, scrollTop)
|
|
3399
|
+
});
|
|
3266
3400
|
}, [selectedOption, maxHeight, floatingRef]);
|
|
3267
3401
|
const listClasses = (0, import_clsx32.default)("overflow-y-auto rounded bg-uiBackground01 py-2 shadow-floatingShadow", {
|
|
3268
3402
|
"border-solid border border-uiBorder01": variant === "outline"
|
|
@@ -3277,7 +3411,7 @@ var SelectList = (0, import_react45.forwardRef)(({ children, maxHeight }, ref) =
|
|
|
3277
3411
|
);
|
|
3278
3412
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("ul", { className: listClasses, style: { maxHeight, ...floatingStyles }, ref, children: [
|
|
3279
3413
|
children,
|
|
3280
|
-
|
|
3414
|
+
isDeselectVisible && selectedOption !== null && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("button", { className: deselectButtonClasses, type: "button", onClick: handleClickDeselect, children: "\u9078\u629E\u89E3\u9664" }) })
|
|
3281
3415
|
] });
|
|
3282
3416
|
});
|
|
3283
3417
|
SelectList.displayName = "SelectList";
|
|
@@ -3285,6 +3419,10 @@ SelectList.displayName = "SelectList";
|
|
|
3285
3419
|
// src/select/select.tsx
|
|
3286
3420
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
3287
3421
|
var FLOATING_OFFSET2 = 4;
|
|
3422
|
+
var OPTION_HEIGHT_PX = { "x-small": 32, small: 32, medium: 32, large: 40 };
|
|
3423
|
+
var DEFAULT_VISIBLE_OPTION_COUNT = 8.5;
|
|
3424
|
+
var LIST_VERTICAL_CHROME_PX = 10;
|
|
3425
|
+
var getDefaultOptionListMaxHeight = (size) => OPTION_HEIGHT_PX[size] * DEFAULT_VISIBLE_OPTION_COUNT + LIST_VERTICAL_CHROME_PX;
|
|
3288
3426
|
function Select({
|
|
3289
3427
|
children,
|
|
3290
3428
|
size = "medium",
|
|
@@ -3297,27 +3435,28 @@ function Select({
|
|
|
3297
3435
|
isDisabled = false,
|
|
3298
3436
|
isError = false,
|
|
3299
3437
|
isOptionSelected = false,
|
|
3438
|
+
hasDeselectButton,
|
|
3300
3439
|
onChange,
|
|
3301
3440
|
optionListMaxHeight,
|
|
3302
3441
|
matchListToTrigger = false,
|
|
3303
3442
|
"aria-label": ariaLabel,
|
|
3304
3443
|
"aria-describedby": ariaDescribedby
|
|
3305
3444
|
}) {
|
|
3306
|
-
const [isOptionListOpen, setIsOptionListOpen] = (0,
|
|
3307
|
-
const targetRef = (0,
|
|
3445
|
+
const [isOptionListOpen, setIsOptionListOpen] = (0, import_react48.useState)(false);
|
|
3446
|
+
const targetRef = (0, import_react48.useRef)(null);
|
|
3308
3447
|
useOutsideClick(targetRef, () => setIsOptionListOpen(false));
|
|
3309
3448
|
useDismissOnModalOpen(() => {
|
|
3310
3449
|
if (isOptionListOpen) {
|
|
3311
3450
|
setIsOptionListOpen(false);
|
|
3312
3451
|
}
|
|
3313
3452
|
});
|
|
3314
|
-
const { refs, floatingStyles } = (0,
|
|
3453
|
+
const { refs, floatingStyles } = (0, import_react47.useFloating)({
|
|
3315
3454
|
open: isOptionListOpen,
|
|
3316
3455
|
onOpenChange: setIsOptionListOpen,
|
|
3317
3456
|
placement: "bottom-start",
|
|
3318
3457
|
middleware: [
|
|
3319
|
-
(0,
|
|
3320
|
-
(0,
|
|
3458
|
+
(0, import_react47.offset)(FLOATING_OFFSET2),
|
|
3459
|
+
(0, import_react47.size)({
|
|
3321
3460
|
apply({ availableWidth, elements, rects }) {
|
|
3322
3461
|
const referenceWidth = rects.reference.width;
|
|
3323
3462
|
if (matchListToTrigger) {
|
|
@@ -3329,11 +3468,13 @@ function Select({
|
|
|
3329
3468
|
}
|
|
3330
3469
|
})
|
|
3331
3470
|
],
|
|
3332
|
-
whileElementsMounted:
|
|
3471
|
+
whileElementsMounted: import_react47.autoUpdate
|
|
3333
3472
|
});
|
|
3334
3473
|
const handleClickToggle = () => setIsOptionListOpen((prev) => !prev);
|
|
3474
|
+
const resolvedOptionListMaxHeight = optionListMaxHeight ?? getDefaultOptionListMaxHeight(size);
|
|
3335
3475
|
const buttonVariant = isError && !isDisabled ? `${variant}Error` : variant;
|
|
3336
3476
|
const isSelected = isOptionSelected && !isDisabled && selectedOption !== null && !isError;
|
|
3477
|
+
const isDeselectVisible = hasDeselectButton ?? placeholder != null;
|
|
3337
3478
|
const wrapperClasses = (0, import_clsx33.default)("relative flex shrink-0 items-center gap-1 rounded bg-uiBackground01", {
|
|
3338
3479
|
"h-6": size === "x-small" || size === "small",
|
|
3339
3480
|
"h-8": size === "medium",
|
|
@@ -3369,7 +3510,7 @@ function Select({
|
|
|
3369
3510
|
value: {
|
|
3370
3511
|
size,
|
|
3371
3512
|
variant,
|
|
3372
|
-
|
|
3513
|
+
isDeselectVisible,
|
|
3373
3514
|
setIsOptionListOpen,
|
|
3374
3515
|
selectedOption,
|
|
3375
3516
|
onChange,
|
|
@@ -3402,7 +3543,7 @@ function Select({
|
|
|
3402
3543
|
]
|
|
3403
3544
|
}
|
|
3404
3545
|
),
|
|
3405
|
-
isOptionListOpen && !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3546
|
+
isOptionListOpen && !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react47.FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "relative z-popover", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(SelectList, { ref: refs.setFloating, maxHeight: resolvedOptionListMaxHeight, children }) }) })
|
|
3406
3547
|
] })
|
|
3407
3548
|
}
|
|
3408
3549
|
);
|
|
@@ -3490,10 +3631,10 @@ function PaginationSelect({
|
|
|
3490
3631
|
}
|
|
3491
3632
|
|
|
3492
3633
|
// src/password-input/password-input.tsx
|
|
3493
|
-
var
|
|
3634
|
+
var import_react49 = require("react");
|
|
3494
3635
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
3495
|
-
var PasswordInputBase = (0,
|
|
3496
|
-
const [isPasswordVisible, setIsPasswordVisible] = (0,
|
|
3636
|
+
var PasswordInputBase = (0, import_react49.forwardRef)(function PasswordInput({ disabled = false, children, ...props }, ref) {
|
|
3637
|
+
const [isPasswordVisible, setIsPasswordVisible] = (0, import_react49.useState)(false);
|
|
3497
3638
|
const { className: _className, ...textInputProps } = props;
|
|
3498
3639
|
const handlePasswordVisibilityToggle = () => {
|
|
3499
3640
|
setIsPasswordVisible((prev) => !prev);
|
|
@@ -3528,7 +3669,7 @@ var PasswordInput2 = Object.assign(PasswordInputBase, {
|
|
|
3528
3669
|
});
|
|
3529
3670
|
|
|
3530
3671
|
// src/popup/popup.tsx
|
|
3531
|
-
var
|
|
3672
|
+
var import_react52 = require("react");
|
|
3532
3673
|
|
|
3533
3674
|
// src/popup/popup-body.tsx
|
|
3534
3675
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
@@ -3537,8 +3678,8 @@ function PopupBody({ children }) {
|
|
|
3537
3678
|
}
|
|
3538
3679
|
|
|
3539
3680
|
// src/popup/popup-context.ts
|
|
3540
|
-
var
|
|
3541
|
-
var PopupContext = (0,
|
|
3681
|
+
var import_react50 = require("react");
|
|
3682
|
+
var PopupContext = (0, import_react50.createContext)({
|
|
3542
3683
|
isOpen: false,
|
|
3543
3684
|
onClose: () => null
|
|
3544
3685
|
});
|
|
@@ -3550,10 +3691,10 @@ function PopupFooter({ children }) {
|
|
|
3550
3691
|
}
|
|
3551
3692
|
|
|
3552
3693
|
// src/popup/popup-header.tsx
|
|
3553
|
-
var
|
|
3694
|
+
var import_react51 = require("react");
|
|
3554
3695
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
3555
3696
|
function PopupHeader({ children, before }) {
|
|
3556
|
-
const { onClose } = (0,
|
|
3697
|
+
const { onClose } = (0, import_react51.useContext)(PopupContext);
|
|
3557
3698
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "typography-h5 flex h-12 w-full shrink-0 items-start justify-between rounded-t-lg px-6 pt-3 text-text01", children: [
|
|
3558
3699
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
3559
3700
|
before,
|
|
@@ -3568,7 +3709,7 @@ var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
|
3568
3709
|
var LIMIT_WIDTH2 = 320;
|
|
3569
3710
|
var LIMIT_HEIGHT2 = 184;
|
|
3570
3711
|
function useOptionalPopoverContext() {
|
|
3571
|
-
return (0,
|
|
3712
|
+
return (0, import_react52.useContext)(PopoverContext);
|
|
3572
3713
|
}
|
|
3573
3714
|
function Popup({ children, isOpen: controlledIsOpen, width = 480, height, onClose }) {
|
|
3574
3715
|
const renderWidth = typeof width === "number" ? Math.max(width, LIMIT_WIDTH2) : width;
|
|
@@ -3595,7 +3736,7 @@ Popup.Footer = PopupFooter;
|
|
|
3595
3736
|
// src/radio/radio.tsx
|
|
3596
3737
|
var import_component_theme14 = require("@zenkigen-inc/component-theme");
|
|
3597
3738
|
var import_clsx34 = __toESM(require("clsx"));
|
|
3598
|
-
var
|
|
3739
|
+
var import_react53 = require("react");
|
|
3599
3740
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
3600
3741
|
function Radio({
|
|
3601
3742
|
name,
|
|
@@ -3608,14 +3749,14 @@ function Radio({
|
|
|
3608
3749
|
onChange
|
|
3609
3750
|
}) {
|
|
3610
3751
|
const isLarge = size === "large";
|
|
3611
|
-
const [isMouseOver, setIsMouseOver] = (0,
|
|
3612
|
-
const handleMouseOverInput = (0,
|
|
3752
|
+
const [isMouseOver, setIsMouseOver] = (0, import_react53.useState)(false);
|
|
3753
|
+
const handleMouseOverInput = (0, import_react53.useCallback)(() => {
|
|
3613
3754
|
setIsMouseOver(true);
|
|
3614
3755
|
}, []);
|
|
3615
|
-
const handleMouseOutInput = (0,
|
|
3756
|
+
const handleMouseOutInput = (0, import_react53.useCallback)(() => {
|
|
3616
3757
|
setIsMouseOver(false);
|
|
3617
3758
|
}, []);
|
|
3618
|
-
const handleChange = (0,
|
|
3759
|
+
const handleChange = (0, import_react53.useCallback)(
|
|
3619
3760
|
(e) => !isDisabled && onChange?.(e),
|
|
3620
3761
|
[isDisabled, onChange]
|
|
3621
3762
|
);
|
|
@@ -3696,13 +3837,13 @@ function Radio({
|
|
|
3696
3837
|
}
|
|
3697
3838
|
|
|
3698
3839
|
// src/radio-card/radio-card.tsx
|
|
3699
|
-
var
|
|
3840
|
+
var import_react56 = require("react");
|
|
3700
3841
|
|
|
3701
3842
|
// src/radio-card/radio-card-context.ts
|
|
3702
|
-
var
|
|
3703
|
-
var RadioCardContext = (0,
|
|
3843
|
+
var import_react54 = require("react");
|
|
3844
|
+
var RadioCardContext = (0, import_react54.createContext)(null);
|
|
3704
3845
|
function useRadioCardContext(componentName) {
|
|
3705
|
-
const context = (0,
|
|
3846
|
+
const context = (0, import_react54.useContext)(RadioCardContext);
|
|
3706
3847
|
if (context === null) {
|
|
3707
3848
|
throw new Error(`<${componentName}> \u306F <RadioCard> \u306E\u5185\u90E8\u3067\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044`);
|
|
3708
3849
|
}
|
|
@@ -3742,11 +3883,11 @@ RadioCardGroup.displayName = "RadioCard.Group";
|
|
|
3742
3883
|
// src/radio-card/radio-card-item.tsx
|
|
3743
3884
|
var import_component_theme15 = require("@zenkigen-inc/component-theme");
|
|
3744
3885
|
var import_clsx35 = __toESM(require("clsx"));
|
|
3745
|
-
var
|
|
3886
|
+
var import_react55 = require("react");
|
|
3746
3887
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
3747
3888
|
function RadioCardItem({ value, label, description, isDisabled: itemDisabled = false, id }) {
|
|
3748
3889
|
const context = useRadioCardContext("RadioCard.Item");
|
|
3749
|
-
const autoId = (0,
|
|
3890
|
+
const autoId = (0, import_react55.useId)();
|
|
3750
3891
|
const inputId = id ?? autoId;
|
|
3751
3892
|
const labelId = `${inputId}-label`;
|
|
3752
3893
|
const descriptionId = `${inputId}-description`;
|
|
@@ -3840,24 +3981,24 @@ function RadioCardRoot({
|
|
|
3840
3981
|
"aria-label": ariaLabel,
|
|
3841
3982
|
"aria-labelledby": ariaLabelledby
|
|
3842
3983
|
}) {
|
|
3843
|
-
const autoName = (0,
|
|
3844
|
-
const baseId = (0,
|
|
3984
|
+
const autoName = (0, import_react56.useId)();
|
|
3985
|
+
const baseId = (0, import_react56.useId)();
|
|
3845
3986
|
const resolvedName = name ?? autoName;
|
|
3846
3987
|
const errorIds = [];
|
|
3847
|
-
const enhancedChildren =
|
|
3848
|
-
if (!(0,
|
|
3988
|
+
const enhancedChildren = import_react56.Children.map(children, (child) => {
|
|
3989
|
+
if (!(0, import_react56.isValidElement)(child)) {
|
|
3849
3990
|
return child;
|
|
3850
3991
|
}
|
|
3851
3992
|
if (child.type === RadioCardErrorMessage && isError) {
|
|
3852
3993
|
const errorChild = child;
|
|
3853
3994
|
const assignedId = errorChild.props.id ?? `${baseId}-error-${errorIds.length + 1}`;
|
|
3854
3995
|
errorIds.push(assignedId);
|
|
3855
|
-
return (0,
|
|
3996
|
+
return (0, import_react56.cloneElement)(errorChild, { id: assignedId });
|
|
3856
3997
|
}
|
|
3857
3998
|
return child;
|
|
3858
3999
|
});
|
|
3859
4000
|
const errorDescribedBy = errorIds.length > 0 ? errorIds.join(" ") : null;
|
|
3860
|
-
const contextValue = (0,
|
|
4001
|
+
const contextValue = (0, import_react56.useMemo)(
|
|
3861
4002
|
() => ({
|
|
3862
4003
|
value,
|
|
3863
4004
|
onChange,
|
|
@@ -3881,9 +4022,9 @@ var RadioCard = Object.assign(RadioCardRoot, {
|
|
|
3881
4022
|
|
|
3882
4023
|
// src/search/search.tsx
|
|
3883
4024
|
var import_clsx36 = require("clsx");
|
|
3884
|
-
var
|
|
4025
|
+
var import_react57 = require("react");
|
|
3885
4026
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
3886
|
-
var Search = (0,
|
|
4027
|
+
var Search = (0, import_react57.forwardRef)(({ width = "100%", size = "medium", ...props }, ref) => {
|
|
3887
4028
|
const classes = (0, import_clsx36.clsx)(
|
|
3888
4029
|
"flex items-center rounded-full border border-uiBorder02 bg-uiBackground01 focus-within:border-activeInput",
|
|
3889
4030
|
{ "h-8 px-3": size === "medium" },
|
|
@@ -3921,16 +4062,16 @@ var Search = (0, import_react56.forwardRef)(({ width = "100%", size = "medium",
|
|
|
3921
4062
|
Search.displayName = "Search";
|
|
3922
4063
|
|
|
3923
4064
|
// src/segmented-control/segmented-control.tsx
|
|
3924
|
-
var
|
|
4065
|
+
var import_react60 = __toESM(require("react"));
|
|
3925
4066
|
|
|
3926
4067
|
// src/segmented-control/segmented-control-context.ts
|
|
3927
|
-
var
|
|
3928
|
-
var SegmentedControlContext = (0,
|
|
4068
|
+
var import_react58 = require("react");
|
|
4069
|
+
var SegmentedControlContext = (0, import_react58.createContext)(null);
|
|
3929
4070
|
|
|
3930
4071
|
// src/segmented-control/segmented-control-item.tsx
|
|
3931
4072
|
var import_component_theme16 = require("@zenkigen-inc/component-theme");
|
|
3932
4073
|
var import_clsx37 = require("clsx");
|
|
3933
|
-
var
|
|
4074
|
+
var import_react59 = require("react");
|
|
3934
4075
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
3935
4076
|
var SegmentedControlItem = ({
|
|
3936
4077
|
label,
|
|
@@ -3940,9 +4081,9 @@ var SegmentedControlItem = ({
|
|
|
3940
4081
|
"aria-label": ariaLabel,
|
|
3941
4082
|
...rest
|
|
3942
4083
|
}) => {
|
|
3943
|
-
const context = (0,
|
|
3944
|
-
const buttonRef = (0,
|
|
3945
|
-
const lastInteractionWasMouse = (0,
|
|
4084
|
+
const context = (0, import_react59.useContext)(SegmentedControlContext);
|
|
4085
|
+
const buttonRef = (0, import_react59.useRef)(null);
|
|
4086
|
+
const lastInteractionWasMouse = (0, import_react59.useRef)(false);
|
|
3946
4087
|
if (context === null) {
|
|
3947
4088
|
throw new Error("SegmentedControl.Item must be used within SegmentedControl");
|
|
3948
4089
|
}
|
|
@@ -3958,7 +4099,7 @@ var SegmentedControlItem = ({
|
|
|
3958
4099
|
const isSelected = value === selectedValue;
|
|
3959
4100
|
const isFocused = value === focusedValue;
|
|
3960
4101
|
const isOptionDisabled = isContextDisabled || itemDisabled === true;
|
|
3961
|
-
(0,
|
|
4102
|
+
(0, import_react59.useEffect)(() => {
|
|
3962
4103
|
if (isFocused === true && buttonRef.current !== null) {
|
|
3963
4104
|
buttonRef.current.focus();
|
|
3964
4105
|
}
|
|
@@ -4035,15 +4176,15 @@ var SegmentedControl = ({
|
|
|
4035
4176
|
"aria-label": ariaLabel,
|
|
4036
4177
|
...rest
|
|
4037
4178
|
}) => {
|
|
4038
|
-
const containerRef = (0,
|
|
4039
|
-
const itemIds =
|
|
4040
|
-
if (!
|
|
4179
|
+
const containerRef = (0, import_react60.useRef)(null);
|
|
4180
|
+
const itemIds = import_react60.Children.toArray(children).filter((child) => {
|
|
4181
|
+
if (!import_react60.default.isValidElement(child) || typeof child.props !== "object" || child.props === null || !("value" in child.props)) {
|
|
4041
4182
|
return false;
|
|
4042
4183
|
}
|
|
4043
4184
|
const props = child.props;
|
|
4044
4185
|
return props.isDisabled !== true;
|
|
4045
4186
|
}).map((child) => child.props.value);
|
|
4046
|
-
const childrenCount =
|
|
4187
|
+
const childrenCount = import_react60.Children.count(children);
|
|
4047
4188
|
const containerStyle = { gridTemplateColumns: `repeat(${childrenCount}, minmax(0,1fr))` };
|
|
4048
4189
|
const {
|
|
4049
4190
|
focusedValue,
|
|
@@ -4089,7 +4230,7 @@ SegmentedControl.Item = SegmentedControlItem;
|
|
|
4089
4230
|
// src/select-sort/select-sort.tsx
|
|
4090
4231
|
var import_component_theme19 = require("@zenkigen-inc/component-theme");
|
|
4091
4232
|
var import_clsx40 = __toESM(require("clsx"));
|
|
4092
|
-
var
|
|
4233
|
+
var import_react61 = require("react");
|
|
4093
4234
|
|
|
4094
4235
|
// src/select-sort/select-list.tsx
|
|
4095
4236
|
var import_component_theme18 = require("@zenkigen-inc/component-theme");
|
|
@@ -4156,8 +4297,8 @@ function SelectSort({
|
|
|
4156
4297
|
onChange,
|
|
4157
4298
|
onClickDeselect
|
|
4158
4299
|
}) {
|
|
4159
|
-
const [isOptionListOpen, setIsOptionListOpen] = (0,
|
|
4160
|
-
const targetRef = (0,
|
|
4300
|
+
const [isOptionListOpen, setIsOptionListOpen] = (0, import_react61.useState)(false);
|
|
4301
|
+
const targetRef = (0, import_react61.useRef)(null);
|
|
4161
4302
|
useOutsideClick(targetRef, () => setIsOptionListOpen(false));
|
|
4162
4303
|
useDismissOnModalOpen(() => {
|
|
4163
4304
|
if (isOptionListOpen) {
|
|
@@ -4165,7 +4306,7 @@ function SelectSort({
|
|
|
4165
4306
|
}
|
|
4166
4307
|
});
|
|
4167
4308
|
const handleClickToggle = () => setIsOptionListOpen((prev) => !prev);
|
|
4168
|
-
const handleClickItem = (0,
|
|
4309
|
+
const handleClickItem = (0, import_react61.useCallback)(
|
|
4169
4310
|
(value) => {
|
|
4170
4311
|
onChange?.(value);
|
|
4171
4312
|
setIsOptionListOpen(false);
|
|
@@ -4232,7 +4373,7 @@ function SelectSort({
|
|
|
4232
4373
|
// src/sort-button/sort-button.tsx
|
|
4233
4374
|
var import_component_theme20 = require("@zenkigen-inc/component-theme");
|
|
4234
4375
|
var import_clsx41 = __toESM(require("clsx"));
|
|
4235
|
-
var
|
|
4376
|
+
var import_react62 = require("react");
|
|
4236
4377
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
4237
4378
|
function SortButton({
|
|
4238
4379
|
size = "medium",
|
|
@@ -4244,7 +4385,7 @@ function SortButton({
|
|
|
4244
4385
|
"aria-label": ariaLabel,
|
|
4245
4386
|
...rest
|
|
4246
4387
|
}) {
|
|
4247
|
-
const handleClick = (0,
|
|
4388
|
+
const handleClick = (0, import_react62.useCallback)(() => {
|
|
4248
4389
|
if (isDisabled || !onClick) return;
|
|
4249
4390
|
onClick();
|
|
4250
4391
|
}, [isDisabled, onClick]);
|
|
@@ -4302,13 +4443,13 @@ function SortButton({
|
|
|
4302
4443
|
|
|
4303
4444
|
// src/steps/steps.tsx
|
|
4304
4445
|
var import_clsx44 = require("clsx");
|
|
4305
|
-
var
|
|
4446
|
+
var import_react65 = require("react");
|
|
4306
4447
|
|
|
4307
4448
|
// src/steps/steps-context.ts
|
|
4308
|
-
var
|
|
4309
|
-
var StepsContext = (0,
|
|
4449
|
+
var import_react63 = require("react");
|
|
4450
|
+
var StepsContext = (0, import_react63.createContext)(null);
|
|
4310
4451
|
function useStepsContext() {
|
|
4311
|
-
const context = (0,
|
|
4452
|
+
const context = (0, import_react63.useContext)(StepsContext);
|
|
4312
4453
|
if (context === null) {
|
|
4313
4454
|
throw new Error("Steps.Item must be used within <Steps>");
|
|
4314
4455
|
}
|
|
@@ -4319,10 +4460,10 @@ function useStepsContext() {
|
|
|
4319
4460
|
var import_clsx43 = require("clsx");
|
|
4320
4461
|
|
|
4321
4462
|
// src/steps/steps-item-context.ts
|
|
4322
|
-
var
|
|
4323
|
-
var StepsItemContext = (0,
|
|
4463
|
+
var import_react64 = require("react");
|
|
4464
|
+
var StepsItemContext = (0, import_react64.createContext)(null);
|
|
4324
4465
|
function useStepsItemContext() {
|
|
4325
|
-
const context = (0,
|
|
4466
|
+
const context = (0, import_react64.useContext)(StepsItemContext);
|
|
4326
4467
|
if (context === null) {
|
|
4327
4468
|
throw new Error("Steps.Item must be rendered inside a <Steps> component");
|
|
4328
4469
|
}
|
|
@@ -4462,15 +4603,15 @@ function HorizontalSeparatorCell({
|
|
|
4462
4603
|
}
|
|
4463
4604
|
function collectStepsItems(children) {
|
|
4464
4605
|
const result = [];
|
|
4465
|
-
|
|
4466
|
-
if (!(0,
|
|
4606
|
+
import_react65.Children.toArray(children).forEach((child) => {
|
|
4607
|
+
if (!(0, import_react65.isValidElement)(child)) {
|
|
4467
4608
|
return;
|
|
4468
4609
|
}
|
|
4469
4610
|
if (child.type === StepsItem) {
|
|
4470
4611
|
result.push(child);
|
|
4471
4612
|
return;
|
|
4472
4613
|
}
|
|
4473
|
-
if (child.type ===
|
|
4614
|
+
if (child.type === import_react65.Fragment) {
|
|
4474
4615
|
const fragmentChildren = child.props.children;
|
|
4475
4616
|
result.push(...collectStepsItems(fragmentChildren));
|
|
4476
4617
|
}
|
|
@@ -4487,12 +4628,12 @@ function StepsRoot({
|
|
|
4487
4628
|
variant = "solid",
|
|
4488
4629
|
"aria-label": ariaLabel
|
|
4489
4630
|
}) {
|
|
4490
|
-
const baseId = (0,
|
|
4491
|
-
const [internalStep] = (0,
|
|
4631
|
+
const baseId = (0, import_react65.useId)();
|
|
4632
|
+
const [internalStep] = (0, import_react65.useState)(defaultCurrentStep ?? 0);
|
|
4492
4633
|
const resolvedCurrentStep = currentStep ?? internalStep;
|
|
4493
|
-
const itemElements = (0,
|
|
4634
|
+
const itemElements = (0, import_react65.useMemo)(() => collectStepsItems(children), [children]);
|
|
4494
4635
|
const stepsCount = itemElements.length;
|
|
4495
|
-
const contextValue = (0,
|
|
4636
|
+
const contextValue = (0, import_react65.useMemo)(
|
|
4496
4637
|
() => ({
|
|
4497
4638
|
size,
|
|
4498
4639
|
orientation,
|
|
@@ -4545,7 +4686,7 @@ Steps.Item = StepsItem;
|
|
|
4545
4686
|
|
|
4546
4687
|
// src/tab/tab.tsx
|
|
4547
4688
|
var import_clsx46 = require("clsx");
|
|
4548
|
-
var
|
|
4689
|
+
var import_react66 = require("react");
|
|
4549
4690
|
|
|
4550
4691
|
// src/tab/tab-item.tsx
|
|
4551
4692
|
var import_clsx45 = require("clsx");
|
|
@@ -4584,7 +4725,7 @@ var TabItem = ({ isSelected = false, isDisabled = false, icon, ...props }) => {
|
|
|
4584
4725
|
// src/tab/tab.tsx
|
|
4585
4726
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
4586
4727
|
function Tab({ children, layout = "auto" }) {
|
|
4587
|
-
const childrenCount =
|
|
4728
|
+
const childrenCount = import_react66.Children.count(children);
|
|
4588
4729
|
const containerStyle = layout === "equal" ? { gridTemplateColumns: `repeat(${childrenCount}, minmax(0,1fr))` } : {};
|
|
4589
4730
|
const containerClasses = (0, import_clsx46.clsx)(
|
|
4590
4731
|
"relative gap-4 px-6 before:absolute before:inset-x-0 before:bottom-0 before:h-px before:bg-uiBorder01",
|
|
@@ -4691,13 +4832,13 @@ function Tag({ id, children, color, variant = "normal", size = "medium", isEdita
|
|
|
4691
4832
|
|
|
4692
4833
|
// src/text-area/text-area.tsx
|
|
4693
4834
|
var import_clsx53 = require("clsx");
|
|
4694
|
-
var
|
|
4835
|
+
var import_react70 = require("react");
|
|
4695
4836
|
|
|
4696
4837
|
// src/text-area/text-area-context.tsx
|
|
4697
|
-
var
|
|
4698
|
-
var TextAreaCompoundContext = (0,
|
|
4838
|
+
var import_react67 = require("react");
|
|
4839
|
+
var TextAreaCompoundContext = (0, import_react67.createContext)(null);
|
|
4699
4840
|
var useTextAreaCompoundContext = (componentName) => {
|
|
4700
|
-
const context = (0,
|
|
4841
|
+
const context = (0, import_react67.useContext)(TextAreaCompoundContext);
|
|
4701
4842
|
if (context == null) {
|
|
4702
4843
|
throw new Error(`${componentName} \u3092\u4F7F\u7528\u3059\u308B\u306B\u306F TextArea \u306E\u5B50\u8981\u7D20\u3068\u3057\u3066\u914D\u7F6E\u3059\u308B\u5FC5\u8981\u304C\u3042\u308B\u3002`);
|
|
4703
4844
|
}
|
|
@@ -4706,9 +4847,9 @@ var useTextAreaCompoundContext = (componentName) => {
|
|
|
4706
4847
|
|
|
4707
4848
|
// src/text-area/text-area-error-message.tsx
|
|
4708
4849
|
var import_clsx51 = require("clsx");
|
|
4709
|
-
var
|
|
4850
|
+
var import_react68 = require("react");
|
|
4710
4851
|
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
4711
|
-
var TextAreaErrorMessage = (0,
|
|
4852
|
+
var TextAreaErrorMessage = (0, import_react68.forwardRef)(
|
|
4712
4853
|
({ "aria-live": ariaLive = "assertive", ...props }, ref) => {
|
|
4713
4854
|
const { textAreaProps } = useTextAreaCompoundContext("TextArea.ErrorMessage");
|
|
4714
4855
|
const typographyClass = textAreaProps.size === "large" ? "typography-label13regular" : "typography-label12regular";
|
|
@@ -4724,9 +4865,9 @@ TextAreaErrorMessage.displayName = "TextArea.ErrorMessage";
|
|
|
4724
4865
|
|
|
4725
4866
|
// src/text-area/text-area-helper-message.tsx
|
|
4726
4867
|
var import_clsx52 = require("clsx");
|
|
4727
|
-
var
|
|
4868
|
+
var import_react69 = require("react");
|
|
4728
4869
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
4729
|
-
var TextAreaHelperMessage = (0,
|
|
4870
|
+
var TextAreaHelperMessage = (0, import_react69.forwardRef)((props, ref) => {
|
|
4730
4871
|
const { textAreaProps } = useTextAreaCompoundContext("TextArea.HelperMessage");
|
|
4731
4872
|
const typographyClass = textAreaProps.size === "large" ? "typography-label13regular" : "typography-label12regular";
|
|
4732
4873
|
const helperMessageClassName = (0, import_clsx52.clsx)(typographyClass, "text-text02");
|
|
@@ -4752,8 +4893,8 @@ function TextAreaInner({
|
|
|
4752
4893
|
maxLength,
|
|
4753
4894
|
...props
|
|
4754
4895
|
}, ref) {
|
|
4755
|
-
const autoGeneratedId = (0,
|
|
4756
|
-
const textAreaPropsForContext = (0,
|
|
4896
|
+
const autoGeneratedId = (0, import_react70.useId)();
|
|
4897
|
+
const textAreaPropsForContext = (0, import_react70.useMemo)(
|
|
4757
4898
|
() => ({
|
|
4758
4899
|
size,
|
|
4759
4900
|
variant,
|
|
@@ -4761,7 +4902,7 @@ function TextAreaInner({
|
|
|
4761
4902
|
}),
|
|
4762
4903
|
[size, variant, isError]
|
|
4763
4904
|
);
|
|
4764
|
-
const contextValue = (0,
|
|
4905
|
+
const contextValue = (0, import_react70.useMemo)(
|
|
4765
4906
|
() => ({
|
|
4766
4907
|
textAreaProps: textAreaPropsForContext,
|
|
4767
4908
|
forwardedRef: ref
|
|
@@ -4771,21 +4912,21 @@ function TextAreaInner({
|
|
|
4771
4912
|
const helperMessageIds = [];
|
|
4772
4913
|
const errorIds = [];
|
|
4773
4914
|
const describedByBaseId = props.id ?? autoGeneratedId;
|
|
4774
|
-
const enhancedChildren =
|
|
4775
|
-
if (!(0,
|
|
4915
|
+
const enhancedChildren = import_react70.Children.map(children, (child) => {
|
|
4916
|
+
if (!(0, import_react70.isValidElement)(child)) {
|
|
4776
4917
|
return child;
|
|
4777
4918
|
}
|
|
4778
4919
|
if (child.type === TextAreaHelperMessage) {
|
|
4779
4920
|
const helperChild = child;
|
|
4780
4921
|
const assignedId = helperChild.props.id ?? `${describedByBaseId}-helper-${helperMessageIds.length + 1}`;
|
|
4781
4922
|
helperMessageIds.push(assignedId);
|
|
4782
|
-
return (0,
|
|
4923
|
+
return (0, import_react70.cloneElement)(helperChild, { id: assignedId });
|
|
4783
4924
|
}
|
|
4784
4925
|
if (child.type === TextAreaErrorMessage && isError) {
|
|
4785
4926
|
const errorChild = child;
|
|
4786
4927
|
const assignedId = errorChild.props.id ?? `${describedByBaseId}-error-${errorIds.length + 1}`;
|
|
4787
4928
|
errorIds.push(assignedId);
|
|
4788
|
-
return (0,
|
|
4929
|
+
return (0, import_react70.cloneElement)(errorChild, { id: assignedId });
|
|
4789
4930
|
}
|
|
4790
4931
|
return child;
|
|
4791
4932
|
});
|
|
@@ -4887,7 +5028,7 @@ function TextAreaInner({
|
|
|
4887
5028
|
children: counterLimit != null ? `${currentLength}/${counterLimit}\u6587\u5B57` : `${currentLength}\u6587\u5B57`
|
|
4888
5029
|
}
|
|
4889
5030
|
) : null;
|
|
4890
|
-
const stackedChildren = enhancedChildren == null ? [] :
|
|
5031
|
+
const stackedChildren = enhancedChildren == null ? [] : import_react70.Children.toArray(enhancedChildren);
|
|
4891
5032
|
const hasMessageChildren = stackedChildren.length > 0;
|
|
4892
5033
|
const hasBottomContent = hasMessageChildren || counterElement != null;
|
|
4893
5034
|
if (!hasBottomContent) {
|
|
@@ -4908,20 +5049,20 @@ var attachStatics2 = (component) => {
|
|
|
4908
5049
|
component.displayName = "TextArea";
|
|
4909
5050
|
return component;
|
|
4910
5051
|
};
|
|
4911
|
-
var TextAreaBase = (0,
|
|
5052
|
+
var TextAreaBase = (0, import_react70.forwardRef)(function TextAreaBase2(props, ref) {
|
|
4912
5053
|
return TextAreaInner(props, ref);
|
|
4913
5054
|
});
|
|
4914
5055
|
var TextArea = attachStatics2(TextAreaBase);
|
|
4915
5056
|
|
|
4916
5057
|
// src/time-picker/time-picker.tsx
|
|
4917
5058
|
var import_clsx55 = require("clsx");
|
|
4918
|
-
var
|
|
5059
|
+
var import_react73 = require("react");
|
|
4919
5060
|
|
|
4920
5061
|
// src/time-picker/time-picker-context.tsx
|
|
4921
|
-
var
|
|
4922
|
-
var TimePickerCompoundContext = (0,
|
|
5062
|
+
var import_react71 = require("react");
|
|
5063
|
+
var TimePickerCompoundContext = (0, import_react71.createContext)(null);
|
|
4923
5064
|
var useTimePickerCompoundContext = (componentName) => {
|
|
4924
|
-
const context = (0,
|
|
5065
|
+
const context = (0, import_react71.useContext)(TimePickerCompoundContext);
|
|
4925
5066
|
if (context == null) {
|
|
4926
5067
|
throw new Error(`${componentName} \u3092\u4F7F\u7528\u3059\u308B\u306B\u306F TimePicker \u306E\u5B50\u8981\u7D20\u3068\u3057\u3066\u914D\u7F6E\u3059\u308B\u5FC5\u8981\u304C\u3042\u308B\u3002`);
|
|
4927
5068
|
}
|
|
@@ -4930,9 +5071,9 @@ var useTimePickerCompoundContext = (componentName) => {
|
|
|
4930
5071
|
|
|
4931
5072
|
// src/time-picker/time-picker-error-message.tsx
|
|
4932
5073
|
var import_clsx54 = require("clsx");
|
|
4933
|
-
var
|
|
5074
|
+
var import_react72 = require("react");
|
|
4934
5075
|
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
4935
|
-
var TimePickerErrorMessage = (0,
|
|
5076
|
+
var TimePickerErrorMessage = (0, import_react72.forwardRef)(
|
|
4936
5077
|
({ "aria-live": ariaLive = "assertive", ...props }, ref) => {
|
|
4937
5078
|
const { size, isError } = useTimePickerCompoundContext("TimePicker.ErrorMessage");
|
|
4938
5079
|
const typographyClass = size === "large" ? "typography-label12regular" : "typography-label11regular";
|
|
@@ -5055,9 +5196,9 @@ var TimePicker = ({
|
|
|
5055
5196
|
isError = false,
|
|
5056
5197
|
children
|
|
5057
5198
|
}) => {
|
|
5058
|
-
const autoGeneratedId = (0,
|
|
5059
|
-
const hourOptions = (0,
|
|
5060
|
-
const minuteOptions = (0,
|
|
5199
|
+
const autoGeneratedId = (0, import_react73.useId)();
|
|
5200
|
+
const hourOptions = (0, import_react73.useMemo)(() => generateHourOptions(minuteStep, minTime, maxTime), [minuteStep, minTime, maxTime]);
|
|
5201
|
+
const minuteOptions = (0, import_react73.useMemo)(
|
|
5061
5202
|
() => generateMinuteOptions(minuteStep, value.hour, minTime, maxTime),
|
|
5062
5203
|
[minuteStep, value.hour, minTime, maxTime]
|
|
5063
5204
|
);
|
|
@@ -5072,19 +5213,19 @@ var TimePicker = ({
|
|
|
5072
5213
|
onChange({ hour: value.hour, minute: option != null ? Number(option.value) : null });
|
|
5073
5214
|
};
|
|
5074
5215
|
const errorIds = [];
|
|
5075
|
-
const assignErrorIds = (nodes) =>
|
|
5076
|
-
if (!(0,
|
|
5216
|
+
const assignErrorIds = (nodes) => import_react73.Children.map(nodes, (child) => {
|
|
5217
|
+
if (!(0, import_react73.isValidElement)(child)) {
|
|
5077
5218
|
return child;
|
|
5078
5219
|
}
|
|
5079
|
-
if (child.type ===
|
|
5220
|
+
if (child.type === import_react73.Fragment) {
|
|
5080
5221
|
const fragmentChild = child;
|
|
5081
|
-
return (0,
|
|
5222
|
+
return (0, import_react73.cloneElement)(fragmentChild, {}, assignErrorIds(fragmentChild.props.children));
|
|
5082
5223
|
}
|
|
5083
5224
|
if (child.type === TimePickerErrorMessage && isError) {
|
|
5084
5225
|
const errorChild = child;
|
|
5085
5226
|
const assignedId = errorChild.props.id ?? `${autoGeneratedId}-error-${errorIds.length + 1}`;
|
|
5086
5227
|
errorIds.push(assignedId);
|
|
5087
|
-
return (0,
|
|
5228
|
+
return (0, import_react73.cloneElement)(errorChild, { id: assignedId });
|
|
5088
5229
|
}
|
|
5089
5230
|
return child;
|
|
5090
5231
|
});
|
|
@@ -5096,7 +5237,7 @@ var TimePicker = ({
|
|
|
5096
5237
|
"typography-label16regular": size === "large"
|
|
5097
5238
|
});
|
|
5098
5239
|
const selectWidth = SELECT_WIDTH_BY_SIZE[size];
|
|
5099
|
-
const contextValue = (0,
|
|
5240
|
+
const contextValue = (0, import_react73.useMemo)(() => ({ size, isError }), [size, isError]);
|
|
5100
5241
|
const timeInputs = /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
5101
5242
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
5102
5243
|
Select,
|
|
@@ -5132,7 +5273,7 @@ var TimePicker = ({
|
|
|
5132
5273
|
}
|
|
5133
5274
|
)
|
|
5134
5275
|
] });
|
|
5135
|
-
const stackedChildren = enhancedChildren == null ? [] :
|
|
5276
|
+
const stackedChildren = enhancedChildren == null ? [] : import_react73.Children.toArray(enhancedChildren);
|
|
5136
5277
|
const hasMessageChildren = stackedChildren.length > 0;
|
|
5137
5278
|
if (!hasMessageChildren) {
|
|
5138
5279
|
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(TimePickerCompoundContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "flex flex-col", children: timeInputs }) });
|
|
@@ -5146,40 +5287,88 @@ TimePicker.ErrorMessage = TimePickerErrorMessage;
|
|
|
5146
5287
|
TimePicker.displayName = "TimePicker";
|
|
5147
5288
|
|
|
5148
5289
|
// src/toast/toast.tsx
|
|
5149
|
-
var import_clsx56 =
|
|
5150
|
-
var
|
|
5290
|
+
var import_clsx56 = require("clsx");
|
|
5291
|
+
var import_react74 = require("react");
|
|
5151
5292
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
5152
5293
|
var CLOSE_TIME_MSEC = 5e3;
|
|
5294
|
+
var REMOVAL_FALLBACK_MSEC = 1e3;
|
|
5153
5295
|
function Toast({
|
|
5154
5296
|
state = "information",
|
|
5155
5297
|
width = "auto",
|
|
5298
|
+
// 既定 false は v1.22.0 までの互換維持のため据え置き(自動クローズしない既定では、安全弁により閉じるボタンが表示される)。
|
|
5299
|
+
// 「自動クローズ・閉じるボタンなし」の新しい既定は ToastProvider が isAutoClose を明示的に渡すことで実現している。
|
|
5156
5300
|
isAutoClose = false,
|
|
5157
5301
|
isAnimation = false,
|
|
5302
|
+
hasCloseButton = false,
|
|
5303
|
+
description,
|
|
5158
5304
|
children,
|
|
5159
5305
|
onClickClose
|
|
5160
5306
|
}) {
|
|
5161
|
-
const [isRemoving, setIsRemoving] = (0,
|
|
5162
|
-
const
|
|
5307
|
+
const [isRemoving, setIsRemoving] = (0, import_react74.useState)(false);
|
|
5308
|
+
const onClickCloseRef = (0, import_react74.useRef)(onClickClose);
|
|
5309
|
+
(0, import_react74.useEffect)(() => {
|
|
5310
|
+
onClickCloseRef.current = onClickClose;
|
|
5311
|
+
}, [onClickClose]);
|
|
5312
|
+
const hasNotifiedCloseRef = (0, import_react74.useRef)(false);
|
|
5313
|
+
const notifyClose = (0, import_react74.useCallback)(() => {
|
|
5314
|
+
if (hasNotifiedCloseRef.current) {
|
|
5315
|
+
return;
|
|
5316
|
+
}
|
|
5317
|
+
hasNotifiedCloseRef.current = true;
|
|
5318
|
+
onClickCloseRef.current();
|
|
5319
|
+
}, []);
|
|
5320
|
+
const handleClose = (0, import_react74.useCallback)(() => {
|
|
5163
5321
|
if (isAnimation) {
|
|
5164
5322
|
setIsRemoving(true);
|
|
5165
5323
|
} else {
|
|
5166
|
-
|
|
5324
|
+
notifyClose();
|
|
5167
5325
|
}
|
|
5168
|
-
}, [isAnimation,
|
|
5169
|
-
const handleAnimationEnd = (e) =>
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5326
|
+
}, [isAnimation, notifyClose]);
|
|
5327
|
+
const handleAnimationEnd = (e) => {
|
|
5328
|
+
if (e.target !== e.currentTarget) {
|
|
5329
|
+
return;
|
|
5330
|
+
}
|
|
5331
|
+
if (window.getComputedStyle(e.currentTarget).opacity === "0") {
|
|
5332
|
+
notifyClose();
|
|
5333
|
+
}
|
|
5334
|
+
};
|
|
5335
|
+
(0, import_react74.useEffect)(() => {
|
|
5336
|
+
if (!isAutoClose) {
|
|
5337
|
+
return;
|
|
5338
|
+
}
|
|
5339
|
+
const timer = window.setTimeout(() => {
|
|
5340
|
+
if (isAnimation) {
|
|
5341
|
+
setIsRemoving(true);
|
|
5342
|
+
} else {
|
|
5343
|
+
notifyClose();
|
|
5344
|
+
}
|
|
5345
|
+
}, CLOSE_TIME_MSEC);
|
|
5346
|
+
return () => window.clearTimeout(timer);
|
|
5347
|
+
}, [isAutoClose, isAnimation, notifyClose]);
|
|
5348
|
+
(0, import_react74.useEffect)(() => {
|
|
5349
|
+
if (!isRemoving) {
|
|
5350
|
+
return;
|
|
5351
|
+
}
|
|
5352
|
+
const fallbackTimer = window.setTimeout(notifyClose, REMOVAL_FALLBACK_MSEC);
|
|
5353
|
+
return () => window.clearTimeout(fallbackTimer);
|
|
5354
|
+
}, [isRemoving, notifyClose]);
|
|
5355
|
+
const isCloseButtonShown = hasCloseButton || !isAutoClose;
|
|
5356
|
+
const wrapperClasses = (0, import_clsx56.clsx)(
|
|
5357
|
+
"pointer-events-auto flex items-center gap-3 rounded border border-solid border-uiBorder01 bg-uiBackground01 p-4 shadow-floatingShadow",
|
|
5358
|
+
{
|
|
5359
|
+
["animate-toast-in"]: isAnimation && !isRemoving,
|
|
5360
|
+
["animate-toast-out opacity-0"]: isAnimation && isRemoving
|
|
5361
|
+
}
|
|
5362
|
+
);
|
|
5363
|
+
const iconClasses = (0, import_clsx56.clsx)("flex shrink-0 items-center", {
|
|
5175
5364
|
"fill-supportSuccess": state === "success",
|
|
5176
5365
|
"fill-supportError": state === "error",
|
|
5177
5366
|
"fill-supportWarning": state === "warning",
|
|
5178
5367
|
"fill-supportInfo": state === "information"
|
|
5179
5368
|
});
|
|
5180
|
-
const
|
|
5369
|
+
const titleClasses = (0, import_clsx56.clsx)("typography-body13regular break-words", {
|
|
5181
5370
|
"text-supportError": state === "error",
|
|
5182
|
-
"text-text01": state
|
|
5371
|
+
"text-text01": state !== "error"
|
|
5183
5372
|
});
|
|
5184
5373
|
const iconName = {
|
|
5185
5374
|
success: "success-filled",
|
|
@@ -5187,48 +5376,82 @@ function Toast({
|
|
|
5187
5376
|
warning: "warning",
|
|
5188
5377
|
information: "information-filled"
|
|
5189
5378
|
};
|
|
5190
|
-
(0, import_react73.useEffect)(() => {
|
|
5191
|
-
const timer = window.setTimeout(() => {
|
|
5192
|
-
if (isAutoClose) {
|
|
5193
|
-
setIsRemoving(true);
|
|
5194
|
-
}
|
|
5195
|
-
}, CLOSE_TIME_MSEC);
|
|
5196
|
-
return () => window.clearTimeout(timer);
|
|
5197
|
-
}, [isAutoClose]);
|
|
5198
5379
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: wrapperClasses, style: { width }, onAnimationEnd: handleAnimationEnd, children: [
|
|
5199
|
-
/* @__PURE__ */ (0, import_jsx_runtime79.
|
|
5200
|
-
|
|
5201
|
-
|
|
5380
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex min-w-0 flex-1 items-start gap-1", children: [
|
|
5381
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: iconClasses, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Icon, { name: iconName[state] }) }),
|
|
5382
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-2 pt-[3px]", children: [
|
|
5383
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("p", { className: titleClasses, children }),
|
|
5384
|
+
description != null && description !== "" && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("p", { className: "typography-label12regular break-words text-text01", children: description })
|
|
5385
|
+
] })
|
|
5386
|
+
] }),
|
|
5387
|
+
isCloseButtonShown && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "flex shrink-0 items-center", children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(IconButton, { icon: "close", size: "medium", variant: "text", isNoPadding: true, "aria-label": "\u9589\u3058\u308B", onClick: handleClose }) })
|
|
5202
5388
|
] });
|
|
5203
5389
|
}
|
|
5204
5390
|
|
|
5205
5391
|
// src/toast/toast-provider.tsx
|
|
5206
|
-
var
|
|
5392
|
+
var import_react75 = require("react");
|
|
5207
5393
|
var import_react_dom3 = require("react-dom");
|
|
5208
5394
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
5209
|
-
var ToastContext = (0,
|
|
5210
|
-
var ToastProvider = ({ children }) => {
|
|
5211
|
-
const [isClientRender, setIsClientRender] = (0,
|
|
5212
|
-
const [toasts, setToasts] = (0,
|
|
5213
|
-
const
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5395
|
+
var ToastContext = (0, import_react75.createContext)({});
|
|
5396
|
+
var ToastProvider = ({ children, hasCloseButton = false }) => {
|
|
5397
|
+
const [isClientRender, setIsClientRender] = (0, import_react75.useState)(false);
|
|
5398
|
+
const [toasts, setToasts] = (0, import_react75.useState)([]);
|
|
5399
|
+
const nextIdRef = (0, import_react75.useRef)(0);
|
|
5400
|
+
const addToast = (0, import_react75.useCallback)(
|
|
5401
|
+
(args) => {
|
|
5402
|
+
nextIdRef.current += 1;
|
|
5403
|
+
const id = nextIdRef.current;
|
|
5404
|
+
setToasts((prev) => [
|
|
5405
|
+
...prev,
|
|
5406
|
+
{
|
|
5407
|
+
id,
|
|
5408
|
+
message: args.message,
|
|
5409
|
+
state: args.state,
|
|
5410
|
+
description: args.description,
|
|
5411
|
+
hasCloseButton: args.hasCloseButton ?? hasCloseButton,
|
|
5412
|
+
isAutoClose: args.isAutoClose ?? true
|
|
5413
|
+
}
|
|
5414
|
+
]);
|
|
5415
|
+
},
|
|
5416
|
+
[hasCloseButton]
|
|
5417
|
+
);
|
|
5418
|
+
const removeToast = (0, import_react75.useCallback)((id) => {
|
|
5217
5419
|
setToasts((prev) => prev.filter((snackbar) => snackbar.id !== id));
|
|
5218
5420
|
}, []);
|
|
5219
|
-
(0,
|
|
5421
|
+
(0, import_react75.useEffect)(() => {
|
|
5220
5422
|
setIsClientRender(true);
|
|
5221
5423
|
}, []);
|
|
5222
5424
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(ToastContext.Provider, { value: { addToast, removeToast }, children: [
|
|
5223
5425
|
children,
|
|
5224
5426
|
isClientRender && (0, import_react_dom3.createPortal)(
|
|
5225
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
5427
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
5428
|
+
"div",
|
|
5429
|
+
{
|
|
5430
|
+
...{ [TOP_LAYER_ATTRIBUTE]: "" },
|
|
5431
|
+
role: "region",
|
|
5432
|
+
"aria-label": "\u901A\u77E5",
|
|
5433
|
+
className: "pointer-events-none fixed bottom-0 left-0 z-toast mb-4 ml-4 flex w-full flex-col-reverse gap-4",
|
|
5434
|
+
children: toasts.map((toast) => /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { role: toast.state === "error" ? "alert" : "status", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
5435
|
+
Toast,
|
|
5436
|
+
{
|
|
5437
|
+
state: toast.state,
|
|
5438
|
+
description: toast.description,
|
|
5439
|
+
hasCloseButton: toast.hasCloseButton,
|
|
5440
|
+
isAutoClose: toast.isAutoClose,
|
|
5441
|
+
isAnimation: true,
|
|
5442
|
+
width: 475,
|
|
5443
|
+
onClickClose: () => removeToast(toast.id),
|
|
5444
|
+
children: toast.message
|
|
5445
|
+
}
|
|
5446
|
+
) }, toast.id))
|
|
5447
|
+
}
|
|
5448
|
+
),
|
|
5226
5449
|
document.body
|
|
5227
5450
|
)
|
|
5228
5451
|
] });
|
|
5229
5452
|
};
|
|
5230
5453
|
var useToast = () => {
|
|
5231
|
-
return (0,
|
|
5454
|
+
return (0, import_react75.useContext)(ToastContext);
|
|
5232
5455
|
};
|
|
5233
5456
|
|
|
5234
5457
|
// src/toggle/toggle.tsx
|
|
@@ -5288,7 +5511,7 @@ function Toggle({
|
|
|
5288
5511
|
}
|
|
5289
5512
|
|
|
5290
5513
|
// src/tooltip/tooltip.tsx
|
|
5291
|
-
var
|
|
5514
|
+
var import_react77 = require("react");
|
|
5292
5515
|
var import_react_dom4 = require("react-dom");
|
|
5293
5516
|
|
|
5294
5517
|
// src/tooltip/tooltip-content.tsx
|
|
@@ -5383,9 +5606,9 @@ var TooltipContent = ({
|
|
|
5383
5606
|
};
|
|
5384
5607
|
|
|
5385
5608
|
// src/tooltip/tooltip-hook.ts
|
|
5386
|
-
var
|
|
5609
|
+
var import_react76 = require("react");
|
|
5387
5610
|
var useTooltip = () => {
|
|
5388
|
-
const calculatePosition = (0,
|
|
5611
|
+
const calculatePosition = (0, import_react76.useCallback)(
|
|
5389
5612
|
(args) => {
|
|
5390
5613
|
const result = {
|
|
5391
5614
|
maxWidth: "none",
|
|
@@ -5449,8 +5672,8 @@ function Tooltip({
|
|
|
5449
5672
|
portalTarget
|
|
5450
5673
|
}) {
|
|
5451
5674
|
const { calculatePosition } = useTooltip();
|
|
5452
|
-
const [isVisible, setIsVisible] = (0,
|
|
5453
|
-
const [tooltipPosition, setTooltipPosition] = (0,
|
|
5675
|
+
const [isVisible, setIsVisible] = (0, import_react77.useState)(false);
|
|
5676
|
+
const [tooltipPosition, setTooltipPosition] = (0, import_react77.useState)({
|
|
5454
5677
|
maxWidth: "none",
|
|
5455
5678
|
width: "auto",
|
|
5456
5679
|
left: "0px",
|
|
@@ -5459,8 +5682,8 @@ function Tooltip({
|
|
|
5459
5682
|
translateX: "0",
|
|
5460
5683
|
translateY: "0"
|
|
5461
5684
|
});
|
|
5462
|
-
const targetRef = (0,
|
|
5463
|
-
const handleMouseOverWrapper = (0,
|
|
5685
|
+
const targetRef = (0, import_react77.useRef)(null);
|
|
5686
|
+
const handleMouseOverWrapper = (0, import_react77.useCallback)(() => {
|
|
5464
5687
|
if (isDisabledHover) {
|
|
5465
5688
|
return;
|
|
5466
5689
|
}
|
|
@@ -5477,16 +5700,16 @@ function Tooltip({
|
|
|
5477
5700
|
}
|
|
5478
5701
|
setIsVisible(true);
|
|
5479
5702
|
}, [isDisabledHover, calculatePosition, maxWidth, verticalPosition, horizontalAlign, size]);
|
|
5480
|
-
const handleMouseOutWrapper = (0,
|
|
5703
|
+
const handleMouseOutWrapper = (0, import_react77.useCallback)(() => {
|
|
5481
5704
|
setIsVisible(false);
|
|
5482
5705
|
}, []);
|
|
5483
|
-
(0,
|
|
5706
|
+
(0, import_react77.useEffect)(() => {
|
|
5484
5707
|
if (targetRef.current === null) return;
|
|
5485
5708
|
const dimensions = targetRef.current?.getBoundingClientRect();
|
|
5486
5709
|
const position = calculatePosition({ dimensions, maxWidth, verticalPosition, horizontalAlign, tooltipSize: size });
|
|
5487
5710
|
setTooltipPosition(position);
|
|
5488
5711
|
}, [calculatePosition, horizontalAlign, maxWidth, size, verticalPosition]);
|
|
5489
|
-
(0,
|
|
5712
|
+
(0, import_react77.useEffect)(() => {
|
|
5490
5713
|
if (!isVisible) return;
|
|
5491
5714
|
const updatePosition = () => {
|
|
5492
5715
|
if (targetRef.current === null) return;
|