@syscore/ui-library 2.0.0-beta-publish-workflow-beta.16 → 2.0.0-beta-publish-workflow-beta.18

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 (269) hide show
  1. package/client/components/icons/IconUtility.tsx +353 -0
  2. package/client/components/icons/X.tsx +4 -3
  3. package/client/components/ui/alert-v02.tsx +2 -6
  4. package/client/components/ui/button-v01.tsx +2 -12
  5. package/client/components/ui/button.tsx +39 -3
  6. package/client/components/ui/dropdown.tsx +2 -12
  7. package/client/components/ui/navigation.tsx +25 -4
  8. package/client/components/ui/radio-v01.tsx +84 -0
  9. package/client/components/ui/search-field-v01.tsx +10 -28
  10. package/client/components/ui/section-heading.tsx +1 -1
  11. package/client/components/ui/sign-in-field-v01.tsx +150 -0
  12. package/client/global.css +363 -73
  13. package/client/lib/system-icons.ts +1583 -0
  14. package/client/lib/utility-icons.ts +121 -0
  15. package/client/ui/Button.stories.tsx +63 -0
  16. package/client/ui/Colors.stories.tsx +34 -31
  17. package/client/ui/Icons.stories.tsx +179 -0
  18. package/client/ui/RadioGroup/RadioGroup.stories.tsx +1 -1
  19. package/client/ui/RadioV01/RadioV01.stories.tsx +136 -0
  20. package/client/ui/SearchField/SearchField.stories.tsx +4 -1
  21. package/client/ui/TextAreaV01/TextAreaV01.stories.tsx +23 -2
  22. package/client/ui/TextFieldV01/PasswordFieldV01.stories.tsx +25 -11
  23. package/client/ui/TextFieldV01/SignInFieldV01.stories.tsx +196 -0
  24. package/dist/client/assets/alert/icon-clear.svg.js +4 -0
  25. package/dist/client/assets/alert/icon-done.svg.js +4 -0
  26. package/dist/client/assets/avatar-identity/placeholder-icon.svg.js +4 -0
  27. package/dist/client/assets/breadcrumb/icon-ellipsis.svg.js +4 -0
  28. package/dist/client/assets/breadcrumb/icon-home.svg.js +4 -0
  29. package/dist/client/assets/breadcrumb/icon-separator.svg.js +4 -0
  30. package/dist/client/assets/button-v01/icon-back.svg.js +4 -0
  31. package/dist/client/assets/button-v01/icon-check.svg.js +4 -0
  32. package/dist/client/assets/button-v01/icon-close.svg.js +4 -0
  33. package/dist/client/assets/button-v01/icon-delete.svg.js +4 -0
  34. package/dist/client/assets/button-v01/icon-device.svg.js +4 -0
  35. package/dist/client/assets/dropdown/icon-carrot-contract.svg.js +4 -0
  36. package/dist/client/assets/dropdown/icon-carrot-expand.svg.js +4 -0
  37. package/dist/client/assets/dropdown/icon-clear.svg.js +4 -0
  38. package/dist/client/assets/dropdown/icon-enter.svg.js +4 -0
  39. package/dist/client/components/icons/AlphaIcon.js +129 -0
  40. package/dist/client/components/icons/ConceptIcons.js +905 -0
  41. package/dist/client/components/icons/IconUtility.js +410 -0
  42. package/dist/client/components/icons/NavAccount.js +37 -0
  43. package/dist/client/components/icons/NavBullet.js +17 -0
  44. package/dist/client/components/icons/NavLogo.js +48 -0
  45. package/dist/client/components/icons/StandardLogo.js +93 -0
  46. package/dist/client/components/icons/UtilityAccordion.js +27 -0
  47. package/dist/client/components/icons/UtilityChangeType.js +26 -0
  48. package/dist/client/components/icons/UtilityCheck.js +28 -0
  49. package/dist/client/components/icons/UtilityChevronDown.js +39 -0
  50. package/dist/client/components/icons/UtilityClassification.js +53 -0
  51. package/dist/client/components/icons/UtilityClearRegular.js +51 -0
  52. package/dist/client/components/icons/UtilityClose.js +49 -0
  53. package/dist/client/components/icons/UtilityCompare.js +91 -0
  54. package/dist/client/components/icons/UtilityDrag.js +89 -0
  55. package/dist/client/components/icons/UtilityEdit.js +50 -0
  56. package/dist/client/components/icons/UtilityFeedback.js +38 -0
  57. package/dist/client/components/icons/UtilityHome.js +34 -0
  58. package/dist/client/components/icons/UtilityMessage.js +41 -0
  59. package/dist/client/components/icons/UtilityOptions.js +53 -0
  60. package/dist/client/components/icons/UtilityPortfolio.js +116 -0
  61. package/dist/client/components/icons/UtilityReset.js +49 -0
  62. package/dist/client/components/icons/UtilityRevisionsHide.js +76 -0
  63. package/dist/client/components/icons/UtilityRevisionsShow.js +56 -0
  64. package/dist/client/components/icons/UtilitySave.js +38 -0
  65. package/dist/client/components/icons/UtilityScopeLarge.js +123 -0
  66. package/dist/client/components/icons/UtilityScoring.js +51 -0
  67. package/dist/client/components/icons/UtilitySearch.js +46 -0
  68. package/dist/client/components/icons/UtilityShow.js +49 -0
  69. package/dist/client/components/icons/UtilitySort.js +63 -0
  70. package/dist/client/components/icons/UtilityTarget.js +29 -0
  71. package/dist/client/components/icons/UtilityTargetActive.js +48 -0
  72. package/dist/client/components/icons/UtilityText.js +59 -0
  73. package/dist/client/components/icons/UtilityTrash.js +66 -0
  74. package/dist/client/components/icons/UtilityTriangleInfo.js +38 -0
  75. package/dist/client/components/icons/X.js +40 -0
  76. package/dist/client/components/icons/achievement-badges/BadgeCertificationBronze.js +144 -0
  77. package/dist/client/components/icons/achievement-badges/BadgeCertificationGold.js +144 -0
  78. package/dist/client/components/icons/achievement-badges/BadgeCertificationPlatinum.js +144 -0
  79. package/dist/client/components/icons/achievement-badges/BadgeCertificationSilver.js +144 -0
  80. package/dist/client/components/icons/achievement-badges/BadgeRatingCoworking.js +91 -0
  81. package/dist/client/components/icons/achievement-badges/BadgeRatingDesign.js +91 -0
  82. package/dist/client/components/icons/achievement-badges/BadgeRatingEquity.js +91 -0
  83. package/dist/client/components/icons/achievement-badges/BadgeRatingHealthySafety.js +93 -0
  84. package/dist/client/components/icons/achievement-badges/BadgeRatingOperations.js +93 -0
  85. package/dist/client/components/icons/achievement-badges/BadgeRatingPerformance.js +93 -0
  86. package/dist/client/components/icons/achievement-badges/BadgeRatingRealEstate.js +93 -0
  87. package/dist/client/components/icons/achievement-badges/BadgeRatingResidential.js +93 -0
  88. package/dist/client/components/icons/achievement-badges/BadgeRatingWorkforce.js +91 -0
  89. package/dist/client/components/icons/imperative-badges/BadgeImperativePrimary.js +58 -0
  90. package/dist/client/components/icons/imperative-badges/BadgeImperativeSecondary.js +69 -0
  91. package/dist/client/components/icons/provider-badges/BadgeEnterpriseProvider.js +117 -0
  92. package/dist/client/components/icons/provider-badges/BadgePerformanceTestingProvider.js +124 -0
  93. package/dist/client/components/icons/provider-badges/BadgeProductProvider.js +117 -0
  94. package/dist/client/components/icons/provider-badges/BadgeSurveyProvider.js +117 -0
  95. package/dist/client/components/icons/provider-seals/SealEnterpriseProvider.js +100 -0
  96. package/dist/client/components/icons/provider-seals/SealPerformanceTestingProvider.js +100 -0
  97. package/dist/client/components/icons/provider-seals/SealProductProvider.js +98 -0
  98. package/dist/client/components/icons/provider-seals/SealProviders.js +98 -0
  99. package/dist/client/components/icons/provider-seals/SealSurveyProvider.js +98 -0
  100. package/dist/client/components/icons/seals/IWBILogo.js +301 -0
  101. package/dist/client/components/icons/seals/SealCertification.js +206 -0
  102. package/dist/client/components/icons/seals/SealCertificationBronze.js +140 -0
  103. package/dist/client/components/icons/seals/SealCertificationGold.js +140 -0
  104. package/dist/client/components/icons/seals/SealCertificationPlatinum.js +140 -0
  105. package/dist/client/components/icons/seals/SealCertificationSilver.js +140 -0
  106. package/dist/client/components/icons/seals/SealIwbiMember.js +134 -0
  107. package/dist/client/components/icons/seals/SealRating.js +157 -0
  108. package/dist/client/components/icons/seals/SealRatingCoworking.js +89 -0
  109. package/dist/client/components/icons/seals/SealRatingDesign.js +89 -0
  110. package/dist/client/components/icons/seals/SealRatingEquity.js +89 -0
  111. package/dist/client/components/icons/seals/SealRatingHealthSafety.js +91 -0
  112. package/dist/client/components/icons/seals/SealRatingOperations.js +89 -0
  113. package/dist/client/components/icons/seals/SealRatingPerformance.js +91 -0
  114. package/dist/client/components/icons/seals/SealRatingRealEstate.js +89 -0
  115. package/dist/client/components/icons/seals/SealRatingWorkforce.js +89 -0
  116. package/dist/client/components/icons/seals/SealWell.js +132 -0
  117. package/dist/client/components/icons/seals/SealWellCertification.js +225 -0
  118. package/dist/client/components/icons/seals/SealWellCommunity.js +197 -0
  119. package/dist/client/components/icons/seals/SealWellResidence.js +197 -0
  120. package/dist/client/components/icons/seals/SealWorksWithWell.js +227 -0
  121. package/dist/client/components/icons/seals/WaterMarkWWWProducts.js +27 -0
  122. package/dist/client/components/icons/seals/WaterMarkWellProjects.js +36 -0
  123. package/dist/client/components/icons/seals/WatermarkMemberOrg.js +24 -0
  124. package/dist/client/components/ui/accordion.js +326 -0
  125. package/dist/client/components/ui/alert-dialog-panel.js +156 -0
  126. package/dist/client/components/ui/alert-dialog.js +103 -0
  127. package/dist/client/components/ui/alert-v02.js +157 -0
  128. package/dist/client/components/ui/alert.js +55 -0
  129. package/dist/client/components/ui/app-bar.js +203 -0
  130. package/dist/client/components/ui/aspect-ratio.js +5 -0
  131. package/dist/client/components/ui/avatar-identity.js +93 -0
  132. package/dist/client/components/ui/avatar.js +56 -0
  133. package/dist/client/components/ui/back-link.js +27 -0
  134. package/dist/client/components/ui/banner.js +75 -0
  135. package/dist/client/components/ui/bottom-navigation.js +127 -0
  136. package/dist/client/components/ui/breadcrumb-trail.js +137 -0
  137. package/dist/client/components/ui/breadcrumb.js +91 -0
  138. package/dist/client/components/ui/button-v01.js +173 -0
  139. package/dist/client/components/ui/button.js +99 -0
  140. package/dist/client/components/ui/calendar.js +62 -0
  141. package/dist/client/components/ui/card.js +177 -0
  142. package/dist/client/components/ui/carousel.js +198 -0
  143. package/dist/client/components/ui/centered-page.js +10 -0
  144. package/dist/client/components/ui/chart.js +239 -0
  145. package/dist/client/components/ui/checkbox-field.js +39 -0
  146. package/dist/client/components/ui/checkbox.js +18 -0
  147. package/dist/client/components/ui/code-badge.js +29 -0
  148. package/dist/client/components/ui/collapsible.js +9 -0
  149. package/dist/client/components/ui/command.js +79 -0
  150. package/dist/client/components/ui/context-menu.js +138 -0
  151. package/dist/client/components/ui/copy.js +39 -0
  152. package/dist/client/components/ui/credit-card-preview.js +74 -0
  153. package/dist/client/components/ui/data-grid.js +156 -0
  154. package/dist/client/components/ui/date-picker.js +142 -0
  155. package/dist/client/components/ui/dialog.js +179 -0
  156. package/dist/client/components/ui/drawer.js +95 -0
  157. package/dist/client/components/ui/drop-zone.js +87 -0
  158. package/dist/client/components/ui/dropdown-menu.js +139 -0
  159. package/dist/client/components/ui/dropdown.js +339 -0
  160. package/dist/client/components/ui/empty-state.js +76 -0
  161. package/dist/client/components/ui/field-group.js +32 -0
  162. package/dist/client/components/ui/file-upload-trigger.js +70 -0
  163. package/dist/client/components/ui/file-upload.js +171 -0
  164. package/dist/client/components/ui/footer.js +97 -0
  165. package/dist/client/components/ui/form.js +109 -0
  166. package/dist/client/components/ui/height-container.js +41 -0
  167. package/dist/client/components/ui/hero-section.js +44 -0
  168. package/dist/client/components/ui/hero-split-image.js +45 -0
  169. package/dist/client/components/ui/hover-card.js +22 -0
  170. package/dist/client/components/ui/icon-button.js +30 -0
  171. package/dist/client/components/ui/inline-notice.js +19 -0
  172. package/dist/client/components/ui/input-otp.js +46 -0
  173. package/dist/client/components/ui/input.js +37 -0
  174. package/dist/client/components/ui/label.js +31 -0
  175. package/dist/client/components/ui/labeled-divider.js +23 -0
  176. package/dist/client/components/ui/layout.js +724 -0
  177. package/dist/client/components/ui/menubar.js +157 -0
  178. package/dist/client/components/ui/meta-row.js +19 -0
  179. package/dist/client/components/ui/mobile-nav.js +230 -0
  180. package/dist/client/components/ui/modal-panel.js +116 -0
  181. package/dist/client/components/ui/navigation-menu.js +89 -0
  182. package/dist/client/components/ui/navigation.js +452 -0
  183. package/dist/client/components/ui/outline-node.js +57 -0
  184. package/dist/client/components/ui/page-header.js +79 -0
  185. package/dist/client/components/ui/pagination-v01.js +124 -0
  186. package/dist/client/components/ui/pagination.js +105 -0
  187. package/dist/client/components/ui/password-field-v01.js +46 -0
  188. package/dist/client/components/ui/pill-button.js +34 -0
  189. package/dist/client/components/ui/popover.js +22 -0
  190. package/dist/client/components/ui/price-tag.js +20 -0
  191. package/dist/client/components/ui/profile-avatar.js +92 -0
  192. package/dist/client/components/ui/progress.js +23 -0
  193. package/dist/client/components/ui/radio-card.js +30 -0
  194. package/dist/client/components/ui/radio-group.js +32 -0
  195. package/dist/client/components/ui/radio-v01.js +58 -0
  196. package/dist/client/components/ui/resizable.js +32 -0
  197. package/dist/client/components/ui/resource-thumbnail.js +24 -0
  198. package/dist/client/components/ui/scroll-area.js +37 -0
  199. package/dist/client/components/ui/search-field-v01.js +111 -0
  200. package/dist/client/components/ui/search.js +109 -0
  201. package/dist/client/components/ui/section-badge.js +22 -0
  202. package/dist/client/components/ui/section-heading.js +21 -0
  203. package/dist/client/components/ui/select.js +96 -0
  204. package/dist/client/components/ui/separator.js +24 -0
  205. package/dist/client/components/ui/sheet.js +106 -0
  206. package/dist/client/components/ui/side-nav.js +173 -0
  207. package/dist/client/components/ui/sidebar.js +580 -0
  208. package/dist/client/components/ui/sign-in-field-v01.js +107 -0
  209. package/dist/client/components/ui/skeleton.js +17 -0
  210. package/dist/client/components/ui/slider.js +20 -0
  211. package/dist/client/components/ui/social-button.js +34 -0
  212. package/dist/client/components/ui/standard-navigation.js +454 -0
  213. package/dist/client/components/ui/status-pill.js +42 -0
  214. package/dist/client/components/ui/stepper.js +111 -0
  215. package/dist/client/components/ui/switch-v01.js +39 -0
  216. package/dist/client/components/ui/switch.js +17 -0
  217. package/dist/client/components/ui/system-bar.js +76 -0
  218. package/dist/client/components/ui/table.js +107 -0
  219. package/dist/client/components/ui/tabs-v01.js +74 -0
  220. package/dist/client/components/ui/tabs.js +253 -0
  221. package/dist/client/components/ui/tag-v02.js +85 -0
  222. package/dist/client/components/ui/tag.js +73 -0
  223. package/dist/client/components/ui/text-area-v01.js +26 -0
  224. package/dist/client/components/ui/text-field-v01.js +78 -0
  225. package/dist/client/components/ui/text-link.js +23 -0
  226. package/dist/client/components/ui/textarea.js +19 -0
  227. package/dist/client/components/ui/timeline.js +87 -0
  228. package/dist/client/components/ui/toast-v01.js +155 -0
  229. package/dist/client/components/ui/toast.js +88 -0
  230. package/dist/client/components/ui/toaster.js +22 -0
  231. package/dist/client/components/ui/toggle.js +56 -0
  232. package/dist/client/components/ui/tooltip.js +328 -0
  233. package/dist/client/components/ui/typography.js +119 -0
  234. package/dist/client/hooks/use-mobile.js +20 -0
  235. package/dist/client/hooks/use-segmented-control.js +32 -0
  236. package/dist/client/hooks/use-tabs.js +22 -0
  237. package/dist/client/hooks/use-toast.js +122 -0
  238. package/dist/client/lib/concept-colors.js +74 -0
  239. package/dist/client/lib/concept-icons.js +32 -0
  240. package/dist/client/lib/utility-icons.js +73 -0
  241. package/dist/client/lib/utils.js +13 -0
  242. package/dist/index.cjs +1 -0
  243. package/dist/index.d.ts +156 -0
  244. package/dist/ui/index.js +774 -0
  245. package/package.json +9 -6
  246. package/dist/index.cjs.js +0 -1
  247. package/dist/index.es.js +0 -18989
  248. /package/{dist → client}/fonts/FT-Made/FTMade-Regular.otf +0 -0
  249. /package/{dist → client}/fonts/FT-Made/FTMade-Regular.ttf +0 -0
  250. /package/{dist → client}/fonts/FT-Made/FTMade-Regular.woff +0 -0
  251. /package/{dist → client}/fonts/FT-Made/FTMade-Regular.woff2 +0 -0
  252. /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-black.otf +0 -0
  253. /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-blackitalic.otf +0 -0
  254. /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-bold.otf +0 -0
  255. /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-bolditalic.otf +0 -0
  256. /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-extrabold.otf +0 -0
  257. /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-extrabolditalic.otf +0 -0
  258. /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-extralight.otf +0 -0
  259. /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-extralightitalic.otf +0 -0
  260. /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-italic.otf +0 -0
  261. /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-light.otf +0 -0
  262. /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-lightitalic.otf +0 -0
  263. /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-medium.otf +0 -0
  264. /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-mediumitalic.otf +0 -0
  265. /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-regular.otf +0 -0
  266. /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-semibold.otf +0 -0
  267. /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-semibolditalic.otf +0 -0
  268. /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-thin.otf +0 -0
  269. /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-thinitalic.otf +0 -0
