@stacksjs/components 0.2.342 → 0.2.344

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 (167) hide show
  1. package/dist/{Accordion-8tv78bh9.stx → Accordion-ccye7erw.stx} +23 -3
  2. package/dist/{Audio-y0sgq50z.stx → Audio-tnjd6anm.stx} +7 -7
  3. package/dist/{Avatar-e43x17z1.stx → Avatar-7vegrsg6.stx} +3 -3
  4. package/dist/Badge-439n5p0a.stx +74 -0
  5. package/dist/{Breadcrumb-csf164sd.stx → Breadcrumb-7hwnfyyw.stx} +21 -6
  6. package/dist/Button-y8fnx29x.stx +193 -0
  7. package/dist/{Calendar-gjjhhfnt.stx → Calendar-8q76ees6.stx} +6 -6
  8. package/dist/{Card-7byck6ep.stx → Card-r55zpjqh.stx} +6 -6
  9. package/dist/{Checkbox-2s2a7n4h.stx → Checkbox-xnm8ax5q.stx} +9 -9
  10. package/dist/{ComboboxInput-z1293bbh.stx → ComboboxInput-9q87fb22.stx} +2 -2
  11. package/dist/{ComboboxOption-6yh7xk7q.stx → ComboboxOption-qm38e8e9.stx} +2 -2
  12. package/dist/{ComboboxOptions-sq5360ae.stx → ComboboxOptions-nbndbrxz.stx} +1 -1
  13. package/dist/{CommandPalette-fzfv1pme.stx → CommandPalette-mkqqep2s.stx} +4 -4
  14. package/dist/{DefaultPaymentMethod-6qrem3sg.stx → DefaultPaymentMethod-v11254p4.stx} +8 -8
  15. package/dist/Dialog-d1020hj6.stx +268 -0
  16. package/dist/DialogBackdrop-de5m5m4w.stx +12 -0
  17. package/dist/DialogPanel-vhdqymc2.stx +19 -0
  18. package/dist/{DialogTitle-x0r6k8x9.stx → DialogTitle-0jjdk5ra.stx} +1 -1
  19. package/dist/{Drawer-9jx39xef.stx → Drawer-rymajw9v.stx} +86 -21
  20. package/dist/{DropdownButton-wcz67dxy.stx → DropdownButton-n6gsmcte.stx} +2 -2
  21. package/dist/{DropdownItem-d8ht2bp5.stx → DropdownItem-qs772agw.stx} +1 -1
  22. package/dist/{DropdownItems-1sxnd5qn.stx → DropdownItems-yf25hdh1.stx} +1 -1
  23. package/dist/{EmailInput-vak3kkmk.stx → EmailInput-agb8kqae.stx} +4 -4
  24. package/dist/{FilterChip-h896vrxm.stx → FilterChip-ww5nkepm.stx} +26 -2
  25. package/dist/{Image-4ezne2xj.stx → Image-79xyzb5j.stx} +3 -3
  26. package/dist/{ListRow-v45ymhcn.stx → ListRow-8d3e1yxh.stx} +2 -2
  27. package/dist/{Listbox-0cyysv0f.stx → Listbox-e5jreb0a.stx} +1 -1
  28. package/dist/{ListboxButton-keb8gm0q.stx → ListboxButton-w3vfvte7.stx} +2 -2
  29. package/dist/{RadioGroupLabel-7mymt1b8.stx → ListboxLabel-ka0hfm7b.stx} +1 -1
  30. package/dist/{ListboxOption-4j070101.stx → ListboxOption-ea0j02a8.stx} +2 -2
  31. package/dist/{ListboxOptions-ejkatcfg.stx → ListboxOptions-qxrkrb8z.stx} +1 -1
  32. package/dist/{Login-2cp65d41.stx → Login-hh53d6tw.stx} +14 -14
  33. package/dist/{NavBar-wcb6f2d3.stx → NavBar-qqrrhdnk.stx} +24 -0
  34. package/dist/{Navigator-smpa7my4.stx → Navigator-55wpcpx1.stx} +2 -2
  35. package/dist/{Notification-03vfh3k6.stx → Notification-7wgk0sw6.stx} +6 -6
  36. package/dist/{NumberInput-j9p5bm5y.stx → NumberInput-54d23rq0.stx} +21 -11
  37. package/dist/{Pagination-ff7nzp7d.stx → Pagination-0ra20dja.stx} +4 -4
  38. package/dist/{PasswordInput-4qykq1dz.stx → PasswordInput-3snyppj4.stx} +24 -14
  39. package/dist/{PaymentMethods-2xy66bwk.stx → PaymentMethods-zwa7c6kh.stx} +10 -10
  40. package/dist/{PopoverButton-mffzc9pr.stx → PopoverButton-panmcysh.stx} +2 -2
  41. package/dist/{PopoverPanel-054yh38h.stx → PopoverPanel-7771yf35.stx} +2 -2
  42. package/dist/{Portal-yghnqdj8.stx → Portal-m73vz879.stx} +1 -1
  43. package/dist/{Progress-twhhzsd9.stx → Progress-cj0z83rx.stx} +47 -18
  44. package/dist/{Radio-ccm07b2m.stx → Radio-m2wz5ny6.stx} +8 -8
  45. package/dist/{RadioGroup-82ytfqdb.stx → RadioGroup-jg9s4ttg.stx} +1 -1
  46. package/dist/{ListboxLabel-7mymt1b8.stx → RadioGroupLabel-ka0hfm7b.stx} +1 -1
  47. package/dist/{RadioGroupOption-7pq7rw84.stx → RadioGroupOption-zvp0y9sn.stx} +2 -2
  48. package/dist/{SearchInput-pdx7agn0.stx → SearchInput-psbjk2ye.stx} +3 -3
  49. package/dist/{SectionCard-r73hvvbc.stx → SectionCard-8ctdacjr.stx} +28 -1
  50. package/dist/{Select-zt72gg1e.stx → Select-pj584jza.stx} +19 -9
  51. package/dist/{Sidebar-f1tff5p3.stx → Sidebar-ve2asgf3.stx} +6 -6
  52. package/dist/{SidebarHeader-3dppxxjh.stx → SidebarHeader-esvby82n.stx} +3 -3
  53. package/dist/{SidebarItem-5v8atp7p.stx → SidebarItem-r4f2pref.stx} +4 -4
  54. package/dist/{SidebarSection-sqz49ary.stx → SidebarSection-5sqza2j6.stx} +2 -2
  55. package/dist/{SidebarSpace-nmbvgrky.stx → SidebarSpace-bwv98azf.stx} +3 -3
  56. package/dist/{SidebarSpaceSwitcher-v5e472j0.stx → SidebarSpaceSwitcher-1mycft2g.stx} +1 -1
  57. package/dist/{SidebarSpaces-6v3p9htw.stx → SidebarSpaces-mdtrynr2.stx} +2 -2
  58. package/dist/{Signup-cbncrtvd.stx → Signup-egdrk3rh.stx} +11 -11
  59. package/dist/{Skeleton-y9tycz2h.stx → Skeleton-me2hwqrc.stx} +4 -4
  60. package/dist/{Spinner-reb6rse4.stx → Spinner-grahbp9a.stx} +9 -9
  61. package/dist/{StepperStep-3ahq4d9m.stx → StepperStep-xw55xjh0.stx} +9 -4
  62. package/dist/{SubscriptionCheckout-7fdkwf04.stx → SubscriptionCheckout-wj4s182k.stx} +13 -13
  63. package/dist/{Switch-cgy7hy0s.stx → Switch-fxbw7s16.stx} +7 -4
  64. package/dist/{TabBarItem-hd2r2ayy.stx → TabBarItem-cnxhgy92.stx} +25 -1
  65. package/dist/{Table-0mc3fdek.stx → Table-akbk3t5q.stx} +1 -1
  66. package/dist/{TableHeader-sxc77b4d.stx → TableHeader-qsc3e208.stx} +1 -1
  67. package/dist/{Tabs-b4xsba1w.stx → Tabs-2cjt68my.stx} +28 -8
  68. package/dist/{Teleport-3gnjtsjf.stx → Teleport-c8nn3757.stx} +2 -2
  69. package/dist/{TextInput-hbe2ynzj.stx → TextInput-9wqzeeg1.stx} +23 -13
  70. package/dist/{Textarea-xcdym703.stx → Textarea-xwkdg8se.stx} +11 -11
  71. package/dist/{Tooltip-y0kzkwh4.stx → Tooltip-14gt4f1w.stx} +9 -6
  72. package/dist/{Transition-7smenaz8.stx → Transition-yrvqbhjy.stx} +1 -1
  73. package/dist/{TwoFactorChallenge-y7n4yrk9.stx → TwoFactorChallenge-0200pjc0.stx} +5 -5
  74. package/dist/{Video-a0aeyexv.stx → Video-rhy7dskw.stx} +6 -6
  75. package/dist/{VirtualTable-jvm1784g.stx → VirtualTable-jvje0ybn.stx} +4 -4
  76. package/dist/composables/index.js +2 -2
  77. package/dist/index.js +13 -13
  78. package/dist/utils/highlighter.d.ts +1 -0
  79. package/dist/utils/highlighter.js +1 -1
  80. package/package.json +3 -3
  81. package/src/components/CodeBlock.stx +7 -1
  82. package/src/components/Footer.stx +1 -1
  83. package/src/components/Hero.stx +2 -2
  84. package/src/components/Installation.stx +4 -4
  85. package/src/ui/accordion/Accordion.stx +23 -3
  86. package/src/ui/audio/Audio.stx +7 -7
  87. package/src/ui/auth/Login.stx +14 -14
  88. package/src/ui/auth/Signup.stx +11 -11
  89. package/src/ui/auth/TwoFactorChallenge.stx +5 -5
  90. package/src/ui/avatar/Avatar.stx +3 -3
  91. package/src/ui/badge/Badge.stx +31 -19
  92. package/src/ui/breadcrumb/Breadcrumb.stx +21 -6
  93. package/src/ui/button/Button.stx +148 -29
  94. package/src/ui/calendar/Calendar.stx +6 -6
  95. package/src/ui/card/Card.stx +6 -6
  96. package/src/ui/checkbox/Checkbox.stx +9 -9
  97. package/src/ui/combobox/ComboboxInput.stx +2 -2
  98. package/src/ui/combobox/ComboboxOption.stx +2 -2
  99. package/src/ui/combobox/ComboboxOptions.stx +1 -1
  100. package/src/ui/command-palette/CommandPalette.stx +4 -4
  101. package/src/ui/dialog/Dialog.stx +231 -4
  102. package/src/ui/dialog/DialogBackdrop.stx +5 -2
  103. package/src/ui/dialog/DialogPanel.stx +5 -2
  104. package/src/ui/dialog/DialogTitle.stx +1 -1
  105. package/src/ui/dialog/README.md +15 -4
  106. package/src/ui/drawer/Drawer.stx +86 -21
  107. package/src/ui/dropdown/DropdownButton.stx +2 -2
  108. package/src/ui/dropdown/DropdownItem.stx +1 -1
  109. package/src/ui/dropdown/DropdownItems.stx +1 -1
  110. package/src/ui/heatmap/Heatmap.stx +1 -1
  111. package/src/ui/image/Image.stx +3 -3
  112. package/src/ui/input/EmailInput.stx +4 -4
  113. package/src/ui/input/NumberInput.stx +21 -11
  114. package/src/ui/input/PasswordInput.stx +24 -14
  115. package/src/ui/input/SearchInput.stx +3 -3
  116. package/src/ui/input/TextInput.stx +23 -13
  117. package/src/ui/listbox/Listbox.stx +1 -1
  118. package/src/ui/listbox/ListboxButton.stx +2 -2
  119. package/src/ui/listbox/ListboxLabel.stx +1 -1
  120. package/src/ui/listbox/ListboxOption.stx +2 -2
  121. package/src/ui/listbox/ListboxOptions.stx +1 -1
  122. package/src/ui/mobile/FilterChip.stx +26 -2
  123. package/src/ui/mobile/ListRow.stx +2 -2
  124. package/src/ui/mobile/NavBar.stx +24 -0
  125. package/src/ui/mobile/SectionCard.stx +28 -1
  126. package/src/ui/mobile/TabBarItem.stx +25 -1
  127. package/src/ui/navigator/Navigator.stx +2 -2
  128. package/src/ui/notification/Notification.stx +6 -6
  129. package/src/ui/pagination/Pagination.stx +4 -4
  130. package/src/ui/payment/DefaultPaymentMethod.stx +8 -8
  131. package/src/ui/payment/PaymentMethods.stx +10 -10
  132. package/src/ui/payment/SubscriptionCheckout.stx +13 -13
  133. package/src/ui/popover/PopoverButton.stx +2 -2
  134. package/src/ui/popover/PopoverPanel.stx +2 -2
  135. package/src/ui/portal/Portal.stx +1 -1
  136. package/src/ui/progress/Progress.stx +47 -18
  137. package/src/ui/radio/Radio.stx +8 -8
  138. package/src/ui/radio-group/RadioGroup.stx +1 -1
  139. package/src/ui/radio-group/RadioGroupLabel.stx +1 -1
  140. package/src/ui/radio-group/RadioGroupOption.stx +2 -2
  141. package/src/ui/select/Select.stx +19 -9
  142. package/src/ui/sidebar/Sidebar.stx +6 -6
  143. package/src/ui/sidebar/SidebarHeader.stx +3 -3
  144. package/src/ui/sidebar/SidebarItem.stx +4 -4
  145. package/src/ui/sidebar/SidebarSection.stx +2 -2
  146. package/src/ui/sidebar/SidebarSpace.stx +3 -3
  147. package/src/ui/sidebar/SidebarSpaceSwitcher.stx +1 -1
  148. package/src/ui/sidebar/SidebarSpaces.stx +2 -2
  149. package/src/ui/skeleton/Skeleton.stx +4 -4
  150. package/src/ui/spinner/Spinner.stx +9 -9
  151. package/src/ui/stepper/StepperStep.stx +9 -4
  152. package/src/ui/switch/Switch.stx +7 -4
  153. package/src/ui/table/Table.stx +1 -1
  154. package/src/ui/table/TableHeader.stx +1 -1
  155. package/src/ui/tabs/Tabs.stx +28 -8
  156. package/src/ui/teleport/Teleport.stx +2 -2
  157. package/src/ui/textarea/Textarea.stx +11 -11
  158. package/src/ui/tooltip/Tooltip.stx +9 -6
  159. package/src/ui/transition/Transition.stx +1 -1
  160. package/src/ui/video/Video.stx +6 -6
  161. package/src/ui/virtual-table/VirtualTable.stx +4 -4
  162. package/src/utils/highlighter.ts +65 -4
  163. package/dist/Badge-xwjeq24d.stx +0 -62
  164. package/dist/Button-h2mk4wfw.stx +0 -74
  165. package/dist/Dialog-y5rz2vrq.stx +0 -41
  166. package/dist/DialogBackdrop-rxax3sec.stx +0 -9
  167. package/dist/DialogPanel-44d8jeqy.stx +0 -16
