@vertz/create-vertz-app 0.2.23 → 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.
@@ -85,7 +85,7 @@ export declare function themeTemplate(): string;
85
85
  /**
86
86
  * src/pages/home.tsx — full CRUD task list with form, checkbox toggle,
87
87
  * delete confirmation dialog, and animated list transitions.
88
- * Demonstrates theme components (Button, Input, AlertDialog) over raw HTML.
88
+ * Demonstrates theme components (Button, Input) and DialogStack confirmation.
89
89
  */
90
90
  export declare function homePageTemplate(): string;
91
91
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CA6B5D;AAED;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,MAAM,CAyJnD;AAED;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CAqQlD;AAID;;GAEG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAGxC;AAID;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CA6B/D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAoBzC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAa5C;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAIpC;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAI3C;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAIvC;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAc9C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CA6B1C;AAID;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAW1C;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAoBvC;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAavC;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAWnC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAe5C;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAOvC;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAgD7C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAW5C;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,CActC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CA0LzC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CA6B5D;AAED;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,MAAM,CAyJnD;AAED;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CAoRlD;AAID;;GAEG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAGxC;AAID;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CA6B/D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAoBzC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAa5C;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAIpC;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAI3C;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAIvC;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAc9C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CA6B1C;AAID;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAW1C;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAoBvC;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAavC;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAWnC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAe5C;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAOvC;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAgD7C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAW5C;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,CActC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAuLzC"}
@@ -338,7 +338,7 @@ Theme components are pre-configured with the app's design tokens and provide con
338
338
  Import components from \`@vertz/ui/components\` — the centralized entrypoint:
339
339
 
340
340
  \`\`\`tsx
341
- import { Button, Input, AlertDialog } from '@vertz/ui/components';
341
+ import { Button, Input, Dialog } from '@vertz/ui/components';
342
342
 
343
343
  // RIGHT — use theme components
344
344
  <Button intent="primary" size="md">Submit</Button>
@@ -354,42 +354,57 @@ import { Button, Input, AlertDialog } from '@vertz/ui/components';
354
354
  **Direct**: \`Button\`, \`Input\`, \`Label\`, \`Badge\`, \`Textarea\`,
355
355
  \`Card\` suite, \`Table\` suite, \`Avatar\` suite, \`FormGroup\` suite
356
356
 
357
- **Primitives**: \`AlertDialog\`, \`Dialog\`, \`Tabs\`,
357
+ **Primitives**: \`Dialog\`, \`Tabs\`,
358
358
  \`Select\`, \`DropdownMenu\`, \`Popover\`, \`Sheet\`, \`Tooltip\`, \`Accordion\`
359
- — all with sub-components (\`.Trigger\`, \`.Content\`, \`.Footer\`, etc.)
359
+ — all with sub-components (\`.Title\`, \`.Content\`, \`.Footer\`, etc.)
360
360
 
361
361
  ## Dialogs
362
362
 
363
- ### Composable \`<AlertDialog>\` for inline confirmations
363
+ ### \`useDialogStack()\` for all dialogs
364
+
365
+ All dialogs use the DialogStack pattern — imperative, promise-based, with automatic
366
+ overlay, focus trapping, and stacking via native \`<dialog>\`.
364
367
 
365
368
  \`\`\`tsx
366
- import { Button, AlertDialog } from '@vertz/ui/components';
367
-
368
- <AlertDialog>
369
- <AlertDialog.Trigger>
370
- <Button intent="danger" size="sm">Delete</Button>
371
- </AlertDialog.Trigger>
372
- <AlertDialog.Content>
373
- <AlertDialog.Title>Delete task?</AlertDialog.Title>
374
- <AlertDialog.Description>This action cannot be undone.</AlertDialog.Description>
375
- <AlertDialog.Footer>
376
- <AlertDialog.Cancel>Cancel</AlertDialog.Cancel>
377
- <AlertDialog.Action onClick={handleDelete}>Delete</AlertDialog.Action>
378
- </AlertDialog.Footer>
379
- </AlertDialog.Content>
380
- </AlertDialog>
381
- \`\`\`
369
+ import { useDialogStack } from '@vertz/ui';
370
+
371
+ const dialogs = useDialogStack();
382
372
 
383
- ### \`useDialogStack()\` for imperative/stacked dialogs
373
+ // Quick confirmation
374
+ const confirmed = await dialogs.confirm({
375
+ title: 'Delete task?',
376
+ description: 'This action cannot be undone.',
377
+ confirm: 'Delete',
378
+ cancel: 'Cancel',
379
+ intent: 'danger',
380
+ });
381
+ if (confirmed) handleDelete();
382
+ \`\`\`
384
383
 
385
- Use when you need promise-based results or dialogs opened from event handlers:
384
+ ### Custom dialog components
386
385
 
387
386
  \`\`\`tsx
388
- import { useDialogStack } from 'vertz/ui';
387
+ import { useDialogStack, useDialog } from '@vertz/ui';
388
+ import { Dialog } from '@vertz/ui/components';
389
389
 
390
- const dialogs = useDialogStack();
391
- const confirmed = await dialogs.open(ConfirmDialog, { message: 'Delete?' });
392
- if (confirmed) handleDelete();
390
+ function EditDialog({ task, dialog }: { task: Task; dialog: DialogHandle<Task> }) {
391
+ return (
392
+ <>
393
+ <Dialog.Header>
394
+ <Dialog.Title>Edit Task</Dialog.Title>
395
+ </Dialog.Header>
396
+ <Dialog.Body>...</Dialog.Body>
397
+ <Dialog.Footer>
398
+ <Dialog.Cancel>Cancel</Dialog.Cancel>
399
+ <Button onClick={() => dialog.close(updatedTask)}>Save</Button>
400
+ </Dialog.Footer>
401
+ </>
402
+ );
403
+ }
404
+
405
+ // Open it
406
+ const result = await dialogs.open(EditDialog, { task });
407
+ if (result.ok) saveTask(result.data);
393
408
  \`\`\`
394
409
 
395
410
  ## Styling
@@ -800,7 +815,7 @@ export const themeGlobals = config.globals;
800
815
  /**
801
816
  * src/pages/home.tsx — full CRUD task list with form, checkbox toggle,
802
817
  * delete confirmation dialog, and animated list transitions.
803
- * Demonstrates theme components (Button, Input, AlertDialog) over raw HTML.
818
+ * Demonstrates theme components (Button, Input) and DialogStack confirmation.
804
819
  */
805
820
  export function homePageTemplate() {
806
821
  return `import {
@@ -814,9 +829,9 @@ export function homePageTemplate() {
814
829
  query,
815
830
  queryMatch,
816
831
  slideInFromTop,
832
+ useDialogStack,
817
833
  } from 'vertz/ui';
818
834
  import { Button } from '@vertz/ui/components';
819
- import { AlertDialog } from '@vertz/ui/components';
820
835
  import { api } from '../client';
821
836
 
822
837
  // Global CSS for list item enter/exit animations
@@ -877,12 +892,23 @@ interface TaskItemProps {
877
892
  }
878
893
 
879
894
  function TaskItem({ id, title, completed }: TaskItemProps) {
895
+ const dialogs = useDialogStack();
896
+
880
897
  const handleToggle = async () => {
881
898
  await api.tasks.update(id, { completed: !completed });
882
899
  };
883
900
 
884
901
  const handleDelete = async () => {
885
- await api.tasks.delete(id);
902
+ const confirmed = await dialogs.confirm({
903
+ title: 'Delete task?',
904
+ description: 'This action cannot be undone.',
905
+ confirm: 'Delete',
906
+ cancel: 'Cancel',
907
+ intent: 'danger',
908
+ });
909
+ if (confirmed) {
910
+ await api.tasks.delete(id);
911
+ }
886
912
  };
887
913
 
888
914
  return (
@@ -896,21 +922,7 @@ function TaskItem({ id, title, completed }: TaskItemProps) {
896
922
  <span className={completed ? styles.labelDone : styles.label}>
897
923
  {title}
898
924
  </span>
899
- <AlertDialog onAction={handleDelete}>
900
- <AlertDialog.Trigger>
901
- <Button intent="ghost" size="sm">Delete</Button>
902
- </AlertDialog.Trigger>
903
- <AlertDialog.Content>
904
- <AlertDialog.Title>Delete task?</AlertDialog.Title>
905
- <AlertDialog.Description>
906
- This action cannot be undone.
907
- </AlertDialog.Description>
908
- <AlertDialog.Footer>
909
- <AlertDialog.Cancel>Cancel</AlertDialog.Cancel>
910
- <AlertDialog.Action>Delete</AlertDialog.Action>
911
- </AlertDialog.Footer>
912
- </AlertDialog.Content>
913
- </AlertDialog>
925
+ <Button intent="ghost" size="sm" onClick={handleDelete}>Delete</Button>
914
926
  </div>
915
927
  );
916
928
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertz/create-vertz-app",
3
- "version": "0.2.23",
3
+ "version": "0.2.24",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Create a new Vertz application",