@igne-agency/react-web-ui 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (254) hide show
  1. package/dist/components/accordion/accordion.css +21 -21
  2. package/dist/components/accordion/accordion.d.ts +17 -4
  3. package/dist/components/accordion/accordion.js +83 -36
  4. package/dist/components/accordion/accordion.module.js +6 -6
  5. package/dist/components/attachment-tile/attachment-preview.d.ts +56 -13
  6. package/dist/components/attachment-tile/attachment-preview.js +388 -119
  7. package/dist/components/attachment-tile/attachment-tile.css +31 -25
  8. package/dist/components/attachment-tile/attachment-tile.d.ts +32 -10
  9. package/dist/components/attachment-tile/attachment-tile.js +160 -43
  10. package/dist/components/attachment-tile/attachment-tile.module.js +8 -8
  11. package/dist/components/attachment-tile/index.d.ts +1 -1
  12. package/dist/components/avatar/avatar.css +9 -9
  13. package/dist/components/avatar/avatar.d.ts +50 -5
  14. package/dist/components/avatar/avatar.js +178 -64
  15. package/dist/components/avatar/avatar.module.js +3 -3
  16. package/dist/components/avatar-group/avatar-group-context.d.ts +2 -4
  17. package/dist/components/avatar-group/avatar-group-context.js +2 -2
  18. package/dist/components/avatar-group/avatar-group.css +26 -20
  19. package/dist/components/avatar-group/avatar-group.d.ts +85 -27
  20. package/dist/components/avatar-group/avatar-group.js +400 -246
  21. package/dist/components/avatar-group/avatar-group.module.js +8 -8
  22. package/dist/components/breadcrumbs/breadcrumbs.css +12 -12
  23. package/dist/components/breadcrumbs/breadcrumbs.d.ts +69 -23
  24. package/dist/components/breadcrumbs/breadcrumbs.js +299 -248
  25. package/dist/components/breadcrumbs/breadcrumbs.module.js +8 -8
  26. package/dist/components/button/button.css +29 -31
  27. package/dist/components/button/button.d.ts +20 -16
  28. package/dist/components/button/button.js +140 -145
  29. package/dist/components/button/button.module.js +1 -1
  30. package/dist/components/button/index.js +1 -1
  31. package/dist/components/checkbox-field/checkbox-field.js +63 -49
  32. package/dist/components/checkbox-field/checkbox.css +105 -56
  33. package/dist/components/checkbox-field/checkbox.d.ts +3 -2
  34. package/dist/components/checkbox-field/checkbox.js +12 -9
  35. package/dist/components/checkbox-field/checkbox.module.js +4 -4
  36. package/dist/components/checkbox-group-field/checkbox-group-field.js +78 -72
  37. package/dist/components/checkbox-group-field/checkbox-group.css +14 -10
  38. package/dist/components/checkbox-group-field/checkbox-group.d.ts +2 -2
  39. package/dist/components/checkbox-group-field/checkbox-group.js +2 -2
  40. package/dist/components/checkbox-group-field/checkbox-group.module.js +2 -2
  41. package/dist/components/collapsible/collapsible.css +20 -20
  42. package/dist/components/collapsible/collapsible.d.ts +17 -4
  43. package/dist/components/collapsible/collapsible.js +83 -36
  44. package/dist/components/collapsible/collapsible.module.js +5 -5
  45. package/dist/components/combobox-field/combobox-field.js +206 -158
  46. package/dist/components/combobox-field/combobox.css +492 -277
  47. package/dist/components/combobox-field/combobox.d.ts +148 -39
  48. package/dist/components/combobox-field/combobox.js +506 -206
  49. package/dist/components/combobox-field/combobox.module.js +21 -21
  50. package/dist/components/combobox-field/value-state-view.css +5 -5
  51. package/dist/components/combobox-field/value-state-view.module.js +4 -4
  52. package/dist/components/composer/composer-attachments.d.ts +30 -11
  53. package/dist/components/composer/composer-attachments.js +45 -40
  54. package/dist/components/composer/composer-editor.css +40 -35
  55. package/dist/components/composer/composer-editor.d.ts +14 -4
  56. package/dist/components/composer/composer-editor.js +134 -44
  57. package/dist/components/composer/composer-editor.module.js +5 -5
  58. package/dist/components/composer/composer.css +22 -22
  59. package/dist/components/composer/composer.d.ts +13 -2
  60. package/dist/components/composer/composer.js +78 -63
  61. package/dist/components/composer/composer.module.js +5 -5
  62. package/dist/components/composer/index.d.ts +2 -2
  63. package/dist/components/composer/mention-text.css +5 -5
  64. package/dist/components/composer/mention-text.module.js +1 -1
  65. package/dist/components/confirm-dialog/confirm-dialog.css +29 -29
  66. package/dist/components/confirm-dialog/confirm-dialog.d.ts +57 -3
  67. package/dist/components/confirm-dialog/confirm-dialog.js +266 -108
  68. package/dist/components/confirm-dialog/confirm-dialog.module.js +5 -5
  69. package/dist/components/conversation/conversation.css +52 -52
  70. package/dist/components/conversation/conversation.d.ts +43 -18
  71. package/dist/components/conversation/conversation.js +120 -78
  72. package/dist/components/conversation/conversation.module.js +15 -15
  73. package/dist/components/date-field/date-field.d.ts +1 -1
  74. package/dist/components/date-field/date-field.js +202 -100
  75. package/dist/components/date-field/date-input.d.ts +73 -37
  76. package/dist/components/date-field/date-input.js +72 -45
  77. package/dist/components/date-field/index.d.ts +1 -1
  78. package/dist/components/date-range-field/date-range-field.d.ts +1 -1
  79. package/dist/components/date-range-field/date-range-field.js +219 -107
  80. package/dist/components/date-range-field/date-range-input.d.ts +84 -40
  81. package/dist/components/date-range-field/date-range-input.js +83 -48
  82. package/dist/components/dialog/dialog.css +32 -32
  83. package/dist/components/dialog/dialog.d.ts +8 -7
  84. package/dist/components/dialog/dialog.js +8 -26
  85. package/dist/components/dialog/dialog.module.js +6 -6
  86. package/dist/components/divider/divider.css +6 -6
  87. package/dist/components/divider/divider.d.ts +36 -2
  88. package/dist/components/divider/divider.js +195 -29
  89. package/dist/components/divider/divider.module.js +3 -3
  90. package/dist/components/drawer/drawer.css +55 -56
  91. package/dist/components/drawer/drawer.d.ts +8 -7
  92. package/dist/components/drawer/drawer.js +8 -26
  93. package/dist/components/drawer/drawer.module.js +6 -6
  94. package/dist/components/field/field.css +34 -24
  95. package/dist/components/field/field.d.ts +60 -37
  96. package/dist/components/field/field.js +242 -157
  97. package/dist/components/field/field.module.js +12 -10
  98. package/dist/components/field/input-parts.d.ts +11 -13
  99. package/dist/components/field/input-parts.js +23 -42
  100. package/dist/components/field-placeholder/field-placeholder.css +6 -6
  101. package/dist/components/field-placeholder/field-placeholder.module.js +4 -4
  102. package/dist/components/fieldset/field-group.d.ts +1 -1
  103. package/dist/components/fieldset/field-group.js +48 -42
  104. package/dist/components/fieldset/fieldset-root.d.ts +1 -1
  105. package/dist/components/fieldset/fieldset-root.js +19 -17
  106. package/dist/components/fieldset/fieldset.d.ts +2 -2
  107. package/dist/components/fieldset/fieldset.js +2 -2
  108. package/dist/components/file-field/file-field.css +126 -60
  109. package/dist/components/file-field/file-field.js +201 -109
  110. package/dist/components/file-field/file-field.module.js +4 -4
  111. package/dist/components/file-field/file-input.d.ts +66 -40
  112. package/dist/components/file-field/file-input.js +188 -132
  113. package/dist/components/filter-bar/filter-bar.css +8 -8
  114. package/dist/components/filter-bar/filter-bar.d.ts +12 -3
  115. package/dist/components/filter-bar/filter-bar.js +23 -25
  116. package/dist/components/filter-bar/filter-bar.module.js +5 -5
  117. package/dist/components/form/form.d.ts +19 -7
  118. package/dist/components/form/form.js +80 -29
  119. package/dist/components/icon/icon.css +2 -2
  120. package/dist/components/icon/icon.module.js +1 -1
  121. package/dist/components/link/link.css +6 -5
  122. package/dist/components/link/link.module.js +1 -1
  123. package/dist/components/menu/menu.css +52 -47
  124. package/dist/components/menu/menu.d.ts +32 -25
  125. package/dist/components/menu/menu.js +75 -124
  126. package/dist/components/menu/menu.module.js +8 -8
  127. package/dist/components/nav/nav-context.d.ts +1 -1
  128. package/dist/components/nav/nav-item-view.d.ts +10 -13
  129. package/dist/components/nav/nav-item-view.js +42 -54
  130. package/dist/components/nav/nav.css +150 -119
  131. package/dist/components/nav/nav.d.ts +61 -17
  132. package/dist/components/nav/nav.js +271 -176
  133. package/dist/components/nav/nav.module.js +17 -15
  134. package/dist/components/number-field/number-field.css +153 -64
  135. package/dist/components/number-field/number-field.d.ts +2 -2
  136. package/dist/components/number-field/number-field.js +112 -91
  137. package/dist/components/number-field/number-field.module.js +6 -6
  138. package/dist/components/number-field/number-input.d.ts +43 -23
  139. package/dist/components/number-field/number-input.js +179 -125
  140. package/dist/components/otp-field/otp-field.css +153 -60
  141. package/dist/components/otp-field/otp-field.d.ts +2 -2
  142. package/dist/components/otp-field/otp-field.js +62 -46
  143. package/dist/components/otp-field/otp-field.module.js +4 -4
  144. package/dist/components/otp-field/otp-input.d.ts +8 -6
  145. package/dist/components/otp-field/otp-input.js +92 -92
  146. package/dist/components/pagination/pagination.d.ts +46 -15
  147. package/dist/components/pagination/pagination.js +217 -224
  148. package/dist/components/password-field/password-field.css +23 -23
  149. package/dist/components/password-field/password-field.js +107 -85
  150. package/dist/components/password-field/password-field.module.js +8 -8
  151. package/dist/components/password-field/password-strength.d.ts +107 -3
  152. package/dist/components/password-field/password-strength.js +569 -92
  153. package/dist/components/photo-field/photo-field.js +137 -112
  154. package/dist/components/photo-field/photo-input.css +67 -44
  155. package/dist/components/photo-field/photo-input.d.ts +59 -15
  156. package/dist/components/photo-field/photo-input.js +173 -86
  157. package/dist/components/photo-field/photo-input.module.js +10 -8
  158. package/dist/components/popover/popover.css +41 -41
  159. package/dist/components/popover/popover.d.ts +66 -25
  160. package/dist/components/popover/popover.js +332 -217
  161. package/dist/components/popover/popover.module.js +15 -19
  162. package/dist/components/radio-group-field/radio-group-field.js +80 -71
  163. package/dist/components/radio-group-field/radio-group.css +112 -60
  164. package/dist/components/radio-group-field/radio-group.d.ts +19 -3
  165. package/dist/components/radio-group-field/radio-group.js +66 -23
  166. package/dist/components/radio-group-field/radio-group.module.js +4 -4
  167. package/dist/components/segmented-control-field/segmented-control-field.d.ts +1 -1
  168. package/dist/components/segmented-control-field/segmented-control-field.js +111 -96
  169. package/dist/components/segmented-control-field/segmented-control.css +132 -79
  170. package/dist/components/segmented-control-field/segmented-control.d.ts +39 -15
  171. package/dist/components/segmented-control-field/segmented-control.js +124 -41
  172. package/dist/components/segmented-control-field/segmented-control.module.js +4 -4
  173. package/dist/components/select-field/select.css +214 -101
  174. package/dist/components/select-field/select.d.ts +43 -11
  175. package/dist/components/select-field/select.js +194 -109
  176. package/dist/components/select-field/select.module.js +14 -14
  177. package/dist/components/skeleton/skeleton.css +4 -4
  178. package/dist/components/skeleton/skeleton.module.js +3 -3
  179. package/dist/components/stale/stale.css +15 -15
  180. package/dist/components/stale/stale.d.ts +27 -3
  181. package/dist/components/stale/stale.js +147 -66
  182. package/dist/components/stale/stale.module.js +6 -6
  183. package/dist/components/status-message/status-message.css +22 -22
  184. package/dist/components/status-message/status-message.module.js +6 -6
  185. package/dist/components/switch-field/switch-field.js +77 -57
  186. package/dist/components/switch-field/switch.css +112 -63
  187. package/dist/components/switch-field/switch.d.ts +20 -3
  188. package/dist/components/switch-field/switch.js +70 -27
  189. package/dist/components/switch-field/switch.module.js +4 -4
  190. package/dist/components/tabs/tabs.css +32 -32
  191. package/dist/components/tabs/tabs.d.ts +21 -7
  192. package/dist/components/tabs/tabs.js +73 -14
  193. package/dist/components/tabs/tabs.module.js +7 -7
  194. package/dist/components/tag/tag.css +84 -84
  195. package/dist/components/tag/tag.module.js +3 -3
  196. package/dist/components/tag-group/tag-group.css +94 -94
  197. package/dist/components/tag-group/tag-group.module.js +4 -4
  198. package/dist/components/text-field/text-field.css +159 -82
  199. package/dist/components/text-field/text-field.d.ts +1 -1
  200. package/dist/components/text-field/text-field.js +139 -110
  201. package/dist/components/text-field/text-field.module.js +9 -9
  202. package/dist/components/text-field/text-input.d.ts +81 -45
  203. package/dist/components/text-field/text-input.js +366 -217
  204. package/dist/components/textarea-field/textarea-field.css +7 -2
  205. package/dist/components/textarea-field/textarea-field.js +72 -56
  206. package/dist/components/textarea-field/textarea-field.module.js +2 -2
  207. package/dist/components/time-field/time-field.js +153 -60
  208. package/dist/components/time-field/time-input.d.ts +21 -10
  209. package/dist/components/time-field/time-input.js +22 -11
  210. package/dist/components/toast/toast-provider.css +34 -31
  211. package/dist/components/toast/toast-provider.d.ts +63 -14
  212. package/dist/components/toast/toast-provider.js +174 -111
  213. package/dist/components/toast/toast-provider.module.js +7 -7
  214. package/dist/components/toggle-group-field/toggle-group-field.d.ts +1 -1
  215. package/dist/components/toggle-group-field/toggle-group-field.js +95 -89
  216. package/dist/components/toggle-group-field/toggle-group.css +117 -67
  217. package/dist/components/toggle-group-field/toggle-group.d.ts +2 -2
  218. package/dist/components/toggle-group-field/toggle-group.js +2 -2
  219. package/dist/components/toggle-group-field/toggle-group.module.js +2 -2
  220. package/dist/components/tooltip/tooltip.css +4 -4
  221. package/dist/components/tooltip/tooltip.module.js +1 -1
  222. package/dist/data-table/data-table-content.js +6 -5
  223. package/dist/data-table/data-table-parts.d.ts +41 -13
  224. package/dist/data-table/data-table-parts.js +213 -172
  225. package/dist/data-table/data-table-selection.d.ts +105 -3
  226. package/dist/data-table/data-table-selection.js +654 -145
  227. package/dist/data-table/data-table.css +125 -128
  228. package/dist/data-table/data-table.d.ts +21 -26
  229. package/dist/data-table/data-table.js +20 -23
  230. package/dist/data-table/data-table.module.js +32 -34
  231. package/dist/data-table/index.d.ts +2 -2
  232. package/dist/index.js +3 -3
  233. package/dist/lib/calendar/calendar-navigation.d.ts +39 -5
  234. package/dist/lib/calendar/calendar-navigation.js +185 -118
  235. package/dist/lib/calendar/calendar-parts.d.ts +143 -0
  236. package/dist/lib/calendar/calendar-parts.js +540 -0
  237. package/dist/lib/calendar/calendar-prefab.d.ts +52 -0
  238. package/dist/lib/calendar/calendar-prefab.js +311 -0
  239. package/dist/lib/calendar/calendar-year.d.ts +3 -1
  240. package/dist/lib/calendar/calendar-year.js +139 -131
  241. package/dist/lib/calendar/temporal.css +325 -232
  242. package/dist/lib/calendar/temporal.d.ts +67 -82
  243. package/dist/lib/calendar/temporal.js +258 -569
  244. package/dist/lib/calendar/temporal.module.js +38 -38
  245. package/dist/lib/forms/use-connected-field.d.ts +1 -1
  246. package/dist/lib/forms/use-connected-field.js +1 -1
  247. package/dist/lib/render-as.d.ts +13 -0
  248. package/dist/lib/render-as.js +46 -0
  249. package/dist/tokens.css +6 -3
  250. package/package.json +1 -1
  251. package/tokens/dark.tokens.json +6 -0
  252. package/tokens/sys.tokens.json +7 -0
  253. package/dist/components/button/close-button.d.ts +0 -16
  254. package/dist/components/button/close-button.js +0 -30
