@cdx-ui/components 0.0.1-beta.65 → 0.0.1-beta.66

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 (242) hide show
  1. package/lib/commonjs/components/AlertDialog/index.js +12 -10
  2. package/lib/commonjs/components/AlertDialog/index.js.map +1 -1
  3. package/lib/commonjs/components/Avatar/index.js +125 -25
  4. package/lib/commonjs/components/Avatar/index.js.map +1 -1
  5. package/lib/commonjs/components/Button/index.js +127 -28
  6. package/lib/commonjs/components/Button/index.js.map +1 -1
  7. package/lib/commonjs/components/Button/styles.js +9 -3
  8. package/lib/commonjs/components/Button/styles.js.map +1 -1
  9. package/lib/commonjs/components/CLAUDE.md +115 -11
  10. package/lib/commonjs/components/Checkbox/index.js +69 -22
  11. package/lib/commonjs/components/Checkbox/index.js.map +1 -1
  12. package/lib/commonjs/components/Checkbox/styles.js +1 -1
  13. package/lib/commonjs/components/Checkbox/styles.js.map +1 -1
  14. package/lib/commonjs/components/Chip/index.js +44 -36
  15. package/lib/commonjs/components/Chip/index.js.map +1 -1
  16. package/lib/commonjs/components/Chip/styles.js +6 -35
  17. package/lib/commonjs/components/Chip/styles.js.map +1 -1
  18. package/lib/commonjs/components/Dialog/index.js +92 -72
  19. package/lib/commonjs/components/Dialog/index.js.map +1 -1
  20. package/lib/commonjs/components/Field/index.js +70 -26
  21. package/lib/commonjs/components/Field/index.js.map +1 -1
  22. package/lib/commonjs/components/Form/index.js +5 -12
  23. package/lib/commonjs/components/Form/index.js.map +1 -1
  24. package/lib/commonjs/components/IconButton/index.js +5 -33
  25. package/lib/commonjs/components/IconButton/index.js.map +1 -1
  26. package/lib/commonjs/components/Input/index.js +50 -20
  27. package/lib/commonjs/components/Input/index.js.map +1 -1
  28. package/lib/commonjs/components/Link/index.js +14 -7
  29. package/lib/commonjs/components/Link/index.js.map +1 -1
  30. package/lib/commonjs/components/ListItem/index.js +129 -54
  31. package/lib/commonjs/components/ListItem/index.js.map +1 -1
  32. package/lib/commonjs/components/OtpInput/index.js +94 -28
  33. package/lib/commonjs/components/OtpInput/index.js.map +1 -1
  34. package/lib/commonjs/components/ProgressBar/index.js +8 -13
  35. package/lib/commonjs/components/ProgressBar/index.js.map +1 -1
  36. package/lib/commonjs/components/Radio/index.js +51 -53
  37. package/lib/commonjs/components/Radio/index.js.map +1 -1
  38. package/lib/commonjs/components/Select/index.js +112 -46
  39. package/lib/commonjs/components/Select/index.js.map +1 -1
  40. package/lib/commonjs/components/Select/styles.js +2 -2
  41. package/lib/commonjs/components/Select/styles.js.map +1 -1
  42. package/lib/commonjs/components/Switch/BaseSwitch.js +23 -13
  43. package/lib/commonjs/components/Switch/BaseSwitch.js.map +1 -1
  44. package/lib/commonjs/components/Switch/BaseSwitch.web.js +25 -21
  45. package/lib/commonjs/components/Switch/BaseSwitch.web.js.map +1 -1
  46. package/lib/commonjs/components/Switch/index.js +34 -3
  47. package/lib/commonjs/components/Switch/index.js.map +1 -1
  48. package/lib/commonjs/components/Tile/index.js +150 -77
  49. package/lib/commonjs/components/Tile/index.js.map +1 -1
  50. package/lib/commonjs/figma/Chip.figma.js +2 -2
  51. package/lib/commonjs/figma/Chip.figma.js.map +1 -1
  52. package/lib/commonjs/utils/positionToDataIcon.js +41 -0
  53. package/lib/commonjs/utils/positionToDataIcon.js.map +1 -0
  54. package/lib/module/components/AlertDialog/index.js +13 -11
  55. package/lib/module/components/AlertDialog/index.js.map +1 -1
  56. package/lib/module/components/Avatar/index.js +128 -28
  57. package/lib/module/components/Avatar/index.js.map +1 -1
  58. package/lib/module/components/Button/index.js +130 -32
  59. package/lib/module/components/Button/index.js.map +1 -1
  60. package/lib/module/components/Button/styles.js +8 -2
  61. package/lib/module/components/Button/styles.js.map +1 -1
  62. package/lib/module/components/CLAUDE.md +115 -11
  63. package/lib/module/components/Checkbox/index.js +72 -25
  64. package/lib/module/components/Checkbox/index.js.map +1 -1
  65. package/lib/module/components/Checkbox/styles.js +1 -1
  66. package/lib/module/components/Checkbox/styles.js.map +1 -1
  67. package/lib/module/components/Chip/index.js +47 -39
  68. package/lib/module/components/Chip/index.js.map +1 -1
  69. package/lib/module/components/Chip/styles.js +6 -35
  70. package/lib/module/components/Chip/styles.js.map +1 -1
  71. package/lib/module/components/Dialog/index.js +96 -76
  72. package/lib/module/components/Dialog/index.js.map +1 -1
  73. package/lib/module/components/Field/index.js +74 -31
  74. package/lib/module/components/Field/index.js.map +1 -1
  75. package/lib/module/components/Form/index.js +7 -14
  76. package/lib/module/components/Form/index.js.map +1 -1
  77. package/lib/module/components/IconButton/index.js +6 -34
  78. package/lib/module/components/IconButton/index.js.map +1 -1
  79. package/lib/module/components/Input/index.js +53 -23
  80. package/lib/module/components/Input/index.js.map +1 -1
  81. package/lib/module/components/Link/index.js +16 -8
  82. package/lib/module/components/Link/index.js.map +1 -1
  83. package/lib/module/components/ListItem/index.js +134 -59
  84. package/lib/module/components/ListItem/index.js.map +1 -1
  85. package/lib/module/components/OtpInput/index.js +94 -28
  86. package/lib/module/components/OtpInput/index.js.map +1 -1
  87. package/lib/module/components/ProgressBar/index.js +9 -14
  88. package/lib/module/components/ProgressBar/index.js.map +1 -1
  89. package/lib/module/components/Radio/index.js +54 -57
  90. package/lib/module/components/Radio/index.js.map +1 -1
  91. package/lib/module/components/Select/index.js +118 -52
  92. package/lib/module/components/Select/index.js.map +1 -1
  93. package/lib/module/components/Select/styles.js +2 -2
  94. package/lib/module/components/Select/styles.js.map +1 -1
  95. package/lib/module/components/Switch/BaseSwitch.js +24 -14
  96. package/lib/module/components/Switch/BaseSwitch.js.map +1 -1
  97. package/lib/module/components/Switch/BaseSwitch.web.js +26 -22
  98. package/lib/module/components/Switch/BaseSwitch.web.js.map +1 -1
  99. package/lib/module/components/Switch/index.js +35 -4
  100. package/lib/module/components/Switch/index.js.map +1 -1
  101. package/lib/module/components/Tile/index.js +155 -83
  102. package/lib/module/components/Tile/index.js.map +1 -1
  103. package/lib/module/figma/Chip.figma.js +2 -2
  104. package/lib/module/figma/Chip.figma.js.map +1 -1
  105. package/lib/module/utils/positionToDataIcon.js +38 -0
  106. package/lib/module/utils/positionToDataIcon.js.map +1 -0
  107. package/lib/typescript/components/AlertDialog/index.d.ts.map +1 -1
  108. package/lib/typescript/components/Avatar/index.d.ts +6 -2
  109. package/lib/typescript/components/Avatar/index.d.ts.map +1 -1
  110. package/lib/typescript/components/Button/index.d.ts +31 -8
  111. package/lib/typescript/components/Button/index.d.ts.map +1 -1
  112. package/lib/typescript/components/Button/styles.d.ts +2 -1
  113. package/lib/typescript/components/Button/styles.d.ts.map +1 -1
  114. package/lib/typescript/components/Checkbox/index.d.ts +3 -1
  115. package/lib/typescript/components/Checkbox/index.d.ts.map +1 -1
  116. package/lib/typescript/components/Chip/index.d.ts +19 -9
  117. package/lib/typescript/components/Chip/index.d.ts.map +1 -1
  118. package/lib/typescript/components/Chip/styles.d.ts +0 -1
  119. package/lib/typescript/components/Chip/styles.d.ts.map +1 -1
  120. package/lib/typescript/components/Dialog/index.d.ts +12 -6
  121. package/lib/typescript/components/Dialog/index.d.ts.map +1 -1
  122. package/lib/typescript/components/Dialog/styles.d.ts +1 -1
  123. package/lib/typescript/components/Field/index.d.ts +14 -7
  124. package/lib/typescript/components/Field/index.d.ts.map +1 -1
  125. package/lib/typescript/components/Form/index.d.ts +4 -4
  126. package/lib/typescript/components/Form/index.d.ts.map +1 -1
  127. package/lib/typescript/components/IconButton/index.d.ts.map +1 -1
  128. package/lib/typescript/components/Input/index.d.ts +11 -3
  129. package/lib/typescript/components/Input/index.d.ts.map +1 -1
  130. package/lib/typescript/components/Link/index.d.ts +2 -0
  131. package/lib/typescript/components/Link/index.d.ts.map +1 -1
  132. package/lib/typescript/components/ListItem/index.d.ts +28 -6
  133. package/lib/typescript/components/ListItem/index.d.ts.map +1 -1
  134. package/lib/typescript/components/OtpInput/index.d.ts +1 -1
  135. package/lib/typescript/components/OtpInput/index.d.ts.map +1 -1
  136. package/lib/typescript/components/ProgressBar/index.d.ts +4 -4
  137. package/lib/typescript/components/ProgressBar/index.d.ts.map +1 -1
  138. package/lib/typescript/components/Radio/index.d.ts +4 -0
  139. package/lib/typescript/components/Radio/index.d.ts.map +1 -1
  140. package/lib/typescript/components/Select/index.d.ts +35 -2
  141. package/lib/typescript/components/Select/index.d.ts.map +1 -1
  142. package/lib/typescript/components/Select/styles.d.ts.map +1 -1
  143. package/lib/typescript/components/Switch/BaseSwitch.d.ts +12 -5
  144. package/lib/typescript/components/Switch/BaseSwitch.d.ts.map +1 -1
  145. package/lib/typescript/components/Switch/BaseSwitch.web.d.ts +11 -5
  146. package/lib/typescript/components/Switch/BaseSwitch.web.d.ts.map +1 -1
  147. package/lib/typescript/components/Switch/index.d.ts +5 -1
  148. package/lib/typescript/components/Switch/index.d.ts.map +1 -1
  149. package/lib/typescript/components/Tile/index.d.ts +8 -2
  150. package/lib/typescript/components/Tile/index.d.ts.map +1 -1
  151. package/lib/typescript/utils/positionToDataIcon.d.ts +29 -0
  152. package/lib/typescript/utils/positionToDataIcon.d.ts.map +1 -0
  153. package/package.json +5 -5
  154. package/src/components/AlertDialog/index.tsx +13 -14
  155. package/src/components/Avatar/index.tsx +134 -44
  156. package/src/components/Button/index.tsx +216 -44
  157. package/src/components/Button/styles.ts +50 -38
  158. package/src/components/CLAUDE.md +115 -11
  159. package/src/components/Checkbox/index.tsx +93 -32
  160. package/src/components/Checkbox/styles.ts +1 -1
  161. package/src/components/Chip/index.tsx +88 -61
  162. package/src/components/Chip/styles.ts +6 -18
  163. package/src/components/Dialog/index.tsx +139 -99
  164. package/src/components/Field/index.tsx +113 -49
  165. package/src/components/Form/index.tsx +18 -14
  166. package/src/components/IconButton/index.tsx +7 -31
  167. package/src/components/Input/index.tsx +75 -32
  168. package/src/components/Link/index.tsx +38 -12
  169. package/src/components/ListItem/index.tsx +158 -73
  170. package/src/components/OtpInput/index.tsx +126 -43
  171. package/src/components/ProgressBar/index.tsx +11 -16
  172. package/src/components/Radio/index.tsx +76 -54
  173. package/src/components/Select/index.tsx +174 -59
  174. package/src/components/Select/styles.ts +1 -2
  175. package/src/components/Switch/BaseSwitch.tsx +38 -16
  176. package/src/components/Switch/BaseSwitch.web.tsx +28 -35
  177. package/src/components/Switch/index.tsx +51 -4
  178. package/src/components/Tile/index.tsx +145 -94
  179. package/src/utils/positionToDataIcon.ts +34 -0
  180. package/lib/commonjs/components/Field/FieldLabel.js +0 -33
  181. package/lib/commonjs/components/Field/FieldLabel.js.map +0 -1
  182. package/lib/commonjs/components/Field/FieldLabel.web.js +0 -22
  183. package/lib/commonjs/components/Field/FieldLabel.web.js.map +0 -1
  184. package/lib/commonjs/components/Form/FormRoot.js +0 -25
  185. package/lib/commonjs/components/Form/FormRoot.js.map +0 -1
  186. package/lib/commonjs/components/Form/FormRoot.web.js +0 -17
  187. package/lib/commonjs/components/Form/FormRoot.web.js.map +0 -1
  188. package/lib/commonjs/components/Input/BaseInput.android.js +0 -20
  189. package/lib/commonjs/components/Input/BaseInput.android.js.map +0 -1
  190. package/lib/commonjs/components/Input/BaseInput.js +0 -13
  191. package/lib/commonjs/components/Input/BaseInput.js.map +0 -1
  192. package/lib/commonjs/components/Input/BaseInput.web.js +0 -50
  193. package/lib/commonjs/components/Input/BaseInput.web.js.map +0 -1
  194. package/lib/commonjs/components/Select/SelectTriggerHost.js +0 -10
  195. package/lib/commonjs/components/Select/SelectTriggerHost.js.map +0 -1
  196. package/lib/commonjs/components/Select/SelectTriggerHost.web.js +0 -102
  197. package/lib/commonjs/components/Select/SelectTriggerHost.web.js.map +0 -1
  198. package/lib/module/components/Field/FieldLabel.js +0 -29
  199. package/lib/module/components/Field/FieldLabel.js.map +0 -1
  200. package/lib/module/components/Field/FieldLabel.web.js +0 -17
  201. package/lib/module/components/Field/FieldLabel.web.js.map +0 -1
  202. package/lib/module/components/Form/FormRoot.js +0 -21
  203. package/lib/module/components/Form/FormRoot.js.map +0 -1
  204. package/lib/module/components/Form/FormRoot.web.js +0 -12
  205. package/lib/module/components/Form/FormRoot.web.js.map +0 -1
  206. package/lib/module/components/Input/BaseInput.android.js +0 -16
  207. package/lib/module/components/Input/BaseInput.android.js.map +0 -1
  208. package/lib/module/components/Input/BaseInput.js +0 -4
  209. package/lib/module/components/Input/BaseInput.js.map +0 -1
  210. package/lib/module/components/Input/BaseInput.web.js +0 -45
  211. package/lib/module/components/Input/BaseInput.web.js.map +0 -1
  212. package/lib/module/components/Select/SelectTriggerHost.js +0 -7
  213. package/lib/module/components/Select/SelectTriggerHost.js.map +0 -1
  214. package/lib/module/components/Select/SelectTriggerHost.web.js +0 -97
  215. package/lib/module/components/Select/SelectTriggerHost.web.js.map +0 -1
  216. package/lib/typescript/components/Field/FieldLabel.d.ts +0 -18
  217. package/lib/typescript/components/Field/FieldLabel.d.ts.map +0 -1
  218. package/lib/typescript/components/Field/FieldLabel.web.d.ts +0 -16
  219. package/lib/typescript/components/Field/FieldLabel.web.d.ts.map +0 -1
  220. package/lib/typescript/components/Form/FormRoot.d.ts +0 -14
  221. package/lib/typescript/components/Form/FormRoot.d.ts.map +0 -1
  222. package/lib/typescript/components/Form/FormRoot.web.d.ts +0 -10
  223. package/lib/typescript/components/Form/FormRoot.web.d.ts.map +0 -1
  224. package/lib/typescript/components/Input/BaseInput.android.d.ts +0 -3
  225. package/lib/typescript/components/Input/BaseInput.android.d.ts.map +0 -1
  226. package/lib/typescript/components/Input/BaseInput.d.ts +0 -2
  227. package/lib/typescript/components/Input/BaseInput.d.ts.map +0 -1
  228. package/lib/typescript/components/Input/BaseInput.web.d.ts +0 -3
  229. package/lib/typescript/components/Input/BaseInput.web.d.ts.map +0 -1
  230. package/lib/typescript/components/Select/SelectTriggerHost.d.ts +0 -3
  231. package/lib/typescript/components/Select/SelectTriggerHost.d.ts.map +0 -1
  232. package/lib/typescript/components/Select/SelectTriggerHost.web.d.ts +0 -16
  233. package/lib/typescript/components/Select/SelectTriggerHost.web.d.ts.map +0 -1
  234. package/src/components/Field/FieldLabel.tsx +0 -33
  235. package/src/components/Field/FieldLabel.web.tsx +0 -25
  236. package/src/components/Form/FormRoot.tsx +0 -20
  237. package/src/components/Form/FormRoot.web.tsx +0 -12
  238. package/src/components/Input/BaseInput.android.tsx +0 -13
  239. package/src/components/Input/BaseInput.tsx +0 -1
  240. package/src/components/Input/BaseInput.web.tsx +0 -41
  241. package/src/components/Select/SelectTriggerHost.tsx +0 -4
  242. package/src/components/Select/SelectTriggerHost.web.tsx +0 -143