@@ -1,46 +1,137 @@
1
1
  <script server cache>
2
2
  export const variant = $props.variant || 'primary'
3
3
  export const size = $props.size || 'md'
4
- export const disabled = $props.disabled || false
5
- export const loading = $props.loading || false
4
+ export const disabled = $bool($props.disabled)
5
+ export const loading = $bool($props.loading)
6
6
  export const type = $props.type || 'button'
7
- export const fullWidth = $props.fullWidth || false
7
+ export const fullWidth = $bool($props.fullWidth)
8
+ /*
9
+ * The label, as a prop, for a button whose text changes with its state.
10
+ *
11
+ * "Rotate" -> "Rotating..." is as common as disabling the button, and the slot
12
+ * cannot express it: slot content is the CALLER's markup, interpolated in the
13
+ * caller's scope at render time, so it is a snapshot like `disabled` used to
14
+ * be. `:text` on the component tag is not the answer either - the runtime's
15
+ * text binding writes textContent, which would erase the spinner and the icons
16
+ * this button keeps inside itself.
17
+ *
18
+ * So the reactive spelling is a prop: `<Button :label="rotateLabel()">`. Given
19
+ * one, the button renders it in a span that tracks the parent's binding; given
20
+ * none, the slot behaves exactly as before. See stacksjs/stx#1997.
21
+ */
22
+ export const label = $props.label || ''
23
+ export const hasLabel = label !== ''
8
24
  export const leftIcon = $props.leftIcon || ''
