@vendure/dashboard 3.5.0-minor-202510031341 → 3.5.0-minor-202510161257

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 (220) hide show
  1. package/dist/plugin/dashboard.plugin.js +1 -1
  2. package/dist/plugin/default-page.html +1 -1
  3. package/dist/vite/utils/ast-utils.spec.js +3 -3
  4. package/dist/vite/utils/tsconfig-utils.js +2 -1
  5. package/dist/vite/vite-plugin-hmr.d.ts +8 -0
  6. package/dist/vite/vite-plugin-hmr.js +34 -0
  7. package/dist/vite/vite-plugin-theme.js +6 -6
  8. package/dist/vite/vite-plugin-transform-index.js +6 -1
  9. package/dist/vite/vite-plugin-vendure-dashboard.d.ts +31 -4
  10. package/dist/vite/vite-plugin-vendure-dashboard.js +89 -34
  11. package/package.json +18 -5
  12. package/src/app/app-providers.tsx +4 -1
  13. package/src/app/common/map-faceted-filter-fields.ts +21 -0
  14. package/src/app/main.tsx +3 -1
  15. package/src/app/routes/_authenticated/_administrators/administrators.graphql.ts +2 -2
  16. package/src/app/routes/_authenticated/_administrators/administrators.tsx +13 -3
  17. package/src/app/routes/_authenticated/_administrators/administrators_.$id.tsx +6 -13
  18. package/src/app/routes/_authenticated/_administrators/components/role-permissions-display.tsx +1 -1
  19. package/src/app/routes/_authenticated/_assets/assets.tsx +17 -1
  20. package/src/app/routes/_authenticated/_collections/collections.graphql.ts +1 -0
  21. package/src/app/routes/_authenticated/_collections/collections.tsx +5 -0
  22. package/src/app/routes/_authenticated/_collections/components/collection-bulk-actions.tsx +0 -1
  23. package/src/app/routes/_authenticated/_customers/customers.tsx +9 -5
  24. package/src/app/routes/_authenticated/_facets/components/facet-bulk-actions.tsx +0 -6
  25. package/src/app/routes/_authenticated/_facets/components/facet-value-bulk-actions.tsx +16 -0
  26. package/src/app/routes/_authenticated/_facets/components/facet-values-table.tsx +43 -12
  27. package/src/app/routes/_authenticated/_facets/facets_.$facetId.values_.$id.tsx +14 -5
  28. package/src/app/routes/_authenticated/_global-settings/global-settings.tsx +4 -8
  29. package/src/app/routes/_authenticated/_global-settings/utils/global-languages.ts +268 -0
  30. package/src/app/routes/_authenticated/_orders/components/edit-order-table.tsx +117 -92
  31. package/src/app/routes/_authenticated/_orders/components/order-address.tsx +15 -15
  32. package/src/app/routes/_authenticated/_orders/components/order-detail-shared.tsx +5 -5
  33. package/src/app/routes/_authenticated/_orders/components/order-modification-summary.tsx +2 -1
  34. package/src/app/routes/_authenticated/_orders/components/order-table-totals.tsx +26 -27
  35. package/src/app/routes/_authenticated/_orders/components/order-table.tsx +5 -3
  36. package/src/app/routes/_authenticated/_orders/components/state-transition-control.tsx +6 -9
  37. package/src/app/routes/_authenticated/_orders/orders.graphql.ts +17 -1
  38. package/src/app/routes/_authenticated/_orders/orders_.$id_.modify.tsx +48 -281
  39. package/src/app/routes/_authenticated/_orders/orders_.draft.$id.tsx +59 -40
  40. package/src/app/routes/_authenticated/_orders/utils/order-utils.ts +73 -0
  41. package/src/app/routes/_authenticated/_orders/utils/use-modify-order.ts +312 -0
  42. package/src/app/routes/_authenticated/_payment-methods/payment-methods.graphql.ts +2 -2
  43. package/src/app/routes/_authenticated/_payment-methods/payment-methods.tsx +4 -0
  44. package/src/app/routes/_authenticated/_product-variants/components/add-currency-dropdown.tsx +49 -0
  45. package/src/app/routes/_authenticated/_product-variants/components/add-stock-location-dropdown.tsx +56 -0
  46. package/src/app/routes/_authenticated/_product-variants/product-variants.graphql.ts +12 -0
  47. package/src/app/routes/_authenticated/_product-variants/product-variants_.$id.tsx +178 -50
  48. package/src/app/routes/_authenticated/_products/components/product-bulk-actions.tsx +0 -6
  49. package/src/app/routes/_authenticated/_products/components/product-variants-table.tsx +0 -11
  50. package/src/app/routes/_authenticated/_products/products.tsx +6 -2
  51. package/src/app/routes/_authenticated/_products/products_.$productId.option-groups.$productOptionGroupId.options_.$id.tsx +4 -8
  52. package/src/app/routes/_authenticated/_promotions/components/promotion-bulk-actions.tsx +0 -10
  53. package/src/app/routes/_authenticated/_promotions/promotions.graphql.ts +2 -2
  54. package/src/app/routes/_authenticated/_promotions/promotions.tsx +12 -0
  55. package/src/app/routes/_authenticated/_promotions/promotions_.$id.tsx +3 -10
  56. package/src/app/routes/_authenticated/_sellers/sellers.graphql.ts +2 -2
  57. package/src/app/routes/_authenticated/_shipping-methods/shipping-methods.graphql.ts +2 -2
  58. package/src/app/routes/_authenticated/_shipping-methods/shipping-methods.tsx +4 -0
  59. package/src/app/routes/_authenticated/_shipping-methods/shipping-methods_.$id.tsx +4 -10
  60. package/src/app/routes/_authenticated/_stock-locations/stock-locations.graphql.ts +2 -2
  61. package/src/app/routes/_authenticated/_tax-categories/tax-categories.graphql.ts +2 -2
  62. package/src/app/routes/_authenticated/_tax-rates/tax-rates.tsx +9 -0
  63. package/src/app/routes/_authenticated/_tax-rates/tax-rates_.$id.tsx +1 -0
  64. package/src/app/routes/_authenticated/_zones/zones.graphql.ts +2 -2
  65. package/src/app/routes/login.tsx +2 -2
  66. package/src/i18n/locales/ar.po +420 -289
  67. package/src/i18n/locales/cs.po +420 -289
  68. package/src/i18n/locales/de.po +420 -289
  69. package/src/i18n/locales/en.po +420 -289
  70. package/src/i18n/locales/es.po +420 -289
  71. package/src/i18n/locales/fa.po +420 -289
  72. package/src/i18n/locales/fr.po +468 -337
  73. package/src/i18n/locales/he.po +420 -289
  74. package/src/i18n/locales/hr.po +420 -289
  75. package/src/i18n/locales/it.po +420 -289
  76. package/src/i18n/locales/ja.po +420 -289
  77. package/src/i18n/locales/nb.po +420 -289
  78. package/src/i18n/locales/ne.po +420 -289
  79. package/src/i18n/locales/pl.po +420 -289
  80. package/src/i18n/locales/pt_BR.po +420 -289
  81. package/src/i18n/locales/pt_PT.po +420 -289
  82. package/src/i18n/locales/ru.po +420 -289
  83. package/src/i18n/locales/sv.po +420 -289
  84. package/src/i18n/locales/tr.po +420 -289
  85. package/src/i18n/locales/uk.po +420 -289
  86. package/src/i18n/locales/zh_Hans.po +420 -289
  87. package/src/i18n/locales/zh_Hant.po +420 -289
  88. package/src/lib/components/data-input/affixed-input.stories.tsx +93 -0
  89. package/src/lib/components/data-input/affixed-input.tsx +5 -2
  90. package/src/lib/components/data-input/boolean-input.stories.tsx +102 -0
  91. package/src/lib/components/data-input/checkbox-input.stories.tsx +61 -0
  92. package/src/lib/components/data-input/customer-group-input.tsx +0 -1
  93. package/src/lib/components/data-input/datetime-input.stories.tsx +62 -0
  94. package/src/lib/components/data-input/datetime-input.tsx +27 -13
  95. package/src/lib/components/data-input/default-relation-input.tsx +18 -12
  96. package/src/lib/components/data-input/money-input.stories.tsx +88 -0
  97. package/src/lib/components/data-input/money-input.tsx +7 -11
  98. package/src/lib/components/data-input/number-input.stories.tsx +103 -0
  99. package/src/lib/components/data-input/number-input.tsx +16 -5
  100. package/src/lib/components/data-input/password-input.stories.tsx +65 -0
  101. package/src/lib/components/data-input/rich-text-input.stories.tsx +92 -0
  102. package/src/lib/components/data-input/slug-input.stories.tsx +232 -0
  103. package/src/lib/components/data-input/slug-input.tsx +9 -10
  104. package/src/lib/components/data-input/text-input.stories.tsx +52 -0
  105. package/src/lib/components/data-input/textarea-input.stories.tsx +55 -0
  106. package/src/lib/components/data-table/add-filter-menu.tsx +6 -1
  107. package/src/lib/components/data-table/column-header-wrapper.tsx +106 -0
  108. package/src/lib/components/data-table/data-table-bulk-action-item.tsx +11 -9
  109. package/src/lib/components/data-table/data-table-bulk-actions.tsx +4 -4
  110. package/src/lib/components/data-table/data-table-column-header.tsx +17 -14
  111. package/src/lib/components/data-table/data-table-faceted-filter.tsx +33 -11
  112. package/src/lib/components/data-table/data-table-filter-badge-editable.tsx +35 -0
  113. package/src/lib/components/data-table/data-table-filter-badge.tsx +28 -14
  114. package/src/lib/components/data-table/data-table-filter-dialog.tsx +28 -8
  115. package/src/lib/components/data-table/data-table-pagination.tsx +23 -7
  116. package/src/lib/components/data-table/data-table.stories.tsx +249 -0
  117. package/src/lib/components/data-table/data-table.tsx +39 -11
  118. package/src/lib/components/data-table/filters/data-table-datetime-filter.tsx +79 -34
  119. package/src/lib/components/data-table/use-generated-columns.tsx +55 -27
  120. package/src/lib/components/layout/generated-breadcrumbs.tsx +4 -12
  121. package/src/lib/components/layout/nav-user.tsx +19 -13
  122. package/src/lib/components/login/login-form.tsx +39 -123
  123. package/src/lib/components/shared/alerts.tsx +29 -17
  124. package/src/lib/components/shared/asset/asset-bulk-actions.tsx +3 -3
  125. package/src/lib/components/shared/asset/asset-gallery.stories.tsx +76 -0
  126. package/src/lib/components/shared/asset/asset-gallery.tsx +147 -113
  127. package/src/lib/components/shared/asset/asset-picker-dialog.stories.tsx +58 -0
  128. package/src/lib/components/shared/configurable-operation-input.tsx +1 -1
  129. package/src/lib/components/shared/customer-group-selector.tsx +5 -2
  130. package/src/lib/components/shared/detail-page-button.stories.tsx +52 -0
  131. package/src/lib/components/shared/facet-value-selector.stories.tsx +48 -0
  132. package/src/lib/components/shared/facet-value-selector.tsx +130 -34
  133. package/src/lib/components/shared/paginated-list-data-table.stories.tsx +212 -0
  134. package/src/lib/components/shared/paginated-list-data-table.tsx +12 -12
  135. package/src/lib/components/shared/permission-guard.stories.tsx +46 -0
  136. package/src/lib/components/shared/remove-from-channel-bulk-action.tsx +2 -0
  137. package/src/lib/components/shared/rich-text-editor/responsive-toolbar.tsx +8 -4
  138. package/src/lib/components/shared/rich-text-editor/rich-text-editor.tsx +1 -0
  139. package/src/lib/components/shared/table-cell/order-table-cell-components.tsx +40 -0
  140. package/src/lib/components/shared/vendure-image.stories.tsx +167 -0
  141. package/src/lib/components/shared/vendure-image.tsx +6 -7
  142. package/src/lib/components/ui/accordion.stories.tsx +33 -0
  143. package/src/lib/components/ui/alert-dialog.stories.tsx +48 -0
  144. package/src/lib/components/ui/alert.stories.tsx +35 -0
  145. package/src/lib/components/ui/aspect-ratio.stories.tsx +28 -0
  146. package/src/lib/components/ui/badge.stories.tsx +28 -0
  147. package/src/lib/components/ui/breadcrumb.stories.tsx +41 -0
  148. package/src/lib/components/ui/button.stories.tsx +38 -0
  149. package/src/lib/components/ui/calendar.stories.tsx +22 -0
  150. package/src/lib/components/ui/card.stories.tsx +28 -0
  151. package/src/lib/components/ui/carousel.stories.tsx +34 -0
  152. package/src/lib/components/ui/checkbox.stories.tsx +31 -0
  153. package/src/lib/components/ui/collapsible.stories.tsx +39 -0
  154. package/src/lib/components/ui/command.stories.tsx +44 -0
  155. package/src/lib/components/ui/context-menu.stories.tsx +38 -0
  156. package/src/lib/components/ui/dialog.stories.tsx +52 -0
  157. package/src/lib/components/ui/drawer.stories.tsx +50 -0
  158. package/src/lib/components/ui/dropdown-menu.stories.tsx +41 -0
  159. package/src/lib/components/ui/hover-card.stories.tsx +38 -0
  160. package/src/lib/components/ui/input-group.tsx +148 -0
  161. package/src/lib/components/ui/input-otp.stories.tsx +30 -0
  162. package/src/lib/components/ui/input.stories.tsx +38 -0
  163. package/src/lib/components/ui/label.stories.tsx +24 -0
  164. package/src/lib/components/ui/menubar.stories.tsx +53 -0
  165. package/src/lib/components/ui/navigation-menu.stories.tsx +54 -0
  166. package/src/lib/components/ui/pagination.stories.tsx +51 -0
  167. package/src/lib/components/ui/password-input.stories.tsx +32 -0
  168. package/src/lib/components/ui/password-input.tsx +33 -0
  169. package/src/lib/components/ui/popover.stories.tsx +33 -0
  170. package/src/lib/components/ui/progress.stories.tsx +27 -0
  171. package/src/lib/components/ui/radio-group.stories.tsx +34 -0
  172. package/src/lib/components/ui/resizable.stories.tsx +32 -0
  173. package/src/lib/components/ui/scroll-area.stories.tsx +31 -0
  174. package/src/lib/components/ui/select.stories.tsx +36 -0
  175. package/src/lib/components/ui/separator.stories.tsx +35 -0
  176. package/src/lib/components/ui/sheet.stories.tsx +50 -0
  177. package/src/lib/components/ui/sidebar-context.ts +16 -0
  178. package/src/lib/components/ui/sidebar.tsx +2 -13
  179. package/src/lib/components/ui/skeleton.stories.tsx +26 -0
  180. package/src/lib/components/ui/slider.stories.tsx +37 -0
  181. package/src/lib/components/ui/switch.stories.tsx +31 -0
  182. package/src/lib/components/ui/table.stories.tsx +52 -0
  183. package/src/lib/components/ui/tabs.stories.tsx +29 -0
  184. package/src/lib/components/ui/textarea.stories.tsx +32 -0
  185. package/src/lib/components/ui/toggle-group.stories.tsx +31 -0
  186. package/src/lib/components/ui/toggle.stories.tsx +39 -0
  187. package/src/lib/components/ui/tooltip.stories.tsx +30 -0
  188. package/src/lib/components/ui/tooltip.tsx +2 -2
  189. package/src/lib/framework/alert/alert-extensions.tsx +0 -11
  190. package/src/lib/framework/alert/alert-item.tsx +14 -19
  191. package/src/lib/framework/alert/alerts-indicator.tsx +14 -15
  192. package/src/lib/framework/alert/search-index-buffer-alert/search-index-buffer-alert.ts +41 -0
  193. package/src/lib/framework/component-registry/component-registry.tsx +3 -14
  194. package/src/lib/framework/dashboard-widget/base-widget.tsx +18 -9
  195. package/src/lib/framework/dashboard-widget/latest-orders-widget/index.tsx +0 -2
  196. package/src/lib/framework/dashboard-widget/widget-filters-context.tsx +12 -11
  197. package/src/lib/framework/defaults.ts +9 -13
  198. package/src/lib/framework/extension-api/input-component-extensions.tsx +6 -1
  199. package/src/lib/framework/extension-api/logic/alerts.ts +3 -2
  200. package/src/lib/framework/extension-api/types/alerts.ts +12 -6
  201. package/src/lib/framework/extension-api/types/data-table.ts +5 -2
  202. package/src/lib/framework/extension-api/types/layout.ts +41 -1
  203. package/src/lib/framework/extension-api/types/login.ts +0 -21
  204. package/src/lib/framework/form-engine/value-transformers.ts +8 -1
  205. package/src/lib/framework/layout-engine/custom-form-page.stories.tsx +344 -0
  206. package/src/lib/framework/layout-engine/page-layout.tsx +69 -57
  207. package/src/lib/framework/layout-engine/page.stories.tsx +275 -0
  208. package/src/lib/framework/nav-menu/nav-menu-extensions.ts +32 -19
  209. package/src/lib/framework/page/detail-page.stories.tsx +151 -0
  210. package/src/lib/framework/page/detail-page.tsx +12 -15
  211. package/src/lib/framework/page/list-page.stories.tsx +217 -0
  212. package/src/lib/framework/page/list-page.tsx +8 -1
  213. package/src/lib/graphql/api.ts +18 -1
  214. package/src/lib/graphql/graphql-env.d.ts +1 -1
  215. package/src/lib/hooks/use-alerts.ts +84 -0
  216. package/src/lib/hooks/use-floating-bulk-actions.ts +2 -3
  217. package/src/lib/index.ts +12 -5
  218. package/src/lib/providers/alerts-provider.tsx +60 -0
  219. package/src/lib/providers/channel-provider.tsx +1 -0
  220. package/src/lib/providers/theme-provider.tsx +6 -3
