@cloudscape-design/components 3.0.230 → 3.0.231

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.
Files changed (132) hide show
  1. package/alert/internal.d.ts.map +1 -1
  2. package/alert/internal.js +3 -1
  3. package/alert/internal.js.map +1 -1
  4. package/annotation-context/index.d.ts +0 -11
  5. package/annotation-context/index.d.ts.map +1 -1
  6. package/annotation-context/index.js +1 -14
  7. package/annotation-context/index.js.map +1 -1
  8. package/annotation-context/utils.d.ts +13 -0
  9. package/annotation-context/utils.d.ts.map +1 -0
  10. package/annotation-context/utils.js +17 -0
  11. package/annotation-context/utils.js.map +1 -0
  12. package/app-layout/index.d.ts.map +1 -1
  13. package/app-layout/index.js +13 -1
  14. package/app-layout/index.js.map +1 -1
  15. package/autosuggest/internal.d.ts.map +1 -1
  16. package/autosuggest/internal.js +3 -5
  17. package/autosuggest/internal.js.map +1 -1
  18. package/code-editor/preferences-modal.d.ts.map +1 -1
  19. package/code-editor/preferences-modal.js +10 -12
  20. package/code-editor/preferences-modal.js.map +1 -1
  21. package/date-range-picker/dropdown.js +4 -4
  22. package/date-range-picker/dropdown.js.map +1 -1
  23. package/flashbar/collapsible-flashbar.d.ts.map +1 -1
  24. package/flashbar/collapsible-flashbar.js +15 -4
  25. package/flashbar/collapsible-flashbar.js.map +1 -1
  26. package/flashbar/common.d.ts +1 -2
  27. package/flashbar/common.d.ts.map +1 -1
  28. package/flashbar/common.js +1 -2
  29. package/flashbar/common.js.map +1 -1
  30. package/flashbar/interfaces.d.ts +1 -1
  31. package/flashbar/interfaces.d.ts.map +1 -1
  32. package/flashbar/interfaces.js.map +1 -1
  33. package/flashbar/non-collapsible-flashbar.d.ts +1 -1
  34. package/flashbar/non-collapsible-flashbar.d.ts.map +1 -1
  35. package/flashbar/non-collapsible-flashbar.js +5 -2
  36. package/flashbar/non-collapsible-flashbar.js.map +1 -1
  37. package/form/internal.d.ts +1 -1
  38. package/form/internal.d.ts.map +1 -1
  39. package/form/internal.js +4 -1
  40. package/form/internal.js.map +1 -1
  41. package/form-field/internal.d.ts.map +1 -1
  42. package/form-field/internal.js +9 -5
  43. package/form-field/internal.js.map +1 -1
  44. package/input/internal.d.ts.map +1 -1
  45. package/input/internal.js +4 -2
  46. package/input/internal.js.map +1 -1
  47. package/internal/environment.js +1 -1
  48. package/internal/i18n/context.d.ts +15 -0
  49. package/internal/i18n/context.d.ts.map +1 -0
  50. package/internal/i18n/context.js +17 -0
  51. package/internal/i18n/context.js.map +1 -0
  52. package/internal/i18n/index.d.ts +2 -0
  53. package/internal/i18n/index.d.ts.map +1 -0
  54. package/internal/i18n/index.js +4 -0
  55. package/internal/i18n/index.js.map +1 -0
  56. package/internal/i18n/messages/all.all.d.ts +3 -0
  57. package/internal/i18n/messages/all.all.js +1953 -0
  58. package/internal/i18n/messages/all.all.json +1971 -0
  59. package/internal/i18n/messages/all.de.d.ts +3 -0
  60. package/internal/i18n/messages/all.de.js +167 -0
  61. package/internal/i18n/messages/all.de.json +167 -0
  62. package/internal/i18n/messages/all.en-GB.d.ts +3 -0
  63. package/internal/i18n/messages/all.en-GB.js +167 -0
  64. package/internal/i18n/messages/all.en-GB.json +167 -0
  65. package/internal/i18n/messages/all.en.d.ts +3 -0
  66. package/internal/i18n/messages/all.en.js +167 -0
  67. package/internal/i18n/messages/all.en.json +167 -0
  68. package/internal/i18n/messages/all.es.d.ts +3 -0
  69. package/internal/i18n/messages/all.es.js +167 -0
  70. package/internal/i18n/messages/all.es.json +167 -0
  71. package/internal/i18n/messages/all.fr.d.ts +3 -0
  72. package/internal/i18n/messages/all.fr.js +167 -0
  73. package/internal/i18n/messages/all.fr.json +167 -0
  74. package/internal/i18n/messages/all.id.d.ts +3 -0
  75. package/internal/i18n/messages/all.id.js +167 -0
  76. package/internal/i18n/messages/all.id.json +167 -0
  77. package/internal/i18n/messages/all.it.d.ts +3 -0
  78. package/internal/i18n/messages/all.it.js +167 -0
  79. package/internal/i18n/messages/all.it.json +167 -0
  80. package/internal/i18n/messages/all.ja.d.ts +3 -0
  81. package/internal/i18n/messages/all.ja.js +175 -0
  82. package/internal/i18n/messages/all.ja.json +175 -0
  83. package/internal/i18n/messages/all.ko.d.ts +3 -0
  84. package/internal/i18n/messages/all.ko.js +161 -0
  85. package/internal/i18n/messages/all.ko.json +167 -0
  86. package/internal/i18n/messages/all.pt-BR.d.ts +3 -0
  87. package/internal/i18n/messages/all.pt-BR.js +167 -0
  88. package/internal/i18n/messages/all.pt-BR.json +167 -0
  89. package/internal/i18n/messages/all.zh-CN.d.ts +3 -0
  90. package/internal/i18n/messages/all.zh-CN.js +163 -0
  91. package/internal/i18n/messages/all.zh-CN.json +169 -0
  92. package/internal/i18n/messages/all.zh-TW.d.ts +3 -0
  93. package/internal/i18n/messages/all.zh-TW.js +162 -0
  94. package/internal/i18n/messages/all.zh-TW.json +168 -0
  95. package/internal/i18n/provider.d.ts +20 -0
  96. package/internal/i18n/provider.d.ts.map +1 -0
  97. package/internal/i18n/provider.js +90 -0
  98. package/internal/i18n/provider.js.map +1 -0
  99. package/internal/manifest.json +1 -1
  100. package/modal/internal.d.ts +1 -1
  101. package/modal/internal.d.ts.map +1 -1
  102. package/modal/internal.js +15 -10
  103. package/modal/internal.js.map +1 -1
  104. package/multiselect/internal.d.ts.map +1 -1
  105. package/multiselect/internal.js +2 -2
  106. package/multiselect/internal.js.map +1 -1
  107. package/package.json +30 -2
  108. package/pagination/internal.d.ts.map +1 -1
  109. package/pagination/internal.js +10 -5
  110. package/pagination/internal.js.map +1 -1
  111. package/popover/internal.d.ts.map +1 -1
  112. package/popover/internal.js +15 -10
  113. package/popover/internal.js.map +1 -1
  114. package/property-filter/controller.d.ts +16 -1
  115. package/property-filter/controller.d.ts.map +1 -1
  116. package/property-filter/controller.js +4 -2
  117. package/property-filter/controller.js.map +1 -1
  118. package/property-filter/index.d.ts.map +1 -1
  119. package/property-filter/index.js +23 -3
  120. package/property-filter/index.js.map +1 -1
  121. package/property-filter/interfaces.d.ts +24 -24
  122. package/property-filter/interfaces.d.ts.map +1 -1
  123. package/property-filter/interfaces.js.map +1 -1
  124. package/property-filter/token-editor.js +2 -2
  125. package/property-filter/token-editor.js.map +1 -1
  126. package/property-filter/token.js +2 -2
  127. package/property-filter/token.js.map +1 -1
  128. package/select/internal.d.ts.map +1 -1
  129. package/select/internal.js +6 -2
  130. package/select/internal.js.map +1 -1
  131. package/tutorial-panel/components/tutorial-detail-view/task-list.js +1 -1
  132. package/tutorial-panel/components/tutorial-detail-view/task-list.js.map +1 -1