9
25
  export const rightIcon = $props.rightIcon || ''
10
26
  export const className = $props.className || ''
11
27
 
28
+ /*
29
+ * Role tokens, not palette shades, so an app can re-theme the button by
30
+ * meaning rather than by cancelling its classes (stacksjs/stx#1993).
31
+ *
32
+ * `className` was never an escape hatch for this: it is appended last in the
33
+ * class ATTRIBUTE, and attribute order does not decide CSS. `bg-blue-500` and
34
+ * `bg-accent` are both single-class selectors of equal specificity, so the
35
+ * winner is whichever lands later in the generated stylesheet - not something
36
+ * a call site can control.
37
+ *
38
+ * `bg-accent-solid` is `var(--stx-accent-solid, <blue-500>)`, so an app sets
39
+ * one variable and primary buttons follow, dark mode included and with no
40
+ * `dark:` anywhere. The solid/hover/ink triple exists because all three have
41
+ * to move together: a themed fill needs its own hover step, and white text on
42
+ * a light themed fill is unreadable.
43
+ *
44
+ * primary and danger are byte-for-byte the same colours as before. outline
45
+ * moves one shade in light mode (its border and text were blue-500, `accent`
46
+ * is blue-600) and its hover tint one step stronger, because a role for every
47
+ * shade would be a palette with extra steps.
48
+ */
12
49
  const variantClasses = {
13
- primary: 'bg-blue-500 hover:bg-blue-600 text-white shadow-md hover:shadow-lg dark:bg-blue-600 dark:hover:bg-blue-700',
14
- secondary: 'bg-surface-sunken hover:bg-neutral-300 text-neutral-900 dark:hover:bg-neutral-600 dark:text-white',
15
- outline: 'border-2 border-blue-500 text-blue-500 hover:bg-blue-50 dark:border-blue-400 dark:text-blue-400 dark:hover:bg-blue-950',
50
+ primary: 'bg-accent-solid hover:bg-accent-solid-hover text-accent-ink shadow-md hover:shadow-lg',
51
+ secondary: 'bg-surface-sunken hover:bg-neutral-300 text-fg dark:hover:bg-neutral-600',
52
+ outline: 'border-2 border-accent text-accent hover:bg-accent-soft',
16
53
  ghost: 'hover:bg-surface-raised text-fg-strong',
17
- danger: 'bg-red-500 hover:bg-red-600 text-white shadow-md hover:shadow-lg dark:bg-red-600 dark:hover:bg-red-700',
54
+ danger: 'bg-danger-solid hover:bg-danger-solid-hover text-danger-ink shadow-md hover:shadow-lg',
18
55
  }
