@proto.ui/prototypes-shadcn 0.2.0-rc.1 → 0.2.0-rc.4

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.
@@ -0,0 +1,2 @@
1
+ declare const dialogCloseIcon: import("@proto.ui/core").Prototype<import("@proto.ui/prototypes-base/dialog").DialogCloseProps, import("@proto.ui/prototypes-base/dialog").DialogCloseExposes>;
2
+ export default dialogCloseIcon;
@@ -0,0 +1,39 @@
1
+ import { definePrototype, tw } from '@proto.ui/core';
2
+ import { asDialogClose } from '@proto.ui/prototypes-base/dialog';
3
+ const dialogCloseIcon = definePrototype({
4
+ name: 'shadcn-dialog-close-icon',
5
+ setup(def) {
6
+ const state = asDialogClose().stateHandles;
7
+ if (!state)
8
+ throw new Error('[shadcn-dialog-close-icon] command states are required.');
9
+ const { disabled, hovered, focusVisible } = state;
10
+ def.a11y.name('Close');
11
+ def.feedback.style.use(tw('absolute right-0 top-4 inline-flex size-8 items-center justify-center rounded-sm transition-all outline-none'));
12
+ def.rule({
13
+ when: (w) => w.state(hovered).eq(true),
14
+ intent: (i) => i.feedback.style.use(tw('bg-muted')),
15
+ });
16
+ def.rule({
17
+ when: (w) => w.state(focusVisible).eq(true),
18
+ intent: (i) => i.feedback.style.use(tw('ring-3 ring-ring/50')),
19
+ });
20
+ def.rule({
21
+ when: (w) => w.state(disabled).eq(true),
22
+ intent: (i) => i.feedback.style.use(tw('pointer-events-none opacity-50')),
23
+ });
24
+ return (renderer) => [
25
+ renderer.r.slot(),
26
+ renderer.svg.root({
27
+ viewBox: '0 0 24 24',
28
+ width: 16,
29
+ height: 16,
30
+ fill: 'none',
31
+ stroke: 'currentColor',
32
+ strokeWidth: 2,
33
+ strokeLinecap: 'round',
34
+ strokeLinejoin: 'round',
35
+ }, [renderer.svg.path({ d: 'M18 6 6 18' }), renderer.svg.path({ d: 'm6 6 12 12' })]),
36
+ ];
37
+ },
38
+ });
39
+ export default dialogCloseIcon;
@@ -1,4 +1,3 @@
1
- import type { ShadcnDialogCloseProps } from './types';
2
- declare const dialogClose: import("@proto.ui/core").Prototype<ShadcnDialogCloseProps, import("@proto.ui/prototypes-base/dialog").DialogCloseExposes>;
1
+ declare const dialogClose: import("@proto.ui/core").Prototype<import("@proto.ui/prototypes-base/dialog").DialogCloseProps, import("@proto.ui/prototypes-base/dialog").DialogCloseExposes>;
3
2
  /** P-SHADCN-DIALOG-CLOSE-DIRECT-ENTRY and P-SHADCN-DIALOG-CLOSE-STATE-DRIVEN-STYLES. */
4
3
  export default dialogClose;
@@ -1,99 +1,11 @@
1
- import { definePrototype, tw } from '@proto.ui/core';
1
+ import { definePrototype } from '@proto.ui/core';
2
2
  import { asDialogClose } from '@proto.ui/prototypes-base/dialog';
