@proto.ui/prototypes-shadcn 0.2.0-rc.5 → 0.2.0-rc.6

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,35 @@
1
+ import { shadcnDialogComponentPreset } from './dialog/preset';
2
+ import { shadcnSwitchComponentPreset } from './switch/preset';
3
+ export type { ShadcnComponentPresetRecipe } from './component-presets.types';
4
+ export { shadcnDialogComponentPreset, shadcnSwitchComponentPreset };
5
+ /**
6
+ * Aggregate surface for prototype-library-owned composition recipes.
7
+ *
8
+ * Each recipe is authored beside its component prototypes. Recipes declare
9
+ * part identity and replacement policy only. Host facade names for the
10
+ * referenced prototypes remain adapter/CLI registry concerns, and all visual
11
+ * tokens remain owned by the referenced prototypes.
12
+ */
13
+ export declare const shadcnComponentPresets: {
14
+ readonly 'shadcn-switch': {
15
+ readonly kind: "replaceable-default-part";
16
+ readonly placement: "direct-child";
17
+ readonly exportName: "ShadcnSwitch";
18
+ readonly rootPrototype: "shadcnSwitchRoot";
19
+ readonly defaultPartPrototype: "shadcnSwitchThumb";
20
+ readonly inputName: "thumb";
21
+ readonly elementName: "proto-ui-shadcn-switch";
22
+ readonly omissionAttribute: "data-pui-no-default-thumb";
23
+ };
24
+ readonly 'shadcn-dialog': {
25
+ readonly kind: "replaceable-default-part";
26
+ readonly placement: "direct-child";
27
+ readonly exportName: "ShadcnDialogContent";
28
+ readonly rootPrototype: "shadcnDialogContent";
29
+ readonly defaultPartPrototype: "shadcnDialogCloseIcon";
30
+ readonly inputName: "close";
31
+ readonly elementName: "proto-ui-shadcn-dialog-content";
32
+ readonly omissionAttribute: "data-pui-no-default-close";
33
+ };
34
+ };
35
+ export default shadcnComponentPresets;
@@ -0,0 +1,16 @@
1
+ import { shadcnDialogComponentPreset } from './dialog/preset';
2
+ import { shadcnSwitchComponentPreset } from './switch/preset';
3
+ export { shadcnDialogComponentPreset, shadcnSwitchComponentPreset };
4
+ /**
5
+ * Aggregate surface for prototype-library-owned composition recipes.
6
+ *
7
+ * Each recipe is authored beside its component prototypes. Recipes declare
8
+ * part identity and replacement policy only. Host facade names for the
9
+ * referenced prototypes remain adapter/CLI registry concerns, and all visual
10
+ * tokens remain owned by the referenced prototypes.
11
+ */
12
+ export const shadcnComponentPresets = {
13
+ 'shadcn-switch': shadcnSwitchComponentPreset,
14
+ 'shadcn-dialog': shadcnDialogComponentPreset,
15
+ };
16
+ export default shadcnComponentPresets;
@@ -0,0 +1,10 @@
1
+ export interface ShadcnComponentPresetRecipe {
2
+ readonly kind: 'replaceable-default-part';
3
+ readonly placement: 'direct-child';
4
+ readonly exportName: string;
5
+ readonly rootPrototype: string;
6
+ readonly defaultPartPrototype: string;
7
+ readonly inputName: string;
8
+ readonly elementName: string;
9
+ readonly omissionAttribute: string;
10
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -8,14 +8,14 @@ const dialogCloseIcon = definePrototype({
8
8
  throw new Error('[shadcn-dialog-close-icon] command states are required.');
9
9
  const { disabled, hovered, focusVisible } = state;
10
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'));
11
+ def.feedback.style.use(tw('absolute right-4 top-4 inline-flex items-center justify-center rounded-sm opacity-70 transition-opacity outline-none ring-offset-0'));
12
12
  def.rule({
13
13
  when: (w) => w.state(hovered).eq(true),
14
- intent: (i) => i.feedback.style.use(tw('bg-muted')),
14
+ intent: (i) => i.feedback.style.use(tw('opacity-100')),
15
15
  });
16
16
  def.rule({
17
17
  when: (w) => w.state(focusVisible).eq(true),
18
- intent: (i) => i.feedback.style.use(tw('ring-3 ring-ring/50')),
18
+ intent: (i) => i.feedback.style.use(tw('ring-2 ring-ring ring-offset-2 ring-offset-background')),
19
19
  });
20
20
  def.rule({
21
21
  when: (w) => w.state(disabled).eq(true),
@@ -20,3 +20,4 @@ export { default as shadcnDialogClose } from './close.proto';
20
20
  export { default as shadcnDialogCloseIcon } from './close-icon.proto';
21
21
  export { default as shadcnDialogHeader } from './header.proto';
22
22
  export { default as shadcnDialogFooter } from './footer.proto';
23
+ export { default as componentPreset, shadcnDialogComponentPreset } from './preset';
@@ -19,3 +19,4 @@ export { default as shadcnDialogClose } from './close.proto';
19
19
  export { default as shadcnDialogCloseIcon } from './close-icon.proto';
20
20
  export { default as shadcnDialogHeader } from './header.proto';
21
21
  export { default as shadcnDialogFooter } from './footer.proto';
22
+ export { default as componentPreset, shadcnDialogComponentPreset } from './preset';
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Component-local composition recipe for the Shadcn Dialog Content convenience facade.
3
+ * Visual tokens remain owned by the referenced Content and CloseIcon prototypes.
4
+ */
5
+ export declare const shadcnDialogComponentPreset: {
6
+ readonly kind: "replaceable-default-part";
7
+ readonly placement: "direct-child";
8
+ readonly exportName: "ShadcnDialogContent";
9
+ readonly rootPrototype: "shadcnDialogContent";
10
+ readonly defaultPartPrototype: "shadcnDialogCloseIcon";
11
+ readonly inputName: "close";
12
+ readonly elementName: "proto-ui-shadcn-dialog-content";
13
+ readonly omissionAttribute: "data-pui-no-default-close";
14
+ };
15
+ export default shadcnDialogComponentPreset;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Component-local composition recipe for the Shadcn Dialog Content convenience facade.
3
+ * Visual tokens remain owned by the referenced Content and CloseIcon prototypes.
4
+ */
5
+ export const shadcnDialogComponentPreset = {
6
+ kind: 'replaceable-default-part',
7
+ placement: 'direct-child',
8
+ exportName: 'ShadcnDialogContent',
9
+ rootPrototype: 'shadcnDialogContent',
10
+ defaultPartPrototype: 'shadcnDialogCloseIcon',
11
+ inputName: 'close',
12
+ elementName: 'proto-ui-shadcn-dialog-content',
13
+ omissionAttribute: 'data-pui-no-default-close',
14
+ };
15
+ export default shadcnDialogComponentPreset;
@@ -1,4 +1,3 @@
1
- import type { ShadcnDialogTriggerProps } from './types';
2
- declare const dialogTrigger: import("@proto.ui/core").Prototype<ShadcnDialogTriggerProps, import("@proto.ui/prototypes-base/dialog").DialogTriggerExposes>;
3
- /** P-SHADCN-DIALOG-TRIGGER-DIRECT-ENTRY and P-SHADCN-DIALOG-TRIGGER-STATE-DRIVEN-STYLES. */
1
+ declare const dialogTrigger: import("@proto.ui/core").Prototype<import("@proto.ui/prototypes-base/dialog").DialogTriggerProps, import("@proto.ui/prototypes-base/dialog").DialogTriggerExposes>;
2
+ /** P-SHADCN-DIALOG-TRIGGER-DIRECT-ENTRY and P-SHADCN-DIALOG-TRIGGER-UNSTYLED-SURFACE. */
4
3
  export default dialogTrigger;
@@ -1,118 +1,13 @@
1
- import { definePrototype, tw } from '@proto.ui/core';
1
+ import { definePrototype } from '@proto.ui/core';
2
2
  import { asDialogTrigger } 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 dialogTrigger = definePrototype({
31
4
  name: 'shadcn-dialog-trigger',
32
- setup(def) {
33
- // P-SHADCN-DIALOG-TRIGGER-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-TRIGGER-BASE-INHERITANCE,
47
7
  // P-SHADCN-DIALOG-TRIGGER-CURRENT-BASE-DEVIATIONS
48
- const buttonState = asDialogTrigger().stateHandles;
49
- if (!buttonState) {
50
- throw new Error('[shadcn-dialog-trigger] Dialog Trigger must project command states.');
51
- }
52
- const { disabled, hovered, focusVisible, pressed } = buttonState;
53
- const expanded = def.state.fromAccessibility('expanded');
54
- const invalid = def.state.fromAccessibility('invalid');
55
- // P-SHADCN-DIALOG-TRIGGER-CURRENT-VISUAL-SURFACE
56
- def.feedback.style.use(tw(BASE_TOKENS));
57
- Object.keys(VARIANT_TOKENS).forEach((variant) => {
58
- def.rule({
59
- when: (w) => w.prop('variant').eq(variant),
60
- intent: (i) => i.feedback.style.use(tw(VARIANT_TOKENS[variant])),
61
- });
62
- });
63
- def.rule({
64
- when: (w) => w.state(focusVisible).eq(true),
65
- intent: (i) => i.feedback.style.use(tw('border-ring ring-3 ring-ring/50')),
66
- });
67
- def.rule({
68
- when: (w) => w.all(w.state(focusVisible).eq(true), w.prop('variant').eq('destructive')),
69
- intent: (i) => i.feedback.style.use(tw('border-destructive/40 ring-destructive/20')),
70
- });
71
- def.rule({
72
- when: (w) => w.state(pressed).eq(true),
73
- intent: (i) => i.feedback.style.use(tw('translate-y-px')),
74
- });
75
- def.rule({
76
- when: (w) => w.all(w.state(hovered).eq(true), w.prop('variant').eq('default')),
77
- intent: (i) => i.feedback.style.use(tw('bg-primary/80')),
78
- });
79
- def.rule({
80
- when: (w) => w.all(w.state(hovered).eq(true), w.prop('variant').eq('secondary')),
81
- intent: (i) => i.feedback.style.use(tw('bg-secondary/80')),
82
- });
83
- def.rule({
84
- when: (w) => w.all(w.state(hovered).eq(true), w.prop('variant').eq('outline')),
85
- intent: (i) => i.feedback.style.use(tw('bg-muted text-foreground')),
86
- });
87
- def.rule({
88
- when: (w) => w.all(w.state(hovered).eq(true), w.prop('variant').eq('ghost')),
89
- intent: (i) => i.feedback.style.use(tw('bg-muted text-foreground')),
90
- });
91
- def.rule({
92
- when: (w) => w.all(w.state(hovered).eq(true), w.prop('variant').eq('link')),
93
- intent: (i) => i.feedback.style.use(tw('underline')),
94
- });
95
- def.rule({
96
- when: (w) => w.all(w.state(hovered).eq(true), w.prop('variant').eq('destructive')),
97
- intent: (i) => i.feedback.style.use(tw('bg-destructive/20')),
98
- });
99
- def.rule({
100
- when: (w) => w.all(w.state(expanded).eq(true), w.prop('variant').eq('outline')),
101
- intent: (i) => i.feedback.style.use(tw('bg-muted text-foreground')),
102
- });
103
- def.rule({
104
- when: (w) => w.all(w.state(expanded).eq(true), w.prop('variant').eq('secondary')),
105
- intent: (i) => i.feedback.style.use(tw('bg-secondary text-secondary-foreground')),
106
- });
107
- def.rule({
108
- when: (w) => w.state(invalid).eq(true),
109
- intent: (i) => i.feedback.style.use(tw('border-destructive ring-3 ring-destructive/20')),
110
- });
111
- def.rule({
112
- when: (w) => w.state(disabled).eq(true),
113
- intent: (i) => i.feedback.style.use(tw('pointer-events-none opacity-50')),
114
- });
8
+ // P-SHADCN-DIALOG-TRIGGER-UNSTYLED-SURFACE
9
+ asDialogTrigger();
115
10
  },
116
11
  });
117
- /** P-SHADCN-DIALOG-TRIGGER-DIRECT-ENTRY and P-SHADCN-DIALOG-TRIGGER-STATE-DRIVEN-STYLES. */
12
+ /** P-SHADCN-DIALOG-TRIGGER-DIRECT-ENTRY and P-SHADCN-DIALOG-TRIGGER-UNSTYLED-SURFACE. */
118
13
  export default dialogTrigger;
@@ -2,9 +2,7 @@ import type { DialogCloseAsHookContract, DialogCloseExposes, DialogCloseProps, D
2
2
  export type ShadcnDialogRootProps = DialogRootProps;
3
3
  export type ShadcnDialogRootExposes = DialogRootExposes;
4
4
  export type ShadcnDialogRootAsHookContract = DialogRootAsHookContract;
5
- export type ShadcnDialogTriggerProps = DialogTriggerProps & {
6
- variant?: 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link';
7
- };
5
+ export type ShadcnDialogTriggerProps = DialogTriggerProps;
8
6
  export type ShadcnDialogTriggerExposes = DialogTriggerExposes;
9
7
  export type ShadcnDialogTriggerAsHookContract = DialogTriggerAsHookContract;
10
8
  export type ShadcnDialogMaskProps = Pick<DialogMaskProps, 'passthrough'>;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { default as button } from './button';
2
2
  export { default as shadcnButton } from './button';
3
+ export { default as componentPresets, shadcnDialogComponentPreset, shadcnComponentPresets, shadcnSwitchComponentPreset, type ShadcnComponentPresetRecipe, } from './component-presets';
3
4
  export { default as toggle } from './toggle';
4
5
  export { default as shadcnToggle } from './toggle';
5
6
  export { switchRoot, switchThumb } from './switch';
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export { default as button } from './button';
2
2
  export { default as shadcnButton } from './button';
3
+ export { default as componentPresets, shadcnDialogComponentPreset, shadcnComponentPresets, shadcnSwitchComponentPreset, } from './component-presets';
3
4
  export { default as toggle } from './toggle';
4
5
  export { default as shadcnToggle } from './toggle';
5
6
  export { switchRoot, switchThumb } from './switch';
@@ -4,3 +4,4 @@ export type { ShadcnSwitchRootProps, ShadcnSwitchRootExposes, ShadcnSwitchRootSt
4
4
  export { switchRoot, switchThumb };
5
5
  export { default as shadcnSwitchRoot } from './root.proto';
6
6
  export { default as shadcnSwitchThumb } from './thumb.proto';
7
+ export { default as componentPreset, shadcnSwitchComponentPreset } from './preset';
@@ -3,3 +3,4 @@ import switchThumb from './thumb.proto';
3
3
  export { switchRoot, switchThumb };
4
4
  export { default as shadcnSwitchRoot } from './root.proto';
5
5
  export { default as shadcnSwitchThumb } from './thumb.proto';
6
+ export { default as componentPreset, shadcnSwitchComponentPreset } from './preset';
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Component-local composition recipe for the Shadcn Switch convenience facade.
3
+ * Visual tokens remain owned by the referenced Root and Thumb prototypes.
4
+ */
5
+ export declare const shadcnSwitchComponentPreset: {
6
+ readonly kind: "replaceable-default-part";
7
+ readonly placement: "direct-child";
8
+ readonly exportName: "ShadcnSwitch";
9
+ readonly rootPrototype: "shadcnSwitchRoot";
10
+ readonly defaultPartPrototype: "shadcnSwitchThumb";
11
+ readonly inputName: "thumb";
12
+ readonly elementName: "proto-ui-shadcn-switch";
13
+ readonly omissionAttribute: "data-pui-no-default-thumb";
14
+ };
15
+ export default shadcnSwitchComponentPreset;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Component-local composition recipe for the Shadcn Switch convenience facade.
3
+ * Visual tokens remain owned by the referenced Root and Thumb prototypes.
4
+ */
5
+ export const shadcnSwitchComponentPreset = {
6
+ kind: 'replaceable-default-part',
7
+ placement: 'direct-child',
8
+ exportName: 'ShadcnSwitch',
9
+ rootPrototype: 'shadcnSwitchRoot',
10
+ defaultPartPrototype: 'shadcnSwitchThumb',
11
+ inputName: 'thumb',
12
+ elementName: 'proto-ui-shadcn-switch',
13
+ omissionAttribute: 'data-pui-no-default-thumb',
14
+ };
15
+ export default shadcnSwitchComponentPreset;
@@ -10,6 +10,7 @@ const THUMB_TOKENS = [
10
10
  'border-border/50',
11
11
  'shadow-lg',
12
12
  'ring-0',
13
+ 'ring-offset-0',
13
14
  'transition-all',
14
15
  'duration-200',
15
16
  'ease-in-out',
@@ -31,7 +32,7 @@ const switchThumb = definePrototype({
31
32
  def.feedback.style.use(tw(THUMB_TOKENS));
32
33
  def.rule({
33
34
  when: (w) => w.state(checked).eq(true),
34
- intent: (i) => i.feedback.style.use(tw('translate-x-5')),
35
+ intent: (i) => i.feedback.style.use(tw('translate-x-[calc(100%_-_2px)]')),
35
36
  });
36
37
  },
37
38
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proto.ui/prototypes-shadcn",
3
- "version": "0.2.0-rc.5",
3
+ "version": "0.2.0-rc.6",
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.5",
15
- "@proto.ui/prototypes-base": "0.2.0-rc.5"
14
+ "@proto.ui/core": "0.2.0-rc.6",
15
+ "@proto.ui/prototypes-base": "0.2.0-rc.6"
16
16
  },
17
17
  "exports": {
18
18
  ".": {
@@ -23,6 +23,10 @@
23
23
  "types": "./dist/button/index.d.ts",
24
24
  "default": "./dist/button/index.js"
25
25
  },
26
+ "./component-presets": {
27
+ "types": "./dist/component-presets.d.ts",
28
+ "default": "./dist/component-presets.js"
29
+ },
26
30
  "./dialog": {
27
31
  "types": "./dist/dialog/index.d.ts",
28
32
  "default": "./dist/dialog/index.js"