19
56
 
57
+ /*
58
+ * Padding decides the height, with no `h-*` to override it.
59
+ *
60
+ * Each size used to carry a fixed height beside its padding, which meant an app
61
+ * passing its own `py-1.5` got the padding it asked for and the height it did
62
+ * not - and `className` cannot win that fight, because `h-10` and `h-8` are
63
+ * single-class selectors of equal specificity (stacksjs/stx#1993).
64
+ *
65
+ * The fixed heights were also wrong on three of five sizes. Measured against
66
+ * the theme's own line-heights: xs declared 1.75rem around 1.5rem of content,
67
+ * while lg declared 3rem around 3.25rem and xl 3.5rem around 3.75rem - so the
68
+ * two largest sizes had been quietly eating a quarter-rem of their own padding.
69
+ *
70
+ * The padding below reproduces all five declared heights EXACTLY - 1.75, 2,
71
+ * 2.5, 3 and 3.5rem - so nothing changes on screen while the height becomes
72
+ * something a call site can actually set. xs, lg and xl needed a padding step
73
+ * adjusted to land on the same number they claimed before.
74
+ */
20
75
  const sizeClasses = {
21
- xs: 'px-2.5 py-1 text-xs h-7 gap-1',
22
- sm: 'px-3 py-1.5 text-sm h-8 gap-1.5',
23
- md: 'px-4 py-2 text-base h-10 gap-2',
24
- lg: 'px-6 py-3 text-lg h-12 gap-2.5',
25
- xl: 'px-8 py-4 text-xl h-14 gap-3',
76
+ xs: 'px-2.5 py-1.5 text-xs gap-1',
77
+ sm: 'px-3 py-1.5 text-sm gap-1.5',
78
+ md: 'px-4 py-2 text-base gap-2',
79
+ lg: 'px-6 py-2.5 text-lg gap-2.5',
80
+ xl: 'px-8 py-3.5 text-xl gap-3',
26
81
  }
