@photonhealth/react 0.0.0-stage → 2.0.0-rc.2

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 (277) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +111 -2
  3. package/dist/adapters/index.d.ts +2 -0
  4. package/dist/adapters/index.d.ts.map +1 -0
  5. package/dist/adapters/index.js +2 -0
  6. package/dist/adapters/index.js.map +1 -0
  7. package/dist/adapters/tailwind.d.ts +3 -0
  8. package/dist/adapters/tailwind.d.ts.map +1 -0
  9. package/dist/adapters/tailwind.js +126 -0
  10. package/dist/adapters/tailwind.js.map +1 -0
  11. package/dist/analytics/PhotonAnalyticsProvider.d.ts +16 -0
  12. package/dist/analytics/PhotonAnalyticsProvider.d.ts.map +1 -0
  13. package/dist/analytics/PhotonAnalyticsProvider.js +57 -0
  14. package/dist/analytics/PhotonAnalyticsProvider.js.map +1 -0
  15. package/dist/analytics/fieldInteraction.d.ts +18 -0
  16. package/dist/analytics/fieldInteraction.d.ts.map +1 -0
  17. package/dist/analytics/fieldInteraction.js +102 -0
  18. package/dist/analytics/fieldInteraction.js.map +1 -0
  19. package/dist/analytics/tracker.d.ts +17 -0
  20. package/dist/analytics/tracker.d.ts.map +1 -0
  21. package/dist/analytics/tracker.js +36 -0
  22. package/dist/analytics/tracker.js.map +1 -0
  23. package/dist/analytics/viewed.d.ts +11 -0
  24. package/dist/analytics/viewed.d.ts.map +1 -0
  25. package/dist/analytics/viewed.js +16 -0
  26. package/dist/analytics/viewed.js.map +1 -0
  27. package/dist/components/ChangeList.d.ts +21 -0
  28. package/dist/components/ChangeList.d.ts.map +1 -0
  29. package/dist/components/ChangeList.js +40 -0
  30. package/dist/components/ChangeList.js.map +1 -0
  31. package/dist/components/PhotonOrder.d.ts +46 -0
  32. package/dist/components/PhotonOrder.d.ts.map +1 -0
  33. package/dist/components/PhotonOrder.js +274 -0
  34. package/dist/components/PhotonOrder.js.map +1 -0
  35. package/dist/components/PhotonPatient.d.ts +48 -0
  36. package/dist/components/PhotonPatient.d.ts.map +1 -0
  37. package/dist/components/PhotonPatient.js +85 -0
  38. package/dist/components/PhotonPatient.js.map +1 -0
  39. package/dist/components/PhotonPrescription.d.ts +32 -0
  40. package/dist/components/PhotonPrescription.d.ts.map +1 -0
  41. package/dist/components/PhotonPrescription.js +11 -0
  42. package/dist/components/PhotonPrescription.js.map +1 -0
  43. package/dist/components/ScreeningAlerts.d.ts +6 -0
  44. package/dist/components/ScreeningAlerts.d.ts.map +1 -0
  45. package/dist/components/ScreeningAlerts.js +11 -0
  46. package/dist/components/ScreeningAlerts.js.map +1 -0
  47. package/dist/components/SignedIn.d.ts +12 -0
  48. package/dist/components/SignedIn.d.ts.map +1 -0
  49. package/dist/components/SignedIn.js +84 -0
  50. package/dist/components/SignedIn.js.map +1 -0
  51. package/dist/components/activity.d.ts +7 -0
  52. package/dist/components/activity.d.ts.map +1 -0
  53. package/dist/components/activity.js +24 -0
  54. package/dist/components/activity.js.map +1 -0
  55. package/dist/components/display.d.ts +90 -0
  56. package/dist/components/display.d.ts.map +1 -0
  57. package/dist/components/display.js +223 -0
  58. package/dist/components/display.js.map +1 -0
  59. package/dist/components/flow.d.ts +35 -0
  60. package/dist/components/flow.d.ts.map +1 -0
  61. package/dist/components/flow.js +53 -0
  62. package/dist/components/flow.js.map +1 -0
  63. package/dist/components/format.d.ts +26 -0
  64. package/dist/components/format.d.ts.map +1 -0
  65. package/dist/components/format.js +61 -0
  66. package/dist/components/format.js.map +1 -0
  67. package/dist/components/index.d.ts +6 -0
  68. package/dist/components/index.d.ts.map +1 -0
  69. package/dist/components/index.js +6 -0
  70. package/dist/components/index.js.map +1 -0
  71. package/dist/components/open.d.ts +47 -0
  72. package/dist/components/open.d.ts.map +1 -0
  73. package/dist/components/open.js +73 -0
  74. package/dist/components/open.js.map +1 -0
  75. package/dist/components/order/DraftOrderPrompt.d.ts +18 -0
  76. package/dist/components/order/DraftOrderPrompt.d.ts.map +1 -0
  77. package/dist/components/order/DraftOrderPrompt.js +26 -0
  78. package/dist/components/order/DraftOrderPrompt.js.map +1 -0
  79. package/dist/components/patient/Benefits.d.ts +25 -0
  80. package/dist/components/patient/Benefits.d.ts.map +1 -0
  81. package/dist/components/patient/Benefits.js +48 -0
  82. package/dist/components/patient/Benefits.js.map +1 -0
  83. package/dist/components/patient/Clinical.d.ts +56 -0
  84. package/dist/components/patient/Clinical.d.ts.map +1 -0
  85. package/dist/components/patient/Clinical.js +118 -0
  86. package/dist/components/patient/Clinical.js.map +1 -0
  87. package/dist/components/patient/IntakeForm.d.ts +10 -0
  88. package/dist/components/patient/IntakeForm.d.ts.map +1 -0
  89. package/dist/components/patient/IntakeForm.js +333 -0
  90. package/dist/components/patient/IntakeForm.js.map +1 -0
  91. package/dist/components/patient/Summary.d.ts +48 -0
  92. package/dist/components/patient/Summary.d.ts.map +1 -0
  93. package/dist/components/patient/Summary.js +90 -0
  94. package/dist/components/patient/Summary.js.map +1 -0
  95. package/dist/components/patient/fields.d.ts +42 -0
  96. package/dist/components/patient/fields.d.ts.map +1 -0
  97. package/dist/components/patient/fields.js +72 -0
  98. package/dist/components/patient/fields.js.map +1 -0
  99. package/dist/components/patient/query.d.ts +37 -0
  100. package/dist/components/patient/query.d.ts.map +1 -0
  101. package/dist/components/patient/query.js +70 -0
  102. package/dist/components/patient/query.js.map +1 -0
  103. package/dist/components/prescription/PrescriptionCard.d.ts +45 -0
  104. package/dist/components/prescription/PrescriptionCard.d.ts.map +1 -0
  105. package/dist/components/prescription/PrescriptionCard.js +179 -0
  106. package/dist/components/prescription/PrescriptionCard.js.map +1 -0
  107. package/dist/components/prescription/PrescriptionDetailsForm/DirectionsInput.d.ts +15 -0
  108. package/dist/components/prescription/PrescriptionDetailsForm/DirectionsInput.d.ts.map +1 -0
  109. package/dist/components/prescription/PrescriptionDetailsForm/DirectionsInput.js +18 -0
  110. package/dist/components/prescription/PrescriptionDetailsForm/DirectionsInput.js.map +1 -0
  111. package/dist/components/prescription/PrescriptionDetailsForm/DispenseInputs.d.ts +23 -0
  112. package/dist/components/prescription/PrescriptionDetailsForm/DispenseInputs.d.ts.map +1 -0
  113. package/dist/components/prescription/PrescriptionDetailsForm/DispenseInputs.js +42 -0
  114. package/dist/components/prescription/PrescriptionDetailsForm/DispenseInputs.js.map +1 -0
  115. package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.d.ts +27 -0
  116. package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.d.ts.map +1 -0
  117. package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.js +169 -0
  118. package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.js.map +1 -0
  119. package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.d.ts +8 -0
  120. package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.d.ts.map +1 -0
  121. package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.js +12 -0
  122. package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.js.map +1 -0
  123. package/dist/components/prescription/PrescriptionDetailsForm/TemplatePicker.d.ts +11 -0
  124. package/dist/components/prescription/PrescriptionDetailsForm/TemplatePicker.d.ts.map +1 -0
  125. package/dist/components/prescription/PrescriptionDetailsForm/TemplatePicker.js +25 -0
  126. package/dist/components/prescription/PrescriptionDetailsForm/TemplatePicker.js.map +1 -0
  127. package/dist/components/prescription/TreatmentSearch/TreatmentPicker.d.ts +50 -0
  128. package/dist/components/prescription/TreatmentSearch/TreatmentPicker.d.ts.map +1 -0
  129. package/dist/components/prescription/TreatmentSearch/TreatmentPicker.js +287 -0
  130. package/dist/components/prescription/TreatmentSearch/TreatmentPicker.js.map +1 -0
  131. package/dist/components/prescription/TreatmentSearch/TreatmentSearch.d.ts +28 -0
  132. package/dist/components/prescription/TreatmentSearch/TreatmentSearch.d.ts.map +1 -0
  133. package/dist/components/prescription/TreatmentSearch/TreatmentSearch.js +146 -0
  134. package/dist/components/prescription/TreatmentSearch/TreatmentSearch.js.map +1 -0
  135. package/dist/components/schemaErrors.d.ts +12 -0
  136. package/dist/components/schemaErrors.d.ts.map +1 -0
  137. package/dist/components/schemaErrors.js +24 -0
  138. package/dist/components/schemaErrors.js.map +1 -0
  139. package/dist/components/search.d.ts +154 -0
  140. package/dist/components/search.d.ts.map +1 -0
  141. package/dist/components/search.js +295 -0
  142. package/dist/components/search.js.map +1 -0
  143. package/dist/hooks/index.d.ts +5 -0
  144. package/dist/hooks/index.d.ts.map +1 -0
  145. package/dist/hooks/index.js +5 -0
  146. package/dist/hooks/index.js.map +1 -0
  147. package/dist/hooks/useLatestCallback.d.ts +7 -0
  148. package/dist/hooks/useLatestCallback.d.ts.map +1 -0
  149. package/dist/hooks/useLatestCallback.js +14 -0
  150. package/dist/hooks/useLatestCallback.js.map +1 -0
  151. package/dist/hooks/useLive.d.ts +15 -0
  152. package/dist/hooks/useLive.d.ts.map +1 -0
  153. package/dist/hooks/useLive.js +6 -0
  154. package/dist/hooks/useLive.js.map +1 -0
  155. package/dist/hooks/useOnChange.d.ts +11 -0
  156. package/dist/hooks/useOnChange.d.ts.map +1 -0
  157. package/dist/hooks/useOnChange.js +28 -0
  158. package/dist/hooks/useOnChange.js.map +1 -0
  159. package/dist/hooks/useSession.d.ts +7 -0
  160. package/dist/hooks/useSession.d.ts.map +1 -0
  161. package/dist/hooks/useSession.js +10 -0
  162. package/dist/hooks/useSession.js.map +1 -0
  163. package/dist/index.d.ts +22 -0
  164. package/dist/index.d.ts.map +1 -0
  165. package/dist/index.js +20 -0
  166. package/dist/index.js.map +1 -0
  167. package/dist/meta/version.d.ts +5 -0
  168. package/dist/meta/version.d.ts.map +1 -0
  169. package/dist/meta/version.js +5 -0
  170. package/dist/meta/version.js.map +1 -0
  171. package/dist/primitives/PhotonProvider.d.ts +60 -0
  172. package/dist/primitives/PhotonProvider.d.ts.map +1 -0
  173. package/dist/primitives/PhotonProvider.js +103 -0
  174. package/dist/primitives/PhotonProvider.js.map +1 -0
  175. package/dist/primitives/defaults.d.ts +3 -0
  176. package/dist/primitives/defaults.d.ts.map +1 -0
  177. package/dist/primitives/defaults.js +70 -0
  178. package/dist/primitives/defaults.js.map +1 -0
  179. package/dist/primitives/icons.d.ts +6 -0
  180. package/dist/primitives/icons.d.ts.map +1 -0
  181. package/dist/primitives/icons.js +6 -0
  182. package/dist/primitives/icons.js.map +1 -0
  183. package/dist/primitives/index.d.ts +5 -0
  184. package/dist/primitives/index.d.ts.map +1 -0
  185. package/dist/primitives/index.js +5 -0
  186. package/dist/primitives/index.js.map +1 -0
  187. package/dist/primitives/photonContext.d.ts +3 -0
  188. package/dist/primitives/photonContext.d.ts.map +1 -0
  189. package/dist/primitives/photonContext.js +3 -0
  190. package/dist/primitives/photonContext.js.map +1 -0
  191. package/dist/primitives/select.d.ts +7 -0
  192. package/dist/primitives/select.d.ts.map +1 -0
  193. package/dist/primitives/select.js +16 -0
  194. package/dist/primitives/select.js.map +1 -0
  195. package/dist/primitives/types.d.ts +288 -0
  196. package/dist/primitives/types.d.ts.map +1 -0
  197. package/dist/primitives/types.js +3 -0
  198. package/dist/primitives/types.js.map +1 -0
  199. package/dist/primitives/useProvidedPhoton.d.ts +8 -0
  200. package/dist/primitives/useProvidedPhoton.d.ts.map +1 -0
  201. package/dist/primitives/useProvidedPhoton.js +8 -0
  202. package/dist/primitives/useProvidedPhoton.js.map +1 -0
  203. package/dist/styles.css +653 -0
  204. package/dist/test-utils/contract.d.ts +17 -0
  205. package/dist/test-utils/contract.d.ts.map +1 -0
  206. package/dist/test-utils/contract.js +282 -0
  207. package/dist/test-utils/contract.js.map +1 -0
  208. package/package.json +76 -4
  209. package/src/adapters/index.ts +1 -0
  210. package/src/adapters/tailwind.tsx +572 -0
  211. package/src/analytics/PhotonAnalyticsProvider.test.tsx +191 -0
  212. package/src/analytics/PhotonAnalyticsProvider.tsx +96 -0
  213. package/src/analytics/fieldInteraction.test.tsx +184 -0
  214. package/src/analytics/fieldInteraction.tsx +148 -0
  215. package/src/analytics/tracker.test.ts +52 -0
  216. package/src/analytics/tracker.ts +42 -0
  217. package/src/analytics/viewed.ts +27 -0
  218. package/src/components/ChangeList.tsx +85 -0
  219. package/src/components/PhotonOrder.test.tsx +256 -0
  220. package/src/components/PhotonOrder.tsx +508 -0
  221. package/src/components/PhotonPatient.tsx +188 -0
  222. package/src/components/PhotonPrescription.test.tsx +116 -0
  223. package/src/components/PhotonPrescription.tsx +45 -0
  224. package/src/components/ScreeningAlerts.tsx +28 -0
  225. package/src/components/SignedIn.tsx +144 -0
  226. package/src/components/activity.ts +23 -0
  227. package/src/components/display.ts +278 -0
  228. package/src/components/flow.ts +67 -0
  229. package/src/components/format.ts +73 -0
  230. package/src/components/index.ts +5 -0
  231. package/src/components/open.ts +100 -0
  232. package/src/components/order/DraftOrderPrompt.test.tsx +80 -0
  233. package/src/components/order/DraftOrderPrompt.tsx +81 -0
  234. package/src/components/patient/Benefits.tsx +133 -0
  235. package/src/components/patient/Clinical.tsx +215 -0
  236. package/src/components/patient/IntakeForm.test.tsx +89 -0
  237. package/src/components/patient/IntakeForm.tsx +564 -0
  238. package/src/components/patient/Summary.test.tsx +106 -0
  239. package/src/components/patient/Summary.tsx +330 -0
  240. package/src/components/patient/fields.tsx +158 -0
  241. package/src/components/patient/query.ts +83 -0
  242. package/src/components/prescription/PrescriptionCard.test.tsx +85 -0
  243. package/src/components/prescription/PrescriptionCard.tsx +347 -0
  244. package/src/components/prescription/PrescriptionDetailsForm/DirectionsInput.test.tsx +85 -0
  245. package/src/components/prescription/PrescriptionDetailsForm/DirectionsInput.tsx +41 -0
  246. package/src/components/prescription/PrescriptionDetailsForm/DispenseInputs.test.tsx +209 -0
  247. package/src/components/prescription/PrescriptionDetailsForm/DispenseInputs.tsx +99 -0
  248. package/src/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.test.tsx +456 -0
  249. package/src/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.tsx +238 -0
  250. package/src/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.test.ts +63 -0
  251. package/src/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.ts +15 -0
  252. package/src/components/prescription/PrescriptionDetailsForm/TemplatePicker.test.tsx +75 -0
  253. package/src/components/prescription/PrescriptionDetailsForm/TemplatePicker.tsx +41 -0
  254. package/src/components/prescription/TreatmentSearch/TreatmentPicker.tsx +375 -0
  255. package/src/components/prescription/TreatmentSearch/TreatmentSearch.test.tsx +699 -0
  256. package/src/components/prescription/TreatmentSearch/TreatmentSearch.tsx +220 -0
  257. package/src/components/schemaErrors.test.ts +49 -0
  258. package/src/components/schemaErrors.ts +33 -0
  259. package/src/components/search.tsx +377 -0
  260. package/src/hooks/index.ts +4 -0
  261. package/src/hooks/useLatestCallback.ts +16 -0
  262. package/src/hooks/useLive.ts +21 -0
  263. package/src/hooks/useOnChange.ts +34 -0
  264. package/src/hooks/useSession.ts +11 -0
  265. package/src/index.ts +21 -0
  266. package/src/meta/version.test.ts +10 -0
  267. package/src/meta/version.ts +4 -0
  268. package/src/primitives/PhotonProvider.tsx +168 -0
  269. package/src/primitives/defaults.tsx +432 -0
  270. package/src/primitives/icons.tsx +37 -0
  271. package/src/primitives/index.ts +4 -0
  272. package/src/primitives/photonContext.ts +4 -0
  273. package/src/primitives/select.ts +15 -0
  274. package/src/primitives/types.ts +288 -0
  275. package/src/primitives/useProvidedPhoton.ts +21 -0
  276. package/src/styles.css +653 -0
  277. package/src/test-utils/contract.tsx +453 -0