@@ -6,7 +6,7 @@ import { DISABLED_CURSOR, TRANSITION_COLORS } from '../../styles/primitives';
6
6
 
7
7
  // ── Trigger ─────────────────────────────────────────────────
8
8
 
9
- export const selectTriggerVariants = cva(['flex w-full min-w-0 flex-row items-center justify-between text-start', 'bg-surface-primary', 'border border-stroke-primary', 'rounded-[var(--border-radius-default)]', TRANSITION_COLORS, 'data-[disabled=true]:bg-surface-secondary', 'data-[disabled=true]:opacity-[var(--opacity-disabled)]', DISABLED_CURSOR, 'data-[readonly=true]:cursor-default', 'data-[readonly=true]:bg-surface-secondary', 'web:data-[hover=true]:data-[focus=false]:data-[invalid=false]:border-stroke-hover', 'data-[focus=true]:border-[length:var(--border-width-focused)]', 'data-[focus=true]:data-[invalid=false]:border-stroke-action', 'data-[focus=true]:data-[invalid=true]:border-stroke-danger', 'data-[state=open]:border-[length:var(--border-width-focused)]', 'data-[state=open]:data-[invalid=false]:border-stroke-action', 'data-[state=open]:data-[invalid=true]:border-stroke-danger', 'data-[invalid=true]:border-stroke-danger'], {
9
+ export const selectTriggerVariants = cva(['flex w-full min-w-0 flex-row items-center justify-between text-start', 'bg-surface-primary', 'border border-stroke-primary', 'rounded-[var(--border-radius-default)]', TRANSITION_COLORS, 'data-[disabled=true]:bg-surface-secondary', 'data-[disabled=true]:opacity-[var(--opacity-disabled)]', DISABLED_CURSOR, 'data-[readonly=true]:cursor-default', 'data-[readonly=true]:bg-surface-secondary', 'web:hover:data-[focus=false]:data-[invalid=false]:border-stroke-hover', 'data-[focus=true]:border-[length:var(--border-width-focused)]', 'data-[focus=true]:data-[invalid=false]:border-stroke-action', 'data-[focus=true]:data-[invalid=true]:border-stroke-danger', 'data-[state=open]:border-[length:var(--border-width-focused)]', 'data-[state=open]:data-[invalid=false]:border-stroke-action', 'data-[state=open]:data-[invalid=true]:border-stroke-danger', 'data-[invalid=true]:border-stroke-danger'], {
10
10
  variants: {
11
11
  variant: {
12
12
  outline: []
@@ -38,7 +38,7 @@ export const selectValueVariants = cva(['min-w-0 flex-1 text-start', 'text-conte
38
38
 
39
39
  // ── Icon ────────────────────────────────────────────────────
40
40
 
41
- export const selectIconVariants = cva(['shrink-0 items-center justify-center self-center', 'text-content-tertiary', 'data-[invalid=true]:text-content-danger', 'data-[state=open]:rotate-180'], {
41
+ export const selectIconVariants = cva(['shrink-0 items-center justify-center self-center', 'text-content-tertiary', 'data-[invalid=true]:text-content-danger'], {
42
42
  variants: {
43
43
  size: {
44
44
  default: 'size-5',
@@ -1 +1 @@
1
- {"version":3,"names":["Platform","cva","DISABLED_CURSOR","TRANSITION_COLORS","selectTriggerVariants","variants","variant","outline","size","default","small","defaultVariants","selectValueVariants","selectIconVariants","selectContentVariants","select","web","selectItemVariants","selectItemLabelVariants"],"sourceRoot":"../../../../src","sources":["components/Select/styles.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,GAAG,QAA2B,0BAA0B;AACjE,SAASC,eAAe,EAAEC,iBAAiB,QAAQ,yBAAyB;;AAE5E;;AAEA,OAAO,MAAMC,qBAAqB,GAAGH,GAAG,CACtC,CACE,sEAAsE,EACtE,oBAAoB,EACpB,8BAA8B,EAC9B,wCAAwC,EACxCE,iBAAiB,EACjB,2CAA2C,EAC3C,wDAAwD,EACxDD,eAAe,EACf,qCAAqC,EACrC,2CAA2C,EAC3C,mFAAmF,EACnF,+DAA+D,EAC/D,6DAA6D,EAC7D,4DAA4D,EAC5D,+DAA+D,EAC/D,6DAA6D,EAC7D,4DAA4D,EAC5D,0CAA0C,CAC3C,EACD;EACEG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B,gCAAgC,EAChC,0EAA0E,EAC1E,8EAA8E,EAC9ED,QAAQ,CAACe,MAAM,CAAC;EACdN,OAAO,EAAE,kDAAkD;EAC3DO,GAAG,EAAE;AACP,CAAC,CAAC,CACH,EACD;EACEX,QAAQ,EAAE;IACRG,IAAI,EAAE;MACJC,OAAO,EAAE,WAAW;MACpBC,KAAK,EAAE;IACT;EACF,CAAC;EACDC,eAAe,EAAE;IACfH,IAAI,EAAE;EACR;AACF,CACF,CAAC;;AAED;;AAEA,OAAO,MAAMU,uBAAuB,GAAGjB,GAAG,CACxC,CAAC,sBAAsB,EAAE,kCAAkC,CAAC,EAC5D;EACEI,QAAQ,EAAE;IACRG,IAAI,EAAE;MACJC,OAAO,EAAE,iBAAiB;MAC1BC,KAAK,EAAE;IACT;EACF,CAAC;EACDC,eAAe,EAAE;IACfH,IAAI,EAAE;EACR;AACF,CACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Platform","cva","DISABLED_CURSOR","TRANSITION_COLORS","selectTriggerVariants","variants","variant","outline","size","default","small","defaultVariants","selectValueVariants","selectIconVariants","selectContentVariants","select","web","selectItemVariants","selectItemLabelVariants"],"sourceRoot":"../../../../src","sources":["components/Select/styles.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,GAAG,QAA2B,0BAA0B;AACjE,SAASC,eAAe,EAAEC,iBAAiB,QAAQ,yBAAyB;;AAE5E;;AAEA,OAAO,MAAMC,qBAAqB,GAAGH,GAAG,CACtC,CACE,sEAAsE,EACtE,oBAAoB,EACpB,8BAA8B,EAC9B,wCAAwC,EACxCE,iBAAiB,EACjB,2CAA2C,EAC3C,wDAAwD,EACxDD,eAAe,EACf,qCAAqC,EACrC,2CAA2C,EAC3C,uEAAuE,EACvE,+DAA+D,EAC/D,6DAA6D,EAC7D,4DAA4D,EAC5D,+DAA+D,EAC/D,6DAA6D,EAC7D,4DAA4D,EAC5D,0CAA0C,CAC3C,EACD;EACEG,QAAQ,EAA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AC1E,8EAA8E,EAC9ED,QAAQ,CAACe,MAAM,CAAC;EACdN,OAAO,EAAE,kDAAkD;EAC3DO,GAAG,EAAE;AACP,CAAC,CAAC,CACH,EACD;EACEX,QAAQ,EAAE;IACRG,IAAI,EAAE;MACJC,OAAO,EAAE,WAAW;MACpBC,KAAK,EAAE;IACT;EACF,CAAC;EACDC,eAAe,EAAE;IACfH,IAAI,EAAE;EACR;AACF,CACF,CAAC;;AAED;;AAEA,OAAO,MAAMU,uBAAuB,GAAGjB,GAAG,CACxC,CAAC,sBAAsB,EAAE,kCAAkC,CAAC,EAC5D;EACEI,QAAQ,EAAE;IACRG,IAAI,EAAE;MACJC,OAAO,EAAE,iBAAiB;MAC1BC,KAAK,EAAE;IACT;EACF,CAAC;EACDC,eAAe,EAAE;IACfH,IAAI,EAAE;EACR;AACF,CACF,CAAC","ignoreList":[]}
@@ -2,40 +2,50 @@
2
2
 
3
3
  import { forwardRef } from 'react';
4
4
  import { Switch as RNSwitch } from 'react-native';
5
- import { cn } from '@cdx-ui/utils';
5
+ import { mergeDataAttributes } from '@cdx-ui/primitives';
6
+ import { cn, composeEventHandlers } from '@cdx-ui/utils';
6
7
  import { switchIosBgVariants, switchThumbColorVariants, switchTrackOffVariants, switchTrackOnVariants } from './styles';
7
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
+ /**
10
+ * Native host for `Switch`. Renders `RNSwitch` with Uniwind className passthrough
11
+ * derived from the resolved interaction state in `switchState`.
12
+ *
13
+ * All state/a11y/interaction machinery lives in the `useSwitch` hook; this file
14
+ * is pure rendering (Standard 3: primitives must not carry styling machinery).
15
+ */
8
16
  export const BaseSwitch = /*#__PURE__*/forwardRef(({
9
- states,
17
+ switchState,
10
18
  className,
11
- disabled,
12
- value,
19
+ size: _size,
20
+ onFocus,
21
+ onBlur,
13
22
  ...props
14
23
  }, ref) => {
15
- const isChecked = value ?? states?.checked ?? false;
16
- const isDisabled = disabled ?? states?.disabled ?? false;
17
- const isInvalid = states?.invalid ?? false;
18
24
  const uniwindProps = {
19
25
  className,
20
26
  thumbColorClassName: cn(switchThumbColorVariants({
21
- isDisabled
27
+ isDisabled: switchState.isDisabled
22
28
  })),
23
29
  trackColorOnClassName: cn(switchTrackOnVariants({
24
- isInvalid
30
+ isInvalid: switchState.isInvalid
25
31
  })),
26
32
  trackColorOffClassName: cn(switchTrackOffVariants({
27
- isInvalid
33
+ isInvalid: switchState.isInvalid
28
34
  })),
29
35
  ios_backgroundColorClassName: cn(switchIosBgVariants({
30
- isInvalid
36
+ isInvalid: switchState.isInvalid
31
37
  }))
32
38
  };
33
39
  return /*#__PURE__*/_jsx(RNSwitch, {
34
40
  ref: ref,
35
- value: isChecked,
36
- disabled: isDisabled,
41
+ value: switchState.checked,
42
+ disabled: switchState.isDisabled,
43
+ onValueChange: switchState.setChecked,
44
+ onFocus: composeEventHandlers(onFocus, switchState.focusProps.onFocus),
45
+ onBlur: composeEventHandlers(onBlur, switchState.focusProps.onBlur),
37
46
  ...uniwindProps,
38
- ...props
47
+ ...props,
48
+ ...mergeDataAttributes(props, switchState.dataAttrs)
39
49
  });
40
50
  });
41
51
  BaseSwitch.displayName = 'BaseSwitch';
@@ -1 +1 @@
1
- {"version":3,"names":["forwardRef","Switch","RNSwitch","cn","switchIosBgVariants","switchThumbColorVariants","switchTrackOffVariants","switchTrackOnVariants","jsx","_jsx","BaseSwitch","states","className","disabled","value","props","ref","isChecked","checked","isDisabled","isInvalid","invalid","uniwindProps","thumbColorClassName","trackColorOnClassName","trackColorOffClassName","ios_backgroundColorClassName","displayName"],"sourceRoot":"../../../../src","sources":["components/Switch/BaseSwitch.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,MAAM,IAAIC,QAAQ,QAA0B,cAAc;AACnE,SAASC,EAAE,QAAQ,eAAe;AAClC,SACEC,mBAAmB,EACnBC,wBAAwB,EACxBC,sBAAsB,EACtBC,qBAAqB,QAChB,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AASlB,OAAO,MAAMC,UAAU,gBAAGV,UAAU,CAClC,CAAC;EAAEW,MAAM;EAAEC,SAAS;EAAEC,QAAQ;EAAEC,KAAK;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,KAAK;EACzD,MAAMC,SAAS,GAAGH,KAAK,IAAIH,MAAM,EAAEO,OAAO,IAAI,KAAK;EACnD,MAAMC,UAAU,GAAGN,QAAQ,IAAIF,MAAM,EAAEE,QAAQ,IAAI,KAAK;EACxD,MAAMO,SAAS,GAAGT,MAAM,EAAEU,OAAO,IAAI,KAAK;EAE1C,MAAMC,YAAgD,GAAG;IACvDV,SAAS;IACTW,mBAAmB,EAAEpB,EAAE,CAACE,wBAAwB,CAAC;MAAEc;IAAW,CAAC,CAAC,CAAC;IACjEK,qBAAqB,EAAErB,EAAE,CAACI,qBAAqB,CAAC;MAAEa;IAAU,CAAC,CAAC,CAAC;IAC/DK,sBAAsB,EAAEtB,EAAE,CAACG,sBAAsB,CAAC;MAAEc;IAAU,CAAC,CAAC,CAAC;IACjEM,4BAA4B,EAAEvB,EAAE,CAACC,mBAAmB,CAAC;MAAEgB;IAAU,CAAC,CAAC;EACrE,CAAC;EAED,oBACEX,IAAA,CAACP,QAAQ;IAACc,GAAG,EAAEA,GAAI;IAACF,KAAK,EAAEG,SAAU;IAACJ,QAAQ,EAAEM,UAAW;IAAA,GAAKG,YAAY;IAAA,GAAMP;EAAK,CAAG,CAAC;AAE/F,CACF,CAAC;AAEDL,UAAU,CAACiB,WAAW,GAAG,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["forwardRef","Switch","RNSwitch","mergeDataAttributes","cn","composeEventHandlers","switchIosBgVariants","switchThumbColorVariants","switchTrackOffVariants","switchTrackOnVariants","jsx","_jsx","BaseSwitch","switchState","className","size","_size","onFocus","onBlur","props","ref","uniwindProps","thumbColorClassName","isDisabled","trackColorOnClassName","isInvalid","trackColorOffClassName","ios_backgroundColorClassName","value","checked","disabled","onValueChange","setChecked","focusProps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O,EAAEZ,oBAAoB,CAACY,OAAO,EAAEJ,WAAW,CAACoB,UAAU,CAAChB,OAAO,CAAE;IACvEC,MAAM,EAAEb,oBAAoB,CAACa,MAAM,EAAEL,WAAW,CAACoB,UAAU,CAACf,MAAM,CAAE;IAAA,GAChEG,YAAY;IAAA,GACZF,KAAK;IAAA,GACLhB,mBAAmB,CAACgB,KAAK,EAAEN,WAAW,CAACqB,SAAS;EAAC,CACtD,CAAC;AAEN,CACF,CAAC;AAEDtB,UAAU,CAACuB,WAAW,GAAG,YAAY","ignoreList":[]}
@@ -2,48 +2,52 @@
2
2
 
3
3
  import { forwardRef } from 'react';
4
4
  import { Pressable, View } from 'react-native';
5
- import { cn } from '@cdx-ui/utils';
5
+ import { mergeDataAttributes } from '@cdx-ui/primitives';
6
+ import { cn, composeEventHandlers } from '@cdx-ui/utils';
6
7
  import { switchThumbVariants, switchTrackVariants, switchWebTrackColorVariants } from './styles';
7
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
+ /**
10
+ * Web host for `Switch`. Renders a custom `Pressable` + `View` toggle (preserving
11
+ * the existing visual contract) wired to the resolved state in `switchState`.
12
+ *
13
+ * `role="switch"` + `aria-checked` + keyboard semantics satisfy the same a11y
14
+ * contract that an `<input type="checkbox" role="switch">` would provide, without
15
+ * the visual rework an input swap would require (see spike notes in PR).
16
+ */
8
17
  export const BaseSwitch = /*#__PURE__*/forwardRef(({
9
- value,
10
- onValueChange,
11
- disabled,
12
- states,
13
- dataSet,
18
+ switchState,
14
19
  className,
15
20
  size = 'md',
21
+ accessibilityLabel,
16
22
  onFocus,
17
23
  onBlur,
18
24
  ...props
19
25
  }, ref) => {
20
- const isChecked = value ?? states?.checked ?? false;
21
- const isDisabled = disabled ?? states?.disabled ?? false;
22
- const isInvalid = states?.invalid ?? false;
23
26
  return /*#__PURE__*/_jsx(Pressable, {
24
27
  ref: ref,
25
28
  role: "switch",
26
- "aria-checked": isChecked,
27
- "aria-disabled": isDisabled,
28
- disabled: isDisabled,
29
- onPress: () => onValueChange?.(!isChecked),
30
- onFocus: onFocus,
31
- onBlur: onBlur,
29
+ "aria-checked": switchState.checked,
30
+ "aria-disabled": switchState.isDisabled,
31
+ accessibilityLabel: accessibilityLabel,
32
+ disabled: switchState.isDisabled,
33
+ onPress: () => switchState.setChecked(!switchState.checked),
34
+ onFocus: composeEventHandlers(onFocus, switchState.focusProps.onFocus),
35
+ onBlur: composeEventHandlers(onBlur, switchState.focusProps.onBlur),
36
+ onHoverIn: switchState.hoverProps.onHoverIn,
37
+ onHoverOut: switchState.hoverProps.onHoverOut,
32
38
  tabIndex: 0,
33
39
  className: cn(switchTrackVariants({
34
40
  size
35
41
  }), switchWebTrackColorVariants({
36
- isChecked,
37
- isInvalid
38
- }), className)
39
- // @ts-expect-error dataSet is a RNW/Uniwind prop not in Pressable types
40
- ,
41
- dataSet: dataSet,
42
+ isChecked: switchState.checked,
43
+ isInvalid: switchState.isInvalid
44
+ }), className),
42
45
  ...props,
46
+ ...mergeDataAttributes(props, switchState.dataAttrs),
43
47
  children: /*#__PURE__*/_jsx(View, {
44
48
  className: cn(switchThumbVariants({
45
49
  size,
46
- isChecked
50
+ isChecked: switchState.checked
47
51
  }))
48
52
  })
49
53
  });
@@ -1 +1 @@
1
- {"version":3,"names":["forwardRef","Pressable","View","cn","switchThumbVariants","switchTrackVariants","switchWebTrackColorVariants","jsx","_jsx","BaseSwitch","value","onValueChange","disabled","states","dataSet","className","size","onFocus","onBlur","props","ref","isChecked","checked","isDisabled","isInvalid","invalid","role","onPress","tabIndex","children","displayName"],"sourceRoot":"../../../../src","sources":["components/Switch/BaseSwitch.web.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,SAAS,EAAEC,IAAI,QAAQ,cAAc;AAC9C,SAASC,EAAE,QAAQ,eAAe;AAClC,SACEC,mBAAmB,EACnBC,mBAAmB,EACnBC,2BAA2B,QAEtB,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAclB,OAAO,MAAMC,UAAU,gBAAGT,UAAU,CAClC,CACE;EACEU,KAAK;EACLC,aAAa;EACbC,QAAQ;EACRC,MAAM;EACNC,OAAO;EACPC,SAAS;EACTC,IAAI,GAAG,IAAI;EACXC,OAAO;EACPC,MAAM;EACN,GAAGC;AACL,CAAC,EACDC,GAAG,KACA;EACH,MAAMC,SAAS,GAAGX,KAAK,IAAIG,MAAM,EAAES,OAAO,IAAI,KAAK;EACnD,MAAMC,UAAU,GAAGX,QAAQ,IAAIC,MAAM,EAAED,QAAQ,IAAI,KAAK;EACxD,MAAMY,SAAS,GAAGX,MAAM,EAAEY,OAAO,IAAI,KAAK;EAE1C,oBACEjB,IAAA,CAACP,SAAS;IACRmB,GAAG,EAAEA,GAAI;IACTM,IAAI,EAAC,QAAQ;IACb,gBAAcL,SAAU;IACxB,iBAAeE,UAAW;IAC1BX,QAAQ,EAAEW,UAAW;IACrBI,OAAO,EAAEA,CAAA,KAAMhB,aAAa,GAAG,CAACU,SAAS,CAAE;IAC3CJ,OAAO,EAAEA,OAAQ;IACjBC,MAAM,EAAEA,MAAO;IACfU,QAAQ,EAAE,CAAE;IACZb,SAAS,EAAEZ,EAAE,CACXE,mBAAmB,CAAC;MAAEW;IAAK,CAAC,CAAC,EAC7BV,2BAA2B,CAAC;MAAEe,SAAS;MAAEG;IAAU,CAAC,CAAC,EACrDT,SACF;IACA;IAAA;IACAD,OAAO,EAAEA,OAAQ;IAAA,GACbK,KAAK;IAAAU,QAAA,eAETrB,IAAA,CAACN,IAAI;MAACa,SAAS,EAAEZ,EAAE,CAACC,mBAAmB,CAAC;QAAEY,IAAI;QAAEK;MAAU,CAAC,CAAC;IAAE,CAAE;EAAC,CACxD,CAAC;AAEhB,CACF,CAAC;AAEDZ,UAAU,CAACqB,WAAW,GAAG,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["forwardRef","Pressable","View","mergeDataAttributes","cn","composeEventHandlers","switchThumbVariants","switchTrackVariants","switchWebTrackColorVariants","jsx","_jsx","BaseSwitch","switchState","className","size","accessibilityLabel","onFocus","onBlur","props","ref","role","checked","isDisabled","disabled","onPress","setChecked","focusProps","onHoverIn","hoverProps","onHoverOut","tabIndex","isChecked","isInvalid","dataAttrs","children","displayName"],"sourceRoot":"../../../../src","sources":["components/Switch/BaseSwitch.web.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,SAAS,EAAEC,IAAI,QAAQ,cAAc;AAC9C,SAASC,mBAAmB,QAA+B,oBAAoB;AAC/E,SAASC,EAAE,EAAEC,oBAAoB,QAAQ,eAAe;AACxD,SACEC,mBAAmB,EACnBC,mBAAmB,EACnBC,2BAA2B,QAEtB,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAWlB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,UAAU,gBAAGX,UAAU,CAClC,CAAC;EAAEY,WAAW;EAAEC,SAAS;EAAEC,IAAI,GAAG,IAAI;EAAEC,kBAAkB;EAAEC,OAAO;EAAEC,MAAM;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,KAAK;EAC/F,oBACET,IAAA,CAACT,SAAS;IACRkB,GAAG,EAAEA,GAAI;IACTC,IAAI,EAAC,QAAQ;IACb,gBAAcR,WAAW,CAACS,OAAQ;IAClC,iBAAeT,WAAW,CAACU,UAAW;IACtCP,kBAAkB,EAAEA,kBAAmB;IACvCQ,QAAQ,EAAEX,WAAW,CAACU,UAAW;IACjCE,OAAO,EAAEA,CAAA,KAAMZ,WAAW,CAACa,UAAU,CAAC,CAACb,WAAW,CAACS,OAAO,CAAE;IAC5DL,OAAO,EAAEX,oBAAoB,CAACW,OAAO,EAAEJ,WAAW,CAACc,UAAU,CAACV,OAAqB,CAAE;IACrFC,MAAM,EAAEZ,oBAAoB,CAACY,MAAM,EAAEL,WAAW,CAACc,UAAU,CAACT,MAAoB,CAAE;IAClFU,SAAS,EAAEf,WAAW,CAACgB,UAAU,CAACD,SAAwB;IAC1DE,UAAU,EAAEjB,WAAW,CAACgB,UAAU,CAACC,UAAyB;IAC5DC,QAAQ,EAAE,CAAE;IACZjB,SAAS,EAAET,EAAE,CACXG,mBAAmB,CAAC;MAAEO;IAAK,CAAC,CAAC,EAC7BN,2BAA2B,CAAC;MAC1BuB,SAAS,EAAEnB,WAAW,CAACS,OAAO;MAC9BW,SAAS,EAAEpB,WAAW,CAACoB;IACzB,CAAC,CAAC,EACFnB,SACF,CAAE;IAAA,GACEK,KAAK;IAAA,GACLf,mBAAmB,CAACe,KAAK,EAAEN,WAAW,CAACqB,SAAS,CAAC;IAAAC,QAAA,eAErDxB,IAAA,CAACR,IAAI;MAACW,SAAS,EAAET,EAAE,CAACE,mBAAmB,CAAC;QAAEQ,IAAI;QAAEiB,SAAS,EAAEnB,WAAW,CAACS;MAAQ,CAAC,CAAC;IAAE,CAAE;EAAC,CAC7E,CAAC;AAEhB,CACF,CAAC;AAEDV,UAAU,CAACwB,WAAW,GAAG,YAAY","ignoreList":[]}
@@ -1,9 +1,40 @@
1
1
  "use strict";
2
2
 
3
- import { createSwitch } from '@cdx-ui/primitives';
3
+ import { forwardRef } from 'react';
4
+ import { dataAttributes, mergeDataAttributes, useSwitch } from '@cdx-ui/primitives';
4
5
  import { BaseSwitch } from './BaseSwitch';
5
- const SwitchPrimitive = createSwitch({
6
- Root: BaseSwitch
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ export const Switch = /*#__PURE__*/forwardRef(({
8
+ className,
9
+ size,
10
+ value,
11
+ isChecked,
12
+ defaultValue,
13
+ disabled,
14
+ isDisabled,
15
+ isInvalid,
16
+ onValueChange,
17
+ ...props
18
+ }, ref) => {
19
+ const switchState = useSwitch({
20
+ value,
21
+ isChecked,
22
+ defaultValue,
23
+ disabled,
24
+ isDisabled,
25
+ isInvalid,
26
+ onValueChange
27
+ });
28
+ return /*#__PURE__*/_jsx(BaseSwitch, {
29
+ ref: ref,
30
+ switchState: switchState,
31
+ className: className,
32
+ size: size,
33
+ ...props,
34
+ ...mergeDataAttributes(props, dataAttributes({
35
+ slot: 'switch'
36
+ }))
37
+ });
7
38
  });
8
- export const Switch = SwitchPrimitive;
39
+ Switch.displayName = 'Switch';
9
40
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createSwitch","BaseSwitch","SwitchPrimitive","Root","Switch"],"sourceRoot":"../../../../src","sources":["components/Switch/index.tsx"],"mappings":";;AAAA,SAA4BA,YAAY,QAAQ,oBAAoB;AACpE,SAASC,UAAU,QAAQ,cAAc;AAGzC,MAAMC,eAAe,GAAGF,YAAY,CAAC;EAAEG,IAAI,EAAEF;AAAW,CAAC,CAAC;AAM1D,OAAO,MAAMG,MAAM,GAAGF,eAAe","ignoreList":[]}
1
+ {"version":3,"names":["forwardRef","dataAttributes","mergeDataAttributes","useSwitch","BaseSwitch","jsx","_jsx","Switch","className","size","value","isChecked","defaultValue","disabled","isDisabled","isInvalid","onValueChange","props","ref","switchState","slot","displayName"],"sourceRoot":"../../../../src","sources":["components/Switch/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,OAAO;AAElC,SACEC,cAAc,EACdC,mBAAmB,EACnBC,SAAS,QAEJ,oBAAoB;AAC3B,SAASC,UAAU,QAAQ,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAU1C,OAAO,MAAMC,MAAM,gBAAGP,UAAU,CAC9B,CACE;EACEQ,SAAS;EACTC,IAAI;EACJC,KAAK;EACLC,SAAS;EACTC,YAAY;EACZC,QAAQ;EACRC,UAAU;EACVC,SAAS;EACTC,aAAa;EACb,GAAGC;AACL,CAAC,EACDC,GAAG,KACA;EACH,MAAMC,WAAW,GAAGhB,SAAS,CAAC;IAC5BO,KAAK;IACLC,SAAS;IACTC,YAAY;IACZC,QAAQ;IACRC,UAAU;IACVC,SAAS;IACTC;EACF,CAAC,CAAC;EAEF,oBACEV,IAAA,CAACF,UAAU;IACTc,GAAG,EAAEA,GAAa;IAClBC,WAAW,EAAEA,WAAY;IACzBX,SAAS,EAAEA,SAAU;IACrBC,IAAI,EAAEA,IAAK;IAAA,GACPQ,KAAK;IAAA,GACLf,mBAAmB,CAACe,KAAK,EAAEhB,cAAc,CAAC;MAAEmB,IAAI,EAAE;IAAS,CAAC,CAAC;EAAC,CACnE,CAAC;AAEN,CACF,CAAC;AAEDb,MAAM,CAACc,WAAW,GAAG,QAAQ","ignoreList":[]}
@@ -1,20 +1,17 @@
1
1
  "use strict";
2
2
 
3
- import { forwardRef } from 'react';
4
- import { Pressable, Text, View } from 'react-native';
5
- import { createTile, useTileContext } from '@cdx-ui/primitives';
3
+ import { forwardRef, useMemo } from 'react';
4
+ import { Text, View } from 'react-native';
5
+ import { Slot, TileGroup as TileGroupPrimitive, TileRoot as TileRootPrimitive, dataAttributes, mergeDataAttributes, useTileContext } from '@cdx-ui/primitives';
6
6
  import { Check } from '@cdx-ui/icons';
7
- import { dataAttributes } from '@cdx-ui/primitives';
8
- import { cn, useStyleContext, withStyleContext } from '@cdx-ui/utils';
9
- import { checkboxIndicatorVariants, checkboxIconVariants } from '../Checkbox/styles';
7
+ import { cn, ParentContext, useParentContext, useStyleContext } from '@cdx-ui/utils';
8
+ import { checkboxIconVariants, checkboxIndicatorVariants } from '../Checkbox/styles';
10
9
  import { Icon } from '../Icon';
11
10
  import { radioIndicatorVariants, radioInnerDotVariants } from '../Radio/styles';
12
11
  import { tileContentVariants, tileDescriptionVariants, tileGroupVariants, tileIndicatorVariants, tileLeadingSlotVariants, tileRootVariants, tileTitleVariants, tileTrailingSlotVariants } from './styles';
13
12
  import { jsx as _jsx } from "react/jsx-runtime";
14
13
  const TILE_SCOPE = 'TILE';
15
14
  const TILE_GROUP_SCOPE = 'TILE_GROUP';
16
- const RootPressable = withStyleContext(Pressable, TILE_SCOPE);
17
- const GroupView = withStyleContext(View, TILE_GROUP_SCOPE);
18
15
  const useTileGroupStyleContext = () => {
19
16
  // `useStyleContext` types the result as a `Record`, but at runtime the value is
20
17
  // `undefined` when no provider is in scope (e.g. standalone Tile). Cast through
@@ -22,16 +19,6 @@ const useTileGroupStyleContext = () => {
22
19
  const ctx = useStyleContext(TILE_GROUP_SCOPE);
23
20
  return ctx ?? {};
24
21
  };
25
- const TilePrimitive = createTile({
26
- Pressable: RootPressable,
27
- Group: GroupView,
28
- LeadingSlot: View,
29
- Content: View,
30
- Title: Text,
31
- Description: Text,
32
- Indicator: View,
33
- TrailingSlot: View
34
- });
35
22
 
36
23
  // =============================================================================
37
24
  // TILE GROUP
@@ -47,7 +34,7 @@ const TilePrimitive = createTile({
47
34
  * - `direction="column"` + `spacing="none"` — tight vertical stack (rows touch).
48
35
  * - `direction="row"` + `spacing="default"` — side-by-side horizontal layout.
49
36
  *
50
- * `shape` (when set) is propagated to child `Tile`s via `withStyleContext`, matching the
37
+ * `shape` (when set) is propagated to child `Tile`s via `ParentContext`, matching the
51
38
  * Avatar size-propagation pattern. A per-tile `shape` prop overrides the inherited value.
52
39
  */
53
40
 
@@ -59,19 +46,31 @@ const TileGroup = /*#__PURE__*/forwardRef(({
59
46
  spacing,
60
47
  shape,
61
48
  ...props
62
- }, ref) => /*#__PURE__*/_jsx(TilePrimitive.Group, {
63
- ref: ref,
64
- className: cn(tileGroupVariants({
65
- direction,
66
- spacing
67
- }), className),
68
- style: style,
69
- context: {
70
- shape
71
- },
72
- ...props,
73
- children: children
74
- }));
49
+ }, ref) => {
50
+ const parent = useParentContext();
51
+ const ctx = useMemo(() => ({
52
+ ...parent,
53
+ [TILE_GROUP_SCOPE]: {
54
+ shape
55
+ }
56
+ }), [parent, shape]);
57
+ return /*#__PURE__*/_jsx(ParentContext.Provider, {
58
+ value: ctx,
59
+ children: /*#__PURE__*/_jsx(TileGroupPrimitive, {
60
+ ref: ref,
61
+ className: cn(tileGroupVariants({
62
+ direction,
63
+ spacing
64
+ }), className),
65
+ style: style,
66
+ ...props,
67
+ ...mergeDataAttributes(props, dataAttributes({
68
+ slot: 'tile-group'
69
+ })),
70
+ children: children
71
+ })
72
+ });
73
+ });
75
74
  TileGroup.displayName = 'Tile.Group';
76
75
 
77
76
  // =============================================================================
@@ -83,7 +82,6 @@ const TileRoot = /*#__PURE__*/forwardRef(({
83
82
  showSeparator,
84
83
  className,
85
84
  style,
86
- context,
87
85
  ...props
88
86
  }, ref) => {
89
87
  const {
@@ -94,15 +92,24 @@ const TileRoot = /*#__PURE__*/forwardRef(({
94
92
  shape,
95
93
  showSeparator
96
94
  }), className);
97
- return /*#__PURE__*/_jsx(TilePrimitive, {
98
- ref: ref,
99
- className: computedClassName,
100
- context: {
101
- ...context,
95
+ const parent = useParentContext();
96
+ const ctx = useMemo(() => ({
97
+ ...parent,
98
+ [TILE_SCOPE]: {
102
99
  shape
103
- },
104
- style: style,
105
- ...props
100
+ }
101
+ }), [parent, shape]);
102
+ return /*#__PURE__*/_jsx(ParentContext.Provider, {
103
+ value: ctx,
104
+ children: /*#__PURE__*/_jsx(TileRootPrimitive, {
105
+ ref: ref,
106
+ className: computedClassName,
107
+ style: style,
108
+ ...props,
109
+ ...mergeDataAttributes(props, dataAttributes({
110
+ slot: 'tile'
111
+ }))
112
+ })
106
113
  });
107
114
  });
108
115
  TileRoot.displayName = 'Tile';
@@ -111,57 +118,100 @@ TileRoot.displayName = 'Tile';
111
118
  // SLOTS
112
119
  // =============================================================================
113
120
 
121
+ const leadingSlotStyle = {
122
+ flexShrink: 0
123
+ };
114
124
  const TileLeadingSlot = /*#__PURE__*/forwardRef(({
125
+ asChild,
115
126
  className,
116
127
  style,
128
+ 'aria-hidden': ariaHidden,
117
129
  ...props
118
- }, ref) => /*#__PURE__*/_jsx(TilePrimitive.LeadingSlot, {
119
- ref: ref,
120
- className: cn(tileLeadingSlotVariants(), className),
121
- style: style,
122
- ...props
123
- }));
130
+ }, ref) => {
131
+ const accessibilityElementsHidden = ariaHidden !== false;
132
+ const Comp = asChild ? Slot : View;
133
+ return /*#__PURE__*/_jsx(Comp, {
134
+ ref: ref,
135
+ accessibilityElementsHidden: accessibilityElementsHidden,
136
+ "aria-hidden": ariaHidden ?? true,
137
+ className: cn(tileLeadingSlotVariants(), className),
138
+ style: [leadingSlotStyle, style],
139
+ ...props,
140
+ ...mergeDataAttributes(props, dataAttributes({
141
+ slot: 'tile-leading'
142
+ }))
143
+ });
144
+ });
124
145
  TileLeadingSlot.displayName = 'Tile.LeadingSlot';
146
+ const contentStyle = {
147
+ flex: 1,
148
+ flexDirection: 'column',
149
+ minWidth: 0
150
+ };
125
151
  const TileContent = /*#__PURE__*/forwardRef(({
152
+ asChild,
126
153
  className,
127
154
  style,
128
155
  ...props
129
- }, ref) => /*#__PURE__*/_jsx(TilePrimitive.Content, {
130
- ref: ref,
131
- className: cn(tileContentVariants(), className),
132
- style: style,
133
- ...props
134
- }));
156
+ }, ref) => {
157
+ const Comp = asChild ? Slot : View;
158
+ return /*#__PURE__*/_jsx(Comp, {
159
+ ref: ref,
160
+ className: cn(tileContentVariants(), className),
161
+ style: [contentStyle, style],
162
+ ...props,
163
+ ...mergeDataAttributes(props, dataAttributes({
164
+ slot: 'tile-content'
165
+ }))
166
+ });
167
+ });
135
168
  TileContent.displayName = 'Tile.Content';
169
+ const noUnderlineStyle = {
170
+ textDecorationLine: 'none'
171
+ };
136
172
  const TileTitle = /*#__PURE__*/forwardRef(({
173
+ asChild,
137
174
  className,
138
175
  style,
139
176
  numberOfLines = 1,
140
177
  ...props
141
- }, ref) => /*#__PURE__*/_jsx(TilePrimitive.Title, {
142
- ref: ref,
143
- className: cn(tileTitleVariants(), className),
144
- style: style,
145
- numberOfLines: numberOfLines,
146
- ...props
147
- }));
178
+ }, ref) => {
179
+ const Comp = asChild ? Slot : Text;
180
+ return /*#__PURE__*/_jsx(Comp, {
181
+ ref: ref,
182
+ className: cn(tileTitleVariants(), className),
183
+ style: [noUnderlineStyle, style],
184
+ numberOfLines: numberOfLines,
185
+ ...props,
186
+ ...mergeDataAttributes(props, dataAttributes({
187
+ slot: 'tile-title'
188
+ }))
189
+ });
190
+ });
148
191
  TileTitle.displayName = 'Tile.Title';
149
192
  const TileDescription = /*#__PURE__*/forwardRef(({
193
+ asChild,
150
194
  className,
151
195
  style,
152
196
  ...props
153
- }, ref) => /*#__PURE__*/_jsx(TilePrimitive.Description, {
154
- ref: ref,
155
- className: cn(tileDescriptionVariants(), className),
156
- style: style,
157
- ...props
158
- }));
197
+ }, ref) => {
198
+ const Comp = asChild ? Slot : Text;
199
+ return /*#__PURE__*/_jsx(Comp, {
200
+ ref: ref,
201
+ className: cn(tileDescriptionVariants(), className),
202
+ style: [noUnderlineStyle, style],
203
+ ...props,
204
+ ...mergeDataAttributes(props, dataAttributes({
205
+ slot: 'tile-description'
206
+ }))
207
+ });
208
+ });
159
209
  TileDescription.displayName = 'Tile.Description';
160
210
 
161
211
  /**
162
212
  * Decorative selection affordance. Renders pure CVA-styled Views — no interactive hooks,
163
213
  * no nested Pressable, zero runtime overhead. The Tile root owns the press target and
164
- * ARIA role; this subtree is `aria-hidden` via `createTileIndicator`.
214
+ * ARIA role; this subtree is `aria-hidden`.
165
215
  *
166
216
  * The visual is inferred from the tile context: `single` (radio semantics) → radio ring,
167
217
  * `multiple` (checkbox semantics) → checkbox square. An explicit `indicatorType` prop
@@ -202,33 +252,55 @@ function TileIndicatorVisual({
202
252
  })
203
253
  });
204
254
  }
255
+ const indicatorStyle = {
256
+ flexShrink: 0,
257
+ pointerEvents: 'none'
258
+ };
205
259
  const TileIndicator = /*#__PURE__*/forwardRef(({
260
+ asChild,
206
261
  className,
207
262
  children,
208
263
  style,
209
264
  indicatorType,
210
265
  ...props
211
- }, ref) => /*#__PURE__*/_jsx(TilePrimitive.Indicator, {
212
- ref: ref,
213
- className: cn(tileIndicatorVariants(), className),
214
- style: style,
215
- indicatorType: indicatorType,
216
- ...props,
217
- children: children ?? /*#__PURE__*/_jsx(TileIndicatorVisual, {
218
- indicatorType: indicatorType
219
- })
220
- }));
266
+ }, ref) => {
267
+ const Comp = asChild ? Slot : View;
268
+ return /*#__PURE__*/_jsx(Comp, {
269
+ ref: ref,
270
+ accessibilityElementsHidden: true,
271
+ "aria-hidden": true,
272
+ className: cn(tileIndicatorVariants(), className),
273
+ style: [indicatorStyle, style],
274
+ ...props,
275
+ ...mergeDataAttributes(props, dataAttributes({
276
+ slot: 'tile-indicator'
277
+ })),
278
+ children: children ?? /*#__PURE__*/_jsx(TileIndicatorVisual, {
279
+ indicatorType: indicatorType
280
+ })
281
+ });
282
+ });
221
283
  TileIndicator.displayName = 'Tile.Indicator';
284
+ const trailingSlotStyle = {
285
+ flexShrink: 0
286
+ };
222
287
  const TileTrailingSlot = /*#__PURE__*/forwardRef(({
288
+ asChild,
223
289
  className,
224
290
  style,
225
291
  ...props
226
- }, ref) => /*#__PURE__*/_jsx(TilePrimitive.TrailingSlot, {
227
- ref: ref,
228
- className: cn(tileTrailingSlotVariants(), className),
229
- style: style,
230
- ...props
231
- }));
292
+ }, ref) => {
293
+ const Comp = asChild ? Slot : View;
294
+ return /*#__PURE__*/_jsx(Comp, {
295
+ ref: ref,
296
+ className: cn(tileTrailingSlotVariants(), className),
297
+ style: [trailingSlotStyle, style],
298
+ ...props,
299
+ ...mergeDataAttributes(props, dataAttributes({
300
+ slot: 'tile-trailing'
301
+ }))
302
+ });
303
+ });
232
304
  TileTrailingSlot.displayName = 'Tile.TrailingSlot';
233
305
  export const Tile = Object.assign(TileRoot, {
234
306
  Group: TileGroup,