27
82
 
28
83
  const iconSizeClasses = { xs: 'h-3 w-3', sm: 'h-4 w-4', md: 'h-5 w-5', lg: 'h-6 w-6', xl: 'h-7 w-7' }
29
- const baseClasses = 'inline-flex items-center justify-center font-semibold rounded-md transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed disabled:pointer-events-none'
84
+ /*
85
+ * The focus ring follows the accent too. It was `ring-blue-500` with no dark
86
+ * twin, so it stayed blue in a dark theme and in a rose-accented app alike;
87
+ * the token's light value is that same blue-500 and its dark value is a step
88
+ * darker, which is a ring that was missing rather than one that changed.
89
+ */
90
+ const baseClasses = 'inline-flex items-center justify-center font-semibold rounded-control transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-accent-solid disabled:opacity-50 disabled:cursor-not-allowed disabled:pointer-events-none'
30
91
  const widthClasses = fullWidth ? 'w-full' : ''
31
92
  export const isDisabled = disabled || loading
32
93
 
33
- export const buttonClasses = `${baseClasses} ${variantClasses[variant]} ${sizeClasses[size]} ${widthClasses} ${className}`.trim()
34
- export const iconClasses = iconSizeClasses[size]
94
+ export const buttonClasses = `${baseClasses} ${variantClasses[variant] || variantClasses.primary} ${sizeClasses[size] || sizeClasses.md} ${widthClasses} ${className}`.trim()
95
+ export const iconClasses = iconSizeClasses[size] || iconSizeClasses.md
35
96
  export const spinnerClasses = `animate-spin ${iconClasses}`.trim()
36
97
  </script>
37
98
 
38
99
  <script client>
39
100
  const emit = defineEmits()
40
- const disabledNow = {{ isDisabled }}
101
+
102
+ /*
103
+ * `disabled` and `loading` are read as live props, not as a server snapshot.
104
+ *
105
+ * This used to be `const disabledNow = {{ isDisabled }}` — a value computed
106
+ * before the page was sent and never looked at again. So the most common piece
107
+ * of button state in an application could not be expressed:
108
+ *
109
+ * <Button :disabled="saving()" @click="save">Save</Button>
110
+ *
111
+ * `saving()` is a signal. On the server it is not yet meaningful, so the button
112
+ * shipped enabled and STAYED enabled for the life of the page — through the
113
+ * exact async action it was there to guard. Double submits, destructive
114
+ * deletes and rotate-key confirmations all land on this.
115
+ *
116
+ * useReactiveProp wires the parent's binding into a local signal: the parent's
117
+ * bindAttr writes the attribute on our root, a MutationObserver picks it up,
118
+ * and the signal flips. Dialog already does this for `open` (#1704) and Switch
119
+ * for `checked`, so this is the package's existing answer rather than a new one.
120
+ *
121
+ * See stacksjs/stx#1997.
122
+ */
123
+ const labelText = useReactiveProp('label', {{ label }}, { parse: value => value == null ? '' : String(value) })
124
+ const isLoading = useReactiveProp('loading', {{ loading }})
125
+ const disabledProp = useReactiveProp('disabled', {{ disabled }})
126
+
127
+ // Loading implies disabled, the same combination the server computes for the
128
+ // initial render, so the two agree before and after hydration.
129
+ const isDisabled = derived(() => disabledProp() || isLoading())
41
130
 
