@react-spectrum/label 3.0.0-nightly-641446f65-240905

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 (217) hide show
  1. package/README.md +3 -0
  2. package/dist/Field.main.js +118 -0
  3. package/dist/Field.main.js.map +1 -0
  4. package/dist/Field.mjs +113 -0
  5. package/dist/Field.module.js +113 -0
  6. package/dist/Field.module.js.map +1 -0
  7. package/dist/HelpText.main.js +57 -0
  8. package/dist/HelpText.main.js.map +1 -0
  9. package/dist/HelpText.mjs +52 -0
  10. package/dist/HelpText.module.js +52 -0
  11. package/dist/HelpText.module.js.map +1 -0
  12. package/dist/Label.main.js +68 -0
  13. package/dist/Label.main.js.map +1 -0
  14. package/dist/Label.mjs +63 -0
  15. package/dist/Label.module.js +63 -0
  16. package/dist/Label.module.js.map +1 -0
  17. package/dist/ar-AE.main.js +7 -0
  18. package/dist/ar-AE.main.js.map +1 -0
  19. package/dist/ar-AE.mjs +9 -0
  20. package/dist/ar-AE.module.js +9 -0
  21. package/dist/ar-AE.module.js.map +1 -0
  22. package/dist/bg-BG.main.js +7 -0
  23. package/dist/bg-BG.main.js.map +1 -0
  24. package/dist/bg-BG.mjs +9 -0
  25. package/dist/bg-BG.module.js +9 -0
  26. package/dist/bg-BG.module.js.map +1 -0
  27. package/dist/cs-CZ.main.js +7 -0
  28. package/dist/cs-CZ.main.js.map +1 -0
  29. package/dist/cs-CZ.mjs +9 -0
  30. package/dist/cs-CZ.module.js +9 -0
  31. package/dist/cs-CZ.module.js.map +1 -0
  32. package/dist/da-DK.main.js +7 -0
  33. package/dist/da-DK.main.js.map +1 -0
  34. package/dist/da-DK.mjs +9 -0
  35. package/dist/da-DK.module.js +9 -0
  36. package/dist/da-DK.module.js.map +1 -0
  37. package/dist/de-DE.main.js +7 -0
  38. package/dist/de-DE.main.js.map +1 -0
  39. package/dist/de-DE.mjs +9 -0
  40. package/dist/de-DE.module.js +9 -0
  41. package/dist/de-DE.module.js.map +1 -0
  42. package/dist/el-GR.main.js +7 -0
  43. package/dist/el-GR.main.js.map +1 -0
  44. package/dist/el-GR.mjs +9 -0
  45. package/dist/el-GR.module.js +9 -0
  46. package/dist/el-GR.module.js.map +1 -0
  47. package/dist/en-US.main.js +7 -0
  48. package/dist/en-US.main.js.map +1 -0
  49. package/dist/en-US.mjs +9 -0
  50. package/dist/en-US.module.js +9 -0
  51. package/dist/en-US.module.js.map +1 -0
  52. package/dist/es-ES.main.js +7 -0
  53. package/dist/es-ES.main.js.map +1 -0
  54. package/dist/es-ES.mjs +9 -0
  55. package/dist/es-ES.module.js +9 -0
  56. package/dist/es-ES.module.js.map +1 -0
  57. package/dist/et-EE.main.js +7 -0
  58. package/dist/et-EE.main.js.map +1 -0
  59. package/dist/et-EE.mjs +9 -0
  60. package/dist/et-EE.module.js +9 -0
  61. package/dist/et-EE.module.js.map +1 -0
  62. package/dist/fi-FI.main.js +7 -0
  63. package/dist/fi-FI.main.js.map +1 -0
  64. package/dist/fi-FI.mjs +9 -0
  65. package/dist/fi-FI.module.js +9 -0
  66. package/dist/fi-FI.module.js.map +1 -0
  67. package/dist/fieldlabel_vars_css.main.js +95 -0
  68. package/dist/fieldlabel_vars_css.main.js.map +1 -0
  69. package/dist/fieldlabel_vars_css.mjs +97 -0
  70. package/dist/fieldlabel_vars_css.module.js +97 -0
  71. package/dist/fieldlabel_vars_css.module.js.map +1 -0
  72. package/dist/fr-FR.main.js +7 -0
  73. package/dist/fr-FR.main.js.map +1 -0
  74. package/dist/fr-FR.mjs +9 -0
  75. package/dist/fr-FR.module.js +9 -0
  76. package/dist/fr-FR.module.js.map +1 -0
  77. package/dist/he-IL.main.js +7 -0
  78. package/dist/he-IL.main.js.map +1 -0
  79. package/dist/he-IL.mjs +9 -0
  80. package/dist/he-IL.module.js +9 -0
  81. package/dist/he-IL.module.js.map +1 -0
  82. package/dist/helptext_vars_css.main.js +41 -0
  83. package/dist/helptext_vars_css.main.js.map +1 -0
  84. package/dist/helptext_vars_css.mjs +43 -0
  85. package/dist/helptext_vars_css.module.js +43 -0
  86. package/dist/helptext_vars_css.module.js.map +1 -0
  87. package/dist/hr-HR.main.js +7 -0
  88. package/dist/hr-HR.main.js.map +1 -0
  89. package/dist/hr-HR.mjs +9 -0
  90. package/dist/hr-HR.module.js +9 -0
  91. package/dist/hr-HR.module.js.map +1 -0
  92. package/dist/hu-HU.main.js +7 -0
  93. package/dist/hu-HU.main.js.map +1 -0
  94. package/dist/hu-HU.mjs +9 -0
  95. package/dist/hu-HU.module.js +9 -0
  96. package/dist/hu-HU.module.js.map +1 -0
  97. package/dist/import.mjs +22 -0
  98. package/dist/intlStrings.main.js +108 -0
  99. package/dist/intlStrings.main.js.map +1 -0
  100. package/dist/intlStrings.mjs +110 -0
  101. package/dist/intlStrings.module.js +110 -0
  102. package/dist/intlStrings.module.js.map +1 -0
  103. package/dist/it-IT.main.js +7 -0
  104. package/dist/it-IT.main.js.map +1 -0
  105. package/dist/it-IT.mjs +9 -0
  106. package/dist/it-IT.module.js +9 -0
  107. package/dist/it-IT.module.js.map +1 -0
  108. package/dist/ja-JP.main.js +7 -0
  109. package/dist/ja-JP.main.js.map +1 -0
  110. package/dist/ja-JP.mjs +9 -0
  111. package/dist/ja-JP.module.js +9 -0
  112. package/dist/ja-JP.module.js.map +1 -0
  113. package/dist/ko-KR.main.js +7 -0
  114. package/dist/ko-KR.main.js.map +1 -0
  115. package/dist/ko-KR.mjs +9 -0
  116. package/dist/ko-KR.module.js +9 -0
  117. package/dist/ko-KR.module.js.map +1 -0
  118. package/dist/lt-LT.main.js +7 -0
  119. package/dist/lt-LT.main.js.map +1 -0
  120. package/dist/lt-LT.mjs +9 -0
  121. package/dist/lt-LT.module.js +9 -0
  122. package/dist/lt-LT.module.js.map +1 -0
  123. package/dist/lv-LV.main.js +7 -0
  124. package/dist/lv-LV.main.js.map +1 -0
  125. package/dist/lv-LV.mjs +9 -0
  126. package/dist/lv-LV.module.js +9 -0
  127. package/dist/lv-LV.module.js.map +1 -0
  128. package/dist/main.js +29 -0
  129. package/dist/main.js.map +1 -0
  130. package/dist/module.js +22 -0
  131. package/dist/module.js.map +1 -0
  132. package/dist/nb-NO.main.js +7 -0
  133. package/dist/nb-NO.main.js.map +1 -0
  134. package/dist/nb-NO.mjs +9 -0
  135. package/dist/nb-NO.module.js +9 -0
  136. package/dist/nb-NO.module.js.map +1 -0
  137. package/dist/nl-NL.main.js +7 -0
  138. package/dist/nl-NL.main.js.map +1 -0
  139. package/dist/nl-NL.mjs +9 -0
  140. package/dist/nl-NL.module.js +9 -0
  141. package/dist/nl-NL.module.js.map +1 -0
  142. package/dist/pl-PL.main.js +7 -0
  143. package/dist/pl-PL.main.js.map +1 -0
  144. package/dist/pl-PL.mjs +9 -0
  145. package/dist/pl-PL.module.js +9 -0
  146. package/dist/pl-PL.module.js.map +1 -0
  147. package/dist/pt-BR.main.js +7 -0
  148. package/dist/pt-BR.main.js.map +1 -0
  149. package/dist/pt-BR.mjs +9 -0
  150. package/dist/pt-BR.module.js +9 -0
  151. package/dist/pt-BR.module.js.map +1 -0
  152. package/dist/pt-PT.main.js +7 -0
  153. package/dist/pt-PT.main.js.map +1 -0
  154. package/dist/pt-PT.mjs +9 -0
  155. package/dist/pt-PT.module.js +9 -0
  156. package/dist/pt-PT.module.js.map +1 -0
  157. package/dist/ro-RO.main.js +7 -0
  158. package/dist/ro-RO.main.js.map +1 -0
  159. package/dist/ro-RO.mjs +9 -0
  160. package/dist/ro-RO.module.js +9 -0
  161. package/dist/ro-RO.module.js.map +1 -0
  162. package/dist/ru-RU.main.js +7 -0
  163. package/dist/ru-RU.main.js.map +1 -0
  164. package/dist/ru-RU.mjs +9 -0
  165. package/dist/ru-RU.module.js +9 -0
  166. package/dist/ru-RU.module.js.map +1 -0
  167. package/dist/sk-SK.main.js +7 -0
  168. package/dist/sk-SK.main.js.map +1 -0
  169. package/dist/sk-SK.mjs +9 -0
  170. package/dist/sk-SK.module.js +9 -0
  171. package/dist/sk-SK.module.js.map +1 -0
  172. package/dist/sl-SI.main.js +7 -0
  173. package/dist/sl-SI.main.js.map +1 -0
  174. package/dist/sl-SI.mjs +9 -0
  175. package/dist/sl-SI.module.js +9 -0
  176. package/dist/sl-SI.module.js.map +1 -0
  177. package/dist/sr-SP.main.js +7 -0
  178. package/dist/sr-SP.main.js.map +1 -0
  179. package/dist/sr-SP.mjs +9 -0
  180. package/dist/sr-SP.module.js +9 -0
  181. package/dist/sr-SP.module.js.map +1 -0
  182. package/dist/sv-SE.main.js +7 -0
  183. package/dist/sv-SE.main.js.map +1 -0
  184. package/dist/sv-SE.mjs +9 -0
  185. package/dist/sv-SE.module.js +9 -0
  186. package/dist/sv-SE.module.js.map +1 -0
  187. package/dist/tr-TR.main.js +7 -0
  188. package/dist/tr-TR.main.js.map +1 -0
  189. package/dist/tr-TR.mjs +9 -0
  190. package/dist/tr-TR.module.js +9 -0
  191. package/dist/tr-TR.module.js.map +1 -0
  192. package/dist/types.d.ts +19 -0
  193. package/dist/types.d.ts.map +1 -0
  194. package/dist/uk-UA.main.js +7 -0
  195. package/dist/uk-UA.main.js.map +1 -0
  196. package/dist/uk-UA.mjs +9 -0
  197. package/dist/uk-UA.module.js +9 -0
  198. package/dist/uk-UA.module.js.map +1 -0
  199. package/dist/vars.0af2d804.css +117 -0
  200. package/dist/vars.0af2d804.css.map +1 -0
  201. package/dist/vars.d58685ae.css +271 -0
  202. package/dist/vars.d58685ae.css.map +1 -0
  203. package/dist/zh-CN.main.js +7 -0
  204. package/dist/zh-CN.main.js.map +1 -0
  205. package/dist/zh-CN.mjs +9 -0
  206. package/dist/zh-CN.module.js +9 -0
  207. package/dist/zh-CN.module.js.map +1 -0
  208. package/dist/zh-TW.main.js +7 -0
  209. package/dist/zh-TW.main.js.map +1 -0
  210. package/dist/zh-TW.mjs +9 -0
  211. package/dist/zh-TW.module.js +9 -0
  212. package/dist/zh-TW.module.js.map +1 -0
  213. package/package.json +60 -0
  214. package/src/Field.tsx +180 -0
  215. package/src/HelpText.tsx +74 -0
  216. package/src/Label.tsx +82 -0
  217. package/src/index.ts +17 -0
