@cloudscape-design/components 3.0.234 → 3.0.236

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 (134) hide show
  1. package/app-layout/drawer/index.d.ts +2 -5
  2. package/app-layout/drawer/index.d.ts.map +1 -1
  3. package/app-layout/drawer/index.js.map +1 -1
  4. package/app-layout/index.d.ts.map +1 -1
  5. package/app-layout/index.js +20 -15
  6. package/app-layout/index.js.map +1 -1
  7. package/app-layout/utils/use-focus-control.d.ts +8 -6
  8. package/app-layout/utils/use-focus-control.d.ts.map +1 -1
  9. package/app-layout/utils/use-focus-control.js +21 -10
  10. package/app-layout/utils/use-focus-control.js.map +1 -1
  11. package/app-layout/utils/use-split-panel-focus-control.d.ts +21 -0
  12. package/app-layout/utils/use-split-panel-focus-control.d.ts.map +1 -0
  13. package/app-layout/utils/use-split-panel-focus-control.js +32 -0
  14. package/app-layout/utils/use-split-panel-focus-control.js.map +1 -0
  15. package/app-layout/visual-refresh/app-bar.d.ts.map +1 -1
  16. package/app-layout/visual-refresh/app-bar.js +3 -6
  17. package/app-layout/visual-refresh/app-bar.js.map +1 -1
  18. package/app-layout/visual-refresh/context.d.ts +6 -2
  19. package/app-layout/visual-refresh/context.d.ts.map +1 -1
  20. package/app-layout/visual-refresh/context.js +24 -11
  21. package/app-layout/visual-refresh/context.js.map +1 -1
  22. package/app-layout/visual-refresh/navigation.d.ts.map +1 -1
  23. package/app-layout/visual-refresh/navigation.js +3 -5
  24. package/app-layout/visual-refresh/navigation.js.map +1 -1
  25. package/app-layout/visual-refresh/split-panel.d.ts.map +1 -1
  26. package/app-layout/visual-refresh/split-panel.js +4 -8
  27. package/app-layout/visual-refresh/split-panel.js.map +1 -1
  28. package/app-layout/visual-refresh/tools.js +5 -6
  29. package/app-layout/visual-refresh/tools.js.map +1 -1
  30. package/autosuggest/internal.d.ts.map +1 -1
  31. package/autosuggest/internal.js +10 -4
  32. package/autosuggest/internal.js.map +1 -1
  33. package/breadcrumb-group/internal.d.ts.map +1 -1
  34. package/breadcrumb-group/internal.js +2 -2
  35. package/breadcrumb-group/internal.js.map +1 -1
  36. package/breadcrumb-group/styles.css.js +7 -6
  37. package/breadcrumb-group/styles.scoped.css +14 -11
  38. package/breadcrumb-group/styles.selectors.js +7 -6
  39. package/calendar/grid/index.d.ts +1 -1
  40. package/calendar/grid/index.d.ts.map +1 -1
  41. package/calendar/grid/index.js.map +1 -1
  42. package/calendar/header/header-button.d.ts +1 -1
  43. package/calendar/header/header-button.d.ts.map +1 -1
  44. package/calendar/header/header-button.js.map +1 -1
  45. package/calendar/header/index.d.ts +2 -2
  46. package/calendar/header/index.d.ts.map +1 -1
  47. package/calendar/header/index.js.map +1 -1
  48. package/calendar/interfaces.d.ts +3 -3
  49. package/calendar/interfaces.d.ts.map +1 -1
  50. package/calendar/interfaces.js.map +1 -1
  51. package/calendar/internal.d.ts +1 -1
  52. package/calendar/internal.d.ts.map +1 -1
  53. package/calendar/internal.js +6 -1
  54. package/calendar/internal.js.map +1 -1
  55. package/date-picker/index.d.ts.map +1 -1
  56. package/date-picker/index.js +6 -4
  57. package/date-picker/index.js.map +1 -1
  58. package/internal/context/split-panel-context.d.ts +2 -8
  59. package/internal/context/split-panel-context.d.ts.map +1 -1
  60. package/internal/context/split-panel-context.js.map +1 -1
  61. package/internal/environment.js +1 -1
  62. package/internal/i18n/context.d.ts +6 -1
  63. package/internal/i18n/context.d.ts.map +1 -1
  64. package/internal/i18n/context.js +7 -7
  65. package/internal/i18n/context.js.map +1 -1
  66. package/internal/i18n/messages/all.all.js +219 -210
  67. package/internal/i18n/messages/all.all.json +231 -231
  68. package/internal/i18n/messages/all.de.js +20 -20
  69. package/internal/i18n/messages/all.de.json +20 -20
  70. package/internal/i18n/messages/all.en-GB.js +20 -20
  71. package/internal/i18n/messages/all.en-GB.json +20 -20
  72. package/internal/i18n/messages/all.en.js +20 -20
  73. package/internal/i18n/messages/all.en.json +20 -20
  74. package/internal/i18n/messages/all.es.js +20 -20
  75. package/internal/i18n/messages/all.es.json +20 -20
  76. package/internal/i18n/messages/all.fr.js +20 -20
  77. package/internal/i18n/messages/all.fr.json +20 -20
  78. package/internal/i18n/messages/all.id.js +20 -20
  79. package/internal/i18n/messages/all.id.json +20 -20
  80. package/internal/i18n/messages/all.it.js +20 -20
  81. package/internal/i18n/messages/all.it.json +20 -20
  82. package/internal/i18n/messages/all.ja.js +20 -20
  83. package/internal/i18n/messages/all.ja.json +20 -20
  84. package/internal/i18n/messages/all.ko.js +22 -19
  85. package/internal/i18n/messages/all.ko.json +20 -20
  86. package/internal/i18n/messages/all.pt-BR.js +20 -20
  87. package/internal/i18n/messages/all.pt-BR.json +20 -20
  88. package/internal/i18n/messages/all.zh-CN.js +24 -21
  89. package/internal/i18n/messages/all.zh-CN.json +22 -22
  90. package/internal/i18n/messages/all.zh-TW.js +23 -20
  91. package/internal/i18n/messages/all.zh-TW.json +21 -21
  92. package/internal/i18n/provider.d.ts.map +1 -1
  93. package/internal/i18n/provider.js +20 -5
  94. package/internal/i18n/provider.js.map +1 -1
  95. package/internal/manifest.json +1 -1
  96. package/package.json +1 -1
  97. package/property-filter/index.js.map +1 -1
  98. package/select/parts/styles.css.js +9 -9
  99. package/select/parts/styles.scoped.css +9 -27
  100. package/select/parts/styles.selectors.js +9 -9
  101. package/split-panel/index.d.ts.map +1 -1
  102. package/split-panel/index.js +6 -24
  103. package/split-panel/index.js.map +1 -1
  104. package/table/body-cell/use-stable-scroll-position.d.ts.map +1 -1
  105. package/table/body-cell/use-stable-scroll-position.js +10 -4
  106. package/table/body-cell/use-stable-scroll-position.js.map +1 -1
  107. package/table/header-cell/index.js +2 -3
  108. package/table/header-cell/index.js.map +1 -1
  109. package/table/use-table-focus-navigation.d.ts +1 -1
  110. package/table/use-table-focus-navigation.d.ts.map +1 -1
  111. package/table/use-table-focus-navigation.js +4 -4
  112. package/table/use-table-focus-navigation.js.map +1 -1
  113. package/tutorial-panel/components/tutorial-list/index.d.ts +0 -1
  114. package/tutorial-panel/components/tutorial-list/index.d.ts.map +1 -1
  115. package/tutorial-panel/components/tutorial-list/index.js +3 -15
  116. package/tutorial-panel/components/tutorial-list/index.js.map +1 -1
  117. package/tutorial-panel/index.d.ts.map +1 -1
  118. package/tutorial-panel/index.js +2 -14
  119. package/tutorial-panel/index.js.map +1 -1
  120. package/tutorial-panel/interfaces.d.ts +1 -1
  121. package/tutorial-panel/interfaces.d.ts.map +1 -1
  122. package/tutorial-panel/interfaces.js.map +1 -1
  123. package/wizard/index.d.ts +1 -1
  124. package/wizard/index.d.ts.map +1 -1
  125. package/wizard/index.js +4 -1
  126. package/wizard/index.js.map +1 -1
  127. package/wizard/interfaces.d.ts +5 -5
  128. package/wizard/interfaces.d.ts.map +1 -1
  129. package/wizard/interfaces.js.map +1 -1
  130. package/wizard/wizard-actions.d.ts +3 -3
  131. package/wizard/wizard-actions.d.ts.map +1 -1
  132. package/wizard/wizard-actions.js.map +1 -1
  133. package/wizard/wizard-form.js +2 -1
  134. package/wizard/wizard-form.js.map +1 -1
