smarthr-ui 75.3.1 → 75.3.2
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/components/FormControl/FormControl.js +13 -7
- package/esm/components/FormControl/FormControl.js.map +1 -1
- package/esm/components/VisuallyHiddenText/VisuallyHiddenText.js +1 -1
- package/esm/components/VisuallyHiddenText/VisuallyHiddenText.js.map +1 -1
- package/esm/intl/locales/en_us.d.ts +71 -71
- package/esm/intl/locales/en_us.js +71 -71
- package/esm/intl/locales/en_us.js.map +1 -1
- package/esm/intl/locales/ko_kr.d.ts +60 -60
- package/esm/intl/locales/ko_kr.js +60 -60
- package/esm/intl/locales/ko_kr.js.map +1 -1
- package/esm/intl/locales/vi_vn.d.ts +70 -70
- package/esm/intl/locales/vi_vn.js +70 -70
- package/esm/intl/locales/vi_vn.js.map +1 -1
- package/esm/intl/locales/zh_hans_cn.d.ts +77 -77
- package/esm/intl/locales/zh_hans_cn.js +77 -77
- package/esm/intl/locales/zh_hans_cn.js.map +1 -1
- package/esm/intl/locales/zh_hant_tw.d.ts +73 -73
- package/esm/intl/locales/zh_hant_tw.js +73 -73
- package/esm/intl/locales/zh_hant_tw.js.map +1 -1
- package/lib/components/FormControl/FormControl.js +13 -7
- package/lib/components/FormControl/FormControl.js.map +1 -1
- package/lib/components/VisuallyHiddenText/VisuallyHiddenText.js +1 -1
- package/lib/components/VisuallyHiddenText/VisuallyHiddenText.js.map +1 -1
- package/lib/intl/locales/en_us.d.ts +71 -71
- package/lib/intl/locales/en_us.js +71 -71
- package/lib/intl/locales/en_us.js.map +1 -1
- package/lib/intl/locales/ko_kr.d.ts +60 -60
- package/lib/intl/locales/ko_kr.js +60 -60
- package/lib/intl/locales/ko_kr.js.map +1 -1
- package/lib/intl/locales/vi_vn.d.ts +70 -70
- package/lib/intl/locales/vi_vn.js +70 -70
- package/lib/intl/locales/vi_vn.js.map +1 -1
- package/lib/intl/locales/zh_hans_cn.d.ts +77 -77
- package/lib/intl/locales/zh_hans_cn.js +77 -77
- package/lib/intl/locales/zh_hans_cn.js.map +1 -1
- package/lib/intl/locales/zh_hant_tw.d.ts +73 -73
- package/lib/intl/locales/zh_hant_tw.js +73 -73
- package/lib/intl/locales/zh_hant_tw.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,102 +3,102 @@
|
|
|
3
3
|
const locale = {
|
|
4
4
|
'smarthr-ui/common/language': '繁體中文',
|
|
5
5
|
'smarthr-ui/ActionDialog/closeButtonLabel': '取消',
|
|
6
|
-
'smarthr-ui/AppHeader/school': '
|
|
6
|
+
'smarthr-ui/AppHeader/school': 'SmartHR學習平台',
|
|
7
7
|
'smarthr-ui/AppHeader/help': '幫助',
|
|
8
8
|
'smarthr-ui/AppHeader/userSettings': '個人設定',
|
|
9
|
-
'smarthr-ui/AppHeader/releaseNotes': '
|
|
10
|
-
'smarthr-ui/AppHeader/releaseNotesLoadError': '
|
|
11
|
-
'smarthr-ui/AppHeader/seeAllReleaseNotes': '
|
|
12
|
-
'smarthr-ui/AppHeader/DesktopHeader/appLauncherLabel': '
|
|
13
|
-
'smarthr-ui/AppHeader/MobileHeader/account': '
|
|
14
|
-
'smarthr-ui/AppHeader/MobileHeader/openMenu': '
|
|
9
|
+
'smarthr-ui/AppHeader/releaseNotes': '版本更新說明',
|
|
10
|
+
'smarthr-ui/AppHeader/releaseNotesLoadError': '讀取版本更新說明失敗。\n請稍等片刻後再試。',
|
|
11
|
+
'smarthr-ui/AppHeader/seeAllReleaseNotes': '查看所有版本更新說明',
|
|
12
|
+
'smarthr-ui/AppHeader/DesktopHeader/appLauncherLabel': '功能',
|
|
13
|
+
'smarthr-ui/AppHeader/MobileHeader/account': '帳號',
|
|
14
|
+
'smarthr-ui/AppHeader/MobileHeader/openMenu': '打開選單',
|
|
15
15
|
'smarthr-ui/AppHeader/MobileHeader/closeMenu': '關閉選單',
|
|
16
16
|
'smarthr-ui/AppHeader/MobileHeader/allAppButton': '所有功能',
|
|
17
17
|
'smarthr-ui/AppHeader/MobileHeader/managementMenu': '管理選單',
|
|
18
|
-
'smarthr-ui/AppHeader/MobileHeader/latestReleaseNotes': '
|
|
19
|
-
'smarthr-ui/AppHeader/MobileHeader/back': '
|
|
18
|
+
'smarthr-ui/AppHeader/MobileHeader/latestReleaseNotes': '最新版本更新說明',
|
|
19
|
+
'smarthr-ui/AppHeader/MobileHeader/back': '返回',
|
|
20
20
|
'smarthr-ui/AppHeader/MobileHeader/openMenuAccordion': '展開',
|
|
21
21
|
'smarthr-ui/AppHeader/MobileHeader/closeMenuAccordion': '關閉',
|
|
22
22
|
'smarthr-ui/AppHeader/Launcher/searchInputTitle': '請輸入功能名稱。',
|
|
23
23
|
'smarthr-ui/AppHeader/Launcher/favoriteModeText': '常用功能',
|
|
24
24
|
'smarthr-ui/AppHeader/Launcher/allModeText': '所有功能',
|
|
25
|
-
'smarthr-ui/AppHeader/Launcher/listText': '
|
|
26
|
-
'smarthr-ui/AppHeader/Launcher/helpText': '',
|
|
25
|
+
'smarthr-ui/AppHeader/Launcher/listText': '功能列表',
|
|
26
|
+
'smarthr-ui/AppHeader/Launcher/helpText': '關於常用功能',
|
|
27
27
|
'smarthr-ui/AppHeader/Launcher/searchResultText': '搜尋結果',
|
|
28
|
-
'smarthr-ui/AppHeader/Launcher/emptyText': '
|
|
28
|
+
'smarthr-ui/AppHeader/Launcher/emptyText': '找不到符合條件的功能。',
|
|
29
29
|
'smarthr-ui/AppHeader/Launcher/sortDropdownLabel': '顯示排序',
|
|
30
30
|
'smarthr-ui/AppHeader/Launcher/sortDropdownSelected': '選擇中',
|
|
31
31
|
'smarthr-ui/AppHeader/Launcher/sortDropdownOrderDefault': '預設',
|
|
32
32
|
'smarthr-ui/AppHeader/Launcher/sortDropdownOrderNameAsc': '以功能名稱遞增',
|
|
33
33
|
'smarthr-ui/AppHeader/Launcher/sortDropdownOrderNameDesc': '以功能名稱遞減',
|
|
34
|
-
'smarthr-ui/AppLauncher/showAllText': '',
|
|
35
|
-
'smarthr-ui/AppLauncher/triggerLabel': '',
|
|
36
|
-
'smarthr-ui/Browser/notFoundDescription': '',
|
|
37
|
-
'smarthr-ui/Browser/notFoundTitle': '',
|
|
34
|
+
'smarthr-ui/AppLauncher/showAllText': '查看全部',
|
|
35
|
+
'smarthr-ui/AppLauncher/triggerLabel': '功能',
|
|
36
|
+
'smarthr-ui/Browser/notFoundDescription': '請嘗試其他條件。',
|
|
37
|
+
'smarthr-ui/Browser/notFoundTitle': '沒有符合條件的項目。',
|
|
38
38
|
'smarthr-ui/Button/loading': '處理中',
|
|
39
|
-
'smarthr-ui/Calendar/currentYear': '
|
|
39
|
+
'smarthr-ui/Calendar/currentYear': '目前年份',
|
|
40
40
|
'smarthr-ui/Calendar/nextMonth': '下個月',
|
|
41
41
|
'smarthr-ui/Calendar/previousMonth': '上個月',
|
|
42
42
|
'smarthr-ui/Calendar/selectYear': '選擇年份',
|
|
43
|
-
'smarthr-ui/Combobox/addItemButtonLabel': '',
|
|
44
|
-
'smarthr-ui/Combobox/loadingText': '',
|
|
45
|
-
'smarthr-ui/Combobox/noResultsText': '
|
|
46
|
-
'smarthr-ui/DropdownMenuButton/triggerActive': '',
|
|
47
|
-
'smarthr-ui/DropdownMenuButton/triggerInactive': '',
|
|
48
|
-
'smarthr-ui/DropZone/selectButtonLabel': '',
|
|
49
|
-
'smarthr-ui/FileViewer/rotateAlt': '',
|
|
50
|
-
'smarthr-ui/FileViewer/scaleDownAlt': '',
|
|
51
|
-
'smarthr-ui/FileViewer/scaleRateLabel': '',
|
|
52
|
-
'smarthr-ui/FileViewer/scaleUpAlt': '',
|
|
53
|
-
'smarthr-ui/FileViewer/unsupportedFileText': '',
|
|
54
|
-
'smarthr-ui/FilterDropdown/applyButton': '',
|
|
55
|
-
'smarthr-ui/FilterDropdown/cancelButton': '',
|
|
56
|
-
'smarthr-ui/FilterDropdown/resetButton': '',
|
|
57
|
-
'smarthr-ui/FilterDropdown/status': '',
|
|
58
|
-
'smarthr-ui/FilterDropdown/triggerButton': '',
|
|
43
|
+
'smarthr-ui/Combobox/addItemButtonLabel': '新增「{name}」',
|
|
44
|
+
'smarthr-ui/Combobox/loadingText': '處理中',
|
|
45
|
+
'smarthr-ui/Combobox/noResultsText': '沒有符合條件的選項。',
|
|
46
|
+
'smarthr-ui/DropdownMenuButton/triggerActive': '關閉選項',
|
|
47
|
+
'smarthr-ui/DropdownMenuButton/triggerInactive': '展開選項',
|
|
48
|
+
'smarthr-ui/DropZone/selectButtonLabel': '選擇檔案',
|
|
49
|
+
'smarthr-ui/FileViewer/rotateAlt': '左轉',
|
|
50
|
+
'smarthr-ui/FileViewer/scaleDownAlt': '縮小',
|
|
51
|
+
'smarthr-ui/FileViewer/scaleRateLabel': '縮放比例',
|
|
52
|
+
'smarthr-ui/FileViewer/scaleUpAlt': '放大',
|
|
53
|
+
'smarthr-ui/FileViewer/unsupportedFileText': '不支援的檔案格式。',
|
|
54
|
+
'smarthr-ui/FilterDropdown/applyButton': '套用',
|
|
55
|
+
'smarthr-ui/FilterDropdown/cancelButton': '取消',
|
|
56
|
+
'smarthr-ui/FilterDropdown/resetButton': '清除篩選條件',
|
|
57
|
+
'smarthr-ui/FilterDropdown/status': '已套用',
|
|
58
|
+
'smarthr-ui/FilterDropdown/triggerButton': '篩選',
|
|
59
59
|
'smarthr-ui/FormDialog/closeButtonLabel': '取消',
|
|
60
|
-
'smarthr-ui/InformationPanel/closeButtonLabel': '',
|
|
61
|
-
'smarthr-ui/InformationPanel/openButtonLabel': '',
|
|
62
|
-
'smarthr-ui/InputFile/destroy': '',
|
|
63
|
-
'smarthr-ui/LanguageSwitcher/checkIconAlt': '',
|
|
64
|
-
'smarthr-ui/Loader/alt': '',
|
|
65
|
-
'smarthr-ui/
|
|
66
|
-
'smarthr-ui/ModelessDialog/
|
|
67
|
-
'smarthr-ui/ModelessDialog/
|
|
68
|
-
'smarthr-ui/
|
|
69
|
-
'smarthr-ui/MultiCombobox/destroyButtonIconAltSuffix': '',
|
|
70
|
-
'smarthr-ui/MultiCombobox/selectedListAriaLabel': '',
|
|
71
|
-
'smarthr-ui/NotificationBar/closeButtonIconAlt': '',
|
|
72
|
-
'smarthr-ui/Pagination/controllerItemButtonFirstLabel': '',
|
|
73
|
-
'smarthr-ui/Pagination/controllerItemButtonLastLabel': '',
|
|
74
|
-
'smarthr-ui/Pagination/controllerItemButtonNextLabel': '',
|
|
75
|
-
'smarthr-ui/Pagination/controllerItemButtonPreviousLabel': '',
|
|
76
|
-
'smarthr-ui/Pagination/itemButtonLabel': '',
|
|
77
|
-
'smarthr-ui/Pagination/navigationLabel': '',
|
|
60
|
+
'smarthr-ui/InformationPanel/closeButtonLabel': '關閉',
|
|
61
|
+
'smarthr-ui/InformationPanel/openButtonLabel': '展開',
|
|
62
|
+
'smarthr-ui/InputFile/destroy': '刪除',
|
|
63
|
+
'smarthr-ui/LanguageSwitcher/checkIconAlt': '已選擇',
|
|
64
|
+
'smarthr-ui/Loader/alt': '處理中',
|
|
65
|
+
'smarthr-ui/MessageDialog/closeButtonLabel': '關閉',
|
|
66
|
+
'smarthr-ui/ModelessDialog/closeButtonIconAlt': '關閉',
|
|
67
|
+
'smarthr-ui/ModelessDialog/dialogHandlerAriaLabel': '對話框位置',
|
|
68
|
+
'smarthr-ui/ModelessDialog/dialogHandlerAriaValuetext': '距離上方{top}px,距離左側{left}px',
|
|
69
|
+
'smarthr-ui/MultiCombobox/destroyButtonIconAltSuffix': ':刪除',
|
|
70
|
+
'smarthr-ui/MultiCombobox/selectedListAriaLabel': '已選項目',
|
|
71
|
+
'smarthr-ui/NotificationBar/closeButtonIconAlt': '關閉',
|
|
72
|
+
'smarthr-ui/Pagination/controllerItemButtonFirstLabel': '移至最前頁',
|
|
73
|
+
'smarthr-ui/Pagination/controllerItemButtonLastLabel': '移至最後頁',
|
|
74
|
+
'smarthr-ui/Pagination/controllerItemButtonNextLabel': '下一步',
|
|
75
|
+
'smarthr-ui/Pagination/controllerItemButtonPreviousLabel': '上一步',
|
|
76
|
+
'smarthr-ui/Pagination/itemButtonLabel': '第{page}頁',
|
|
77
|
+
'smarthr-ui/Pagination/navigationLabel': '分頁',
|
|
78
78
|
'smarthr-ui/RequiredLabel/text': '必填',
|
|
79
|
-
'smarthr-ui/SearchInput/iconAlt': '',
|
|
80
|
-
'smarthr-ui/Select/blankLabel': '',
|
|
81
|
-
'smarthr-ui/SingleCombobox/destroyButtonIconAlt': '',
|
|
82
|
-
'smarthr-ui/SortDropdown/applyButtonLabel': '',
|
|
83
|
-
'smarthr-ui/SortDropdown/ascLabel': '',
|
|
84
|
-
'smarthr-ui/SortDropdown/cancelButtonLabel': '',
|
|
85
|
-
'smarthr-ui/SortDropdown/descLabel': '',
|
|
86
|
-
'smarthr-ui/SortDropdown/sortFieldLabel': '',
|
|
87
|
-
'smarthr-ui/SortDropdown/sortOrderLabel': '',
|
|
88
|
-
'smarthr-ui/StepFormDialog/backButtonLabel': '',
|
|
89
|
-
'smarthr-ui/StepFormDialog/closeButtonLabel': '',
|
|
90
|
-
'smarthr-ui/StepFormDialog/nextButtonLabel': '',
|
|
91
|
-
'smarthr-ui/StepStatusIcon/closedAlt': '',
|
|
92
|
-
'smarthr-ui/StepStatusIcon/completedAlt': '',
|
|
93
|
-
'smarthr-ui/Textarea/availableLetters': '',
|
|
94
|
-
'smarthr-ui/Textarea/maxLettersExceeded': '',
|
|
95
|
-
'smarthr-ui/Textarea/screenReaderMaxLettersDescription': '',
|
|
79
|
+
'smarthr-ui/SearchInput/iconAlt': '搜尋',
|
|
80
|
+
'smarthr-ui/Select/blankLabel': '請選擇',
|
|
81
|
+
'smarthr-ui/SingleCombobox/destroyButtonIconAlt': '刪除',
|
|
82
|
+
'smarthr-ui/SortDropdown/applyButtonLabel': '套用',
|
|
83
|
+
'smarthr-ui/SortDropdown/ascLabel': '遞增',
|
|
84
|
+
'smarthr-ui/SortDropdown/cancelButtonLabel': '取消',
|
|
85
|
+
'smarthr-ui/SortDropdown/descLabel': '遞減',
|
|
86
|
+
'smarthr-ui/SortDropdown/sortFieldLabel': '排序項目',
|
|
87
|
+
'smarthr-ui/SortDropdown/sortOrderLabel': '排序方式',
|
|
88
|
+
'smarthr-ui/StepFormDialog/backButtonLabel': '返回',
|
|
89
|
+
'smarthr-ui/StepFormDialog/closeButtonLabel': '取消',
|
|
90
|
+
'smarthr-ui/StepFormDialog/nextButtonLabel': '下一步',
|
|
91
|
+
'smarthr-ui/StepStatusIcon/closedAlt': '中斷',
|
|
92
|
+
'smarthr-ui/StepStatusIcon/completedAlt': '已完成',
|
|
93
|
+
'smarthr-ui/Textarea/availableLetters': '還可輸入{availableLetters}個字',
|
|
94
|
+
'smarthr-ui/Textarea/maxLettersExceeded': '超出{exceededLetters}個字',
|
|
95
|
+
'smarthr-ui/Textarea/screenReaderMaxLettersDescription': '最多可輸入{maxLetters}個字',
|
|
96
96
|
'smarthr-ui/TextLink/openInNewTab': '在新視窗中開啟',
|
|
97
|
-
'smarthr-ui/Th/sortDirectionAsc': '',
|
|
98
|
-
'smarthr-ui/Th/sortDirectionDesc': '',
|
|
99
|
-
'smarthr-ui/Th/sortDirectionNone': '',
|
|
100
|
-
'smarthr-ui/ThCheckbox/checkAllInvisibleLabel': '',
|
|
101
|
-
'smarthr-ui/ThCheckbox/checkColumnName': '',
|
|
97
|
+
'smarthr-ui/Th/sortDirectionAsc': '遞增',
|
|
98
|
+
'smarthr-ui/Th/sortDirectionDesc': '遞減',
|
|
99
|
+
'smarthr-ui/Th/sortDirectionNone': '無排序',
|
|
100
|
+
'smarthr-ui/ThCheckbox/checkAllInvisibleLabel': '選擇/取消所有項目',
|
|
101
|
+
'smarthr-ui/ThCheckbox/checkColumnName': '選擇',
|
|
102
102
|
};
|
|
103
103
|
|
|
104
104
|
export { locale };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zh_hant_tw.js","sources":["../../../src/intl/locales/zh_hant_tw.ts"],"sourcesContent":["import type { ja } from '.'\n\n// キーと値の間に改行が入ると翻訳システムと連携できなくなるため、prettier-ignoreしている\n// prettier-ignore\nexport const locale = {\n 'smarthr-ui/common/language': '繁體中文',\n 'smarthr-ui/ActionDialog/closeButtonLabel': '取消',\n 'smarthr-ui/AppHeader/school': '
|
|
1
|
+
{"version":3,"file":"zh_hant_tw.js","sources":["../../../src/intl/locales/zh_hant_tw.ts"],"sourcesContent":["import type { ja } from '.'\n\n// キーと値の間に改行が入ると翻訳システムと連携できなくなるため、prettier-ignoreしている\n// prettier-ignore\nexport const locale = {\n 'smarthr-ui/common/language': '繁體中文',\n 'smarthr-ui/ActionDialog/closeButtonLabel': '取消',\n 'smarthr-ui/AppHeader/school': 'SmartHR學習平台',\n 'smarthr-ui/AppHeader/help': '幫助',\n 'smarthr-ui/AppHeader/userSettings': '個人設定',\n 'smarthr-ui/AppHeader/releaseNotes': '版本更新說明',\n 'smarthr-ui/AppHeader/releaseNotesLoadError': '讀取版本更新說明失敗。\\n請稍等片刻後再試。',\n 'smarthr-ui/AppHeader/seeAllReleaseNotes': '查看所有版本更新說明',\n 'smarthr-ui/AppHeader/DesktopHeader/appLauncherLabel': '功能',\n 'smarthr-ui/AppHeader/MobileHeader/account': '帳號',\n 'smarthr-ui/AppHeader/MobileHeader/openMenu': '打開選單',\n 'smarthr-ui/AppHeader/MobileHeader/closeMenu': '關閉選單',\n 'smarthr-ui/AppHeader/MobileHeader/allAppButton': '所有功能',\n 'smarthr-ui/AppHeader/MobileHeader/managementMenu': '管理選單',\n 'smarthr-ui/AppHeader/MobileHeader/latestReleaseNotes': '最新版本更新說明',\n 'smarthr-ui/AppHeader/MobileHeader/back': '返回',\n 'smarthr-ui/AppHeader/MobileHeader/openMenuAccordion': '展開',\n 'smarthr-ui/AppHeader/MobileHeader/closeMenuAccordion': '關閉',\n 'smarthr-ui/AppHeader/Launcher/searchInputTitle': '請輸入功能名稱。',\n 'smarthr-ui/AppHeader/Launcher/favoriteModeText': '常用功能',\n 'smarthr-ui/AppHeader/Launcher/allModeText': '所有功能',\n 'smarthr-ui/AppHeader/Launcher/listText': '功能列表',\n 'smarthr-ui/AppHeader/Launcher/helpText': '關於常用功能',\n 'smarthr-ui/AppHeader/Launcher/searchResultText': '搜尋結果',\n 'smarthr-ui/AppHeader/Launcher/emptyText': '找不到符合條件的功能。',\n 'smarthr-ui/AppHeader/Launcher/sortDropdownLabel': '顯示排序',\n 'smarthr-ui/AppHeader/Launcher/sortDropdownSelected': '選擇中',\n 'smarthr-ui/AppHeader/Launcher/sortDropdownOrderDefault': '預設',\n 'smarthr-ui/AppHeader/Launcher/sortDropdownOrderNameAsc': '以功能名稱遞增',\n 'smarthr-ui/AppHeader/Launcher/sortDropdownOrderNameDesc': '以功能名稱遞減',\n 'smarthr-ui/AppLauncher/showAllText': '查看全部',\n 'smarthr-ui/AppLauncher/triggerLabel': '功能',\n 'smarthr-ui/Browser/notFoundDescription': '請嘗試其他條件。',\n 'smarthr-ui/Browser/notFoundTitle': '沒有符合條件的項目。',\n 'smarthr-ui/Button/loading': '處理中',\n 'smarthr-ui/Calendar/currentYear': '目前年份',\n 'smarthr-ui/Calendar/nextMonth': '下個月',\n 'smarthr-ui/Calendar/previousMonth': '上個月',\n 'smarthr-ui/Calendar/selectYear': '選擇年份',\n 'smarthr-ui/Combobox/addItemButtonLabel': '新增「{name}」',\n 'smarthr-ui/Combobox/loadingText': '處理中',\n 'smarthr-ui/Combobox/noResultsText': '沒有符合條件的選項。',\n 'smarthr-ui/DropdownMenuButton/triggerActive': '關閉選項',\n 'smarthr-ui/DropdownMenuButton/triggerInactive': '展開選項',\n 'smarthr-ui/DropZone/selectButtonLabel': '選擇檔案',\n 'smarthr-ui/FileViewer/rotateAlt': '左轉',\n 'smarthr-ui/FileViewer/scaleDownAlt': '縮小',\n 'smarthr-ui/FileViewer/scaleRateLabel': '縮放比例',\n 'smarthr-ui/FileViewer/scaleUpAlt': '放大',\n 'smarthr-ui/FileViewer/unsupportedFileText': '不支援的檔案格式。',\n 'smarthr-ui/FilterDropdown/applyButton': '套用',\n 'smarthr-ui/FilterDropdown/cancelButton': '取消',\n 'smarthr-ui/FilterDropdown/resetButton': '清除篩選條件',\n 'smarthr-ui/FilterDropdown/status': '已套用',\n 'smarthr-ui/FilterDropdown/triggerButton': '篩選',\n 'smarthr-ui/FormDialog/closeButtonLabel': '取消',\n 'smarthr-ui/InformationPanel/closeButtonLabel': '關閉',\n 'smarthr-ui/InformationPanel/openButtonLabel': '展開',\n 'smarthr-ui/InputFile/destroy': '刪除',\n 'smarthr-ui/LanguageSwitcher/checkIconAlt': '已選擇',\n 'smarthr-ui/Loader/alt': '處理中',\n 'smarthr-ui/MessageDialog/closeButtonLabel': '關閉',\n 'smarthr-ui/ModelessDialog/closeButtonIconAlt': '關閉',\n 'smarthr-ui/ModelessDialog/dialogHandlerAriaLabel': '對話框位置',\n 'smarthr-ui/ModelessDialog/dialogHandlerAriaValuetext': '距離上方{top}px,距離左側{left}px',\n 'smarthr-ui/MultiCombobox/destroyButtonIconAltSuffix': ':刪除',\n 'smarthr-ui/MultiCombobox/selectedListAriaLabel': '已選項目',\n 'smarthr-ui/NotificationBar/closeButtonIconAlt': '關閉',\n 'smarthr-ui/Pagination/controllerItemButtonFirstLabel': '移至最前頁',\n 'smarthr-ui/Pagination/controllerItemButtonLastLabel': '移至最後頁',\n 'smarthr-ui/Pagination/controllerItemButtonNextLabel': '下一步',\n 'smarthr-ui/Pagination/controllerItemButtonPreviousLabel': '上一步',\n 'smarthr-ui/Pagination/itemButtonLabel': '第{page}頁',\n 'smarthr-ui/Pagination/navigationLabel': '分頁',\n 'smarthr-ui/RequiredLabel/text': '必填',\n 'smarthr-ui/SearchInput/iconAlt': '搜尋',\n 'smarthr-ui/Select/blankLabel': '請選擇',\n 'smarthr-ui/SingleCombobox/destroyButtonIconAlt': '刪除',\n 'smarthr-ui/SortDropdown/applyButtonLabel': '套用',\n 'smarthr-ui/SortDropdown/ascLabel': '遞增',\n 'smarthr-ui/SortDropdown/cancelButtonLabel': '取消',\n 'smarthr-ui/SortDropdown/descLabel': '遞減',\n 'smarthr-ui/SortDropdown/sortFieldLabel': '排序項目',\n 'smarthr-ui/SortDropdown/sortOrderLabel': '排序方式',\n 'smarthr-ui/StepFormDialog/backButtonLabel': '返回',\n 'smarthr-ui/StepFormDialog/closeButtonLabel': '取消',\n 'smarthr-ui/StepFormDialog/nextButtonLabel': '下一步',\n 'smarthr-ui/StepStatusIcon/closedAlt': '中斷',\n 'smarthr-ui/StepStatusIcon/completedAlt': '已完成',\n 'smarthr-ui/Textarea/availableLetters': '還可輸入{availableLetters}個字',\n 'smarthr-ui/Textarea/maxLettersExceeded': '超出{exceededLetters}個字',\n 'smarthr-ui/Textarea/screenReaderMaxLettersDescription': '最多可輸入{maxLetters}個字',\n 'smarthr-ui/TextLink/openInNewTab': '在新視窗中開啟',\n 'smarthr-ui/Th/sortDirectionAsc': '遞增',\n 'smarthr-ui/Th/sortDirectionDesc': '遞減',\n 'smarthr-ui/Th/sortDirectionNone': '無排序',\n 'smarthr-ui/ThCheckbox/checkAllInvisibleLabel': '選擇/取消所有項目',\n 'smarthr-ui/ThCheckbox/checkColumnName': '選擇',\n} as const satisfies Record<keyof typeof ja, string>\n"],"names":[],"mappings":"AAEA;AACA;AACO,MAAM,MAAM,GAAG;AACpB,IAAA,4BAA4B,EAAE,MAAM;AACpC,IAAA,0CAA0C,EAAE,IAAI;AAChD,IAAA,6BAA6B,EAAE,aAAa;AAC5C,IAAA,2BAA2B,EAAE,IAAI;AACjC,IAAA,mCAAmC,EAAE,MAAM;AAC3C,IAAA,mCAAmC,EAAE,QAAQ;AAC7C,IAAA,4CAA4C,EAAE,wBAAwB;AACtE,IAAA,yCAAyC,EAAE,YAAY;AACvD,IAAA,qDAAqD,EAAE,IAAI;AAC3D,IAAA,2CAA2C,EAAE,IAAI;AACjD,IAAA,4CAA4C,EAAE,MAAM;AACpD,IAAA,6CAA6C,EAAE,MAAM;AACrD,IAAA,gDAAgD,EAAE,MAAM;AACxD,IAAA,kDAAkD,EAAE,MAAM;A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KAAK;AAC/C,IAAA,sCAAsC,EAAE,0BAA0B;AAClE,IAAA,wCAAwC,EAAE,uBAAuB;AACjE,IAAA,uDAAuD,EAAE,qBAAqB;AAC9E,IAAA,kCAAkC,EAAE,SAAS;AAC7C,IAAA,gCAAgC,EAAE,IAAI;AACtC,IAAA,iCAAiC,EAAE,IAAI;AACvC,IAAA,iCAAiC,EAAE,KAAK;AACxC,IAAA,8CAA8C,EAAE,WAAW;AAC3D,IAAA,uCAAuC,EAAE,IAAI;;;;;"}
|
|
@@ -203,17 +203,23 @@ const ActualFormControl = ({ title, titleType = 'blockTitle', subActionArea, dan
|
|
|
203
203
|
const legendText = (0, react_innertext_1.default)(title);
|
|
204
204
|
if (!legendText)
|
|
205
205
|
return;
|
|
206
|
-
const
|
|
206
|
+
const labelMap = new Map(Array.from(document.querySelectorAll('label[for]')).map((label) => [
|
|
207
|
+
label.getAttribute('for'),
|
|
208
|
+
label,
|
|
209
|
+
]));
|
|
207
210
|
inputs.forEach((input) => {
|
|
208
211
|
const inputId = input.getAttribute('id');
|
|
209
|
-
|
|
210
|
-
|
|
212
|
+
let accessibleName = input.getAttribute('aria-label');
|
|
213
|
+
if (!accessibleName) {
|
|
214
|
+
const label = labelMap.get(inputId);
|
|
215
|
+
if (!label?.closest('.smarthr-ui-VisuallyHiddenText')) {
|
|
216
|
+
// HINT: <label> があり、かつ <VisuallyHiddenText> でラップされていない場合
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
accessibleName = label.textContent || '';
|
|
211
220
|
}
|
|
212
|
-
const accessibleName = input.hasAttribute('aria-label')
|
|
213
|
-
? input.getAttribute('aria-label')
|
|
214
|
-
: null;
|
|
215
221
|
if (accessibleName && !accessibleName.includes(legendText)) {
|
|
216
|
-
input.setAttribute('aria-label', `${accessibleName} ${legendText}
|
|
222
|
+
input.setAttribute('aria-label', `${accessibleName} ${legendText}`.trim());
|
|
217
223
|
}
|
|
218
224
|
});
|
|
219
225
|
}, [isFieldset, title]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormControl.js","sourceRoot":"","sources":["../../../src/components/FormControl/FormControl.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAA;;;;;;;;AAEZ,iCAac;AACd,iCAA6B;AAC7B,sEAAuC;AACvC,yDAAsC;AAEtC,kCAAiD;AACjD,sCAA0C;AAC1C,gDAA4C;AAC5C,kCAA8C;AAC9C,8DAAgG;AA6ChG,MAAM,kBAAkB,GAAG,IAAA,sBAAE,EAAC;IAC5B,KAAK,EAAE;QACL,OAAO,EAAE;YACP,wBAAwB;YACxB,8CAA8C;YAC9C,4BAA4B;YAC5B,qEAAqE;YACrE,4EAA4E;YAC5E,0EAA0E;YAC1E,kFAAkF;YAClF,yGAAyG;SAC1G;QACD,KAAK,EAAE,CAAC,8BAA8B,CAAC;QACvC,SAAS,EAAE,CAAC,eAAe,CAAC;QAC5B,SAAS,EAAE,CAAC,qCAAqC,EAAE,iBAAiB,CAAC;QACrE,eAAe,EAAE,CAAC,gBAAgB,CAAC;QACnC,eAAe,EAAE,EAAE;KACpB;IACD,QAAQ,EAAE;QACR,WAAW,EAAE;YACX,CAAC,EAAE,EAAE;YACL,IAAI,EAAE,EAAE;YACR,GAAG,EAAE,EAAE;YACP,IAAI,EAAE,EAAE;YACR,CAAC,EAAE,EAAE;YACL,IAAI,EAAE,EAAE;YACR,GAAG,EAAE,EAAE;YACP,CAAC,EAAE,EAAE;YACL,GAAG,EAAE,EAAE;YACP,CAAC,EAAE,EAAE;YACL,GAAG,EAAE,EAAE;YACP,CAAC,EAAE,EAAE;YACL,CAAC,EAAE,EAAE;YACL,GAAG,EAAE,EAAE;YACP,GAAG,EAAE,EAAE;YACP,EAAE,EAAE,EAAE;YACN,CAAC,EAAE,EAAE;YACL,CAAC,EAAE,EAAE;YACL,CAAC,EAAE,EAAE;YACL,EAAE,EAAE,EAAE;YACN,GAAG,EAAE,EAAE;YACP,GAAG,EAAE,EAAE;SACoB;QAC7B,UAAU,E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C,CAAC,CAAC,CACrB,uBAAC,WAAI,IACH,EAAE,EAAC,GAAG,EACN,IAAI,EAAC,GAAG,EACR,KAAK,EAAC,WAAW,EACjB,EAAE,EAAE,GAAG,cAAc,uBAAuB,EAC5C,SAAS,EAAC,6CAA6C,YAEtD,oBAAoB,GAChB,CACR,CAAC,CAAC,CAAC,IAAI,CACT,CAAA;AAEY,QAAA,WAAW,GAAsD,yBAAiB,CAAA","sourcesContent":["'use client'\n\nimport {\n type ComponentProps,\n type ComponentPropsWithoutRef,\n type ComponentType,\n type FC,\n Fragment,\n type FunctionComponentElement,\n type PropsWithChildren,\n type ReactNode,\n memo,\n useEffect,\n useMemo,\n useRef,\n} from 'react'\nimport { useId } from 'react'\nimport innerText from 'react-innertext'\nimport { tv } from 'tailwind-variants'\n\nimport { FaCircleExclamationIcon } from '../Icon'\nimport { Cluster, Stack } from '../Layout'\nimport { StatusLabel } from '../StatusLabel'\nimport { Text, type TextProps } from '../Text'\nimport { VisuallyHiddenText, visuallyHiddenTextClassNameGenerator } from '../VisuallyHiddenText'\n\nimport type { Gap } from '../../types'\n\ntype StatusLabelProps = ComponentProps<typeof StatusLabel>\ntype StatusLabelType = FunctionComponentElement<StatusLabelProps>\n\ntype Props = PropsWithChildren<{\n /** グループのタイトル名 */\n title: ReactNode\n /** タイトルの見出しのタイプ */\n titleType?: TextProps['styleType']\n /** タイトル右の領域 */\n subActionArea?: ReactNode\n /** タイトルの見出しを視覚的に隠すかどうか */\n dangerouslyTitleHidden?: boolean\n /** label 要素に適用する `htmlFor` 値 */\n htmlFor?: string\n /** label 要素に適用する `id` 値 */\n labelId?: string\n /** タイトル群と子要素の間の間隔調整用(基本的には不要) */\n innerMargin?: Gap\n /** タイトルの隣に表示する `StatusLabel` の Props の配列 */\n /**\n * @deprecated statusLabelProps属性は非推奨です。statusLabelsを使ってください。\n */\n statusLabelProps?: StatusLabelProps | StatusLabelProps[]\n /** タイトルの隣に表示する `StatusLabel` の配列 */\n statusLabels?: StatusLabelType | StatusLabelType[]\n /** タイトルの下に表示するヘルプメッセージ */\n helpMessage?: ReactNode\n /** タイトルの下に表示する入力例 */\n exampleMessage?: ReactNode\n /** タイトルの下に表示するエラーメッセージ */\n errorMessages?: ReactNode | ReactNode[]\n /** エラーがある場合に自動的に入力要素を error にするかどうか */\n autoBindErrorInput?: boolean\n /** フォームコントロールの下に表示する補足メッセージ */\n supplementaryMessage?: ReactNode\n /** `true` のとき、文字色を `TEXT_DISABLED` にする */\n disabled?: boolean\n as?: string | ComponentType<any>\n}>\ntype ElementProps = Omit<ComponentPropsWithoutRef<'div'>, keyof Props | 'aria-labelledby'>\n\nconst classNameGenerator = tv({\n slots: {\n wrapper: [\n 'smarthr-ui-FormControl',\n 'shr-mx-[unset] shr-border-none shr-p-[unset]',\n 'disabled:shr-text-disabled',\n '[&:disabled_.smarthr-ui-FormControl-label_>_span]:shr-text-disabled',\n '[&:disabled_.smarthr-ui-FormControl-exampleMessage]:shr-text-color-inherit',\n '[&:disabled_.smarthr-ui-FormControl-errorMessage]:shr-text-color-inherit',\n '[&:disabled_.smarthr-ui-FormControl-supplementaryMessage]:shr-text-color-inherit',\n '[&:disabled_.smarthr-ui-Input]:shr-border-default/50 [&:disabled_.smarthr-ui-Input]:shr-bg-white-darken',\n ],\n label: ['smarthr-ui-FormControl-label'],\n errorList: ['shr-list-none'],\n errorIcon: ['smarthr-ui-FormControl-errorMessage', 'shr-text-danger'],\n underTitleStack: ['[&&&]:shr-mt-0'],\n childrenWrapper: [],\n },\n variants: {\n innerMargin: {\n 0: {},\n 0.25: {},\n 0.5: {},\n 0.75: {},\n 1: {},\n 1.25: {},\n 1.5: {},\n 2: {},\n 2.5: {},\n 3: {},\n 3.5: {},\n 4: {},\n 8: {},\n X3S: {},\n XXS: {},\n XS: {},\n S: {},\n M: {},\n L: {},\n XL: {},\n XXL: {},\n X3L: {},\n } as { [key in Gap]: string },\n isFieldset: {\n true: {},\n false: {},\n },\n },\n compoundVariants: [\n // TODO: innerMarginが未指定、初期値の場合、かつFieldsetの場合、childrenの上部の余白を広げることで\n // FormControltとの差をわかりやすくしている\n // 微妙な方法ではあるので、必要に応じてinnerMarginではない属性を用意する\n // https://kufuinc.slack.com/archives/CGC58MW01/p1737944965871159?thread_ts=1737541173.404369&cid=CGC58MW01\n {\n innerMargin: undefined,\n isFieldset: true,\n class: {\n childrenWrapper: '[:not([hidden])_~_&&&]:shr-mt-1',\n },\n },\n {\n innerMargin: undefined,\n isFieldset: false,\n class: {\n childrenWrapper: '[:not([hidden])_~_&&&]:shr-mt-0.5',\n },\n },\n ],\n})\n\nconst SMARTHR_UI_INPUT_SELECTOR = '[data-smarthr-ui-input=\"true\"]'\n\nexport const ActualFormControl: FC<Props & ElementProps> = ({\n title,\n titleType = 'blockTitle',\n subActionArea,\n dangerouslyTitleHidden = false,\n htmlFor,\n labelId,\n innerMargin,\n statusLabels,\n statusLabelProps,\n helpMessage,\n exampleMessage,\n errorMessages,\n autoBindErrorInput = true,\n supplementaryMessage,\n as = 'div',\n className,\n children,\n ...props\n}) => {\n const defaultHtmlFor = useId()\n const defaultLabelId = useId()\n const managedHtmlFor = htmlFor || defaultHtmlFor\n const managedLabelId = labelId || defaultLabelId\n const inputWrapperRef = useRef<HTMLDivElement>(null)\n const isFieldset = as === 'fieldset'\n\n const describedbyIds = useMemo(() => {\n const temp = []\n\n if (helpMessage) {\n temp.push(`${managedHtmlFor}_helpMessage`)\n }\n if (exampleMessage) {\n temp.push(`${managedHtmlFor}_exampleMessage`)\n }\n if (supplementaryMessage) {\n temp.push(`${managedHtmlFor}_supplementaryMessage`)\n }\n if (errorMessages) {\n temp.push(`${managedHtmlFor}_errorMessages`)\n }\n\n return temp.join(' ')\n }, [helpMessage, exampleMessage, supplementaryMessage, errorMessages, managedHtmlFor])\n\n const actualStatusLabels = useMemo(() => {\n if (statusLabels) {\n return (Array.isArray(statusLabels) ? statusLabels : [statusLabels]).map(\n (statusLabel, index) => <Fragment key={index}>{statusLabel}</Fragment>,\n )\n }\n\n if (!statusLabelProps) {\n return []\n }\n\n const labelProps = Array.isArray(statusLabelProps) ? statusLabelProps : [statusLabelProps]\n\n return labelProps.map((prop, index) => <StatusLabel {...prop} key={index} />)\n }, [statusLabels, statusLabelProps])\n\n const actualErrorMessages = useMemo(() => {\n if (!errorMessages) {\n return []\n }\n\n return Array.isArray(errorMessages) ? errorMessages : [errorMessages]\n }, [errorMessages])\n\n const actualInnerMargin = useMemo(() => innerMargin ?? 0.5, [innerMargin])\n\n const classNames = useMemo(() => {\n const { wrapper, label, errorList, errorIcon, underTitleStack, childrenWrapper } =\n classNameGenerator({ innerMargin, isFieldset })\n\n return {\n wrapper: wrapper({ className }),\n label: label({\n className: dangerouslyTitleHidden ? visuallyHiddenTextClassNameGenerator() : '',\n }),\n errorList: errorList(),\n errorIcon: errorIcon(),\n underTitleStack: underTitleStack(),\n childrenWrapper: childrenWrapper(),\n }\n }, [innerMargin, isFieldset, dangerouslyTitleHidden, className])\n\n useEffect(() => {\n if (\n isFieldset ||\n !inputWrapperRef?.current ||\n // HINT: 対象idを持つ要素が既に存在する場合、何もしない\n document.getElementById(managedHtmlFor)\n ) {\n return\n }\n\n const input = inputWrapperRef.current.querySelector(SMARTHR_UI_INPUT_SELECTOR)\n\n if (!input) {\n return\n }\n\n if (!input.getAttribute('id')) {\n input.setAttribute('id', managedHtmlFor)\n }\n\n if (input instanceof HTMLInputElement && input.type === 'file') {\n const attrName = 'aria-labelledby'\n const inputLabelledByIds = input.getAttribute(attrName)\n\n if (inputLabelledByIds) {\n // InputFileの場合はlabel要素の可視ラベルをアクセシブルネームに含める\n input.setAttribute(attrName, `${inputLabelledByIds} ${managedLabelId}`)\n }\n }\n }, [managedHtmlFor, isFieldset, managedLabelId])\n\n useEffect(() => {\n if (!describedbyIds || !inputWrapperRef?.current) {\n return\n }\n\n const inputWrapper = inputWrapperRef.current\n const attrName = 'aria-describedby'\n\n if (inputWrapper.querySelector(`[${attrName}=\"${describedbyIds}\"]`)) {\n return\n }\n\n const input = inputWrapper.querySelector(SMARTHR_UI_INPUT_SELECTOR)\n\n if (input) {\n const attribute = input.getAttribute(attrName)\n\n input.setAttribute(attrName, attribute ? `${attribute} ${describedbyIds}` : describedbyIds)\n }\n }, [describedbyIds])\n\n useEffect(() => {\n if (!autoBindErrorInput || !inputWrapperRef?.current) {\n return\n }\n\n const input = inputWrapperRef.current.querySelector(SMARTHR_UI_INPUT_SELECTOR)\n\n if (input) {\n const attrName = 'aria-invalid'\n\n if (actualErrorMessages.length > 0) {\n input.setAttribute(attrName, 'true')\n } else {\n input.removeAttribute(attrName)\n }\n }\n }, [actualErrorMessages.length, autoBindErrorInput])\n\n // HINT: Fieldset内の可視ラベルが無いinputに、legend文言をアクセシブルネームに追加する\n // https://waic.jp/translations/WCAG21/Understanding/label-in-name.html\n useEffect(() => {\n if (!isFieldset || !inputWrapperRef.current) return\n const inputs = inputWrapperRef.current.querySelectorAll(SMARTHR_UI_INPUT_SELECTOR)\n if (!inputs.length) return\n\n const legendText = innerText(title)\n if (!legendText) return\n\n const labels = new Set(\n Array.from(document.querySelectorAll('label[for]')).map((label) => label.getAttribute('for')),\n )\n\n inputs.forEach((input) => {\n const inputId = input.getAttribute('id')\n if (inputId && labels.has(inputId)) {\n return\n }\n\n const accessibleName = input.hasAttribute('aria-label')\n ? input.getAttribute('aria-label')\n : null\n\n if (accessibleName && !accessibleName.includes(legendText)) {\n input.setAttribute('aria-label', `${accessibleName} ${legendText} `.trim())\n }\n })\n }, [isFieldset, title])\n\n let body = (\n <>\n <HelpMessageParagraph helpMessage={helpMessage} managedHtmlFor={managedHtmlFor} />\n <ExampleMessageText exampleMessage={exampleMessage} managedHtmlFor={managedHtmlFor} />\n <ErrorMessageList\n errorMessages={actualErrorMessages}\n managedHtmlFor={managedHtmlFor}\n classNames={classNames}\n />\n <div className={classNames.childrenWrapper} ref={inputWrapperRef}>\n {children}\n </div>\n <SupplementaryMessageText\n supplementaryMessage={supplementaryMessage}\n managedHtmlFor={managedHtmlFor}\n />\n </>\n )\n\n // HINT: dangerouslyTitleHiddenの場合、body以下の余白の計算を簡略化するため\n // Stackをネストし、そのStackに対してmargin-top: 0を指定する\n // こうすることでinner Stack以下の要素は擬似的にStackの最初の要素になる\n if (dangerouslyTitleHidden) {\n body = (\n <Stack gap={actualInnerMargin} className={classNames.underTitleStack}>\n {body}\n </Stack>\n )\n }\n\n return (\n <Stack\n {...props}\n as={as}\n gap={actualInnerMargin}\n aria-describedby={isFieldset && describedbyIds ? describedbyIds : undefined}\n className={classNames.wrapper}\n >\n <TitleCluster\n isFieldset={isFieldset}\n managedHtmlFor={managedHtmlFor}\n managedLabelId={managedLabelId}\n dangerouslyTitleHidden={dangerouslyTitleHidden}\n titleType={titleType}\n title={title}\n statusLabels={actualStatusLabels}\n subActionArea={subActionArea}\n labelClassName={classNames.label}\n />\n {body}\n </Stack>\n )\n}\n\nconst TitleCluster = memo<\n Pick<Props, 'dangerouslyTitleHidden' | 'title' | 'subActionArea'> & {\n titleType: TextProps['styleType']\n isFieldset: boolean\n managedHtmlFor: string\n managedLabelId: string\n labelClassName: string\n statusLabels: StatusLabelType[]\n }\n>(\n ({\n isFieldset,\n managedHtmlFor,\n managedLabelId,\n dangerouslyTitleHidden,\n titleType,\n title,\n subActionArea,\n labelClassName,\n statusLabels,\n }) => {\n const body = (\n <>\n <Text styleType={titleType}>{title}</Text>\n <StatusLabelCluster statusLabels={statusLabels} />\n </>\n )\n\n const attrs = useMemo(() => {\n if (dangerouslyTitleHidden) {\n return {\n label: null,\n visuallyHidden: isFieldset\n ? {\n as: 'legend',\n }\n : {\n as: 'label',\n htmlFor: managedHtmlFor,\n id: managedLabelId,\n },\n }\n }\n\n if (isFieldset) {\n return {\n label: { 'aria-hidden': 'true' } as const,\n visuallyHidden: { as: 'legend' },\n }\n }\n\n return {\n label: {\n as: 'label' as const,\n htmlFor: managedHtmlFor,\n id: managedLabelId,\n },\n visuallyHidden: null,\n }\n }, [managedLabelId, managedHtmlFor, dangerouslyTitleHidden, isFieldset])\n\n return (\n <>\n {attrs.visuallyHidden && (\n <VisuallyHiddenText {...attrs.visuallyHidden}>\n {\n // HINT: innerTextでは正しく文字が取得できない場合がある\n // 安全策としてinnerTextが空を取得してきたらbody自体を埋めこみます\n innerText(body) || body\n }\n </VisuallyHiddenText>\n )}\n {attrs.label && (\n <Cluster\n justify=\"space-between\"\n // HINT: UI上、常にトップの要素になるため、Stackの計算が狂わないよう、\n // 常にmargin-topを0にする\n className=\"[&&&]:shr--mt-0\"\n >\n <Cluster {...attrs.label} align=\"center\" className={labelClassName}>\n {body}\n </Cluster>\n {subActionArea && <div className=\"shr-grow\">{subActionArea}</div>}\n </Cluster>\n )}\n </>\n )\n },\n)\n\nconst StatusLabelCluster = memo<{ statusLabels: StatusLabelType[] }>(({ statusLabels }) =>\n statusLabels.length === 0 ? null : (\n <Cluster gap={0.25} as=\"span\">\n {statusLabels}\n </Cluster>\n ),\n)\n\nconst HelpMessageParagraph = memo<Pick<Props, 'helpMessage'> & { managedHtmlFor: string }>(\n ({ helpMessage, managedHtmlFor }) =>\n helpMessage ? (\n <p className=\"smarthr-ui-FormControl-helpMessage\" id={`${managedHtmlFor}_helpMessage`}>\n {helpMessage}\n </p>\n ) : null,\n)\n\nconst ExampleMessageText = memo<Pick<Props, 'exampleMessage'> & { managedHtmlFor: string }>(\n ({ exampleMessage, managedHtmlFor }) =>\n exampleMessage ? (\n <Text\n as=\"p\"\n color=\"TEXT_GREY\"\n italic\n id={`${managedHtmlFor}_exampleMessage`}\n className=\"smarthr-ui-FormControl-exampleMessage\"\n >\n {exampleMessage}\n </Text>\n ) : null,\n)\n\nconst ErrorMessageList = memo<{\n errorMessages: ReactNode[]\n managedHtmlFor: string\n classNames: {\n errorList: string\n errorIcon: string\n }\n}>(({ errorMessages, managedHtmlFor, classNames }) =>\n errorMessages.length > 0 ? (\n <div id={`${managedHtmlFor}_errorMessages`} className={classNames.errorList} role=\"alert\">\n {errorMessages.map((message, index) => (\n <p key={index}>\n <FaCircleExclamationIcon text={message} className={classNames.errorIcon} />\n </p>\n ))}\n </div>\n ) : null,\n)\n\nconst SupplementaryMessageText = memo<\n Pick<Props, 'supplementaryMessage'> & { managedHtmlFor: string }\n>(({ supplementaryMessage, managedHtmlFor }) =>\n supplementaryMessage ? (\n <Text\n as=\"p\"\n size=\"S\"\n color=\"TEXT_GREY\"\n id={`${managedHtmlFor}_supplementaryMessage`}\n className=\"smarthr-ui-FormControl-supplementaryMessage\"\n >\n {supplementaryMessage}\n </Text>\n ) : null,\n)\n\nexport const FormControl: FC<Omit<Props & ElementProps, 'as' | 'disabled'>> = ActualFormControl\n"]}
|
|
1
|
+
{"version":3,"file":"FormControl.js","sourceRoot":"","sources":["../../../src/components/FormControl/FormControl.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAA;;;;;;;;AAEZ,iCAac;AACd,iCAA6B;AAC7B,sEAAuC;AACvC,yDAAsC;AAEtC,kCAAiD;AACjD,sCAA0C;AAC1C,gDAA4C;AAC5C,kCAA8C;AAC9C,8DAAgG;AA6ChG,MAAM,kBAAkB,GAAG,IAAA,sBAAE,EAAC;IAC5B,KAAK,EAAE;QACL,OAAO,EAAE;YACP,wBAAwB;YACxB,8CAA8C;YAC9C,4BAA4B;YAC5B,qEAAqE;YACrE,4EAA4E;YAC5E,0EAA0E;YAC1E,kFAAkF;YAClF,yGAAyG;SAC1G;QACD,KAAK,EAAE,CAAC,8BAA8B,CAAC;QACvC,SAAS,EAAE,CAAC,eAAe,CAAC;QAC5B,SAAS,EAAE,CAAC,qCAAqC,EAAE,iBAAiB,CAAC;QACrE,eAAe,EAAE,CAAC,gBAAgB,CAAC;QACnC,eAAe,EAAE,EAAE;KACpB;IACD,QAAQ,EAAE;QACR,WAAW,EAAE;YACX,CAAC,EAAE,EAAE;YACL,IAAI,EAAE,EAAE;YACR,GAAG,EAAE,EAAE;YACP,IAAI,EAAE,EAAE;YACR,CAAC,EAAE,EAAE;YACL,IAAI,EAAE,EAAE;YACR,G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D,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CACzB,gCAAK,EAAE,EAAE,GAAG,cAAc,gBAAgB,EAAE,SAAS,EAAE,UAAU,CAAC,SAAS,EAAE,IAAI,EAAC,OAAO,YACtF,aAAa,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,CACrC,wCACE,uBAAC,8BAAuB,IAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC,SAAS,GAAI,IADrE,KAAK,CAET,CACL,CAAC,GACE,CACP,CAAC,CAAC,CAAC,IAAI,CACT,CAAA;AAED,MAAM,wBAAwB,GAAG,IAAA,YAAI,EAEnC,CAAC,EAAE,oBAAoB,EAAE,cAAc,EAAE,EAAE,EAAE,CAC7C,oBAAoB,CAAC,CAAC,CAAC,CACrB,uBAAC,WAAI,IACH,EAAE,EAAC,GAAG,EACN,IAAI,EAAC,GAAG,EACR,KAAK,EAAC,WAAW,EACjB,EAAE,EAAE,GAAG,cAAc,uBAAuB,EAC5C,SAAS,EAAC,6CAA6C,YAEtD,oBAAoB,GAChB,CACR,CAAC,CAAC,CAAC,IAAI,CACT,CAAA;AAEY,QAAA,WAAW,GAAsD,yBAAiB,CAAA","sourcesContent":["'use client'\n\nimport {\n type ComponentProps,\n type ComponentPropsWithoutRef,\n type ComponentType,\n type FC,\n Fragment,\n type FunctionComponentElement,\n type PropsWithChildren,\n type ReactNode,\n memo,\n useEffect,\n useMemo,\n useRef,\n} from 'react'\nimport { useId } from 'react'\nimport innerText from 'react-innertext'\nimport { tv } from 'tailwind-variants'\n\nimport { FaCircleExclamationIcon } from '../Icon'\nimport { Cluster, Stack } from '../Layout'\nimport { StatusLabel } from '../StatusLabel'\nimport { Text, type TextProps } from '../Text'\nimport { VisuallyHiddenText, visuallyHiddenTextClassNameGenerator } from '../VisuallyHiddenText'\n\nimport type { Gap } from '../../types'\n\ntype StatusLabelProps = ComponentProps<typeof StatusLabel>\ntype StatusLabelType = FunctionComponentElement<StatusLabelProps>\n\ntype Props = PropsWithChildren<{\n /** グループのタイトル名 */\n title: ReactNode\n /** タイトルの見出しのタイプ */\n titleType?: TextProps['styleType']\n /** タイトル右の領域 */\n subActionArea?: ReactNode\n /** タイトルの見出しを視覚的に隠すかどうか */\n dangerouslyTitleHidden?: boolean\n /** label 要素に適用する `htmlFor` 値 */\n htmlFor?: string\n /** label 要素に適用する `id` 値 */\n labelId?: string\n /** タイトル群と子要素の間の間隔調整用(基本的には不要) */\n innerMargin?: Gap\n /** タイトルの隣に表示する `StatusLabel` の Props の配列 */\n /**\n * @deprecated statusLabelProps属性は非推奨です。statusLabelsを使ってください。\n */\n statusLabelProps?: StatusLabelProps | StatusLabelProps[]\n /** タイトルの隣に表示する `StatusLabel` の配列 */\n statusLabels?: StatusLabelType | StatusLabelType[]\n /** タイトルの下に表示するヘルプメッセージ */\n helpMessage?: ReactNode\n /** タイトルの下に表示する入力例 */\n exampleMessage?: ReactNode\n /** タイトルの下に表示するエラーメッセージ */\n errorMessages?: ReactNode | ReactNode[]\n /** エラーがある場合に自動的に入力要素を error にするかどうか */\n autoBindErrorInput?: boolean\n /** フォームコントロールの下に表示する補足メッセージ */\n supplementaryMessage?: ReactNode\n /** `true` のとき、文字色を `TEXT_DISABLED` にする */\n disabled?: boolean\n as?: string | ComponentType<any>\n}>\ntype ElementProps = Omit<ComponentPropsWithoutRef<'div'>, keyof Props | 'aria-labelledby'>\n\nconst classNameGenerator = tv({\n slots: {\n wrapper: [\n 'smarthr-ui-FormControl',\n 'shr-mx-[unset] shr-border-none shr-p-[unset]',\n 'disabled:shr-text-disabled',\n '[&:disabled_.smarthr-ui-FormControl-label_>_span]:shr-text-disabled',\n '[&:disabled_.smarthr-ui-FormControl-exampleMessage]:shr-text-color-inherit',\n '[&:disabled_.smarthr-ui-FormControl-errorMessage]:shr-text-color-inherit',\n '[&:disabled_.smarthr-ui-FormControl-supplementaryMessage]:shr-text-color-inherit',\n '[&:disabled_.smarthr-ui-Input]:shr-border-default/50 [&:disabled_.smarthr-ui-Input]:shr-bg-white-darken',\n ],\n label: ['smarthr-ui-FormControl-label'],\n errorList: ['shr-list-none'],\n errorIcon: ['smarthr-ui-FormControl-errorMessage', 'shr-text-danger'],\n underTitleStack: ['[&&&]:shr-mt-0'],\n childrenWrapper: [],\n },\n variants: {\n innerMargin: {\n 0: {},\n 0.25: {},\n 0.5: {},\n 0.75: {},\n 1: {},\n 1.25: {},\n 1.5: {},\n 2: {},\n 2.5: {},\n 3: {},\n 3.5: {},\n 4: {},\n 8: {},\n X3S: {},\n XXS: {},\n XS: {},\n S: {},\n M: {},\n L: {},\n XL: {},\n XXL: {},\n X3L: {},\n } as { [key in Gap]: string },\n isFieldset: {\n true: {},\n false: {},\n },\n },\n compoundVariants: [\n // TODO: innerMarginが未指定、初期値の場合、かつFieldsetの場合、childrenの上部の余白を広げることで\n // FormControltとの差をわかりやすくしている\n // 微妙な方法ではあるので、必要に応じてinnerMarginではない属性を用意する\n // https://kufuinc.slack.com/archives/CGC58MW01/p1737944965871159?thread_ts=1737541173.404369&cid=CGC58MW01\n {\n innerMargin: undefined,\n isFieldset: true,\n class: {\n childrenWrapper: '[:not([hidden])_~_&&&]:shr-mt-1',\n },\n },\n {\n innerMargin: undefined,\n isFieldset: false,\n class: {\n childrenWrapper: '[:not([hidden])_~_&&&]:shr-mt-0.5',\n },\n },\n ],\n})\n\nconst SMARTHR_UI_INPUT_SELECTOR = '[data-smarthr-ui-input=\"true\"]'\n\nexport const ActualFormControl: FC<Props & ElementProps> = ({\n title,\n titleType = 'blockTitle',\n subActionArea,\n dangerouslyTitleHidden = false,\n htmlFor,\n labelId,\n innerMargin,\n statusLabels,\n statusLabelProps,\n helpMessage,\n exampleMessage,\n errorMessages,\n autoBindErrorInput = true,\n supplementaryMessage,\n as = 'div',\n className,\n children,\n ...props\n}) => {\n const defaultHtmlFor = useId()\n const defaultLabelId = useId()\n const managedHtmlFor = htmlFor || defaultHtmlFor\n const managedLabelId = labelId || defaultLabelId\n const inputWrapperRef = useRef<HTMLDivElement>(null)\n const isFieldset = as === 'fieldset'\n\n const describedbyIds = useMemo(() => {\n const temp = []\n\n if (helpMessage) {\n temp.push(`${managedHtmlFor}_helpMessage`)\n }\n if (exampleMessage) {\n temp.push(`${managedHtmlFor}_exampleMessage`)\n }\n if (supplementaryMessage) {\n temp.push(`${managedHtmlFor}_supplementaryMessage`)\n }\n if (errorMessages) {\n temp.push(`${managedHtmlFor}_errorMessages`)\n }\n\n return temp.join(' ')\n }, [helpMessage, exampleMessage, supplementaryMessage, errorMessages, managedHtmlFor])\n\n const actualStatusLabels = useMemo(() => {\n if (statusLabels) {\n return (Array.isArray(statusLabels) ? statusLabels : [statusLabels]).map(\n (statusLabel, index) => <Fragment key={index}>{statusLabel}</Fragment>,\n )\n }\n\n if (!statusLabelProps) {\n return []\n }\n\n const labelProps = Array.isArray(statusLabelProps) ? statusLabelProps : [statusLabelProps]\n\n return labelProps.map((prop, index) => <StatusLabel {...prop} key={index} />)\n }, [statusLabels, statusLabelProps])\n\n const actualErrorMessages = useMemo(() => {\n if (!errorMessages) {\n return []\n }\n\n return Array.isArray(errorMessages) ? errorMessages : [errorMessages]\n }, [errorMessages])\n\n const actualInnerMargin = useMemo(() => innerMargin ?? 0.5, [innerMargin])\n\n const classNames = useMemo(() => {\n const { wrapper, label, errorList, errorIcon, underTitleStack, childrenWrapper } =\n classNameGenerator({ innerMargin, isFieldset })\n\n return {\n wrapper: wrapper({ className }),\n label: label({\n className: dangerouslyTitleHidden ? visuallyHiddenTextClassNameGenerator() : '',\n }),\n errorList: errorList(),\n errorIcon: errorIcon(),\n underTitleStack: underTitleStack(),\n childrenWrapper: childrenWrapper(),\n }\n }, [innerMargin, isFieldset, dangerouslyTitleHidden, className])\n\n useEffect(() => {\n if (\n isFieldset ||\n !inputWrapperRef?.current ||\n // HINT: 対象idを持つ要素が既に存在する場合、何もしない\n document.getElementById(managedHtmlFor)\n ) {\n return\n }\n\n const input = inputWrapperRef.current.querySelector(SMARTHR_UI_INPUT_SELECTOR)\n\n if (!input) {\n return\n }\n\n if (!input.getAttribute('id')) {\n input.setAttribute('id', managedHtmlFor)\n }\n\n if (input instanceof HTMLInputElement && input.type === 'file') {\n const attrName = 'aria-labelledby'\n const inputLabelledByIds = input.getAttribute(attrName)\n\n if (inputLabelledByIds) {\n // InputFileの場合はlabel要素の可視ラベルをアクセシブルネームに含める\n input.setAttribute(attrName, `${inputLabelledByIds} ${managedLabelId}`)\n }\n }\n }, [managedHtmlFor, isFieldset, managedLabelId])\n\n useEffect(() => {\n if (!describedbyIds || !inputWrapperRef?.current) {\n return\n }\n\n const inputWrapper = inputWrapperRef.current\n const attrName = 'aria-describedby'\n\n if (inputWrapper.querySelector(`[${attrName}=\"${describedbyIds}\"]`)) {\n return\n }\n\n const input = inputWrapper.querySelector(SMARTHR_UI_INPUT_SELECTOR)\n\n if (input) {\n const attribute = input.getAttribute(attrName)\n\n input.setAttribute(attrName, attribute ? `${attribute} ${describedbyIds}` : describedbyIds)\n }\n }, [describedbyIds])\n\n useEffect(() => {\n if (!autoBindErrorInput || !inputWrapperRef?.current) {\n return\n }\n\n const input = inputWrapperRef.current.querySelector(SMARTHR_UI_INPUT_SELECTOR)\n\n if (input) {\n const attrName = 'aria-invalid'\n\n if (actualErrorMessages.length > 0) {\n input.setAttribute(attrName, 'true')\n } else {\n input.removeAttribute(attrName)\n }\n }\n }, [actualErrorMessages.length, autoBindErrorInput])\n\n // HINT: Fieldset内の可視ラベルが無いinputに、legend文言をアクセシブルネームに追加する\n // https://waic.jp/translations/WCAG21/Understanding/label-in-name.html\n useEffect(() => {\n if (!isFieldset || !inputWrapperRef.current) return\n const inputs = inputWrapperRef.current.querySelectorAll(SMARTHR_UI_INPUT_SELECTOR)\n if (!inputs.length) return\n\n const legendText = innerText(title)\n if (!legendText) return\n\n const labelMap = new Map(\n Array.from(document.querySelectorAll('label[for]')).map((label) => [\n label.getAttribute('for'),\n label,\n ]),\n )\n\n inputs.forEach((input) => {\n const inputId = input.getAttribute('id')\n let accessibleName = input.getAttribute('aria-label')\n\n if (!accessibleName) {\n const label = labelMap.get(inputId)\n if (!label?.closest('.smarthr-ui-VisuallyHiddenText')) {\n // HINT: <label> があり、かつ <VisuallyHiddenText> でラップされていない場合\n return\n }\n\n accessibleName = label.textContent || ''\n }\n\n if (accessibleName && !accessibleName.includes(legendText)) {\n input.setAttribute('aria-label', `${accessibleName} ${legendText}`.trim())\n }\n })\n }, [isFieldset, title])\n\n let body = (\n <>\n <HelpMessageParagraph helpMessage={helpMessage} managedHtmlFor={managedHtmlFor} />\n <ExampleMessageText exampleMessage={exampleMessage} managedHtmlFor={managedHtmlFor} />\n <ErrorMessageList\n errorMessages={actualErrorMessages}\n managedHtmlFor={managedHtmlFor}\n classNames={classNames}\n />\n <div className={classNames.childrenWrapper} ref={inputWrapperRef}>\n {children}\n </div>\n <SupplementaryMessageText\n supplementaryMessage={supplementaryMessage}\n managedHtmlFor={managedHtmlFor}\n />\n </>\n )\n\n // HINT: dangerouslyTitleHiddenの場合、body以下の余白の計算を簡略化するため\n // Stackをネストし、そのStackに対してmargin-top: 0を指定する\n // こうすることでinner Stack以下の要素は擬似的にStackの最初の要素になる\n if (dangerouslyTitleHidden) {\n body = (\n <Stack gap={actualInnerMargin} className={classNames.underTitleStack}>\n {body}\n </Stack>\n )\n }\n\n return (\n <Stack\n {...props}\n as={as}\n gap={actualInnerMargin}\n aria-describedby={isFieldset && describedbyIds ? describedbyIds : undefined}\n className={classNames.wrapper}\n >\n <TitleCluster\n isFieldset={isFieldset}\n managedHtmlFor={managedHtmlFor}\n managedLabelId={managedLabelId}\n dangerouslyTitleHidden={dangerouslyTitleHidden}\n titleType={titleType}\n title={title}\n statusLabels={actualStatusLabels}\n subActionArea={subActionArea}\n labelClassName={classNames.label}\n />\n {body}\n </Stack>\n )\n}\n\nconst TitleCluster = memo<\n Pick<Props, 'dangerouslyTitleHidden' | 'title' | 'subActionArea'> & {\n titleType: TextProps['styleType']\n isFieldset: boolean\n managedHtmlFor: string\n managedLabelId: string\n labelClassName: string\n statusLabels: StatusLabelType[]\n }\n>(\n ({\n isFieldset,\n managedHtmlFor,\n managedLabelId,\n dangerouslyTitleHidden,\n titleType,\n title,\n subActionArea,\n labelClassName,\n statusLabels,\n }) => {\n const body = (\n <>\n <Text styleType={titleType}>{title}</Text>\n <StatusLabelCluster statusLabels={statusLabels} />\n </>\n )\n\n const attrs = useMemo(() => {\n if (dangerouslyTitleHidden) {\n return {\n label: null,\n visuallyHidden: isFieldset\n ? {\n as: 'legend',\n }\n : {\n as: 'label',\n htmlFor: managedHtmlFor,\n id: managedLabelId,\n },\n }\n }\n\n if (isFieldset) {\n return {\n label: { 'aria-hidden': 'true' } as const,\n visuallyHidden: { as: 'legend' },\n }\n }\n\n return {\n label: {\n as: 'label' as const,\n htmlFor: managedHtmlFor,\n id: managedLabelId,\n },\n visuallyHidden: null,\n }\n }, [managedLabelId, managedHtmlFor, dangerouslyTitleHidden, isFieldset])\n\n return (\n <>\n {attrs.visuallyHidden && (\n <VisuallyHiddenText {...attrs.visuallyHidden}>\n {\n // HINT: innerTextでは正しく文字が取得できない場合がある\n // 安全策としてinnerTextが空を取得してきたらbody自体を埋めこみます\n innerText(body) || body\n }\n </VisuallyHiddenText>\n )}\n {attrs.label && (\n <Cluster\n justify=\"space-between\"\n // HINT: UI上、常にトップの要素になるため、Stackの計算が狂わないよう、\n // 常にmargin-topを0にする\n className=\"[&&&]:shr--mt-0\"\n >\n <Cluster {...attrs.label} align=\"center\" className={labelClassName}>\n {body}\n </Cluster>\n {subActionArea && <div className=\"shr-grow\">{subActionArea}</div>}\n </Cluster>\n )}\n </>\n )\n },\n)\n\nconst StatusLabelCluster = memo<{ statusLabels: StatusLabelType[] }>(({ statusLabels }) =>\n statusLabels.length === 0 ? null : (\n <Cluster gap={0.25} as=\"span\">\n {statusLabels}\n </Cluster>\n ),\n)\n\nconst HelpMessageParagraph = memo<Pick<Props, 'helpMessage'> & { managedHtmlFor: string }>(\n ({ helpMessage, managedHtmlFor }) =>\n helpMessage ? (\n <p className=\"smarthr-ui-FormControl-helpMessage\" id={`${managedHtmlFor}_helpMessage`}>\n {helpMessage}\n </p>\n ) : null,\n)\n\nconst ExampleMessageText = memo<Pick<Props, 'exampleMessage'> & { managedHtmlFor: string }>(\n ({ exampleMessage, managedHtmlFor }) =>\n exampleMessage ? (\n <Text\n as=\"p\"\n color=\"TEXT_GREY\"\n italic\n id={`${managedHtmlFor}_exampleMessage`}\n className=\"smarthr-ui-FormControl-exampleMessage\"\n >\n {exampleMessage}\n </Text>\n ) : null,\n)\n\nconst ErrorMessageList = memo<{\n errorMessages: ReactNode[]\n managedHtmlFor: string\n classNames: {\n errorList: string\n errorIcon: string\n }\n}>(({ errorMessages, managedHtmlFor, classNames }) =>\n errorMessages.length > 0 ? (\n <div id={`${managedHtmlFor}_errorMessages`} className={classNames.errorList} role=\"alert\">\n {errorMessages.map((message, index) => (\n <p key={index}>\n <FaCircleExclamationIcon text={message} className={classNames.errorIcon} />\n </p>\n ))}\n </div>\n ) : null,\n)\n\nconst SupplementaryMessageText = memo<\n Pick<Props, 'supplementaryMessage'> & { managedHtmlFor: string }\n>(({ supplementaryMessage, managedHtmlFor }) =>\n supplementaryMessage ? (\n <Text\n as=\"p\"\n size=\"S\"\n color=\"TEXT_GREY\"\n id={`${managedHtmlFor}_supplementaryMessage`}\n className=\"smarthr-ui-FormControl-supplementaryMessage\"\n >\n {supplementaryMessage}\n </Text>\n ) : null,\n)\n\nexport const FormControl: FC<Omit<Props & ElementProps, 'as' | 'disabled'>> = ActualFormControl\n"]}
|
|
@@ -9,7 +9,7 @@ exports.visuallyHiddenTextClassNameGenerator = (0, tailwind_variants_1.tv)({
|
|
|
9
9
|
});
|
|
10
10
|
const ActualVisuallyHiddenText = ({ as: Component = 'span', className, ...props }) => {
|
|
11
11
|
const actualClassName = (0, react_1.useMemo)(() => (0, exports.visuallyHiddenTextClassNameGenerator)({ className }), [className]);
|
|
12
|
-
return (0, jsx_runtime_1.jsx)(Component, { ...props, className: actualClassName });
|
|
12
|
+
return (0, jsx_runtime_1.jsx)(Component, { ...props, className: `smarthr-ui-VisuallyHiddenText ${actualClassName}` });
|
|
13
13
|
};
|
|
14
14
|
exports.VisuallyHiddenText = (0, react_1.memo)(ActualVisuallyHiddenText);
|
|
15
15
|
//# sourceMappingURL=VisuallyHiddenText.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VisuallyHiddenText.js","sourceRoot":"","sources":["../../../src/components/VisuallyHiddenText/VisuallyHiddenText.tsx"],"names":[],"mappings":";;;;AAAA,iCAAoG;AACpG,yDAAsC;AAEzB,QAAA,oCAAoC,GAAG,IAAA,sBAAE,EAAC;IACrD,IAAI,EAAE,4IAA4I;CACnJ,CAAC,CAAA;AAOF,MAAM,wBAAwB,GAAG,CAAiC,EAChE,EAAE,EAAE,SAAS,GAAG,MAAM,EACtB,SAAS,EACT,GAAG,KAAK,EACC,EAAE,EAAE;IACb,MAAM,eAAe,GAAG,IAAA,eAAO,EAC7B,GAAG,EAAE,CAAC,IAAA,4CAAoC,EAAC,EAAE,SAAS,EAAE,CAAC,EACzD,CAAC,SAAS,CAAC,CACZ,CAAA;IAED,OAAO,uBAAC,SAAS,OAAK,KAAK,EAAE,SAAS,EAAE,eAAe,GAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"VisuallyHiddenText.js","sourceRoot":"","sources":["../../../src/components/VisuallyHiddenText/VisuallyHiddenText.tsx"],"names":[],"mappings":";;;;AAAA,iCAAoG;AACpG,yDAAsC;AAEzB,QAAA,oCAAoC,GAAG,IAAA,sBAAE,EAAC;IACrD,IAAI,EAAE,4IAA4I;CACnJ,CAAC,CAAA;AAOF,MAAM,wBAAwB,GAAG,CAAiC,EAChE,EAAE,EAAE,SAAS,GAAG,MAAM,EACtB,SAAS,EACT,GAAG,KAAK,EACC,EAAE,EAAE;IACb,MAAM,eAAe,GAAG,IAAA,eAAO,EAC7B,GAAG,EAAE,CAAC,IAAA,4CAAoC,EAAC,EAAE,SAAS,EAAE,CAAC,EACzD,CAAC,SAAS,CAAC,CACZ,CAAA;IAED,OAAO,uBAAC,SAAS,OAAK,KAAK,EAAE,SAAS,EAAE,iCAAiC,eAAe,EAAE,GAAI,CAAA;AAChG,CAAC,CAAA;AAEY,QAAA,kBAAkB,GAAG,IAAA,YAAI,EAAC,wBAAwB,CAAoC,CAAA","sourcesContent":["import { type ComponentProps, type ElementType, type PropsWithChildren, memo, useMemo } from 'react'\nimport { tv } from 'tailwind-variants'\n\nexport const visuallyHiddenTextClassNameGenerator = tv({\n base: 'shr-absolute shr-h-px shr-w-px shr-overflow-hidden shr-whitespace-nowrap shr-border-0 shr-p-0 [clip-path:inset(100%)] [clip:rect(0_0_0_0)]',\n})\n\ntype Props<T extends ElementType> = PropsWithChildren<{\n as?: T\n}> &\n ComponentProps<T>\n\nconst ActualVisuallyHiddenText = <T extends ElementType = 'span'>({\n as: Component = 'span',\n className,\n ...props\n}: Props<T>) => {\n const actualClassName = useMemo(\n () => visuallyHiddenTextClassNameGenerator({ className }),\n [className],\n )\n\n return <Component {...props} className={`smarthr-ui-VisuallyHiddenText ${actualClassName}`} />\n}\n\nexport const VisuallyHiddenText = memo(ActualVisuallyHiddenText) as typeof ActualVisuallyHiddenText\n"]}
|