smarthr-ui 97.0.0 → 98.0.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/lib/components/AppHeader/components/common/AppLauncherFeatures.cjs +1 -1
- package/lib/components/AppHeader/components/common/AppLauncherFeatures.js +1 -1
- package/lib/components/AppHeader/components/common/AppLauncherSortDropdown.cjs +1 -1
- package/lib/components/AppHeader/components/common/AppLauncherSortDropdown.js +1 -1
- package/lib/components/AppHeader/components/desktop/AppLauncher.cjs +5 -5
- package/lib/components/AppHeader/components/desktop/AppLauncher.cjs.map +1 -1
- package/lib/components/AppHeader/components/desktop/AppLauncher.js +5 -5
- package/lib/components/AppHeader/components/desktop/AppLauncher.js.map +1 -1
- package/lib/components/AppHeader/components/desktop/DesktopHeader.cjs +1 -1
- package/lib/components/AppHeader/components/desktop/DesktopHeader.js +1 -1
- package/lib/components/AppHeader/components/desktop/ReleaseNotesDropdown.cjs +1 -1
- package/lib/components/AppHeader/components/desktop/ReleaseNotesDropdown.js +1 -1
- package/lib/components/AppHeader/components/desktop/UserInfo.cjs +1 -1
- package/lib/components/AppHeader/components/desktop/UserInfo.js +1 -1
- package/lib/components/AppHeader/components/mobile/AppLauncher.cjs +1 -1
- package/lib/components/AppHeader/components/mobile/AppLauncher.js +1 -1
- package/lib/components/AppHeader/components/mobile/AppLauncherFilterDropdown.cjs +1 -1
- package/lib/components/AppHeader/components/mobile/AppLauncherFilterDropdown.js +1 -1
- package/lib/components/AppHeader/components/mobile/Help.cjs +1 -1
- package/lib/components/AppHeader/components/mobile/Help.js +1 -1
- package/lib/components/AppHeader/components/mobile/LanguageSelector.cjs +1 -1
- package/lib/components/AppHeader/components/mobile/LanguageSelector.js +1 -1
- package/lib/components/AppHeader/components/mobile/Menu.cjs +1 -1
- package/lib/components/AppHeader/components/mobile/Menu.js +1 -1
- package/lib/components/AppHeader/components/mobile/MenuAccordion.cjs +1 -1
- package/lib/components/AppHeader/components/mobile/MenuAccordion.js +1 -1
- package/lib/components/AppHeader/components/mobile/MenuDialog.cjs +2 -2
- package/lib/components/AppHeader/components/mobile/MenuDialog.js +2 -2
- package/lib/components/AppHeader/components/mobile/MenuSubHeading.cjs +1 -1
- package/lib/components/AppHeader/components/mobile/MenuSubHeading.js +1 -1
- package/lib/components/AppHeader/components/mobile/ReleaseNote.cjs +1 -1
- package/lib/components/AppHeader/components/mobile/ReleaseNote.js +1 -1
- package/lib/components/AppHeader/components/mobile/UserInfo.cjs +2 -2
- package/lib/components/AppHeader/components/mobile/UserInfo.js +2 -2
- package/lib/components/Browser/Browser.cjs +11 -7
- package/lib/components/Browser/Browser.cjs.map +1 -1
- package/lib/components/Browser/Browser.js +12 -8
- package/lib/components/Browser/Browser.js.map +1 -1
- package/lib/components/Calendar/Calendar.cjs +1 -1
- package/lib/components/Calendar/Calendar.js +1 -1
- package/lib/components/Calendar/CalendarTable.cjs +1 -1
- package/lib/components/Calendar/CalendarTable.js +1 -1
- package/lib/components/Calendar/YearPicker.cjs +1 -1
- package/lib/components/Calendar/YearPicker.js +1 -1
- package/lib/components/Combobox/MultiCombobox/MultiCombobox.cjs +122 -134
- package/lib/components/Combobox/MultiCombobox/MultiCombobox.cjs.map +1 -1
- package/lib/components/Combobox/MultiCombobox/MultiCombobox.js +123 -135
- package/lib/components/Combobox/MultiCombobox/MultiCombobox.js.map +1 -1
- package/lib/components/Combobox/MultiCombobox/MultiSelectedItem.cjs +1 -1
- package/lib/components/Combobox/MultiCombobox/MultiSelectedItem.js +1 -1
- package/lib/components/Combobox/SingleCombobox/SingleCombobox.cjs +96 -46
- package/lib/components/Combobox/SingleCombobox/SingleCombobox.cjs.map +1 -1
- package/lib/components/Combobox/SingleCombobox/SingleCombobox.js +98 -48
- package/lib/components/Combobox/SingleCombobox/SingleCombobox.js.map +1 -1
- package/lib/components/Combobox/useListbox.cjs +1 -1
- package/lib/components/Combobox/useListbox.js +1 -1
- package/lib/components/Combobox/useOptions.cjs +3 -1
- package/lib/components/Combobox/useOptions.cjs.map +1 -1
- package/lib/components/Combobox/useOptions.js +4 -2
- package/lib/components/Combobox/useOptions.js.map +1 -1
- package/lib/components/Dialog/ControlledActionDialog/ActionDialogContentInner.cjs +3 -3
- package/lib/components/Dialog/ControlledActionDialog/ActionDialogContentInner.cjs.map +1 -1
- package/lib/components/Dialog/ControlledActionDialog/ActionDialogContentInner.js +3 -3
- package/lib/components/Dialog/ControlledActionDialog/ActionDialogContentInner.js.map +1 -1
- package/lib/components/Dialog/ControlledFormDialog/FormDialogContentInner.cjs +3 -3
- package/lib/components/Dialog/ControlledFormDialog/FormDialogContentInner.cjs.map +1 -1
- package/lib/components/Dialog/ControlledFormDialog/FormDialogContentInner.js +3 -3
- package/lib/components/Dialog/ControlledFormDialog/FormDialogContentInner.js.map +1 -1
- package/lib/components/Dialog/ControlledMessageDialog/MessageDialogContentInner.cjs +1 -1
- package/lib/components/Dialog/ControlledMessageDialog/MessageDialogContentInner.js +1 -1
- package/lib/components/Dialog/ControlledStepFormDialog/ControlledStepFormDialog.cjs +1 -1
- package/lib/components/Dialog/ControlledStepFormDialog/ControlledStepFormDialog.js +1 -1
- package/lib/components/Dialog/ControlledStepFormDialog/StepFormDialogContentInner.cjs +2 -2
- package/lib/components/Dialog/ControlledStepFormDialog/StepFormDialogContentInner.cjs.map +1 -1
- package/lib/components/Dialog/ControlledStepFormDialog/StepFormDialogContentInner.js +2 -2
- package/lib/components/Dialog/ControlledStepFormDialog/StepFormDialogContentInner.js.map +1 -1
- package/lib/components/Dialog/DialogContentResponseStatusMessage.cjs +3 -8
- package/lib/components/Dialog/DialogContentResponseStatusMessage.cjs.map +1 -1
- package/lib/components/Dialog/DialogContentResponseStatusMessage.d.ts +1 -1
- package/lib/components/Dialog/DialogContentResponseStatusMessage.js +3 -8
- package/lib/components/Dialog/DialogContentResponseStatusMessage.js.map +1 -1
- package/lib/components/Dialog/FocusTrap.cjs +4 -1
- package/lib/components/Dialog/FocusTrap.cjs.map +1 -1
- package/lib/components/Dialog/FocusTrap.js +4 -1
- package/lib/components/Dialog/FocusTrap.js.map +1 -1
- package/lib/components/Dialog/ModelessDialog/ModelessDialog.cjs +1 -1
- package/lib/components/Dialog/ModelessDialog/ModelessDialog.js +1 -1
- package/lib/components/DropZone/DropZone.cjs +1 -1
- package/lib/components/DropZone/DropZone.js +1 -1
- package/lib/components/Dropdown/Dropdown.cjs +36 -34
- package/lib/components/Dropdown/Dropdown.cjs.map +1 -1
- package/lib/components/Dropdown/Dropdown.js +37 -35
- package/lib/components/Dropdown/Dropdown.js.map +1 -1
- package/lib/components/Dropdown/DropdownMenuButton/DropdownMenuButton.cjs +1 -1
- package/lib/components/Dropdown/DropdownMenuButton/DropdownMenuButton.js +1 -1
- package/lib/components/Dropdown/FilterDropdown/FilterDropdown.cjs +3 -5
- package/lib/components/Dropdown/FilterDropdown/FilterDropdown.cjs.map +1 -1
- package/lib/components/Dropdown/FilterDropdown/FilterDropdown.d.ts +1 -1
- package/lib/components/Dropdown/FilterDropdown/FilterDropdown.js +3 -5
- package/lib/components/Dropdown/FilterDropdown/FilterDropdown.js.map +1 -1
- package/lib/components/Dropdown/SortDropdown/useSortDropdown.cjs +1 -1
- package/lib/components/Dropdown/SortDropdown/useSortDropdown.js +1 -1
- package/lib/components/ErrorScreen/AuthErrorScreen.cjs +1 -1
- package/lib/components/ErrorScreen/AuthErrorScreen.js +1 -1
- package/lib/components/ErrorScreen/ForbiddenErrorScreen.cjs +1 -1
- package/lib/components/ErrorScreen/ForbiddenErrorScreen.js +1 -1
- package/lib/components/ErrorScreen/NotFoundErrorScreen.cjs +1 -1
- package/lib/components/ErrorScreen/NotFoundErrorScreen.js +1 -1
- package/lib/components/ErrorScreen/UnauthorizedErrorScreen.cjs +1 -1
- package/lib/components/ErrorScreen/UnauthorizedErrorScreen.js +1 -1
- package/lib/components/FormControl/FormControl.cjs +2 -22
- package/lib/components/FormControl/FormControl.cjs.map +1 -1
- package/lib/components/FormControl/FormControl.js +2 -22
- package/lib/components/FormControl/FormControl.js.map +1 -1
- package/lib/components/Header/AppLauncher/AppLauncher.cjs +1 -1
- package/lib/components/Header/AppLauncher/AppLauncher.js +1 -1
- package/lib/components/Header/LanguageSwitcher/LanguageSwitcher.cjs +1 -1
- package/lib/components/Header/LanguageSwitcher/LanguageSwitcher.js +1 -1
- package/lib/components/Icon/OpenInNewTabIcon.cjs +1 -1
- package/lib/components/Icon/OpenInNewTabIcon.js +1 -1
- package/lib/components/InformationPanel/InformationPanel.cjs +1 -1
- package/lib/components/InformationPanel/InformationPanel.js +1 -1
- package/lib/components/Input/SearchInput/SearchInputIcon.cjs +1 -1
- package/lib/components/Input/SearchInput/SearchInputIcon.js +1 -1
- package/lib/components/InputFile/InputFileMultiplyAppendable.cjs +1 -1
- package/lib/components/InputFile/InputFileMultiplyAppendable.js +1 -1
- package/lib/components/InputFile/InputFileNative.cjs +1 -1
- package/lib/components/InputFile/InputFileNative.js +1 -1
- package/lib/components/Layout/Cluster/Cluster.cjs +0 -1
- package/lib/components/Layout/Cluster/Cluster.cjs.map +1 -1
- package/lib/components/Layout/Cluster/Cluster.js +0 -1
- package/lib/components/Layout/Cluster/Cluster.js.map +1 -1
- package/lib/components/Layout/Container/Container.cjs +1 -5
- package/lib/components/Layout/Container/Container.cjs.map +1 -1
- package/lib/components/Layout/Container/Container.js +1 -5
- package/lib/components/Layout/Container/Container.js.map +1 -1
- package/lib/components/Layout/Stack/Stack.cjs +22 -22
- package/lib/components/Layout/Stack/Stack.cjs.map +1 -1
- package/lib/components/Layout/Stack/Stack.js +22 -22
- package/lib/components/Layout/Stack/Stack.js.map +1 -1
- package/lib/components/Loader/LoaderSpinner.cjs +1 -1
- package/lib/components/Loader/LoaderSpinner.js +1 -1
- package/lib/components/Pagination/Pagination.cjs +1 -1
- package/lib/components/Pagination/Pagination.js +1 -1
- package/lib/components/Pagination/PaginationItemButton.cjs +1 -1
- package/lib/components/Pagination/PaginationItemButton.js +1 -1
- package/lib/components/SideNav/SideNav.cjs +3 -22
- package/lib/components/SideNav/SideNav.cjs.map +1 -1
- package/lib/components/SideNav/SideNav.d.ts +2 -9
- package/lib/components/SideNav/SideNav.js +4 -23
- package/lib/components/SideNav/SideNav.js.map +1 -1
- package/lib/components/SideNav/SideNavContext.cjs +11 -0
- package/lib/components/SideNav/SideNavContext.cjs.map +1 -0
- package/lib/components/SideNav/SideNavContext.d.ts +7 -0
- package/lib/components/SideNav/SideNavContext.js +8 -0
- package/lib/components/SideNav/SideNavContext.js.map +1 -0
- package/lib/components/SideNav/SideNavItemButton.cjs +12 -7
- package/lib/components/SideNav/SideNavItemButton.cjs.map +1 -1
- package/lib/components/SideNav/SideNavItemButton.d.ts +5 -11
- package/lib/components/SideNav/SideNavItemButton.js +12 -7
- package/lib/components/SideNav/SideNavItemButton.js.map +1 -1
- package/lib/components/Table/Th.cjs +2 -2
- package/lib/components/Table/Th.cjs.map +1 -1
- package/lib/components/Table/Th.d.ts +0 -2
- package/lib/components/Table/Th.js +2 -2
- package/lib/components/Table/Th.js.map +1 -1
- package/lib/components/Table/ThCheckbox.cjs +1 -1
- package/lib/components/Table/ThCheckbox.js +1 -1
- package/lib/components/Table/ThSortButton.cjs +5 -6
- package/lib/components/Table/ThSortButton.cjs.map +1 -1
- package/lib/components/Table/ThSortButton.d.ts +1 -6
- package/lib/components/Table/ThSortButton.js +5 -6
- package/lib/components/Table/ThSortButton.js.map +1 -1
- package/lib/components/WarekiPicker/WarekiPicker.cjs +1 -1
- package/lib/components/WarekiPicker/WarekiPicker.js +1 -1
- package/lib/index.cjs +1 -6
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +1 -4
- package/lib/index.js.map +1 -1
- package/lib/intl/Localizer.cjs +5 -1
- package/lib/intl/Localizer.cjs.map +1 -1
- package/lib/intl/Localizer.d.ts +1 -1
- package/lib/intl/Localizer.js +5 -1
- package/lib/intl/Localizer.js.map +1 -1
- package/metadata.json +1 -1
- package/package.json +1 -1
- package/smarthr-ui.css +0 -94
- package/lib/hooks/useDecorators.cjs +0 -18
- package/lib/hooks/useDecorators.cjs.map +0 -1
- package/lib/hooks/useDecorators.d.ts +0 -6
- package/lib/hooks/useDecorators.js +0 -16
- package/lib/hooks/useDecorators.js.map +0 -1
- package/lib/hooks/useDevice/DeviceProvider.cjs +0 -37
- package/lib/hooks/useDevice/DeviceProvider.cjs.map +0 -1
- package/lib/hooks/useDevice/DeviceProvider.d.ts +0 -4
- package/lib/hooks/useDevice/DeviceProvider.js +0 -35
- package/lib/hooks/useDevice/DeviceProvider.js.map +0 -1
- package/lib/hooks/useDevice/index.cjs +0 -10
- package/lib/hooks/useDevice/index.cjs.map +0 -1
- package/lib/hooks/useDevice/index.d.ts +0 -2
- package/lib/hooks/useDevice/index.js +0 -3
- package/lib/hooks/useDevice/index.js.map +0 -1
- package/lib/hooks/useDevice/useDevice.cjs +0 -11
- package/lib/hooks/useDevice/useDevice.cjs.map +0 -1
- package/lib/hooks/useDevice/useDevice.d.ts +0 -4
- package/lib/hooks/useDevice/useDevice.js +0 -8
- package/lib/hooks/useDevice/useDevice.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useMemo
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
3
|
import { tv as ce } from './../../vendor/.pnpm/tailwind-variants@0.3.1_tailwindcss@3.4.19_ts-node@10.9.2_@swc_core@1.15.17_@types_node@20.19.35_typescript@5.9.3__/vendor/tailwind-variants/dist/index.js';
|
|
4
|
-
import {
|
|
4
|
+
import { SideNavProvider } from './SideNavContext.js';
|
|
5
5
|
|
|
6
6
|
const ROUNDED = {
|
|
7
7
|
t_l: '[&>.smarthr-ui-SideNav-item:first-child]:shr-rounded-tl-l',
|
|
@@ -26,28 +26,9 @@ const classNameGenerator = ce({
|
|
|
26
26
|
rounded: false,
|
|
27
27
|
},
|
|
28
28
|
});
|
|
29
|
-
const SideNav = ({
|
|
30
|
-
const actualOnClick = useMemo(() => onClick
|
|
31
|
-
? (e) => onClick(e, (e.currentTarget.value ||
|
|
32
|
-
e.currentTarget.getAttribute('data-value')))
|
|
33
|
-
: undefined, [onClick]);
|
|
29
|
+
const SideNav = ({ size = 'M', className, rounded, children, ...rest }) => {
|
|
34
30
|
const actualClassName = useMemo(() => classNameGenerator({ rounded, className }), [rounded, className]);
|
|
35
|
-
return (jsx("ul", { ...rest, className: actualClassName, children:
|
|
36
|
-
? items.map((item) => (jsx(SideNavItemButton, { id: item.id, title: item.title, prefix: item.prefix, current: item.current, size: size, onClick: actualOnClick }, item.id)))
|
|
37
|
-
: children &&
|
|
38
|
-
Children.map(children, (child) => {
|
|
39
|
-
if (child &&
|
|
40
|
-
typeof child === 'object' &&
|
|
41
|
-
'type' in child &&
|
|
42
|
-
child.type === SideNavItemButton) {
|
|
43
|
-
return cloneElement(child, {
|
|
44
|
-
// 子コンポーネントに対して親コンポーネントから onClick size を一括で適用
|
|
45
|
-
size,
|
|
46
|
-
onClick: actualOnClick,
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
return child;
|
|
50
|
-
}) }));
|
|
31
|
+
return (jsx("ul", { ...rest, className: actualClassName, children: jsx(SideNavProvider, { value: { size }, children: children }) }));
|
|
51
32
|
};
|
|
52
33
|
|
|
53
34
|
export { SideNav };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SideNav.js","sources":["../../../src/components/SideNav/SideNav.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"SideNav.js","sources":["../../../src/components/SideNav/SideNav.tsx"],"sourcesContent":["import { type ComponentPropsWithoutRef, type FC, type PropsWithChildren, useMemo } from 'react'\nimport { type VariantProps, tv } from 'tailwind-variants'\n\nimport { SideNavProvider } from './SideNavContext'\n\nimport type { SideNavSizeType } from './SideNavItemButton'\n\ntype AbstractProps = PropsWithChildren<{\n /** 各アイテムの大きさ */\n size?: SideNavSizeType\n /** コンポーネントに適用するクラス名 */\n className?: string\n}> &\n VariantProps<typeof classNameGenerator>\ntype Props = AbstractProps & Omit<ComponentPropsWithoutRef<'ul'>, keyof AbstractProps>\n\nconst ROUNDED = {\n t_l: '[&>.smarthr-ui-SideNav-item:first-child]:shr-rounded-tl-l',\n t_r: '[&>.smarthr-ui-SideNav-item:first-child]:shr-rounded-tr-l',\n b_l: '[&>.smarthr-ui-SideNav-item:last-child]:shr-rounded-bl-l',\n b_r: '[&>.smarthr-ui-SideNav-item:last-child]:shr-rounded-br-l',\n}\nconst ROUNDED_ALL = ['shr-rounded-l', ROUNDED.t_l, ROUNDED.t_r, ROUNDED.b_l, ROUNDED.b_r]\n\nconst classNameGenerator = tv({\n base: ['smarthr-ui-SideNav', 'shr-relative shr-list-none shr-bg-column'],\n variants: {\n rounded: {\n true: ROUNDED_ALL,\n all: ROUNDED_ALL,\n top: ['shr-rounded-t-l', ROUNDED.t_l, ROUNDED.t_r],\n right: ['shr-rounded-r-l', ROUNDED.t_r, ROUNDED.b_r],\n bottom: ['shr-rounded-b-l', ROUNDED.b_l, ROUNDED.b_r],\n left: ['shr-rounded-l-l', ROUNDED.t_l, ROUNDED.b_l],\n },\n },\n defaultVariants: {\n rounded: false,\n },\n})\n\nexport const SideNav: FC<Props> = ({ size = 'M', className, rounded, children, ...rest }) => {\n const actualClassName = useMemo(\n () => classNameGenerator({ rounded, className }),\n [rounded, className],\n )\n\n return (\n <ul {...rest} className={actualClassName}>\n <SideNavProvider value={{ size }}>{children}</SideNavProvider>\n </ul>\n )\n}\n"],"names":["tv","_jsx"],"mappings":";;;;;AAgBA,MAAM,OAAO,GAAG;AACd,IAAA,GAAG,EAAE,2DAA2D;AAChE,IAAA,GAAG,EAAE,2DAA2D;AAChE,IAAA,GAAG,EAAE,0DAA0D;AAC/D,IAAA,GAAG,EAAE,0DAA0D;CAChE;AACD,MAAM,WAAW,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,E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
|
+
const useSideNavContext = () => React.useContext(SideNavContext);
|
|
7
|
+
const SideNavProvider = SideNavContext.Provider;
|
|
8
|
+
|
|
9
|
+
exports.SideNavProvider = SideNavProvider;
|
|
10
|
+
exports.useSideNavContext = useSideNavContext;
|
|
11
|
+
//# sourceMappingURL=SideNavContext.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SideNavContext.cjs","sources":["../../../src/components/SideNav/SideNavContext.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nimport type { SideNavSizeType } from './SideNavItemButton'\n\ntype SideNavContextValue = {\n size: SideNavSizeType\n}\n\nconst SideNavContext = createContext<SideNavContextValue | undefined>(undefined)\n\nexport const useSideNavContext = () => useContext(SideNavContext)\n\nexport const SideNavProvider = SideNavContext.Provider\n"],"names":["createContext","useContext"],"mappings":";;;;AAQA,MAAM,cAAc,GAAGA,mBAAa,CAAkC,SAAS,CAAC;AAEzE,MAAM,iBAAiB,GAAG,MAAMC,gBAAU,CAAC,cAAc;AAEzD,MAAM,eAAe,GAAG,cAAc,CAAC;;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SideNavSizeType } from './SideNavItemButton';
|
|
2
|
+
type SideNavContextValue = {
|
|
3
|
+
size: SideNavSizeType;
|
|
4
|
+
};
|
|
5
|
+
export declare const useSideNavContext: () => SideNavContextValue | undefined;
|
|
6
|
+
export declare const SideNavProvider: import("react").Provider<SideNavContextValue | undefined>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
const SideNavContext = createContext(undefined);
|
|
4
|
+
const useSideNavContext = () => useContext(SideNavContext);
|
|
5
|
+
const SideNavProvider = SideNavContext.Provider;
|
|
6
|
+
|
|
7
|
+
export { SideNavProvider, useSideNavContext };
|
|
8
|
+
//# sourceMappingURL=SideNavContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SideNavContext.js","sources":["../../../src/components/SideNav/SideNavContext.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nimport type { SideNavSizeType } from './SideNavItemButton'\n\ntype SideNavContextValue = {\n size: SideNavSizeType\n}\n\nconst SideNavContext = createContext<SideNavContextValue | undefined>(undefined)\n\nexport const useSideNavContext = () => useContext(SideNavContext)\n\nexport const SideNavProvider = SideNavContext.Provider\n"],"names":[],"mappings":";;AAQA,MAAM,cAAc,GAAG,aAAa,CAAkC,SAAS,CAAC;AAEzE,MAAM,iBAAiB,GAAG,MAAM,UAAU,CAAC,cAAc;AAEzD,MAAM,eAAe,GAAG,cAAc,CAAC;;;;"}
|
|
@@ -12,6 +12,7 @@ require('../Layout/Reel/Reel.cjs');
|
|
|
12
12
|
require('../Layout/Sidebar/Sidebar.cjs');
|
|
13
13
|
require('../Layout/Center/Center.cjs');
|
|
14
14
|
require('../Layout/Container/Container.cjs');
|
|
15
|
+
var components_SideNav_SideNavContext = require('./SideNavContext.cjs');
|
|
15
16
|
|
|
16
17
|
const classNameGenerator = index.tv({
|
|
17
18
|
slots: {
|
|
@@ -51,32 +52,36 @@ const classNameGenerator = index.tv({
|
|
|
51
52
|
},
|
|
52
53
|
},
|
|
53
54
|
});
|
|
54
|
-
const SideNavItemButton = ({ id,
|
|
55
|
+
const SideNavItemButton = ({ id, prefix, suffix, current, children, className, onClick, ...rest }) => {
|
|
56
|
+
const context = components_SideNav_SideNavContext.useSideNavContext();
|
|
57
|
+
const size = context?.size ?? 'M';
|
|
55
58
|
const classNames = React.useMemo(() => {
|
|
56
59
|
const { wrapper, button, body, bodyText } = classNameGenerator();
|
|
57
60
|
return {
|
|
58
61
|
wrapper: wrapper({ className }),
|
|
59
|
-
button: button({ size
|
|
62
|
+
button: button({ size }),
|
|
60
63
|
body: body(),
|
|
61
64
|
bodyText: bodyText(),
|
|
62
65
|
};
|
|
63
66
|
}, [className, size]);
|
|
64
|
-
return (jsxRuntime.jsx("li", { ...rest, "data-current": !!current, className: classNames.wrapper, children: jsxRuntime.jsx(components_Button_UnstyledButton.UnstyledButton, { className: classNames.button, onClick: onClick, value: id, children: jsxRuntime.jsx(BodyCluster, { prefix: prefix, suffix: suffix,
|
|
67
|
+
return (jsxRuntime.jsx("li", { ...rest, id: id, "data-current": !!current, className: classNames.wrapper, children: jsxRuntime.jsx(components_Button_UnstyledButton.UnstyledButton, { className: classNames.button, onClick: onClick, value: id, children: jsxRuntime.jsx(BodyCluster, { prefix: prefix, suffix: suffix, classNames: classNames, children: children }) }) }));
|
|
65
68
|
};
|
|
66
|
-
const SideNavItemAnchor = ({
|
|
69
|
+
const SideNavItemAnchor = ({ prefix, suffix, current, children, className, href, elementAs, onClick, ...rest }) => {
|
|
70
|
+
const context = components_SideNav_SideNavContext.useSideNavContext();
|
|
71
|
+
const size = context?.size ?? 'M';
|
|
67
72
|
const classNames = React.useMemo(() => {
|
|
68
73
|
const { wrapper, button, body, bodyText } = classNameGenerator();
|
|
69
74
|
return {
|
|
70
75
|
wrapper: wrapper({ className }),
|
|
71
|
-
button: button({ size
|
|
76
|
+
button: button({ size }),
|
|
72
77
|
body: body(),
|
|
73
78
|
bodyText: bodyText(),
|
|
74
79
|
};
|
|
75
80
|
}, [className, size]);
|
|
76
81
|
const Anchor = elementAs || 'a';
|
|
77
|
-
return (jsxRuntime.jsx("li", { ...rest, "data-current": !!current, className: classNames.wrapper, children: jsxRuntime.jsx(Anchor, { className: classNames.button, href: href, onClick: onClick,
|
|
82
|
+
return (jsxRuntime.jsx("li", { ...rest, "data-current": !!current, className: classNames.wrapper, children: jsxRuntime.jsx(Anchor, { className: classNames.button, href: href, onClick: onClick, children: jsxRuntime.jsx(BodyCluster, { prefix: prefix, suffix: suffix, classNames: classNames, children: children }) }) }));
|
|
78
83
|
};
|
|
79
|
-
const BodyCluster = React.memo(({ prefix, suffix,
|
|
84
|
+
const BodyCluster = React.memo(({ prefix, suffix, children, classNames }) => (jsxRuntime.jsxs(components_Layout_Cluster_Cluster.Cluster, { inline: true, align: "center", className: classNames.body, as: "span", children: [prefix, jsxRuntime.jsx("span", { className: classNames.bodyText, children: children }), suffix] })));
|
|
80
85
|
|
|
81
86
|
exports.SideNavItemAnchor = SideNavItemAnchor;
|
|
82
87
|
exports.SideNavItemButton = SideNavItemButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SideNavItemButton.cjs","sources":["../../../src/components/SideNav/SideNavItemButton.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ElementType,\n type FC,\n type ReactNode,\n memo,\n useMemo,\n} from 'react'\nimport { tv } from 'tailwind-variants'\n\nimport { UnstyledButton } from '../Button'\nimport { Cluster } from '../Layout'\n\nexport type SideNavSizeType = 'M' | 'S'\n\ntype AbstractProps = {\n /**
|
|
1
|
+
{"version":3,"file":"SideNavItemButton.cjs","sources":["../../../src/components/SideNav/SideNavItemButton.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ElementType,\n type FC,\n type ReactNode,\n memo,\n useMemo,\n} from 'react'\nimport { tv } from 'tailwind-variants'\n\nimport { UnstyledButton } from '../Button'\nimport { Cluster } from '../Layout'\n\nimport { useSideNavContext } from './SideNavContext'\n\nexport type SideNavSizeType = 'M' | 'S'\n\ntype AbstractProps = {\n /** タイトルのプレフィックスの内容。通常、StatusLabelやIconの配置に用います。 */\n prefix?: ReactNode\n /** タイトルのサフィックスの内容。通常、Prefixを使用済みの場合にStatusLabelやChipの配置に用います。 */\n suffix?: ReactNode\n /** 選択されているアイテムかどうか */\n current?: boolean\n}\n\ntype AbstractButtonProps = AbstractProps & {\n /** アイテムを押下したときに発火するコールバック関数 */\n onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void\n}\n\ntype AbstractAnchorProps<T extends ElementType = 'a'> = AbstractProps & {\n href: string\n /** next/link などのカスタムコンポーネントを指定します。指定がない場合はデフォルトで `a` タグが使用されます。 */\n elementAs?: T\n /** アイテムを押下したときに発火するコールバック関数 */\n onClick?: (e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void\n}\n\ntype ButtonProps = Omit<ComponentPropsWithoutRef<'li'>, keyof AbstractButtonProps> &\n AbstractButtonProps\n\ntype AnchorProps<T extends ElementType = 'a'> = Omit<\n ComponentPropsWithoutRef<'li'>,\n keyof AbstractAnchorProps<T>\n> &\n AbstractAnchorProps<T>\n\nconst classNameGenerator = tv({\n slots: {\n wrapper: [\n 'smarthr-ui-SideNav-item shr-relative',\n 'data-[current=true]:shr-bg-main data-[current=true]:shr-text-white',\n 'data-[current=true]:after:shr-absolute data-[current=true]:after:-shr-right-0.25 data-[current=true]:after:shr-top-1/2 data-[current=true]:after:-shr-translate-y-1/2 data-[current=true]:after:shr-translate-x-0 data-[current=true]:after:shr-border-b-4 data-[current=true]:after:shr-border-l-4 data-[current=true]:after:shr-border-r-0 data-[current=true]:after:shr-border-t-4 data-[current=true]:after:shr-border-solid data-[current=true]:after:shr-border-b-transparent data-[current=true]:after:shr-border-l-main data-[current=true]:after:shr-border-r-transparent data-[current=true]:after:shr-border-t-transparent data-[current=true]:after:shr-content-[\"\"]',\n 'data-[current=false]:hover:shr-bg-column-darken',\n '[&:has(:focus-visible)]:shr-z-1', // pseudoエレメントがliの::afterと衝突しないために子要素に適用しますが、次のエレメントに被られるからz-indexを一時的に変更します\n ],\n button: [\n 'shr-w-full shr-leading-none [&]:shr-box-border',\n 'focus-visible:shr-focus-indicator',\n '[[data-current=true]_&:focus-visible]:shr-focus-indicator',\n 'shr-inline-flex shr-items-center',\n 'shr-no-underline',\n\n // ::before: フォーカスリングと上のアイテムの下端の間の隙間を埋めるために、上端から1px外側に1pxの横線を描画する。\n // 非選択かつ先頭以外のボタンにフォーカスが当たったときのみ表示する\n 'before:shr-absolute before:-shr-top-[1px] before:shr-left-0 before:shr-hidden before:shr-h-px before:shr-w-full before:shr-bg-border before:shr-content-[\"\"]',\n '[:first-child_&]:before:shr-hidden [[data-current=false]:not(:first-child)_&:focus-visible]:before:shr-block [[data-current=false]_&:focus-visible]:before:shr-absolute',\n\n // ::after: フォーカスリングと下のアイテムの上端の間の隙間を埋めるために、下端から1px外側に1pxの横線を描画する。\n // 非選択かつ末尾以外のボタンにフォーカスが当たったときのみ表示する\n 'after:shr-absolute after:-shr-bottom-[1px] after:shr-left-0 after:shr-hidden after:shr-h-px after:shr-w-full after:shr-bg-border after:shr-content-[\"\"]',\n '[:last-child_&]:after:shr-hidden [[data-current=false]:not(:last-child)_&:focus-visible]:after:shr-block [[data-current=false]_&:focus-visible]:after:shr-absolute',\n ],\n body: 'shr-w-full',\n bodyText: 'smarthr-ui-SideNav-itemBodyText shr-grow',\n },\n variants: {\n size: {\n M: {\n button: 'shr-p-1 shr-text-base',\n },\n S: {\n button: 'shr-px-1 shr-py-0.5 shr-text-sm',\n },\n },\n },\n})\n\nexport const SideNavItemButton: FC<ButtonProps> = ({\n id,\n prefix,\n suffix,\n current,\n children,\n className,\n onClick,\n ...rest\n}) => {\n const context = useSideNavContext()\n const size = context?.size ?? 'M'\n\n const classNames = useMemo(() => {\n const { wrapper, button, body, bodyText } = classNameGenerator()\n\n return {\n wrapper: wrapper({ className }),\n button: button({ size }),\n body: body(),\n bodyText: bodyText(),\n }\n }, [className, size])\n\n return (\n <li {...rest} id={id} data-current={!!current} className={classNames.wrapper}>\n <UnstyledButton className={classNames.button} onClick={onClick} value={id}>\n <BodyCluster prefix={prefix} suffix={suffix} classNames={classNames}>\n {children}\n </BodyCluster>\n </UnstyledButton>\n </li>\n )\n}\n\nexport const SideNavItemAnchor = <T extends ElementType = 'a'>({\n prefix,\n suffix,\n current,\n children,\n className,\n href,\n elementAs,\n onClick,\n ...rest\n}: AnchorProps<T>) => {\n const context = useSideNavContext()\n const size = context?.size ?? 'M'\n\n const classNames = useMemo(() => {\n const { wrapper, button, body, bodyText } = classNameGenerator()\n\n return {\n wrapper: wrapper({ className }),\n button: button({ size }),\n body: body(),\n bodyText: bodyText(),\n }\n }, [className, size])\n\n const Anchor = elementAs || 'a'\n\n return (\n <li {...rest} data-current={!!current} className={classNames.wrapper}>\n <Anchor className={classNames.button} href={href} onClick={onClick}>\n <BodyCluster prefix={prefix} suffix={suffix} classNames={classNames}>\n {children}\n </BodyCluster>\n </Anchor>\n </li>\n )\n}\n\nconst BodyCluster = memo<\n Pick<AbstractProps, 'prefix' | 'suffix'> & {\n children: ReactNode\n classNames: { body: string; bodyText: string }\n }\n>(({ prefix, suffix, children, classNames }) => (\n <Cluster inline align=\"center\" className={classNames.body} as=\"span\">\n {prefix}\n <span className={classNames.bodyText}>{children}</span>\n {suffix}\n </Cluster>\n))\n"],"names":["tv","useSideNavContext","useMemo","_jsx","UnstyledButton","memo","_jsxs","Cluster"],"mappings":";;;;;;;;;;;;;;;;AAgDA,MAAM,kBAAkB,GAAGA,QAAE,CAAC;AAC5B,IAAA,KAAK,EAAE;AACL,QAAA,OAAO,EAAE;YACP,sCAAsC;YACtC,oEAAoE;YACpE,kpBAAkpB;YAClpB,iDAAiD;AACjD,YAAA,iCAAiC;AAClC,SAAA;AACD,QAAA,MAAM,EAAE;YACN,gDAAgD;YAChD,mCAAmC;YACnC,2DAA2D;YAC3D,kCAAkC;YAClC,kBAAkB;;;YAIlB,8JAA8J;YAC9J,yKAAyK;;;YAIzK,yJAAyJ;YACzJ,oKAAoK;AACrK,SAAA;AACD,QAAA,IAAI,EAAE,YAAY;AAClB,QAAA,QAAQ,EAAE,0CAA0C;AACrD,KAAA;AACD,IAAA,QAAQ,EAAE;AACR,QAAA,IAAI,EAAE;AACJ,YAAA,CAAC,EAAE;AACD,gBAAA,MAAM,EAAE,uBAAuB;AAChC,aAAA;AACD,YAAA,CAAC,EAAE;AACD,gBAAA,MAAM,EAAE,iCAAiC;AAC1C,aAAA;AACF,SAAA;AACF,KAAA;AACF,CAAA,CAAC;AAEK,MAAM,iBAAiB,GAAoB,CAAC,EACjD,EAAE,EACF,MAAM,EACN,MAAM,EACN,OAAO,EACP,QAAQ,EACR,SAAS,EAC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AQ,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAQ,EACtD,MAAM,CAAA,EAAA,CACC,CACX,CAAC;;;;;"}
|
|
@@ -1,32 +1,26 @@
|
|
|
1
1
|
import { type ComponentPropsWithoutRef, type ElementType, type FC, type ReactNode } from 'react';
|
|
2
2
|
export type SideNavSizeType = 'M' | 'S';
|
|
3
3
|
type AbstractProps = {
|
|
4
|
-
/** アイテムのタイトル
|
|
5
|
-
* @deprecated SideNav で items を使う時の props です。children を使ってください。
|
|
6
|
-
*/
|
|
7
|
-
title?: ReactNode;
|
|
8
4
|
/** タイトルのプレフィックスの内容。通常、StatusLabelやIconの配置に用います。 */
|
|
9
5
|
prefix?: ReactNode;
|
|
10
6
|
/** タイトルのサフィックスの内容。通常、Prefixを使用済みの場合にStatusLabelやChipの配置に用います。 */
|
|
11
7
|
suffix?: ReactNode;
|
|
12
8
|
/** 選択されているアイテムかどうか */
|
|
13
9
|
current?: boolean;
|
|
14
|
-
/** アイテムの大きさ */
|
|
15
|
-
size?: SideNavSizeType;
|
|
16
|
-
/** アイテムを押下したときに発火するコールバック関数 */
|
|
17
|
-
onClick?: (e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement, MouseEvent>) => void;
|
|
18
10
|
};
|
|
19
11
|
type AbstractButtonProps = AbstractProps & {
|
|
20
|
-
/**
|
|
21
|
-
|
|
12
|
+
/** アイテムを押下したときに発火するコールバック関数 */
|
|
13
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
22
14
|
};
|
|
23
15
|
type AbstractAnchorProps<T extends ElementType = 'a'> = AbstractProps & {
|
|
24
16
|
href: string;
|
|
25
17
|
/** next/link などのカスタムコンポーネントを指定します。指定がない場合はデフォルトで `a` タグが使用されます。 */
|
|
26
18
|
elementAs?: T;
|
|
19
|
+
/** アイテムを押下したときに発火するコールバック関数 */
|
|
20
|
+
onClick?: (e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void;
|
|
27
21
|
};
|
|
28
22
|
type ButtonProps = Omit<ComponentPropsWithoutRef<'li'>, keyof AbstractButtonProps> & AbstractButtonProps;
|
|
29
23
|
type AnchorProps<T extends ElementType = 'a'> = Omit<ComponentPropsWithoutRef<'li'>, keyof AbstractAnchorProps<T>> & AbstractAnchorProps<T>;
|
|
30
24
|
export declare const SideNavItemButton: FC<ButtonProps>;
|
|
31
|
-
export declare const SideNavItemAnchor: <T extends ElementType = "a">({
|
|
25
|
+
export declare const SideNavItemAnchor: <T extends ElementType = "a">({ prefix, suffix, current, children, className, href, elementAs, onClick, ...rest }: AnchorProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
32
26
|
export {};
|
|
@@ -10,6 +10,7 @@ import '../Layout/Reel/Reel.js';
|
|
|
10
10
|
import '../Layout/Sidebar/Sidebar.js';
|
|
11
11
|
import '../Layout/Center/Center.js';
|
|
12
12
|
import '../Layout/Container/Container.js';
|
|
13
|
+
import { useSideNavContext } from './SideNavContext.js';
|
|
13
14
|
|
|
14
15
|
const classNameGenerator = ce({
|
|
15
16
|
slots: {
|
|
@@ -49,32 +50,36 @@ const classNameGenerator = ce({
|
|
|
49
50
|
},
|
|
50
51
|
},
|
|
51
52
|
});
|
|
52
|
-
const SideNavItemButton = ({ id,
|
|
53
|
+
const SideNavItemButton = ({ id, prefix, suffix, current, children, className, onClick, ...rest }) => {
|
|
54
|
+
const context = useSideNavContext();
|
|
55
|
+
const size = context?.size ?? 'M';
|
|
53
56
|
const classNames = useMemo(() => {
|
|
54
57
|
const { wrapper, button, body, bodyText } = classNameGenerator();
|
|
55
58
|
return {
|
|
56
59
|
wrapper: wrapper({ className }),
|
|
57
|
-
button: button({ size
|
|
60
|
+
button: button({ size }),
|
|
58
61
|
body: body(),
|
|
59
62
|
bodyText: bodyText(),
|
|
60
63
|
};
|
|
61
64
|
}, [className, size]);
|
|
62
|
-
return (jsx("li", { ...rest, "data-current": !!current, className: classNames.wrapper, children: jsx(UnstyledButton, { className: classNames.button, onClick: onClick, value: id, children: jsx(BodyCluster, { prefix: prefix, suffix: suffix,
|
|
65
|
+
return (jsx("li", { ...rest, id: id, "data-current": !!current, className: classNames.wrapper, children: jsx(UnstyledButton, { className: classNames.button, onClick: onClick, value: id, children: jsx(BodyCluster, { prefix: prefix, suffix: suffix, classNames: classNames, children: children }) }) }));
|
|
63
66
|
};
|
|
64
|
-
const SideNavItemAnchor = ({
|
|
67
|
+
const SideNavItemAnchor = ({ prefix, suffix, current, children, className, href, elementAs, onClick, ...rest }) => {
|
|
68
|
+
const context = useSideNavContext();
|
|
69
|
+
const size = context?.size ?? 'M';
|
|
65
70
|
const classNames = useMemo(() => {
|
|
66
71
|
const { wrapper, button, body, bodyText } = classNameGenerator();
|
|
67
72
|
return {
|
|
68
73
|
wrapper: wrapper({ className }),
|
|
69
|
-
button: button({ size
|
|
74
|
+
button: button({ size }),
|
|
70
75
|
body: body(),
|
|
71
76
|
bodyText: bodyText(),
|
|
72
77
|
};
|
|
73
78
|
}, [className, size]);
|
|
74
79
|
const Anchor = elementAs || 'a';
|
|
75
|
-
return (jsx("li", { ...rest, "data-current": !!current, className: classNames.wrapper, children: jsx(Anchor, { className: classNames.button, href: href, onClick: onClick,
|
|
80
|
+
return (jsx("li", { ...rest, "data-current": !!current, className: classNames.wrapper, children: jsx(Anchor, { className: classNames.button, href: href, onClick: onClick, children: jsx(BodyCluster, { prefix: prefix, suffix: suffix, classNames: classNames, children: children }) }) }));
|
|
76
81
|
};
|
|
77
|
-
const BodyCluster = memo(({ prefix, suffix,
|
|
82
|
+
const BodyCluster = memo(({ prefix, suffix, children, classNames }) => (jsxs(Cluster, { inline: true, align: "center", className: classNames.body, as: "span", children: [prefix, jsx("span", { className: classNames.bodyText, children: children }), suffix] })));
|
|
78
83
|
|
|
79
84
|
export { SideNavItemAnchor, SideNavItemButton };
|
|
80
85
|
//# sourceMappingURL=SideNavItemButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SideNavItemButton.js","sources":["../../../src/components/SideNav/SideNavItemButton.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ElementType,\n type FC,\n type ReactNode,\n memo,\n useMemo,\n} from 'react'\nimport { tv } from 'tailwind-variants'\n\nimport { UnstyledButton } from '../Button'\nimport { Cluster } from '../Layout'\n\nexport type SideNavSizeType = 'M' | 'S'\n\ntype AbstractProps = {\n /**
|
|
1
|
+
{"version":3,"file":"SideNavItemButton.js","sources":["../../../src/components/SideNav/SideNavItemButton.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ElementType,\n type FC,\n type ReactNode,\n memo,\n useMemo,\n} from 'react'\nimport { tv } from 'tailwind-variants'\n\nimport { UnstyledButton } from '../Button'\nimport { Cluster } from '../Layout'\n\nimport { useSideNavContext } from './SideNavContext'\n\nexport type SideNavSizeType = 'M' | 'S'\n\ntype AbstractProps = {\n /** タイトルのプレフィックスの内容。通常、StatusLabelやIconの配置に用います。 */\n prefix?: ReactNode\n /** タイトルのサフィックスの内容。通常、Prefixを使用済みの場合にStatusLabelやChipの配置に用います。 */\n suffix?: ReactNode\n /** 選択されているアイテムかどうか */\n current?: boolean\n}\n\ntype AbstractButtonProps = AbstractProps & {\n /** アイテムを押下したときに発火するコールバック関数 */\n onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void\n}\n\ntype AbstractAnchorProps<T extends ElementType = 'a'> = AbstractProps & {\n href: string\n /** next/link などのカスタムコンポーネントを指定します。指定がない場合はデフォルトで `a` タグが使用されます。 */\n elementAs?: T\n /** アイテムを押下したときに発火するコールバック関数 */\n onClick?: (e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void\n}\n\ntype ButtonProps = Omit<ComponentPropsWithoutRef<'li'>, keyof AbstractButtonProps> &\n AbstractButtonProps\n\ntype AnchorProps<T extends ElementType = 'a'> = Omit<\n ComponentPropsWithoutRef<'li'>,\n keyof AbstractAnchorProps<T>\n> &\n AbstractAnchorProps<T>\n\nconst classNameGenerator = tv({\n slots: {\n wrapper: [\n 'smarthr-ui-SideNav-item shr-relative',\n 'data-[current=true]:shr-bg-main data-[current=true]:shr-text-white',\n 'data-[current=true]:after:shr-absolute data-[current=true]:after:-shr-right-0.25 data-[current=true]:after:shr-top-1/2 data-[current=true]:after:-shr-translate-y-1/2 data-[current=true]:after:shr-translate-x-0 data-[current=true]:after:shr-border-b-4 data-[current=true]:after:shr-border-l-4 data-[current=true]:after:shr-border-r-0 data-[current=true]:after:shr-border-t-4 data-[current=true]:after:shr-border-solid data-[current=true]:after:shr-border-b-transparent data-[current=true]:after:shr-border-l-main data-[current=true]:after:shr-border-r-transparent data-[current=true]:after:shr-border-t-transparent data-[current=true]:after:shr-content-[\"\"]',\n 'data-[current=false]:hover:shr-bg-column-darken',\n '[&:has(:focus-visible)]:shr-z-1', // pseudoエレメントがliの::afterと衝突しないために子要素に適用しますが、次のエレメントに被られるからz-indexを一時的に変更します\n ],\n button: [\n 'shr-w-full shr-leading-none [&]:shr-box-border',\n 'focus-visible:shr-focus-indicator',\n '[[data-current=true]_&:focus-visible]:shr-focus-indicator',\n 'shr-inline-flex shr-items-center',\n 'shr-no-underline',\n\n // ::before: フォーカスリングと上のアイテムの下端の間の隙間を埋めるために、上端から1px外側に1pxの横線を描画する。\n // 非選択かつ先頭以外のボタンにフォーカスが当たったときのみ表示する\n 'before:shr-absolute before:-shr-top-[1px] before:shr-left-0 before:shr-hidden before:shr-h-px before:shr-w-full before:shr-bg-border before:shr-content-[\"\"]',\n '[:first-child_&]:before:shr-hidden [[data-current=false]:not(:first-child)_&:focus-visible]:before:shr-block [[data-current=false]_&:focus-visible]:before:shr-absolute',\n\n // ::after: フォーカスリングと下のアイテムの上端の間の隙間を埋めるために、下端から1px外側に1pxの横線を描画する。\n // 非選択かつ末尾以外のボタンにフォーカスが当たったときのみ表示する\n 'after:shr-absolute after:-shr-bottom-[1px] after:shr-left-0 after:shr-hidden after:shr-h-px after:shr-w-full after:shr-bg-border after:shr-content-[\"\"]',\n '[:last-child_&]:after:shr-hidden [[data-current=false]:not(:last-child)_&:focus-visible]:after:shr-block [[data-current=false]_&:focus-visible]:after:shr-absolute',\n ],\n body: 'shr-w-full',\n bodyText: 'smarthr-ui-SideNav-itemBodyText shr-grow',\n },\n variants: {\n size: {\n M: {\n button: 'shr-p-1 shr-text-base',\n },\n S: {\n button: 'shr-px-1 shr-py-0.5 shr-text-sm',\n },\n },\n },\n})\n\nexport const SideNavItemButton: FC<ButtonProps> = ({\n id,\n prefix,\n suffix,\n current,\n children,\n className,\n onClick,\n ...rest\n}) => {\n const context = useSideNavContext()\n const size = context?.size ?? 'M'\n\n const classNames = useMemo(() => {\n const { wrapper, button, body, bodyText } = classNameGenerator()\n\n return {\n wrapper: wrapper({ className }),\n button: button({ size }),\n body: body(),\n bodyText: bodyText(),\n }\n }, [className, size])\n\n return (\n <li {...rest} id={id} data-current={!!current} className={classNames.wrapper}>\n <UnstyledButton className={classNames.button} onClick={onClick} value={id}>\n <BodyCluster prefix={prefix} suffix={suffix} classNames={classNames}>\n {children}\n </BodyCluster>\n </UnstyledButton>\n </li>\n )\n}\n\nexport const SideNavItemAnchor = <T extends ElementType = 'a'>({\n prefix,\n suffix,\n current,\n children,\n className,\n href,\n elementAs,\n onClick,\n ...rest\n}: AnchorProps<T>) => {\n const context = useSideNavContext()\n const size = context?.size ?? 'M'\n\n const classNames = useMemo(() => {\n const { wrapper, button, body, bodyText } = classNameGenerator()\n\n return {\n wrapper: wrapper({ className }),\n button: button({ size }),\n body: body(),\n bodyText: bodyText(),\n }\n }, [className, size])\n\n const Anchor = elementAs || 'a'\n\n return (\n <li {...rest} data-current={!!current} className={classNames.wrapper}>\n <Anchor className={classNames.button} href={href} onClick={onClick}>\n <BodyCluster prefix={prefix} suffix={suffix} classNames={classNames}>\n {children}\n </BodyCluster>\n </Anchor>\n </li>\n )\n}\n\nconst BodyCluster = memo<\n Pick<AbstractProps, 'prefix' | 'suffix'> & {\n children: ReactNode\n classNames: { body: string; bodyText: string }\n }\n>(({ prefix, suffix, children, classNames }) => (\n <Cluster inline align=\"center\" className={classNames.body} as=\"span\">\n {prefix}\n <span className={classNames.bodyText}>{children}</span>\n {suffix}\n </Cluster>\n))\n"],"names":["tv","_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;AAgDA,MAAM,kBAAkB,GAAGA,EAAE,CAAC;AAC5B,IAAA,KAAK,EAAE;AACL,QAAA,OAAO,EAAE;YACP,sCAAsC;YACtC,oEAAoE;YACpE,kpBAAkpB;YAClpB,iDAAiD;AACjD,YAAA,iCAAiC;AAClC,SAAA;AACD,QAAA,MAAM,EAAE;YACN,gDAAgD;YAChD,mCAAmC;YACnC,2DAA2D;YAC3D,kCAAkC;YAClC,kBAAkB;;;YAIlB,8JAA8J;YAC9J,yKAAyK;;;YAIzK,yJAAyJ;YACzJ,oKAAoK;AACrK,SAAA;AACD,QAAA,IAAI,EAAE,YAAY;AAClB,QAAA,QAAQ,EAAE,0CAA0C;AACrD,KAAA;AACD,IAAA,QAAQ,EAAE;AACR,QAAA,IAAI,EAAE;AACJ,YAAA,CAAC,EAAE;AACD,gBAAA,MAAM,EAAE,uBAAuB;AAChC,aAAA;AACD,YAAA,CAAC,EAAE;AACD,gBAAA,MAAM,EAAE,iCAAiC;AAC1C,aAAA;AACF,SAAA;AACF,KAAA;AACF,CAAA,CAAC;AAEK,MAAM,iBAAiB,GAAoB,CAAC,EACjD,EAAE,EACF,MAAM,EACN,MAAM,EACN,OAAO,EACP,QAAQ,EACR,SAAS,EACT,OAAO,EACP,GAAG,IAAI,EACR,KAAI;AACH,IAAA,MAAM,OAAO,GAAG,iBAAiB,EAAE;AACnC,IAAA,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,GAAG;AAEjC,IAAA,MAAM,UAAU,GAAG,OAAO,CAAC,MAAK;AAC9B,QAAA,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,kBAAkB,EAAE;QAEhE,OAAO;AACL,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,CAAC;YACxB,IAAI,EAAE,IAAI,EAAE;YACZ,QAAQ,EAAE,QAAQ,EAAE;SACrB;AACH,IAAA,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAErB,IAAA,MAAM,MAAM,GAAG,SAAS,IAAI,GAAG;IAE/B,QACEA,eAAQ,IAAI,EAAA,cAAA,EAAgB,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC,OAAO,EAAA,QAAA,EAClEA,GAAA,CAAC,MAAM,EAAA,EAAC,SAAS,EAAE,UAAU,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAA,QAAA,EAChEA,GAAA,CAAC,WAAW,EAAA,EAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAA,QAAA,EAChE,QAAQ,EAAA,CACG,EAAA,CACP,EAAA,CACN;AAET;AAEA,MAAM,WAAW,GAAG,IAAI,CAKtB,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MACzCC,IAAA,CAAC,OAAO,EAAA,EAAC,MAAM,EAAA,IAAA,EAAC,KAAK,EAAC,QAAQ,EAAC,SAAS,EAAE,UAAU,CAAC,IAAI,EAAE,EAAE,EAAC,MAAM,EAAA,QAAA,EAAA,CACjE,MAAM,EACPD,GAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAE,UAAU,CAAC,QAAQ,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAQ,EACtD,MAAM,CAAA,EAAA,CACC,CACX,CAAC;;;;"}
|
|
@@ -40,7 +40,7 @@ const convertContentWidth = (contentWidth) => {
|
|
|
40
40
|
}
|
|
41
41
|
return contentWidth;
|
|
42
42
|
};
|
|
43
|
-
const Th = React.memo(({ children, sort, onSort,
|
|
43
|
+
const Th = React.memo(({ children, sort, onSort, align, vAlign, fixed, contentWidth, className, style, ...rest }) => {
|
|
44
44
|
const actualClassName = React.useMemo(() => {
|
|
45
45
|
const base = classNameGenerator({ className, align, vAlign });
|
|
46
46
|
if (!fixed) {
|
|
@@ -54,7 +54,7 @@ const Th = React.memo(({ children, sort, onSort, decorators, align, vAlign, fixe
|
|
|
54
54
|
width: convertContentWidth(contentWidth),
|
|
55
55
|
}), [style, contentWidth]);
|
|
56
56
|
const ariaSort = React.useMemo(() => (sort ? (sort === 'none' ? 'none' : `${sort}ending`) : undefined), [sort]);
|
|
57
|
-
return (jsxRuntime.jsx("th", { ...rest, "aria-sort": ariaSort, "data-fixed": fixed, className: actualClassName, style: actualStyle, children: sort ? (jsxRuntime.jsx(components_Table_ThSortButton.ThSortButton, { align: align, onSort: onSort, sort: sort,
|
|
57
|
+
return (jsxRuntime.jsx("th", { ...rest, "aria-sort": ariaSort, "data-fixed": fixed, className: actualClassName, style: actualStyle, children: sort ? (jsxRuntime.jsx(components_Table_ThSortButton.ThSortButton, { align: align, onSort: onSort, sort: sort, children: children })) : (children) }));
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
exports.Th = Th;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Th.cjs","sources":["../../../src/components/Table/Th.tsx"],"sourcesContent":["import {\n type AriaAttributes,\n type ComponentPropsWithoutRef,\n type PropsWithChildren,\n memo,\n useMemo,\n} from 'react'\nimport { type VariantProps, tv } from 'tailwind-variants'\n\nimport { ThSortButton } from './ThSortButton'\nimport { reelShadowClassNameGenerator } from './reelShadowStyle'\n\nimport type { CellContentWidth } from './type'\n\nexport type AbstractProps = PropsWithChildren<\n {\n /** 並び替え状態 */\n sort?: ComponentPropsWithoutRef<typeof ThSortButton>['sort']\n /** 並び替えをクリックした時に発火するコールバック関数 */\n onSort?: () => void\n /** 横スクロール時、カラムを左右いずれかに固定 */\n fixed?: 'left' | 'right'\n
|
|
1
|
+
{"version":3,"file":"Th.cjs","sources":["../../../src/components/Table/Th.tsx"],"sourcesContent":["import {\n type AriaAttributes,\n type ComponentPropsWithoutRef,\n type PropsWithChildren,\n memo,\n useMemo,\n} from 'react'\nimport { type VariantProps, tv } from 'tailwind-variants'\n\nimport { ThSortButton } from './ThSortButton'\nimport { reelShadowClassNameGenerator } from './reelShadowStyle'\n\nimport type { CellContentWidth } from './type'\n\nexport type AbstractProps = PropsWithChildren<\n {\n /** 並び替え状態 */\n sort?: ComponentPropsWithoutRef<typeof ThSortButton>['sort']\n /** 並び替えをクリックした時に発火するコールバック関数 */\n onSort?: () => void\n /** 横スクロール時、カラムを左右いずれかに固定 */\n fixed?: 'left' | 'right'\n contentWidth?: CellContentWidth\n } & VariantProps<typeof classNameGenerator>\n>\ntype Props = AbstractProps & Omit<ComponentPropsWithoutRef<'th'>, keyof AbstractProps | 'onClick'>\n\nconst classNameGenerator = tv({\n base: [\n 'smarthr-ui-Th',\n 'shr-whitespace-nowrap shr-border-0 shr-px-1 shr-py-0.75 shr-text-left shr-align-middle shr-text-sm shr-font-bold shr-leading-tight shr-text-black',\n 'aria-[sort]:shr-cursor-pointer',\n 'hover:aria-[sort]:shr-bg-head-darken',\n '[&:has(:focus-visible)]:aria-[sort]:shr-focus-indicator',\n '[&[aria-sort=none]_.smarthr-ui-Icon]:forced-colors:shr-fill-[GrayText]',\n '[&[aria-sort=ascending]_.smarthr-ui-Icon:first-of-type]:forced-colors:shr-fill-[CanvasText] [&[aria-sort=ascending]_.smarthr-ui-Icon:last-of-type]:forced-colors:shr-fill-[GrayText]',\n '[&[aria-sort=descending]_.smarthr-ui-Icon:first-of-type]:forced-colors:shr-fill-[GrayText] [&[aria-sort=descending]_.smarthr-ui-Icon:last-of-type]:forced-colors:shr-fill-[CanvasText]',\n ],\n variants: {\n align: {\n left: '',\n right: 'shr-text-right',\n },\n vAlign: {\n middle: '',\n baseline: 'shr-align-baseline',\n bottom: 'shr-align-bottom',\n },\n },\n defaultVariants: {\n align: 'left',\n vAlign: 'middle',\n },\n})\n\nconst convertContentWidth = (contentWidth?: CellContentWidth) => {\n if (typeof contentWidth === 'number') {\n // Th は fontSize.S のため、rem で指定する\n return `${contentWidth}rem`\n }\n\n return contentWidth\n}\n\nexport const Th = memo<Props>(\n ({ children, sort, onSort, align, vAlign, fixed, contentWidth, className, style, ...rest }) => {\n const actualClassName = useMemo(() => {\n const base = classNameGenerator({ className, align, vAlign })\n\n if (!fixed) {\n return base\n }\n\n const shadow = reelShadowClassNameGenerator({ showShadow: false, direction: fixed })\n\n return `${base} ${shadow}`\n }, [align, className, fixed, vAlign])\n const actualStyle = useMemo(\n () => ({\n ...style,\n width: convertContentWidth(contentWidth),\n }),\n [style, contentWidth],\n )\n\n const ariaSort = useMemo<AriaAttributes['aria-sort'] | undefined>(\n () => (sort ? (sort === 'none' ? 'none' : `${sort}ending`) : undefined),\n [sort],\n )\n\n return (\n <th\n {...rest}\n aria-sort={ariaSort}\n data-fixed={fixed}\n className={actualClassName}\n style={actualStyle}\n >\n {sort ? (\n <ThSortButton align={align} onSort={onSort} sort={sort}>\n {children}\n </ThSortButton>\n ) : (\n children\n )}\n </th>\n )\n },\n)\n"],"names":["tv","memo","useMemo","reelShadowClassNameGenerator","_jsx","ThSortButton"],"mappings":";;;;;;;;AA2BA,MAAM,kBAAkB,GAAGA,QAAE,CAAC;AAC5B,IAAA,IAAI,EAAE;QACJ,eAAe;QACf,mJAAmJ;QACnJ,gCAAgC;QAChC,sCAAsC;QACtC,yDAAyD;QACzD,wEAAwE;QACxE,sLAAsL;QACtL,wLAAwL;AACzL,KAAA;AACD,IAAA,QAAQ,EAAE;AACR,QAAA,KAAK,EAAE;AACL,YAAA,IAAI,EAAE,EAAE;AACR,YAAA,KAAK,EAAE,gBAAgB;AACxB,SAAA;AACD,QAAA,MAAM,EAAE;AACN,YAAA,MAAM,EAAE,EAAE;AACV,YAAA,QAAQ,EAAE,oBAAoB;AAC9B,YAAA,MAAM,EAAE,kBAAkB;AAC3B,SAAA;AACF,KAAA;AACD,IAAA,eAAe,EAAE;AACf,QAAA,KAAK,EAAE,MAAM;AACb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;IAED,QACEE,0BACM,IAAI,EAAA,WAAA,EACG,QAAQ,EAAA,YAAA,EACP,KAAK,EACjB,SAAS,EAAE,eAAe,EAC1B,KAAK,EAAE,WAAW,EAAA,QAAA,EAEjB,IAAI,IACHA,cAAA,CAACC,0CAAY,IAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAA,QAAA,EACnD,QAAQ,EAAA,CACI,KAEf,QAAQ,CACT,EAAA,CACE;AAET,CAAC;;;;"}
|
|
@@ -9,8 +9,6 @@ export type AbstractProps = PropsWithChildren<{
|
|
|
9
9
|
onSort?: () => void;
|
|
10
10
|
/** 横スクロール時、カラムを左右いずれかに固定 */
|
|
11
11
|
fixed?: 'left' | 'right';
|
|
12
|
-
/** 文言を変更するための関数 */
|
|
13
|
-
decorators?: ComponentPropsWithoutRef<typeof ThSortButton>['decorators'];
|
|
14
12
|
contentWidth?: CellContentWidth;
|
|
15
13
|
} & VariantProps<typeof classNameGenerator>>;
|
|
16
14
|
type Props = AbstractProps & Omit<ComponentPropsWithoutRef<'th'>, keyof AbstractProps | 'onClick'>;
|
|
@@ -38,7 +38,7 @@ const convertContentWidth = (contentWidth) => {
|
|
|
38
38
|
}
|
|
39
39
|
return contentWidth;
|
|
40
40
|
};
|
|
41
|
-
const Th = memo(({ children, sort, onSort,
|
|
41
|
+
const Th = memo(({ children, sort, onSort, align, vAlign, fixed, contentWidth, className, style, ...rest }) => {
|
|
42
42
|
const actualClassName = useMemo(() => {
|
|
43
43
|
const base = classNameGenerator({ className, align, vAlign });
|
|
44
44
|
if (!fixed) {
|
|
@@ -52,7 +52,7 @@ const Th = memo(({ children, sort, onSort, decorators, align, vAlign, fixed, con
|
|
|
52
52
|
width: convertContentWidth(contentWidth),
|
|
53
53
|
}), [style, contentWidth]);
|
|
54
54
|
const ariaSort = useMemo(() => (sort ? (sort === 'none' ? 'none' : `${sort}ending`) : undefined), [sort]);
|
|
55
|
-
return (jsx("th", { ...rest, "aria-sort": ariaSort, "data-fixed": fixed, className: actualClassName, style: actualStyle, children: sort ? (jsx(ThSortButton, { align: align, onSort: onSort, sort: sort,
|
|
55
|
+
return (jsx("th", { ...rest, "aria-sort": ariaSort, "data-fixed": fixed, className: actualClassName, style: actualStyle, children: sort ? (jsx(ThSortButton, { align: align, onSort: onSort, sort: sort, children: children })) : (children) }));
|
|
56
56
|
});
|
|
57
57
|
|
|
58
58
|
export { Th };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Th.js","sources":["../../../src/components/Table/Th.tsx"],"sourcesContent":["import {\n type AriaAttributes,\n type ComponentPropsWithoutRef,\n type PropsWithChildren,\n memo,\n useMemo,\n} from 'react'\nimport { type VariantProps, tv } from 'tailwind-variants'\n\nimport { ThSortButton } from './ThSortButton'\nimport { reelShadowClassNameGenerator } from './reelShadowStyle'\n\nimport type { CellContentWidth } from './type'\n\nexport type AbstractProps = PropsWithChildren<\n {\n /** 並び替え状態 */\n sort?: ComponentPropsWithoutRef<typeof ThSortButton>['sort']\n /** 並び替えをクリックした時に発火するコールバック関数 */\n onSort?: () => void\n /** 横スクロール時、カラムを左右いずれかに固定 */\n fixed?: 'left' | 'right'\n
|
|
1
|
+
{"version":3,"file":"Th.js","sources":["../../../src/components/Table/Th.tsx"],"sourcesContent":["import {\n type AriaAttributes,\n type ComponentPropsWithoutRef,\n type PropsWithChildren,\n memo,\n useMemo,\n} from 'react'\nimport { type VariantProps, tv } from 'tailwind-variants'\n\nimport { ThSortButton } from './ThSortButton'\nimport { reelShadowClassNameGenerator } from './reelShadowStyle'\n\nimport type { CellContentWidth } from './type'\n\nexport type AbstractProps = PropsWithChildren<\n {\n /** 並び替え状態 */\n sort?: ComponentPropsWithoutRef<typeof ThSortButton>['sort']\n /** 並び替えをクリックした時に発火するコールバック関数 */\n onSort?: () => void\n /** 横スクロール時、カラムを左右いずれかに固定 */\n fixed?: 'left' | 'right'\n contentWidth?: CellContentWidth\n } & VariantProps<typeof classNameGenerator>\n>\ntype Props = AbstractProps & Omit<ComponentPropsWithoutRef<'th'>, keyof AbstractProps | 'onClick'>\n\nconst classNameGenerator = tv({\n base: [\n 'smarthr-ui-Th',\n 'shr-whitespace-nowrap shr-border-0 shr-px-1 shr-py-0.75 shr-text-left shr-align-middle shr-text-sm shr-font-bold shr-leading-tight shr-text-black',\n 'aria-[sort]:shr-cursor-pointer',\n 'hover:aria-[sort]:shr-bg-head-darken',\n '[&:has(:focus-visible)]:aria-[sort]:shr-focus-indicator',\n '[&[aria-sort=none]_.smarthr-ui-Icon]:forced-colors:shr-fill-[GrayText]',\n '[&[aria-sort=ascending]_.smarthr-ui-Icon:first-of-type]:forced-colors:shr-fill-[CanvasText] [&[aria-sort=ascending]_.smarthr-ui-Icon:last-of-type]:forced-colors:shr-fill-[GrayText]',\n '[&[aria-sort=descending]_.smarthr-ui-Icon:first-of-type]:forced-colors:shr-fill-[GrayText] [&[aria-sort=descending]_.smarthr-ui-Icon:last-of-type]:forced-colors:shr-fill-[CanvasText]',\n ],\n variants: {\n align: {\n left: '',\n right: 'shr-text-right',\n },\n vAlign: {\n middle: '',\n baseline: 'shr-align-baseline',\n bottom: 'shr-align-bottom',\n },\n },\n defaultVariants: {\n align: 'left',\n vAlign: 'middle',\n },\n})\n\nconst convertContentWidth = (contentWidth?: CellContentWidth) => {\n if (typeof contentWidth === 'number') {\n // Th は fontSize.S のため、rem で指定する\n return `${contentWidth}rem`\n }\n\n return contentWidth\n}\n\nexport const Th = memo<Props>(\n ({ children, sort, onSort, align, vAlign, fixed, contentWidth, className, style, ...rest }) => {\n const actualClassName = useMemo(() => {\n const base = classNameGenerator({ className, align, vAlign })\n\n if (!fixed) {\n return base\n }\n\n const shadow = reelShadowClassNameGenerator({ showShadow: false, direction: fixed })\n\n return `${base} ${shadow}`\n }, [align, className, fixed, vAlign])\n const actualStyle = useMemo(\n () => ({\n ...style,\n width: convertContentWidth(contentWidth),\n }),\n [style, contentWidth],\n )\n\n const ariaSort = useMemo<AriaAttributes['aria-sort'] | undefined>(\n () => (sort ? (sort === 'none' ? 'none' : `${sort}ending`) : undefined),\n [sort],\n )\n\n return (\n <th\n {...rest}\n aria-sort={ariaSort}\n data-fixed={fixed}\n className={actualClassName}\n style={actualStyle}\n >\n {sort ? (\n <ThSortButton align={align} onSort={onSort} sort={sort}>\n {children}\n </ThSortButton>\n ) : (\n children\n )}\n </th>\n )\n },\n)\n"],"names":["tv","_jsx"],"mappings":";;;;;;AA2BA,MAAM,kBAAkB,GAAGA,EAAE,CAAC;AAC5B,IAAA,IAAI,EAAE;QACJ,eAAe;QACf,mJAAmJ;QACnJ,gCAAgC;QAChC,sCAAsC;QACtC,yDAAyD;QACzD,wEAAwE;QACxE,sLAAsL;QACtL,wLAAwL;AACzL,KAAA;AACD,IAAA,QAAQ,EAAE;AACR,QAAA,KAAK,EAAE;AACL,YAAA,IAAI,EAAE,EAAE;AACR,YAAA,KAAK,EAAE,gBAAgB;AACxB,SAAA;AACD,QAAA,MAAM,EAAE;AACN,YAAA,MAAM,EAAE,EAAE;AACV,YAAA,QAAQ,EAAE,oBAAoB;AAC9B,YAAA,MAAM,EAAE,kBAAkB;AAC3B,SAAA;AACF,KAAA;AACD,IAAA,eAAe,EAAE;AACf,QAAA,KAAK,EAAE,MAAM;AACb,QAAA,MAAM,EAAE,QAAQ;AACjB,KAAA;AACF,CAAA,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,YAA+B,KAAI;AAC9D,IAAA,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE;;QAEpC,OAAO,CAAA,EAAG,YAAY,CAAA,GAAA,CAAK;IAC7B;AAEA,IAAA,OAAO,YAAY;AACrB,CAAC;AAEM,MAAM,EAAE,GAAG,IAAI,CACpB,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,KAAI;AA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.2_@swc_core@1.15.17_@types_node@20.19.35_typescript@5.9.3__/vendor/tailwind-variants/dist/index.cjs');
|
|
7
7
|
require('../../intl/IntlProvider.cjs');
|
|
8
8
|
var intl_useIntl = require('../../intl/useIntl.cjs');
|
|
9
|
-
require('
|
|
9
|
+
require('../../intl/Localizer.cjs');
|
|
10
10
|
require('../../_virtual/dayjs.min.cjs');
|
|
11
11
|
require('../../intl/TimeFormatter.cjs');
|
|
12
12
|
var components_Checkbox_Checkbox = require('../Checkbox/Checkbox.cjs');
|
|
@@ -4,7 +4,7 @@ import { forwardRef, useMemo } from 'react';
|
|
|
4
4
|
import { tv as ce } from './../../vendor/.pnpm/tailwind-variants@0.3.1_tailwindcss@3.4.19_ts-node@10.9.2_@swc_core@1.15.17_@types_node@20.19.35_typescript@5.9.3__/vendor/tailwind-variants/dist/index.js';
|
|
5
5
|
import '../../intl/IntlProvider.js';
|
|
6
6
|
import { useIntl } from '../../intl/useIntl.js';
|
|
7
|
-
import '
|
|
7
|
+
import '../../intl/Localizer.js';
|
|
8
8
|
import '../../_virtual/dayjs.min.js';
|
|
9
9
|
import '../../intl/TimeFormatter.js';
|
|
10
10
|
import { Checkbox } from '../Checkbox/Checkbox.js';
|
|
@@ -6,7 +6,7 @@ var React = require('react');
|
|
|
6
6
|
var index = require('./../../vendor/.pnpm/tailwind-variants@0.3.1_tailwindcss@3.4.19_ts-node@10.9.2_@swc_core@1.15.17_@types_node@20.19.35_typescript@5.9.3__/vendor/tailwind-variants/dist/index.cjs');
|
|
7
7
|
require('../../intl/IntlProvider.cjs');
|
|
8
8
|
var intl_useIntl = require('../../intl/useIntl.cjs');
|
|
9
|
-
require('
|
|
9
|
+
require('../../intl/Localizer.cjs');
|
|
10
10
|
require('../../_virtual/dayjs.min.cjs');
|
|
11
11
|
require('../../intl/TimeFormatter.cjs');
|
|
12
12
|
require('../Button/Button.cjs');
|
|
@@ -26,9 +26,9 @@ const sortButtonClassNameGenerator = index.tv({
|
|
|
26
26
|
},
|
|
27
27
|
},
|
|
28
28
|
});
|
|
29
|
-
const ThSortButton = React.memo(({ align, sort,
|
|
29
|
+
const ThSortButton = React.memo(({ align, sort, onSort, children }) => {
|
|
30
30
|
const { localize } = intl_useIntl.useIntl();
|
|
31
|
-
const
|
|
31
|
+
const defaultTexts = React.useMemo(() => ({
|
|
32
32
|
asc: localize({
|
|
33
33
|
id: 'smarthr-ui/Th/sortDirectionAsc',
|
|
34
34
|
defaultText: '昇順',
|
|
@@ -45,9 +45,8 @@ const ThSortButton = React.memo(({ align, sort, decorators, onSort, children })
|
|
|
45
45
|
const sortLabel = React.useMemo(() => {
|
|
46
46
|
if (!sort)
|
|
47
47
|
return undefined;
|
|
48
|
-
return
|
|
49
|
-
|
|
50
|
-
}, [decorators, sort, decoratorDefaultTexts]);
|
|
48
|
+
return defaultTexts[sort];
|
|
49
|
+
}, [sort, defaultTexts]);
|
|
51
50
|
const className = React.useMemo(() => sortButtonClassNameGenerator({ align }), [align]);
|
|
52
51
|
return (jsxRuntime.jsxs(components_Button_UnstyledButton.UnstyledButton, { onClick: onSort, className: className, children: [children, jsxRuntime.jsx(SortIcon, {}), jsxRuntime.jsx(components_VisuallyHiddenText_VisuallyHiddenText.VisuallyHiddenText, { children: sortLabel })] }));
|
|
53
52
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThSortButton.cjs","sources":["../../../src/components/Table/ThSortButton.tsx"],"sourcesContent":["'use client'\n\nimport { type PropsWithChildren,
|
|
1
|
+
{"version":3,"file":"ThSortButton.cjs","sources":["../../../src/components/Table/ThSortButton.tsx"],"sourcesContent":["'use client'\n\nimport { type PropsWithChildren, memo, useMemo } from 'react'\nimport { type VariantProps, tv } from 'tailwind-variants'\n\nimport { useIntl } from '../../intl'\nimport { UnstyledButton } from '../Button'\nimport { FaSortDownIcon, FaSortUpIcon } from '../Icon'\nimport { VisuallyHiddenText } from '../VisuallyHiddenText'\n\nconst sortButtonClassNameGenerator = tv({\n base: 'shr-relative -shr-mx-1 -shr-my-0.75 shr-inline-flex shr-w-full shr-items-center shr-justify-between shr-gap-x-0.5 shr-px-1 shr-py-0.75 shr-font-bold',\n variants: {\n align: {\n left: '',\n right: 'shr-justify-end',\n },\n },\n})\n\ntype sortTypes = 'asc' | 'desc' | 'none'\n\ntype Props = PropsWithChildren<{\n align?: VariantProps<typeof sortButtonClassNameGenerator>['align']\n onSort?: () => void\n sort?: sortTypes\n}>\n\nexport const ThSortButton = memo<Props>(({ align, sort, onSort, children }) => {\n const { localize } = useIntl()\n\n const defaultTexts = useMemo(\n () => ({\n asc: localize({\n id: 'smarthr-ui/Th/sortDirectionAsc',\n defaultText: '昇順',\n }),\n desc: localize({\n id: 'smarthr-ui/Th/sortDirectionDesc',\n defaultText: '降順',\n }),\n none: localize({\n id: 'smarthr-ui/Th/sortDirectionNone',\n defaultText: '並び替えなし',\n }),\n }),\n [localize],\n )\n\n const sortLabel = useMemo(() => {\n if (!sort) return undefined\n\n return defaultTexts[sort]\n }, [sort, defaultTexts])\n\n const className = useMemo(() => sortButtonClassNameGenerator({ align }), [align])\n\n return (\n <UnstyledButton onClick={onSort} className={className}>\n {children}\n <SortIcon />\n <VisuallyHiddenText>{sortLabel}</VisuallyHiddenText>\n </UnstyledButton>\n )\n})\n\nconst sortIconClassNameGenerator = tv({\n slots: {\n wrapper: 'smarthr-ui-Icon-extended shr-relative shr-h-1 shr-w-1',\n upIcon: [\n 'shr-absolute shr-left-0 shr-top-0',\n 'shr-text-base',\n '[[aria-sort=\"none\"]_&]:shr-text-disabled',\n '[[aria-sort=\"ascending\"]_&]:shr-text-black',\n '[[aria-sort=\"descending\"]_&]:shr-text-disabled',\n ],\n downIcon: [\n 'shr-absolute shr-left-0 shr-top-0',\n 'shr-text-base',\n '[[aria-sort=\"none\"]_&]:shr-text-disabled',\n '[[aria-sort=\"ascending\"]_&]:shr-text-disabled',\n '[[aria-sort=\"descending\"]_&]:shr-text-black',\n ],\n },\n})\n\nconst SortIcon = memo(() => {\n const classNames = useMemo(() => {\n const { wrapper, upIcon, downIcon } = sortIconClassNameGenerator()\n\n return {\n wrapper: wrapper(),\n upIcon: upIcon(),\n downIcon: downIcon(),\n }\n }, [])\n\n return (\n <span className={classNames.wrapper}>\n <FaSortUpIcon className={classNames.upIcon} />\n <FaSortDownIcon className={classNames.downIcon} />\n </span>\n )\n})\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAUA;AACE;AACA;AACE;AACE;AACA;AACD;AACF;AACF;AAUM;AACL;AAEA;;AAGM;AACA;;;AAGA;AACA;;;AAGA;AACA;;AAEH;AAIH;AACE;AAAW;AAEX;AACF;AAEA;;AASF;AAEA;AACE;AACE;AACA;;;;;;AAMC;AACD;;;;;;AAMC;AACF;AACF;AAED;AACE;;;;;;;;AAUA;AAMF;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type PropsWithChildren
|
|
1
|
+
import { type PropsWithChildren } from 'react';
|
|
2
2
|
import { type VariantProps } from 'tailwind-variants';
|
|
3
3
|
declare const sortButtonClassNameGenerator: import("tailwind-variants").TVReturnType<{
|
|
4
4
|
align: {
|
|
@@ -41,11 +41,6 @@ type Props = PropsWithChildren<{
|
|
|
41
41
|
align?: VariantProps<typeof sortButtonClassNameGenerator>['align'];
|
|
42
42
|
onSort?: () => void;
|
|
43
43
|
sort?: sortTypes;
|
|
44
|
-
decorators?: {
|
|
45
|
-
sortDirectionIconAlt: (text: string, { sort }: {
|
|
46
|
-
sort: sortTypes;
|
|
47
|
-
}) => ReactNode;
|
|
48
|
-
};
|
|
49
44
|
}>;
|
|
50
45
|
export declare const ThSortButton: import("react").NamedExoticComponent<Props>;
|
|
51
46
|
export {};
|