@stacksjs/components 0.2.20 → 0.2.24
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.
- package/README.md +36 -92
- package/dist/{Accordion-x2gjedap.stx → Accordion-sbfra0mz.stx} +2 -2
- package/dist/{Audio-0fk6p9tn.stx → Audio-vdmg1258.stx} +1 -1
- package/dist/{Avatar-5m0v0s4x.stx → Avatar-365cvrh4.stx} +1 -1
- package/dist/{Badge-ynes82vv.stx → Badge-8m3qete4.stx} +2 -2
- package/dist/{Breadcrumb-h9n427sk.stx → Breadcrumb-7f7s4d02.stx} +1 -1
- package/dist/{Button-7xtrzn14.stx → Button-3tt4vsqt.stx} +2 -2
- package/dist/{Calendar-egvx1pma.stx → Calendar-58nnkdh8.stx} +5 -5
- package/dist/{Card-r9w7vy1a.stx → Card-6wdbexqr.stx} +2 -2
- package/dist/{Checkbox-m8v46pmx.stx → Checkbox-p3q3e3nf.stx} +1 -1
- package/dist/{Checkout-vcnnr176.stx → Checkout-e4037tyy.stx} +1 -1
- package/dist/{Combobox-npb08vkp.stx → Combobox-th5ebw62.stx} +1 -1
- package/dist/{ComboboxButton-vcdyq4zw.stx → ComboboxButton-8gxwkhdx.stx} +1 -1
- package/dist/{ComboboxInput-c9d2p02m.stx → ComboboxInput-mk99z65n.stx} +1 -1
- package/dist/{ComboboxOption-7d0h9ash.stx → ComboboxOption-an9zyan6.stx} +1 -1
- package/dist/{ComboboxOptions-4dtqc0qa.stx → ComboboxOptions-6b5ywc5x.stx} +1 -1
- package/dist/{CommandPalette-ah00bf8v.stx → CommandPalette-kwmdf2np.stx} +1 -1
- package/dist/{CommandPaletteItem-2yx0gvtj.stx → CommandPaletteItem-zx2fbpts.stx} +1 -1
- package/dist/{DefaultPaymentMethod-emw5fg8s.stx → DefaultPaymentMethod-shhf6aap.stx} +1 -1
- package/dist/{Dialog-1w4rz7x0.stx → Dialog-rgmj8q2j.stx} +1 -1
- package/dist/{DialogBackdrop-qbm3y5ab.stx → DialogBackdrop-rxax3sec.stx} +1 -1
- package/dist/{DialogDescription-01w5j74b.stx → DialogDescription-76prd1m2.stx} +1 -1
- package/dist/{DialogPanel-brsszrrs.stx → DialogPanel-44d8jeqy.stx} +1 -1
- package/dist/{DialogTitle-3rxhwg21.stx → DialogTitle-x0r6k8x9.stx} +1 -1
- package/dist/{Drawer-yfaz8q7f.stx → Drawer-p7m351bn.stx} +3 -3
- package/dist/{Dropdown-ng7nx556.stx → Dropdown-jz4jy0n3.stx} +1 -1
- package/dist/{DropdownButton-vc4zpyrb.stx → DropdownButton-9w8zkfwj.stx} +1 -1
- package/dist/{DropdownItem-z491y23c.stx → DropdownItem-wagdspb8.stx} +1 -1
- package/dist/{DropdownItems-7ykf29sj.stx → DropdownItems-aygjpxkx.stx} +1 -1
- package/dist/{EmailInput-bfshpj92.stx → EmailInput-ajsp9vw6.stx} +1 -1
- package/dist/{Form-z4f7w6r1.stx → Form-1mdmx9b6.stx} +1 -1
- package/dist/{Image-ktk0451c.stx → Image-jhkm6w1f.stx} +1 -1
- package/dist/{Listbox-xcejcmyc.stx → Listbox-pqqh72g8.stx} +1 -1
- package/dist/{ListboxButton-nx5kmw19.stx → ListboxButton-spwx7513.stx} +1 -1
- package/dist/{RadioGroupLabel-aky8a73n.stx → ListboxLabel-7mymt1b8.stx} +1 -1
- package/dist/{ListboxOption-6h4hsdz5.stx → ListboxOption-7nxzaexq.stx} +1 -1
- package/dist/{ListboxOptions-2sacdtm5.stx → ListboxOptions-8kqvfp7z.stx} +1 -1
- package/dist/{Login-s2jkvd9y.stx → Login-rx9gyqhx.stx} +1 -1
- package/dist/{Navigator-tqqdgdkw.stx → Navigator-aay8bjab.stx} +3 -3
- package/dist/{Notification-sry8egea.stx → Notification-gk33gv7b.stx} +1 -1
- package/dist/{NumberInput-zm93ddfw.stx → NumberInput-nzpkx1ry.stx} +3 -3
- package/dist/{Pagination-yza9v4qw.stx → Pagination-h61eq390.stx} +6 -6
- package/dist/{PasswordInput-4xnndp5y.stx → PasswordInput-zv4hm43j.stx} +2 -2
- package/dist/{PaymentMethods-jxba6kek.stx → PaymentMethods-j42jsk5x.stx} +3 -3
- package/dist/{Popover-scbqatjq.stx → Popover-469gbt6r.stx} +1 -1
- package/dist/{PopoverButton-rbxhzj4k.stx → PopoverButton-fnaqc77g.stx} +1 -1
- package/dist/{PopoverPanel-9ng1rm6e.stx → PopoverPanel-y0vtf5w9.stx} +1 -1
- package/dist/{Portal-j111yvqp.stx → Portal-s2q37yp0.stx} +1 -1
- package/dist/{Progress-gbmw3akr.stx → Progress-vmdkm06p.stx} +1 -1
- package/dist/{Radio-1n9qamv1.stx → Radio-04bs3d21.stx} +1 -1
- package/dist/{RadioGroup-12dw2vhk.stx → RadioGroup-bvb1mrhd.stx} +1 -1
- package/dist/{RadioGroupDescription-bjm3mdht.stx → RadioGroupDescription-yej78fak.stx} +1 -1
- package/dist/{ListboxLabel-aky8a73n.stx → RadioGroupLabel-7mymt1b8.stx} +1 -1
- package/dist/{RadioGroupOption-9pcxgwmd.stx → RadioGroupOption-cpdwgnhw.stx} +1 -1
- package/dist/{SearchInput-g240e2nq.stx → SearchInput-2521m475.stx} +1 -1
- package/dist/{Select-p9f94b20.stx → Select-g4mmvfv8.stx} +1 -1
- package/dist/{Sidebar-gwxw8q38.stx → Sidebar-40ckbzh8.stx} +1 -1
- package/dist/{SidebarFooter-887kxret.stx → SidebarFooter-hnth56mg.stx} +1 -1
- package/dist/{SidebarHeader-qjeyx0hv.stx → SidebarHeader-3wrte2p2.stx} +1 -1
- package/dist/{SidebarItem-4dpwtmb4.stx → SidebarItem-zqtvvzpc.stx} +1 -1
- package/dist/{SidebarSection-kh92fk4m.stx → SidebarSection-3etwnbjr.stx} +1 -1
- package/dist/{Signup-3nxq5zag.stx → Signup-c4dyv6f3.stx} +1 -1
- package/dist/{Skeleton-g0nx1njm.stx → Skeleton-v1pwa8nr.stx} +1 -1
- package/dist/{Spinner-w4zj58xp.stx → Spinner-7dahavkd.stx} +1 -1
- package/dist/{Stepper-rwc5actp.stx → Stepper-rgbk76hd.stx} +1 -1
- package/dist/{StepperStep-h0k657nm.stx → StepperStep-en4r00zv.stx} +1 -1
- package/dist/{SubscriptionCheckout-4cbxdg7w.stx → SubscriptionCheckout-gawjzf3q.stx} +2 -2
- package/dist/{Switch-kjq8qd2p.stx → Switch-036j9vm1.stx} +1 -1
- package/dist/{Table-59j9qwp0.stx → Table-6cx8az9h.stx} +1 -1
- package/dist/{TableBody-reka2gwv.stx → TableBody-wf6t13j9.stx} +1 -1
- package/dist/{TableCell-j7nh4sgr.stx → TableCell-ntx0edbn.stx} +1 -1
- package/dist/{TableHead-ecbrwpqm.stx → TableHead-3k4hnm2k.stx} +1 -1
- package/dist/{TableHeader-jn2shwsv.stx → TableHeader-ydys9rzz.stx} +1 -1
- package/dist/{TableRow-xz8rrxhc.stx → TableRow-z09p2ebf.stx} +1 -1
- package/dist/{Tabs-kb6ex6m7.stx → Tabs-svh721m0.stx} +2 -2
- package/dist/{Teleport-819cg9zm.stx → Teleport-qfch3w0b.stx} +1 -1
- package/dist/{TextInput-zx9kgr79.stx → TextInput-k2kfkgy1.stx} +2 -2
- package/dist/{Textarea-5xvmrb0z.stx → Textarea-szad57dz.stx} +1 -1
- package/dist/{Tooltip-5ehqsy49.stx → Tooltip-em7t551n.stx} +1 -1
- package/dist/{Transition-2j39s044.stx → Transition-0hmr6zxb.stx} +1 -1
- package/dist/{TwoFactorChallenge-2q4gg89m.stx → TwoFactorChallenge-an9yvxvq.stx} +2 -2
- package/dist/{Video-6aq4shh4.stx → Video-crxva65p.stx} +1 -1
- package/dist/{VirtualList-weh5qtm1.stx → VirtualList-cndhjejh.stx} +1 -1
- package/dist/{VirtualTable-59a1eskc.stx → VirtualTable-ng0b48yp.stx} +1 -1
- package/dist/components/CodeBlock.stx +12 -0
- package/dist/components/Footer.stx +8 -0
- package/dist/components/Hero.stx +3 -0
- package/dist/components/Installation.stx +5 -0
- package/dist/index.js +9 -9
- package/dist/ui/accordion/Accordion.stx +10 -0
- package/dist/ui/audio/Audio.stx +11 -0
- package/dist/ui/auth/Login.stx +10 -0
- package/dist/ui/auth/Signup.stx +5 -0
- package/dist/ui/auth/TwoFactorChallenge.stx +9 -0
- package/dist/ui/avatar/Avatar.stx +15 -0
- package/dist/ui/badge/Badge.stx +9 -0
- package/dist/ui/breadcrumb/Breadcrumb.stx +9 -0
- package/dist/ui/button/Button.stx +14 -0
- package/dist/ui/button/index.d.ts +2 -2
- package/dist/ui/calendar/Calendar.stx +10 -0
- package/dist/ui/card/Card.stx +12 -0
- package/dist/ui/checkbox/Checkbox.stx +15 -0
- package/dist/ui/combobox/Combobox.stx +4 -0
- package/dist/ui/combobox/ComboboxButton.stx +2 -0
- package/dist/ui/combobox/ComboboxInput.stx +8 -0
- package/dist/ui/combobox/ComboboxOption.stx +13 -0
- package/dist/ui/combobox/ComboboxOptions.stx +3 -0
- package/dist/ui/command-palette/CommandPalette.stx +8 -0
- package/dist/ui/command-palette/CommandPaletteItem.stx +8 -0
- package/dist/ui/dialog/Dialog.stx +5 -0
- package/dist/ui/dialog/DialogBackdrop.stx +2 -0
- package/dist/ui/dialog/DialogDescription.stx +2 -0
- package/dist/ui/dialog/DialogPanel.stx +2 -0
- package/dist/ui/dialog/DialogTitle.stx +2 -0
- package/dist/ui/drawer/Drawer.stx +9 -0
- package/dist/ui/dropdown/Dropdown.stx +7 -0
- package/dist/ui/dropdown/DropdownButton.stx +6 -0
- package/dist/ui/dropdown/DropdownItem.stx +10 -0
- package/dist/ui/dropdown/DropdownItems.stx +3 -0
- package/dist/ui/form/Form.stx +11 -0
- package/dist/ui/form/index.d.ts +2 -2
- package/dist/ui/image/Image.stx +26 -0
- package/dist/ui/input/EmailInput.stx +11 -0
- package/dist/ui/input/NumberInput.stx +19 -0
- package/dist/ui/input/PasswordInput.stx +19 -0
- package/dist/ui/input/SearchInput.stx +12 -0
- package/dist/ui/input/TextInput.stx +22 -0
- package/dist/ui/input/index.d.ts +6 -6
- package/dist/ui/listbox/Listbox.stx +5 -0
- package/dist/ui/listbox/ListboxButton.stx +3 -0
- package/dist/ui/listbox/ListboxLabel.stx +2 -0
- package/dist/ui/listbox/ListboxOption.stx +13 -0
- package/dist/ui/listbox/ListboxOptions.stx +3 -0
- package/dist/ui/navigator/Navigator.stx +8 -0
- package/dist/ui/notification/Notification.stx +12 -0
- package/dist/ui/pagination/Pagination.stx +12 -0
- package/dist/ui/payment/Checkout.stx +13 -0
- package/dist/ui/payment/DefaultPaymentMethod.stx +4 -0
- package/dist/ui/payment/PaymentMethods.stx +6 -0
- package/dist/ui/payment/SubscriptionCheckout.stx +191 -0
- package/dist/ui/popover/Popover.stx +7 -0
- package/dist/ui/popover/PopoverButton.stx +6 -0
- package/dist/ui/popover/PopoverPanel.stx +4 -0
- package/dist/ui/portal/Portal.stx +2 -0
- package/dist/ui/progress/Progress.stx +14 -0
- package/dist/ui/radio/Radio.stx +14 -0
- package/dist/ui/radio-group/RadioGroup.stx +4 -0
- package/dist/ui/radio-group/RadioGroupDescription.stx +2 -0
- package/dist/ui/radio-group/RadioGroupLabel.stx +2 -0
- package/dist/ui/radio-group/RadioGroupOption.stx +13 -0
- package/dist/ui/select/Select.stx +14 -0
- package/dist/ui/sidebar/Sidebar.stx +33 -0
- package/dist/ui/sidebar/SidebarFooter.stx +27 -0
- package/dist/ui/sidebar/SidebarHeader.stx +26 -0
- package/dist/ui/sidebar/SidebarItem.stx +28 -0
- package/dist/ui/sidebar/SidebarSection.stx +25 -0
- package/dist/ui/skeleton/Skeleton.stx +9 -0
- package/dist/ui/spinner/Spinner.stx +9 -0
- package/dist/ui/stepper/Stepper.stx +4 -0
- package/dist/ui/stepper/StepperStep.stx +12 -0
- package/dist/ui/switch/Switch.stx +15 -0
- package/dist/ui/table/Table.stx +3 -0
- package/dist/ui/table/TableBody.stx +1 -0
- package/dist/ui/table/TableCell.stx +1 -0
- package/dist/ui/table/TableHead.stx +1 -0
- package/dist/ui/table/TableHeader.stx +3 -0
- package/dist/ui/table/TableRow.stx +2 -0
- package/dist/ui/tabs/Tabs.stx +9 -0
- package/dist/ui/teleport/Teleport.stx +3 -0
- package/dist/ui/textarea/Textarea.stx +18 -0
- package/dist/ui/tooltip/Tooltip.stx +9 -0
- package/dist/ui/transition/Transition.stx +27 -0
- package/dist/ui/video/Video.stx +15 -0
- package/dist/ui/virtual-list/VirtualList.stx +9 -0
- package/dist/ui/virtual-table/VirtualTable.stx +16 -0
- package/dist/utils/accessibility.d.ts +10 -25
- package/dist/utils/animation/easing.d.ts +75 -0
- package/dist/utils/error-handling.d.ts +8 -21
- package/dist/utils/i18n.d.ts +36 -86
- package/package.json +5 -3
- package/src/ui/accordion/Accordion.stx +2 -2
- package/src/ui/audio/Audio.stx +1 -1
- package/src/ui/audio/README.md +5 -6
- package/src/ui/auth/Login.stx +1 -1
- package/src/ui/auth/README.md +30 -33
- package/src/ui/auth/Signup.stx +1 -1
- package/src/ui/auth/TwoFactorChallenge.stx +2 -2
- package/src/ui/avatar/Avatar.stx +1 -1
- package/src/ui/badge/Badge.stx +2 -2
- package/src/ui/breadcrumb/Breadcrumb.stx +1 -1
- package/src/ui/button/Button.stx +2 -2
- package/src/ui/button/README.md +12 -32
- package/src/ui/calendar/Calendar.stx +5 -5
- package/src/ui/card/Card.stx +2 -2
- package/src/ui/checkbox/Checkbox.stx +1 -1
- package/src/ui/combobox/Combobox.stx +1 -1
- package/src/ui/combobox/ComboboxButton.stx +1 -1
- package/src/ui/combobox/ComboboxInput.stx +1 -1
- package/src/ui/combobox/ComboboxOption.stx +1 -1
- package/src/ui/combobox/ComboboxOptions.stx +1 -1
- package/src/ui/combobox/README.md +25 -29
- package/src/ui/command-palette/CommandPalette.stx +1 -1
- package/src/ui/command-palette/CommandPaletteItem.stx +1 -1
- package/src/ui/command-palette/README.md +8 -8
- package/src/ui/dialog/Dialog.stx +1 -1
- package/src/ui/dialog/DialogBackdrop.stx +1 -1
- package/src/ui/dialog/DialogDescription.stx +1 -1
- package/src/ui/dialog/DialogPanel.stx +1 -1
- package/src/ui/dialog/DialogTitle.stx +1 -1
- package/src/ui/dialog/README.md +26 -38
- package/src/ui/drawer/Drawer.stx +3 -3
- package/src/ui/drawer/README.md +13 -33
- package/src/ui/dropdown/Dropdown.stx +1 -1
- package/src/ui/dropdown/DropdownButton.stx +1 -1
- package/src/ui/dropdown/DropdownItem.stx +1 -1
- package/src/ui/dropdown/DropdownItems.stx +1 -1
- package/src/ui/dropdown/README.md +28 -56
- package/src/ui/form/Form.stx +1 -1
- package/src/ui/image/Image.stx +1 -1
- package/src/ui/image/README.md +45 -52
- package/src/ui/input/EmailInput.stx +1 -1
- package/src/ui/input/NumberInput.stx +3 -3
- package/src/ui/input/PasswordInput.stx +2 -2
- package/src/ui/input/SearchInput.stx +1 -1
- package/src/ui/input/TextInput.stx +2 -2
- package/src/ui/listbox/Listbox.stx +1 -1
- package/src/ui/listbox/ListboxButton.stx +1 -1
- package/src/ui/listbox/ListboxLabel.stx +1 -1
- package/src/ui/listbox/ListboxOption.stx +1 -1
- package/src/ui/listbox/ListboxOptions.stx +1 -1
- package/src/ui/listbox/README.md +21 -29
- package/src/ui/navigator/Navigator.stx +3 -3
- package/src/ui/notification/Notification.stx +1 -1
- package/src/ui/notification/README.md +28 -32
- package/src/ui/pagination/Pagination.stx +6 -6
- package/src/ui/payment/Checkout.stx +1 -1
- package/src/ui/payment/DefaultPaymentMethod.stx +1 -1
- package/src/ui/payment/PaymentMethods.stx +3 -3
- package/src/ui/payment/README.md +59 -141
- package/src/ui/payment/SubscriptionCheckout.stx +2 -2
- package/src/ui/popover/Popover.stx +1 -1
- package/src/ui/popover/PopoverButton.stx +1 -1
- package/src/ui/popover/PopoverPanel.stx +1 -1
- package/src/ui/popover/README.md +10 -14
- package/src/ui/portal/Portal.stx +1 -1
- package/src/ui/progress/Progress.stx +1 -1
- package/src/ui/radio/Radio.stx +1 -1
- package/src/ui/radio-group/README.md +29 -35
- package/src/ui/radio-group/RadioGroup.stx +1 -1
- package/src/ui/radio-group/RadioGroupDescription.stx +1 -1
- package/src/ui/radio-group/RadioGroupLabel.stx +1 -1
- package/src/ui/radio-group/RadioGroupOption.stx +1 -1
- package/src/ui/select/README.md +49 -73
- package/src/ui/select/Select.stx +1 -1
- package/src/ui/sidebar/Sidebar.stx +1 -1
- package/src/ui/sidebar/SidebarFooter.stx +1 -1
- package/src/ui/sidebar/SidebarHeader.stx +1 -1
- package/src/ui/sidebar/SidebarItem.stx +1 -1
- package/src/ui/sidebar/SidebarSection.stx +1 -1
- package/src/ui/skeleton/Skeleton.stx +1 -1
- package/src/ui/spinner/Spinner.stx +1 -1
- package/src/ui/stepper/README.md +8 -8
- package/src/ui/stepper/Stepper.stx +1 -1
- package/src/ui/stepper/StepperStep.stx +1 -1
- package/src/ui/switch/README.md +10 -29
- package/src/ui/switch/Switch.stx +1 -1
- package/src/ui/table/README.md +17 -17
- package/src/ui/table/Table.stx +1 -1
- package/src/ui/table/TableBody.stx +1 -1
- package/src/ui/table/TableCell.stx +1 -1
- package/src/ui/table/TableHead.stx +1 -1
- package/src/ui/table/TableHeader.stx +1 -1
- package/src/ui/table/TableRow.stx +1 -1
- package/src/ui/tabs/Tabs.stx +2 -2
- package/src/ui/teleport/Teleport.stx +1 -1
- package/src/ui/textarea/Textarea.stx +1 -1
- package/src/ui/tooltip/Tooltip.stx +1 -1
- package/src/ui/transition/README.md +4 -4
- package/src/ui/transition/Transition.stx +1 -1
- package/src/ui/video/README.md +7 -8
- package/src/ui/video/Video.stx +1 -1
- package/src/ui/virtual-list/VirtualList.stx +1 -1
- package/src/ui/virtual-table/VirtualTable.stx +1 -1
package/src/ui/payment/README.md
CHANGED
|
@@ -2,50 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Comprehensive payment components for Stripe integration, including payment method management and checkout flows.
|
|
4
4
|
|
|
5
|
-
## Component Syntax
|
|
6
|
-
|
|
7
|
-
stx supports multiple ways to use components:
|
|
8
|
-
|
|
9
|
-
### 1. @component Directive with Object Shorthand (Recommended)
|
|
10
|
-
```stx
|
|
11
|
-
@component('Checkout', {
|
|
12
|
-
products,
|
|
13
|
-
stripePublicKey,
|
|
14
|
-
apiUrl
|
|
15
|
-
})
|
|
16
|
-
@endcomponent
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
### 2. @component Directive with Full Props
|
|
20
|
-
```stx
|
|
21
|
-
@component('Checkout', {
|
|
22
|
-
products: products,
|
|
23
|
-
stripePublicKey: stripePublicKey,
|
|
24
|
-
apiUrl: apiUrl
|
|
25
|
-
})
|
|
26
|
-
@endcomponent
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
### 3. PascalCase Component Tags (Vue-like)
|
|
30
|
-
```stx
|
|
31
|
-
<Checkout
|
|
32
|
-
:products="products"
|
|
33
|
-
:stripePublicKey="stripePublicKey"
|
|
34
|
-
:apiUrl="apiUrl"
|
|
35
|
-
/>
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### 4. PascalCase with Static Values
|
|
39
|
-
```stx
|
|
40
|
-
<Checkout
|
|
41
|
-
products="[]"
|
|
42
|
-
stripePublicKey="pk_test_..."
|
|
43
|
-
apiUrl="https://api.example.com"
|
|
44
|
-
/>
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
All syntaxes are equivalent and can be used interchangeably based on your preference.
|
|
48
|
-
|
|
49
5
|
## Installation
|
|
50
6
|
|
|
51
7
|
```bash
|
|
@@ -68,13 +24,11 @@ Display the default payment method with a badge.
|
|
|
68
24
|
|
|
69
25
|
## Usage
|
|
70
26
|
|
|
71
|
-
### Checkout Component
|
|
72
|
-
|
|
73
|
-
**Using @component directive with object shorthand:**
|
|
27
|
+
### Checkout Component
|
|
74
28
|
|
|
75
29
|
```stx
|
|
76
|
-
<script>
|
|
77
|
-
|
|
30
|
+
<script server>
|
|
31
|
+
const products = [
|
|
78
32
|
{
|
|
79
33
|
id: 1,
|
|
80
34
|
name: 'Premium Subscription',
|
|
@@ -84,58 +38,34 @@ export const products = [
|
|
|
84
38
|
}
|
|
85
39
|
]
|
|
86
40
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
41
|
+
const mode = 'subscription'
|
|
42
|
+
const stripePublicKey = 'pk_test_...'
|
|
43
|
+
const apiUrl = 'https://api.example.com'
|
|
44
|
+
const redirectUrl = '/thank-you'
|
|
45
|
+
const shipping = 4500
|
|
46
|
+
const taxes = 552
|
|
93
47
|
|
|
94
|
-
|
|
48
|
+
const onSubmit = (result) => {
|
|
95
49
|
if (result.success) {
|
|
96
50
|
console.log('Payment successful!')
|
|
97
51
|
window.location.href = redirectUrl
|
|
98
52
|
}
|
|
99
53
|
}
|
|
100
54
|
|
|
101
|
-
|
|
55
|
+
const onRemoveProduct = (productId) => {
|
|
102
56
|
console.log('Remove product:', productId)
|
|
103
57
|
// Update cart state
|
|
104
58
|
}
|
|
105
59
|
</script>
|
|
106
60
|
|
|
107
|
-
@component('Checkout', {
|
|
108
|
-
products,
|
|
109
|
-
mode,
|
|
110
|
-
stripePublicKey,
|
|
111
|
-
apiUrl,
|
|
112
|
-
redirectUrl,
|
|
113
|
-
shipping,
|
|
114
|
-
taxes,
|
|
115
|
-
onSubmit,
|
|
116
|
-
onRemoveProduct
|
|
117
|
-
})
|
|
118
|
-
@endcomponent
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
**Or using Vue-like PascalCase syntax:**
|
|
122
|
-
|
|
123
|
-
```stx
|
|
124
|
-
<script>
|
|
125
|
-
export const products = [...]
|
|
126
|
-
export const stripePublicKey = 'pk_test_...'
|
|
127
|
-
export const apiUrl = 'https://api.example.com'
|
|
128
|
-
// ... other exports
|
|
129
|
-
</script>
|
|
130
|
-
|
|
131
61
|
<Checkout
|
|
132
62
|
:products="products"
|
|
133
|
-
mode="
|
|
63
|
+
:mode="mode"
|
|
134
64
|
:stripePublicKey="stripePublicKey"
|
|
135
65
|
:apiUrl="apiUrl"
|
|
136
|
-
redirectUrl="
|
|
137
|
-
:shipping="
|
|
138
|
-
:taxes="
|
|
66
|
+
:redirectUrl="redirectUrl"
|
|
67
|
+
:shipping="shipping"
|
|
68
|
+
:taxes="taxes"
|
|
139
69
|
:onSubmit="onSubmit"
|
|
140
70
|
:onRemoveProduct="onRemoveProduct"
|
|
141
71
|
/>
|
|
@@ -144,8 +74,8 @@ export const apiUrl = 'https://api.example.com'
|
|
|
144
74
|
### PaymentMethods Component
|
|
145
75
|
|
|
146
76
|
```stx
|
|
147
|
-
<script>
|
|
148
|
-
|
|
77
|
+
<script server>
|
|
78
|
+
const methods = [
|
|
149
79
|
{
|
|
150
80
|
id: 1,
|
|
151
81
|
brand: 'Visa',
|
|
@@ -162,31 +92,29 @@ export const methods = [
|
|
|
162
92
|
}
|
|
163
93
|
]
|
|
164
94
|
|
|
165
|
-
|
|
95
|
+
const handleDelete = (id) => {
|
|
166
96
|
console.log('Delete payment method:', id)
|
|
167
97
|
// Call your API to delete
|
|
168
98
|
}
|
|
169
99
|
|
|
170
|
-
|
|
100
|
+
const handleMakeDefault = (id) => {
|
|
171
101
|
console.log('Make default:', id)
|
|
172
102
|
// Call your API to set as default
|
|
173
103
|
}
|
|
174
104
|
</script>
|
|
175
105
|
|
|
176
|
-
|
|
177
|
-
paymentMethods
|
|
178
|
-
onDeletePaymentMethod
|
|
179
|
-
onMakeDefault
|
|
180
|
-
|
|
181
|
-
})
|
|
182
|
-
@endcomponent
|
|
106
|
+
<PaymentMethods
|
|
107
|
+
:paymentMethods="methods"
|
|
108
|
+
:onDeletePaymentMethod="handleDelete"
|
|
109
|
+
:onMakeDefault="handleMakeDefault"
|
|
110
|
+
/>
|
|
183
111
|
```
|
|
184
112
|
|
|
185
113
|
### DefaultPaymentMethod Component
|
|
186
114
|
|
|
187
115
|
```stx
|
|
188
|
-
<script>
|
|
189
|
-
|
|
116
|
+
<script server>
|
|
117
|
+
const defaultMethod = {
|
|
190
118
|
id: 1,
|
|
191
119
|
brand: 'Visa',
|
|
192
120
|
last_four: '4242',
|
|
@@ -195,18 +123,14 @@ export const defaultMethod = {
|
|
|
195
123
|
}
|
|
196
124
|
</script>
|
|
197
125
|
|
|
198
|
-
|
|
199
|
-
paymentMethod: defaultMethod,
|
|
200
|
-
isLoading: false
|
|
201
|
-
})
|
|
202
|
-
@endcomponent
|
|
126
|
+
<DefaultPaymentMethod :paymentMethod="defaultMethod" />
|
|
203
127
|
```
|
|
204
128
|
|
|
205
129
|
### SubscriptionCheckout Component
|
|
206
130
|
|
|
207
131
|
```stx
|
|
208
|
-
<script>
|
|
209
|
-
|
|
132
|
+
<script server>
|
|
133
|
+
const cartProducts = [
|
|
210
134
|
{
|
|
211
135
|
id: 1,
|
|
212
136
|
name: 'Premium Subscription',
|
|
@@ -216,7 +140,7 @@ export const cartProducts = [
|
|
|
216
140
|
}
|
|
217
141
|
]
|
|
218
142
|
|
|
219
|
-
|
|
143
|
+
const handleCheckoutComplete = (result) => {
|
|
220
144
|
if (result.success) {
|
|
221
145
|
console.log('Payment successful!')
|
|
222
146
|
// Redirect to success page
|
|
@@ -224,15 +148,14 @@ export const handleCheckoutComplete = (result) => {
|
|
|
224
148
|
}
|
|
225
149
|
</script>
|
|
226
150
|
|
|
227
|
-
|
|
228
|
-
products
|
|
229
|
-
stripePublicKey
|
|
230
|
-
apiUrl
|
|
231
|
-
shipping
|
|
232
|
-
taxes
|
|
233
|
-
onSubmit
|
|
234
|
-
|
|
235
|
-
@endcomponent
|
|
151
|
+
<SubscriptionCheckout
|
|
152
|
+
:products="cartProducts"
|
|
153
|
+
stripePublicKey="pk_test_..."
|
|
154
|
+
apiUrl="https://api.example.com/payments"
|
|
155
|
+
:shipping="4500"
|
|
156
|
+
:taxes="552"
|
|
157
|
+
:onSubmit="handleCheckoutComplete"
|
|
158
|
+
/>
|
|
236
159
|
```
|
|
237
160
|
|
|
238
161
|
## Props
|
|
@@ -362,30 +285,30 @@ Use any future expiration date and any 3-digit CVC.
|
|
|
362
285
|
## Example: Full Payment Flow
|
|
363
286
|
|
|
364
287
|
```stx
|
|
365
|
-
<script>
|
|
288
|
+
<script server>
|
|
366
289
|
// Fetch payment methods
|
|
367
|
-
|
|
290
|
+
const paymentMethods = await fetch('/api/payment-methods').then(r => r.json())
|
|
368
291
|
|
|
369
292
|
// Fetch default payment method
|
|
370
|
-
|
|
293
|
+
const defaultMethod = paymentMethods.find(m => m.is_default)
|
|
371
294
|
|
|
372
295
|
// Cart products
|
|
373
|
-
|
|
296
|
+
const cart = [
|
|
374
297
|
{ id: 1, name: 'Product 1', price: 5000, quantity: 2 },
|
|
375
298
|
{ id: 2, name: 'Product 2', price: 3000, quantity: 1 },
|
|
376
299
|
]
|
|
377
300
|
|
|
378
|
-
|
|
301
|
+
const handleDelete = async (id) => {
|
|
379
302
|
await fetch(`/api/payment-methods/${id}`, { method: 'DELETE' })
|
|
380
303
|
// Refetch payment methods
|
|
381
304
|
}
|
|
382
305
|
|
|
383
|
-
|
|
306
|
+
const handleMakeDefault = async (id) => {
|
|
384
307
|
await fetch(`/api/payment-methods/${id}/default`, { method: 'POST' })
|
|
385
308
|
// Refetch payment methods
|
|
386
309
|
}
|
|
387
310
|
|
|
388
|
-
|
|
311
|
+
const handleCheckout = (result) => {
|
|
389
312
|
if (result.success) {
|
|
390
313
|
window.location.href = '/thank-you'
|
|
391
314
|
}
|
|
@@ -393,29 +316,24 @@ export const handleCheckout = (result) => {
|
|
|
393
316
|
</script>
|
|
394
317
|
|
|
395
318
|
<!-- Default Payment Method -->
|
|
396
|
-
|
|
397
|
-
paymentMethod: defaultMethod
|
|
398
|
-
})
|
|
399
|
-
@endcomponent
|
|
319
|
+
<DefaultPaymentMethod :paymentMethod="defaultMethod" />
|
|
400
320
|
|
|
401
321
|
<!-- All Payment Methods -->
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
onDeletePaymentMethod
|
|
405
|
-
onMakeDefault
|
|
406
|
-
|
|
407
|
-
@endcomponent
|
|
322
|
+
<PaymentMethods
|
|
323
|
+
:paymentMethods="paymentMethods"
|
|
324
|
+
:onDeletePaymentMethod="handleDelete"
|
|
325
|
+
:onMakeDefault="handleMakeDefault"
|
|
326
|
+
/>
|
|
408
327
|
|
|
409
328
|
<!-- Checkout Form -->
|
|
410
|
-
|
|
411
|
-
products
|
|
412
|
-
stripePublicKey
|
|
413
|
-
apiUrl
|
|
414
|
-
shipping
|
|
415
|
-
taxes
|
|
416
|
-
onSubmit
|
|
417
|
-
|
|
418
|
-
@endcomponent
|
|
329
|
+
<SubscriptionCheckout
|
|
330
|
+
:products="cart"
|
|
331
|
+
stripePublicKey="pk_test_..."
|
|
332
|
+
apiUrl="https://api.example.com/payments"
|
|
333
|
+
:shipping="1000"
|
|
334
|
+
:taxes="800"
|
|
335
|
+
:onSubmit="handleCheckout"
|
|
336
|
+
/>
|
|
419
337
|
```
|
|
420
338
|
|
|
421
339
|
## Security Notes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script server>
|
|
2
2
|
export const products = $props.products || []
|
|
3
3
|
export const stripePublicKey = $props.stripePublicKey || ''
|
|
4
4
|
export const apiUrl = $props.apiUrl || ''
|
|
@@ -144,7 +144,7 @@ export const containerClasses = `bg-gray-50 dark:bg-blue-gray-900 ${className}`.
|
|
|
144
144
|
<button
|
|
145
145
|
type="button"
|
|
146
146
|
class="flex items-center justify-center bg-white dark:bg-blue-gray-700 p-2.5 text-gray-400 dark:text-gray-500 -m-2.5 hover:text-gray-500 dark:hover:text-gray-400"
|
|
147
|
-
|
|
147
|
+
@click="handleRemoveProduct('{{ product.id }}')"
|
|
148
148
|
title="Remove"
|
|
149
149
|
>
|
|
150
150
|
<span class="sr-only">Remove</span>
|
package/src/ui/popover/README.md
CHANGED
|
@@ -11,19 +11,19 @@ bun add @stacksjs/components
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
13
|
```stx
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
<Popover>
|
|
15
|
+
<PopoverButton className="px-4 py-2 bg-blue-500 text-white rounded">
|
|
16
16
|
Solutions
|
|
17
|
-
|
|
17
|
+
</PopoverButton>
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
<PopoverPanel className="w-64">
|
|
20
20
|
<div class="grid gap-4">
|
|
21
21
|
<a href="/analytics">Analytics</a>
|
|
22
22
|
<a href="/engagement">Engagement</a>
|
|
23
23
|
<a href="/security">Security</a>
|
|
24
24
|
</div>
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
</PopoverPanel>
|
|
26
|
+
</Popover>
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
## Props
|
|
@@ -55,7 +55,7 @@ bun add @stacksjs/components
|
|
|
55
55
|
### Solutions Menu
|
|
56
56
|
|
|
57
57
|
```stx
|
|
58
|
-
|
|
58
|
+
<PopoverPanel className="w-80">
|
|
59
59
|
<div class="grid gap-8">
|
|
60
60
|
<a href="/analytics" class="flex items-start gap-4 group">
|
|
61
61
|
<div class="shrink-0 text-blue-500">
|
|
@@ -69,19 +69,15 @@ bun add @stacksjs/components
|
|
|
69
69
|
</div>
|
|
70
70
|
</a>
|
|
71
71
|
</div>
|
|
72
|
-
|
|
72
|
+
</PopoverPanel>
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
### Different Positions
|
|
76
76
|
|
|
77
77
|
```stx
|
|
78
|
-
|
|
79
|
-
Content appears above
|
|
80
|
-
@endcomponent
|
|
78
|
+
<PopoverPanel position="top">Content appears above</PopoverPanel>
|
|
81
79
|
|
|
82
|
-
|
|
83
|
-
Content appears to the left
|
|
84
|
-
@endcomponent
|
|
80
|
+
<PopoverPanel position="left">Content appears to the left</PopoverPanel>
|
|
85
81
|
```
|
|
86
82
|
|
|
87
83
|
## Features
|
package/src/ui/portal/Portal.stx
CHANGED
package/src/ui/radio/Radio.stx
CHANGED
|
@@ -11,27 +11,25 @@ bun add @stacksjs/components
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
13
|
```stx
|
|
14
|
-
<script>
|
|
15
|
-
|
|
14
|
+
<script server>
|
|
15
|
+
let selected = 'option1'
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
function handleChange(value) {
|
|
18
18
|
selected = value
|
|
19
19
|
}
|
|
20
20
|
</script>
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
Choose an option
|
|
25
|
-
@endcomponent
|
|
22
|
+
<RadioGroup :value="selected" :onChange="handleChange">
|
|
23
|
+
<RadioGroupLabel>Choose an option</RadioGroupLabel>
|
|
26
24
|
|
|
27
|
-
|
|
25
|
+
<RadioGroupOption value="option1" :currentValue="selected" :onChange="handleChange">
|
|
28
26
|
Option 1
|
|
29
|
-
|
|
27
|
+
</RadioGroupOption>
|
|
30
28
|
|
|
31
|
-
|
|
29
|
+
<RadioGroupOption value="option2" :currentValue="selected" :onChange="handleChange">
|
|
32
30
|
Option 2
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
</RadioGroupOption>
|
|
32
|
+
</RadioGroup>
|
|
35
33
|
```
|
|
36
34
|
|
|
37
35
|
## Props
|
|
@@ -71,44 +69,40 @@ export function handleChange(value) {
|
|
|
71
69
|
### Server Plans
|
|
72
70
|
|
|
73
71
|
```stx
|
|
74
|
-
<script>
|
|
75
|
-
|
|
72
|
+
<script server>
|
|
73
|
+
const plans = [
|
|
76
74
|
{ name: 'Startup', ram: '12GB', cpus: '6 CPUs', disk: '160 GB SSD' },
|
|
77
75
|
{ name: 'Business', ram: '16GB', cpus: '8 CPUs', disk: '512 GB SSD' },
|
|
78
76
|
{ name: 'Enterprise', ram: '32GB', cpus: '12 CPUs', disk: '1024 GB SSD' }
|
|
79
77
|
]
|
|
80
78
|
|
|
81
|
-
|
|
79
|
+
let selected = plans[0]
|
|
82
80
|
|
|
83
|
-
|
|
81
|
+
function handleChange(plan) {
|
|
84
82
|
selected = plan
|
|
85
83
|
}
|
|
86
84
|
</script>
|
|
87
85
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
Server size
|
|
91
|
-
@endcomponent
|
|
86
|
+
<RadioGroup :value="selected" :onChange="handleChange">
|
|
87
|
+
<RadioGroupLabel className="sr-only">Server size</RadioGroupLabel>
|
|
92
88
|
|
|
93
89
|
<div class="space-y-2">
|
|
94
90
|
@foreach(plan in plans)
|
|
95
|
-
|
|
96
|
-
value
|
|
97
|
-
currentValue
|
|
98
|
-
onChange
|
|
99
|
-
|
|
91
|
+
<RadioGroupOption
|
|
92
|
+
:value="plan"
|
|
93
|
+
:currentValue="selected"
|
|
94
|
+
:onChange="handleChange"
|
|
95
|
+
>
|
|
100
96
|
<div class="w-full flex items-center justify-between">
|
|
101
97
|
<div class="flex items-center">
|
|
102
98
|
<div class="text-sm">
|
|
103
|
-
|
|
104
|
-
className: 'font-medium'
|
|
105
|
-
})
|
|
99
|
+
<RadioGroupLabel className="font-medium">
|
|
106
100
|
{{ plan.name }}
|
|
107
|
-
|
|
101
|
+
</RadioGroupLabel>
|
|
108
102
|
|
|
109
|
-
|
|
103
|
+
<RadioGroupDescription>
|
|
110
104
|
{{ plan.ram }}/{{ plan.cpus }} · {{ plan.disk }}
|
|
111
|
-
|
|
105
|
+
</RadioGroupDescription>
|
|
112
106
|
</div>
|
|
113
107
|
</div>
|
|
114
108
|
|
|
@@ -119,18 +113,18 @@ export function handleChange(plan) {
|
|
|
119
113
|
</svg>
|
|
120
114
|
@endif
|
|
121
115
|
</div>
|
|
122
|
-
|
|
116
|
+
</RadioGroupOption>
|
|
123
117
|
@endforeach
|
|
124
118
|
</div>
|
|
125
|
-
|
|
119
|
+
</RadioGroup>
|
|
126
120
|
```
|
|
127
121
|
|
|
128
122
|
### With Disabled Option
|
|
129
123
|
|
|
130
124
|
```stx
|
|
131
|
-
|
|
125
|
+
<RadioGroupOption value="disabled" disabled>
|
|
132
126
|
This option is disabled
|
|
133
|
-
|
|
127
|
+
</RadioGroupOption>
|
|
134
128
|
```
|
|
135
129
|
|
|
136
130
|
## Features
|