@@ -0,0 +1,84 @@
1
+ import * as React from "react";
2
+
3
+ import { cn } from "@/lib/utils";
4
+
5
+ /** Radio v0.1 (native input + styled control). */
6
+ type RadioV01State = "default" | "focus" | "error" | "error-focus" | "disabled";
7
+
8
+ interface RadioV01Props
9
+ extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "type" | "size"> {
10
+ state?: RadioV01State;
11
+ error?: boolean;
12
+ label?: React.ReactNode;
13
+ containerClassName?: string;
14
+ }
15
+
16
+ const RadioV01 = React.forwardRef<HTMLInputElement, RadioV01Props>(
17
+ (
18
+ {
19
+ className,
20
+ containerClassName,
21
+ state,
22
+ error = false,
23
+ label,
24
+ disabled,
25
+ onFocus,
26
+ onBlur,
27
+ id,
28
+ ...props
29
+ },
30
+ ref,
31
+ ) => {
32
+ const [focused, setFocused] = React.useState(false);
33
+ const generated = React.useId();
34
+ const inputId = id ?? generated;
35
+
36
+ const resolved: RadioV01State =
37
+ state ??
38
+ (disabled
39
+ ? "disabled"
40
+ : error
41
+ ? focused
42
+ ? "error-focus"
43
+ : "error"
44
+ : focused
45
+ ? "focus"
46
+ : "default");
47
+
48
+ return (
49
+ <label
50
+ htmlFor={inputId}
51
+ data-state={resolved}
52
+ className={cn("radio-v01 font-mazzardSoft", containerClassName)}
53
+ >
54
+ <input
55
+ ref={ref}
56
+ id={inputId}
57
+ type="radio"
58
+ className={cn("radio-v01-input", className)}
59
+ disabled={disabled || resolved === "disabled"}
60
+ aria-invalid={error || undefined}
61
+ onFocus={(event) => {
62
+ setFocused(true);
63
+ onFocus?.(event);
64
+ }}
65
+ onBlur={(event) => {
66
+ setFocused(false);
67
+ onBlur?.(event);
68
+ }}
69
+ {...props}
70
+ />
71
+ <span className="radio-v01-control" aria-hidden="true">
72
+ <span className="radio-v01-dot" />
73
+ </span>
74
+ {label != null && label !== "" ? (
75
+ <span className="radio-v01-label">{label}</span>
76
+ ) : null}
77
+ </label>
78
+ );
79
+ },
80
+ );
81
+ RadioV01.displayName = "RadioV01";
82
+
83
+ export { RadioV01 };
84
+ export type { RadioV01Props, RadioV01State };
@@ -2,17 +2,7 @@ import * as React from "react";
2
2
 