42
131
  function onClick(event) {
43
- if (disabledNow) {
132
+ // Read through the signal: a button disabled after render must stop guarding
133
+ // on the live value, not on what was true when the page was built.
134
+ if (isDisabled()) {
44
135
  event.preventDefault()
45
136
  return
46
137
  }
@@ -52,23 +143,51 @@ function onClick(event) {
52
143
  type="{{ type }}"
53
144
  class="{{ buttonClasses }}"
54
145
  @if(isDisabled)disabled@endif
55
- @click="onClick($event)"
146
+ :disabled="isDisabled()"
56
147
  aria-busy="{{ loading ? 'true' : 'false' }}"
148
+ :aria-busy="isLoading() ? 'true' : 'false'"
149
+ @click="onClick($event)"
57
150
  >
58
- @if(loading)
59
- <svg class="{{ spinnerClasses }}" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
60
- <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
61
- <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
62
- </svg>
63
- @else
64
- @if(leftIcon)
65
- <span class="{{ iconClasses }}">{!! leftIcon !!}</span>
66
- @endif
151
+ {{-- The spinner is always in the DOM so `loading` can turn it on after render;
152
+ it was inside an @if, which meant the only way to see it was to have been
153
+ loading when the page was built. x-cloak only when the server says we are
154
+ NOT loading, so a button rendered loading shows its spinner on first
155
+ paint rather than waiting for hydration. --}}
156
+ <svg
157
+ :show="isLoading()"
158
+ @if(!loading)x-cloak@endif
159
+ class="{{ spinnerClasses }}"
160
+ xmlns="http://www.w3.org/2000/svg"
161
+ fill="none"
162
+ viewBox="0 0 24 24"
163
+ >
164
+ <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
165
+ <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
166
+ </svg>
167
+
168
+ @if(leftIcon)
169
+ <span :show="!isLoading()" @if(loading)x-cloak@endif class="{{ iconClasses }}">{!! leftIcon !!}</span>
67
170
  @endif
68
171
 
69
172
  <slot />
70
173
 
71
- @if(!loading && rightIcon)
72
- <span class="{{ iconClasses }}">{!! rightIcon !!}</span>
174
+ {{-- The label span is decided on the CLIENT, because the server cannot see a
175
+ reactive prop at all: `:label="rotateLabel()"` is categorised as client
176
+ reactive, so `$props.label` is undefined during render and only the
177
+ root's data-stx-parent-bindings records that a binding exists.
178
+
179
+ `:if` rather than always rendering it, because the button is a flex
180
+ container with a gap: an empty span is still a flex item and would add a
181
+ trailing gap to every button that uses the slot. x-cloak while the
182
+ server has no label, so that gap is not visible for the frame before
183
+ hydration - the same pairing the spinner above uses. --}}
184
+ <span
185
+ :if="labelText()"
186
+ @if(!hasLabel)x-cloak@endif
187
+ :text="labelText()"
188
+ >{{ label }}</span>
189
+
190
+ @if(rightIcon)
191
+ <span :show="!isLoading()" @if(loading)x-cloak@endif class="{{ iconClasses }}">{!! rightIcon !!}</span>
73
192
  @endif
74
193
  </button>
@@ -9,11 +9,11 @@ export const showToday = $props.showToday !== false
9
9
  export const className = $props.className || ''
10
10
  export const highlightToday = $props.highlightToday !== false
11
11
 
12
- const baseClasses = 'bg-white dark:bg-gray-800 rounded-lg shadow-lg p-4 w-full max-w-sm'
12
+ const baseClasses = 'bg-panel rounded-panel shadow-lg p-4 w-full max-w-sm'
13
13
  export const calendarClasses = `${baseClasses} ${className}`.trim()
14
14
  export const headerClasses = 'flex items-center justify-between mb-4'
15
15
  export const monthYearClasses = 'text-lg font-semibold text-fg'
16
- export const buttonClasses = 'p-2 hover:bg-surface-raised rounded-md transition-colors'
16
+ export const buttonClasses = 'p-2 hover:bg-surface-raised rounded-control transition-colors'
17
17
  export const weekdaysClasses = 'grid grid-cols-7 gap-1 mb-2'
18
18
  export const weekdayClasses = 'text-center text-xs font-medium text-fg-muted py-2'
19
19
  export const daysGridClasses = 'grid grid-cols-7 gap-1'
@@ -116,15 +116,15 @@ function goToToday() {
116
116
  }
117
117
 
118
118
  function dayClasses(day) {
119
- const base = 'flex items-center justify-center h-10 w-10 rounded-md text-sm transition-colors'
119
+ const base = 'flex items-center justify-center h-10 w-10 rounded-control text-sm transition-colors'
120
120
  const isSelected = isSameDay(day.date, selectedDate())
121
121
  const isTodayDate = isToday(day.date)
122
122
  const disabled = isDisabled(day.date)
123
123
  let cls = base
124
124
  cls += day.isCurrentMonth ? 'text-fg' : 'text-fg-subtle'
125
125
  cls += disabled ? ' opacity-50 cursor-not-allowed' : 'cursor-pointer hover:bg-surface-raised'
126
- if (isSelected) cls += 'bg-info-solid text-white hover:bg-blue-700 dark:hover:bg-blue-600'
127
- if (isTodayDate && highlightToday && !isSelected) cls += 'border-2 border-info'
126
+ if (isSelected) cls += 'bg-accent-solid text-white hover:bg-blue-700 dark:hover:bg-blue-600'
127
+ if (isTodayDate && highlightToday && !isSelected) cls += 'border-2 border-accent'
128
128
  return cls
129
129
  }
130
130
 
@@ -179,7 +179,7 @@ defineExpose({ selectedDate, currentMonth, selectDate })
179
179
  <div class="mt-4 flex justify-center">
180
180
  <button
181
181
  type="button"
182
- class="px-4 py-2 text-sm font-medium text-info hover:bg-blue-50 dark:hover:bg-gray-700 rounded-md transition-colors"
182
+ class="px-4 py-2 text-sm font-medium text-accent hover:bg-blue-50 dark:hover:bg-neutral-700 rounded-control transition-colors"
183
183
  @click="goToToday()"
184
184
  >
185
185
  Today
@@ -1,16 +1,16 @@
1
1
  <script server cache>
2
2
  export const variant = $props.variant || 'default'
3
3
  export const padding = $props.padding || 'default'
4
- export const hover = $props.hover || false
5
- export const clickable = $props.clickable || false
4
+ export const hover = $bool($props.hover)
5
+ export const clickable = $bool($props.clickable)
6
6
  export const image = $props.image || ''
7
7
  export const imageAlt = $props.imageAlt || ''
8
8
  export const className = $props.className || ''
9
9
 
10
10
  const variantClasses = {
11
- default: 'bg-white dark:bg-gray-800 border border-line',
11
+ default: 'bg-panel border border-line',
12
12
  outlined: 'bg-transparent border-2 border-line-strong',
13
- elevated: 'bg-white dark:bg-gray-800 shadow-lg border-0',
13
+ elevated: 'bg-panel shadow-lg border-0',
14
14
  flat: 'bg-surface border-0',
15
15
  }
16
16
 
@@ -18,9 +18,9 @@ const paddingClasses = { none: 'p-0', sm: 'p-3', default: 'p-6', lg: 'p-8' }
18
18
  const hoverClasses = hover ? 'transition-all duration-200 hover:shadow-lg hover:-translate-y-0.5' : ''
19
19
  const clickableClasses = clickable ? 'cursor-pointer' : ''
20
20
 
21
- export const cardClasses = `rounded-lg overflow-hidden ${variantClasses[variant]} ${paddingClasses[image ? 'none' : padding]} ${hoverClasses} ${clickableClasses} ${className}`.trim()
21
+ export const cardClasses = `rounded-panel overflow-hidden ${variantClasses[variant] || variantClasses.default} ${paddingClasses[image ? 'none' : padding] || paddingClasses.default} ${hoverClasses} ${clickableClasses} ${className}`.trim()
22
22
  export const imageClasses = `w-full h-48 object-cover`.trim()
23
- export const contentClasses = `${image ? paddingClasses[padding] : ''}`.trim()
23
+ export const contentClasses = `${image ? paddingClasses[padding] || paddingClasses.default : ''}`.trim()
24
24
  </script>
25
25
 
26
26
  <script client>
@@ -1,24 +1,24 @@
1
1
  <script server>
2
- export const checked = $props.checked || false
3
- export const disabled = $props.disabled || false
4
- export const indeterminate = $props.indeterminate || false
2
+ export const checked = $bool($props.checked)
3
+ export const disabled = $bool($props.disabled)
4
+ export const indeterminate = $bool($props.indeterminate)
5
5
  export const size = $props.size || 'md'
6
6
  export const label = $props.label || ''
7
7
  export const description = $props.description || ''
8
- export const error = $props.error || false
9
- export const required = $props.required || false
8
+ export const error = $bool($props.error)
9
+ export const required = $bool($props.required)
10
10
  export const value = $props.value || ''
11
11
  export const name = $props.name || ''
12
12
  export const className = $props.className || ''
13
13
 
14
14
  const sizeClasses = { sm: 'h-4 w-4', md: 'h-5 w-5', lg: 'h-6 w-6' }
15
15
  const baseClasses = 'rounded border-line-strong text-accent focus:ring-accent focus:ring-2 focus:ring-offset-2 dark:focus:ring-offset-gray-900 transition-colors'
16
- const stateClasses = error ? 'border-red-300 dark:border-red-600 text-danger focus:ring-red-500 dark:focus:ring-red-400' : ''
16
+ const stateClasses = error ? 'border-danger-line text-danger focus:ring-danger-focus' : ''
17
17
  const disabledClasses = disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer'
18
18
 
19
- export const checkboxClasses = `${baseClasses} ${sizeClasses[size]} ${stateClasses} ${disabledClasses}`.trim()
19
+ export const checkboxClasses = `${baseClasses} ${sizeClasses[size] || sizeClasses.md} ${stateClasses} ${disabledClasses}`.trim()
20
20
  export const labelClasses = `text-sm font-medium ${error ? 'text-danger' : 'text-fg'} ${disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer'}`.trim()
21
- export const descriptionClasses = `text-sm ${error ? 'text-red-500 dark:text-red-400' : 'text-fg-soft'}`.trim()
21
+ export const descriptionClasses = `text-sm ${error ? 'text-danger' : 'text-fg-soft'}`.trim()
22
22
  export const inputId = `checkbox-${value || label}`
23
23
  </script>
24
24
 
@@ -72,7 +72,7 @@ defineExpose({ isChecked })
72
72
  <label for="{{ inputId }}" class="{{ labelClasses }}">
73
73
  {{ label }}
74
74
  @if(required)
75
- <span class="text-red-500 ml-1">*</span>
75
+ <span class="text-danger ml-1">*</span>
76
76
  @endif
77
77
  </label>
78
78
  @endif
@@ -2,9 +2,9 @@
2
2
  export const displayValue = $props.displayValue
3
3
  export const className = $props.className || ''
4
4
  export const placeholder = $props.placeholder || ''
5
- export const disabled = $props.disabled || false
5
+ export const disabled = $bool($props.disabled)
6
6
 
7
- const baseClasses = 'w-full rounded-lg border-none bg-white dark:bg-neutral-800 py-2 pl-3 pr-10 text-sm leading-5 text-neutral-900 dark:text-white focus:ring-0 focus:outline-none focus-visible:border-blue-500 focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75 focus-visible:ring-offset-2'
7
+ const baseClasses = 'w-full rounded-panel border-none bg-panel py-2 pl-3 pr-10 text-sm leading-5 text-fg focus:ring-0 focus:outline-none focus-visible:border-blue-500 focus-visible:ring-2 focus-visible:ring-white/75 focus-visible:ring-offset-2'
8
8
  const disabledClasses = disabled ? 'opacity-50 cursor-not-allowed' : ''
9
9
  export const inputClasses = `${baseClasses} ${disabledClasses} ${className}`.trim()
10
10
  </script>
@@ -1,6 +1,6 @@
1
1
  <script server>
2
2
  export const value = $props.value
3
- export const disabled = $props.disabled || false
3
+ export const disabled = $bool($props.disabled)
4
4
  export const className = $props.className || ''
5
5
  export const as = $props.as || 'li'
6
6
 
@@ -32,7 +32,7 @@ function onClick(event) {
32
32
  @if(disabled)aria-disabled="true"@endif
33
33
  @click="onClick($event)"
34
34
  >
35
- <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-info" data-stx-combobox-check>
35
+ <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-accent" data-stx-combobox-check>
36
36
  <svg class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
37
37
  <path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd" />
38
38
  </svg>
@@ -2,7 +2,7 @@
2
2
  export const className = $props.className || ''
3
3
  export const as = $props.as || 'ul'
4
4
 
5
- const baseClasses = 'absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-md bg-white dark:bg-neutral-800 py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none'
5
+ const baseClasses = 'absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-panel bg-panel py-1 text-base shadow-lg ring-1 ring-black/5 focus:outline-none'
6
6
  export const optionsClasses = `${baseClasses} ${className}`.trim()
7
7
  </script>
8
8
 
@@ -1,5 +1,5 @@
1
1
  <script server>
2
- export const open = $props.open || false
2
+ export const open = $bool($props.open)
3
3
  export const initialQuery = $props.query || ''
4
4
  export const className = $props.className || ''
5
5
 
@@ -58,16 +58,16 @@ defineExpose({ isOpen, query, show, close })
58
58
  data-palette-id="{{ paletteInstanceId }}"
59
59
  @stx:command-select="onItemSelect($event)"
60
60
  >
61
- <div class="fixed inset-0 bg-neutral-500 bg-opacity-25 dark:bg-opacity-50 transition-opacity" @click="close()"></div>
61
+ <div class="fixed inset-0 bg-neutral-500/25 dark:bg-neutral-500/50 transition-opacity" @click="close()"></div>
62
62
 
63
- <div class="mx-auto max-w-xl transform divide-y divide-neutral-100 dark:divide-neutral-800 overflow-hidden rounded-xl bg-white dark:bg-neutral-900 shadow-2xl ring-1 ring-black ring-opacity-5 transition-all relative">
63
+ <div class="mx-auto max-w-xl transform divide-y divide-line overflow-hidden rounded-xl bg-white dark:bg-neutral-900 shadow-2xl ring-1 ring-black/5 transition-all relative">
64
64
  <div class="relative">
65
65
  <svg class="pointer-events-none absolute top-3.5 left-4 h-5 w-5 text-neutral-400" viewBox="0 0 20 20" fill="currentColor">
66
66
  <path fill-rule="evenodd" d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" clip-rule="evenodd" />
67
67
  </svg>
68
68
  <input
69
69
  type="text"
70
- class="h-12 w-full border-0 bg-transparent pl-11 pr-4 text-neutral-900 dark:text-white placeholder-neutral-400 focus:ring-0 sm:text-sm"
70
+ class="h-12 w-full border-0 bg-transparent pl-11 pr-4 text-fg placeholder-neutral-400 focus:ring-0 sm:text-sm"
71
71
  placeholder="Search..."
72
72
  :value="query()"
73
73
  @input="onQueryInput($event)"