@@ -1,124 +1,601 @@
1
1
  import { usePasswordStrength } from "../../lib/password-strength/password-strength.js";
2
+ import { useRequiredContext } from "../../lib/use-required-context.js";
2
3
  import { useLocale } from "../locale-provider/locale-provider.js";
3
4
  import password_field_module_default from "./password-field.module.js";
4
5
  import { c } from "react/compiler-runtime";
6
+ import { useRender } from "@base-ui/react/use-render";
5
7
  import { clsx } from "clsx";
6
8
  import { jsx, jsxs } from "react/jsx-runtime";
9
+ import { createContext } from "react";
7
10
  import { Meter } from "@base-ui/react/meter";
8
11
  // src/components/password-field/password-strength.tsx
9
12
  var MAX_SCORE = 4;
13
+ var StrengthContext = createContext(null);
14
+ var useStrength = () => {
15
+ return useRequiredContext(StrengthContext, "PasswordStrength parts must be rendered within <PasswordStrength.Root>.");
16
+ };
17
+ var BandContext = createContext(null);
18
+ var useBand = () => {
19
+ return useRequiredContext(BandContext, "PasswordStrength.Value must be rendered within <PasswordStrength.Meter>.");
20
+ };
10
21
  /**
11
- * The strength band of a password as a labelled meter, followed by zxcvbn's own
12
- * warning and suggestions in the locale's language. It suspends while that
13
- * language's dictionaries load, and renders nothing for an empty password.
22
+ * Judges `password` with zxcvbn in the locale's language and hands the result
23
+ * to the parts inside it. It suspends while that language's dictionaries load,
24
+ * and renders nothing for an empty password.
14
25
  *
15
26
  * @example
16
- * <PasswordStrength password={password} label="Password strength" scoreLabels={SCORE_LABELS} />
27
+ * <PasswordStrength.Root password={password}>…</PasswordStrength.Root>
17
28
  */