@@ -0,0 +1,51 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import {
3
+ Pagination,
4
+ PaginationContent,
5
+ PaginationEllipsis,
6
+ PaginationItem,
7
+ PaginationLink,
8
+ PaginationNext,
9
+ PaginationPrevious,
10
+ } from './pagination.js';
11
+
12
+ const meta = {
13
+ title: 'UI/Pagination',
14
+ component: Pagination,
15
+ parameters: {
16
+ layout: 'centered',
17
+ },
18
+ tags: ['autodocs'],
19
+ } satisfies Meta<typeof Pagination>;
20
+
21
+ export default meta;
22
+ type Story = StoryObj<typeof meta>;
23
+
24
+ export const Playground: Story = {
25
+ render: () => (
26
+ <Pagination>
27
+ <PaginationContent>
28
+ <PaginationItem>
29
+ <PaginationPrevious href="#" />
30
+ </PaginationItem>
31
+ <PaginationItem>
32
+ <PaginationLink href="#">1</PaginationLink>
33
+ </PaginationItem>
34
+ <PaginationItem>
35
+ <PaginationLink href="#" isActive>
36
+ 2
37
+ </PaginationLink>
38
+ </PaginationItem>
39
+ <PaginationItem>
40
+ <PaginationLink href="#">3</PaginationLink>
41
+ </PaginationItem>
42
+ <PaginationItem>
43
+ <PaginationEllipsis />
44
+ </PaginationItem>
45
+ <PaginationItem>
46
+ <PaginationNext href="#" />
47
+ </PaginationItem>
48
+ </PaginationContent>
49
+ </Pagination>
50
+ ),
51
+ };
@@ -0,0 +1,32 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { PasswordInput } from './password-input.js';
3
+
4
+ const meta = {
5
+ title: 'UI/Password Input',
6
+ component: PasswordInput,
7
+ parameters: {
8
+ layout: 'centered',
9
+ },
10
+ tags: ['autodocs'],
11
+ argTypes: {
12
+ placeholder: {
13
+ control: 'text',
14
+ description: 'Placeholder text',
15
+ },
16
+ disabled: {
17
+ control: 'boolean',
18
+ description: 'Whether the input is disabled',
19
+ },
20
+ },
21
+ } satisfies Meta<typeof PasswordInput>;
22
+
23
+ export default meta;
24
+ type Story = StoryObj<typeof meta>;
25
+
26
+ export const Playground: Story = {
27
+ args: {
28
+ placeholder: 'Enter password...',
29
+ disabled: false,
30
+ },
31
+ render: args => <PasswordInput {...args} className="w-[300px]" />,
32
+ };
@@ -0,0 +1,33 @@
1
+ import { t } from '@lingui/react/macro';
2
+ import { Eye, EyeOff } from 'lucide-react';
3
+ import * as React from 'react';
4
+
5
+ import {
6
+ InputGroup,
7
+ InputGroupAddon,
8
+ InputGroupButton,
9
+ InputGroupInput,
10
+ } from './input-group.js';
11
+
12
+ type PasswordInputProps = Readonly<Omit<React.ComponentProps<'input'>, 'type'>>;
13
+
14
+ function PasswordInput({ ...props }: PasswordInputProps) {
15
+ const [showPassword, setShowPassword] = React.useState(false);
16
+
17
+ return (
18
+ <InputGroup>
19
+ <InputGroupInput type={showPassword ? 'text' : 'password'} {...props} />
20
+ <InputGroupAddon align="inline-end">
21
+ <InputGroupButton
22
+ size="icon-xs"
23
+ onClick={() => setShowPassword(!showPassword)}
24
+ aria-label={showPassword ? t`Hide password` : t`Show password`}
25
+ >
26
+ {showPassword ? <EyeOff /> : <Eye />}
27
+ </InputGroupButton>
28
+ </InputGroupAddon>
29
+ </InputGroup>
30
+ );
31
+ }
32
+
33
+ export { PasswordInput };
@@ -0,0 +1,33 @@
1
+ import type { Meta, StoryObj} from '@storybook/react-vite';
2
+ import { Button } from './button.js';
3
+ import { Popover, PopoverContent, PopoverTrigger } from './popover.js';
4
+
5
+ const meta = {
6
+ title: 'UI/Popover',
7
+ component: Popover,
8
+ parameters: {
9
+ layout: 'centered',
10
+ },
11
+ tags: ['autodocs'],
12
+ } satisfies Meta<typeof Popover>;
13
+
14
+ export default meta;
15
+ type Story = StoryObj<typeof meta>;
16
+
17
+ export const Playground: Story = {
18
+ render: () => (
19
+ <Popover>
20
+ <PopoverTrigger asChild>
21
+ <Button variant="outline">Open popover</Button>
22
+ </PopoverTrigger>
23
+ <PopoverContent className="w-80">
24
+ <div className="grid gap-4">
25
+ <div className="space-y-2">
26
+ <h4 className="font-medium leading-none">Dimensions</h4>
27
+ <p className="text-sm text-muted-foreground">Set the dimensions for the layer.</p>
28
+ </div>
29
+ </div>
30
+ </PopoverContent>
31
+ </Popover>
32
+ ),
33
+ };
@@ -0,0 +1,27 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { Progress } from './progress.js';
3
+
4
+ const meta = {
5
+ title: 'UI/Progress',
6
+ component: Progress,
7
+ parameters: {
8
+ layout: 'centered',
9
+ },
10
+ tags: ['autodocs'],
11
+ argTypes: {
12
+ value: {
13
+ control: { type: 'range', min: 0, max: 100, step: 1 },
14
+ description: 'Progress value (0-100)',
15
+ },
16
+ },
17
+ } satisfies Meta<typeof Progress>;
18
+
19
+ export default meta;
20
+ type Story = StoryObj<typeof meta>;
21
+
22
+ export const Playground: Story = {
23
+ args: {
24
+ value: 60,
25
+ },
26
+ render: args => <Progress {...args} className="w-[300px]" />,
27
+ };
@@ -0,0 +1,34 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { Label } from './label.js';
3
+ import { RadioGroup, RadioGroupItem } from './radio-group.js';
4
+
5
+ const meta = {
6
+ title: 'UI/Radio Group',
7
+ component: RadioGroup,
8
+ parameters: {
9
+ layout: 'centered',
10
+ },
11
+ tags: ['autodocs'],
12
+ } satisfies Meta<typeof RadioGroup>;
13
+
14
+ export default meta;
15
+ type Story = StoryObj<typeof meta>;
16
+
17
+ export const Playground: Story = {
18
+ render: () => (
19
+ <RadioGroup defaultValue="option-one">
20
+ <div className="flex items-center space-x-2">
21
+ <RadioGroupItem value="option-one" id="option-one" />
22
+ <Label htmlFor="option-one">Option One</Label>
23
+ </div>
24
+ <div className="flex items-center space-x-2">
25
+ <RadioGroupItem value="option-two" id="option-two" />
26
+ <Label htmlFor="option-two">Option Two</Label>
27
+ </div>
28
+ <div className="flex items-center space-x-2">
29
+ <RadioGroupItem value="option-three" id="option-three" />
30
+ <Label htmlFor="option-three">Option Three</Label>
31
+ </div>
32
+ </RadioGroup>
33
+ ),
34
+ };
@@ -0,0 +1,32 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from './resizable.js';
3
+
4
+ const meta = {
5
+ title: 'UI/Resizable',
6
+ component: ResizablePanelGroup,
7
+ parameters: {
8
+ layout: 'centered',
9
+ },
10
+ tags: ['autodocs'],
11
+ } satisfies Meta<typeof ResizablePanelGroup>;
12
+
13
+ export default meta;
14
+ type Story = StoryObj<typeof meta>;
15
+
16
+ export const Playground: Story = {
17
+ render: () => (
18
+ <ResizablePanelGroup direction="horizontal" className="w-[600px] h-[200px] rounded-lg border">
19
+ <ResizablePanel defaultSize={50}>
20
+ <div className="flex h-full items-center justify-center p-6">
21
+ <span className="font-semibold">Left Panel</span>
22
+ </div>
23
+ </ResizablePanel>
24
+ <ResizableHandle />
25
+ <ResizablePanel defaultSize={50}>
26
+ <div className="flex h-full items-center justify-center p-6">
27
+ <span className="font-semibold">Right Panel</span>
28
+ </div>
29
+ </ResizablePanel>
30
+ </ResizablePanelGroup>
31
+ ),
32
+ };
@@ -0,0 +1,31 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { ScrollArea } from './scroll-area.js';
3
+ import { Separator } from './separator.js';
4
+
5
+ const meta = {
6
+ title: 'UI/Scroll Area',
7
+ component: ScrollArea,
8
+ parameters: {
9
+ layout: 'centered',
10
+ },
11
+ tags: ['autodocs'],
12
+ } satisfies Meta<typeof ScrollArea>;
13
+
14
+ export default meta;
15
+ type Story = StoryObj<typeof meta>;
16
+
17
+ export const Playground: Story = {
18
+ render: () => (
19
+ <ScrollArea className="h-72 w-48 rounded-md border">
20
+ <div className="p-4">
21
+ <h4 className="mb-4 text-sm font-medium leading-none">Tags</h4>
22
+ {Array.from({ length: 50 }).map((_, i) => (
23
+ <div key={i}>
24
+ <div className="text-sm">Tag {i + 1}</div>
25
+ <Separator className="my-2" />
26
+ </div>
27
+ ))}
28
+ </div>
29
+ </ScrollArea>
30
+ ),
31
+ };
@@ -0,0 +1,36 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import {
3
+ Select,
4
+ SelectContent,
5
+ SelectItem,
6
+ SelectTrigger,
7
+ SelectValue,
8
+ } from './select.js';
9
+
10
+ const meta = {
11
+ title: 'UI/Select',
12
+ component: Select,
13
+ parameters: {
14
+ layout: 'centered',
15
+ },
16
+ tags: ['autodocs'],
17
+ } satisfies Meta<typeof Select>;
18
+
19
+ export default meta;
20
+ type Story = StoryObj<typeof meta>;
21
+
22
+ export const Playground: Story = {
23
+ render: () => (
24
+ <Select defaultValue="option1">
25
+ <SelectTrigger className="w-[200px]">
26
+ <SelectValue placeholder="Select an option" />
27
+ </SelectTrigger>
28
+ <SelectContent>
29
+ <SelectItem value="option1">Option 1</SelectItem>
30
+ <SelectItem value="option2">Option 2</SelectItem>
31
+ <SelectItem value="option3">Option 3</SelectItem>
32
+ <SelectItem value="option4">Option 4</SelectItem>
33
+ </SelectContent>
34
+ </Select>
35
+ ),
36
+ };
@@ -0,0 +1,35 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { Separator } from './separator.js';
3
+
4
+ const meta = {
5
+ title: 'UI/Separator',
6
+ component: Separator,
7
+ parameters: {
8
+ layout: 'centered',
9
+ },
10
+ tags: ['autodocs'],
11
+ } satisfies Meta<typeof Separator>;
12
+
13
+ export default meta;
14
+ type Story = StoryObj<typeof meta>;
15
+
16
+ export const Playground: Story = {
17
+ render: () => (
18
+ <div className="w-[300px]">
19
+ <div className="space-y-1">
20
+ <h4 className="text-sm font-medium leading-none">Radix Primitives</h4>
21
+ <p className="text-sm text-muted-foreground">
22
+ An open-source UI component library.
23
+ </p>
24
+ </div>
25
+ <Separator className="my-4" />
26
+ <div className="flex h-5 items-center space-x-4 text-sm">
27
+ <div>Blog</div>
28
+ <Separator orientation="vertical" />
29
+ <div>Docs</div>
30
+ <Separator orientation="vertical" />
31
+ <div>Source</div>
32
+ </div>
33
+ </div>
34
+ ),
35
+ };
@@ -0,0 +1,50 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { Button } from './button.js';
3
+ import {
4
+ Sheet,
5
+ SheetClose,
6
+ SheetContent,
7
+ SheetDescription,
8
+ SheetFooter,
9
+ SheetHeader,
10
+ SheetTitle,
11
+ SheetTrigger,
12
+ } from './sheet.js';
13
+
14
+ const meta = {
15
+ title: 'UI/Sheet',
16
+ component: Sheet,
17
+ parameters: {
18
+ layout: 'centered',
19
+ },
20
+ tags: ['autodocs'],
21
+ } satisfies Meta<typeof Sheet>;
22
+
23
+ export default meta;
24
+ type Story = StoryObj<typeof meta>;
25
+
26
+ export const Playground: Story = {
27
+ render: () => (
28
+ <Sheet>
29
+ <SheetTrigger asChild>
30
+ <Button>Open Sheet</Button>
31
+ </SheetTrigger>
32
+ <SheetContent>
33
+ <SheetHeader>
34
+ <SheetTitle>Edit profile</SheetTitle>
35
+ <SheetDescription>
36
+ Make changes to your profile here. Click save when you're done.
37
+ </SheetDescription>
38
+ </SheetHeader>
39
+ <div className="grid gap-4 py-4">
40
+ <p>Sheet content goes here</p>
41
+ </div>
42
+ <SheetFooter>
43
+ <SheetClose asChild>
44
+ <Button type="submit">Save changes</Button>
45
+ </SheetClose>
46
+ </SheetFooter>
47
+ </SheetContent>
48
+ </Sheet>
49
+ ),
50
+ };
@@ -0,0 +1,16 @@
1
+ import * as React from 'react';
2
+
3
+ export type SidebarContext = {
4
+ state: 'expanded' | 'collapsed';
5
+ open: boolean;
6
+ setOpen: (open: boolean) => void;
7
+ openMobile: boolean;
8
+ setOpenMobile: (open: boolean) => void;
9
+ isMobile: boolean;
10
+ toggleSidebar: () => void;
11
+ };
12
+
13
+ // This is split into a separate file from `sidebar.tsx` because having them in the same
14
+ // file causes the app to break on HMR in dev mode. It relates to this issue:
15
+ // https://github.com/vitejs/vite/issues/3301#issuecomment-1080030773
16
+ export const SidebarContext = React.createContext<SidebarContext | null>(null);
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import { Slot } from '@radix-ui/react-slot';
4
- import { VariantProps, cva } from 'class-variance-authority';
4
+ import { cva, VariantProps } from 'class-variance-authority';
5
5
  import { PanelLeftIcon } from 'lucide-react';
