smarthr-ui 75.4.0 → 76.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/esm/_virtual/index.js +4 -4
- package/esm/_virtual/index2.js +4 -4
- package/esm/_virtual/index3.js +4 -4
- package/esm/components/AppHeader/AppHeader.js +3 -7
- package/esm/components/AppHeader/AppHeader.js.map +1 -1
- package/esm/components/AppHeader/components/desktop/DesktopHeader.js +4 -6
- package/esm/components/AppHeader/components/desktop/DesktopHeader.js.map +1 -1
- package/esm/components/AppHeader/components/mobile/LanguageSelector.js +13 -7
- package/esm/components/AppHeader/components/mobile/LanguageSelector.js.map +1 -1
- package/esm/components/AppHeader/components/mobile/MobileHeader.js +1 -3
- package/esm/components/AppHeader/components/mobile/MobileHeader.js.map +1 -1
- package/esm/components/AppHeader/components/mobile/UserInfo.js +3 -5
- package/esm/components/AppHeader/components/mobile/UserInfo.js.map +1 -1
- package/esm/components/AppHeader/stories/args.js +0 -1
- package/esm/components/AppHeader/stories/args.js.map +1 -1
- package/esm/components/AppHeader/types.d.ts +1 -2
- package/esm/components/Combobox/MultiCombobox/MultiCombobox.js +1 -1
- package/esm/components/Combobox/SingleCombobox/SingleCombobox.js +1 -1
- package/esm/components/Combobox/helper.js +1 -1
- package/esm/components/Combobox/useOptions.js +1 -1
- package/esm/components/Dialog/StepFormDialog/StepFormDialogContentInner.js +1 -1
- package/esm/components/Dialog/StepFormDialog/StepFormDialogContentInner.js.map +1 -1
- package/esm/components/Dropdown/DropdownMenuButton/DropdownMenuButton.js +1 -1
- package/esm/components/Dropdown/FilterDropdown/FilterDropdown.js +1 -1
- package/esm/components/FormControl/FormControl.js +1 -1
- package/esm/components/Header/LanguageSwitcher/LanguageSwitcher.d.ts +2 -2
- package/esm/components/Header/LanguageSwitcher/LanguageSwitcher.js +3 -3
- package/esm/components/Header/LanguageSwitcher/LanguageSwitcher.js.map +1 -1
- package/esm/components/SpreadsheetTable/SpreadsheetTable.js +1 -1
- package/esm/components/SpreadsheetTable/SpreadsheetTable.js.map +1 -1
- package/esm/components/Tooltip/Tooltip.js +1 -1
- package/esm/intl/IntlProvider.d.ts +4 -4
- package/esm/intl/IntlProvider.js +2 -1
- package/esm/intl/IntlProvider.js.map +1 -1
- package/esm/intl/localeMap.d.ts +3 -0
- package/esm/{components/AppHeader/multilingualization → intl}/localeMap.js +3 -2
- package/esm/intl/localeMap.js.map +1 -0
- package/esm/libs/lodash.js +2 -2
- package/esm/types/index.d.ts +0 -1
- package/lib/components/AppHeader/AppHeader.js +2 -4
- package/lib/components/AppHeader/AppHeader.js.map +1 -1
- package/lib/components/AppHeader/components/desktop/DesktopHeader.js +4 -6
- package/lib/components/AppHeader/components/desktop/DesktopHeader.js.map +1 -1
- package/lib/components/AppHeader/components/mobile/LanguageSelector.js +11 -7
- package/lib/components/AppHeader/components/mobile/LanguageSelector.js.map +1 -1
- package/lib/components/AppHeader/components/mobile/MobileHeader.js +1 -3
- package/lib/components/AppHeader/components/mobile/MobileHeader.js.map +1 -1
- package/lib/components/AppHeader/components/mobile/UserInfo.js +3 -5
- package/lib/components/AppHeader/components/mobile/UserInfo.js.map +1 -1
- package/lib/components/AppHeader/stories/args.js +0 -1
- package/lib/components/AppHeader/stories/args.js.map +1 -1
- package/lib/components/AppHeader/types.d.ts +1 -2
- package/lib/components/AppHeader/types.js.map +1 -1
- package/lib/components/Dialog/StepFormDialog/StepFormDialogContentInner.js +1 -1
- package/lib/components/Dialog/StepFormDialog/StepFormDialogContentInner.js.map +1 -1
- package/lib/components/Header/LanguageSwitcher/LanguageSwitcher.d.ts +2 -2
- package/lib/components/Header/LanguageSwitcher/LanguageSwitcher.js +3 -3
- package/lib/components/Header/LanguageSwitcher/LanguageSwitcher.js.map +1 -1
- package/lib/components/SpreadsheetTable/SpreadsheetTable.js +1 -1
- package/lib/components/SpreadsheetTable/SpreadsheetTable.js.map +1 -1
- package/lib/intl/IntlProvider.d.ts +4 -4
- package/lib/intl/IntlProvider.js +2 -1
- package/lib/intl/IntlProvider.js.map +1 -1
- package/lib/intl/localeMap.d.ts +3 -0
- package/lib/{components/AppHeader/multilingualization → intl}/localeMap.js +3 -2
- package/lib/intl/localeMap.js.map +1 -0
- package/lib/types/index.d.ts +0 -1
- package/lib/types/index.js.map +1 -1
- package/package.json +1 -1
- package/smarthr-ui.css +2 -2
- package/esm/components/AppHeader/hooks/useLocale.d.ts +0 -11
- package/esm/components/AppHeader/hooks/useLocale.js +0 -11
- package/esm/components/AppHeader/hooks/useLocale.js.map +0 -1
- package/esm/components/AppHeader/multilingualization/index.d.ts +0 -2
- package/esm/components/AppHeader/multilingualization/index.js +0 -2
- package/esm/components/AppHeader/multilingualization/index.js.map +0 -1
- package/esm/components/AppHeader/multilingualization/localeMap.d.ts +0 -10
- package/esm/components/AppHeader/multilingualization/localeMap.js.map +0 -1
- package/esm/components/AppHeader/multilingualization/types.d.ts +0 -3
- package/esm/components/AppHeader/multilingualization/types.js +0 -4
- package/esm/components/AppHeader/multilingualization/types.js.map +0 -1
- package/esm/types/Locale.d.ts +0 -3
- package/esm/types/Locale.js +0 -2
- package/esm/types/Locale.js.map +0 -1
- package/lib/components/AppHeader/hooks/useLocale.d.ts +0 -11
- package/lib/components/AppHeader/hooks/useLocale.js +0 -13
- package/lib/components/AppHeader/hooks/useLocale.js.map +0 -1
- package/lib/components/AppHeader/multilingualization/index.d.ts +0 -2
- package/lib/components/AppHeader/multilingualization/index.js +0 -6
- package/lib/components/AppHeader/multilingualization/index.js.map +0 -1
- package/lib/components/AppHeader/multilingualization/localeMap.d.ts +0 -10
- package/lib/components/AppHeader/multilingualization/localeMap.js.map +0 -1
- package/lib/components/AppHeader/multilingualization/types.d.ts +0 -3
- package/lib/components/AppHeader/multilingualization/types.js +0 -5
- package/lib/components/AppHeader/multilingualization/types.js.map +0 -1
- package/lib/types/Locale.d.ts +0 -3
- package/lib/types/Locale.js +0 -3
- package/lib/types/Locale.js.map +0 -1
package/esm/_virtual/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getDefaultExportFromCjs } from './_commonjsHelpers.js';
|
|
2
|
-
import { __require as
|
|
2
|
+
import { __require as requireLodash_merge } from './../vendor/.pnpm/lodash.merge@4.6.2/vendor/lodash.merge/index.js';
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var lodash_mergeExports = requireLodash_merge();
|
|
5
|
+
var _merge = /*@__PURE__*/getDefaultExportFromCjs(lodash_mergeExports);
|
|
6
6
|
|
|
7
|
-
export {
|
|
7
|
+
export { _merge as default };
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
package/esm/_virtual/index2.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getDefaultExportFromCjs } from './_commonjsHelpers.js';
|
|
2
|
-
import { __require as
|
|
2
|
+
import { __require as requireLodash_range } from './../vendor/.pnpm/lodash.range@3.2.0/vendor/lodash.range/index.js';
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var lodash_rangeExports = requireLodash_range();
|
|
5
|
+
var _range = /*@__PURE__*/getDefaultExportFromCjs(lodash_rangeExports);
|
|
6
6
|
|
|
7
|
-
export {
|
|
7
|
+
export { _range as default };
|
|
8
8
|
//# sourceMappingURL=index2.js.map
|
package/esm/_virtual/index3.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getDefaultExportFromCjs } from './_commonjsHelpers.js';
|
|
2
|
-
import { __require as
|
|
2
|
+
import { __require as requireReactInnertext } from './../vendor/.pnpm/react-innertext@1.1.5_@types_react@18.3.23_react@19.1.1/vendor/react-innertext/index.js';
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var reactInnertextExports = requireReactInnertext();
|
|
5
|
+
var innerText = /*@__PURE__*/getDefaultExportFromCjs(reactInnertextExports);
|
|
6
6
|
|
|
7
|
-
export {
|
|
7
|
+
export { innerText as default };
|
|
8
8
|
//# sourceMappingURL=index3.js.map
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { IntlProvider } from '../../intl/IntlProvider.js';
|
|
4
|
-
import 'react';
|
|
5
|
-
import 'react-intl';
|
|
2
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
6
3
|
import { DesktopHeader } from './components/desktop/DesktopHeader.js';
|
|
7
4
|
import { MobileHeader } from './components/mobile/MobileHeader.js';
|
|
8
|
-
import { LocaleContextProvider } from './hooks/useLocale.js';
|
|
9
5
|
import { useMediaQuery, mediaQuery } from './hooks/useMediaQuery.js';
|
|
10
6
|
|
|
11
|
-
const AppHeader = ({
|
|
7
|
+
const AppHeader = ({ children, ...props }) => {
|
|
12
8
|
// NOTE: ヘッダーの出し分けは CSS によって行われているので、useMediaQuery による children の出し分けは本来不要ですが、
|
|
13
9
|
// wovn の言語切替カスタム UI の挿入対象となる DOM ("wovn-embedded-widget-anchor" クラスを持った div) が複数描画されていると、
|
|
14
10
|
// wovn のスクリプトの仕様上1つ目の DOM にしか UI が挿入されないため、やむを得ず children のみ React のレンダリングレベルでの出し分けをしています。
|
|
15
11
|
const isDesktop = useMediaQuery(mediaQuery.desktop);
|
|
16
12
|
// HINT: Desktop,Mobileの両ヘッダーは常にHTML上に存在し、cssでvisibleを切り替えることでSSR環境でのレイアウトシフトが発生しないようにしています
|
|
17
13
|
// 表示切替は画面幅によって決まり、SSR環境では判定出来ないためです
|
|
18
|
-
return (
|
|
14
|
+
return (jsxs(Fragment, { children: [jsx(DesktopHeader, { ...props, children: isDesktop ? children : undefined }), jsx(MobileHeader, { ...props, children: isDesktop ? undefined : children })] }));
|
|
19
15
|
};
|
|
20
16
|
|
|
21
17
|
export { AppHeader };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppHeader.js","sources":["../../../src/components/AppHeader/AppHeader.tsx"],"sourcesContent":["'use client'\n\nimport {
|
|
1
|
+
{"version":3,"file":"AppHeader.js","sources":["../../../src/components/AppHeader/AppHeader.tsx"],"sourcesContent":["'use client'\n\nimport { DesktopHeader } from './components/desktop/DesktopHeader'\nimport { MobileHeader } from './components/mobile/MobileHeader'\nimport { mediaQuery, useMediaQuery } from './hooks/useMediaQuery'\n\nimport type { HeaderProps } from './types'\nimport type { FC } from 'react'\n\nexport const AppHeader: FC<HeaderProps> = ({ children, ...props }) => {\n // NOTE: ヘッダーの出し分けは CSS によって行われているので、useMediaQuery による children の出し分けは本来不要ですが、\n // wovn の言語切替カスタム UI の挿入対象となる DOM (\"wovn-embedded-widget-anchor\" クラスを持った div) が複数描画されていると、\n // wovn のスクリプトの仕様上1つ目の DOM にしか UI が挿入されないため、やむを得ず children のみ React のレンダリングレベルでの出し分けをしています。\n const isDesktop = useMediaQuery(mediaQuery.desktop)\n\n // HINT: Desktop,Mobileの両ヘッダーは常にHTML上に存在し、cssでvisibleを切り替えることでSSR環境でのレイアウトシフトが発生しないようにしています\n // 表示切替は画面幅によって決まり、SSR環境では判定出来ないためです\n return (\n <>\n <DesktopHeader {...props}>{isDesktop ? children : undefined}</DesktopHeader>\n <MobileHeader {...props}>{isDesktop ? undefined : children}</MobileHeader>\n </>\n )\n}\n"],"names":[],"mappings":";;;;;;AASO;;;;;;;AAQL;AAMF;;"}
|
|
@@ -4,6 +4,7 @@ import { tv as ce } from './../../../../vendor/.pnpm/tailwind-variants@0.3.1_tai
|
|
|
4
4
|
import '../../../../intl/IntlProvider.js';
|
|
5
5
|
import { useIntl } from '../../../../intl/useIntl.js';
|
|
6
6
|
import 'react-intl';
|
|
7
|
+
import { localeMap } from '../../../../intl/localeMap.js';
|
|
7
8
|
import { Button } from '../../../Button/Button.js';
|
|
8
9
|
import '../../../Button/AnchorButton.js';
|
|
9
10
|
import '../../../Button/UnstyledButton.js';
|
|
@@ -28,8 +29,6 @@ import '../../../Layout/Reel/Reel.js';
|
|
|
28
29
|
import '../../../Layout/Sidebar/Sidebar.js';
|
|
29
30
|
import '../../../Layout/Center/Center.js';
|
|
30
31
|
import '../../../Layout/Container/Container.js';
|
|
31
|
-
import { useLocale } from '../../hooks/useLocale.js';
|
|
32
|
-
import { localeMap } from '../../multilingualization/localeMap.js';
|
|
33
32
|
import { Translate } from '../common/Translate.js';
|
|
34
33
|
import { AppLauncher } from './AppLauncher.js';
|
|
35
34
|
import { Navigation } from './Navigation.js';
|
|
@@ -46,7 +45,7 @@ const classNameGenerator = ce({
|
|
|
46
45
|
],
|
|
47
46
|
},
|
|
48
47
|
});
|
|
49
|
-
const DesktopHeader = ({ enableNew, className = '', appName, tenants, currentTenantId, schoolUrl, helpPageUrl, children, userInfo, desktopAdditionalContent, navigations, desktopNavigationAdditionalContent, releaseNote, features, ...props }) => {
|
|
48
|
+
const DesktopHeader = ({ enableNew, className = '', appName, tenants, currentTenantId, schoolUrl, helpPageUrl, children, userInfo, desktopAdditionalContent, navigations, desktopNavigationAdditionalContent, releaseNote, features, locale: localeProps, ...props }) => {
|
|
50
49
|
const classNames = useMemo(() => {
|
|
51
50
|
const { wrapper, appsButton } = classNameGenerator();
|
|
52
51
|
return {
|
|
@@ -54,8 +53,7 @@ const DesktopHeader = ({ enableNew, className = '', appName, tenants, currentTen
|
|
|
54
53
|
appsButton: appsButton(),
|
|
55
54
|
};
|
|
56
55
|
}, [className]);
|
|
57
|
-
const { locale } =
|
|
58
|
-
const { localize } = useIntl();
|
|
56
|
+
const { localize, locale } = useIntl();
|
|
59
57
|
const translated = useMemo(() => ({
|
|
60
58
|
appLauncherLabel: localize({
|
|
61
59
|
id: 'smarthr-ui/AppHeader/DesktopHeader/appLauncherLabel',
|
|
@@ -64,7 +62,7 @@ const DesktopHeader = ({ enableNew, className = '', appName, tenants, currentTen
|
|
|
64
62
|
school: localize({ id: 'smarthr-ui/AppHeader/school', defaultText: 'スクール' }),
|
|
65
63
|
help: localize({ id: 'smarthr-ui/AppHeader/help', defaultText: 'ヘルプ' }),
|
|
66
64
|
}), [localize]);
|
|
67
|
-
return (jsxs(Fragment, { children: [jsx(Header, { ...props, enableNew: enableNew, className: classNames.wrapper, featureName: appName, tenants: tenants, currentTenantId: currentTenantId, children: jsxs(Cluster, { align: "center", className: "shr--me-0.25", children: [!enableNew && (jsxs(Fragment, { children: [features && features.length > 0 && (jsxs(Dropdown, { children: [jsx(AppLauncherButton, { enableNew: enableNew, className: classNames.appsButton, children: translated.appLauncherLabel }), jsx(DropdownContent, { controllable: true, children: jsx(AppLauncher, { features: features }) })] })), schoolUrl && (jsx(HeaderLink, { href: schoolUrl, prefix: jsx(FaGraduationCapIcon, {}), className: "shr-flex shr-items-center shr-py-0.75 shr-leading-none", children: jsx(Translate, { children: translated.school }) }))] })), helpPageUrl && (jsx(HeaderLink, { href: helpPageUrl, prefix: enableNew ? jsx(FaRegCircleQuestionIcon, {}) : jsx(FaCircleQuestionIcon, {}), className: enableNew ? undefined : 'shr-flex shr-items-center shr-py-0.75 shr-leading-none', enableNew: enableNew, children: jsx(Translate, { children: translated.help }) })),
|
|
65
|
+
return (jsxs(Fragment, { children: [jsx(Header, { ...props, enableNew: enableNew, className: classNames.wrapper, featureName: appName, tenants: tenants, currentTenantId: currentTenantId, children: jsxs(Cluster, { align: "center", className: "shr--me-0.25", children: [!enableNew && (jsxs(Fragment, { children: [features && features.length > 0 && (jsxs(Dropdown, { children: [jsx(AppLauncherButton, { enableNew: enableNew, className: classNames.appsButton, children: translated.appLauncherLabel }), jsx(DropdownContent, { controllable: true, children: jsx(AppLauncher, { features: features }) })] })), schoolUrl && (jsx(HeaderLink, { href: schoolUrl, prefix: jsx(FaGraduationCapIcon, {}), className: "shr-flex shr-items-center shr-py-0.75 shr-leading-none", children: jsx(Translate, { children: translated.school }) }))] })), helpPageUrl && (jsx(HeaderLink, { href: helpPageUrl, prefix: enableNew ? jsx(FaRegCircleQuestionIcon, {}) : jsx(FaCircleQuestionIcon, {}), className: enableNew ? undefined : 'shr-flex shr-items-center shr-py-0.75 shr-leading-none', enableNew: enableNew, children: jsx(Translate, { children: translated.help }) })), localeProps && (jsx(LanguageSwitcher, { localeMap: localeMap, locale: locale, onLanguageSelect: localeProps.onSelectLocale, enableNew: enableNew })), children, userInfo && (jsx(UserInfo, { ...userInfo, tenants: tenants, currentTenantId: currentTenantId, desktopAdditionalContent: desktopAdditionalContent, enableNew: enableNew }))] }) }), navigations && (jsx(Navigation, { appName: appName, navigations: navigations, additionalContent: desktopNavigationAdditionalContent, releaseNote: releaseNote, enableNew: enableNew }))] }));
|
|
68
66
|
};
|
|
69
67
|
const AppLauncherButton = memo(({ enableNew, children, className }) => (jsx(DropdownTrigger, { children: jsx(Button, { prefix: enableNew ?? jsx(FaToolboxIcon, {}), className: className, children: jsx(Translate, { children: children }) }) })));
|
|
70
68
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DesktopHeader.js","sources":["../../../../../src/components/AppHeader/components/desktop/DesktopHeader.tsx"],"sourcesContent":["import { type FC, type PropsWithChildren, memo, useMemo } from 'react'\nimport { tv } from 'tailwind-variants'\n\nimport { useIntl } from '../../../../intl'\nimport { Button } from '../../../Button'\nimport { Dropdown, DropdownContent, DropdownTrigger } from '../../../Dropdown'\nimport { Header, HeaderLink, LanguageSwitcher } from '../../../Header'\nimport {\n FaCircleQuestionIcon,\n FaGraduationCapIcon,\n FaRegCircleQuestionIcon,\n FaToolboxIcon,\n} from '../../../Icon'\nimport { Cluster } from '../../../Layout'\nimport {
|
|
1
|
+
{"version":3,"file":"DesktopHeader.js","sources":["../../../../../src/components/AppHeader/components/desktop/DesktopHeader.tsx"],"sourcesContent":["import { type FC, type PropsWithChildren, memo, useMemo } from 'react'\nimport { tv } from 'tailwind-variants'\n\nimport { useIntl } from '../../../../intl'\nimport { localeMap } from '../../../../intl/localeMap'\nimport { Button } from '../../../Button'\nimport { Dropdown, DropdownContent, DropdownTrigger } from '../../../Dropdown'\nimport { Header, HeaderLink, LanguageSwitcher } from '../../../Header'\nimport {\n FaCircleQuestionIcon,\n FaGraduationCapIcon,\n FaRegCircleQuestionIcon,\n FaToolboxIcon,\n} from '../../../Icon'\nimport { Cluster } from '../../../Layout'\nimport { Translate } from '../common/Translate'\n\nimport { AppLauncher } from './AppLauncher'\nimport { Navigation } from './Navigation'\nimport { UserInfo } from './UserInfo'\n\nimport type { HeaderProps } from '../../types'\n\nconst classNameGenerator = tv({\n slots: {\n wrapper: 'max-[751px]:!shr-hidden',\n appsButton: [\n 'shr-border-none shr-bg-transparent shr-px-0.25 shr-font-normal shr-text-white',\n 'hover:shr-border-transparent hover:shr-bg-transparent',\n 'focus-visible:shr-border-transparent focus-visible:shr-bg-transparent',\n 'forced-colors:shr-border-shorthand',\n ],\n },\n})\n\nexport const DesktopHeader: FC<HeaderProps> = ({\n enableNew,\n className = '',\n appName,\n tenants,\n currentTenantId,\n schoolUrl,\n helpPageUrl,\n children,\n userInfo,\n desktopAdditionalContent,\n navigations,\n desktopNavigationAdditionalContent,\n releaseNote,\n features,\n locale: localeProps,\n ...props\n}) => {\n const classNames = useMemo(() => {\n const { wrapper, appsButton } = classNameGenerator()\n\n return {\n wrapper: wrapper({ className }),\n appsButton: appsButton(),\n }\n }, [className])\n\n const { localize, locale } = useIntl()\n const translated = useMemo(\n () => ({\n appLauncherLabel: localize({\n id: 'smarthr-ui/AppHeader/DesktopHeader/appLauncherLabel',\n defaultText: 'アプリ',\n }),\n school: localize({ id: 'smarthr-ui/AppHeader/school', defaultText: 'スクール' }),\n help: localize({ id: 'smarthr-ui/AppHeader/help', defaultText: 'ヘルプ' }),\n }),\n [localize],\n )\n\n return (\n <>\n <Header\n {...props}\n enableNew={enableNew}\n className={classNames.wrapper}\n featureName={appName}\n tenants={tenants}\n currentTenantId={currentTenantId}\n >\n <Cluster align=\"center\" className=\"shr--me-0.25\">\n {!enableNew && (\n <>\n {features && features.length > 0 && (\n <Dropdown>\n <AppLauncherButton enableNew={enableNew} className={classNames.appsButton}>\n {translated.appLauncherLabel}\n </AppLauncherButton>\n <DropdownContent controllable>\n <AppLauncher features={features} />\n </DropdownContent>\n </Dropdown>\n )}\n\n {schoolUrl && (\n <HeaderLink\n href={schoolUrl}\n prefix={<FaGraduationCapIcon />}\n className=\"shr-flex shr-items-center shr-py-0.75 shr-leading-none\"\n >\n <Translate>{translated.school}</Translate>\n </HeaderLink>\n )}\n </>\n )}\n\n {helpPageUrl && (\n <HeaderLink\n href={helpPageUrl}\n prefix={enableNew ? <FaRegCircleQuestionIcon /> : <FaCircleQuestionIcon />}\n className={\n enableNew ? undefined : 'shr-flex shr-items-center shr-py-0.75 shr-leading-none'\n }\n enableNew={enableNew}\n >\n <Translate>{translated.help}</Translate>\n </HeaderLink>\n )}\n\n {localeProps && (\n <LanguageSwitcher\n localeMap={localeMap}\n locale={locale}\n onLanguageSelect={localeProps.onSelectLocale as (locale: string) => void}\n enableNew={enableNew}\n />\n )}\n\n {children}\n\n {userInfo && (\n <UserInfo\n {...userInfo}\n tenants={tenants}\n currentTenantId={currentTenantId}\n desktopAdditionalContent={desktopAdditionalContent}\n enableNew={enableNew}\n />\n )}\n </Cluster>\n </Header>\n\n {navigations && (\n <Navigation\n appName={appName}\n navigations={navigations}\n additionalContent={desktopNavigationAdditionalContent}\n releaseNote={releaseNote}\n enableNew={enableNew}\n />\n )}\n </>\n )\n}\n\nconst AppLauncherButton = memo<\n Pick<HeaderProps, 'enableNew'> & PropsWithChildren<{ className: string }>\n>(({ enableNew, children, className }) => (\n <DropdownTrigger>\n <Button prefix={enableNew ?? <FaToolboxIcon />} className={className}>\n <Translate>{children}</Translate>\n </Button>\n </DropdownTrigger>\n))\n"],"names":["tv","_jsxs","_Fragment","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAM,kBAAkB,GAAGA,EAAE,CAAC;AAC5B,IAAA,KAAK,EAAE;AACL,QAAA,OAAO,EAAE,yBAAyB;AAClC,QAAA,UAAU,EAAE;YACV,+EAA+E;YAC/E,uDAAuD;YACvD,uEAAuE;YACvE,oCAAoC;AACrC,SAAA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A,CAC7B,CACd,EAEA,WAAW,KACVA,GAAA,CAAC,gBAAgB,EAAA,EACf,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,WAAW,CAAC,cAA0C,EACxE,SAAS,EAAE,SAAS,EAAA,CACpB,CACH,EAEA,QAAQ,EAER,QAAQ,KACPA,GAAA,CAAC,QAAQ,EAAA,EAAA,GACH,QAAQ,EACZ,OAAO,EAAE,OAAO,EAChB,eAAe,EAAE,eAAe,EAChC,wBAAwB,EAAE,wBAAwB,EAClD,SAAS,EAAE,SAAS,GACpB,CACH,CAAA,EAAA,CACO,EAAA,CACH,EAER,WAAW,KACVA,GAAA,CAAC,UAAU,EAAA,EACT,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,kCAAkC,EACrD,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EAAA,CACpB,CACH,CAAA,EAAA,CACA;AAEP;AAEA,MAAM,iBAAiB,GAAG,IAAI,CAE5B,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,MACnCA,GAAA,CAAC,eAAe,cACdA,GAAA,CAAC,MAAM,IAAC,MAAM,EAAE,SAAS,IAAIA,GAAA,CAAC,aAAa,EAAA,EAAA,CAAG,EAAE,SAAS,EAAE,SAAS,YAClEA,GAAA,CAAC,SAAS,cAAE,QAAQ,EAAA,CAAa,GAC1B,EAAA,CACO,CACnB,CAAC;;;;"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { memo, useMemo, useCallback } from 'react';
|
|
3
3
|
import { tv as ce } from './../../../../vendor/.pnpm/tailwind-variants@0.3.1_tailwindcss@3.4.17_ts-node@10.9.2_@swc_core@1.13.2_@types_node@20.19.9_typescript@5.8.3__/vendor/tailwind-variants/dist/index.js';
|
|
4
|
+
import '../../../../intl/IntlProvider.js';
|
|
5
|
+
import { useIntl } from '../../../../intl/useIntl.js';
|
|
6
|
+
import 'react-intl';
|
|
7
|
+
import { localeMap } from '../../../../intl/localeMap.js';
|
|
4
8
|
import { Button } from '../../../Button/Button.js';
|
|
5
9
|
import '../../../Button/AnchorButton.js';
|
|
6
10
|
import '../../../Button/UnstyledButton.js';
|
|
@@ -9,7 +13,6 @@ import { FaXmarkIcon, FaCheckIcon } from '../../../Icon/Icon.js';
|
|
|
9
13
|
import '../../../Icon/generateIcon.js';
|
|
10
14
|
import { Section } from '../../../SectioningContent/SectioningContent.js';
|
|
11
15
|
import '../../../SectioningContent/levelContext.js';
|
|
12
|
-
import { localeMap } from '../../multilingualization/localeMap.js';
|
|
13
16
|
import { CommonButton } from '../common/CommonButton.js';
|
|
14
17
|
|
|
15
18
|
const classNameGenerator = ce({
|
|
@@ -22,8 +25,11 @@ const classNameGenerator = ce({
|
|
|
22
25
|
button: ['[&&:not(:has(svg))]:shr-ps-2.5'],
|
|
23
26
|
},
|
|
24
27
|
});
|
|
25
|
-
const
|
|
26
|
-
const
|
|
28
|
+
const LanguageSelector = memo(({ locale: localeProps, onClickClose }) => {
|
|
29
|
+
const { locale, availableLocales } = useIntl();
|
|
30
|
+
const { locales } = useMemo(() => ({
|
|
31
|
+
locales: Object.entries(localeMap).filter(([code]) => availableLocales.includes(code)),
|
|
32
|
+
}), [availableLocales]);
|
|
27
33
|
const classNames = useMemo(() => {
|
|
28
34
|
const { header, headerTitle, buttonWrapper, button } = classNameGenerator();
|
|
29
35
|
return {
|
|
@@ -34,12 +40,12 @@ const LanguageSelector = memo(({ locale, onClickClose }) => {
|
|
|
34
40
|
};
|
|
35
41
|
}, []);
|
|
36
42
|
const onClickLocale = useCallback((e) => {
|
|
37
|
-
|
|
38
|
-
}, [
|
|
39
|
-
return (jsxs(Section, { children: [jsx(SelectorHeading, { onClickClose: onClickClose, wrapperClassName: classNames.header, className: classNames.headerTitle }), jsx("div", { className: classNames.buttonWrapper, children:
|
|
43
|
+
localeProps.onSelectLocale(e.currentTarget.value);
|
|
44
|
+
}, [localeProps]);
|
|
45
|
+
return (jsxs(Section, { children: [jsx(SelectorHeading, { onClickClose: onClickClose, wrapperClassName: classNames.header, className: classNames.headerTitle }), jsx("div", { className: classNames.buttonWrapper, children: locales.map(([localeKey, label]) => (jsx(LocaleButton, { value: localeKey, onClick: onClickLocale, selected: localeKey === locale, className: classNames.button, children: label }, localeKey))) })] }));
|
|
40
46
|
});
|
|
41
47
|
const SelectorHeading = memo(({ onClickClose, wrapperClassName, className }) => (jsxs("div", { className: wrapperClassName, children: [jsx(Heading, { className: className, children: "Language" }), jsx(Button, { type: "button", size: "s", onClick: onClickClose, children: jsx(FaXmarkIcon, { alt: "close" }) })] })));
|
|
42
|
-
const LocaleButton = memo(({ value, selected, className, onClick }) => (jsx(CommonButton, { elementAs: "button", type: "button", value: value, onClick: onClick, prefix: selected && jsx(FaCheckIcon, { color: "MAIN" }), className: className, children:
|
|
48
|
+
const LocaleButton = memo(({ value, selected, className, children, onClick }) => (jsx(CommonButton, { elementAs: "button", type: "button", value: value, onClick: onClick, prefix: selected && jsx(FaCheckIcon, { color: "MAIN" }), className: className, children: children })));
|
|
43
49
|
|
|
44
50
|
export { LanguageSelector };
|
|
45
51
|
//# sourceMappingURL=LanguageSelector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LanguageSelector.js","sources":["../../../../../src/components/AppHeader/components/mobile/LanguageSelector.tsx"],"sourcesContent":["import { type MouseEvent, memo, useCallback, useMemo } from 'react'\nimport { tv } from 'tailwind-variants'\n\nimport {
|
|
1
|
+
{"version":3,"file":"LanguageSelector.js","sources":["../../../../../src/components/AppHeader/components/mobile/LanguageSelector.tsx"],"sourcesContent":["import { type MouseEvent, memo, useCallback, useMemo } from 'react'\nimport { tv } from 'tailwind-variants'\n\nimport { useIntl } from '../../../../intl'\nimport { type Locale, localeMap } from '../../../../intl/localeMap'\nimport { Button } from '../../../Button'\nimport { Heading } from '../../../Heading'\nimport { FaCheckIcon, FaXmarkIcon } from '../../../Icon'\nimport { Section } from '../../../SectioningContent'\nimport { CommonButton } from '../common/CommonButton'\n\nimport type { LocaleProps } from '../../types'\n\nconst classNameGenerator = tv({\n slots: {\n header: [\n 'shr-border-b-shorthand shr-flex shr-items-center shr-justify-between shr-gap-1 shr-px-1 shr-py-0.75',\n ],\n headerTitle: ['shr-font-normal [&&]:shr-text-base'],\n buttonWrapper: ['shr-p-0.5'],\n button: ['[&&:not(:has(svg))]:shr-ps-2.5'],\n },\n})\n\ntype Props = {\n locale: LocaleProps\n onClickClose: () => void\n}\n\nexport const LanguageSelector = memo<Props>(({ locale: localeProps, onClickClose }) => {\n const { locale, availableLocales } = useIntl()\n const { locales } = useMemo(\n () => ({\n locales: Object.entries(localeMap).filter(([code]) => availableLocales.includes(code)),\n }),\n [availableLocales],\n )\n const classNames = useMemo(() => {\n const { header, headerTitle, buttonWrapper, button } = classNameGenerator()\n\n return {\n header: header(),\n headerTitle: headerTitle(),\n buttonWrapper: buttonWrapper(),\n button: button(),\n }\n }, [])\n\n const onClickLocale = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n localeProps.onSelectLocale(e.currentTarget.value as Locale)\n },\n [localeProps],\n )\n\n return (\n <Section>\n <SelectorHeading\n onClickClose={onClickClose}\n wrapperClassName={classNames.header}\n className={classNames.headerTitle}\n />\n <div className={classNames.buttonWrapper}>\n {locales.map(([localeKey, label]) => (\n <LocaleButton\n key={localeKey}\n value={localeKey as Locale}\n onClick={onClickLocale}\n selected={localeKey === locale}\n className={classNames.button}\n >\n {label}\n </LocaleButton>\n ))}\n </div>\n </Section>\n )\n})\n\nconst SelectorHeading = memo<\n Pick<Props, 'onClickClose'> & { wrapperClassName: string; className: string }\n>(({ onClickClose, wrapperClassName, className }) => (\n <div className={wrapperClassName}>\n <Heading className={className}>Language</Heading>\n <Button type=\"button\" size=\"s\" onClick={onClickClose}>\n <FaXmarkIcon alt=\"close\" />\n </Button>\n </div>\n))\n\nconst LocaleButton = memo<{\n value: Locale\n selected: boolean\n className: string\n children: string\n onClick: (e: MouseEvent<HTMLButtonElement>) => void\n}>(({ value, selected, className, children, onClick }) => (\n <CommonButton\n elementAs=\"button\"\n type=\"button\"\n value={value}\n onClick={onClick}\n prefix={selected && <FaCheckIcon color=\"MAIN\" />}\n className={className}\n >\n {children}\n </CommonButton>\n))\n"],"names":["tv","_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;;AAaA,MAAM,kBAAkB,GAAGA,EAAE,CAAC;AAC5B,IAAA,KAAK,EAAE;AACL,QAAA,MAAM,EAAE;YACN,qGAAqG;AACtG,SAAA;QACD,WAAW,EAAE,CAAC,oCAAoC,CAAC;QACnD,aAAa,EAAE,CAAC,WAAW,CAAC;QAC5B,MAAM,EAAE,CAAC,gCAAgC,CAAC;AAC3C,KAAA;AACF,CAAA,CAAC;AAOK,MAAM,gBAAgB,GAAG,IAAI,CAAQ,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,KAAI;IACpF,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,OAAO,EAAE;IAC9C,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CACzB,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACvF,KAAA,CAAC,EACF,CAAC,gBAAgB,CAAC,CACnB;AACD,IAAA,MAAM,UAAU,GAAG,OAAO,CAAC,MAAK;AAC9B,QAAA,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,kBAAkB,EAAE;QAE3E,OAAO;YACL,MAAM,EAAE,MAAM,EAAE;YAChB,WAAW,EAAE,WAAW,EAAE;YAC1B,aAAa,EAAE,aAAa,EAAE;YAC9B,MAAM,EAAE,MAAM,EAAE;SACjB;IACH,CAAC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AEF,MAAM,YAAY,GAAG,IAAI,CAMtB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MACnDA,GAAA,CAAC,YAAY,EAAA,EACX,SAAS,EAAC,QAAQ,EAClB,IAAI,EAAC,QAAQ,EACb,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,QAAQ,IAAIA,GAAA,CAAC,WAAW,EAAA,EAAC,KAAK,EAAC,MAAM,EAAA,CAAG,EAChD,SAAS,EAAE,SAAS,EAAA,QAAA,EAEnB,QAAQ,EAAA,CACI,CAChB,CAAC;;;;"}
|
|
@@ -5,7 +5,6 @@ import '../../../Header/LanguageSwitcher/LanguageSwitcher.js';
|
|
|
5
5
|
import '../../../Header/HeaderLink.js';
|
|
6
6
|
import '../../../Header/HeaderDropdownMenuButton.js';
|
|
7
7
|
import '../../../Header/AppLauncher/AppLauncher.js';
|
|
8
|
-
import { useLocale } from '../../hooks/useLocale.js';
|
|
9
8
|
import { AppLauncherContext } from './AppLauncherContext.js';
|
|
10
9
|
import { Help } from './Help.js';
|
|
11
10
|
import { Menu } from './Menu.js';
|
|
@@ -14,11 +13,10 @@ import { ReleaseNoteContext } from './ReleaseNoteContext.js';
|
|
|
14
13
|
import { TenantSelector } from './TenantSelector.js';
|
|
15
14
|
import { UserInfo } from './UserInfo.js';
|
|
16
15
|
|
|
17
|
-
const MobileHeader = ({ navigations, features, releaseNote, className = '', tenants, children, helpPageUrl, schoolUrl, userInfo, appName, currentTenantId, onTenantSelect, mobileAdditionalContent, ...props }) => {
|
|
16
|
+
const MobileHeader = ({ navigations, features, releaseNote, className = '', tenants, children, helpPageUrl, schoolUrl, userInfo, appName, currentTenantId, onTenantSelect, mobileAdditionalContent, locale, ...props }) => {
|
|
18
17
|
const [isAppLauncherSelected, setIsAppLauncherSelected] = useState(false);
|
|
19
18
|
const [isReleaseNoteSelected, setIsReleaseNoteSelected] = useState(false);
|
|
20
19
|
const [selectedNavigationGroup, setSelectedNavigationGroup] = useState(null);
|
|
21
|
-
const { locale } = useLocale();
|
|
22
20
|
// navigations の設定をメニューの解放条件とする
|
|
23
21
|
const isMenuAvailable = navigations && navigations.length > 0;
|
|
24
22
|
return (jsx(AppLauncherContext.Provider, { value: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileHeader.js","sources":["../../../../../src/components/AppHeader/components/mobile/MobileHeader.tsx"],"sourcesContent":["import { type FC, useState } from 'react'\n\nimport { Header } from '../../../Header'\
|
|
1
|
+
{"version":3,"file":"MobileHeader.js","sources":["../../../../../src/components/AppHeader/components/mobile/MobileHeader.tsx"],"sourcesContent":["import { type FC, useState } from 'react'\n\nimport { Header } from '../../../Header'\n\nimport { AppLauncherContext } from './AppLauncherContext'\nimport { Help } from './Help'\nimport { Menu } from './Menu'\nimport { NavigationContext } from './NavigationContext'\nimport { ReleaseNoteContext } from './ReleaseNoteContext'\nimport { TenantSelector } from './TenantSelector'\nimport { UserInfo } from './UserInfo'\n\nimport type { HeaderProps, NavigationGroup } from '../../types'\n\nexport const MobileHeader: FC<HeaderProps> = ({\n navigations,\n features,\n releaseNote,\n className = '',\n tenants,\n children,\n helpPageUrl,\n schoolUrl,\n userInfo,\n appName,\n currentTenantId,\n onTenantSelect,\n mobileAdditionalContent,\n locale,\n ...props\n}) => {\n const [isAppLauncherSelected, setIsAppLauncherSelected] = useState(false)\n const [isReleaseNoteSelected, setIsReleaseNoteSelected] = useState(false)\n const [selectedNavigationGroup, setSelectedNavigationGroup] = useState<NavigationGroup | null>(\n null,\n )\n\n // navigations の設定をメニューの解放条件とする\n const isMenuAvailable = navigations && navigations.length > 0\n\n return (\n <AppLauncherContext.Provider\n value={{\n features,\n isAppLauncherSelected,\n setIsAppLauncherSelected,\n }}\n >\n <NavigationContext.Provider\n value={{\n navigations: navigations ?? [],\n selectedNavigationGroup,\n setSelectedNavigationGroup,\n }}\n >\n <ReleaseNoteContext.Provider\n value={{\n releaseNote,\n isReleaseNoteSelected,\n setIsReleaseNoteSelected,\n }}\n >\n <Header\n {...props}\n className={`${className} min-[752px]:!shr-hidden`}\n tenants={isMenuAvailable ? undefined : tenants}\n >\n {children}\n\n <Help helpPageUrl={helpPageUrl} schoolUrl={schoolUrl} />\n\n <UserInfo {...userInfo} locale={locale} />\n\n {isMenuAvailable && (\n <Menu\n appName={appName}\n tenantSelector={\n <TenantSelector\n tenants={tenants}\n currentTenantId={currentTenantId}\n onTenantSelect={onTenantSelect}\n />\n }\n additionalContent={mobileAdditionalContent}\n />\n )}\n </Header>\n </ReleaseNoteContext.Provider>\n </NavigationContext.Provider>\n </AppLauncherContext.Provider>\n )\n}\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;AAcO,MAAM,YAAY,GAAoB,CAAC,EAC5C,WAAW,EACX,QAAQ,EACR,WAAW,EACX,SAAS,GAAG,EAAE,EACd,OAAO,EACP,QAAQ,EACR,WAAW,EACX,SAAS,EACT,QAAQ,EACR,OAAO,EACP,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,MAAM,EACN,GAAG,KAAK,EACT,KAAI;IACH,MAAM,CAAC,qBAAqB,EAAE,wBAAwB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;IACzE,MAAM,CAAC,qBAAqB,EAAE,wBAAwB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;IACzE,MAAM,CAAC,uBAAuB,EAAE,0BAA0B,CAAC,GAAG,QAAQ,CACpE,IAAI,CACL;;IAGD,MAAM,eAAe,GAAG,WAAW,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC;AAE7D,IAAA,QACEA,GAAA,CAAC,kBAAkB,CAAC,QAAQ,EAAA,EAC1B,KAAK,EAAE;YACL,QAAQ;YACR,qBAAqB;YACrB,wBAAwB;AACzB,SAAA,EAAA,QAAA,EAEDA,IAAC,iBAAiB,CAAC,QAAQ,EAAA,EACzB,KAAK,EAAE;gBACL,WAAW,EAAE,WAAW,IAAI,EAAE;gBAC9B,uBAAuB;gBACvB,0BAA0B;AAC3B,aAAA,EAAA,QAAA,EAEDA,IAAC,kBAAkB,CAAC,QAAQ,EAAA,EAC1B,KAAK,EAAE;oBACL,WAAW;oBACX,qBAAqB;oBACrB,wBAAwB;AACzB,iBAAA,EAAA,QAAA,EAEDC,KAAC,MAAM,EAAA,EAAA,GACD,KAAK,EACT,SAAS,EAAE,CAAA,EAAG,SAAS,CAAA,wBAAA,CAA0B,EACjD,OAAO,EAAE,eAAe,GAAG,SAAS,GAAG,OAAO,aAE7C,QAAQ,EAETD,IAAC,IAAI,EAAA,EAAC,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAA,CAAI,EAExDA,GAAA,CAAC,QAAQ,OAAK,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAA,CAAI,EAEzC,eAAe,KACdA,IAAC,IAAI,EAAA,EACH,OAAO,EAAE,OAAO,EAChB,cAAc,EACZA,GAAA,CAAC,cAAc,IACb,OAAO,EAAE,OAAO,EAChB,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,cAAc,EAAA,CAC9B,EAEJ,iBAAiB,EAAE,uBAAuB,GAC1C,CACH,CAAA,EAAA,CACM,GACmB,EAAA,CACH,EAAA,CACD;AAElC;;;;"}
|
|
@@ -39,7 +39,6 @@ import '../../../Dropdown/DropdownMenuButton/DropdownMenuGroup.js';
|
|
|
39
39
|
import '../../../Dropdown/SortDropdown/SortDropdown.js';
|
|
40
40
|
import { FaUserLargeIcon, FaGlobeIcon, FaGearIcon } from '../../../Icon/Icon.js';
|
|
41
41
|
import '../../../Icon/generateIcon.js';
|
|
42
|
-
import { useLocale } from '../../hooks/useLocale.js';
|
|
43
42
|
import { buildDisplayName } from '../../utils.js';
|
|
44
43
|
import { CommonButton } from '../common/CommonButton.js';
|
|
45
44
|
import { Translate } from '../common/Translate.js';
|
|
@@ -55,7 +54,7 @@ const classNameGenerator = ce({
|
|
|
55
54
|
dropdownButtonArea: ['shr-border-t-shorthand shr-p-0.5'],
|
|
56
55
|
},
|
|
57
56
|
});
|
|
58
|
-
const UserInfo = memo(({ arbitraryDisplayName, email, empCode, firstName, lastName, accountUrl }) => {
|
|
57
|
+
const UserInfo = memo(({ arbitraryDisplayName, email, empCode, firstName, lastName, accountUrl, locale }) => {
|
|
59
58
|
const displayName = useMemo(() => arbitraryDisplayName ??
|
|
60
59
|
buildDisplayName({
|
|
61
60
|
email,
|
|
@@ -63,13 +62,12 @@ const UserInfo = memo(({ arbitraryDisplayName, email, empCode, firstName, lastNa
|
|
|
63
62
|
firstName,
|
|
64
63
|
lastName,
|
|
65
64
|
}), [arbitraryDisplayName, email, empCode, firstName, lastName]);
|
|
66
|
-
return displayName ? jsx(ActualUserInfo, { accountUrl: accountUrl, displayName: displayName }) : null;
|
|
65
|
+
return displayName ? (jsx(ActualUserInfo, { accountUrl: accountUrl, displayName: displayName, locale: locale })) : null;
|
|
67
66
|
});
|
|
68
|
-
const ActualUserInfo = ({ displayName, accountUrl, }) => {
|
|
67
|
+
const ActualUserInfo = ({ displayName, accountUrl, locale, }) => {
|
|
69
68
|
const [languageDialogOpen, setLanguageDialogOpen] = useState(false);
|
|
70
69
|
const dialogOpen = useCallback(() => setLanguageDialogOpen(true), []);
|
|
71
70
|
const dialogClose = useCallback(() => setLanguageDialogOpen(false), []);
|
|
72
|
-
const { locale } = useLocale();
|
|
73
71
|
const { localize } = useIntl();
|
|
74
72
|
const translated = useMemo(() => ({
|
|
75
73
|
account: localize({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserInfo.js","sources":["../../../../../src/components/AppHeader/components/mobile/UserInfo.tsx"],"sourcesContent":["import { type FC, memo, useCallback, useMemo, useState } from 'react'\nimport { tv } from 'tailwind-variants'\n\nimport { useIntl } from '../../../../intl'\nimport { Button } from '../../../Button'\nimport { Dialog } from '../../../Dialog'\nimport { Dropdown, DropdownContent, DropdownTrigger } from '../../../Dropdown'\nimport { FaGearIcon, FaGlobeIcon, FaUserLargeIcon } from '../../../Icon'\nimport {
|
|
1
|
+
{"version":3,"file":"UserInfo.js","sources":["../../../../../src/components/AppHeader/components/mobile/UserInfo.tsx"],"sourcesContent":["import { type FC, memo, useCallback, useMemo, useState } from 'react'\nimport { tv } from 'tailwind-variants'\n\nimport { useIntl } from '../../../../intl'\nimport { Button } from '../../../Button'\nimport { Dialog } from '../../../Dialog'\nimport { Dropdown, DropdownContent, DropdownTrigger } from '../../../Dropdown'\nimport { FaGearIcon, FaGlobeIcon, FaUserLargeIcon } from '../../../Icon'\nimport { buildDisplayName } from '../../utils'\nimport { CommonButton } from '../common/CommonButton'\nimport { Translate } from '../common/Translate'\n\nimport { LanguageSelector } from './LanguageSelector'\n\nimport type { HeaderProps, UserInfoProps } from '../../types'\n\nconst classNameGenerator = tv({\n slots: {\n iconButton: ['[&&&]:shr-border-transparent [&&]:shr-p-0.25'],\n iconButtonInner: [\n 'shr-border-shorthand shr-block shr-flex shr-items-center shr-justify-center shr-rounded-full shr-bg-white shr-p-0.25',\n ],\n dropdownUserName: ['shr-box-border shr-min-w-[246px] shr-px-1 shr-py-0.75 shr-text-sm'],\n dropdownButtonArea: ['shr-border-t-shorthand shr-p-0.5'],\n },\n})\n\ntype Props = UserInfoProps & Pick<HeaderProps, 'locale'>\n\nexport const UserInfo = memo<Props>(\n ({ arbitraryDisplayName, email, empCode, firstName, lastName, accountUrl, locale }) => {\n const displayName = useMemo(\n () =>\n arbitraryDisplayName ??\n buildDisplayName({\n email,\n empCode,\n firstName,\n lastName,\n }),\n [arbitraryDisplayName, email, empCode, firstName, lastName],\n )\n\n return displayName ? (\n <ActualUserInfo accountUrl={accountUrl} displayName={displayName} locale={locale} />\n ) : null\n },\n)\n\nconst ActualUserInfo: FC<Pick<Props, 'accountUrl' | 'locale'> & { displayName: string }> = ({\n displayName,\n accountUrl,\n locale,\n}) => {\n const [languageDialogOpen, setLanguageDialogOpen] = useState(false)\n\n const dialogOpen = useCallback(() => setLanguageDialogOpen(true), [])\n const dialogClose = useCallback(() => setLanguageDialogOpen(false), [])\n\n const { localize } = useIntl()\n const translated = useMemo(\n () => ({\n account: localize({\n id: 'smarthr-ui/AppHeader/MobileHeader/account',\n defaultText: 'アカウント',\n }),\n userSetting: localize({\n id: 'smarthr-ui/AppHeader/userSettings',\n defaultText: '個人設定',\n }),\n }),\n [localize],\n )\n\n const classNames = useMemo(() => {\n const { iconButton, iconButtonInner, dropdownUserName, dropdownButtonArea } =\n classNameGenerator()\n\n return {\n iconButton: iconButton(),\n iconButtonInner: iconButtonInner(),\n dropdownUserName: dropdownUserName(),\n dropdownButtonArea: dropdownButtonArea(),\n }\n }, [])\n\n return (\n <>\n <Dropdown>\n <DropdownTrigger>\n <Button variant=\"skeleton\" size=\"s\" className={classNames.iconButton}>\n <span className={classNames.iconButtonInner}>\n <FaUserLargeIcon alt={translated.account} className=\"shr-fill-grey\" />\n </span>\n </Button>\n </DropdownTrigger>\n\n <DropdownContent>\n <div className={classNames.dropdownUserName}>\n <p>{displayName}</p>\n </div>\n\n {(locale || accountUrl) && (\n <div className={classNames.dropdownButtonArea}>\n {locale && (\n <CommonButton\n elementAs=\"button\"\n type=\"button\"\n onClick={dialogOpen}\n prefix={<FaGlobeIcon />}\n >\n Language\n </CommonButton>\n )}\n\n {accountUrl && (\n <CommonButton\n elementAs=\"a\"\n href={accountUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n prefix={<FaGearIcon />}\n >\n <Translate>{translated.userSetting}</Translate>\n </CommonButton>\n )}\n </div>\n )}\n </DropdownContent>\n </Dropdown>\n\n {locale && (\n <Dialog isOpen={languageDialogOpen} onClickOverlay={dialogClose} width={246}>\n <LanguageSelector locale={locale} onClickClose={dialogClose} />\n </Dialog>\n )}\n </>\n )\n}\n"],"names":["tv","_jsx","_jsxs","_Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAM,kBAAkB,GAAGA,EAAE,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C,kBAAkB,aAC1C,MAAM,KACLD,GAAA,CAAC,YAAY,IACX,SAAS,EAAC,QAAQ,EAClB,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,UAAU,EACnB,MAAM,EAAEA,GAAA,CAAC,WAAW,KAAG,EAAA,QAAA,EAAA,UAAA,EAAA,CAGV,CAChB,EAEA,UAAU,KACTA,GAAA,CAAC,YAAY,IACX,SAAS,EAAC,GAAG,EACb,IAAI,EAAE,UAAU,EAChB,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,qBAAqB,EACzB,MAAM,EAAEA,GAAA,CAAC,UAAU,EAAA,EAAA,CAAG,EAAA,QAAA,EAEtBA,IAAC,SAAS,EAAA,EAAA,QAAA,EAAE,UAAU,CAAC,WAAW,EAAA,CAAa,EAAA,CAClC,CAChB,CAAA,EAAA,CACG,CACP,IACe,CAAA,EAAA,CACT,EAEV,MAAM,KACLA,IAAC,MAAM,EAAA,EAAC,MAAM,EAAE,kBAAkB,EAAE,cAAc,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,YACzEA,GAAA,CAAC,gBAAgB,IAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAA,CAAI,GACxD,CACV,CAAA,EAAA,CACA;AAEP,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"args.js","sources":["../../../../src/components/AppHeader/stories/args.tsx"],"sourcesContent":["import { action } from 'storybook/actions'\n\nimport type { AppHeader } from '../AppHeader'\nimport type { ComponentProps, FC, PropsWithChildren } from 'react'\n\nconst CustomLink: FC<PropsWithChildren<{ to: string; className?: string }>> = (props) => (\n <a {...props} href={props.to} className={props.className ?? ''}>\n {props.children}\n </a>\n)\n\nconst AdditionalContent: FC<PropsWithChildren> = ({ children }) => (\n <div style={{ background: 'rgb(242 242 242)', padding: '4px 8px' }}>{children}</div>\n)\n\nconst buildFeature = (index: number, name: string, favorite: boolean, position?: number) => ({\n id: `feature-${index}`,\n url: 'https://example.com',\n name,\n favorite,\n position: position ?? null,\n})\n\nexport const args: ComponentProps<typeof AppHeader> = {\n children: <AdditionalContent>children</AdditionalContent>,\n appName: '勤怠管理',\n tenants: [\n {\n id: 'tenant-1',\n name: '株式会社テストテナント壱',\n },\n {\n id: 'tenant-2',\n name: '株式会社テストテナント弐',\n },\n ],\n currentTenantId: 'tenant-1',\n onTenantSelect: action('テナント選択'),\n schoolUrl: 'https://example.com',\n helpPageUrl: 'https://example.com',\n locale: {\n
|
|
1
|
+
{"version":3,"file":"args.js","sources":["../../../../src/components/AppHeader/stories/args.tsx"],"sourcesContent":["import { action } from 'storybook/actions'\n\nimport type { AppHeader } from '../AppHeader'\nimport type { ComponentProps, FC, PropsWithChildren } from 'react'\n\nconst CustomLink: FC<PropsWithChildren<{ to: string; className?: string }>> = (props) => (\n <a {...props} href={props.to} className={props.className ?? ''}>\n {props.children}\n </a>\n)\n\nconst AdditionalContent: FC<PropsWithChildren> = ({ children }) => (\n <div style={{ background: 'rgb(242 242 242)', padding: '4px 8px' }}>{children}</div>\n)\n\nconst buildFeature = (index: number, name: string, favorite: boolean, position?: number) => ({\n id: `feature-${index}`,\n url: 'https://example.com',\n name,\n favorite,\n position: position ?? null,\n})\n\nexport const args: ComponentProps<typeof AppHeader> = {\n children: <AdditionalContent>children</AdditionalContent>,\n appName: '勤怠管理',\n tenants: [\n {\n id: 'tenant-1',\n name: '株式会社テストテナント壱',\n },\n {\n id: 'tenant-2',\n name: '株式会社テストテナント弐',\n },\n ],\n currentTenantId: 'tenant-1',\n onTenantSelect: action('テナント選択'),\n schoolUrl: 'https://example.com',\n helpPageUrl: 'https://example.com',\n locale: {\n onSelectLocale: action('locale'),\n },\n userInfo: {\n email: 'smarthr@example.com',\n empCode: '001',\n firstName: '須磨',\n lastName: '栄子',\n accountUrl: 'https://example.com',\n },\n desktopAdditionalContent: <AdditionalContent>desktopAdditionalContent</AdditionalContent>,\n navigations: [\n {\n children: 'aタグ',\n href: 'https://example.com',\n },\n {\n children: 'カスタムタグ',\n elementAs: CustomLink,\n to: 'https://example.com',\n },\n {\n children: 'ボタン',\n onClick: action('AppNavボタンクリック'),\n },\n {\n children: 'ドロップダウン',\n childNavigations: [\n {\n children: 'aタグ',\n href: 'https://example.com',\n },\n {\n children: 'カスタムタグ',\n elementAs: CustomLink,\n to: 'https://example.com',\n },\n {\n children: 'ボタン',\n onClick: action('ボタンクリック'),\n },\n ],\n },\n {\n children: 'グループ',\n childNavigations: [\n {\n title: 'グループ1',\n childNavigations: [\n {\n children: 'グループ1_アイテム1',\n href: 'https://example.com',\n current: true,\n },\n {\n children: 'グループ1_アイテム2',\n href: 'https://example.com',\n },\n ],\n },\n {\n title: 'グループ2',\n childNavigations: [\n {\n children: 'グループ2_アイテム1',\n href: 'https://example.com',\n },\n {\n children: 'グループ2_アイテム2',\n href: 'https://example.com',\n },\n ],\n },\n ],\n },\n ],\n desktopNavigationAdditionalContent: (\n <AdditionalContent>desktopNavigationAdditionalContent</AdditionalContent>\n ),\n releaseNote: {\n links: [\n {\n title: 'リリースノート1',\n url: 'https://example.com',\n },\n {\n title: 'リリースノート2',\n url: 'https://example.com',\n },\n {\n title: 'リリースノート3',\n url: 'https://example.com',\n },\n ],\n indexUrl: 'https://example.com',\n },\n features: [\n buildFeature(1, '従業員リスト', false),\n buildFeature(2, '共通設定', true, 4),\n buildFeature(3, 'お知らせ管理', true, 3),\n buildFeature(4, '給与明細', true, 1),\n buildFeature(5, '申請', false),\n buildFeature(6, '給与明細管理', false),\n buildFeature(7, 'マイナンバー管理', false),\n buildFeature(8, '源泉徴収票管理', false),\n buildFeature(9, '手続き', false),\n buildFeature(10, '手続きToDo', false),\n buildFeature(11, '文書配付', false),\n buildFeature(12, 'IdP', true, 2),\n ],\n mobileAdditionalContent: <AdditionalContent>mobileAdditionalContent</AdditionalContent>,\n}\n"],"names":["_jsx","action"],"mappings":";;;AAKA,MAAM,UAAU,GAA8D,CAAC,KAAK,MAClFA,GAAA,CAAA,GAAA,EAAA,E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K,CAAC;AAChC,QAAA,YAAY,CAAC,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC;AAClC,QAAA,YAAY,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC;AACjC,QAAA,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC;AAC7B,QAAA,YAAY,CAAC,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC;AAClC,QAAA,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC;QAC/B,YAAY,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AACjC,KAAA;IACD,uBAAuB,EAAEA,GAAA,CAAC,iBAAiB,EAAA,EAAA,QAAA,EAAA,yBAAA,EAAA,CAA4C;;;;;"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
import type { Locale } from '../../intl/localeMap';
|
|
1
2
|
import type { Header } from '../Header';
|
|
2
3
|
import type { ComponentProps, ComponentType, MouseEvent, ReactElement, ReactNode } from 'react';
|
|
3
|
-
type Locale = 'ja' | 'en-us' | 'id-id' | 'pt' | 'vi' | 'ko' | 'zh-cn' | 'zh-tw';
|
|
4
4
|
export type LocaleProps = {
|
|
5
|
-
selectedLocale: Locale;
|
|
6
5
|
onSelectLocale: (locale: Locale) => void;
|
|
7
6
|
};
|
|
8
7
|
export type UserInfoProps = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { memo, useMemo, useRef, useState, useCallback, useImperativeHandle, useEffect, useId } from 'react';
|
|
4
|
-
import innerText from '../../../_virtual/
|
|
4
|
+
import innerText from '../../../_virtual/index3.js';
|
|
5
5
|
import { tv as ce } from './../../../vendor/.pnpm/tailwind-variants@0.3.1_tailwindcss@3.4.17_ts-node@10.9.2_@swc_core@1.13.2_@types_node@20.19.9_typescript@5.8.3__/vendor/tailwind-variants/dist/index.js';
|
|
6
6
|
import { useOuterClick } from '../../../hooks/useOuterClick.js';
|
|
7
7
|
import '../../../intl/IntlProvider.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { useRef, useState, useImperativeHandle, useCallback, useMemo, useEffect } from 'react';
|
|
4
|
-
import innerText from '../../../_virtual/
|
|
4
|
+
import innerText from '../../../_virtual/index3.js';
|
|
5
5
|
import { tv as ce } from './../../../vendor/.pnpm/tailwind-variants@0.3.1_tailwindcss@3.4.17_ts-node@10.9.2_@swc_core@1.13.2_@types_node@20.19.9_typescript@5.8.3__/vendor/tailwind-variants/dist/index.js';
|
|
6
6
|
import { useClick } from '../../../hooks/useClick.js';
|
|
7
7
|
import { useDecorators } from '../../../hooks/useDecorators.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback, useId, useMemo } from 'react';
|
|
2
|
-
import innerText from '../../_virtual/
|
|
2
|
+
import innerText from '../../_virtual/index3.js';
|
|
3
3
|
import { areItemsEqual, convertMatchableString } from './helper.js';
|
|
4
4
|
|
|
5
5
|
const defaultIsItemSelected = (targetItem, selectedItems) => selectedItems.some((item) => areItemsEqual(item, targetItem));
|
|
@@ -86,7 +86,7 @@ const StepFormDialogContentInner = ({ children, title, titleId, subtitle, titleT
|
|
|
86
86
|
}), [localize]);
|
|
87
87
|
const decorated = useDecorators(decoratorDefaultTexts, decorators);
|
|
88
88
|
const actionText = activeStep === stepLength ? submitLabel : decorated.nextButtonLabel;
|
|
89
|
-
const stepText = `(${activeStep}/${stepLength}
|
|
89
|
+
const stepText = stepLength > 1 ? `(${activeStep}/${stepLength})` : '';
|
|
90
90
|
const calcedResponseStatus = useResponseStatus(responseStatus);
|
|
91
91
|
return (
|
|
92
92
|
// eslint-disable-next-line smarthr/a11y-heading-in-sectioning-content, smarthr/a11y-prohibit-sectioning-content-in-form
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepFormDialogContentInner.js","sources":["../../../../src/components/Dialog/StepFormDialog/StepFormDialogContentInner.tsx"],"sourcesContent":["'use client'\n\nimport {\n type FC,\n type FormEvent,\n type PropsWithChildren,\n type ReactNode,\n useCallback,\n useContext,\n useMemo,\n} from 'react'\n\nimport { type DecoratorsType, useDecorators } from '../../../hooks/useDecorators'\nimport { type ResponseStatus, useResponseStatus } from '../../../hooks/useResponseStatus'\nimport { useIntl } from '../../../intl'\nimport { Button } from '../../Button'\nimport { Cluster, Stack } from '../../Layout'\nimport { Section } from '../../SectioningContent'\nimport { DialogBody, type Props as DialogBodyProps } from '../DialogBody'\nimport { DialogContentResponseStatusMessage } from '../DialogContentResponseStatusMessage'\nimport { DialogHeader, type Props as DialogHeaderProps } from '../DialogHeader'\nimport { dialogContentInner } from '../dialogInnerStyle'\n\nimport { StepFormDialogContext, type StepItem } from './StepFormDialogProvider'\n\nexport type BaseProps = PropsWithChildren<\n DialogHeaderProps &\n DialogBodyProps & {\n /** アクションボタンのラベル */\n submitLabel: ReactNode\n /** アクションボタンのスタイル */\n actionTheme?: 'primary' | 'secondary' | 'danger'\n /**\n * アクションボタンをクリックした時に発火するコールバック関数\n * @param closeDialog ダイアログを閉じる関数\n * @param currentStep onSubmitが発火した時のステップ\n * @returns 次のステップに遷移する場合は次のステップ、遷移しない場合はundefined\n */\n onSubmit: (\n closeDialog: () => void,\n e: FormEvent<HTMLFormElement>,\n currentStep: StepItem,\n ) => StepItem | undefined\n /** アクションボタンを無効にするかどうか */\n actionDisabled?: boolean\n /** 閉じるボタンを無効にするかどうか */\n closeDisabled?: boolean\n /** コンポーネント内の文言を変更するための関数を設定 */\n decorators?: DecoratorsType<DecoratorKeyTypes>\n }\n>\n\nexport type StepFormDialogContentInnerProps = BaseProps & {\n firstStep: StepItem\n onClickClose: () => void\n responseStatus?: ResponseStatus\n /** ステップの総数 */\n stepLength: number\n onClickBack?: () => void\n}\n\ntype DecoratorKeyTypes = 'closeButtonLabel' | 'nextButtonLabel' | 'backButtonLabel'\n\nconst BUTTON_COLUMN_GAP = {\n row: 0.5,\n column: 1,\n} as const\n\nexport const StepFormDialogContentInner: FC<StepFormDialogContentInnerProps> = ({\n children,\n title,\n titleId,\n subtitle,\n titleTag,\n contentBgColor,\n contentPadding,\n submitLabel,\n actionTheme = 'primary',\n stepLength,\n firstStep,\n onSubmit,\n onClickClose,\n responseStatus,\n actionDisabled,\n closeDisabled,\n decorators,\n onClickBack,\n}) => {\n const { localize } = useIntl()\n const { currentStep, stepQueue, setCurrentStep, scrollerRef } = useContext(StepFormDialogContext)\n const activeStep = useMemo(() => currentStep?.stepNumber ?? 1, [currentStep])\n\n const handleCloseAction = useCallback(() => {\n onClickClose()\n setTimeout(() => {\n // HINT: ダイアログが閉じるtransitionが完了してから初期化をしている\n stepQueue.current = []\n setCurrentStep(firstStep)\n }, 300)\n }, [firstStep, stepQueue, setCurrentStep, onClickClose])\n\n const changeCurrentStep = useCallback(\n (step: Parameters<typeof setCurrentStep>[0]) => {\n setCurrentStep(step)\n\n // HINT: stepが切り替わるごとにbodyのscroll位置を先頭に戻す処理\n if (scrollerRef.current) {\n scrollerRef.current.scroll(0, 0)\n }\n },\n [setCurrentStep, scrollerRef],\n )\n\n const handleSubmitAction = useCallback(\n (e: FormEvent<HTMLFormElement>) => {\n e.preventDefault()\n // HINT: React Potals などで擬似的にformがネストしている場合など、stopPropagationを実行しないと\n // 親formが意図せずsubmitされてしまう場合がある\n e.stopPropagation()\n\n const next = onSubmit(handleCloseAction, e, currentStep)\n\n if (next) {\n stepQueue.current.push(currentStep)\n changeCurrentStep(next)\n }\n },\n [currentStep, stepQueue, onSubmit, handleCloseAction, changeCurrentStep],\n )\n const handleBackAction = useCallback(() => {\n onClickBack?.()\n\n changeCurrentStep(stepQueue.current.pop() ?? firstStep)\n }, [firstStep, stepQueue, onClickBack, changeCurrentStep])\n\n const classNames = useMemo(() => {\n const { wrapper, actionArea, buttonArea, message } = dialogContentInner()\n\n return {\n wrapper: wrapper(),\n actionArea: actionArea(),\n buttonArea: buttonArea(),\n message: message(),\n }\n }, [])\n\n const decoratorDefaultTexts = useMemo(\n () => ({\n closeButtonLabel: localize({\n id: 'smarthr-ui/StepFormDialog/closeButtonLabel',\n defaultText: 'キャンセル',\n }),\n nextButtonLabel: localize({\n id: 'smarthr-ui/StepFormDialog/nextButtonLabel',\n defaultText: '次へ',\n }),\n backButtonLabel: localize({\n id: 'smarthr-ui/StepFormDialog/backButtonLabel',\n defaultText: '戻る',\n }),\n }),\n [localize],\n )\n\n const decorated = useDecorators<DecoratorKeyTypes>(decoratorDefaultTexts, decorators)\n const actionText = activeStep === stepLength ? submitLabel : decorated.nextButtonLabel\n const stepText = `(${activeStep}/${stepLength}
|
|
1
|
+
{"version":3,"file":"StepFormDialogContentInner.js","sources":["../../../../src/components/Dialog/StepFormDialog/StepFormDialogContentInner.tsx"],"sourcesContent":["'use client'\n\nimport {\n type FC,\n type FormEvent,\n type PropsWithChildren,\n type ReactNode,\n useCallback,\n useContext,\n useMemo,\n} from 'react'\n\nimport { type DecoratorsType, useDecorators } from '../../../hooks/useDecorators'\nimport { type ResponseStatus, useResponseStatus } from '../../../hooks/useResponseStatus'\nimport { useIntl } from '../../../intl'\nimport { Button } from '../../Button'\nimport { Cluster, Stack } from '../../Layout'\nimport { Section } from '../../SectioningContent'\nimport { DialogBody, type Props as DialogBodyProps } from '../DialogBody'\nimport { DialogContentResponseStatusMessage } from '../DialogContentResponseStatusMessage'\nimport { DialogHeader, type Props as DialogHeaderProps } from '../DialogHeader'\nimport { dialogContentInner } from '../dialogInnerStyle'\n\nimport { StepFormDialogContext, type StepItem } from './StepFormDialogProvider'\n\nexport type BaseProps = PropsWithChildren<\n DialogHeaderProps &\n DialogBodyProps & {\n /** アクションボタンのラベル */\n submitLabel: ReactNode\n /** アクションボタンのスタイル */\n actionTheme?: 'primary' | 'secondary' | 'danger'\n /**\n * アクションボタンをクリックした時に発火するコールバック関数\n * @param closeDialog ダイアログを閉じる関数\n * @param currentStep onSubmitが発火した時のステップ\n * @returns 次のステップに遷移する場合は次のステップ、遷移しない場合はundefined\n */\n onSubmit: (\n closeDialog: () => void,\n e: FormEvent<HTMLFormElement>,\n currentStep: StepItem,\n ) => StepItem | undefined\n /** アクションボタンを無効にするかどうか */\n actionDisabled?: boolean\n /** 閉じるボタンを無効にするかどうか */\n closeDisabled?: boolean\n /** コンポーネント内の文言を変更するための関数を設定 */\n decorators?: DecoratorsType<DecoratorKeyTypes>\n }\n>\n\nexport type StepFormDialogContentInnerProps = BaseProps & {\n firstStep: StepItem\n onClickClose: () => void\n responseStatus?: ResponseStatus\n /** ステップの総数 */\n stepLength: number\n onClickBack?: () => void\n}\n\ntype DecoratorKeyTypes = 'closeButtonLabel' | 'nextButtonLabel' | 'backButtonLabel'\n\nconst BUTTON_COLUMN_GAP = {\n row: 0.5,\n column: 1,\n} as const\n\nexport const StepFormDialogContentInner: FC<StepFormDialogContentInnerProps> = ({\n children,\n title,\n titleId,\n subtitle,\n titleTag,\n contentBgColor,\n contentPadding,\n submitLabel,\n actionTheme = 'primary',\n stepLength,\n firstStep,\n onSubmit,\n onClickClose,\n responseStatus,\n actionDisabled,\n closeDisabled,\n decorators,\n onClickBack,\n}) => {\n const { localize } = useIntl()\n const { currentStep, stepQueue, setCurrentStep, scrollerRef } = useContext(StepFormDialogContext)\n const activeStep = useMemo(() => currentStep?.stepNumber ?? 1, [currentStep])\n\n const handleCloseAction = useCallback(() => {\n onClickClose()\n setTimeout(() => {\n // HINT: ダイアログが閉じるtransitionが完了してから初期化をしている\n stepQueue.current = []\n setCurrentStep(firstStep)\n }, 300)\n }, [firstStep, stepQueue, setCurrentStep, onClickClose])\n\n const changeCurrentStep = useCallback(\n (step: Parameters<typeof setCurrentStep>[0]) => {\n setCurrentStep(step)\n\n // HINT: stepが切り替わるごとにbodyのscroll位置を先頭に戻す処理\n if (scrollerRef.current) {\n scrollerRef.current.scroll(0, 0)\n }\n },\n [setCurrentStep, scrollerRef],\n )\n\n const handleSubmitAction = useCallback(\n (e: FormEvent<HTMLFormElement>) => {\n e.preventDefault()\n // HINT: React Potals などで擬似的にformがネストしている場合など、stopPropagationを実行しないと\n // 親formが意図せずsubmitされてしまう場合がある\n e.stopPropagation()\n\n const next = onSubmit(handleCloseAction, e, currentStep)\n\n if (next) {\n stepQueue.current.push(currentStep)\n changeCurrentStep(next)\n }\n },\n [currentStep, stepQueue, onSubmit, handleCloseAction, changeCurrentStep],\n )\n const handleBackAction = useCallback(() => {\n onClickBack?.()\n\n changeCurrentStep(stepQueue.current.pop() ?? firstStep)\n }, [firstStep, stepQueue, onClickBack, changeCurrentStep])\n\n const classNames = useMemo(() => {\n const { wrapper, actionArea, buttonArea, message } = dialogContentInner()\n\n return {\n wrapper: wrapper(),\n actionArea: actionArea(),\n buttonArea: buttonArea(),\n message: message(),\n }\n }, [])\n\n const decoratorDefaultTexts = useMemo(\n () => ({\n closeButtonLabel: localize({\n id: 'smarthr-ui/StepFormDialog/closeButtonLabel',\n defaultText: 'キャンセル',\n }),\n nextButtonLabel: localize({\n id: 'smarthr-ui/StepFormDialog/nextButtonLabel',\n defaultText: '次へ',\n }),\n backButtonLabel: localize({\n id: 'smarthr-ui/StepFormDialog/backButtonLabel',\n defaultText: '戻る',\n }),\n }),\n [localize],\n )\n\n const decorated = useDecorators<DecoratorKeyTypes>(decoratorDefaultTexts, decorators)\n const actionText = activeStep === stepLength ? submitLabel : decorated.nextButtonLabel\n const stepText = stepLength > 1 ? `(${activeStep}/${stepLength})` : ''\n\n const calcedResponseStatus = useResponseStatus(responseStatus)\n\n return (\n // eslint-disable-next-line smarthr/a11y-heading-in-sectioning-content, smarthr/a11y-prohibit-sectioning-content-in-form\n <Section>\n <form onSubmit={handleSubmitAction}>\n <div className={classNames.wrapper}>\n <DialogHeader\n title={subtitle ? title : `${title}${stepText}`}\n subtitle={subtitle ? `${subtitle}${stepText}` : undefined}\n titleTag={titleTag}\n titleId={titleId}\n />\n <DialogBody\n contentPadding={contentPadding}\n contentBgColor={contentBgColor}\n ref={scrollerRef}\n >\n {children}\n </DialogBody>\n <Stack gap={0.5} className={classNames.actionArea}>\n <Cluster justify=\"space-between\" gap={{ row: 0.5, column: 2 }}>\n {activeStep > 1 && (\n <Button\n onClick={handleBackAction}\n disabled={calcedResponseStatus.isProcessing}\n className=\"smarthr-ui-Dialog-backButton\"\n >\n {decorated.backButtonLabel}\n </Button>\n )}\n <Cluster gap={BUTTON_COLUMN_GAP} className={classNames.buttonArea}>\n <Button\n onClick={handleCloseAction}\n disabled={closeDisabled || calcedResponseStatus.isProcessing}\n className=\"smarthr-ui-Dialog-closeButton\"\n >\n {decorated.closeButtonLabel}\n </Button>\n <Button\n type=\"submit\"\n variant={actionTheme}\n disabled={actionDisabled}\n loading={calcedResponseStatus.isProcessing}\n className=\"smarthr-ui-Dialog-actionButton\"\n >\n {actionText}\n </Button>\n </Cluster>\n </Cluster>\n <DialogContentResponseStatusMessage\n responseStatus={calcedResponseStatus}\n className={classNames.message}\n />\n </Stack>\n </div>\n </form>\n </Section>\n )\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA+DA;AACE;AACA;;;AAuBA;AACA;AACA;AAEA;AACE;;;AAGE;;;;AAKJ;;;AAKI;;;AAGF;AAIF;;;;;;;AAUM;;;AAGJ;AAGF;;;;AAMA;AACE;;;;;;;;AAUF;;AAGM;AACA;;;AAGA;AACA;;;AAGA;AACA;;AAEH;;AAKH;AACA;AAEA;;;;AA2DF;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { memo, useContext, useMemo, useRef, Children, isValidElement, Fragment, cloneElement } from 'react';
|
|
4
|
-
import innerText from '../../../_virtual/
|
|
4
|
+
import innerText from '../../../_virtual/index3.js';
|
|
5
5
|
import { tv as ce } from './../../../vendor/.pnpm/tailwind-variants@0.3.1_tailwindcss@3.4.17_ts-node@10.9.2_@swc_core@1.13.2_@types_node@20.19.9_typescript@5.8.3__/vendor/tailwind-variants/dist/index.js';
|
|
6
6
|
import { DropdownContext, Dropdown } from '../Dropdown.js';
|
|
7
7
|
import { DropdownTrigger } from '../DropdownTrigger.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
|
-
import innerText from '../../../_virtual/
|
|
4
|
+
import innerText from '../../../_virtual/index3.js';
|
|
5
5
|
import { tv as ce } from './../../../vendor/.pnpm/tailwind-variants@0.3.1_tailwindcss@3.4.17_ts-node@10.9.2_@swc_core@1.13.2_@types_node@20.19.9_typescript@5.8.3__/vendor/tailwind-variants/dist/index.js';
|
|
6
6
|
import { useDecorators } from '../../../hooks/useDecorators.js';
|
|
7
7
|
import { useResponseStatus } from '../../../hooks/useResponseStatus.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { memo, useMemo, useId, useRef, Fragment as Fragment$1, createElement, useEffect } from 'react';
|
|
3
3
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
4
|
-
import innerText from '../../_virtual/
|
|
4
|
+
import innerText from '../../_virtual/index3.js';
|
|
5
5
|
import { tv as ce } from './../../vendor/.pnpm/tailwind-variants@0.3.1_tailwindcss@3.4.17_ts-node@10.9.2_@swc_core@1.13.2_@types_node@20.19.9_typescript@5.8.3__/vendor/tailwind-variants/dist/index.js';
|
|
6
6
|
import { FaCircleExclamationIcon } from '../Icon/Icon.js';
|
|
7
7
|
import '../Icon/generateIcon.js';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type FC, type HTMLAttributes } from 'react';
|
|
2
2
|
import { type VariantProps } from 'tailwind-variants';
|
|
3
3
|
import { type DecoratorsType } from '../../../hooks/useDecorators';
|
|
4
|
-
import type {
|
|
4
|
+
import type { Locale } from '../../../intl/localeMap';
|
|
5
5
|
export type Props = {
|
|
6
6
|
narrow?: boolean;
|
|
7
|
-
localeMap:
|
|
7
|
+
localeMap: Partial<Record<Locale, string>>;
|
|
8
8
|
locale?: string;
|
|
9
9
|
defaultLocale?: string;
|
|
10
10
|
/** コンポーネント内の文言を変更するための関数を設定 */
|