18
- var PasswordStrength = (t0) => {
19
- const $ = c(23);
20
- const { password, label, scoreLabels, languages, className } = t0;
29
+ var Root = (t0) => {
30
+ const $ = c(20);
31
+ let className;
32
+ let languages;
33
+ let password;
34
+ let props;
35
+ let ref;
36
+ let render;
37
+ if ($[0] !== t0) {
38
+ ({password, languages, className, render, ref, ...props} = t0);
39
+ $[0] = t0;
40
+ $[1] = className;
41
+ $[2] = languages;
42
+ $[3] = password;
43
+ $[4] = props;
44
+ $[5] = ref;
45
+ $[6] = render;
46
+ } else {
47
+ className = $[1];
48
+ languages = $[2];
49
+ password = $[3];
50
+ props = $[4];
51
+ ref = $[5];
52
+ render = $[6];
53
+ }
21
54
  const strength = usePasswordStrength(password, useLocale(), languages);
22
- if (strength === null) return null;
23
- const band = scoreLabels[strength.score];
55
+ const t1 = strength !== null;
56
+ let t2;
57
+ if ($[7] !== className) {
58
+ t2 = clsx(password_field_module_default.strength, className);
59
+ $[7] = className;
60
+ $[8] = t2;
61
+ } else t2 = $[8];
62
+ let t3;
63
+ if ($[9] !== props || $[10] !== t2) {
64
+ t3 = {
65
+ ...props,
66
+ className: t2
67
+ };
68
+ $[9] = props;
69
+ $[10] = t2;
70
+ $[11] = t3;
71
+ } else t3 = $[11];
72
+ let t4;
73
+ if ($[12] !== ref || $[13] !== render || $[14] !== t1 || $[15] !== t3) {
74
+ t4 = {
75
+ render,
76
+ ref,
77
+ enabled: t1,
78
+ props: t3
79
+ };
80
+ $[12] = ref;
81
+ $[13] = render;
82
+ $[14] = t1;
83
+ $[15] = t3;
84
+ $[16] = t4;
85
+ } else t4 = $[16];
86
+ const element = useRender(t4);
87
+ let t5;
88
+ if ($[17] !== element || $[18] !== strength) {
89
+ t5 = strength === null ? null : /* @__PURE__ */ jsx(StrengthContext, {
90
+ value: strength,
91
+ children: element
92
+ });
93
+ $[17] = element;
94
+ $[18] = strength;
95
+ $[19] = t5;
96
+ } else t5 = $[19];
97
+ return t5;
98
+ };
99
+ /**
100
+ * The strength band as a meter, read as the band's name. It sets `data-score`,
101
+ * which the `Value` and `Indicator` inside it colour by.
102
+ *
103
+ * @example
104
+ * <PasswordStrength.Meter scoreLabels={SCORE_LABELS}>…</PasswordStrength.Meter>
105
+ */
106
+ var StrengthMeter = (t0) => {
107
+ const $ = c(16);
108
+ let className;
109
+ let props;
110
+ let scoreLabels;
111
+ if ($[0] !== t0) {
112
+ ({scoreLabels, className, ...props} = t0);
113
+ $[0] = t0;
114
+ $[1] = className;
115
+ $[2] = props;
116
+ $[3] = scoreLabels;
117
+ } else {
118
+ className = $[1];
119
+ props = $[2];
120
+ scoreLabels = $[3];
121
+ }
122
+ const { score } = useStrength();
123
+ const band = scoreLabels[score];
24
124
  let t1;
25
- if ($[0] !== className) {
26
- t1 = clsx(password_field_module_default.strength, className);
27
- $[0] = className;
28
- $[1] = t1;
29
- } else t1 = $[1];
125
+ if ($[4] !== band) {
126
+ t1 = () => band;
127
+ $[4] = band;
128
+ $[5] = t1;
129
+ } else t1 = $[5];
30
130
  let t2;
31
- if ($[2] !== band) {
32
- t2 = () => band;
33
- $[2] = band;
34
- $[3] = t2;
35
- } else t2 = $[3];
131
+ if ($[6] !== className) {
132
+ t2 = clsx(password_field_module_default.meter, className);
133
+ $[6] = className;
134
+ $[7] = t2;
135
+ } else t2 = $[7];
36
136
  let t3;
37
- if ($[4] !== label) {
38
- t3 = /* @__PURE__ */ jsx(Meter.Label, {
39
- className: password_field_module_default.meterLabel,
40
- children: label
137
+ if ($[8] !== props || $[9] !== score || $[10] !== t1 || $[11] !== t2) {
138
+ t3 = /* @__PURE__ */ jsx(Meter.Root, {
139
+ value: score,
140
+ max: MAX_SCORE,
141
+ "data-score": score,
142
+ getAriaValueText: t1,
143
+ className: t2,
144
+ ...props
41
145
  });
42
- $[4] = label;
43
- $[5] = t3;
44
- } else t3 = $[5];
146
+ $[8] = props;
147
+ $[9] = score;
148
+ $[10] = t1;
149
+ $[11] = t2;
150
+ $[12] = t3;
151
+ } else t3 = $[12];
45
152
  let t4;
46
- if ($[6] !== band) {
47
- t4 = /* @__PURE__ */ jsx(Meter.Value, {
48
- className: password_field_module_default.meterValue,
49
- children: () => band
153
+ if ($[13] !== band || $[14] !== t3) {
154
+ t4 = /* @__PURE__ */ jsx(BandContext, {
155
+ value: band,
156
+ children: t3
50
157
  });
51
- $[6] = band;
52
- $[7] = t4;
53
- } else t4 = $[7];
54
- let t5;
55
- if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
56
- t5 = /* @__PURE__ */ jsx(Meter.Track, {
57
- className: password_field_module_default.meterTrack,
58
- children: /* @__PURE__ */ jsx(Meter.Indicator, { className: password_field_module_default.meterIndicator })
158
+ $[13] = band;
159
+ $[14] = t3;
160
+ $[15] = t4;
161
+ } else t4 = $[15];
162
+ return t4;
163
+ };
164
+ /**
165
+ * The meter's label, such as "Password strength".
166
+ *
167
+ * @example
168
+ * <PasswordStrength.Label>Password strength</PasswordStrength.Label>
169
+ */
170
+ var Label = (t0) => {
171
+ const $ = c(8);
172
+ let className;
173
+ let props;
174
+ if ($[0] !== t0) {
175
+ ({className, ...props} = t0);
176
+ $[0] = t0;
177
+ $[1] = className;
178
+ $[2] = props;
179
+ } else {
180
+ className = $[1];
181
+ props = $[2];
182
+ }
183
+ let t1;
184
+ if ($[3] !== className) {
185
+ t1 = clsx(password_field_module_default.meterLabel, className);
186
+ $[3] = className;
187
+ $[4] = t1;
188
+ } else t1 = $[4];
189
+ let t2;
190
+ if ($[5] !== props || $[6] !== t1) {
191
+ t2 = /* @__PURE__ */ jsx(Meter.Label, {
192
+ className: t1,
193
+ ...props
59
194
  });
60
- $[8] = t5;
61
- } else t5 = $[8];
62
- let t6;
63
- if ($[9] !== strength.score || $[10] !== t2 || $[11] !== t3 || $[12] !== t4) {
64
- t6 = /* @__PURE__ */ jsxs(Meter.Root, {
65
- value: strength.score,
66
- max: MAX_SCORE,
67
- "data-score": strength.score,
68
- getAriaValueText: t2,
69
- className: password_field_module_default.meter,
195
+ $[5] = props;
196
+ $[6] = t1;
197
+ $[7] = t2;
198
+ } else t2 = $[7];
199
+ return t2;
200
+ };
201
+ /**
202
+ * The band's name, such as "Fair", from the meter's `scoreLabels`.
203
+ *
204
+ * @example
205
+ * <PasswordStrength.Value />
206
+ */
207
+ var Value = (t0) => {
208
+ const $ = c(11);
209
+ let className;
210
+ let props;
211
+ if ($[0] !== t0) {
212
+ ({className, ...props} = t0);
213
+ $[0] = t0;
214
+ $[1] = className;
215
+ $[2] = props;
216
+ } else {
217
+ className = $[1];
218
+ props = $[2];
219
+ }
220
+ const band = useBand();
221
+ let t1;
222
+ if ($[3] !== className) {
223
+ t1 = clsx(password_field_module_default.meterValue, className);
224
+ $[3] = className;
225
+ $[4] = t1;
226
+ } else t1 = $[4];
227
+ let t2;
228
+ if ($[5] !== band) {
229
+ t2 = () => band;
230
+ $[5] = band;
231
+ $[6] = t2;
232
+ } else t2 = $[6];
233
+ let t3;
234
+ if ($[7] !== props || $[8] !== t1 || $[9] !== t2) {
235
+ t3 = /* @__PURE__ */ jsx(Meter.Value, {
236
+ className: t1,
237
+ ...props,
238
+ children: t2
239
+ });
240
+ $[7] = props;
241
+ $[8] = t1;
242
+ $[9] = t2;
243
+ $[10] = t3;
244
+ } else t3 = $[10];
245
+ return t3;
246
+ };
247
+ /**
248
+ * The bar the indicator fills.
249
+ *
250
+ * @example
251
+ * <PasswordStrength.Track><PasswordStrength.Indicator /></PasswordStrength.Track>
252
+ */
253
+ var Track = (t0) => {
254
+ const $ = c(8);
255
+ let className;
256
+ let props;
257
+ if ($[0] !== t0) {
258
+ ({className, ...props} = t0);
259
+ $[0] = t0;
260
+ $[1] = className;
261
+ $[2] = props;
262
+ } else {
263
+ className = $[1];
264
+ props = $[2];
265
+ }
266
+ let t1;
267
+ if ($[3] !== className) {
268
+ t1 = clsx(password_field_module_default.meterTrack, className);
269
+ $[3] = className;
270
+ $[4] = t1;
271
+ } else t1 = $[4];
272
+ let t2;
273
+ if ($[5] !== props || $[6] !== t1) {
274
+ t2 = /* @__PURE__ */ jsx(Meter.Track, {
275
+ className: t1,
276
+ ...props
277
+ });
278
+ $[5] = props;
279
+ $[6] = t1;
280
+ $[7] = t2;
281
+ } else t2 = $[7];
282
+ return t2;
283
+ };
284
+ /**
285
+ * The fill of the track, as far as the band reaches and in its colour.
286
+ *
287
+ * @example
288
+ * <PasswordStrength.Indicator />
289
+ */
290
+ var Indicator = (t0) => {
291
+ const $ = c(8);
292
+ let className;
293
+ let props;
294
+ if ($[0] !== t0) {
295
+ ({className, ...props} = t0);
296
+ $[0] = t0;
297
+ $[1] = className;
298
+ $[2] = props;
299
+ } else {
300
+ className = $[1];
301
+ props = $[2];
302
+ }
303
+ let t1;
304
+ if ($[3] !== className) {
305
+ t1 = clsx(password_field_module_default.meterIndicator, className);
306
+ $[3] = className;
307
+ $[4] = t1;
308
+ } else t1 = $[4];
309
+ let t2;
310
+ if ($[5] !== props || $[6] !== t1) {
311
+ t2 = /* @__PURE__ */ jsx(Meter.Indicator, {
312
+ className: t1,
313
+ ...props
314
+ });
315
+ $[5] = props;
316
+ $[6] = t1;
317
+ $[7] = t2;
318
+ } else t2 = $[7];
319
+ return t2;
320
+ };
321
+ /**
322
+ * zxcvbn's own warning, in the locale's language. Renders nothing without one.
323
+ *
324
+ * @example
325
+ * <PasswordStrength.Feedback />
326
+ */
327
+ var Feedback = (t0) => {
328
+ const $ = c(16);
329
+ let className;
330
+ let props;
331
+ let ref;
332
+ let render;
333
+ if ($[0] !== t0) {
334
+ ({className, render, ref, ...props} = t0);
335
+ $[0] = t0;
336
+ $[1] = className;
337
+ $[2] = props;
338
+ $[3] = ref;
339
+ $[4] = render;
340
+ } else {
341
+ className = $[1];
342
+ props = $[2];
343
+ ref = $[3];
344
+ render = $[4];
345
+ }
346
+ const { warning } = useStrength();
347
+ const t1 = warning !== "";
348
+ let t2;
349
+ if ($[5] !== className) {
350
+ t2 = clsx(password_field_module_default.feedback, className);
351
+ $[5] = className;
352
+ $[6] = t2;
353
+ } else t2 = $[6];
354
+ let t3;
355
+ if ($[7] !== props || $[8] !== t2 || $[9] !== warning) {
356
+ t3 = {
357
+ ...props,
358
+ className: t2,
359
+ children: warning
360
+ };
361
+ $[7] = props;
362
+ $[8] = t2;
363
+ $[9] = warning;
364
+ $[10] = t3;
365
+ } else t3 = $[10];
366
+ let t4;
367
+ if ($[11] !== ref || $[12] !== render || $[13] !== t1 || $[14] !== t3) {
368
+ t4 = {
369
+ defaultTagName: "p",
370
+ render,
371
+ ref,
372
+ enabled: t1,
373
+ props: t3
374
+ };
375
+ $[11] = ref;
376
+ $[12] = render;
377
+ $[13] = t1;
378
+ $[14] = t3;
379
+ $[15] = t4;
380
+ } else t4 = $[15];
381
+ return useRender(t4);
382
+ };
383
+ /**
384
+ * zxcvbn's own suggestions, in the locale's language, as a list. Renders
385
+ * nothing without any.
386
+ *
387
+ * @example
388
+ * <PasswordStrength.Suggestions>
389
+ * {suggestion => <PasswordStrength.Suggestion key={suggestion}>{suggestion}</PasswordStrength.Suggestion>}
390
+ * </PasswordStrength.Suggestions>
391
+ */
392
+ var Suggestions = (t0) => {
393
+ const $ = c(20);
394
+ let children;
395
+ let className;
396
+ let props;
397
+ let ref;
398
+ let render;
399
+ if ($[0] !== t0) {
400
+ ({className, render, ref, children, ...props} = t0);
401
+ $[0] = t0;
402
+ $[1] = children;
403
+ $[2] = className;
404
+ $[3] = props;
405
+ $[4] = ref;
406
+ $[5] = render;
407
+ } else {
408
+ children = $[1];
409
+ className = $[2];
410
+ props = $[3];
411
+ ref = $[4];
412
+ render = $[5];
413
+ }
414
+ const { suggestions } = useStrength();
415
+ const t1 = suggestions.length > 0;
416
+ let t2;
417
+ if ($[6] !== className) {
418
+ t2 = clsx(password_field_module_default.suggestions, className);
419
+ $[6] = className;
420
+ $[7] = t2;
421
+ } else t2 = $[7];
422
+ let t3;
423
+ if ($[8] !== children || $[9] !== suggestions) {
424
+ t3 = suggestions.map(children);
425
+ $[8] = children;
426
+ $[9] = suggestions;
427
+ $[10] = t3;
428
+ } else t3 = $[10];
429
+ let t4;
430
+ if ($[11] !== props || $[12] !== t2 || $[13] !== t3) {
431
+ t4 = {
432
+ ...props,
433
+ className: t2,
434
+ children: t3
435
+ };
436
+ $[11] = props;
437
+ $[12] = t2;
438
+ $[13] = t3;
439
+ $[14] = t4;
440
+ } else t4 = $[14];
441
+ let t5;
442
+ if ($[15] !== ref || $[16] !== render || $[17] !== t1 || $[18] !== t4) {
443
+ t5 = {
444
+ defaultTagName: "ul",
445
+ render,
446
+ ref,
447
+ enabled: t1,
448
+ props: t4
449
+ };
450
+ $[15] = ref;
451
+ $[16] = render;
452
+ $[17] = t1;
453
+ $[18] = t4;
454
+ $[19] = t5;
455
+ } else t5 = $[19];
456
+ return useRender(t5);
457
+ };
458
+ /**
459
+ * One of zxcvbn's suggestions.
460
+ *
461
+ * @example
462
+ * <PasswordStrength.Suggestion>{suggestion}</PasswordStrength.Suggestion>
463
+ */
464
+ var Suggestion = (t0) => {
465
+ const $ = c(14);
466
+ let className;
467
+ let props;
468
+ let ref;
469
+ let render;
470
+ if ($[0] !== t0) {
471
+ ({className, render, ref, ...props} = t0);
472
+ $[0] = t0;
473
+ $[1] = className;
474
+ $[2] = props;
475
+ $[3] = ref;
476
+ $[4] = render;
477
+ } else {
478
+ className = $[1];
479
+ props = $[2];
480
+ ref = $[3];
481
+ render = $[4];
482
+ }
483
+ let t1;
484
+ if ($[5] !== className) {
485
+ t1 = clsx(password_field_module_default.feedback, className);
486
+ $[5] = className;
487
+ $[6] = t1;
488
+ } else t1 = $[6];
489
+ let t2;
490
+ if ($[7] !== props || $[8] !== t1) {
491
+ t2 = {
492
+ ...props,
493
+ className: t1
494
+ };
495
+ $[7] = props;
496
+ $[8] = t1;
497
+ $[9] = t2;
498
+ } else t2 = $[9];
499
+ let t3;
500
+ if ($[10] !== ref || $[11] !== render || $[12] !== t2) {
501
+ t3 = {
502
+ defaultTagName: "li",
503
+ render,
504
+ ref,
505
+ props: t2
506
+ };
507
+ $[10] = ref;
508
+ $[11] = render;
509
+ $[12] = t2;
510
+ $[13] = t3;
511
+ } else t3 = $[13];
512
+ return useRender(t3);
513
+ };
514
+ var Prefab = (t0) => {
515
+ const $ = c(14);
516
+ const { password, label, scoreLabels, languages, className } = t0;
517
+ let t1;
518
+ if ($[0] !== label) {
519
+ t1 = /* @__PURE__ */ jsx(Label, { children: label });
520
+ $[0] = label;
521
+ $[1] = t1;
522
+ } else t1 = $[1];
523
+ let t2;
524
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
525
+ t2 = /* @__PURE__ */ jsx(Value, {});
526
+ $[2] = t2;
527
+ } else t2 = $[2];
528
+ let t3;
529
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
530
+ t3 = /* @__PURE__ */ jsx(Track, { children: /* @__PURE__ */ jsx(Indicator, {}) });
531
+ $[3] = t3;
532
+ } else t3 = $[3];
533
+ let t4;
534
+ if ($[4] !== scoreLabels || $[5] !== t1) {
535
+ t4 = /* @__PURE__ */ jsxs(StrengthMeter, {
536
+ scoreLabels,
70
537
  children: [
71
- t3,
72
- t4,
73
- t5
538
+ t1,
539
+ t2,
540
+ t3
74
541
  ]
75
542
  });
76
- $[9] = strength.score;
77
- $[10] = t2;
78
- $[11] = t3;
79
- $[12] = t4;
80
- $[13] = t6;
81
- } else t6 = $[13];
543
+ $[4] = scoreLabels;
544
+ $[5] = t1;
545
+ $[6] = t4;
546
+ } else t4 = $[6];
547
+ let t5;
548
+ let t6;
549
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
550
+ t5 = /* @__PURE__ */ jsx(Feedback, {});
551
+ t6 = /* @__PURE__ */ jsx(Suggestions, { children: _temp });
552
+ $[7] = t5;
553
+ $[8] = t6;
554
+ } else {
555
+ t5 = $[7];
556
+ t6 = $[8];
557
+ }
82
558
  let t7;
83
- if ($[14] !== strength.warning) {
84
- t7 = strength.warning !== "" && /* @__PURE__ */ jsx("p", {
85
- className: password_field_module_default.feedback,
86
- children: strength.warning
87
- });
88
- $[14] = strength.warning;
89
- $[15] = t7;
90
- } else t7 = $[15];
91
- let t8;
92
- if ($[16] !== strength.suggestions) {
93
- t8 = strength.suggestions.length > 0 && /* @__PURE__ */ jsx("ul", {
94
- className: password_field_module_default.suggestions,
95
- children: strength.suggestions.map(_temp)
96
- });
97
- $[16] = strength.suggestions;
98
- $[17] = t8;
99
- } else t8 = $[17];
100
- let t9;
101
- if ($[18] !== t1 || $[19] !== t6 || $[20] !== t7 || $[21] !== t8) {
102
- t9 = /* @__PURE__ */ jsxs("div", {
103
- className: t1,
559
+ if ($[9] !== className || $[10] !== languages || $[11] !== password || $[12] !== t4) {
560
+ t7 = /* @__PURE__ */ jsxs(Root, {
561
+ password,
562
+ languages,
563
+ className,
104
564
  children: [
105
- t6,
106
- t7,
107
- t8
565
+ t4,
566
+ t5,
567
+ t6
108
568
  ]
109
569
  });
110
- $[18] = t1;
111
- $[19] = t6;
112
- $[20] = t7;
113
- $[21] = t8;
114
- $[22] = t9;
115
- } else t9 = $[22];
116
- return t9;
570
+ $[9] = className;
571
+ $[10] = languages;
572
+ $[11] = password;
573
+ $[12] = t4;
574
+ $[13] = t7;
575
+ } else t7 = $[13];
576
+ return t7;
117
577
  };
578
+ /**
579
+ * The strength band of a password as a labelled meter, followed by zxcvbn's own
580
+ * warning and suggestions in the locale's language. It suspends while that
581
+ * language's dictionaries load, and renders nothing for an empty password. The
582
+ * parts hanging off it compose a meter by hand.
583
+ *
584
+ * @example
585
+ * <PasswordStrength password={password} label="Password strength" scoreLabels={SCORE_LABELS} />
586
+ */
587
+ var PasswordStrength = Object.assign(Prefab, {
588
+ Root,
589
+ Meter: StrengthMeter,
590
+ Label,
591
+ Value,
592
+ Track,
593
+ Indicator,
594
+ Feedback,
595
+ Suggestions,
596
+ Suggestion
597
+ });
118
598
  function _temp(suggestion) {
119
- return /* @__PURE__ */ jsx("li", {
120
- className: password_field_module_default.feedback,
121
- children: suggestion
122
- }, suggestion);
599
+ return /* @__PURE__ */ jsx(Suggestion, { children: suggestion }, suggestion);
123
600
  }
124
601
  export { PasswordStrength };