6
6
  import * as React from 'react';
7
7
  import { MouseEvent } from 'react';
@@ -10,6 +10,7 @@ import { Button } from '@/vdb/components/ui/button.js';
10
10
  import { Input } from '@/vdb/components/ui/input.js';
11
11
  import { Separator } from '@/vdb/components/ui/separator.js';
12
12
  import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from '@/vdb/components/ui/sheet.js';
13
+ import { SidebarContext } from '@/vdb/components/ui/sidebar-context.js';
13
14
  import { Skeleton } from '@/vdb/components/ui/skeleton.js';
14
15
  import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/vdb/components/ui/tooltip.js';
15
16
  import { useIsMobile } from '@/vdb/hooks/use-mobile.js';
@@ -22,18 +23,6 @@ const SIDEBAR_WIDTH_MOBILE = '18rem';
22
23
  const SIDEBAR_WIDTH_ICON = '3rem';
23
24
  const SIDEBAR_KEYBOARD_SHORTCUT = 'b';
24
25
 
25
- type SidebarContext = {
26
- state: 'expanded' | 'collapsed';
27
- open: boolean;
28
- setOpen: (open: boolean) => void;
29
- openMobile: boolean;
30
- setOpenMobile: (open: boolean) => void;
31
- isMobile: boolean;
32
- toggleSidebar: () => void;
33
- };
34
-
35
- const SidebarContext = React.createContext<SidebarContext | null>(null);
36
-
37
26
  function useSidebar() {
38
27
  const context = React.useContext(SidebarContext);
39
28
  if (!context) {
@@ -0,0 +1,26 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { Skeleton } from './skeleton.js';
3
+
4
+ const meta = {
5
+ title: 'UI/Skeleton',
6
+ component: Skeleton,
7
+ parameters: {
8
+ layout: 'centered',
9
+ },
10
+ tags: ['autodocs'],
11
+ } satisfies Meta<typeof Skeleton>;
12
+
13
+ export default meta;
14
+ type Story = StoryObj<typeof meta>;
15
+
16
+ export const Playground: Story = {
17
+ render: () => (
18
+ <div className="flex items-center space-x-4">
19
+ <Skeleton className="h-12 w-12 rounded-full" />
20
+ <div className="space-y-2">
21
+ <Skeleton className="h-4 w-[250px]" />
22
+ <Skeleton className="h-4 w-[200px]" />
23
+ </div>
24
+ </div>
25
+ ),
26
+ };
@@ -0,0 +1,37 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { Slider } from './slider.js';
3
+
4
+ const meta = {
5
+ title: 'UI/Slider',
6
+ component: Slider,
7
+ parameters: {
8
+ layout: 'centered',
9
+ },
10
+ tags: ['autodocs'],
11
+ argTypes: {
12
+ defaultValue: {
13
+ control: { type: 'array' },
14
+ description: 'Default value',
15
+ },
16
+ max: {
17
+ control: 'number',
18
+ description: 'Maximum value',
19
+ },
20
+ step: {
21
+ control: 'number',
22
+ description: 'Step increment',
23
+ },
24
+ },
25
+ } satisfies Meta<typeof Slider>;
26
+
27
+ export default meta;
28
+ type Story = StoryObj<typeof meta>;
29
+
30
+ export const Playground: Story = {
31
+ args: {
32
+ defaultValue: [50],
33
+ max: 100,
34
+ step: 1,
35
+ },
36
+ render: args => <Slider {...args} className="w-[300px]" />,
37
+ };
@@ -0,0 +1,31 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { Switch } from './switch.js';
3
+
4
+ const meta = {
5
+ title: 'UI/Switch',
6
+ component: Switch,
7
+ parameters: {
8
+ layout: 'centered',
9
+ },
10
+ tags: ['autodocs'],
11
+ argTypes: {
12
+ disabled: {
13
+ control: 'boolean',
14
+ description: 'Whether the switch is disabled',
15
+ },
16
+ checked: {
17
+ control: 'boolean',
18
+ description: 'Whether the switch is checked',
19
+ },
20
+ },
21
+ } satisfies Meta<typeof Switch>;
22
+
23
+ export default meta;
24
+ type Story = StoryObj<typeof meta>;
25
+
26
+ export const Playground: Story = {
27
+ args: {
28
+ checked: false,
29
+ disabled: false,
30
+ },
31
+ };
@@ -0,0 +1,52 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import {
3
+ Table,
4
+ TableBody,
5
+ TableCell,
6
+ TableHead,
7
+ TableHeader,
8
+ TableRow,
9
+ } from './table.js';
10
+
11
+ const meta = {
12
+ title: 'UI/Table',
13
+ component: Table,
14
+ parameters: {
15
+ layout: 'centered',
16
+ },
17
+ tags: ['autodocs'],
18
+ } satisfies Meta<typeof Table>;
19
+
20
+ export default meta;
21
+ type Story = StoryObj<typeof meta>;
22
+
23
+ export const Playground: Story = {
24
+ render: () => (
25
+ <Table className="w-[500px]">
26
+ <TableHeader>
27
+ <TableRow>
28
+ <TableHead>Name</TableHead>
29
+ <TableHead>Email</TableHead>
30
+ <TableHead>Role</TableHead>
31
+ </TableRow>
32
+ </TableHeader>
33
+ <TableBody>
34
+ <TableRow>
35
+ <TableCell>John Doe</TableCell>
36
+ <TableCell>john@example.com</TableCell>
37
+ <TableCell>Admin</TableCell>
38
+ </TableRow>
39
+ <TableRow>
40
+ <TableCell>Jane Smith</TableCell>
41
+ <TableCell>jane@example.com</TableCell>
42
+ <TableCell>User</TableCell>
43
+ </TableRow>
44
+ <TableRow>
45
+ <TableCell>Bob Johnson</TableCell>
46
+ <TableCell>bob@example.com</TableCell>
47
+ <TableCell>User</TableCell>
48
+ </TableRow>
49
+ </TableBody>
50
+ </Table>
51
+ ),
52
+ };
@@ -0,0 +1,29 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { Tabs, TabsContent, TabsList, TabsTrigger } from './tabs.js';
3
+
4
+ const meta = {
5
+ title: 'UI/Tabs',
6
+ component: Tabs,
7
+ parameters: {
8
+ layout: 'centered',
9
+ },
10
+ tags: ['autodocs'],
11
+ } satisfies Meta<typeof Tabs>;
12
+
13
+ export default meta;
14
+ type Story = StoryObj<typeof meta>;
15
+
16
+ export const Playground: Story = {
17
+ render: () => (
18
+ <Tabs defaultValue="tab1" className="w-[400px]">
19
+ <TabsList>
20
+ <TabsTrigger value="tab1">Tab 1</TabsTrigger>
21
+ <TabsTrigger value="tab2">Tab 2</TabsTrigger>
22
+ <TabsTrigger value="tab3">Tab 3</TabsTrigger>
23
+ </TabsList>
24
+ <TabsContent value="tab1">Content for Tab 1</TabsContent>
25
+ <TabsContent value="tab2">Content for Tab 2</TabsContent>
26
+ <TabsContent value="tab3">Content for Tab 3</TabsContent>
27
+ </Tabs>
28
+ ),
29
+ };
@@ -0,0 +1,32 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { Textarea } from './textarea.js';
3
+
4
+ const meta = {
5
+ title: 'UI/Textarea',
6
+ component: Textarea,
7
+ parameters: {
8
+ layout: 'centered',
9
+ },
10
+ tags: ['autodocs'],
11
+ argTypes: {
12
+ placeholder: {
13
+ control: 'text',
14
+ description: 'Placeholder text',
15
+ },
16
+ disabled: {
17
+ control: 'boolean',
18
+ description: 'Whether the textarea is disabled',
19
+ },
20
+ },
21
+ } satisfies Meta<typeof Textarea>;
22
+
23
+ export default meta;
24
+ type Story = StoryObj<typeof meta>;
25
+
26
+ export const Playground: Story = {
27
+ args: {
28
+ placeholder: 'Type your message here...',
29
+ disabled: false,
30
+ },
31
+ render: args => <Textarea {...args} className="w-[400px]" />,
32
+ };