@igne-agency/react-web-ui 0.4.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 (257) hide show
  1. package/dist/base.css +3 -0
  2. package/dist/components/accordion/accordion.css +21 -21
  3. package/dist/components/accordion/accordion.d.ts +17 -4
  4. package/dist/components/accordion/accordion.js +83 -36
  5. package/dist/components/accordion/accordion.module.js +6 -6
  6. package/dist/components/attachment-tile/attachment-preview.d.ts +56 -13
  7. package/dist/components/attachment-tile/attachment-preview.js +388 -119
  8. package/dist/components/attachment-tile/attachment-tile.css +31 -25
  9. package/dist/components/attachment-tile/attachment-tile.d.ts +32 -10
  10. package/dist/components/attachment-tile/attachment-tile.js +160 -43
  11. package/dist/components/attachment-tile/attachment-tile.module.js +8 -8
  12. package/dist/components/attachment-tile/index.d.ts +1 -1
  13. package/dist/components/avatar/avatar.css +9 -9
  14. package/dist/components/avatar/avatar.d.ts +50 -5
  15. package/dist/components/avatar/avatar.js +178 -64
  16. package/dist/components/avatar/avatar.module.js +3 -3
  17. package/dist/components/avatar-group/avatar-group-context.d.ts +2 -4
  18. package/dist/components/avatar-group/avatar-group-context.js +2 -2
  19. package/dist/components/avatar-group/avatar-group.css +26 -20
  20. package/dist/components/avatar-group/avatar-group.d.ts +85 -27
  21. package/dist/components/avatar-group/avatar-group.js +400 -246
  22. package/dist/components/avatar-group/avatar-group.module.js +8 -8
  23. package/dist/components/breadcrumbs/breadcrumbs.css +12 -12
  24. package/dist/components/breadcrumbs/breadcrumbs.d.ts +69 -23
  25. package/dist/components/breadcrumbs/breadcrumbs.js +299 -248
  26. package/dist/components/breadcrumbs/breadcrumbs.module.js +8 -8
  27. package/dist/components/button/button.css +29 -31
  28. package/dist/components/button/button.d.ts +20 -16
  29. package/dist/components/button/button.js +140 -145
  30. package/dist/components/button/button.module.js +1 -1
  31. package/dist/components/button/index.js +1 -1
  32. package/dist/components/checkbox-field/checkbox-field.js +63 -49
  33. package/dist/components/checkbox-field/checkbox.css +105 -56
  34. package/dist/components/checkbox-field/checkbox.d.ts +3 -2
  35. package/dist/components/checkbox-field/checkbox.js +12 -9
  36. package/dist/components/checkbox-field/checkbox.module.js +4 -4
  37. package/dist/components/checkbox-group-field/checkbox-group-field.js +78 -72
  38. package/dist/components/checkbox-group-field/checkbox-group.css +14 -10
  39. package/dist/components/checkbox-group-field/checkbox-group.d.ts +2 -2
  40. package/dist/components/checkbox-group-field/checkbox-group.js +2 -2
  41. package/dist/components/checkbox-group-field/checkbox-group.module.js +2 -2
  42. package/dist/components/collapsible/collapsible.css +20 -20
  43. package/dist/components/collapsible/collapsible.d.ts +17 -4
  44. package/dist/components/collapsible/collapsible.js +83 -36
  45. package/dist/components/collapsible/collapsible.module.js +5 -5
  46. package/dist/components/combobox-field/combobox-field.js +206 -158
  47. package/dist/components/combobox-field/combobox.css +492 -277
  48. package/dist/components/combobox-field/combobox.d.ts +148 -39
  49. package/dist/components/combobox-field/combobox.js +506 -206
  50. package/dist/components/combobox-field/combobox.module.js +21 -21
  51. package/dist/components/combobox-field/value-state-view.css +5 -5
  52. package/dist/components/combobox-field/value-state-view.module.js +4 -4
  53. package/dist/components/composer/composer-attachments.d.ts +30 -11
  54. package/dist/components/composer/composer-attachments.js +45 -40
  55. package/dist/components/composer/composer-editor.css +40 -35
  56. package/dist/components/composer/composer-editor.d.ts +14 -4
  57. package/dist/components/composer/composer-editor.js +134 -44
  58. package/dist/components/composer/composer-editor.module.js +5 -5
  59. package/dist/components/composer/composer.css +22 -22
  60. package/dist/components/composer/composer.d.ts +13 -2
  61. package/dist/components/composer/composer.js +78 -63
  62. package/dist/components/composer/composer.module.js +5 -5
  63. package/dist/components/composer/index.d.ts +2 -2
  64. package/dist/components/composer/mention-text.css +5 -5
  65. package/dist/components/composer/mention-text.module.js +1 -1
  66. package/dist/components/confirm-dialog/confirm-dialog.css +29 -29
  67. package/dist/components/confirm-dialog/confirm-dialog.d.ts +57 -3
  68. package/dist/components/confirm-dialog/confirm-dialog.js +266 -108
  69. package/dist/components/confirm-dialog/confirm-dialog.module.js +5 -5
  70. package/dist/components/conversation/conversation.css +52 -52
  71. package/dist/components/conversation/conversation.d.ts +43 -18
  72. package/dist/components/conversation/conversation.js +120 -78
  73. package/dist/components/conversation/conversation.module.js +15 -15
  74. package/dist/components/date-field/date-field.d.ts +1 -1
  75. package/dist/components/date-field/date-field.js +202 -100
  76. package/dist/components/date-field/date-input.d.ts +73 -37
  77. package/dist/components/date-field/date-input.js +72 -45
  78. package/dist/components/date-field/index.d.ts +1 -1
  79. package/dist/components/date-range-field/date-range-field.d.ts +1 -1
  80. package/dist/components/date-range-field/date-range-field.js +219 -107
  81. package/dist/components/date-range-field/date-range-input.d.ts +84 -40
  82. package/dist/components/date-range-field/date-range-input.js +83 -48
  83. package/dist/components/dialog/dialog.css +32 -32
  84. package/dist/components/dialog/dialog.d.ts +8 -7
  85. package/dist/components/dialog/dialog.js +8 -26
  86. package/dist/components/dialog/dialog.module.js +6 -6
  87. package/dist/components/divider/divider.css +6 -6
  88. package/dist/components/divider/divider.d.ts +36 -2
  89. package/dist/components/divider/divider.js +195 -29
  90. package/dist/components/divider/divider.module.js +3 -3
  91. package/dist/components/drawer/drawer.css +55 -56
  92. package/dist/components/drawer/drawer.d.ts +8 -7
  93. package/dist/components/drawer/drawer.js +8 -26
  94. package/dist/components/drawer/drawer.module.js +6 -6
  95. package/dist/components/field/field.css +34 -24
  96. package/dist/components/field/field.d.ts +60 -37
  97. package/dist/components/field/field.js +242 -157
  98. package/dist/components/field/field.module.js +12 -10
  99. package/dist/components/field/input-parts.d.ts +11 -13
  100. package/dist/components/field/input-parts.js +23 -42
  101. package/dist/components/field-placeholder/field-placeholder.css +6 -6
  102. package/dist/components/field-placeholder/field-placeholder.module.js +4 -4
  103. package/dist/components/fieldset/field-group.d.ts +1 -1
  104. package/dist/components/fieldset/field-group.js +48 -42
  105. package/dist/components/fieldset/fieldset-root.d.ts +1 -1
  106. package/dist/components/fieldset/fieldset-root.js +19 -17
  107. package/dist/components/fieldset/fieldset.d.ts +2 -2
  108. package/dist/components/fieldset/fieldset.js +2 -2
  109. package/dist/components/file-field/file-field.css +126 -60
  110. package/dist/components/file-field/file-field.js +201 -109
  111. package/dist/components/file-field/file-field.module.js +4 -4
  112. package/dist/components/file-field/file-input.d.ts +66 -40
  113. package/dist/components/file-field/file-input.js +188 -132
  114. package/dist/components/filter-bar/filter-bar.css +8 -8
  115. package/dist/components/filter-bar/filter-bar.d.ts +12 -3
  116. package/dist/components/filter-bar/filter-bar.js +23 -25
  117. package/dist/components/filter-bar/filter-bar.module.js +5 -5
  118. package/dist/components/form/form.d.ts +19 -7
  119. package/dist/components/form/form.js +80 -29
  120. package/dist/components/icon/icon.css +2 -2
  121. package/dist/components/icon/icon.module.js +1 -1
  122. package/dist/components/link/link.css +6 -5
  123. package/dist/components/link/link.module.js +1 -1
  124. package/dist/components/menu/menu.css +52 -47
  125. package/dist/components/menu/menu.d.ts +32 -25
  126. package/dist/components/menu/menu.js +75 -124
  127. package/dist/components/menu/menu.module.js +8 -8
  128. package/dist/components/nav/nav-context.d.ts +1 -1
  129. package/dist/components/nav/nav-item-view.d.ts +10 -13
  130. package/dist/components/nav/nav-item-view.js +42 -54
  131. package/dist/components/nav/nav.css +150 -119
  132. package/dist/components/nav/nav.d.ts +61 -17
  133. package/dist/components/nav/nav.js +271 -176
  134. package/dist/components/nav/nav.module.js +17 -15
  135. package/dist/components/number-field/number-field.css +153 -64
  136. package/dist/components/number-field/number-field.d.ts +2 -2
  137. package/dist/components/number-field/number-field.js +112 -91
  138. package/dist/components/number-field/number-field.module.js +6 -6
  139. package/dist/components/number-field/number-input.d.ts +43 -23
  140. package/dist/components/number-field/number-input.js +179 -125
  141. package/dist/components/otp-field/otp-field.css +153 -60
  142. package/dist/components/otp-field/otp-field.d.ts +2 -2
  143. package/dist/components/otp-field/otp-field.js +62 -46
  144. package/dist/components/otp-field/otp-field.module.js +4 -4
  145. package/dist/components/otp-field/otp-input.d.ts +8 -6
  146. package/dist/components/otp-field/otp-input.js +92 -92
  147. package/dist/components/pagination/pagination.d.ts +46 -15
  148. package/dist/components/pagination/pagination.js +217 -224
  149. package/dist/components/password-field/password-field.css +23 -23
  150. package/dist/components/password-field/password-field.js +107 -85
  151. package/dist/components/password-field/password-field.module.js +8 -8
  152. package/dist/components/password-field/password-strength.d.ts +107 -3
  153. package/dist/components/password-field/password-strength.js +569 -92
  154. package/dist/components/photo-field/photo-field.js +137 -112
  155. package/dist/components/photo-field/photo-input.css +67 -44
  156. package/dist/components/photo-field/photo-input.d.ts +59 -15
  157. package/dist/components/photo-field/photo-input.js +173 -86
  158. package/dist/components/photo-field/photo-input.module.js +10 -8
  159. package/dist/components/popover/popover.css +41 -41
  160. package/dist/components/popover/popover.d.ts +66 -25
  161. package/dist/components/popover/popover.js +332 -217
  162. package/dist/components/popover/popover.module.js +15 -19
  163. package/dist/components/radio-group-field/radio-group-field.js +80 -71
  164. package/dist/components/radio-group-field/radio-group.css +112 -60
  165. package/dist/components/radio-group-field/radio-group.d.ts +19 -3
  166. package/dist/components/radio-group-field/radio-group.js +66 -23
  167. package/dist/components/radio-group-field/radio-group.module.js +4 -4
  168. package/dist/components/segmented-control-field/segmented-control-field.d.ts +1 -1
  169. package/dist/components/segmented-control-field/segmented-control-field.js +111 -96
  170. package/dist/components/segmented-control-field/segmented-control.css +132 -79
  171. package/dist/components/segmented-control-field/segmented-control.d.ts +39 -15
  172. package/dist/components/segmented-control-field/segmented-control.js +124 -41
  173. package/dist/components/segmented-control-field/segmented-control.module.js +4 -4
  174. package/dist/components/select-field/select.css +214 -101
  175. package/dist/components/select-field/select.d.ts +43 -11
  176. package/dist/components/select-field/select.js +194 -109
  177. package/dist/components/select-field/select.module.js +14 -14
  178. package/dist/components/skeleton/skeleton.css +4 -4
  179. package/dist/components/skeleton/skeleton.module.js +3 -3
  180. package/dist/components/stale/stale.css +15 -15
  181. package/dist/components/stale/stale.d.ts +27 -3
  182. package/dist/components/stale/stale.js +147 -66
  183. package/dist/components/stale/stale.module.js +6 -6
  184. package/dist/components/status-message/status-message.css +22 -22
  185. package/dist/components/status-message/status-message.module.js +6 -6
  186. package/dist/components/switch-field/switch-field.js +77 -57
  187. package/dist/components/switch-field/switch.css +112 -63
  188. package/dist/components/switch-field/switch.d.ts +20 -3
  189. package/dist/components/switch-field/switch.js +70 -27
  190. package/dist/components/switch-field/switch.module.js +4 -4
  191. package/dist/components/tabs/tabs.css +32 -32
  192. package/dist/components/tabs/tabs.d.ts +21 -7
  193. package/dist/components/tabs/tabs.js +73 -14
  194. package/dist/components/tabs/tabs.module.js +7 -7
  195. package/dist/components/tag/tag.css +84 -84
  196. package/dist/components/tag/tag.module.js +3 -3
  197. package/dist/components/tag-group/tag-group.css +94 -94
  198. package/dist/components/tag-group/tag-group.module.js +4 -4
  199. package/dist/components/text-field/text-field.css +159 -82
  200. package/dist/components/text-field/text-field.d.ts +1 -1
  201. package/dist/components/text-field/text-field.js +139 -110
  202. package/dist/components/text-field/text-field.module.js +9 -9
  203. package/dist/components/text-field/text-input.d.ts +81 -45
  204. package/dist/components/text-field/text-input.js +366 -217
  205. package/dist/components/textarea-field/textarea-field.css +7 -2
  206. package/dist/components/textarea-field/textarea-field.js +72 -56
  207. package/dist/components/textarea-field/textarea-field.module.js +2 -2
  208. package/dist/components/time-field/time-field.js +153 -60
  209. package/dist/components/time-field/time-input.d.ts +21 -10
  210. package/dist/components/time-field/time-input.js +22 -11
  211. package/dist/components/toast/toast-provider.css +34 -31
  212. package/dist/components/toast/toast-provider.d.ts +63 -14
  213. package/dist/components/toast/toast-provider.js +174 -111
  214. package/dist/components/toast/toast-provider.module.js +7 -7
  215. package/dist/components/toggle-group-field/toggle-group-field.d.ts +1 -1
  216. package/dist/components/toggle-group-field/toggle-group-field.js +95 -89
  217. package/dist/components/toggle-group-field/toggle-group.css +117 -67
  218. package/dist/components/toggle-group-field/toggle-group.d.ts +2 -2
  219. package/dist/components/toggle-group-field/toggle-group.js +2 -2
  220. package/dist/components/toggle-group-field/toggle-group.module.js +2 -2
  221. package/dist/components/tooltip/tooltip.css +4 -4
  222. package/dist/components/tooltip/tooltip.module.js +1 -1
  223. package/dist/data-table/data-table-content.js +6 -5
  224. package/dist/data-table/data-table-parts.d.ts +41 -13
  225. package/dist/data-table/data-table-parts.js +213 -172
  226. package/dist/data-table/data-table-selection.d.ts +105 -3
  227. package/dist/data-table/data-table-selection.js +654 -145
  228. package/dist/data-table/data-table.css +125 -128
  229. package/dist/data-table/data-table.d.ts +21 -26
  230. package/dist/data-table/data-table.js +20 -23
  231. package/dist/data-table/data-table.module.js +32 -34
  232. package/dist/data-table/index.d.ts +2 -2
  233. package/dist/index.js +3 -3
  234. package/dist/lib/calendar/calendar-navigation.d.ts +39 -5
  235. package/dist/lib/calendar/calendar-navigation.js +185 -118
  236. package/dist/lib/calendar/calendar-parts.d.ts +143 -0
  237. package/dist/lib/calendar/calendar-parts.js +540 -0
  238. package/dist/lib/calendar/calendar-prefab.d.ts +52 -0
  239. package/dist/lib/calendar/calendar-prefab.js +311 -0
  240. package/dist/lib/calendar/calendar-year.d.ts +3 -1
  241. package/dist/lib/calendar/calendar-year.js +139 -131
  242. package/dist/lib/calendar/temporal.css +325 -232
  243. package/dist/lib/calendar/temporal.d.ts +67 -82
  244. package/dist/lib/calendar/temporal.js +258 -569
  245. package/dist/lib/calendar/temporal.module.js +38 -38
  246. package/dist/lib/forms/use-connected-field.d.ts +1 -1
  247. package/dist/lib/forms/use-connected-field.js +1 -1
  248. package/dist/lib/render-as.d.ts +13 -0
  249. package/dist/lib/render-as.js +46 -0
  250. package/dist/terrazzo/index.d.ts +4 -3
  251. package/dist/terrazzo/index.js +17 -6
  252. package/dist/tokens.css +28 -4
  253. package/package.json +2 -2
  254. package/tokens/dark.tokens.json +6 -0
  255. package/tokens/sys.tokens.json +7 -0
  256. package/dist/components/button/close-button.d.ts +0 -16
  257. 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 };