@@ -0,0 +1,271 @@
1
+ .A-HlBa_i18nFontFamily {
2
+ font-synthesis: weight;
3
+ font-family: adobe-clean, Source Sans Pro, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Ubuntu, Trebuchet MS, Lucida Grande, sans-serif;
4
+ }
5
+
6
+ .A-HlBa_i18nFontFamily:lang(ar) {
7
+ font-family: myriad-arabic, adobe-clean, Source Sans Pro, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Ubuntu, Trebuchet MS, Lucida Grande, sans-serif;
8
+ }
9
+
10
+ .A-HlBa_i18nFontFamily:lang(he) {
11
+ font-family: myriad-hebrew, adobe-clean, Source Sans Pro, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Ubuntu, Trebuchet MS, Lucida Grande, sans-serif;
12
+ }
13
+
14
+ .A-HlBa_i18nFontFamily:lang(zh) {
15
+ font-family: adobe-clean-han-traditional, source-han-traditional, MingLiu, Heiti TC Light, sans-serif;
16
+ }
17
+
18
+ .A-HlBa_i18nFontFamily:lang(zh-Hans) {
19
+ font-family: adobe-clean-han-simplified-c, source-han-simplified-c, SimSun, Heiti SC Light, sans-serif;
20
+ }
21
+
22
+ .A-HlBa_i18nFontFamily:lang(zh-Hant) {
23
+ font-family: adobe-clean-han-traditional, source-han-traditional, MingLiu, Microsoft JhengHei UI, Microsoft JhengHei, Heiti TC Light, sans-serif;
24
+ }
25
+
26
+ .A-HlBa_i18nFontFamily:lang(zh-SG), .A-HlBa_i18nFontFamily:lang(zh-CN) {
27
+ font-family: adobe-clean-han-simplified-c, source-han-simplified-c, SimSun, Heiti SC Light, sans-serif;
28
+ }
29
+
30
+ .A-HlBa_i18nFontFamily:lang(ko) {
31
+ font-family: adobe-clean-han-korean, source-han-korean, Malgun Gothic, Apple Gothic, sans-serif;
32
+ }
33
+
34
+ .A-HlBa_i18nFontFamily:lang(ja) {
35
+ font-family: adobe-clean-han-japanese, Hiragino Kaku Gothic ProN, ヒラギノ角ゴ ProN W3, Osaka, YuGothic, Yu Gothic, メイリオ, Meiryo, MS Pゴシック, MS PGothic, sans-serif;
36
+ }
37
+
38
+ .A-HlBa_spectrum-FocusRing-ring {
39
+ --spectrum-focus-ring-border-radius: var(--spectrum-textfield-border-radius, var(--spectrum-alias-border-radius-regular));
40
+ --spectrum-focus-ring-gap: var(--spectrum-alias-input-focusring-gap);
41
+ --spectrum-focus-ring-size: var(--spectrum-alias-input-focusring-size);
42
+ --spectrum-focus-ring-border-size: 0px;
43
+ --spectrum-focus-ring-color: var(--spectrum-high-contrast-focus-ring-color, var(--spectrum-alias-focus-ring-color, var(--spectrum-alias-focus-color)));
44
+ }
45
+
46
+ .A-HlBa_spectrum-FocusRing-ring:after {
47
+ border-radius: calc(var(--spectrum-focus-ring-border-radius) + var(--spectrum-focus-ring-gap));
48
+ content: "";
49
+ margin: calc(-1 * var(--spectrum-focus-ring-border-size));
50
+ pointer-events: none;
51
+ transition: box-shadow var(--spectrum-global-animation-duration-100, .13s) ease-out, margin var(--spectrum-global-animation-duration-100, .13s) ease-out;
52
+ display: block;
53
+ position: absolute;
54
+ inset: 0;
55
+ }
56
+
57
+ .A-HlBa_spectrum-FocusRing.A-HlBa_focus-ring:after {
58
+ margin: calc(var(--spectrum-focus-ring-gap) * -1 - var(--spectrum-focus-ring-border-size));
59
+ box-shadow: 0 0 0 var(--spectrum-focus-ring-size) var(--spectrum-focus-ring-color);
60
+ }
61
+
62
+ .A-HlBa_spectrum-FocusRing--quiet:after {
63
+ border-radius: 0;
64
+ }
65
+
66
+ .A-HlBa_spectrum-FocusRing--quiet.A-HlBa_focus-ring:after {
67
+ margin: 0 0 calc(var(--spectrum-focus-ring-gap) * -1 - var(--spectrum-focus-ring-border-size)) 0;
68
+ box-shadow: 0 var(--spectrum-focus-ring-size) 0 var(--spectrum-focus-ring-color);
69
+ }
70
+
71
+ @media (forced-colors: active) {
72
+ .A-HlBa_spectrum-FocusRing, .A-HlBa_spectrum-FocusRing-ring, .A-HlBa_spectrum-FocusRing--quiet {
73
+ --spectrum-high-contrast-focus-ring-color: Highlight;
74
+ }
75
+
76
+ :is(.A-HlBa_spectrum-FocusRing, .A-HlBa_spectrum-FocusRing-ring, .A-HlBa_spectrum-FocusRing--quiet):after {
77
+ forced-color-adjust: none;
78
+ }
79
+ }
80
+
81
+ .A-HlBa_spectrum-FieldLabel {
82
+ box-sizing: border-box;
83
+ padding: var(--spectrum-fieldlabel-padding-top, var(--spectrum-global-dimension-size-50)) 0 var(--spectrum-fieldlabel-padding-bottom, var(--spectrum-global-dimension-size-65));
84
+ font-size: var(--spectrum-fieldlabel-text-size, var(--spectrum-global-dimension-font-size-75));
85
+ font-weight: var(--spectrum-fieldlabel-text-font-weight, var(--spectrum-global-font-weight-regular));
86
+ line-height: var(--spectrum-fieldlabel-text-line-height, var(--spectrum-global-font-line-height-small));
87
+ vertical-align: top;
88
+ -webkit-font-smoothing: subpixel-antialiased;
89
+ -moz-osx-font-smoothing: auto;
90
+ font-smoothing: subpixel-antialiased;
91
+ text-align: start;
92
+ cursor: default;
93
+ flex: none;
94
+ display: flex;
95
+ }
96
+
97
+ .A-HlBa_spectrum-FieldLabel--positionSide {
98
+ padding-top: var(--spectrum-fieldlabel-side-padding-top, var(--spectrum-global-dimension-size-100));
99
+ padding-inline-end: var(--spectrum-fieldlabel-side-padding-x, var(--spectrum-global-dimension-size-100));
100
+ display: inline-flex;
101
+ }
102
+
103
+ .A-HlBa_spectrum-FieldLabel-requiredIcon {
104
+ margin-top: var(--spectrum-fieldlabel-asterisk-margin-y, var(--spectrum-global-dimension-size-50));
105
+ margin-inline-end: 0;
106
+ margin-bottom: 0;
107
+ margin-inline-start: var(--spectrum-fieldlabel-asterisk-gap, var(--spectrum-global-dimension-size-25));
108
+ }
109
+
110
+ .A-HlBa_spectrum-FieldLabel--alignEnd {
111
+ text-align: end;
112
+ justify-content: flex-end;
113
+ }
114
+
115
+ .A-HlBa_spectrum-Field {
116
+ --spectrum-field-default-width: var(--spectrum-alias-single-line-width, var(--spectrum-global-dimension-size-2400));
117
+ height: max-content;
118
+ }
119
+
120
+ .A-HlBa_spectrum-Field .A-HlBa_spectrum-Field-contextualHelp {
121
+ margin-inline-start: var(--spectrum-global-dimension-size-50);
122
+ margin-top: var(--spectrum-global-dimension-size-25);
123
+ grid-area: A-HlBa_contextualHelp;
124
+ }
125
+
126
+ .A-HlBa_spectrum-Field:where(.A-HlBa_spectrum-Field--positionTop) {
127
+ width: var(--spectrum-field-default-width);
128
+ grid-template: "A-HlBa_label A-HlBa_contextualHelp ."
129
+ "A-HlBa_field A-HlBa_field A-HlBa_field" 1fr
130
+ "A-HlBa_helpText A-HlBa_helpText A-HlBa_helpText"
131
+ / auto auto minmax(0, 1fr);
132
+ align-content: start;
133
+ display: inline-grid;
134
+ }
135
+
136
+ .A-HlBa_spectrum-Field:where(.A-HlBa_spectrum-Field--positionTop) .A-HlBa_spectrum-Field-field {
137
+ grid-area: A-HlBa_field;
138
+ width: 100%;
139
+ }
140
+
141
+ .A-HlBa_spectrum-Field:where(.A-HlBa_spectrum-Field--positionTop).A-HlBa_spectrum-Field--alignEnd {
142
+ grid-template-columns: 1fr auto 0;
143
+ }
144
+
145
+ .A-HlBa_spectrum-Field:where(.A-HlBa_spectrum-Field--positionTop) .A-HlBa_spectrum-FieldLabel {
146
+ grid-area: A-HlBa_label;
147
+ }
148
+
149
+ .A-HlBa_spectrum-Field:where(.A-HlBa_spectrum-Field--positionSide) {
150
+ align-items: flex-start;
151
+ display: inline-flex;
152
+ }
153
+
154
+ .A-HlBa_spectrum-Field:where(.A-HlBa_spectrum-Field--positionSide) .A-HlBa_spectrum-Field-wrapper {
155
+ width: var(--spectrum-field-default-width);
156
+ flex: 1;
157
+ min-width: 0;
158
+ height: 100%;
159
+ }
160
+
161
+ .A-HlBa_spectrum-Field:where(.A-HlBa_spectrum-Field--positionSide) .A-HlBa_spectrum-Field-wrapper .A-HlBa_spectrum-Field-field {
162
+ width: 100%;
163
+ }
164
+
165
+ .A-HlBa_spectrum-Field:where(.A-HlBa_spectrum-Field--positionSide) .A-HlBa_spectrum-Field-field {
166
+ flex: 1;
167
+ min-width: 0;
168
+ }
169
+
170
+ .A-HlBa_spectrum-Field:where(.A-HlBa_spectrum-Field--positionSide) .A-HlBa_spectrum-Field-contextualHelp {
171
+ margin-top: var(--spectrum-global-dimension-size-65);
172
+ margin-inline-end: var(--spectrum-fieldlabel-side-padding-x, var(--spectrum-global-dimension-size-100));
173
+ }
174
+
175
+ .A-HlBa_spectrum-Field.A-HlBa_spectrum-Field--hasContextualHelp .A-HlBa_spectrum-FieldLabel {
176
+ padding-inline-end: 0;
177
+ }
178
+
179
+ .A-HlBa_spectrum-Form.A-HlBa_spectrum-Form--positionSide {
180
+ border-collapse: separate;
181
+ border-spacing: 0 var(--spectrum-global-dimension-size-300);
182
+ margin: calc(var(--spectrum-global-dimension-size-250) * -1) 0;
183
+ text-align: start;
184
+ display: table;
185
+ }
186
+
187
+ .A-HlBa_spectrum-Form.A-HlBa_spectrum-Form--positionSide .A-HlBa_spectrum-Field {
188
+ width: 100%;
189
+ display: table-row;
190
+ }
191
+
192
+ .A-HlBa_spectrum-Form.A-HlBa_spectrum-Form--positionSide .A-HlBa_spectrum-Field:not(.A-HlBa_spectrum-Field--hasContextualHelp) .A-HlBa_spectrum-FieldLabel, .A-HlBa_spectrum-Form.A-HlBa_spectrum-Form--positionSide .A-HlBa_spectrum-Field.A-HlBa_spectrum-Field--hasContextualHelp .A-HlBa_spectrum-Field-labelCell {
193
+ display: table-cell;
194
+ }
195
+
196
+ .A-HlBa_spectrum-Form.A-HlBa_spectrum-Form--positionSide .A-HlBa_spectrum-Field .A-HlBa_spectrum-Field-labelCell {
197
+ vertical-align: top;
198
+ }
199
+
200
+ .A-HlBa_spectrum-Form.A-HlBa_spectrum-Form--positionSide .A-HlBa_spectrum-Field.A-HlBa_spectrum-Field--alignEnd .A-HlBa_spectrum-Field-labelCell {
201
+ text-align: end;
202
+ }
203
+
204
+ .A-HlBa_spectrum-Form.A-HlBa_spectrum-Form--positionSide .A-HlBa_spectrum-Field .A-HlBa_spectrum-Field-labelWrapper {
205
+ display: inline-flex;
206
+ }
207
+
208
+ .A-HlBa_spectrum-Form.A-HlBa_spectrum-Form--positionSide .A-HlBa_spectrum-Field .A-HlBa_spectrum-Field-labelWrapper .A-HlBa_spectrum-FieldLabel {
209
+ flex: 1;
210
+ }
211
+
212
+ .A-HlBa_spectrum-Form.A-HlBa_spectrum-Form--positionSide .A-HlBa_spectrum-Field-wrapper {
213
+ width: 100%;
214
+ }
215
+
216
+ .A-HlBa_spectrum-Form.A-HlBa_spectrum-Form--positionSide .A-HlBa_spectrum-Field-field {
217
+ min-width: var(--spectrum-alias-single-line-width, var(--spectrum-global-dimension-size-2400));
218
+ width: auto;
219
+ }
220
+
221
+ .A-HlBa_spectrum-Form.A-HlBa_spectrum-Form--positionTop {
222
+ min-width: var(--spectrum-alias-single-line-width, var(--spectrum-global-dimension-size-2400));
223
+ flex-direction: column;
224
+ margin: 0;
225
+ display: flex;
226
+ }
227
+
228
+ .A-HlBa_spectrum-Form.A-HlBa_spectrum-Form--positionTop > * {
229
+ margin-top: var(--spectrum-global-dimension-size-100);
230
+ width: 100%;
231
+ }
232
+
233
+ .A-HlBa_spectrum-LabeledValue.A-HlBa_spectrum-Field--positionSide {
234
+ align-items: baseline;
235
+ }
236
+
237
+ .A-HlBa_spectrum-LabeledValue.A-HlBa_spectrum-Field--positionSide .A-HlBa_spectrum-Field-contextualHelp {
238
+ top: var(--spectrum-global-dimension-size-40);
239
+ margin-top: var(--spectrum-global-dimension-size-65);
240
+ position: relative;
241
+ }
242
+
243
+ .A-HlBa_spectrum-LabeledValue.A-HlBa_spectrum-Field--positionTop {
244
+ width: unset;
245
+ }
246
+
247
+ .A-HlBa_spectrum-LabeledValue .A-HlBa_spectrum-FieldLabel.A-HlBa_spectrum-FieldLabel {
248
+ padding-top: 0;
249
+ }
250
+
251
+ .A-HlBa_spectrum-LabeledValue .A-HlBa_spectrum-Field-wrapper.A-HlBa_spectrum-Field-wrapper {
252
+ width: unset;
253
+ }
254
+
255
+ .A-HlBa_spectrum-LabeledValue .A-HlBa_spectrum-Field-field {
256
+ word-break: break-word;
257
+ overflow: hidden;
258
+ }
259
+
260
+ .A-HlBa_spectrum-LabeledValue .A-HlBa_spectrum-Field-contextualHelp {
261
+ margin-top: calc(-1 * var(--spectrum-global-dimension-size-25));
262
+ }
263
+
264
+ .A-HlBa_spectrum-FieldLabel, .A-HlBa_spectrum-Form-itemLabel {
265
+ color: var(--spectrum-fieldlabel-text-color, var(--spectrum-alias-label-text-color));
266
+ }
267
+
268
+ :is(.A-HlBa_spectrum-FieldLabel, .A-HlBa_spectrum-Form-itemLabel).A-HlBa_is-disabled {
269
+ color: var(--spectrum-fieldlabel-text-color-disabled, var(--spectrum-alias-text-color-disabled));
270
+ }
271
+ /*# sourceMappingURL=vars.d58685ae.css.map */
@@ -0,0 +1 @@
1
+ {"mappings":"AA4DA;;;;;AAIE;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAQA;;;;AAIA;;;;AAKF;;;;;;;;AAOE;;;;;;;;;;;AAqBE;;;;;AAQF;;;;AAKE;;;;;AAOJ;EACE;;;;EAIE;;;;;AAMJ;;;;;;;;;;;;;;;;AAsBA;;;;;;AAMA;;;;;;;AAOA;;;;;AAUA;;;;;AAIE;;;;;;AAMA;;;;;;;;;;AAUE;;;;;AAMA;;;;AAIA;;;;AAOF;;;;;AAKE;;;;;;;AAaE;;;;AAMF;;;;;AAKA;;;;;AAOA;;;;AAaF;;;;;;;;AAOE;;;;;AAME;;;;AAKA;;;;AAKA;;;;AAKA;;;;AAGE;;;;AAMJ;;;;AAIA;;;;;AAOF;;;;;;;AASE;;;;;AASF;;;;AAGE;;;;;;AAOF;;;;AAIA;;;;AAIA;;;;AAIA;;;;;AAKA;;;;AAkBF;;;;AAIE","sources":["packages/@adobe/spectrum-css-temp/components/fieldlabel/vars.css"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"vars.d58685ae.css.map"}
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ "(optional)": `\u{FF08}\u{53EF}\u{9009}\u{FF09}`,
3
+ "(required)": `\u{FF08}\u{5FC5}\u{586B}\u{FF09}`
4
+ };
5
+
6
+
7
+ //# sourceMappingURL=zh-CN.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":"AAAA,iBAAiB;IAAG,cAAc,CAAC,gCAAI,CAAC;IACtC,cAAc,CAAC,gCAAI,CAAC;AACtB","sources":["packages/@react-spectrum/label/intl/zh-CN.json"],"sourcesContent":["{\n \"(optional)\": \"(可选)\",\n \"(required)\": \"(必填)\"\n}\n"],"names":[],"version":3,"file":"zh-CN.main.js.map"}
package/dist/zh-CN.mjs ADDED
@@ -0,0 +1,9 @@
1
+ var $0128cc194bc107bb$exports = {};
2
+ $0128cc194bc107bb$exports = {
3
+ "(optional)": `\u{FF08}\u{53EF}\u{9009}\u{FF09}`,
4
+ "(required)": `\u{FF08}\u{5FC5}\u{586B}\u{FF09}`
5
+ };
6
+
7
+
8
+ export {$0128cc194bc107bb$exports as default};
9
+ //# sourceMappingURL=zh-CN.module.js.map
@@ -0,0 +1,9 @@
1
+ var $0128cc194bc107bb$exports = {};
2
+ $0128cc194bc107bb$exports = {
3
+ "(optional)": `\u{FF08}\u{53EF}\u{9009}\u{FF09}`,
4
+ "(required)": `\u{FF08}\u{5FC5}\u{586B}\u{FF09}`
5
+ };
6
+
7
+
8
+ export {$0128cc194bc107bb$exports as default};
9
+ //# sourceMappingURL=zh-CN.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";AAAA,4BAAiB;IAAG,cAAc,CAAC,gCAAI,CAAC;IACtC,cAAc,CAAC,gCAAI,CAAC;AACtB","sources":["packages/@react-spectrum/label/intl/zh-CN.json"],"sourcesContent":["{\n \"(optional)\": \"(可选)\",\n \"(required)\": \"(必填)\"\n}\n"],"names":[],"version":3,"file":"zh-CN.module.js.map"}
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ "(optional)": `(\u{9078}\u{586B})`,
3
+ "(required)": `(\u{5FC5}\u{586B})`
4
+ };
5
+
6
+
7
+ //# sourceMappingURL=zh-TW.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":"AAAA,iBAAiB;IAAG,cAAc,CAAC,kBAAI,CAAC;IACtC,cAAc,CAAC,kBAAI,CAAC;AACtB","sources":["packages/@react-spectrum/label/intl/zh-TW.json"],"sourcesContent":["{\n \"(optional)\": \"(選填)\",\n \"(required)\": \"(必填)\"\n}\n"],"names":[],"version":3,"file":"zh-TW.main.js.map"}
package/dist/zh-TW.mjs ADDED
@@ -0,0 +1,9 @@
1
+ var $c57738f6094a3d25$exports = {};
2
+ $c57738f6094a3d25$exports = {
3
+ "(optional)": `(\u{9078}\u{586B})`,
4
+ "(required)": `(\u{5FC5}\u{586B})`
5
+ };
6
+
7
+
8
+ export {$c57738f6094a3d25$exports as default};
9
+ //# sourceMappingURL=zh-TW.module.js.map
@@ -0,0 +1,9 @@
1
+ var $c57738f6094a3d25$exports = {};
2
+ $c57738f6094a3d25$exports = {
3
+ "(optional)": `(\u{9078}\u{586B})`,
4
+ "(required)": `(\u{5FC5}\u{586B})`
5
+ };
6
+
7
+
8
+ export {$c57738f6094a3d25$exports as default};
9
+ //# sourceMappingURL=zh-TW.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";AAAA,4BAAiB;IAAG,cAAc,CAAC,kBAAI,CAAC;IACtC,cAAc,CAAC,kBAAI,CAAC;AACtB","sources":["packages/@react-spectrum/label/intl/zh-TW.json"],"sourcesContent":["{\n \"(optional)\": \"(選填)\",\n \"(required)\": \"(必填)\"\n}\n"],"names":[],"version":3,"file":"zh-TW.module.js.map"}
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "@react-spectrum/label",
3
+ "version": "3.0.0-nightly-641446f65-240905",
4
+ "description": "Spectrum UI components in React",
5
+ "license": "Apache-2.0",
6
+ "main": "dist/main.js",
7
+ "module": "dist/module.js",
8
+ "exports": {
9
+ "types": "./dist/types.d.ts",
10
+ "import": "./dist/import.mjs",
11
+ "require": "./dist/main.js"
12
+ },
13
+ "types": "dist/types.d.ts",
14
+ "source": "src/index.ts",
15
+ "files": [
16
+ "dist",
17
+ "src"
18
+ ],
19
+ "sideEffects": [
20
+ "*.css"
21
+ ],
22
+ "targets": {
23
+ "main": {
24
+ "includeNodeModules": [
25
+ "@adobe/spectrum-css-temp"
26
+ ]
27
+ },
28
+ "module": {
29
+ "includeNodeModules": [
30
+ "@adobe/spectrum-css-temp"
31
+ ]
32
+ }
33
+ },
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "https://github.com/adobe/react-spectrum"
37
+ },
38
+ "dependencies": {
39
+ "@react-aria/i18n": "^3.0.0-nightly-641446f65-240905",
40
+ "@react-aria/utils": "^3.0.0-nightly-641446f65-240905",
41
+ "@react-spectrum/form": "^3.0.0-nightly-641446f65-240905",
42
+ "@react-spectrum/layout": "^3.0.0-nightly-641446f65-240905",
43
+ "@react-spectrum/utils": "^3.0.0-nightly-641446f65-240905",
44
+ "@react-types/label": "^3.0.0-nightly-641446f65-240905",
45
+ "@react-types/shared": "^3.0.0-nightly-641446f65-240905",
46
+ "@spectrum-icons/ui": "^3.0.0-nightly-641446f65-240905",
47
+ "@swc/helpers": "^0.5.0"
48
+ },
49
+ "devDependencies": {
50
+ "@adobe/spectrum-css-temp": "3.0.0-alpha.1"
51
+ },
52
+ "peerDependencies": {
53
+ "@react-spectrum/provider": "^3.0.0-nightly-641446f65-240905",
54
+ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
55
+ },
56
+ "publishConfig": {
57
+ "access": "public"
58
+ },
59
+ "stableVersion": "3.16.8"
60
+ }
package/src/Field.tsx ADDED
@@ -0,0 +1,180 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+
13
+ import {classNames, SlotProvider, useStyleProps} from '@react-spectrum/utils';
14
+ import {Flex} from '@react-spectrum/layout';
15
+ import {HelpText} from './HelpText';
16
+ import {Label} from './Label';
17
+ import {LabelPosition, RefObject} from '@react-types/shared';
18
+ import labelStyles from '@adobe/spectrum-css-temp/components/fieldlabel/vars.css';
19
+ import {mergeProps, useId} from '@react-aria/utils';
20
+ import React, {ReactNode, Ref} from 'react';
21
+ import {SpectrumFieldProps} from '@react-types/label';
22
+ import {useFormProps} from '@react-spectrum/form';
23
+
24
+ function Field(props: SpectrumFieldProps, ref: Ref<HTMLElement>) {
25
+ let formProps = useFormProps(props);
26
+ let isInForm = formProps !== props;
27
+ props = formProps;
28
+ let {
29
+ label,
30
+ labelPosition = 'top' as LabelPosition,
31
+ labelAlign,
32
+ isRequired,
33
+ necessityIndicator,
34
+ includeNecessityIndicatorInAccessibilityName,
35
+ validationState,
36
+ isInvalid,
37
+ description,
38
+ errorMessage = e => e.validationErrors.join(' '),
39
+ validationErrors,
40
+ validationDetails,
41
+ isDisabled,
42
+ showErrorIcon,
43
+ contextualHelp,
44
+ children,
45
+ labelProps = {},
46
+ // Not every component that uses <Field> supports help text.
47
+ descriptionProps = {},
48
+ errorMessageProps = {},
49
+ elementType,
50
+ wrapperClassName,
51
+ wrapperProps = {},
52
+ ...otherProps
53
+ } = props;
54
+ let {styleProps} = useStyleProps(otherProps);
55
+ let errorMessageString: ReactNode = null;
56
+ if (typeof errorMessage === 'function') {
57
+ errorMessageString = isInvalid != null && validationErrors != null && validationDetails != null
58
+ ? errorMessage({
59
+ isInvalid,
60
+ validationErrors,
61
+ validationDetails
62
+ })
63
+ : null;
64
+ } else {
65
+ errorMessageString = errorMessage;
66
+ }
67
+ let hasHelpText = !!description || errorMessageString && (isInvalid || validationState === 'invalid');
68
+ let contextualHelpId = useId();
69
+
70
+ let fallbackLabelPropsId = useId();
71
+ if (label && contextualHelp && !labelProps.id) {
72
+ labelProps.id = fallbackLabelPropsId;
73
+ }
74
+
75
+ let labelWrapperClass = classNames(
76
+ labelStyles,
77
+ 'spectrum-Field',
78
+ {
79
+ 'spectrum-Field--positionTop': labelPosition === 'top',
80
+ 'spectrum-Field--positionSide': labelPosition === 'side',
81
+ 'spectrum-Field--alignEnd': labelAlign === 'end',
82
+ 'spectrum-Field--hasContextualHelp': !!props.contextualHelp
83
+ },
84
+ styleProps.className,
85
+ wrapperClassName
86
+ );
87
+
88
+ children = React.cloneElement(children, mergeProps(children.props as any, {
89
+ className: classNames(
90
+ labelStyles,
91
+ 'spectrum-Field-field'
92
+ )
93
+ }));
94
+
95
+ let renderHelpText = () => (
96
+ <HelpText
97
+ descriptionProps={descriptionProps}
98
+ errorMessageProps={errorMessageProps}
99
+ description={description}
100
+ errorMessage={errorMessageString}
101
+ validationState={validationState}
102
+ isInvalid={isInvalid}
103
+ isDisabled={isDisabled}
104
+ showErrorIcon={showErrorIcon}
105
+ gridArea={labelStyles.helpText} />
106
+ );
107
+
108
+ let renderChildren = () => {
109
+ if (labelPosition === 'side') {
110
+ return (
111
+ <Flex direction="column" UNSAFE_className={classNames(labelStyles, 'spectrum-Field-wrapper')}>
112
+ {children}
113
+ {hasHelpText && renderHelpText()}
114
+ </Flex>
115
+ );
116
+ }
117
+
118
+ return (
119
+ <>
120
+ {children}
121
+ {hasHelpText && renderHelpText()}
122
+ </>
123
+ );
124
+ };
125
+
126
+ let labelAndContextualHelp = (
127
+ <>
128
+ {label && (
129
+ <Label
130
+ {...labelProps}
131
+ labelPosition={labelPosition}
132
+ labelAlign={labelAlign}
133
+ isRequired={isRequired}
134
+ necessityIndicator={necessityIndicator}
135
+ includeNecessityIndicatorInAccessibilityName={includeNecessityIndicatorInAccessibilityName}
136
+ elementType={elementType}>
137
+ {label}
138
+ </Label>
139
+ )}
140
+ {label && contextualHelp &&
141
+ <SlotProvider
142
+ slots={{
143
+ actionButton: {
144
+ UNSAFE_className: classNames(labelStyles, 'spectrum-Field-contextualHelp'),
145
+ id: contextualHelpId,
146
+ 'aria-labelledby': labelProps?.id ? `${labelProps.id} ${contextualHelpId}` : undefined
147
+ }
148
+ }}>
149
+ {contextualHelp}
150
+ </SlotProvider>
151
+ }
152
+ </>
153
+ );
154
+
155
+ // Need to add an extra wrapper for the label and contextual help if labelPosition is side,
156
+ // so that the table layout works inside forms.
157
+ if (isInForm && labelPosition === 'side' && label && contextualHelp) {
158
+ labelAndContextualHelp = (
159
+ <div className={classNames(labelStyles, 'spectrum-Field-labelCell')}>
160
+ <div className={classNames(labelStyles, 'spectrum-Field-labelWrapper')}>
161
+ {labelAndContextualHelp}
162
+ </div>
163
+ </div>
164
+ );
165
+ }
166
+
167
+ return (
168
+ (<div
169
+ {...styleProps}
170
+ {...wrapperProps}
171
+ ref={ref as RefObject<HTMLDivElement | null>}
172
+ className={labelWrapperClass}>
173
+ {labelAndContextualHelp}
174
+ {renderChildren()}
175
+ </div>)
176
+ );
177
+ }
178
+
179
+ let _Field = React.forwardRef(Field);
180
+ export {_Field as Field};
@@ -0,0 +1,74 @@
1
+ /*
2
+ * Copyright 2021 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+
13
+ import AlertMedium from '@spectrum-icons/ui/AlertMedium';
14
+ import {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';
15
+ import {DOMRef, SpectrumFieldValidation, SpectrumHelpTextProps, StyleProps, Validation} from '@react-types/shared';
16
+ import React, {HTMLAttributes, ReactNode} from 'react';
17
+ import styles from '@adobe/spectrum-css-temp/components/helptext/vars.css';
18
+
19
+ interface HelpTextProps extends Omit<SpectrumHelpTextProps, 'errorMessage'>, Omit<Validation<any>, 'validationState'>, SpectrumFieldValidation<any>, StyleProps {
20
+ /** Props for the help text description element. */
21
+ descriptionProps?: HTMLAttributes<HTMLElement>,
22
+ /** Props for the help text error message element. */
23
+ errorMessageProps?: HTMLAttributes<HTMLElement>,
24
+ /** An error message for the field. */
25
+ errorMessage?: ReactNode
26
+ }
27
+
28
+ function HelpText(props: HelpTextProps, ref: DOMRef<HTMLDivElement>) {
29
+ let {
30
+ description,
31
+ errorMessage,
32
+ validationState,
33
+ isInvalid,
34
+ isDisabled,
35
+ showErrorIcon,
36
+ descriptionProps,
37
+ errorMessageProps
38
+ } = props;
39
+ let domRef = useDOMRef(ref);
40
+ let isErrorMessage = errorMessage && (isInvalid || validationState === 'invalid');
41
+ let {styleProps} = useStyleProps(props);
42
+
43
+ return (
44
+ <div
45
+ {...styleProps}
46
+ className={classNames(
47
+ styles,
48
+ 'spectrum-HelpText',
49
+ `spectrum-HelpText--${isErrorMessage ? 'negative' : 'neutral'}`,
50
+ {'is-disabled': isDisabled},
51
+ styleProps.className
52
+ )}
53
+ ref={domRef}>
54
+ {isErrorMessage ? (
55
+ <>
56
+ {showErrorIcon && <AlertMedium UNSAFE_className={classNames(styles, 'spectrum-HelpText-validationIcon')} />}
57
+ <div {...errorMessageProps} className={classNames(styles, 'spectrum-HelpText-text')}>
58
+ {errorMessage}
59
+ </div>
60
+ </>
61
+ ) : (
62
+ <div {...descriptionProps} className={classNames(styles, 'spectrum-HelpText-text')}>
63
+ {description}
64
+ </div>
65
+ )}
66
+ </div>
67
+ );
68
+ }
69
+
70
+ /**
71
+ * Help text provides either an informative description or an error message that gives more context about what a user needs to input. It's commonly used in forms.
72
+ */
73
+ const _HelpText = React.forwardRef(HelpText);
74
+ export {_HelpText as HelpText};