@@ -0,0 +1,169 @@
1
+ {
2
+ "@cloudscape-design/components": {
3
+ "zh-CN": {
4
+ "alert": { "dismissAriaLabel": [{ "type": 0, "value": "退出提示" }] },
5
+ "autosuggest": {
6
+ "stepNumberLabel": [
7
+ { "type": 0, "value": "第 " },
8
+ { "type": 1, "value": "stepNumber" },
9
+ { "type": 0, "value": " 步" }
10
+ ],
11
+ "collapsedStepsLabel": [
12
+ { "type": 0, "value": "第 " },
13
+ { "type": 1, "value": "stepNumber" },
14
+ { "type": 0, "value": " 步,共 " },
15
+ { "type": 1, "value": "stepsCount" },
16
+ { "type": 0, "value": " 步" }
17
+ ],
18
+ "cancelButton": [{ "type": 0, "value": "取消" }],
19
+ "previousButton": [{ "type": 0, "value": "上一步" }],
20
+ "nextButton": [{ "type": 0, "value": "下一步" }],
21
+ "optional": [{ "type": 0, "value": "可选" }]
22
+ },
23
+ "app-layout": {
24
+ "ariaLabels.navigation": [{ "type": 0, "value": "侧导航" }],
25
+ "ariaLabels.navigationClose": [{ "type": 0, "value": "关闭侧导航" }],
26
+ "ariaLabels.navigationToggle": [{ "type": 0, "value": "打开侧导航" }],
27
+ "ariaLabels.notifications": [{ "type": 0, "value": "通知" }],
28
+ "ariaLabels.tools": [{ "type": 0, "value": "帮助面板" }],
29
+ "ariaLabels.toolsClose": [{ "type": 0, "value": "打开帮助面板" }],
30
+ "ariaLabels.toolsToggle": [{ "type": 0, "value": "关闭帮助面板" }]
31
+ },
32
+ "date-picker": {
33
+ "nextMonthAriaLabel": [{ "type": 0, "value": "下个月" }],
34
+ "previousMonthAriaLabel": [{ "type": 0, "value": "上个月" }],
35
+ "todayAriaLabel": [{ "type": 0, "value": "今天" }]
36
+ },
37
+ "flashbar": {
38
+ "i18nStrings.ariaLabel": [{ "type": 0, "value": "通知" }],
39
+ "i18nStrings.errorIconAriaLabel": [{ "type": 0, "value": "错误" }],
40
+ "i18nStrings.inProgressIconAriaLabel": [{ "type": 0, "value": "进行中" }],
41
+ "i18nStrings.infoIconAriaLabel": [{ "type": 0, "value": "信息" }],
42
+ "i18nStrings.notificationBarAriaLabel": [{ "type": 0, "value": "所有通知" }],
43
+ "i18nStrings.notificationBarText": [{ "type": 0, "value": "通知" }],
44
+ "i18nStrings.successIconAriaLabel": [{ "type": 0, "value": "成功" }],
45
+ "i18nStrings.warningIconAriaLabel": [{ "type": 0, "value": "警告" }]
46
+ },
47
+ "form": { "errorIconAriaLabel": [{ "type": 0, "value": "错误" }] },
48
+ "form-field": { "i18nStrings.errorIconAriaLabel": [{ "type": 0, "value": "错误" }] },
49
+ "input": { "clearAriaLabel": [{ "type": 0, "value": "清除" }] },
50
+ "modal": { "closeAriaLabel": [{ "type": 0, "value": "关闭模态" }] },
51
+ "pagination": {
52
+ "ariaLabels.nextPageLabel": [{ "type": 0, "value": "下一页" }],
53
+ "ariaLabels.pageLabel": [
54
+ { "type": 0, "value": "第 " },
55
+ { "type": 1, "value": "pageNumber" },
56
+ { "type": 0, "value": " 页" }
57
+ ],
58
+ "ariaLabels.previousPageLabel": [{ "type": 0, "value": "上一页" }]
59
+ },
60
+ "popover": { "dismissAriaLabel": [{ "type": 0, "value": "关闭弹出框" }] },
61
+ "property-filter": {
62
+ "i18nStrings.allPropertiesLabel": [{ "type": 0, "value": "所有属性" }],
63
+ "i18nStrings.applyActionText": [{ "type": 0, "value": "应用" }],
64
+ "i18nStrings.cancelActionText": [{ "type": 0, "value": "取消" }],
65
+ "i18nStrings.clearFiltersText": [{ "type": 0, "value": "清除筛选条件" }],
66
+ "i18nStrings.editTokenHeader": [{ "type": 0, "value": "编辑筛选条件" }],
67
+ "i18nStrings.groupPropertiesText": [{ "type": 0, "value": "属性" }],
68
+ "i18nStrings.groupValuesText": [{ "type": 0, "value": "值" }],
69
+ "i18nStrings.operationAndText": [{ "type": 0, "value": "和" }],
70
+ "i18nStrings.operationOrText": [{ "type": 0, "value": "或" }],
71
+ "i18nStrings.operatorContainsText": [{ "type": 0, "value": "包含" }],
72
+ "i18nStrings.operatorDoesNotContainText": [{ "type": 0, "value": "不包含" }],
73
+ "i18nStrings.operatorDoesNotEqualText": [{ "type": 0, "value": "不等于" }],
74
+ "i18nStrings.operatorEqualsText": [{ "type": 0, "value": "等于" }],
75
+ "i18nStrings.operatorGreaterOrEqualText": [{ "type": 0, "value": "大于或等于" }],
76
+ "i18nStrings.operatorGreaterText": [{ "type": 0, "value": "大于" }],
77
+ "i18nStrings.operatorLessOrEqualText": [{ "type": 0, "value": "小于或等于" }],
78
+ "i18nStrings.operatorLessText": [{ "type": 0, "value": "小于" }],
79
+ "i18nStrings.operatorText": [{ "type": 0, "value": "运算符" }],
80
+ "i18nStrings.operatorsText": [{ "type": 0, "value": "运算符" }],
81
+ "i18nStrings.propertyText": [{ "type": 0, "value": "属性" }],
82
+ "i18nStrings.tokenLimitShowFewer": [{ "type": 0, "value": "显示更少" }],
83
+ "i18nStrings.tokenLimitShowMore": [{ "type": 0, "value": "显示更多" }],
84
+ "i18nStrings.valueText": [{ "type": 0, "value": "值" }],
85
+ "i18nStrings.removeTokenButtonAriaLabel": [
86
+ {
87
+ "type": 5,
88
+ "value": "token__operator",
89
+ "options": {
90
+ "equals": {
91
+ "value": [
92
+ { "type": 0, "value": "删除筛选条件," },
93
+ { "type": 1, "value": "token__propertyKey" },
94
+ { "type": 0, "value": "等于" },
95
+ { "type": 1, "value": "token__value" }
96
+ ]
97
+ },
98
+ "not_equals": {
99
+ "value": [
100
+ { "type": 0, "value": "删除筛选条件," },
101
+ { "type": 1, "value": "token__propertyKey" },
102
+ { "type": 0, "value": "不等于" },
103
+ { "type": 1, "value": "token__value" }
104
+ ]
105
+ },
106
+ "greater_than": {
107
+ "value": [
108
+ { "type": 0, "value": "删除筛选条件," },
109
+ { "type": 1, "value": "token__propertyKey" },
110
+ { "type": 0, "value": "大于" },
111
+ { "type": 1, "value": "token__value" }
112
+ ]
113
+ },
114
+ "greater_than_equal": {
115
+ "value": [
116
+ { "type": 0, "value": "删除筛选条件," },
117
+ { "type": 1, "value": "token__propertyKey" },
118
+ { "type": 0, "value": "大于或等于" },
119
+ { "type": 1, "value": "token__value" }
120
+ ]
121
+ },
122
+ "less_than": {
123
+ "value": [
124
+ { "type": 0, "value": "删除筛选条件," },
125
+ { "type": 1, "value": "token__propertyKey" },
126
+ { "type": 0, "value": "小于" },
127
+ { "type": 1, "value": "token__value" }
128
+ ]
129
+ },
130
+ "less_than_equal": {
131
+ "value": [
132
+ { "type": 0, "value": "删除筛选条件," },
133
+ { "type": 1, "value": "token__propertyKey" },
134
+ { "type": 0, "value": "小于或等于" },
135
+ { "type": 1, "value": "token__value" }
136
+ ]
137
+ },
138
+ "contains": {
139
+ "value": [
140
+ { "type": 0, "value": "删除筛选条件," },
141
+ { "type": 1, "value": "token__propertyKey" },
142
+ { "type": 0, "value": "包含" },
143
+ { "type": 1, "value": "token__value" }
144
+ ]
145
+ },
146
+ "not_contains": {
147
+ "value": [
148
+ { "type": 0, "value": "删除筛选条件," },
149
+ { "type": 1, "value": "token__propertyKey" },
150
+ { "type": 0, "value": "不包含" },
151
+ { "type": 1, "value": "token__value" }
152
+ ]
153
+ },
154
+ "other": { "value": [] }
155
+ }
156
+ }
157
+ ]
158
+ },
159
+ "select": {
160
+ "errorIconAriaLabel": [{ "type": 0, "value": "错误" }],
161
+ "selectedAriaLabel": [{ "type": 0, "value": "已选定" }]
162
+ },
163
+ "wizard": {
164
+ "errorIconAriaLabel": [{ "type": 0, "value": "错误" }],
165
+ "selectedAriaLabel": [{ "type": 0, "value": "已选定" }]
166
+ }
167
+ }
168
+ }
169
+ }
@@ -0,0 +1,3 @@
1
+ import { I18nProviderProps } from '../provider';
2
+ const messages: I18nProviderProps.Messages;
3
+ export default messages;
@@ -0,0 +1,162 @@
1
+ export default {
2
+ '@cloudscape-design/components': {
3
+ 'zh-TW': {
4
+ alert: { dismissAriaLabel: [{ type: 0, value: '關閉提醒' }] },
5
+ autosuggest: {
6
+ stepNumberLabel: [
7
+ { type: 0, value: '步驟 ' },
8
+ { type: 1, value: 'stepNumber' },
9
+ ],
10
+ collapsedStepsLabel: [
11
+ { type: 0, value: '步驟 ' },
12
+ { type: 1, value: 'stepNumber' },
13
+ { type: 0, value: ',共 ' },
14
+ { type: 1, value: 'stepsCount' },
15
+ { type: 0, value: ' 步' },
16
+ ],
17
+ cancelButton: [{ type: 0, value: '取消' }],
18
+ previousButton: [{ type: 0, value: '上一步' }],
19
+ nextButton: [{ type: 0, value: '下一步' }],
20
+ optional: [{ type: 0, value: '選用' }],
21
+ },
22
+ 'app-layout': {
23
+ 'ariaLabels.navigation': [{ type: 0, value: '側邊導覽' }],
24
+ 'ariaLabels.navigationClose': [{ type: 0, value: '關閉側邊導覽' }],
25
+ 'ariaLabels.navigationToggle': [{ type: 0, value: '開啟側邊導覽' }],
26
+ 'ariaLabels.notifications': [{ type: 0, value: '通知' }],
27
+ 'ariaLabels.tools': [{ type: 0, value: '說明面板' }],
28
+ 'ariaLabels.toolsClose': [{ type: 0, value: '開啟說明面板' }],
29
+ 'ariaLabels.toolsToggle': [{ type: 0, value: '關閉說明面板' }],
30
+ },
31
+ 'date-picker': {
32
+ nextMonthAriaLabel: [{ type: 0, value: '下個月' }],
33
+ previousMonthAriaLabel: [{ type: 0, value: '上個月' }],
34
+ todayAriaLabel: [{ type: 0, value: '今天' }],
35
+ },
36
+ flashbar: {
37
+ 'i18nStrings.ariaLabel': [{ type: 0, value: '通知' }],
38
+ 'i18nStrings.errorIconAriaLabel': [{ type: 0, value: '錯誤' }],
39
+ 'i18nStrings.inProgressIconAriaLabel': [{ type: 0, value: '進行中' }],
40
+ 'i18nStrings.infoIconAriaLabel': [{ type: 0, value: '資訊' }],
41
+ 'i18nStrings.notificationBarAriaLabel': [{ type: 0, value: '所有通知' }],
42
+ 'i18nStrings.notificationBarText': [{ type: 0, value: '通知' }],
43
+ 'i18nStrings.successIconAriaLabel': [{ type: 0, value: '成功' }],
44
+ 'i18nStrings.warningIconAriaLabel': [{ type: 0, value: '警告' }],
45
+ },
46
+ form: { errorIconAriaLabel: [{ type: 0, value: '錯誤' }] },
47
+ 'form-field': { 'i18nStrings.errorIconAriaLabel': [{ type: 0, value: '錯誤' }] },
48
+ input: { clearAriaLabel: [{ type: 0, value: '清除' }] },
49
+ modal: { closeAriaLabel: [{ type: 0, value: '關閉強制回應' }] },
50
+ pagination: {
51
+ 'ariaLabels.nextPageLabel': [{ type: 0, value: '下一頁' }],
52
+ 'ariaLabels.pageLabel': [
53
+ { type: 0, value: '所有頁面中的第 ' },
54
+ { type: 1, value: 'pageNumber' },
55
+ { type: 0, value: ' 頁' },
56
+ ],
57
+ 'ariaLabels.previousPageLabel': [{ type: 0, value: '上一頁' }],
58
+ },
59
+ popover: { dismissAriaLabel: [{ type: 0, value: '關閉彈出視窗' }] },
60
+ 'property-filter': {
61
+ 'i18nStrings.allPropertiesLabel': [{ type: 0, value: '所有屬性' }],
62
+ 'i18nStrings.applyActionText': [{ type: 0, value: '套用' }],
63
+ 'i18nStrings.cancelActionText': [{ type: 0, value: '取消' }],
64
+ 'i18nStrings.clearFiltersText': [{ type: 0, value: '清除篩選條件' }],
65
+ 'i18nStrings.editTokenHeader': [{ type: 0, value: '編輯篩選條件' }],
66
+ 'i18nStrings.groupPropertiesText': [{ type: 0, value: '屬性' }],
67
+ 'i18nStrings.groupValuesText': [{ type: 0, value: '值' }],
68
+ 'i18nStrings.operationAndText': [{ type: 0, value: '和' }],
69
+ 'i18nStrings.operationOrText': [{ type: 0, value: '或' }],
70
+ 'i18nStrings.operatorContainsText': [{ type: 0, value: '包含' }],
71
+ 'i18nStrings.operatorDoesNotContainText': [{ type: 0, value: '不包含' }],
72
+ 'i18nStrings.operatorDoesNotEqualText': [{ type: 0, value: '不等於' }],
73
+ 'i18nStrings.operatorEqualsText': [{ type: 0, value: '等於' }],
74
+ 'i18nStrings.operatorGreaterOrEqualText': [{ type: 0, value: '大於或等於' }],
75
+ 'i18nStrings.operatorGreaterText': [{ type: 0, value: '大於' }],
76
+ 'i18nStrings.operatorLessOrEqualText': [{ type: 0, value: '小於或等於' }],
77
+ 'i18nStrings.operatorLessText': [{ type: 0, value: '小於' }],
78
+ 'i18nStrings.operatorText': [{ type: 0, value: '運算子' }],
79
+ 'i18nStrings.operatorsText': [{ type: 0, value: '運算子' }],
80
+ 'i18nStrings.propertyText': [{ type: 0, value: '屬性' }],
81
+ 'i18nStrings.tokenLimitShowFewer': [{ type: 0, value: '顯示較少' }],
82
+ 'i18nStrings.tokenLimitShowMore': [{ type: 0, value: '顯示更多' }],
83
+ 'i18nStrings.valueText': [{ type: 0, value: '值' }],
84
+ 'i18nStrings.removeTokenButtonAriaLabel': [
85
+ {
86
+ type: 5,
87
+ value: 'token__operator',
88
+ options: {
89
+ equals: {
90
+ value: [
91
+ { type: 0, value: '移除篩選條件,' },
92
+ { type: 1, value: 'token__propertyKey' },
93
+ { type: 0, value: ' 等於 ' },
94
+ { type: 1, value: 'token__value' },
95
+ ],
96
+ },
97
+ not_equals: {
98
+ value: [
99
+ { type: 0, value: '移除篩選條件,' },
100
+ { type: 1, value: 'token__propertyKey' },
101
+ { type: 0, value: ' 不等於 ' },
102
+ { type: 1, value: 'token__value' },
103
+ ],
104
+ },
105
+ greater_than: {
106
+ value: [
107
+ { type: 0, value: '移除篩選條件,' },
108
+ { type: 1, value: 'token__propertyKey' },
109
+ { type: 0, value: ' 大於 ' },
110
+ { type: 1, value: 'token__value' },
111
+ ],
112
+ },
113
+ greater_than_equal: {
114
+ value: [
115
+ { type: 0, value: '移除篩選條件,' },
116
+ { type: 1, value: 'token__propertyKey' },
117
+ { type: 0, value: ' 大於或等於 ' },
118
+ { type: 1, value: 'token__value' },
119
+ ],
120
+ },
121
+ less_than: {
122
+ value: [
123
+ { type: 0, value: '移除篩選條件,' },
124
+ { type: 1, value: 'token__propertyKey' },
125
+ { type: 0, value: ' 小於 ' },
126
+ { type: 1, value: 'token__value' },
127
+ ],
128
+ },
129
+ less_than_equal: {
130
+ value: [
131
+ { type: 0, value: '移除篩選條件,' },
132
+ { type: 1, value: 'token__propertyKey' },
133
+ { type: 0, value: ' 小於或等於 ' },
134
+ { type: 1, value: 'token__value' },
135
+ ],
136
+ },
137
+ contains: {
138
+ value: [
139
+ { type: 0, value: '移除篩選條件,' },
140
+ { type: 1, value: 'token__propertyKey' },
141
+ { type: 0, value: ' 包含 ' },
142
+ { type: 1, value: 'token__value' },
143
+ ],
144
+ },
145
+ not_contains: {
146
+ value: [
147
+ { type: 0, value: '移除篩選條件,' },
148
+ { type: 1, value: 'token__propertyKey' },
149
+ { type: 0, value: ' 不包含 ' },
150
+ { type: 1, value: 'token__value' },
151
+ ],
152
+ },
153
+ other: { value: [] },
154
+ },
155
+ },
156
+ ],
157
+ },
158
+ select: { errorIconAriaLabel: [{ type: 0, value: '錯誤' }], selectedAriaLabel: [{ type: 0, value: '已選取' }] },
159
+ wizard: { errorIconAriaLabel: [{ type: 0, value: '錯誤' }], selectedAriaLabel: [{ type: 0, value: '已選取' }] },
160
+ },
161
+ },
162
+ };
@@ -0,0 +1,168 @@
1
+ {
2
+ "@cloudscape-design/components": {
3
+ "zh-TW": {
4
+ "alert": { "dismissAriaLabel": [{ "type": 0, "value": "關閉提醒" }] },
5
+ "autosuggest": {
6
+ "stepNumberLabel": [
7
+ { "type": 0, "value": "步驟 " },
8
+ { "type": 1, "value": "stepNumber" }
9
+ ],
10
+ "collapsedStepsLabel": [
11
+ { "type": 0, "value": "步驟 " },
12
+ { "type": 1, "value": "stepNumber" },
13
+ { "type": 0, "value": ",共 " },
14
+ { "type": 1, "value": "stepsCount" },
15
+ { "type": 0, "value": " 步" }
16
+ ],
17
+ "cancelButton": [{ "type": 0, "value": "取消" }],
18
+ "previousButton": [{ "type": 0, "value": "上一步" }],
19
+ "nextButton": [{ "type": 0, "value": "下一步" }],
20
+ "optional": [{ "type": 0, "value": "選用" }]
21
+ },
22
+ "app-layout": {
23
+ "ariaLabels.navigation": [{ "type": 0, "value": "側邊導覽" }],
24
+ "ariaLabels.navigationClose": [{ "type": 0, "value": "關閉側邊導覽" }],
25
+ "ariaLabels.navigationToggle": [{ "type": 0, "value": "開啟側邊導覽" }],
26
+ "ariaLabels.notifications": [{ "type": 0, "value": "通知" }],
27
+ "ariaLabels.tools": [{ "type": 0, "value": "說明面板" }],
28
+ "ariaLabels.toolsClose": [{ "type": 0, "value": "開啟說明面板" }],
29
+ "ariaLabels.toolsToggle": [{ "type": 0, "value": "關閉說明面板" }]
30
+ },
31
+ "date-picker": {
32
+ "nextMonthAriaLabel": [{ "type": 0, "value": "下個月" }],
33
+ "previousMonthAriaLabel": [{ "type": 0, "value": "上個月" }],
34
+ "todayAriaLabel": [{ "type": 0, "value": "今天" }]
35
+ },
36
+ "flashbar": {
37
+ "i18nStrings.ariaLabel": [{ "type": 0, "value": "通知" }],
38
+ "i18nStrings.errorIconAriaLabel": [{ "type": 0, "value": "錯誤" }],
39
+ "i18nStrings.inProgressIconAriaLabel": [{ "type": 0, "value": "進行中" }],
40
+ "i18nStrings.infoIconAriaLabel": [{ "type": 0, "value": "資訊" }],
41
+ "i18nStrings.notificationBarAriaLabel": [{ "type": 0, "value": "所有通知" }],
42
+ "i18nStrings.notificationBarText": [{ "type": 0, "value": "通知" }],
43
+ "i18nStrings.successIconAriaLabel": [{ "type": 0, "value": "成功" }],
44
+ "i18nStrings.warningIconAriaLabel": [{ "type": 0, "value": "警告" }]
45
+ },
46
+ "form": { "errorIconAriaLabel": [{ "type": 0, "value": "錯誤" }] },
47
+ "form-field": { "i18nStrings.errorIconAriaLabel": [{ "type": 0, "value": "錯誤" }] },
48
+ "input": { "clearAriaLabel": [{ "type": 0, "value": "清除" }] },
49
+ "modal": { "closeAriaLabel": [{ "type": 0, "value": "關閉強制回應" }] },
50
+ "pagination": {
51
+ "ariaLabels.nextPageLabel": [{ "type": 0, "value": "下一頁" }],
52
+ "ariaLabels.pageLabel": [
53
+ { "type": 0, "value": "所有頁面中的第 " },
54
+ { "type": 1, "value": "pageNumber" },
55
+ { "type": 0, "value": " 頁" }
56
+ ],
57
+ "ariaLabels.previousPageLabel": [{ "type": 0, "value": "上一頁" }]
58
+ },
59
+ "popover": { "dismissAriaLabel": [{ "type": 0, "value": "關閉彈出視窗" }] },
60
+ "property-filter": {
61
+ "i18nStrings.allPropertiesLabel": [{ "type": 0, "value": "所有屬性" }],
62
+ "i18nStrings.applyActionText": [{ "type": 0, "value": "套用" }],
63
+ "i18nStrings.cancelActionText": [{ "type": 0, "value": "取消" }],
64
+ "i18nStrings.clearFiltersText": [{ "type": 0, "value": "清除篩選條件" }],
65
+ "i18nStrings.editTokenHeader": [{ "type": 0, "value": "編輯篩選條件" }],
66
+ "i18nStrings.groupPropertiesText": [{ "type": 0, "value": "屬性" }],
67
+ "i18nStrings.groupValuesText": [{ "type": 0, "value": "值" }],
68
+ "i18nStrings.operationAndText": [{ "type": 0, "value": "和" }],
69
+ "i18nStrings.operationOrText": [{ "type": 0, "value": "或" }],
70
+ "i18nStrings.operatorContainsText": [{ "type": 0, "value": "包含" }],
71
+ "i18nStrings.operatorDoesNotContainText": [{ "type": 0, "value": "不包含" }],
72
+ "i18nStrings.operatorDoesNotEqualText": [{ "type": 0, "value": "不等於" }],
73
+ "i18nStrings.operatorEqualsText": [{ "type": 0, "value": "等於" }],
74
+ "i18nStrings.operatorGreaterOrEqualText": [{ "type": 0, "value": "大於或等於" }],
75
+ "i18nStrings.operatorGreaterText": [{ "type": 0, "value": "大於" }],
76
+ "i18nStrings.operatorLessOrEqualText": [{ "type": 0, "value": "小於或等於" }],
77
+ "i18nStrings.operatorLessText": [{ "type": 0, "value": "小於" }],
78
+ "i18nStrings.operatorText": [{ "type": 0, "value": "運算子" }],
79
+ "i18nStrings.operatorsText": [{ "type": 0, "value": "運算子" }],
80
+ "i18nStrings.propertyText": [{ "type": 0, "value": "屬性" }],
81
+ "i18nStrings.tokenLimitShowFewer": [{ "type": 0, "value": "顯示較少" }],
82
+ "i18nStrings.tokenLimitShowMore": [{ "type": 0, "value": "顯示更多" }],
83
+ "i18nStrings.valueText": [{ "type": 0, "value": "值" }],
84
+ "i18nStrings.removeTokenButtonAriaLabel": [
85
+ {
86
+ "type": 5,
87
+ "value": "token__operator",
88
+ "options": {
89
+ "equals": {
90
+ "value": [
91
+ { "type": 0, "value": "移除篩選條件," },
92
+ { "type": 1, "value": "token__propertyKey" },
93
+ { "type": 0, "value": " 等於 " },
94
+ { "type": 1, "value": "token__value" }
95
+ ]
96
+ },
97
+ "not_equals": {
98
+ "value": [
99
+ { "type": 0, "value": "移除篩選條件," },
100
+ { "type": 1, "value": "token__propertyKey" },
101
+ { "type": 0, "value": " 不等於 " },
102
+ { "type": 1, "value": "token__value" }
103
+ ]
104
+ },
105
+ "greater_than": {
106
+ "value": [
107
+ { "type": 0, "value": "移除篩選條件," },
108
+ { "type": 1, "value": "token__propertyKey" },
109
+ { "type": 0, "value": " 大於 " },
110
+ { "type": 1, "value": "token__value" }
111
+ ]
112
+ },
113
+ "greater_than_equal": {
114
+ "value": [
115
+ { "type": 0, "value": "移除篩選條件," },
116
+ { "type": 1, "value": "token__propertyKey" },
117
+ { "type": 0, "value": " 大於或等於 " },
118
+ { "type": 1, "value": "token__value" }
119
+ ]
120
+ },
121
+ "less_than": {
122
+ "value": [
123
+ { "type": 0, "value": "移除篩選條件," },
124
+ { "type": 1, "value": "token__propertyKey" },
125
+ { "type": 0, "value": " 小於 " },
126
+ { "type": 1, "value": "token__value" }
127
+ ]
128
+ },
129
+ "less_than_equal": {
130
+ "value": [
131
+ { "type": 0, "value": "移除篩選條件," },
132
+ { "type": 1, "value": "token__propertyKey" },
133
+ { "type": 0, "value": " 小於或等於 " },
134
+ { "type": 1, "value": "token__value" }
135
+ ]
136
+ },
137
+ "contains": {
138
+ "value": [
139
+ { "type": 0, "value": "移除篩選條件," },
140
+ { "type": 1, "value": "token__propertyKey" },
141
+ { "type": 0, "value": " 包含 " },
142
+ { "type": 1, "value": "token__value" }
143
+ ]
144
+ },
145
+ "not_contains": {
146
+ "value": [
147
+ { "type": 0, "value": "移除篩選條件," },
148
+ { "type": 1, "value": "token__propertyKey" },
149
+ { "type": 0, "value": " 不包含 " },
150
+ { "type": 1, "value": "token__value" }
151
+ ]
152
+ },
153
+ "other": { "value": [] }
154
+ }
155
+ }
156
+ ]
157
+ },
158
+ "select": {
159
+ "errorIconAriaLabel": [{ "type": 0, "value": "錯誤" }],
160
+ "selectedAriaLabel": [{ "type": 0, "value": "已選取" }]
161
+ },
162
+ "wizard": {
163
+ "errorIconAriaLabel": [{ "type": 0, "value": "錯誤" }],
164
+ "selectedAriaLabel": [{ "type": 0, "value": "已選取" }]
165
+ }
166
+ }
167
+ }
168
+ }
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { MessageFormatElement } from '@formatjs/icu-messageformat-parser';
3
+ export interface I18nProviderProps {
4
+ messages: ReadonlyArray<I18nProviderProps.Messages>;
5
+ locale?: string;
6
+ children: React.ReactNode;
7
+ }
8
+ export declare namespace I18nProviderProps {
9
+ interface Messages {
10
+ [namespace: string]: {
11
+ [locale: string]: {
12
+ [component: string]: {
13
+ [key: string]: string | MessageFormatElement[];
14
+ };
15
+ };
16
+ };
17
+ }
18
+ }
19
+ export declare function I18nProvider({ messages: messagesArray, locale: providedLocale, children }: I18nProviderProps): JSX.Element;
20
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../src/internal/i18n/provider.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAI1E,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,aAAa,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,yBAAiB,iBAAiB,CAAC;IACjC,UAAiB,QAAQ;QACvB,CAAC,SAAS,EAAE,MAAM,GAAG;YACnB,CAAC,MAAM,EAAE,MAAM,GAAG;gBAChB,CAAC,SAAS,EAAE,MAAM,GAAG;oBACnB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,oBAAoB,EAAE,CAAC;iBAChD,CAAC;aACH,CAAC;SACH,CAAC;KACH;CACF;AASD,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,iBAAiB,eAuD5G"}
@@ -0,0 +1,90 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import React, { useContext } from 'react';
4
+ import IntlMessageFormat from 'intl-messageformat';
5
+ import { InternalI18nContext } from './context';
6
+ /**
7
+ * Context to send parent messages down to child I18nProviders. This isn't
8
+ * included in the InternalI18nContext to avoid components from depending on
9
+ * MessageFormatElement types.
10
+ */
11
+ const I18nMessagesContext = React.createContext({});
12
+ export function I18nProvider({ messages: messagesArray, locale: providedLocale, children }) {
13
+ // The provider accepts an array of configs. We merge parent messages and
14
+ // flatten the tree early on so that accesses by key are simpler and faster.
15
+ const parentMessages = useContext(I18nMessagesContext);
16
+ const messages = mergeMessages([parentMessages, ...messagesArray]);
17
+ // If a locale isn't provided, we can try and guess from the html lang,
18
+ // and lastly default to English. Locales have a recommended case, but are
19
+ // matched case-insensitively, so we lowercase it internally.
20
+ const locale = (providedLocale || (document === null || document === void 0 ? void 0 : document.documentElement.lang) || 'en').toLowerCase();
21
+ const format = (namespace, component, key, provided, customHandler) => {
22
+ var _a, _b, _c;
23
+ // A general rule in the library is that undefined is basically
24
+ // treated as "not provided". So even if a user explicitly provides an
25
+ // undefined value, it will default to i18n values.
26
+ if (provided !== undefined) {
27
+ return provided;
28
+ }
29
+ // Widen the locale string (e.g. en-GB -> en) until we find a locale
30
+ // that contains the message we need.
31
+ let message;
32
+ const matchableLocales = getMatchableLocales(locale);
33
+ for (const matchableLocale of matchableLocales) {
34
+ const localeMessage = (_c = (_b = (_a = messages === null || messages === void 0 ? void 0 : messages[namespace]) === null || _a === void 0 ? void 0 : _a[matchableLocale]) === null || _b === void 0 ? void 0 : _b[component]) === null || _c === void 0 ? void 0 : _c[key];
35
+ if (localeMessage !== undefined) {
36
+ message = localeMessage;
37
+ break;
38
+ }
39
+ }
40
+ // If a message wasn't found, exit early.
41
+ if (message === undefined) {
42
+ return provided;
43
+ }
44
+ const intlMessageFormat = new IntlMessageFormat(message, locale);
45
+ if (customHandler) {
46
+ return customHandler(args => intlMessageFormat.format(args));
47
+ }
48
+ // Assuming `T extends string` since a customHandler wasn't provided.
49
+ return intlMessageFormat.format();
50
+ };
51
+ return (React.createElement(InternalI18nContext.Provider, { value: format },
52
+ React.createElement(I18nMessagesContext.Provider, { value: messages }, children)));
53
+ }
54
+ function mergeMessages(sources) {
55
+ const result = {};
56
+ for (const messages of sources) {
57
+ for (const namespace in messages) {
58
+ if (!(namespace in result)) {
59
+ result[namespace] = {};
60
+ }
61
+ for (const casedLocale in messages[namespace]) {
62
+ const locale = casedLocale.toLowerCase();
63
+ if (!(locale in result[namespace])) {
64
+ result[namespace][locale] = {};
65
+ }
66
+ for (const component in messages[namespace][casedLocale]) {
67
+ if (!(component in result[namespace][locale])) {
68
+ result[namespace][locale][component] = {};
69
+ }
70
+ for (const key in messages[namespace][casedLocale][component]) {
71
+ result[namespace][locale][component][key] = messages[namespace][casedLocale][component][key];
72
+ }
73
+ }
74
+ }
75
+ }
76
+ }
77
+ return result;
78
+ }
79
+ function getMatchableLocales(ietfLanguageTag) {
80
+ const parts = ietfLanguageTag.split('-');
81
+ if (parts.length === 1) {
82
+ return [ietfLanguageTag];
83
+ }
84
+ const localeStrings = [];
85
+ for (let i = parts.length; i > 0; i--) {
86
+ localeStrings.push(parts.slice(0, i).join('-'));
87
+ }
88
+ return localeStrings;
89
+ }
90
+ //# sourceMappingURL=provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../../src/internal/i18n/provider.tsx"],"names":[],"mappings":"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","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useContext } from 'react';\nimport IntlMessageFormat from 'intl-messageformat';\nimport { MessageFormatElement } from '@formatjs/icu-messageformat-parser';\n\nimport { InternalI18nContext, FormatFunction, CustomHandler } from './context';\n\nexport interface I18nProviderProps {\n messages: ReadonlyArray<I18nProviderProps.Messages>;\n locale?: string;\n children: React.ReactNode;\n}\n\nexport namespace I18nProviderProps {\n export interface Messages {\n [namespace: string]: {\n [locale: string]: {\n [component: string]: {\n [key: string]: string | MessageFormatElement[];\n };\n };\n };\n }\n}\n\n/**\n * Context to send parent messages down to child I18nProviders. This isn't\n * included in the InternalI18nContext to avoid components from depending on\n * MessageFormatElement types.\n */\nconst I18nMessagesContext = React.createContext<I18nProviderProps.Messages>({});\n\nexport function I18nProvider({ messages: messagesArray, locale: providedLocale, children }: I18nProviderProps) {\n // The provider accepts an array of configs. We merge parent messages and\n // flatten the tree early on so that accesses by key are simpler and faster.\n const parentMessages = useContext(I18nMessagesContext);\n const messages = mergeMessages([parentMessages, ...messagesArray]);\n\n // If a locale isn't provided, we can try and guess from the html lang,\n // and lastly default to English. Locales have a recommended case, but are\n // matched case-insensitively, so we lowercase it internally.\n const locale = (providedLocale || document?.documentElement.lang || 'en').toLowerCase();\n\n const format: FormatFunction = <T,>(\n namespace: string,\n component: string,\n key: string,\n provided: T,\n customHandler?: CustomHandler<T>\n ): T => {\n // A general rule in the library is that undefined is basically\n // treated as \"not provided\". So even if a user explicitly provides an\n // undefined value, it will default to i18n values.\n if (provided !== undefined) {\n return provided;\n }\n\n // Widen the locale string (e.g. en-GB -> en) until we find a locale\n // that contains the message we need.\n let message: string | MessageFormatElement[] | undefined;\n const matchableLocales = getMatchableLocales(locale);\n for (const matchableLocale of matchableLocales) {\n const localeMessage = messages?.[namespace]?.[matchableLocale]?.[component]?.[key];\n if (localeMessage !== undefined) {\n message = localeMessage;\n break;\n }\n }\n\n // If a message wasn't found, exit early.\n if (message === undefined) {\n return provided;\n }\n\n const intlMessageFormat = new IntlMessageFormat(message, locale);\n if (customHandler) {\n return customHandler(args => intlMessageFormat.format(args) as string);\n }\n // Assuming `T extends string` since a customHandler wasn't provided.\n return intlMessageFormat.format() as T;\n };\n\n return (\n <InternalI18nContext.Provider value={format}>\n <I18nMessagesContext.Provider value={messages}>{children}</I18nMessagesContext.Provider>\n </InternalI18nContext.Provider>\n );\n}\n\nfunction mergeMessages(sources: ReadonlyArray<I18nProviderProps.Messages>): I18nProviderProps.Messages {\n const result: I18nProviderProps.Messages = {};\n for (const messages of sources) {\n for (const namespace in messages) {\n if (!(namespace in result)) {\n result[namespace] = {};\n }\n for (const casedLocale in messages[namespace]) {\n const locale = casedLocale.toLowerCase();\n if (!(locale in result[namespace])) {\n result[namespace][locale] = {};\n }\n for (const component in messages[namespace][casedLocale]) {\n if (!(component in result[namespace][locale])) {\n result[namespace][locale][component] = {};\n }\n for (const key in messages[namespace][casedLocale][component]) {\n result[namespace][locale][component][key] = messages[namespace][casedLocale][component][key];\n }\n }\n }\n }\n }\n return result;\n}\n\nfunction getMatchableLocales(ietfLanguageTag: string): string[] {\n const parts = ietfLanguageTag.split('-');\n if (parts.length === 1) {\n return [ietfLanguageTag];\n }\n\n const localeStrings: string[] = [];\n for (let i = parts.length; i > 0; i--) {\n localeStrings.push(parts.slice(0, i).join('-'));\n }\n return localeStrings;\n}\n"]}
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "dce5e7163f2b6751bc147ac6c0352778d1dbb400"
2
+ "commit": "f53ef7ce941781154de29f6072011f60eca678f4"
3
3
  }