@@ -0,0 +1,653 @@
1
+ /*
2
+ * @photonhealth/react — optional structural styles for the unstyled defaults.
3
+ *
4
+ * Adopts the host page: fonts, sizes and colours are inherited; spacing is in
5
+ * em so it scales with the page's type; accents use the system AccentColor.
6
+ * Every rule is wrapped in :where() (zero specificity), so any host style wins.
7
+ *
8
+ * Tune without overriding selectors:
9
+ * --prx-accent interactive colour (default AccentColor)
10
+ * --prx-border hairlines (default: currentColor at 20%)
11
+ * --prx-radius corner radius (default 0.5em)
12
+ * --prx-surface card background (default transparent)
13
+ * --prx-on-accent text on accent buttons (default white)
14
+ * --prx-warning / --prx-critical / --prx-success / --prx-info status tints
15
+ */
16
+
17
+ :where([class^="prx-"], [class*=" prx-"]) {
18
+ box-sizing: border-box;
19
+ }
20
+
21
+ :where([data-gap="1"]) {
22
+ gap: 0.25em;
23
+ }
24
+ :where([data-gap="2"]) {
25
+ gap: 0.5em;
26
+ }
27
+ :where([data-gap="3"]) {
28
+ gap: 0.75em;
29
+ }
30
+ :where([data-gap="4"]) {
31
+ gap: 1em;
32
+ }
33
+ :where([data-gap="6"]) {
34
+ gap: 1.5em;
35
+ }
36
+
37
+ :where(.prx-stack) {
38
+ display: flex;
39
+ flex-direction: column;
40
+ }
41
+ :where(.prx-stack[data-align="start"]) {
42
+ align-items: flex-start;
43
+ }
44
+ :where(.prx-stack[data-align="end"]) {
45
+ align-items: flex-end;
46
+ }
47
+ :where(.prx-row) {
48
+ display: flex;
49
+ flex-wrap: wrap;
50
+ align-items: center;
51
+ }
52
+ :where(.prx-row[data-align="start"]) {
53
+ align-items: flex-start;
54
+ }
55
+ :where(.prx-row[data-align="end"]) {
56
+ align-items: flex-end;
57
+ }
58
+ :where(.prx-row[data-justify="between"]) {
59
+ justify-content: space-between;
60
+ }
61
+ :where(.prx-row[data-justify="end"]) {
62
+ justify-content: flex-end;
63
+ }
64
+ :where(.prx-grid) {
65
+ display: grid;
66
+ }
67
+ :where(.prx-container) {
68
+ max-width: 35em;
69
+ margin-inline: auto;
70
+ }
71
+
72
+ :where(.prx-page-header h1) {
73
+ margin: 0;
74
+ font-size: 1.5em;
75
+ }
76
+ :where(.prx-page-header p) {
77
+ margin: 0.25em 0 0;
78
+ opacity: 0.75;
79
+ }
80
+ :where(.prx-text[data-tone="secondary"]) {
81
+ opacity: 0.8;
82
+ }
83
+ :where(.prx-text[data-tone="tertiary"]) {
84
+ opacity: 0.65;
85
+ }
86
+
87
+ :where(.prx-card) {
88
+ border: 1px solid var(--prx-border, color-mix(in srgb, currentColor 20%, transparent));
89
+ border-radius: var(--prx-radius, 0.5em);
90
+ background: var(--prx-surface, transparent);
91
+ }
92
+ :where(.prx-card-header, .prx-card-body, .prx-card-footer) {
93
+ padding: 1em;
94
+ }
95
+ :where(.prx-card[data-divided] > * + *) {
96
+ border-top: 1px solid var(--prx-border, color-mix(in srgb, currentColor 20%, transparent));
97
+ }
98
+ :where(.prx-card-header) {
99
+ display: flex;
100
+ justify-content: space-between;
101
+ gap: 1em;
102
+ align-items: flex-start;
103
+ }
104
+ :where(.prx-card-title) {
105
+ margin: 0;
106
+ font-size: 1.05em;
107
+ }
108
+ :where(.prx-card-description) {
109
+ margin: 0.25em 0 0;
110
+ opacity: 0.75;
111
+ }
112
+ :where(.prx-card-footer) {
113
+ display: flex;
114
+ justify-content: flex-end;
115
+ align-items: center;
116
+ gap: 0.5em;
117
+ flex-wrap: wrap;
118
+ }
119
+ :where(.prx-card-footer-start) {
120
+ margin-right: auto;
121
+ }
122
+ :where(.prx-spinner-status) {
123
+ display: inline-flex;
124
+ align-items: center;
125
+ gap: 0.5em;
126
+ font-size: 0.875em;
127
+ opacity: 0.75;
128
+ }
129
+ :where(.prx-spinner) {
130
+ width: 1em;
131
+ height: 1em;
132
+ border: 2px solid color-mix(in srgb, currentColor 25%, transparent);
133
+ border-top-color: currentColor;
134
+ border-radius: 50%;
135
+ animation: prx-spin var(--prx-spin-duration, 0.8s) linear infinite;
136
+ }
137
+ @keyframes prx-spin {
138
+ to {
139
+ transform: rotate(360deg);
140
+ }
141
+ }
142
+ @media (prefers-reduced-motion: reduce) {
143
+ :where(.prx-spinner) {
144
+ animation: none;
145
+ }
146
+ }
147
+
148
+ :where(.prx-field) {
149
+ display: flex;
150
+ flex-direction: column;
151
+ gap: 0.25em;
152
+ min-width: 0;
153
+ }
154
+ :where(.prx-label) {
155
+ font-size: 0.85em;
156
+ font-weight: 600;
157
+ }
158
+ :where(.prx-note) {
159
+ font-size: 0.85em;
160
+ min-height: 1.2em;
161
+ opacity: 0.75;
162
+ }
163
+ :where(.prx-field[data-invalid] .prx-note) {
164
+ color: var(--prx-critical, #d92d20);
165
+ opacity: 1;
166
+ }
167
+ :where(.prx-input) {
168
+ font: inherit;
169
+ color: inherit;
170
+ background: transparent;
171
+ border: 1px solid var(--prx-border, color-mix(in srgb, currentColor 20%, transparent));
172
+ border-radius: var(--prx-radius, 0.5em);
173
+ padding: 0.5em 0.65em;
174
+ width: 100%;
175
+ box-sizing: border-box;
176
+ }
177
+ :where(.prx-input:focus-visible, .prx-button:focus-visible) {
178
+ outline: 2px solid var(--prx-accent, AccentColor);
179
+ outline-offset: 2px;
180
+ }
181
+ :where(.prx-input-wrap) {
182
+ position: relative;
183
+ display: block;
184
+ }
185
+ /* The field's ×: where the spinner goes, the text kept clear of it. */
186
+ :where(.prx-input[data-clearable]) {
187
+ padding-right: 2.2em;
188
+ }
189
+ :where(.prx-input-clear) {
190
+ position: absolute;
191
+ right: 0.35em;
192
+ top: 50%;
193
+ transform: translateY(-50%);
194
+ display: grid;
195
+ place-items: center;
196
+ padding: 0.25em;
197
+ font: inherit;
198
+ color: inherit;
199
+ background: none;
200
+ border: 0;
201
+ border-radius: var(--prx-radius, 0.5em);
202
+ cursor: pointer;
203
+ opacity: 0.7;
204
+ }
205
+ :where(.prx-input-clear:hover, .prx-input-clear:focus-visible) {
206
+ opacity: 1;
207
+ outline: 2px solid var(--prx-accent, AccentColor);
208
+ outline-offset: 0;
209
+ }
210
+ :where(.prx-spinner) {
211
+ position: absolute;
212
+ right: 0.65em;
213
+ top: 50%;
214
+ width: 1em;
215
+ height: 1em;
216
+ margin-top: -0.5em;
217
+ border: 2px solid color-mix(in srgb, currentColor 25%, transparent);
218
+ border-top-color: var(--prx-accent, AccentColor);
219
+ border-radius: 50%;
220
+ animation: prx-spin var(--prx-spin-duration, 0.8s) linear infinite;
221
+ }
222
+ @keyframes prx-spin {
223
+ to {
224
+ transform: rotate(360deg);
225
+ }
226
+ }
227
+ @media (prefers-reduced-motion: reduce) {
228
+ :where(.prx-spinner) {
229
+ animation: none;
230
+ }
231
+ }
232
+ :where(.prx-check) {
233
+ display: inline-flex;
234
+ gap: 0.5em;
235
+ align-items: center;
236
+ }
237
+ :where(.prx-radio-group) {
238
+ border: 0;
239
+ padding: 0;
240
+ margin: 0;
241
+ display: flex;
242
+ flex-direction: column;
243
+ gap: 0.5em;
244
+ }
245
+ :where(.prx-radio-group[data-horizontal]) {
246
+ flex-direction: row;
247
+ flex-wrap: wrap;
248
+ }
249
+
250
+ :where(.prx-button) {
251
+ font: inherit;
252
+ cursor: pointer;
253
+ border-radius: var(--prx-radius, 0.5em);
254
+ padding: 0.5em 1em;
255
+ border: 1px solid var(--prx-accent, AccentColor);
256
+ background: var(--prx-accent, AccentColor);
257
+ color: var(--prx-on-accent, white);
258
+ }
259
+ :where(.prx-button[data-variant="secondary"]) {
260
+ background: transparent;
261
+ color: var(--prx-accent, AccentColor);
262
+ border-color: var(--prx-accent, AccentColor);
263
+ }
264
+ :where(.prx-button[data-variant="ghost"]) {
265
+ background: transparent;
266
+ color: var(--prx-accent, AccentColor);
267
+ border-color: transparent;
268
+ }
269
+ :where(.prx-button[data-variant="secondary"]:hover, .prx-button[data-variant="ghost"]:hover) {
270
+ background: color-mix(in srgb, var(--prx-accent, AccentColor) 8%, transparent);
271
+ }
272
+ :where(.prx-button[data-tone="critical"]) {
273
+ color: var(--prx-critical, #d92d20);
274
+ }
275
+ :where(.prx-button[data-tone="critical"]:hover) {
276
+ background: color-mix(in srgb, var(--prx-critical, #d92d20) 8%, transparent);
277
+ }
278
+ :where(.prx-button[data-variant="danger"]) {
279
+ background: var(--prx-critical, #d92d20);
280
+ border-color: var(--prx-critical, #d92d20);
281
+ color: white;
282
+ }
283
+ :where(.prx-button[data-size="sm"]) {
284
+ padding: 0.3em 0.7em;
285
+ font-size: 0.9em;
286
+ }
287
+ :where(.prx-button[data-size="lg"]) {
288
+ padding: 0.7em 1.4em;
289
+ }
290
+ :where(.prx-icon) {
291
+ width: 1.25em;
292
+ height: 1.25em;
293
+ display: block;
294
+ }
295
+ :where(.prx-button:not([data-icon])) {
296
+ display: inline-flex;
297
+ align-items: center;
298
+ gap: 0.4em;
299
+ }
300
+ :where(.prx-button:not([data-icon]) .prx-icon) {
301
+ width: 1em;
302
+ height: 1em;
303
+ }
304
+ :where(.prx-button[data-icon]) {
305
+ padding: 0.35em;
306
+ line-height: 0;
307
+ }
308
+ :where(.prx-badge .prx-icon) {
309
+ width: 1em;
310
+ height: 1em;
311
+ }
312
+ :where(.prx-button:disabled) {
313
+ opacity: 0.5;
314
+ cursor: not-allowed;
315
+ }
316
+ :where(.prx-button[data-loading]) {
317
+ cursor: progress;
318
+ }
319
+
320
+ /* Rows like OptionList's (.prx-option): separate cards; keyboard focus reads as its selected row. */
321
+ :where(.prx-choices) {
322
+ list-style: none;
323
+ margin: 0;
324
+ padding: 0;
325
+ display: flex;
326
+ flex-direction: column;
327
+ gap: 0.5em;
328
+ }
329
+ :where(.prx-choice) {
330
+ font: inherit;
331
+ color: inherit;
332
+ background: none;
333
+ width: 100%;
334
+ text-align: left;
335
+ padding: 0.75em 1em;
336
+ border: 1px solid var(--prx-border, color-mix(in srgb, currentColor 20%, transparent));
337
+ border-radius: var(--prx-radius, 0.5em);
338
+ cursor: pointer;
339
+ display: flex;
340
+ align-items: center;
341
+ gap: 0.75em;
342
+ }
343
+ :where(.prx-choice-text) {
344
+ flex: 1;
345
+ min-width: 0;
346
+ display: flex;
347
+ flex-direction: column;
348
+ gap: 0.15em;
349
+ }
350
+ /* What Return would take: shown on the row the keys are on, so it answers "and now what?". Keyboard only —
351
+ a pointer doesn't need telling. */
352
+ :where(.prx-choice-return) {
353
+ flex: none;
354
+ width: 1.15em;
355
+ height: 1.15em;
356
+ visibility: hidden;
357
+ }
358
+ :where(.prx-choice:focus-visible .prx-choice-return),
359
+ :where(.prx-choice-active .prx-choice-return) {
360
+ visibility: visible;
361
+ }
362
+ /* Driven by a field that keeps the cursor: the row the keys are on is marked, not focused, so it has to
363
+ look the way a focused one does. */
364
+ :where(li.prx-choice) {
365
+ list-style: none;
366
+ cursor: pointer;
367
+ }
368
+ :where(.prx-choice-active) {
369
+ border-color: var(--prx-accent, AccentColor);
370
+ box-shadow: inset 0 0 0 1px var(--prx-accent, AccentColor);
371
+ background: color-mix(in srgb, var(--prx-accent, AccentColor) 6%, transparent);
372
+ }
373
+ /* The way out of the list: the same row and width as a choice, so the keys run through it — but no border
374
+ until it has focus, because it isn't one of the people above it. */
375
+ :where(.prx-choice-action) {
376
+ border-color: transparent;
377
+ color: var(--prx-accent, AccentColor);
378
+ }
379
+ :where(.prx-choice-action:focus-visible),
380
+ :where(.prx-choice-action.prx-choice-active) {
381
+ border-color: var(--prx-accent, AccentColor);
382
+ }
383
+ :where(.prx-choice:hover) {
384
+ background: color-mix(in srgb, var(--prx-accent, AccentColor) 8%, transparent);
385
+ }
386
+ :where(.prx-choice:focus-visible, .prx-choice[aria-busy="true"]) {
387
+ outline: none;
388
+ border-color: var(--prx-accent, AccentColor);
389
+ box-shadow: inset 0 0 0 1px var(--prx-accent, AccentColor);
390
+ background: color-mix(in srgb, var(--prx-accent, AccentColor) 6%, transparent);
391
+ }
392
+ :where(.prx-choice:disabled) {
393
+ opacity: 0.5;
394
+ cursor: not-allowed;
395
+ }
396
+ :where(.prx-choice-line) {
397
+ display: flex;
398
+ flex-wrap: wrap;
399
+ align-items: baseline;
400
+ column-gap: 0.5em;
401
+ }
402
+ :where(.prx-choice-description) {
403
+ font-size: 0.85em;
404
+ opacity: 0.7;
405
+ }
406
+ :where(.prx-options) {
407
+ display: flex;
408
+ flex-direction: column;
409
+ gap: 0.6em;
410
+ border-radius: var(--prx-radius, 0.5em);
411
+ }
412
+ :where(.prx-options:focus-visible) {
413
+ outline: none; /* the selected row shows where focus is */
414
+ }
415
+ :where(.prx-options-list) {
416
+ list-style: none;
417
+ margin: 0;
418
+ padding: 0;
419
+ display: flex;
420
+ flex-direction: column;
421
+ gap: 0.5em;
422
+ }
423
+ :where(.prx-option) {
424
+ font: inherit;
425
+ color: inherit;
426
+ background: none;
427
+ width: 100%;
428
+ text-align: left;
429
+ padding: 0.75em 1em;
430
+ border: 1px solid var(--prx-border, color-mix(in srgb, currentColor 20%, transparent));
431
+ border-radius: var(--prx-radius, 0.5em);
432
+ display: flex;
433
+ flex-direction: column;
434
+ gap: 0.75em;
435
+ }
436
+ :where(button.prx-option) {
437
+ cursor: pointer;
438
+ }
439
+ :where(button.prx-option:hover, button.prx-option:focus-visible) {
440
+ background: color-mix(in srgb, var(--prx-accent, AccentColor) 8%, transparent);
441
+ outline: none;
442
+ }
443
+ :where(.prx-option[data-active][data-selected]) {
444
+ border-color: var(--prx-accent, AccentColor);
445
+ box-shadow: inset 0 0 0 1px var(--prx-accent, AccentColor);
446
+ background: color-mix(in srgb, var(--prx-accent, AccentColor) 6%, transparent);
447
+ }
448
+ :where(.prx-option[data-active] .prx-option-label) {
449
+ font-weight: 600;
450
+ }
451
+ :where(.prx-option-row) {
452
+ display: flex;
453
+ align-items: center;
454
+ gap: 0.6em;
455
+ }
456
+ /* The open row's heading: a button (it reports its key), drawn as the row's text. */
457
+ :where(button.prx-option-row) {
458
+ font: inherit;
459
+ color: inherit;
460
+ background: none;
461
+ border: 0;
462
+ padding: 0;
463
+ width: 100%;
464
+ text-align: left;
465
+ cursor: pointer;
466
+ }
467
+ :where(button.prx-option-row:focus-visible) {
468
+ outline: 2px solid var(--prx-accent, AccentColor);
469
+ outline-offset: 2px;
470
+ }
471
+ :where(.prx-option-text) {
472
+ display: flex;
473
+ flex-direction: column;
474
+ gap: 0.15em;
475
+ }
476
+ :where(.prx-toggle-group) {
477
+ display: flex;
478
+ flex-direction: column;
479
+ gap: 0.5em;
480
+ }
481
+ :where(.prx-toggle-label) {
482
+ font-size: 0.85em;
483
+ }
484
+ :where(.prx-toggles) {
485
+ display: flex;
486
+ flex-wrap: wrap;
487
+ gap: 0.5em;
488
+ }
489
+ :where(.prx-toggle) {
490
+ font: inherit;
491
+ color: inherit;
492
+ background: none;
493
+ cursor: pointer;
494
+ padding: 0.45em 0.9em;
495
+ border: 1px solid var(--prx-border, color-mix(in srgb, currentColor 20%, transparent));
496
+ border-radius: var(--prx-radius, 0.5em);
497
+ display: inline-flex;
498
+ align-items: baseline;
499
+ gap: 0.4em;
500
+ }
501
+ :where(.prx-toggle[aria-pressed="true"]) {
502
+ background: var(--prx-accent, AccentColor);
503
+ border-color: var(--prx-accent, AccentColor);
504
+ color: var(--prx-on-accent, white);
505
+ font-weight: 600;
506
+ }
507
+ :where(.prx-toggle[data-muted]:not([aria-pressed="true"])) {
508
+ opacity: 0.45;
509
+ }
510
+ :where(.prx-toggle:disabled) {
511
+ opacity: 0.5;
512
+ cursor: not-allowed;
513
+ }
514
+ :where(.prx-option-chevron) {
515
+ margin-left: auto;
516
+ opacity: 0.5;
517
+ }
518
+ /* The view's primary action, in flow: right-aligned under the content. Where it sits on a page
519
+ (pinned, in a footer, in a dialog's buttons) is the host's call. */
520
+ :where(.prx-action-bar) {
521
+ display: flex;
522
+ justify-content: flex-end;
523
+ align-items: center;
524
+ gap: 1em;
525
+ }
526
+ /* Narrow containers (a phone, a dialog, a side panel): chips share the row evenly, for thumbs. A
527
+ container query, not a viewport one: the cards can sit at any width on any screen. */
528
+ :where(.prx-toggle-group) {
529
+ container-type: inline-size;
530
+ }
531
+ @container (max-width: 28em) {
532
+ :where(.prx-toggle) {
533
+ flex: 1 1 calc(33.333% - 0.5em);
534
+ justify-content: center;
535
+ }
536
+ }
537
+ :where(.prx-alert) {
538
+ display: flex;
539
+ justify-content: space-between;
540
+ gap: 1em;
541
+ padding: 0.75em 1em;
542
+ border-radius: var(--prx-radius, 0.5em);
543
+ border-left: 0.25em solid var(--prx-info, var(--prx-accent, AccentColor));
544
+ background: color-mix(in srgb, var(--prx-info, var(--prx-accent, AccentColor)) 8%, transparent);
545
+ }
546
+ :where(.prx-alert[data-tone="warning"]) {
547
+ border-left-color: var(--prx-warning, #b54708);
548
+ background: color-mix(in srgb, var(--prx-warning, #b54708) 8%, transparent);
549
+ }
550
+ :where(.prx-alert[data-tone="critical"]) {
551
+ border-left-color: var(--prx-critical, #d92d20);
552
+ background: color-mix(in srgb, var(--prx-critical, #d92d20) 8%, transparent);
553
+ }
554
+ :where(.prx-alert[data-tone="success"]) {
555
+ border-left-color: var(--prx-success, #067647);
556
+ background: color-mix(in srgb, var(--prx-success, #067647) 8%, transparent);
557
+ }
558
+ :where(.prx-alert[data-tone="neutral"]) {
559
+ border-left-color: var(--prx-border, color-mix(in srgb, currentColor 20%, transparent));
560
+ background: transparent;
561
+ }
562
+ :where(.prx-alert-description) {
563
+ margin-top: 0.25em;
564
+ }
565
+
566
+ :where(.prx-badge) {
567
+ display: inline-flex;
568
+ align-items: center;
569
+ gap: 0.3em;
570
+ font-size: 0.8em;
571
+ padding: 0.1em 0.6em;
572
+ border-radius: 999px;
573
+ border: 1px solid var(--prx-border, color-mix(in srgb, currentColor 20%, transparent));
574
+ }
575
+ :where(.prx-badge-remove) {
576
+ font: inherit;
577
+ color: inherit;
578
+ background: none;
579
+ border: 0;
580
+ padding: 0;
581
+ cursor: pointer;
582
+ opacity: 0.7;
583
+ }
584
+ :where(.prx-badge-remove:hover) {
585
+ opacity: 1;
586
+ }
587
+ :where(.prx-badge-remove:focus-visible) {
588
+ outline: 2px solid var(--prx-accent, AccentColor);
589
+ outline-offset: 1px;
590
+ }
591
+ :where(.prx-badge[data-tone="warning"]) {
592
+ border-color: var(--prx-warning, #b54708);
593
+ color: var(--prx-warning, #b54708);
594
+ }
595
+ :where(.prx-badge[data-tone="critical"]) {
596
+ border-color: var(--prx-critical, #d92d20);
597
+ color: var(--prx-critical, #d92d20);
598
+ }
599
+ :where(.prx-badge[data-tone="success"]) {
600
+ border-color: var(--prx-success, #067647);
601
+ color: var(--prx-success, #067647);
602
+ }
603
+ :where(.prx-badge[data-tone="info"]) {
604
+ border-color: var(--prx-info, var(--prx-accent, AccentColor));
605
+ color: var(--prx-info, var(--prx-accent, AccentColor));
606
+ }
607
+
608
+ :where(.prx-disclosure) {
609
+ display: flex;
610
+ flex-direction: column;
611
+ gap: 0.75em;
612
+ }
613
+ :where(.prx-disclosure-toggle) {
614
+ font: inherit;
615
+ color: inherit;
616
+ background: none;
617
+ border: 0;
618
+ padding: 0;
619
+ display: flex;
620
+ align-items: center;
621
+ gap: 0.35em;
622
+ width: 100%;
623
+ text-align: left;
624
+ cursor: pointer;
625
+ opacity: 0.8;
626
+ border-radius: var(--prx-radius, 0.5em);
627
+ }
628
+ :where(.prx-disclosure-toggle:hover) {
629
+ opacity: 1;
630
+ }
631
+ :where(.prx-disclosure-toggle:focus-visible) {
632
+ outline: 2px solid var(--prx-accent, AccentColor);
633
+ outline-offset: 2px;
634
+ }
635
+ :where(.prx-disclosure-chevron) {
636
+ width: 1em;
637
+ height: 1em;
638
+ flex: none;
639
+ }
640
+ :where(.prx-disclosure[data-open] .prx-disclosure-chevron) {
641
+ transform: rotate(90deg);
642
+ }
643
+
644
+ @media (prefers-reduced-motion: no-preference) {
645
+ :where(.prx-disclosure-chevron) {
646
+ transition: transform 0.14s;
647
+ }
648
+ :where(.prx-button, .prx-input) {
649
+ transition:
650
+ border-color 0.14s,
651
+ background-color 0.14s;
652
+ }
653
+ }
@@ -0,0 +1,17 @@
1
+ import type { PhotonComponents } from "../primitives/types.ts";
2
+ /** A brand: a name for the test titles, and its building blocks (`undefined`: the stock HTML defaults). */
3
+ export type Brand = [name: string, components: Partial<PhotonComponents> | undefined];
4
+ /**
5
+ * The building-block contract: what the cards rely on from every brand's building blocks, whichever design
6
+ * system draws them (a Button never submits a surrounding form, Inputs are labelled, a critical Alert is
7
+ * announced, …). An adapter that breaks one breaks the workflow in that brand only — what this catches.
8
+ *
9
+ * Registers Vitest tests; call it at the top level of a test file that runs in jsdom, with
10
+ * `@testing-library/react` installed:
11
+ *
12
+ * // @vitest-environment jsdom
13
+ * import { buildingBlocksContract } from "@photonhealth/react/test-utils/contract";
14
+ * buildingBlocksContract([["mine", myComponents]]);
15
+ */
16
+ export declare function buildingBlocksContract(brands: Brand[]): void;
17
+ //# sourceMappingURL=contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/test-utils/contract.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,2GAA2G;AAC3G,MAAM,MAAM,KAAK,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,SAAS,CAAC,CAAC;AAEtF;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAgb5D"}