@@ -2,22 +2,6 @@ export default {
2
2
  '@cloudscape-design/components': {
3
3
  'pt-BR': {
4
4
  alert: { dismissAriaLabel: [{ type: 0, value: 'Descartar alerta' }] },
5
- autosuggest: {
6
- stepNumberLabel: [
7
- { type: 0, value: 'Etapa ' },
8
- { type: 1, value: 'stepNumber' },
9
- ],
10
- collapsedStepsLabel: [
11
- { type: 0, value: 'Etapa ' },
12
- { type: 1, value: 'stepNumber' },
13
- { type: 0, value: ' de ' },
14
- { type: 1, value: 'stepsCount' },
15
- ],
16
- cancelButton: [{ type: 0, value: 'Cancelar' }],
17
- previousButton: [{ type: 0, value: 'Anterior' }],
18
- nextButton: [{ type: 0, value: 'Próximo' }],
19
- optional: [{ type: 0, value: 'opcional' }],
20
- },
21
5
  'app-layout': {
22
6
  'ariaLabels.navigation': [{ type: 0, value: 'Navegação lateral' }],
23
7
  'ariaLabels.navigationClose': [{ type: 0, value: 'Fechar navegação lateral' }],
@@ -27,7 +11,11 @@ export default {
27
11
  'ariaLabels.toolsClose': [{ type: 0, value: 'Abrir o painel de ajuda' }],
28
12
  'ariaLabels.toolsToggle': [{ type: 0, value: 'Fechar o painel de ajuda' }],
29
13
  },
30
- 'date-picker': {
14
+ autosuggest: {
15
+ errorIconAriaLabel: [{ type: 0, value: 'Erro' }],
16
+ selectedAriaLabel: [{ type: 0, value: 'Selecionado' }],
17
+ },
18
+ calendar: {
31
19
  nextMonthAriaLabel: [{ type: 0, value: 'Próximo mês' }],
32
20
  previousMonthAriaLabel: [{ type: 0, value: 'Mês anterior' }],
33
21
  todayAriaLabel: [{ type: 0, value: 'Hoje' }],
@@ -42,8 +30,8 @@ export default {
42
30
  'i18nStrings.successIconAriaLabel': [{ type: 0, value: 'Com êxito' }],
43
31
  'i18nStrings.warningIconAriaLabel': [{ type: 0, value: 'Aviso' }],
44
32
  },
45
- form: { errorIconAriaLabel: [{ type: 0, value: 'Erro' }] },
46
33
  'form-field': { 'i18nStrings.errorIconAriaLabel': [{ type: 0, value: 'Erro' }] },
34
+ form: { errorIconAriaLabel: [{ type: 0, value: 'Erro' }] },
47
35
  input: { clearAriaLabel: [{ type: 0, value: 'Limpar' }] },
48
36
  modal: { closeAriaLabel: [{ type: 0, value: 'Fechar modal' }] },
49
37
  pagination: {
@@ -159,8 +147,20 @@ export default {
159
147
  selectedAriaLabel: [{ type: 0, value: 'Selecionado' }],
160
148
  },
161
149
  wizard: {
162
- errorIconAriaLabel: [{ type: 0, value: 'Erro' }],
163
- selectedAriaLabel: [{ type: 0, value: 'Selecionado' }],
150
+ 'i18nStrings.stepNumberLabel': [
151
+ { type: 0, value: 'Etapa ' },
152
+ { type: 1, value: 'stepNumber' },
153
+ ],
154
+ 'i18nStrings.collapsedStepsLabel': [
155
+ { type: 0, value: 'Etapa ' },
156
+ { type: 1, value: 'stepNumber' },
157
+ { type: 0, value: ' de ' },
158
+ { type: 1, value: 'stepsCount' },
159
+ ],
160
+ 'i18nStrings.cancelButton': [{ type: 0, value: 'Cancelar' }],
161
+ 'i18nStrings.previousButton': [{ type: 0, value: 'Anterior' }],
162
+ 'i18nStrings.nextButton': [{ type: 0, value: 'Próximo' }],
163
+ 'i18nStrings.optional': [{ type: 0, value: 'opcional' }],
164
164
  },
165
165
  },
166
166
  },
@@ -2,22 +2,6 @@
2
2
  "@cloudscape-design/components": {
3
3
  "pt-BR": {
4
4
  "alert": { "dismissAriaLabel": [{ "type": 0, "value": "Descartar alerta" }] },
5
- "autosuggest": {
6
- "stepNumberLabel": [
7
- { "type": 0, "value": "Etapa " },
8
- { "type": 1, "value": "stepNumber" }
9
- ],
10
- "collapsedStepsLabel": [
11
- { "type": 0, "value": "Etapa " },
12
- { "type": 1, "value": "stepNumber" },
13
- { "type": 0, "value": " de " },
14
- { "type": 1, "value": "stepsCount" }
15
- ],
16
- "cancelButton": [{ "type": 0, "value": "Cancelar" }],
17
- "previousButton": [{ "type": 0, "value": "Anterior" }],
18
- "nextButton": [{ "type": 0, "value": "Próximo" }],
19
- "optional": [{ "type": 0, "value": "opcional" }]
20
- },
21
5
  "app-layout": {
22
6
  "ariaLabels.navigation": [{ "type": 0, "value": "Navegação lateral" }],
23
7
  "ariaLabels.navigationClose": [{ "type": 0, "value": "Fechar navegação lateral" }],
@@ -27,7 +11,11 @@
27
11
  "ariaLabels.toolsClose": [{ "type": 0, "value": "Abrir o painel de ajuda" }],
28
12
  "ariaLabels.toolsToggle": [{ "type": 0, "value": "Fechar o painel de ajuda" }]
29
13
  },
30
- "date-picker": {
14
+ "autosuggest": {
15
+ "errorIconAriaLabel": [{ "type": 0, "value": "Erro" }],
16
+ "selectedAriaLabel": [{ "type": 0, "value": "Selecionado" }]
17
+ },
18
+ "calendar": {
31
19
  "nextMonthAriaLabel": [{ "type": 0, "value": "Próximo mês" }],
32
20
  "previousMonthAriaLabel": [{ "type": 0, "value": "Mês anterior" }],
33
21
  "todayAriaLabel": [{ "type": 0, "value": "Hoje" }]
@@ -42,8 +30,8 @@
42
30
  "i18nStrings.successIconAriaLabel": [{ "type": 0, "value": "Com êxito" }],
43
31
  "i18nStrings.warningIconAriaLabel": [{ "type": 0, "value": "Aviso" }]
44
32
  },
45
- "form": { "errorIconAriaLabel": [{ "type": 0, "value": "Erro" }] },
46
33
  "form-field": { "i18nStrings.errorIconAriaLabel": [{ "type": 0, "value": "Erro" }] },
34
+ "form": { "errorIconAriaLabel": [{ "type": 0, "value": "Erro" }] },
47
35
  "input": { "clearAriaLabel": [{ "type": 0, "value": "Limpar" }] },
48
36
  "modal": { "closeAriaLabel": [{ "type": 0, "value": "Fechar modal" }] },
49
37
  "pagination": {
@@ -159,8 +147,20 @@
159
147
  "selectedAriaLabel": [{ "type": 0, "value": "Selecionado" }]
160
148
  },
161
149
  "wizard": {
162
- "errorIconAriaLabel": [{ "type": 0, "value": "Erro" }],
163
- "selectedAriaLabel": [{ "type": 0, "value": "Selecionado" }]
150
+ "i18nStrings.stepNumberLabel": [
151
+ { "type": 0, "value": "Etapa " },
152
+ { "type": 1, "value": "stepNumber" }
153
+ ],
154
+ "i18nStrings.collapsedStepsLabel": [
155
+ { "type": 0, "value": "Etapa " },
156
+ { "type": 1, "value": "stepNumber" },
157
+ { "type": 0, "value": " de " },
158
+ { "type": 1, "value": "stepsCount" }
159
+ ],
160
+ "i18nStrings.cancelButton": [{ "type": 0, "value": "Cancelar" }],
161
+ "i18nStrings.previousButton": [{ "type": 0, "value": "Anterior" }],
162
+ "i18nStrings.nextButton": [{ "type": 0, "value": "Próximo" }],
163
+ "i18nStrings.optional": [{ "type": 0, "value": "opcional" }]
164
164
  }
165
165
  }
166
166
  }
@@ -2,24 +2,6 @@ export default {
2
2
  '@cloudscape-design/components': {
3
3
  'zh-CN': {
4
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
5
  'app-layout': {
24
6
  'ariaLabels.navigation': [{ type: 0, value: '侧导航' }],
25
7
  'ariaLabels.navigationClose': [{ type: 0, value: '关闭侧导航' }],
@@ -29,7 +11,11 @@ export default {
29
11
  'ariaLabels.toolsClose': [{ type: 0, value: '打开帮助面板' }],
30
12
  'ariaLabels.toolsToggle': [{ type: 0, value: '关闭帮助面板' }],
31
13
  },
32
- 'date-picker': {
14
+ autosuggest: {
15
+ errorIconAriaLabel: [{ type: 0, value: '错误' }],
16
+ selectedAriaLabel: [{ type: 0, value: '已选定' }],
17
+ },
18
+ calendar: {
33
19
  nextMonthAriaLabel: [{ type: 0, value: '下个月' }],
34
20
  previousMonthAriaLabel: [{ type: 0, value: '上个月' }],
35
21
  todayAriaLabel: [{ type: 0, value: '今天' }],
@@ -44,8 +30,8 @@ export default {
44
30
  'i18nStrings.successIconAriaLabel': [{ type: 0, value: '成功' }],
45
31
  'i18nStrings.warningIconAriaLabel': [{ type: 0, value: '警告' }],
46
32
  },
47
- form: { errorIconAriaLabel: [{ type: 0, value: '错误' }] },
48
33
  'form-field': { 'i18nStrings.errorIconAriaLabel': [{ type: 0, value: '错误' }] },
34
+ form: { errorIconAriaLabel: [{ type: 0, value: '错误' }] },
49
35
  input: { clearAriaLabel: [{ type: 0, value: '清除' }] },
50
36
  modal: { closeAriaLabel: [{ type: 0, value: '关闭模态' }] },
51
37
  pagination: {
@@ -157,7 +143,24 @@ export default {
157
143
  ],
158
144
  },
159
145
  select: { errorIconAriaLabel: [{ type: 0, value: '错误' }], selectedAriaLabel: [{ type: 0, value: '已选定' }] },
160
- wizard: { errorIconAriaLabel: [{ type: 0, value: '错误' }], selectedAriaLabel: [{ type: 0, value: '已选定' }] },
146
+ wizard: {
147
+ 'i18nStrings.stepNumberLabel': [
148
+ { type: 0, value: '第 ' },
149
+ { type: 1, value: 'stepNumber' },
150
+ { type: 0, value: ' 步' },
151
+ ],
152
+ 'i18nStrings.collapsedStepsLabel': [
153
+ { type: 0, value: '第 ' },
154
+ { type: 1, value: 'stepNumber' },
155
+ { type: 0, value: ' 步,共 ' },
156
+ { type: 1, value: 'stepsCount' },
157
+ { type: 0, value: ' 步' },
158
+ ],
159
+ 'i18nStrings.cancelButton': [{ type: 0, value: '取消' }],
160
+ 'i18nStrings.previousButton': [{ type: 0, value: '上一步' }],
161
+ 'i18nStrings.nextButton': [{ type: 0, value: '下一步' }],
162
+ 'i18nStrings.optional': [{ type: 0, value: '可选' }],
163
+ },
161
164
  },
162
165
  },
163
166
  };
@@ -2,24 +2,6 @@
2
2
  "@cloudscape-design/components": {
3
3
  "zh-CN": {
4
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
5
  "app-layout": {
24
6
  "ariaLabels.navigation": [{ "type": 0, "value": "侧导航" }],
25
7
  "ariaLabels.navigationClose": [{ "type": 0, "value": "关闭侧导航" }],
@@ -29,7 +11,11 @@
29
11
  "ariaLabels.toolsClose": [{ "type": 0, "value": "打开帮助面板" }],
30
12
  "ariaLabels.toolsToggle": [{ "type": 0, "value": "关闭帮助面板" }]
31
13
  },
32
- "date-picker": {
14
+ "autosuggest": {
15
+ "errorIconAriaLabel": [{ "type": 0, "value": "错误" }],
16
+ "selectedAriaLabel": [{ "type": 0, "value": "已选定" }]
17
+ },
18
+ "calendar": {
33
19
  "nextMonthAriaLabel": [{ "type": 0, "value": "下个月" }],
34
20
  "previousMonthAriaLabel": [{ "type": 0, "value": "上个月" }],
35
21
  "todayAriaLabel": [{ "type": 0, "value": "今天" }]
@@ -44,8 +30,8 @@
44
30
  "i18nStrings.successIconAriaLabel": [{ "type": 0, "value": "成功" }],
45
31
  "i18nStrings.warningIconAriaLabel": [{ "type": 0, "value": "警告" }]
46
32
  },
47
- "form": { "errorIconAriaLabel": [{ "type": 0, "value": "错误" }] },
48
33
  "form-field": { "i18nStrings.errorIconAriaLabel": [{ "type": 0, "value": "错误" }] },
34
+ "form": { "errorIconAriaLabel": [{ "type": 0, "value": "错误" }] },
49
35
  "input": { "clearAriaLabel": [{ "type": 0, "value": "清除" }] },
50
36
  "modal": { "closeAriaLabel": [{ "type": 0, "value": "关闭模态" }] },
51
37
  "pagination": {
@@ -161,8 +147,22 @@
161
147
  "selectedAriaLabel": [{ "type": 0, "value": "已选定" }]
162
148
  },
163
149
  "wizard": {
164
- "errorIconAriaLabel": [{ "type": 0, "value": "错误" }],
165
- "selectedAriaLabel": [{ "type": 0, "value": "已选定" }]
150
+ "i18nStrings.stepNumberLabel": [
151
+ { "type": 0, "value": "" },
152
+ { "type": 1, "value": "stepNumber" },
153
+ { "type": 0, "value": " 步" }
154
+ ],
155
+ "i18nStrings.collapsedStepsLabel": [
156
+ { "type": 0, "value": "第 " },
157
+ { "type": 1, "value": "stepNumber" },
158
+ { "type": 0, "value": " 步,共 " },
159
+ { "type": 1, "value": "stepsCount" },
160
+ { "type": 0, "value": " 步" }
161
+ ],
162
+ "i18nStrings.cancelButton": [{ "type": 0, "value": "取消" }],
163
+ "i18nStrings.previousButton": [{ "type": 0, "value": "上一步" }],
164
+ "i18nStrings.nextButton": [{ "type": 0, "value": "下一步" }],
165
+ "i18nStrings.optional": [{ "type": 0, "value": "可选" }]
166
166
  }
167
167
  }
168
168
  }
@@ -2,23 +2,6 @@ export default {
2
2
  '@cloudscape-design/components': {
3
3
  'zh-TW': {
4
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
5
  'app-layout': {
23
6
  'ariaLabels.navigation': [{ type: 0, value: '側邊導覽' }],
24
7
  'ariaLabels.navigationClose': [{ type: 0, value: '關閉側邊導覽' }],
@@ -28,7 +11,11 @@ export default {
28
11
  'ariaLabels.toolsClose': [{ type: 0, value: '開啟說明面板' }],
29
12
  'ariaLabels.toolsToggle': [{ type: 0, value: '關閉說明面板' }],
30
13
  },
31
- 'date-picker': {
14
+ autosuggest: {
15
+ errorIconAriaLabel: [{ type: 0, value: '錯誤' }],
16
+ selectedAriaLabel: [{ type: 0, value: '已選取' }],
17
+ },
18
+ calendar: {
32
19
  nextMonthAriaLabel: [{ type: 0, value: '下個月' }],
33
20
  previousMonthAriaLabel: [{ type: 0, value: '上個月' }],
34
21
  todayAriaLabel: [{ type: 0, value: '今天' }],
@@ -43,8 +30,8 @@ export default {
43
30
  'i18nStrings.successIconAriaLabel': [{ type: 0, value: '成功' }],
44
31
  'i18nStrings.warningIconAriaLabel': [{ type: 0, value: '警告' }],
45
32
  },
46
- form: { errorIconAriaLabel: [{ type: 0, value: '錯誤' }] },
47
33
  'form-field': { 'i18nStrings.errorIconAriaLabel': [{ type: 0, value: '錯誤' }] },
34
+ form: { errorIconAriaLabel: [{ type: 0, value: '錯誤' }] },
48
35
  input: { clearAriaLabel: [{ type: 0, value: '清除' }] },
49
36
  modal: { closeAriaLabel: [{ type: 0, value: '關閉強制回應' }] },
50
37
  pagination: {
@@ -156,7 +143,23 @@ export default {
156
143
  ],
157
144
  },
158
145
  select: { errorIconAriaLabel: [{ type: 0, value: '錯誤' }], selectedAriaLabel: [{ type: 0, value: '已選取' }] },
159
- wizard: { errorIconAriaLabel: [{ type: 0, value: '錯誤' }], selectedAriaLabel: [{ type: 0, value: '已選取' }] },
146
+ wizard: {
147
+ 'i18nStrings.stepNumberLabel': [
148
+ { type: 0, value: '步驟 ' },
149
+ { type: 1, value: 'stepNumber' },
150
+ ],
151
+ 'i18nStrings.collapsedStepsLabel': [
152
+ { type: 0, value: '步驟 ' },
153
+ { type: 1, value: 'stepNumber' },
154
+ { type: 0, value: ',共 ' },
155
+ { type: 1, value: 'stepsCount' },
156
+ { type: 0, value: ' 步' },
157
+ ],
158
+ 'i18nStrings.cancelButton': [{ type: 0, value: '取消' }],
159
+ 'i18nStrings.previousButton': [{ type: 0, value: '上一步' }],
160
+ 'i18nStrings.nextButton': [{ type: 0, value: '下一步' }],
161
+ 'i18nStrings.optional': [{ type: 0, value: '選用' }],
162
+ },
160
163
  },
161
164
  },
162
165
  };
@@ -2,23 +2,6 @@
2
2
  "@cloudscape-design/components": {
3
3
  "zh-TW": {
4
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
5
  "app-layout": {
23
6
  "ariaLabels.navigation": [{ "type": 0, "value": "側邊導覽" }],
24
7
  "ariaLabels.navigationClose": [{ "type": 0, "value": "關閉側邊導覽" }],
@@ -28,7 +11,11 @@
28
11
  "ariaLabels.toolsClose": [{ "type": 0, "value": "開啟說明面板" }],
29
12
  "ariaLabels.toolsToggle": [{ "type": 0, "value": "關閉說明面板" }]
30
13
  },
31
- "date-picker": {
14
+ "autosuggest": {
15
+ "errorIconAriaLabel": [{ "type": 0, "value": "錯誤" }],
16
+ "selectedAriaLabel": [{ "type": 0, "value": "已選取" }]
17
+ },
18
+ "calendar": {
32
19
  "nextMonthAriaLabel": [{ "type": 0, "value": "下個月" }],
33
20
  "previousMonthAriaLabel": [{ "type": 0, "value": "上個月" }],
34
21
  "todayAriaLabel": [{ "type": 0, "value": "今天" }]
@@ -43,8 +30,8 @@
43
30
  "i18nStrings.successIconAriaLabel": [{ "type": 0, "value": "成功" }],
44
31
  "i18nStrings.warningIconAriaLabel": [{ "type": 0, "value": "警告" }]
45
32
  },
46
- "form": { "errorIconAriaLabel": [{ "type": 0, "value": "錯誤" }] },
47
33
  "form-field": { "i18nStrings.errorIconAriaLabel": [{ "type": 0, "value": "錯誤" }] },
34
+ "form": { "errorIconAriaLabel": [{ "type": 0, "value": "錯誤" }] },
48
35
  "input": { "clearAriaLabel": [{ "type": 0, "value": "清除" }] },
49
36
  "modal": { "closeAriaLabel": [{ "type": 0, "value": "關閉強制回應" }] },
50
37
  "pagination": {
@@ -160,8 +147,21 @@
160
147
  "selectedAriaLabel": [{ "type": 0, "value": "已選取" }]
161
148
  },
162
149
  "wizard": {
163
- "errorIconAriaLabel": [{ "type": 0, "value": "錯誤" }],
164
- "selectedAriaLabel": [{ "type": 0, "value": "已選取" }]
150
+ "i18nStrings.stepNumberLabel": [
151
+ { "type": 0, "value": "步驟 " },
152
+ { "type": 1, "value": "stepNumber" }
153
+ ],
154
+ "i18nStrings.collapsedStepsLabel": [
155
+ { "type": 0, "value": "步驟 " },
156
+ { "type": 1, "value": "stepNumber" },
157
+ { "type": 0, "value": ",共 " },
158
+ { "type": 1, "value": "stepsCount" },
159
+ { "type": 0, "value": " 步" }
160
+ ],
161
+ "i18nStrings.cancelButton": [{ "type": 0, "value": "取消" }],
162
+ "i18nStrings.previousButton": [{ "type": 0, "value": "上一步" }],
163
+ "i18nStrings.nextButton": [{ "type": 0, "value": "下一步" }],
164
+ "i18nStrings.optional": [{ "type": 0, "value": "選用" }]
165
165
  }
166
166
  }
167
167
  }
@@ -1 +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"}
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;AAK1E,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,eAuE5G"}
@@ -3,6 +3,7 @@
3
3
  import React, { useContext } from 'react';
4
4
  import IntlMessageFormat from 'intl-messageformat';
5
5
  import { InternalI18nContext } from './context';
6
+ import { warnOnce } from '../logging';
6
7
  /**
7
8
  * Context to send parent messages down to child I18nProviders. This isn't
8
9
  * included in the InternalI18nContext to avoid components from depending on
@@ -10,14 +11,28 @@ import { InternalI18nContext } from './context';
10
11
  */
11
12
  const I18nMessagesContext = React.createContext({});
12
13
  export function I18nProvider({ messages: messagesArray, locale: providedLocale, children }) {
14
+ if (typeof document === 'undefined' && !providedLocale) {
15
+ warnOnce('I18nProvider', 'An explicit locale was not provided during server rendering. This can lead to a hydration mismatch on the client.');
16
+ }
13
17
  // The provider accepts an array of configs. We merge parent messages and
14
18
  // flatten the tree early on so that accesses by key are simpler and faster.
15
19
  const parentMessages = useContext(I18nMessagesContext);
16
20
  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
+ let locale;
22
+ if (providedLocale) {
23
+ // If a locale is explicitly provided, use the string directly.
24
+ // Locales have a recommended case, but are matched case-insensitively,
25
+ // so we lowercase it internally.
26
+ locale = providedLocale.toLowerCase();
27
+ }
28
+ else if (typeof document !== 'undefined' && document.documentElement.lang) {
29
+ // Otherwise, use the value provided in the HTML tag.
30
+ locale = document.documentElement.lang.toLowerCase();
31
+ }
32
+ else {
33
+ // Lastly, fall back to English.
34
+ locale = 'en';
35
+ }
21
36
  const format = (namespace, component, key, provided, customHandler) => {
22
37
  var _a, _b, _c;
23
38
  // A general rule in the library is that undefined is basically
@@ -48,7 +63,7 @@ export function I18nProvider({ messages: messagesArray, locale: providedLocale,
48
63
  // Assuming `T extends string` since a customHandler wasn't provided.
49
64
  return intlMessageFormat.format();
50
65
  };
51
- return (React.createElement(InternalI18nContext.Provider, { value: format },
66
+ return (React.createElement(InternalI18nContext.Provider, { value: { locale, format } },
52
67
  React.createElement(I18nMessagesContext.Provider, { value: messages }, children)));
53
68
  }
54
69
  function mergeMessages(sources) {
@@ -1 +1 @@
1
- {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../../src/internal/i18n/provider.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,iBAAiB,MAAM,oBAAoB,CAAC;AAGnD,OAAO,EAAE,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7C,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;qBAC3C;oBACD,KAAK,MAAM,GAAG,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,EAAE;wBAC7D,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC;qBAC9F;iBACF;aACF;SACF;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,mBAAmB,CAAC,eAAuB;IAClD,MAAM,KAAK,GAAG,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QACtB,OAAO,CAAC,eAAe,CAAC,CAAC;KAC1B;IAED,MAAM,aAAa,GAAa,EAAE,CAAC;IACnC,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;QACrC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;KACjD;IACD,OAAO,aAAa,CAAC;AACvB,CAAC","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
+ {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../../src/internal/i18n/provider.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,iBAAiB,MAAM,oBAAoB,CAAC;AAGnD,OAAO,EAAE,mBAAmB,EAAiC,MAAM,WAAW,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAoBtC;;;;GAIG;AACH,MAAM,mBAAmB,GAAG,KAAK,CAAC,aAAa,CAA6B,EAAE,CAAC,CAAC;AAEhF,MAAM,UAAU,YAAY,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAqB;IAC3G,IAAI,OAAO,QAAQ,KAAK,WAAW,IAAI,CAAC,cAAc,EAAE;QACtD,QAAQ,CACN,cAAc,EACd,mHAAmH,CACpH,CAAC;KACH;IAED,yEAAyE;IACzE,4EAA4E;IAC5E,MAAM,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AC,GAAG,EAAE,CAAC;qBAC3C;oBACD,KAAK,MAAM,GAAG,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,EAAE;wBAC7D,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC;qBAC9F;iBACF;aACF;SACF;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,mBAAmB,CAAC,eAAuB;IAClD,MAAM,KAAK,GAAG,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QACtB,OAAO,CAAC,eAAe,CAAC,CAAC;KAC1B;IAED,MAAM,aAAa,GAAa,EAAE,CAAC;IACnC,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;QACrC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;KACjD;IACD,OAAO,aAAa,CAAC;AACvB,CAAC","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';\nimport { warnOnce } from '../logging';\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 if (typeof document === 'undefined' && !providedLocale) {\n warnOnce(\n 'I18nProvider',\n 'An explicit locale was not provided during server rendering. This can lead to a hydration mismatch on the client.'\n );\n }\n\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 let locale: string;\n if (providedLocale) {\n // If a locale is explicitly provided, use the string directly.\n // Locales have a recommended case, but are matched case-insensitively,\n // so we lowercase it internally.\n locale = providedLocale.toLowerCase();\n } else if (typeof document !== 'undefined' && document.documentElement.lang) {\n // Otherwise, use the value provided in the HTML tag.\n locale = document.documentElement.lang.toLowerCase();\n } else {\n // Lastly, fall back to English.\n locale = 'en';\n }\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={{ locale, 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": "10eed9625e8217e8fa4c179c4a2b396f3cd53329"
2
+ "commit": "e3a77cb8f2230a2dd24ef57ccc1d3cc8807962b4"
3
3
  }
package/package.json CHANGED
@@ -108,7 +108,7 @@
108
108
  "./internal/base-component/index.js",
109
109
  "./internal/base-component/styles.css.js"
110
110
  ],
111
- "version": "3.0.234",
111
+ "version": "3.0.236",
112
112
  "repository": {
113
113
  "type": "git",
114
114
  "url": "https://github.com/cloudscape-design/components.git"