3
- const BASE_TOKENS = [
4
- 'group/button',
5
- 'inline-flex',
6
- 'shrink-0',
7
- 'items-center',
8
- 'justify-center',
9
- 'rounded-lg',
10
- 'border',
11
- 'bg-clip-padding',
12
- 'text-sm',
13
- 'font-medium',
14
- 'whitespace-nowrap',
15
- 'transition-all',
16
- 'outline-none',
17
- 'select-none',
18
- 'h-8',
19
- 'gap-1.5',
20
- 'px-2.5',
21
- ].join(' ');
22
- const VARIANT_TOKENS = {
23
- default: 'border-transparent bg-primary text-primary-foreground',
24
- destructive: 'border-transparent bg-destructive/10 text-destructive',
25
- outline: 'border-border bg-background text-foreground',
26
- secondary: 'border-transparent bg-secondary text-secondary-foreground',
27
- ghost: 'border-transparent bg-transparent text-foreground',
28
- link: 'border-transparent bg-transparent text-primary underline-offset-4',
29
- };
30
3
  const dialogClose = definePrototype({
31
4
  name: 'shadcn-dialog-close',
32
- setup(def) {
33
- // P-SHADCN-DIALOG-CLOSE-VARIANT-PROP
34
- def.props.define({
35
- variant: {
36
- type: 'enum',
37
- empty: 'fallback',
38
- options: ['default', 'destructive', 'outline', 'secondary', 'ghost', 'link'],
39
- },
40
- disabled: { type: 'boolean', empty: 'fallback' },
41
- });
42
- def.props.setDefaults({
43
- variant: 'default',
44
- disabled: false,
45
- });
5
+ setup() {
46
6
  // P-SHADCN-DIALOG-CLOSE-BASE-INHERITANCE,
47
7
  // P-SHADCN-DIALOG-CLOSE-CURRENT-BASE-DEVIATIONS
48
- const buttonState = asDialogClose().stateHandles;
49
- if (!buttonState) {
50
- throw new Error('[shadcn-dialog-close] Dialog Close must project command states.');
51
- }
52
- const { disabled, hovered, focusVisible, pressed } = buttonState;
53
- // P-SHADCN-DIALOG-CLOSE-CURRENT-VISUAL-SURFACE
54
- def.feedback.style.use(tw(BASE_TOKENS));
55
- Object.keys(VARIANT_TOKENS).forEach((variant) => {
56
- def.rule({
57
- when: (w) => w.prop('variant').eq(variant),
58
- intent: (i) => i.feedback.style.use(tw(VARIANT_TOKENS[variant])),
59
- });
60
- });
61
- def.rule({
62
- when: (w) => w.state(focusVisible).eq(true),
63
- intent: (i) => i.feedback.style.use(tw('border-ring ring-3 ring-ring/50')),
64
- });
65
- def.rule({
66
- when: (w) => w.state(pressed).eq(true),
67
- intent: (i) => i.feedback.style.use(tw('translate-y-px')),
68
- });
69
- def.rule({
70
- when: (w) => w.all(w.state(hovered).eq(true), w.prop('variant').eq('default')),
71
- intent: (i) => i.feedback.style.use(tw('bg-primary/80')),
72
- });
73
- def.rule({
74
- when: (w) => w.all(w.state(hovered).eq(true), w.prop('variant').eq('secondary')),
75
- intent: (i) => i.feedback.style.use(tw('bg-secondary/80')),
76
- });
77
- def.rule({
78
- when: (w) => w.all(w.state(hovered).eq(true), w.prop('variant').eq('outline')),
79
- intent: (i) => i.feedback.style.use(tw('bg-muted text-foreground')),
80
- });
81
- def.rule({
82
- when: (w) => w.all(w.state(hovered).eq(true), w.prop('variant').eq('ghost')),
83
- intent: (i) => i.feedback.style.use(tw('bg-muted text-foreground')),
84
- });
85
- def.rule({
86
- when: (w) => w.all(w.state(hovered).eq(true), w.prop('variant').eq('link')),
87
- intent: (i) => i.feedback.style.use(tw('underline')),
88
- });
89
- def.rule({
90
- when: (w) => w.all(w.state(hovered).eq(true), w.prop('variant').eq('destructive')),
91
- intent: (i) => i.feedback.style.use(tw('bg-destructive/20')),
92
- });
93
- def.rule({
94
- when: (w) => w.state(disabled).eq(true),
95
- intent: (i) => i.feedback.style.use(tw('pointer-events-none opacity-50')),
96
- });
8
+ asDialogClose();
97
9
  },
98
10
  });
99
11
  /** P-SHADCN-DIALOG-CLOSE-DIRECT-ENTRY and P-SHADCN-DIALOG-CLOSE-STATE-DRIVEN-STYLES. */
@@ -0,0 +1,2 @@
1
+ declare const dialogFooter: import("@proto.ui/core").Prototype<import("@proto.ui/types").PropsBaseType, Record<string, unknown>>;
2
+ export default dialogFooter;
@@ -0,0 +1,11 @@
1
+ import { definePrototype, tw } from '@proto.ui/core';
2
+ import { DIALOG_FAMILY } from '@proto.ui/prototypes-base/dialog';
3
+ const dialogFooter = definePrototype({
4
+ name: 'shadcn-dialog-footer',
5
+ setup(def) {
6
+ def.anatomy.claim(DIALOG_FAMILY, { role: 'footer' });
7
+ def.feedback.style.use(tw('flex gap-2 items-center'));
8
+ return (renderer) => renderer.r.slot();
9
+ },
10
+ });
11
+ export default dialogFooter;
@@ -0,0 +1,2 @@
1
+ declare const dialogHeader: import("@proto.ui/core").Prototype<import("@proto.ui/types").PropsBaseType, Record<string, unknown>>;
2
+ export default dialogHeader;
@@ -0,0 +1,11 @@
1
+ import { definePrototype, tw } from '@proto.ui/core';
2
+ import { DIALOG_FAMILY } from '@proto.ui/prototypes-base/dialog';
3
+ const dialogHeader = definePrototype({
4
+ name: 'shadcn-dialog-header',
5
+ setup(def) {
6
+ def.anatomy.claim(DIALOG_FAMILY, { role: 'header' });
7
+ def.feedback.style.use(tw('flex flex-col gap-2 text-left'));
8
+ return (renderer) => renderer.r.slot();
9
+ },
10
+ });
11
+ export default dialogHeader;
@@ -1,12 +1,15 @@
1
1
  import dialogClose from './close.proto';
2
2
  import dialogContent from './content.proto';
3
+ import dialogCloseIcon from './close-icon.proto';
3
4
  import dialogDescription from './description.proto';
4
5
  import dialogMask from './overlay.proto';
5
6
  import dialogRoot from './root.proto';
6
7
  import dialogTitle from './title.proto';
7
8
  import dialogTrigger from './trigger.proto';
9
+ import dialogHeader from './header.proto';
10
+ import dialogFooter from './footer.proto';
8
11
  export type { ShadcnDialogRootProps, ShadcnDialogRootExposes, ShadcnDialogRootAsHookContract, ShadcnDialogTriggerProps, ShadcnDialogTriggerExposes, ShadcnDialogTriggerAsHookContract, ShadcnDialogMaskProps, ShadcnDialogMaskExposes, ShadcnDialogMaskAsHookContract, ShadcnDialogContentProps, ShadcnDialogContentExposes, ShadcnDialogContentAsHookContract, ShadcnDialogTitleProps, ShadcnDialogTitleExposes, ShadcnDialogTitleAsHookContract, ShadcnDialogDescriptionProps, ShadcnDialogDescriptionExposes, ShadcnDialogDescriptionAsHookContract, ShadcnDialogCloseProps, ShadcnDialogCloseExposes, ShadcnDialogCloseAsHookContract, } from './types';
9
- export { dialogRoot, dialogTrigger, dialogMask, dialogContent, dialogTitle, dialogDescription, dialogClose, };
12
+ export { dialogRoot, dialogTrigger, dialogMask, dialogContent, dialogTitle, dialogDescription, dialogClose, dialogCloseIcon, dialogHeader, dialogFooter, };
10
13
  export { default as shadcnDialogRoot } from './root.proto';
11
14
  export { default as shadcnDialogTrigger } from './trigger.proto';
12
15
  export { default as shadcnDialogMask } from './overlay.proto';
@@ -14,3 +17,6 @@ export { default as shadcnDialogContent } from './content.proto';
14
17
  export { default as shadcnDialogTitle } from './title.proto';
15
18
  export { default as shadcnDialogDescription } from './description.proto';
16
19
  export { default as shadcnDialogClose } from './close.proto';
20
+ export { default as shadcnDialogCloseIcon } from './close-icon.proto';
21
+ export { default as shadcnDialogHeader } from './header.proto';
22
+ export { default as shadcnDialogFooter } from './footer.proto';
@@ -1,11 +1,14 @@
1
1
  import dialogClose from './close.proto';
2
2
  import dialogContent from './content.proto';
3
+ import dialogCloseIcon from './close-icon.proto';
3
4
  import dialogDescription from './description.proto';
4
5
  import dialogMask from './overlay.proto';
5
6
  import dialogRoot from './root.proto';
6
7
  import dialogTitle from './title.proto';
7
8
  import dialogTrigger from './trigger.proto';
8
- export { dialogRoot, dialogTrigger, dialogMask, dialogContent, dialogTitle, dialogDescription, dialogClose, };
9
+ import dialogHeader from './header.proto';
10
+ import dialogFooter from './footer.proto';
11
+ export { dialogRoot, dialogTrigger, dialogMask, dialogContent, dialogTitle, dialogDescription, dialogClose, dialogCloseIcon, dialogHeader, dialogFooter, };
9
12
  export { default as shadcnDialogRoot } from './root.proto';
10
13
  export { default as shadcnDialogTrigger } from './trigger.proto';
11
14
  export { default as shadcnDialogMask } from './overlay.proto';
@@ -13,3 +16,6 @@ export { default as shadcnDialogContent } from './content.proto';
13
16
  export { default as shadcnDialogTitle } from './title.proto';
14
17
  export { default as shadcnDialogDescription } from './description.proto';
15
18
  export { default as shadcnDialogClose } from './close.proto';
19
+ export { default as shadcnDialogCloseIcon } from './close-icon.proto';
20
+ export { default as shadcnDialogHeader } from './header.proto';
21
+ export { default as shadcnDialogFooter } from './footer.proto';
@@ -20,8 +20,6 @@ export type ShadcnDialogTitleAsHookContract = DialogTitleAsHookContract;
20
20
  export type ShadcnDialogDescriptionProps = DialogDescriptionProps;
21
21
  export type ShadcnDialogDescriptionExposes = DialogDescriptionExposes;
22
22
  export type ShadcnDialogDescriptionAsHookContract = DialogDescriptionAsHookContract;
23
- export type ShadcnDialogCloseProps = DialogCloseProps & {
24
- variant?: 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link';
25
- };
23
+ export type ShadcnDialogCloseProps = DialogCloseProps;
26
24
  export type ShadcnDialogCloseExposes = DialogCloseExposes;
27
25
  export type ShadcnDialogCloseAsHookContract = DialogCloseAsHookContract;
package/dist/index.d.ts CHANGED
@@ -25,7 +25,7 @@ export { default as shadcnSelectTrigger } from './select/trigger.proto';
25
25
  export { default as shadcnSelectValue } from './select/value.proto';
26
26
  export { default as shadcnSelectContent } from './select/content.proto';
27
27
  export { default as shadcnSelectItem } from './select/item.proto';
28
- export { dialogRoot, dialogTrigger, dialogMask, dialogContent, dialogTitle, dialogDescription, dialogClose, } from './dialog';
28
+ export { dialogRoot, dialogTrigger, dialogMask, dialogContent, dialogTitle, dialogDescription, dialogClose, dialogCloseIcon, dialogHeader, dialogFooter, } from './dialog';
29
29
  export { default as shadcnDialogRoot } from './dialog/root.proto';
30
30
  export { default as shadcnDialogTrigger } from './dialog/trigger.proto';
31
31
  export { default as shadcnDialogMask } from './dialog/overlay.proto';
@@ -33,6 +33,9 @@ export { default as shadcnDialogContent } from './dialog/content.proto';
33
33
  export { default as shadcnDialogTitle } from './dialog/title.proto';
34
34
  export { default as shadcnDialogDescription } from './dialog/description.proto';
35
35
  export { default as shadcnDialogClose } from './dialog/close.proto';
36
+ export { default as shadcnDialogCloseIcon } from './dialog/close-icon.proto';
37
+ export { default as shadcnDialogHeader } from './dialog/header.proto';
38
+ export { default as shadcnDialogFooter } from './dialog/footer.proto';
36
39
  export type { ShadcnButtonProps, ShadcnButtonExposes, ShadcnButtonSize, ShadcnButtonVariant, } from './button/types';
37
40
  export type { ShadcnToggleProps, ShadcnToggleExposes, ShadcnToggleStateHandles, ShadcnToggleAsHookContract, } from './toggle/types';
38
41
  export type { ShadcnSwitchRootProps, ShadcnSwitchRootExposes, ShadcnSwitchRootStateHandles, ShadcnSwitchRootAsHookContract, ShadcnSwitchThumbProps, ShadcnSwitchThumbExposes, ShadcnSwitchThumbAsHookContract, } from './switch/types';
package/dist/index.js CHANGED
@@ -25,7 +25,7 @@ export { default as shadcnSelectTrigger } from './select/trigger.proto';
25
25
  export { default as shadcnSelectValue } from './select/value.proto';
26
26
  export { default as shadcnSelectContent } from './select/content.proto';
27
27
  export { default as shadcnSelectItem } from './select/item.proto';
28
- export { dialogRoot, dialogTrigger, dialogMask, dialogContent, dialogTitle, dialogDescription, dialogClose, } from './dialog';
28
+ export { dialogRoot, dialogTrigger, dialogMask, dialogContent, dialogTitle, dialogDescription, dialogClose, dialogCloseIcon, dialogHeader, dialogFooter, } from './dialog';
29
29
  export { default as shadcnDialogRoot } from './dialog/root.proto';
30
30
  export { default as shadcnDialogTrigger } from './dialog/trigger.proto';
31
31
  export { default as shadcnDialogMask } from './dialog/overlay.proto';
@@ -33,3 +33,6 @@ export { default as shadcnDialogContent } from './dialog/content.proto';
33
33
  export { default as shadcnDialogTitle } from './dialog/title.proto';
34
34
  export { default as shadcnDialogDescription } from './dialog/description.proto';
35
35
  export { default as shadcnDialogClose } from './dialog/close.proto';
36
+ export { default as shadcnDialogCloseIcon } from './dialog/close-icon.proto';
37
+ export { default as shadcnDialogHeader } from './dialog/header.proto';
38
+ export { default as shadcnDialogFooter } from './dialog/footer.proto';
@@ -11,7 +11,7 @@ const ROOT_BASE_TOKENS = [
11
11
  'border',
12
12
  'border-transparent',
13
13
  'pl-0.5',
14
- 'pr-[20px]',
14
+ 'pr-5',
15
15
  'shadow-xs',
16
16
  'transition-all',
17
17
  'duration-200',
@@ -35,7 +35,7 @@ const switchRoot = definePrototype({
35
35
  // P-SHADCN-SWITCH-STATE-DRIVEN-STYLES
36
36
  def.rule({
37
37
  when: (w) => w.state(checked).eq(true),
38
- intent: (i) => i.feedback.style.use(tw('pl-[20px] pr-0.5 bg-primary text-primary-foreground')),
38
+ intent: (i) => i.feedback.style.use(tw('pl-5 pr-0.5 bg-primary text-primary-foreground')),
39
39
  });
40
40
  def.rule({
41
41
  when: (w) => w.all(w.state(checked).eq(false), w.state(hovered).eq(true)),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proto.ui/prototypes-shadcn",
3
- "version": "0.2.0-rc.1",
3
+ "version": "0.2.0-rc.4",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "protoUi": {
@@ -11,8 +11,8 @@
11
11
  }
12
12
  },
13
13
  "dependencies": {
14
- "@proto.ui/core": "0.2.0-rc.1",
15
- "@proto.ui/prototypes-base": "0.2.0-rc.1"
14
+ "@proto.ui/core": "0.2.0-rc.4",
15
+ "@proto.ui/prototypes-base": "0.2.0-rc.4"
16
16
  },
17
17
  "exports": {
18
18
  ".": {