3
3
  import { cn } from "@/lib/utils";
4
4
 
5
- /**
6
- * Search field — built from the Figma component set `Search field`
7
- * (node 12008:2262, "Search Field -v0.1").
8
- *
9
- * Figma models it as a single `State` property: Default, Focus, Active, Filled,
10
- * Disable. Those map onto real interaction here — focus and value derive the
11
- * state — and `state` can also be passed to pin one for specs and stories.
12
- *
13
- * Spacing and radius come from `--space-*` / `--radius-*`. The sizes Figma
14
- * specifies that are not on a scale live as `--search-field-*` variables.
15
- */
5
+ /** Search field v0.1 (Figma Search field). */
16
6
  type SearchFieldV01State =
17
7
  | "default"
18
8
  | "focus"
@@ -20,11 +10,6 @@ type SearchFieldV01State =
20
10
  | "filled"
21
11
  | "disabled";
22
12
 
23
- /**
24
- * Figma's icons are stroked at 1.5 on a 16 viewBox — lucide's own 24 viewBox
25
- * renders a different weight at this size, so the paths are inlined verbatim.
26
- * All three take `currentColor`.
27
- */
28
13
  const iconProps = {
29
14
  fill: "none",
30
15
  strokeWidth: 1.5,
@@ -57,20 +42,9 @@ const ClearIcon = (props: React.SVGProps<SVGSVGElement>) => (
57
42
 
58
43
  interface SearchFieldV01Props
59
44
  extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> {
60
- /**
61
- * Figma `State`. Omit to let focus and value drive it:
62
- * empty + blurred = `default`, empty + focused = `focus`,
63
- * has value + focused = `active`, has value + blurred = `filled`.
64
- */
65
45
  state?: SearchFieldV01State;
66
- /**
67
- * Inline typeahead remainder rendered after the value — Figma's `Active`
68
- * state ("Entry" + "typeahead"). Also shows the Enter affordance.
69
- */
70
46
  suggestion?: string;
71
- /** Renders the clear button once there is a value (Figma `Filled`). */
72
47
  onClear?: () => void;
73
- /** Class for the outer box; `className` goes to the input. */
74
48
  containerClassName?: string;
75
49
  }
76
50
 
@@ -113,8 +87,9 @@ const SearchFieldV01 = React.forwardRef<HTMLInputElement, SearchFieldV01Props>(
113
87
  ? "filled"
114
88
  : "default");
115
89
 
116
- // Figma drops the search icon as soon as the field is in use.
117
90
  const showSearchIcon = resolved === "default" || resolved === "disabled";
91
+ const showCaret =
92
+ state != null && (resolved === "focus" || resolved === "active");
118
93
  const showTypeahead = resolved === "active" && Boolean(suggestion);
119
94
  const showEnter = resolved === "active";
120
95
  const showClear = resolved === "filled" && hasValue && Boolean(onClear);
@@ -122,6 +97,7 @@ const SearchFieldV01 = React.forwardRef<HTMLInputElement, SearchFieldV01Props>(
122
97
  return (
123
98
  <div
124
99
  data-state={resolved}
100
+ data-caret={showCaret ? (hasValue ? "trailing" : "leading") : undefined}
125
101
  className={cn(
126
102
  "search-field-v01",
127
103
  showTypeahead && "search-field-v01--typeahead",
@@ -135,6 +111,9 @@ const SearchFieldV01 = React.forwardRef<HTMLInputElement, SearchFieldV01Props>(
135
111
  )}
136
112
 
137
113
  <span className="search-field-v01-field">
114
+ {showCaret && !hasValue && (
115
+ <span className="search-field-v01-caret" aria-hidden />
116
+ )}
138
117
  <input
139
118
  ref={ref}
140
119
  type="search"
@@ -157,6 +136,9 @@ const SearchFieldV01 = React.forwardRef<HTMLInputElement, SearchFieldV01Props>(
157
136
  }}
158
137
  {...props}
159
138
  />
139
+ {showCaret && hasValue && (
140
+ <span className="search-field-v01-caret" aria-hidden />
141
+ )}
160
142
  {showTypeahead && (
161
143
  <span className="search-field-v01-suggestion" aria-hidden="true">
162
144
  {suggestion}
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { Text } from "@syscore/ui-library";
2
+ import { Text } from "./typography";
3
3
  import { Stack } from "./layout";
4
4
 
5
5
  // ---------------------------------------------------------------------------
@@ -0,0 +1,150 @@
1
+ import * as React from "react";
2
+
3
+ import { cn } from "@/lib/utils";
4
+ import {
5
+ IconUtilityHidden,
6
+ IconUtilityPreview,
7
+ IconUtilityQuestion,
8
+ } from "@/components/icons/IconUtility";
9
+
10
+ /** Sign-in field v0.1 — stacked email/password (Figma Sign in). */
11
+ type SignInFieldV01Type = "email" | "password";
12
+ type SignInFieldV01State = "default" | "focus" | "active" | "filled" | "error";
13
+
14
+ interface SignInFieldV01Props
15
+ extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "type" | "size"> {
16
+ type?: SignInFieldV01Type;
17
+ state?: SignInFieldV01State;
18
+ hide?: boolean;
19
+ onHideChange?: (hide: boolean) => void;
20
+ onHelp?: () => void;
21
+ containerClassName?: string;
22
+ }
23
+
24
+ const SignInFieldV01 = React.forwardRef<HTMLInputElement, SignInFieldV01Props>(
25
+ (
26
+ {
27
+ className,
28
+ containerClassName,
29
+ type = "email",
30
+ state,
31
+ hide,
32
+ onHideChange,
33
+ onHelp,
34
+ placeholder,
35
+ value,
36
+ defaultValue,
37
+ onFocus,
38
+ onBlur,
39
+ onChange,
40
+ disabled,
41
+ ...props
42
+ },
43
+ ref,
44
+ ) => {
45
+ const isPassword = type === "password";
46
+ const [focused, setFocused] = React.useState(false);
47
+ const [internalValue, setInternalValue] = React.useState(
48
+ defaultValue != null ? String(defaultValue) : "",
49
+ );
50
+ const [internalHide, setInternalHide] = React.useState(true);
51
+
52
+ const currentValue = value != null ? String(value) : internalValue;
53
+ const hasValue = currentValue.length > 0;
54
+ const masked = hide !== undefined ? hide : internalHide;
55
+
56
+ const pinned = state === "error" && !isPassword ? undefined : state;
57
+
58
+ const resolved: SignInFieldV01State =
59
+ pinned ??
60
+ (focused ? (hasValue ? "active" : "focus") : hasValue ? "filled" : "default");
61
+
62
+ const isError = resolved === "error";
63
+
64
+ const showCaret =
65
+ pinned != null && (resolved === "focus" || resolved === "active");
66
+
67
+ const toggleHide = () => {
68
+ if (hide === undefined) setInternalHide(!masked);
69
+ onHideChange?.(!masked);
70
+ };
71
+
72
+ return (
73
+ <div
74
+ data-type={type}
75
+ data-state={resolved}
76
+ data-caret={showCaret ? (hasValue ? "trailing" : "leading") : undefined}
77
+ className={cn("sign-in-field-v01 font-mazzardSoft", containerClassName)}
78
+ >
79
+ <div className="sign-in-field-v01-field">
80
+ {showCaret && !hasValue ? (
81
+ <span className="sign-in-field-v01-caret" aria-hidden />
82
+ ) : null}
83
+ <input
84
+ ref={ref}
85
+ type={
86
+ isPassword && masked && !isError
87
+ ? "password"
88
+ : isPassword
89
+ ? "text"
90
+ : "email"
91
+ }
92
+ className={cn("sign-in-field-v01-input", className)}
93
+ placeholder={
94
+ placeholder ??
95
+ (isPassword ? "Enter your password" : "Enter your email")
96
+ }
97
+ disabled={disabled}
98
+ value={value != null ? value : internalValue}
99
+ onFocus={(event) => {
100
+ setFocused(true);
101
+ onFocus?.(event);
102
+ }}
103
+ onBlur={(event) => {
104
+ setFocused(false);
105
+ onBlur?.(event);
106
+ }}
107
+ onChange={(event) => {
108
+ if (value == null) setInternalValue(event.target.value);
109
+ onChange?.(event);
110
+ }}
111
+ {...props}
112
+ />
113
+ {showCaret && hasValue ? (
114
+ <span className="sign-in-field-v01-caret" aria-hidden />
115
+ ) : null}
116
+
117
+ {isPassword ? (
118
+ <span className="sign-in-field-v01-actions">
119
+ {hasValue && !isError ? (
120
+ <button
121
+ type="button"
122
+ className="sign-in-field-v01-action"
123
+ onClick={toggleHide}
124
+ disabled={disabled}
125
+ aria-label={masked ? "Show password" : "Hide password"}
126
+ aria-pressed={!masked}
127
+ >
128
+ {masked ? <IconUtilityPreview /> : <IconUtilityHidden />}
129
+ </button>
130
+ ) : null}
131
+ <button
132
+ type="button"
133
+ className="sign-in-field-v01-action"
134
+ onClick={onHelp}
135
+ disabled={disabled}
136
+ aria-label="Password help"
137
+ >
138
+ <IconUtilityQuestion />
139
+ </button>
140
+ </span>
141
+ ) : null}
142
+ </div>
143
+ </div>
144
+ );
145
+ },
146
+ );
147
+ SignInFieldV01.displayName = "SignInFieldV01";
148
+
149
+ export { SignInFieldV01 };
150
+ export type { SignInFieldV01Props, SignInFieldV01State, SignInFieldV01Type };