@proto.ui/prototypes-shadcn 0.1.0 → 0.2.0-rc.0
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 +25 -2
- package/THIRD_PARTY_NOTICES.md +15 -0
- package/dist/button/button.proto.d.ts +11 -0
- package/dist/button/button.proto.js +161 -0
- package/dist/button/index.d.ts +2 -4
- package/dist/button/index.js +1 -175
- package/dist/button/types.d.ts +1 -1
- package/dist/dialog/close.proto.d.ts +4 -0
- package/dist/dialog/{close.js → close.proto.js} +13 -8
- package/dist/dialog/content.proto.d.ts +4 -0
- package/dist/dialog/content.proto.js +26 -0
- package/dist/dialog/description.proto.d.ts +3 -0
- package/dist/dialog/description.proto.js +13 -0
- package/dist/dialog/index.d.ts +14 -14
- package/dist/dialog/index.js +14 -14
- package/dist/dialog/overlay.proto.d.ts +4 -0
- package/dist/dialog/overlay.proto.js +26 -0
- package/dist/dialog/root.proto.d.ts +3 -0
- package/dist/dialog/root.proto.js +13 -0
- package/dist/dialog/title.proto.d.ts +3 -0
- package/dist/dialog/{title.js → title.proto.js} +4 -1
- package/dist/dialog/trigger.proto.d.ts +4 -0
- package/dist/dialog/{trigger.js → trigger.proto.js} +13 -8
- package/dist/dialog/types.d.ts +6 -5
- package/dist/dropdown/content.proto.d.ts +3 -0
- package/dist/dropdown/content.proto.js +43 -0
- package/dist/dropdown/index.d.ts +8 -8
- package/dist/dropdown/index.js +8 -8
- package/dist/dropdown/item.proto.d.ts +4 -0
- package/dist/dropdown/item.proto.js +50 -0
- package/dist/dropdown/root.proto.d.ts +3 -0
- package/dist/dropdown/root.proto.js +12 -0
- package/dist/dropdown/trigger.proto.d.ts +4 -0
- package/dist/dropdown/{trigger.js → trigger.proto.js} +15 -9
- package/dist/dropdown/types.d.ts +5 -2
- package/dist/hover-card/content.proto.d.ts +3 -0
- package/dist/hover-card/content.proto.js +42 -0
- package/dist/hover-card/index.d.ts +6 -6
- package/dist/hover-card/index.js +6 -6
- package/dist/hover-card/root.proto.d.ts +3 -0
- package/dist/hover-card/root.proto.js +14 -0
- package/dist/hover-card/trigger.proto.d.ts +3 -0
- package/dist/hover-card/trigger.proto.js +33 -0
- package/dist/hover-card/types.d.ts +1 -1
- package/dist/index.d.ts +27 -20
- package/dist/index.js +26 -20
- package/dist/select/content.proto.d.ts +4 -0
- package/dist/select/content.proto.js +52 -0
- package/dist/select/index.d.ts +11 -0
- package/dist/select/index.js +10 -0
- package/dist/select/item.proto.d.ts +3 -0
- package/dist/select/item.proto.js +60 -0
- package/dist/select/root.proto.d.ts +3 -0
- package/dist/select/root.proto.js +11 -0
- package/dist/select/trigger.proto.d.ts +4 -0
- package/dist/select/trigger.proto.js +66 -0
- package/dist/select/types.d.ts +20 -0
- package/dist/select/types.js +1 -0
- package/dist/select/value.proto.d.ts +3 -0
- package/dist/select/value.proto.js +16 -0
- package/dist/switch/index.d.ts +4 -4
- package/dist/switch/index.js +4 -4
- package/dist/switch/root.proto.d.ts +8 -0
- package/dist/switch/{root.js → root.proto.js} +19 -9
- package/dist/switch/thumb.proto.d.ts +8 -0
- package/dist/switch/{thumb.js → thumb.proto.js} +10 -1
- package/dist/switch/types.d.ts +1 -1
- package/dist/tabs/content.proto.d.ts +4 -0
- package/dist/tabs/content.proto.js +23 -0
- package/dist/tabs/index.d.ts +8 -8
- package/dist/tabs/index.js +8 -8
- package/dist/tabs/list.proto.d.ts +4 -0
- package/dist/tabs/list.proto.js +13 -0
- package/dist/tabs/root.proto.d.ts +4 -0
- package/dist/tabs/root.proto.js +13 -0
- package/dist/tabs/trigger.proto.d.ts +4 -0
- package/dist/tabs/{trigger.js → trigger.proto.js} +11 -7
- package/dist/tabs/types.d.ts +1 -1
- package/dist/toggle/index.d.ts +2 -4
- package/dist/toggle/index.js +1 -82
- package/dist/toggle/toggle.proto.d.ts +11 -0
- package/dist/toggle/toggle.proto.js +85 -0
- package/dist/toggle/types.d.ts +1 -1
- package/package.json +46 -5
- package/dist/dialog/close.d.ts +0 -3
- package/dist/dialog/content.d.ts +0 -2
- package/dist/dialog/content.js +0 -10
- package/dist/dialog/description.d.ts +0 -2
- package/dist/dialog/description.js +0 -10
- package/dist/dialog/overlay.d.ts +0 -2
- package/dist/dialog/overlay.js +0 -10
- package/dist/dialog/root.d.ts +0 -2
- package/dist/dialog/root.js +0 -10
- package/dist/dialog/title.d.ts +0 -2
- package/dist/dialog/trigger.d.ts +0 -3
- package/dist/dropdown/content.d.ts +0 -2
- package/dist/dropdown/content.js +0 -10
- package/dist/dropdown/item.d.ts +0 -2
- package/dist/dropdown/item.js +0 -49
- package/dist/dropdown/root.d.ts +0 -2
- package/dist/dropdown/root.js +0 -10
- package/dist/dropdown/trigger.d.ts +0 -3
- package/dist/hover-card/content.d.ts +0 -2
- package/dist/hover-card/content.js +0 -10
- package/dist/hover-card/root.d.ts +0 -2
- package/dist/hover-card/root.js +0 -10
- package/dist/hover-card/trigger.d.ts +0 -2
- package/dist/hover-card/trigger.js +0 -46
- package/dist/switch/root.d.ts +0 -3
- package/dist/switch/thumb.d.ts +0 -3
- package/dist/tabs/content.d.ts +0 -3
- package/dist/tabs/content.js +0 -15
- package/dist/tabs/list.d.ts +0 -3
- package/dist/tabs/list.js +0 -10
- package/dist/tabs/root.d.ts +0 -3
- package/dist/tabs/root.js +0 -10
- package/dist/tabs/trigger.d.ts +0 -3
package/README.md
CHANGED
|
@@ -6,6 +6,15 @@ shadcn-style Proto UI prototype library for adapter-driven components.
|
|
|
6
6
|
|
|
7
7
|
Provides a shadcn-style Proto UI prototype library that works with Proto UI adapters.
|
|
8
8
|
|
|
9
|
+
## Source Attribution And Status
|
|
10
|
+
|
|
11
|
+
- Component APIs and visual definitions are derived from [shadcn/ui](https://github.com/shadcn-ui/ui).
|
|
12
|
+
- This package is maintained by Proto UI and is not an official shadcn/ui package.
|
|
13
|
+
- Each cataloged component pins an upstream comparison revision and declares its current compatible subset; uncataloged or unimplemented upstream API must not be implied as supported.
|
|
14
|
+
- The first pinned catalog baseline is the v4 new-york Button at shadcn-ui/ui revision `f31ed81983653919dd4fe77aee4b4859f610f1dc`.
|
|
15
|
+
- Shadcn prototypes inherit their Base protocols by default. A setup-time negative patch is allowed only when the derived P entity explicitly declares the abandoned or replaced Base capability.
|
|
16
|
+
- Proto UI intentionally does not expose upstream `asChild`: trigger event routes remain component-author-owned and are merged automatically through `asTrigger`; transparent slots are not claimed as Radix Slot equivalents.
|
|
17
|
+
|
|
9
18
|
## Package Role
|
|
10
19
|
|
|
11
20
|
Prototype library package intended to be consumed together with Proto UI adapters.
|
|
@@ -13,14 +22,28 @@ Prototype library package intended to be consumed together with Proto UI adapter
|
|
|
13
22
|
## Install
|
|
14
23
|
|
|
15
24
|
```bash
|
|
16
|
-
npm install @proto.ui/prototypes-shadcn@0.0.
|
|
25
|
+
npm install @proto.ui/prototypes-shadcn@0.2.0-rc.0
|
|
17
26
|
```
|
|
18
27
|
|
|
28
|
+
## Family Imports
|
|
29
|
+
|
|
30
|
+
Prefer anatomy-family subpaths so only the selected Shadcn family and its corresponding Base family enter the prototype module graph:
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { shadcnButton } from '@proto.ui/prototypes-shadcn/button';
|
|
34
|
+
import { shadcnSelectRoot, shadcnSelectTrigger } from '@proto.ui/prototypes-shadcn/select';
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The root package export remains available for compatibility. Shadcn families do not depend on sibling Shadcn families.
|
|
38
|
+
|
|
19
39
|
## Internal Structure
|
|
20
40
|
|
|
21
41
|
- `src/button/`
|
|
42
|
+
- `src/dialog/`
|
|
43
|
+
- `src/dropdown/`
|
|
22
44
|
- `src/hover-card/`
|
|
23
45
|
- `src/index.ts`
|
|
46
|
+
- `src/select/`
|
|
24
47
|
- `src/switch/`
|
|
25
48
|
- `src/tabs/`
|
|
26
49
|
- `src/toggle/`
|
|
@@ -32,4 +55,4 @@ npm install @proto.ui/prototypes-shadcn@0.0.1
|
|
|
32
55
|
|
|
33
56
|
## License
|
|
34
57
|
|
|
35
|
-
MIT
|
|
58
|
+
The Proto UI integration code is MIT-licensed. The pinned shadcn/ui attribution and upstream MIT license are distributed in [`THIRD_PARTY_NOTICES.md`](./THIRD_PARTY_NOTICES.md); the Proto UI package license does not replace that upstream notice.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Third-Party Notices
|
|
2
|
+
|
|
3
|
+
`@proto.ui/prototypes-shadcn` derives component APIs and visual definitions from [shadcn/ui](https://github.com/shadcn-ui/ui). The first cataloged comparison baseline is revision `f31ed81983653919dd4fe77aee4b4859f610f1dc`. Proto UI maintains this package as an independent, unofficial implementation.
|
|
4
|
+
|
|
5
|
+
## shadcn/ui
|
|
6
|
+
|
|
7
|
+
MIT License
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2023 shadcn
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ShadcnButtonExposes, ShadcnButtonProps, ShadcnButtonSize, ShadcnButtonVariant } from './types';
|
|
2
|
+
declare const button: import("@proto.ui/core").Prototype<ShadcnButtonProps, import("@proto.ui/prototypes-base/button").ButtonExposes>;
|
|
3
|
+
/**
|
|
4
|
+
* P-SHADCN-BUTTON-COMPATIBILITY-SUBSET:
|
|
5
|
+
* The one catalog open question centralizes every upstream difference.
|
|
6
|
+
* P-SHADCN-BUTTON-AS-CHILD-OMISSION is intentional under D-AS-CHILD-OMISSION-0001;
|
|
7
|
+
* native/className forwarding, aria-invalid/nested-svg selectors, extra sizes,
|
|
8
|
+
* and exact token parity remain implementation or review gaps.
|
|
9
|
+
*/
|
|
10
|
+
export type { ShadcnButtonProps, ShadcnButtonExposes, ShadcnButtonSize, ShadcnButtonVariant };
|
|
11
|
+
export default button;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { definePrototype, tw } from '@proto.ui/core';
|
|
2
|
+
import { asButton } from '@proto.ui/prototypes-base/button';
|
|
3
|
+
// Shared button skeleton copied from shadcn/ui and reduced to the plain
|
|
4
|
+
// utility tokens that Proto UI v0 can express in feedback.style today.
|
|
5
|
+
const BUTTON_BASE_TOKENS = [
|
|
6
|
+
'group/button',
|
|
7
|
+
'inline-flex',
|
|
8
|
+
'shrink-0',
|
|
9
|
+
'items-center',
|
|
10
|
+
'justify-center',
|
|
11
|
+
'rounded-lg',
|
|
12
|
+
'border',
|
|
13
|
+
'bg-clip-padding',
|
|
14
|
+
'text-sm',
|
|
15
|
+
'font-medium',
|
|
16
|
+
'whitespace-nowrap',
|
|
17
|
+
'transition-all',
|
|
18
|
+
'outline-none',
|
|
19
|
+
'select-none',
|
|
20
|
+
].join(' ');
|
|
21
|
+
// Variant rules stay composable and only encode the stable visual surface.
|
|
22
|
+
// Pseudo selectors such as hover/focus-visible/dark are left to
|
|
23
|
+
// dedicated rule extensions because the current feedback token contract does
|
|
24
|
+
// not accept selector-style utilities directly.
|
|
25
|
+
const VARIANT_TOKENS = {
|
|
26
|
+
default: 'border-transparent bg-primary text-primary-foreground',
|
|
27
|
+
destructive: 'border-transparent bg-destructive/10 text-destructive',
|
|
28
|
+
outline: 'border-border bg-background text-foreground',
|
|
29
|
+
secondary: 'border-transparent bg-secondary text-secondary-foreground',
|
|
30
|
+
ghost: 'border-transparent bg-transparent text-foreground',
|
|
31
|
+
link: 'border-transparent bg-transparent text-primary underline-offset-4',
|
|
32
|
+
};
|
|
33
|
+
// Size rules cover the public API we expose right now. The upstream examples
|
|
34
|
+
// also contain xs-style variants, but those are not part of this prototype API
|
|
35
|
+
// yet, so they are intentionally left out here.
|
|
36
|
+
const SIZE_TOKENS = {
|
|
37
|
+
default: 'h-8 gap-1.5 px-2.5',
|
|
38
|
+
sm: 'h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem]',
|
|
39
|
+
lg: 'h-9 gap-1.5 px-2.5',
|
|
40
|
+
icon: 'size-8',
|
|
41
|
+
};
|
|
42
|
+
const button = definePrototype({
|
|
43
|
+
name: 'shadcn-button',
|
|
44
|
+
setup(def) {
|
|
45
|
+
// P-SHADCN-BUTTON-VARIANT-PROP, P-SHADCN-BUTTON-SIZE-PROP
|
|
46
|
+
def.props.define({
|
|
47
|
+
variant: {
|
|
48
|
+
type: 'enum',
|
|
49
|
+
empty: 'fallback',
|
|
50
|
+
options: ['default', 'destructive', 'outline', 'secondary', 'ghost', 'link'],
|
|
51
|
+
},
|
|
52
|
+
size: { type: 'enum', empty: 'fallback', options: ['default', 'sm', 'lg', 'icon'] },
|
|
53
|
+
disabled: { type: 'boolean', empty: 'fallback' },
|
|
54
|
+
});
|
|
55
|
+
def.props.setDefaults({
|
|
56
|
+
variant: 'default',
|
|
57
|
+
size: 'default',
|
|
58
|
+
disabled: false,
|
|
59
|
+
});
|
|
60
|
+
// P-SHADCN-BUTTON-BASE-INHERITANCE,
|
|
61
|
+
// P-SHADCN-BUTTON-CURRENT-BASE-DEVIATIONS
|
|
62
|
+
// The current projection keeps every asButton-introduced behavior. A future
|
|
63
|
+
// setup-only negative patch must first be declared as a P-entity deviation.
|
|
64
|
+
const buttonState = asButton().stateHandles;
|
|
65
|
+
if (!buttonState) {
|
|
66
|
+
throw new Error('[shadcn-button] asButton must project Button state handles.');
|
|
67
|
+
}
|
|
68
|
+
const { disabled, hovered, focusVisible, pressed } = buttonState;
|
|
69
|
+
// P-SHADCN-BUTTON-DIRECT-ENTRY
|
|
70
|
+
// Base skeleton shared by every shadcn-style button.
|
|
71
|
+
def.feedback.style.use(tw(BUTTON_BASE_TOKENS));
|
|
72
|
+
// Variant surface rules map the public `variant` prop to visual tokens.
|
|
73
|
+
Object.keys(VARIANT_TOKENS).forEach((variant) => {
|
|
74
|
+
def.rule({
|
|
75
|
+
when: (w) => w.prop('variant').eq(variant),
|
|
76
|
+
intent: (i) => i.feedback.style.use(tw(VARIANT_TOKENS[variant])),
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
// Size rules are isolated so later icon-density refinements can layer on
|
|
80
|
+
// top without re-encoding every variant.
|
|
81
|
+
Object.keys(SIZE_TOKENS).forEach((size) => {
|
|
82
|
+
def.rule({
|
|
83
|
+
when: (w) => w.prop('size').eq(size),
|
|
84
|
+
intent: (i) => i.feedback.style.use(tw(SIZE_TOKENS[size])),
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
// P-SHADCN-BUTTON-INTERACTION-STYLES
|
|
88
|
+
// Focus/press are shared interaction states exposed by `asButton()`, so
|
|
89
|
+
// shadcn styling can stay inside rule semantics instead of hard-coding
|
|
90
|
+
// host-specific pseudo selectors.
|
|
91
|
+
def.rule({
|
|
92
|
+
when: (w) => w.state(focusVisible).eq(true),
|
|
93
|
+
intent: (i) => i.feedback.style.use(tw('border-ring ring-3 ring-ring/50')),
|
|
94
|
+
});
|
|
95
|
+
def.rule({
|
|
96
|
+
when: (w) => w.all(w.state(focusVisible).eq(true), w.prop('variant').eq('destructive')),
|
|
97
|
+
intent: (i) => i.feedback.style.use(tw('border-destructive/40 ring-destructive/20')),
|
|
98
|
+
});
|
|
99
|
+
def.rule({
|
|
100
|
+
when: (w) => w.state(pressed).eq(true),
|
|
101
|
+
intent: (i) => i.feedback.style.use(tw('translate-y-px')),
|
|
102
|
+
});
|
|
103
|
+
// Hovered surface rules are split by variant so later dark/meta branches
|
|
104
|
+
// can replace them cleanly without duplicating the base variant tokens.
|
|
105
|
+
def.rule({
|
|
106
|
+
when: (w) => w.all(w.state(hovered).eq(true), w.prop('variant').eq('default')),
|
|
107
|
+
intent: (i) => i.feedback.style.use(tw('bg-primary/80')),
|
|
108
|
+
});
|
|
109
|
+
def.rule({
|
|
110
|
+
when: (w) => w.all(w.state(hovered).eq(true), w.prop('variant').eq('secondary')),
|
|
111
|
+
intent: (i) => i.feedback.style.use(tw('bg-secondary/80')),
|
|
112
|
+
});
|
|
113
|
+
def.rule({
|
|
114
|
+
when: (w) => w.all(w.state(hovered).eq(true), w.prop('variant').eq('outline')),
|
|
115
|
+
intent: (i) => i.feedback.style.use(tw('bg-muted text-foreground')),
|
|
116
|
+
});
|
|
117
|
+
def.rule({
|
|
118
|
+
when: (w) => w.all(w.state(hovered).eq(true), w.prop('variant').eq('ghost')),
|
|
119
|
+
intent: (i) => i.feedback.style.use(tw('bg-muted text-foreground')),
|
|
120
|
+
});
|
|
121
|
+
def.rule({
|
|
122
|
+
when: (w) => w.all(w.state(hovered).eq(true), w.prop('variant').eq('link')),
|
|
123
|
+
intent: (i) => i.feedback.style.use(tw('underline')),
|
|
124
|
+
});
|
|
125
|
+
def.rule({
|
|
126
|
+
when: (w) => w.all(w.state(hovered).eq(true), w.prop('variant').eq('destructive')),
|
|
127
|
+
intent: (i) => i.feedback.style.use(tw('bg-destructive/20')),
|
|
128
|
+
});
|
|
129
|
+
// P-SHADCN-BUTTON-COLOR-SCHEME-STYLES
|
|
130
|
+
// Dark mode stays in meta so the prototype remains host-agnostic while web
|
|
131
|
+
// adapters still have a clean place to optimize to `dark:*`.
|
|
132
|
+
def.rule({
|
|
133
|
+
when: (w) => w.all(w.meta('colorScheme').eq('dark'), w.prop('variant').eq('outline')),
|
|
134
|
+
intent: (i) => i.feedback.style.use(tw('border-input bg-input/30')),
|
|
135
|
+
});
|
|
136
|
+
def.rule({
|
|
137
|
+
when: (w) => w.all(w.meta('colorScheme').eq('dark'), w.state(hovered).eq(true), w.prop('variant').eq('outline')),
|
|
138
|
+
intent: (i) => i.feedback.style.use(tw('bg-input/50')),
|
|
139
|
+
});
|
|
140
|
+
def.rule({
|
|
141
|
+
when: (w) => w.all(w.meta('colorScheme').eq('dark'), w.prop('variant').eq('destructive')),
|
|
142
|
+
intent: (i) => i.feedback.style.use(tw('bg-destructive/20')),
|
|
143
|
+
});
|
|
144
|
+
def.rule({
|
|
145
|
+
when: (w) => w.all(w.meta('colorScheme').eq('dark'), w.state(hovered).eq(true), w.prop('variant').eq('destructive')),
|
|
146
|
+
intent: (i) => i.feedback.style.use(tw('bg-destructive/30')),
|
|
147
|
+
});
|
|
148
|
+
def.rule({
|
|
149
|
+
when: (w) => w.all(w.meta('colorScheme').eq('dark'), w.state(focusVisible).eq(true), w.prop('variant').eq('destructive')),
|
|
150
|
+
intent: (i) => i.feedback.style.use(tw('ring-destructive/40')),
|
|
151
|
+
});
|
|
152
|
+
// Disabled remains a standalone rule because it semantically cuts across
|
|
153
|
+
// every variant and size, and we now source it from the shared button
|
|
154
|
+
// behavior instead of duplicating prop semantics locally.
|
|
155
|
+
def.rule({
|
|
156
|
+
when: (w) => w.state(disabled).eq(true),
|
|
157
|
+
intent: (i) => i.feedback.style.use(tw('pointer-events-none opacity-50')),
|
|
158
|
+
});
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
export default button;
|
package/dist/button/index.d.ts
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export type { ShadcnButtonProps, ShadcnButtonExposes, ShadcnButtonSize, ShadcnButtonVariant };
|
|
4
|
-
export default button;
|
|
1
|
+
export { default, default as shadcnButton } from './button.proto';
|
|
2
|
+
export type { ShadcnButtonExposes, ShadcnButtonProps, ShadcnButtonSize, ShadcnButtonVariant, } from './button.proto';
|
package/dist/button/index.js
CHANGED
|
@@ -1,175 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { asButton } from '@proto.ui/prototypes-base';
|
|
3
|
-
// Shared button skeleton copied from shadcn/ui and reduced to the plain
|
|
4
|
-
// utility tokens that Proto UI v0 can express in feedback.style today.
|
|
5
|
-
const BUTTON_BASE_TOKENS = [
|
|
6
|
-
'group/button',
|
|
7
|
-
'inline-flex',
|
|
8
|
-
'shrink-0',
|
|
9
|
-
'items-center',
|
|
10
|
-
'justify-center',
|
|
11
|
-
'rounded-lg',
|
|
12
|
-
'border',
|
|
13
|
-
'bg-clip-padding',
|
|
14
|
-
'text-sm',
|
|
15
|
-
'font-medium',
|
|
16
|
-
'whitespace-nowrap',
|
|
17
|
-
'transition-all',
|
|
18
|
-
'outline-none',
|
|
19
|
-
'select-none',
|
|
20
|
-
].join(' ');
|
|
21
|
-
// Variant rules stay composable and only encode the stable visual surface.
|
|
22
|
-
// Pseudo selectors such as hover/focus-visible/aria-invalid/dark are left to
|
|
23
|
-
// dedicated rule extensions because the current feedback token contract does
|
|
24
|
-
// not accept selector-style utilities directly.
|
|
25
|
-
const VARIANT_TOKENS = {
|
|
26
|
-
default: 'border-transparent bg-primary text-primary-foreground',
|
|
27
|
-
destructive: 'border-transparent bg-destructive/10 text-destructive',
|
|
28
|
-
outline: 'border-border bg-background text-foreground',
|
|
29
|
-
secondary: 'border-transparent bg-secondary text-secondary-foreground',
|
|
30
|
-
ghost: 'border-transparent bg-transparent text-foreground',
|
|
31
|
-
link: 'border-transparent bg-transparent text-primary underline-offset-4',
|
|
32
|
-
};
|
|
33
|
-
// Size rules cover the public API we expose right now. The upstream examples
|
|
34
|
-
// also contain xs-style variants, but those are not part of this prototype API
|
|
35
|
-
// yet, so they are intentionally left out here.
|
|
36
|
-
const SIZE_TOKENS = {
|
|
37
|
-
default: 'h-8 gap-1.5 px-2.5',
|
|
38
|
-
sm: 'h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem]',
|
|
39
|
-
lg: 'h-9 gap-1.5 px-2.5',
|
|
40
|
-
icon: 'size-8',
|
|
41
|
-
};
|
|
42
|
-
const button = definePrototype({
|
|
43
|
-
name: 'shadcn-button',
|
|
44
|
-
setup(def) {
|
|
45
|
-
def.props.define({
|
|
46
|
-
variant: {
|
|
47
|
-
type: 'string',
|
|
48
|
-
empty: 'fallback',
|
|
49
|
-
enum: ['default', 'destructive', 'outline', 'secondary', 'ghost', 'link'],
|
|
50
|
-
},
|
|
51
|
-
size: { type: 'string', empty: 'fallback', enum: ['default', 'sm', 'lg', 'icon'] },
|
|
52
|
-
disabled: { type: 'boolean', empty: 'fallback' },
|
|
53
|
-
});
|
|
54
|
-
def.props.setDefaults({
|
|
55
|
-
variant: 'default',
|
|
56
|
-
size: 'default',
|
|
57
|
-
disabled: false,
|
|
58
|
-
});
|
|
59
|
-
asButton();
|
|
60
|
-
const disabled = def.state.fromInteraction('disabled');
|
|
61
|
-
const hovered = def.state.fromInteraction('hovered');
|
|
62
|
-
const focused = def.state.fromInteraction('focused');
|
|
63
|
-
const focusVisible = def.state.fromInteraction('focusVisible');
|
|
64
|
-
const pressed = def.state.fromInteraction('pressed');
|
|
65
|
-
const expanded = def.state.fromAccessibility('expanded');
|
|
66
|
-
const invalid = def.state.fromAccessibility('invalid');
|
|
67
|
-
// Base skeleton shared by every shadcn-style button.
|
|
68
|
-
def.feedback.style.use(tw(BUTTON_BASE_TOKENS));
|
|
69
|
-
// Variant surface rules map the public `variant` prop to visual tokens.
|
|
70
|
-
Object.keys(VARIANT_TOKENS).forEach((variant) => {
|
|
71
|
-
def.rule({
|
|
72
|
-
when: (w) => w.prop('variant').eq(variant),
|
|
73
|
-
intent: (i) => i.feedback.style.use(tw(VARIANT_TOKENS[variant])),
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
// Size rules are isolated so later icon-density refinements can layer on
|
|
77
|
-
// top without re-encoding every variant.
|
|
78
|
-
Object.keys(SIZE_TOKENS).forEach((size) => {
|
|
79
|
-
def.rule({
|
|
80
|
-
when: (w) => w.prop('size').eq(size),
|
|
81
|
-
intent: (i) => i.feedback.style.use(tw(SIZE_TOKENS[size])),
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
// Focus/press are shared interaction states exposed by `asButton()`, so
|
|
85
|
-
// shadcn styling can stay inside rule semantics instead of hard-coding
|
|
86
|
-
// host-specific pseudo selectors.
|
|
87
|
-
def.rule({
|
|
88
|
-
when: (w) => w.state(focusVisible).eq(true),
|
|
89
|
-
intent: (i) => i.feedback.style.use(tw('border-ring ring-3 ring-ring/50')),
|
|
90
|
-
});
|
|
91
|
-
def.rule({
|
|
92
|
-
when: (w) => w.all(w.state(focusVisible).eq(true), w.prop('variant').eq('destructive')),
|
|
93
|
-
intent: (i) => i.feedback.style.use(tw('border-destructive/40 ring-destructive/20')),
|
|
94
|
-
});
|
|
95
|
-
def.rule({
|
|
96
|
-
when: (w) => w.state(pressed).eq(true),
|
|
97
|
-
intent: (i) => i.feedback.style.use(tw('translate-y-px')),
|
|
98
|
-
});
|
|
99
|
-
// Hovered surface rules are split by variant so later dark/meta branches
|
|
100
|
-
// can replace them cleanly without duplicating the base variant tokens.
|
|
101
|
-
def.rule({
|
|
102
|
-
when: (w) => w.all(w.state(hovered).eq(true), w.prop('variant').eq('default')),
|
|
103
|
-
intent: (i) => i.feedback.style.use(tw('bg-primary/80')),
|
|
104
|
-
});
|
|
105
|
-
def.rule({
|
|
106
|
-
when: (w) => w.all(w.state(hovered).eq(true), w.prop('variant').eq('secondary')),
|
|
107
|
-
intent: (i) => i.feedback.style.use(tw('bg-secondary/80')),
|
|
108
|
-
});
|
|
109
|
-
def.rule({
|
|
110
|
-
when: (w) => w.all(w.state(hovered).eq(true), w.prop('variant').eq('outline')),
|
|
111
|
-
intent: (i) => i.feedback.style.use(tw('bg-muted text-foreground')),
|
|
112
|
-
});
|
|
113
|
-
def.rule({
|
|
114
|
-
when: (w) => w.all(w.state(hovered).eq(true), w.prop('variant').eq('ghost')),
|
|
115
|
-
intent: (i) => i.feedback.style.use(tw('bg-muted text-foreground')),
|
|
116
|
-
});
|
|
117
|
-
def.rule({
|
|
118
|
-
when: (w) => w.all(w.state(hovered).eq(true), w.prop('variant').eq('link')),
|
|
119
|
-
intent: (i) => i.feedback.style.use(tw('underline')),
|
|
120
|
-
});
|
|
121
|
-
def.rule({
|
|
122
|
-
when: (w) => w.all(w.state(hovered).eq(true), w.prop('variant').eq('destructive')),
|
|
123
|
-
intent: (i) => i.feedback.style.use(tw('bg-destructive/20')),
|
|
124
|
-
});
|
|
125
|
-
// Accessibility semantics stay in the official shared state lane. This
|
|
126
|
-
// keeps button-compatible semantics like `expanded` / `invalid` reusable
|
|
127
|
-
// by higher-level triggers instead of reintroducing ad-hoc aria props here.
|
|
128
|
-
def.rule({
|
|
129
|
-
when: (w) => w.all(w.state(expanded).eq(true), w.prop('variant').eq('outline')),
|
|
130
|
-
intent: (i) => i.feedback.style.use(tw('bg-muted text-foreground')),
|
|
131
|
-
});
|
|
132
|
-
def.rule({
|
|
133
|
-
when: (w) => w.all(w.state(expanded).eq(true), w.prop('variant').eq('secondary')),
|
|
134
|
-
intent: (i) => i.feedback.style.use(tw('bg-secondary text-secondary-foreground')),
|
|
135
|
-
});
|
|
136
|
-
def.rule({
|
|
137
|
-
when: (w) => w.state(invalid).eq(true),
|
|
138
|
-
intent: (i) => i.feedback.style.use(tw('border-destructive ring-3 ring-destructive/20')),
|
|
139
|
-
});
|
|
140
|
-
// Dark mode stays in meta so the prototype remains host-agnostic while web
|
|
141
|
-
// adapters still have a clean place to optimize to `dark:*`.
|
|
142
|
-
def.rule({
|
|
143
|
-
when: (w) => w.all(w.meta('colorScheme').eq('dark'), w.prop('variant').eq('outline')),
|
|
144
|
-
intent: (i) => i.feedback.style.use(tw('border-input bg-input/30')),
|
|
145
|
-
});
|
|
146
|
-
def.rule({
|
|
147
|
-
when: (w) => w.all(w.meta('colorScheme').eq('dark'), w.state(hovered).eq(true), w.prop('variant').eq('outline')),
|
|
148
|
-
intent: (i) => i.feedback.style.use(tw('bg-input/50')),
|
|
149
|
-
});
|
|
150
|
-
def.rule({
|
|
151
|
-
when: (w) => w.all(w.meta('colorScheme').eq('dark'), w.prop('variant').eq('destructive')),
|
|
152
|
-
intent: (i) => i.feedback.style.use(tw('bg-destructive/20')),
|
|
153
|
-
});
|
|
154
|
-
def.rule({
|
|
155
|
-
when: (w) => w.all(w.meta('colorScheme').eq('dark'), w.state(hovered).eq(true), w.prop('variant').eq('destructive')),
|
|
156
|
-
intent: (i) => i.feedback.style.use(tw('bg-destructive/30')),
|
|
157
|
-
});
|
|
158
|
-
def.rule({
|
|
159
|
-
when: (w) => w.all(w.meta('colorScheme').eq('dark'), w.state(focusVisible).eq(true), w.prop('variant').eq('destructive')),
|
|
160
|
-
intent: (i) => i.feedback.style.use(tw('ring-destructive/40')),
|
|
161
|
-
});
|
|
162
|
-
def.rule({
|
|
163
|
-
when: (w) => w.all(w.meta('colorScheme').eq('dark'), w.state(invalid).eq(true)),
|
|
164
|
-
intent: (i) => i.feedback.style.use(tw('border-destructive/50 ring-destructive/40')),
|
|
165
|
-
});
|
|
166
|
-
// Disabled remains a standalone rule because it semantically cuts across
|
|
167
|
-
// every variant and size, and we now source it from the shared button
|
|
168
|
-
// behavior instead of duplicating prop semantics locally.
|
|
169
|
-
def.rule({
|
|
170
|
-
when: (w) => w.state(disabled).eq(true),
|
|
171
|
-
intent: (i) => i.feedback.style.use(tw('pointer-events-none opacity-50')),
|
|
172
|
-
});
|
|
173
|
-
},
|
|
174
|
-
});
|
|
175
|
-
export default button;
|
|
1
|
+
export { default, default as shadcnButton } from './button.proto';
|
package/dist/button/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ButtonExposes, ButtonProps } from '@proto.ui/prototypes-base';
|
|
1
|
+
import type { ButtonExposes, ButtonProps } from '@proto.ui/prototypes-base/button';
|
|
2
2
|
export type ShadcnButtonVariant = 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link';
|
|
3
3
|
export type ShadcnButtonSize = 'default' | 'sm' | 'lg' | 'icon';
|
|
4
4
|
export interface ShadcnButtonProps extends ButtonProps {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ShadcnDialogCloseProps } from './types';
|
|
2
|
+
declare const dialogClose: import("@proto.ui/core").Prototype<ShadcnDialogCloseProps, import("@proto.ui/prototypes-base/dialog").DialogCloseExposes>;
|
|
3
|
+
/** P-SHADCN-DIALOG-CLOSE-DIRECT-ENTRY and P-SHADCN-DIALOG-CLOSE-STATE-DRIVEN-STYLES. */
|
|
4
|
+
export default dialogClose;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { definePrototype, tw } from '@proto.ui/core';
|
|
2
|
-
import { asDialogClose } from '@proto.ui/prototypes-base';
|
|
2
|
+
import { asDialogClose } from '@proto.ui/prototypes-base/dialog';
|
|
3
3
|
const BASE_TOKENS = [
|
|
4
4
|
'group/button',
|
|
5
5
|
'inline-flex',
|
|
@@ -30,11 +30,12 @@ const VARIANT_TOKENS = {
|
|
|
30
30
|
const dialogClose = definePrototype({
|
|
31
31
|
name: 'shadcn-dialog-close',
|
|
32
32
|
setup(def) {
|
|
33
|
+
// P-SHADCN-DIALOG-CLOSE-VARIANT-PROP
|
|
33
34
|
def.props.define({
|
|
34
35
|
variant: {
|
|
35
|
-
type: '
|
|
36
|
+
type: 'enum',
|
|
36
37
|
empty: 'fallback',
|
|
37
|
-
|
|
38
|
+
options: ['default', 'destructive', 'outline', 'secondary', 'ghost', 'link'],
|
|
38
39
|
},
|
|
39
40
|
disabled: { type: 'boolean', empty: 'fallback' },
|
|
40
41
|
});
|
|
@@ -42,11 +43,14 @@ const dialogClose = definePrototype({
|
|
|
42
43
|
variant: 'default',
|
|
43
44
|
disabled: false,
|
|
44
45
|
});
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
// P-SHADCN-DIALOG-CLOSE-BASE-INHERITANCE,
|
|
47
|
+
// 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
|
|
50
54
|
def.feedback.style.use(tw(BASE_TOKENS));
|
|
51
55
|
Object.keys(VARIANT_TOKENS).forEach((variant) => {
|
|
52
56
|
def.rule({
|
|
@@ -92,4 +96,5 @@ const dialogClose = definePrototype({
|
|
|
92
96
|
});
|
|
93
97
|
},
|
|
94
98
|
});
|
|
99
|
+
/** P-SHADCN-DIALOG-CLOSE-DIRECT-ENTRY and P-SHADCN-DIALOG-CLOSE-STATE-DRIVEN-STYLES. */
|
|
95
100
|
export default dialogClose;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ShadcnDialogContentExposes, ShadcnDialogContentProps } from './types';
|
|
2
|
+
declare const dialogContent: import("@proto.ui/core").Prototype<ShadcnDialogContentProps, ShadcnDialogContentExposes>;
|
|
3
|
+
/** P-SHADCN-DIALOG-CONTENT-DIRECT-ENTRY; parity is bounded by P-SHADCN-DIALOG-CONTENT-COMPATIBILITY-SUBSET. */
|
|
4
|
+
export default dialogContent;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { definePrototype, tw } from '@proto.ui/core';
|
|
2
|
+
import { asDialogContent } from '@proto.ui/prototypes-base/dialog';
|
|
3
|
+
const dialogContent = definePrototype({
|
|
4
|
+
name: 'shadcn-dialog-content',
|
|
5
|
+
setup(def) {
|
|
6
|
+
// P-SHADCN-DIALOG-CONTENT-BASE-INHERITANCE,
|
|
7
|
+
// P-SHADCN-DIALOG-CONTENT-PUBLIC-BOUNDARY-DEVIATION
|
|
8
|
+
const dialog = asDialogContent();
|
|
9
|
+
// P-SHADCN-DIALOG-CONTENT-TRANSITION
|
|
10
|
+
dialog.asTransition.configure({ enterDuration: 200, leaveDuration: 200 });
|
|
11
|
+
const dialogState = dialog.stateHandles;
|
|
12
|
+
const { open } = dialogState;
|
|
13
|
+
// P-SHADCN-DIALOG-CONTENT-CURRENT-VISUAL-SURFACE
|
|
14
|
+
def.feedback.style.use(tw('fixed left-1/2 top-1/2 grid w-full max-w-lg gap-4 -translate-x-1/2 -translate-y-1/2 rounded-lg border border-border bg-background p-6 shadow-lg duration-200 outline-none'));
|
|
15
|
+
def.rule({
|
|
16
|
+
when: (w) => w.state(open).eq(true),
|
|
17
|
+
intent: (i) => i.feedback.style.use(tw('animate-in fade-in-0 zoom-in-95')),
|
|
18
|
+
});
|
|
19
|
+
def.rule({
|
|
20
|
+
when: (w) => w.state(open).eq(false),
|
|
21
|
+
intent: (i) => i.feedback.style.use(tw('animate-out fade-out-0 zoom-out-95')),
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
/** P-SHADCN-DIALOG-CONTENT-DIRECT-ENTRY; parity is bounded by P-SHADCN-DIALOG-CONTENT-COMPATIBILITY-SUBSET. */
|
|
26
|
+
export default dialogContent;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const dialogDescription: import("@proto.ui/core").Prototype<import("@proto.ui/prototypes-base/dialog").DialogDescriptionProps, import("@proto.ui/prototypes-base/dialog").DialogDescriptionExposes>;
|
|
2
|
+
/** P-SHADCN-DIALOG-DESCRIPTION-DIRECT-ENTRY; parity is bounded by P-SHADCN-DIALOG-DESCRIPTION-COMPATIBILITY-SUBSET. */
|
|
3
|
+
export default dialogDescription;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { definePrototype, tw } from '@proto.ui/core';
|
|
2
|
+
import { asDialogDescription } from '@proto.ui/prototypes-base/dialog';
|
|
3
|
+
const dialogDescription = definePrototype({
|
|
4
|
+
name: 'shadcn-dialog-description',
|
|
5
|
+
setup(def) {
|
|
6
|
+
// P-SHADCN-DIALOG-DESCRIPTION-BASE-INHERITANCE,
|
|
7
|
+
// P-SHADCN-DIALOG-DESCRIPTION-CURRENT-VISUAL-SURFACE
|
|
8
|
+
asDialogDescription();
|
|
9
|
+
def.feedback.style.use(tw('text-sm text-muted-foreground'));
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
/** P-SHADCN-DIALOG-DESCRIPTION-DIRECT-ENTRY; parity is bounded by P-SHADCN-DIALOG-DESCRIPTION-COMPATIBILITY-SUBSET. */
|
|
13
|
+
export default dialogDescription;
|
package/dist/dialog/index.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import dialogClose from './close';
|
|
2
|
-
import dialogContent from './content';
|
|
3
|
-
import dialogDescription from './description';
|
|
4
|
-
import dialogMask from './overlay';
|
|
5
|
-
import dialogRoot from './root';
|
|
6
|
-
import dialogTitle from './title';
|
|
7
|
-
import dialogTrigger from './trigger';
|
|
1
|
+
import dialogClose from './close.proto';
|
|
2
|
+
import dialogContent from './content.proto';
|
|
3
|
+
import dialogDescription from './description.proto';
|
|
4
|
+
import dialogMask from './overlay.proto';
|
|
5
|
+
import dialogRoot from './root.proto';
|
|
6
|
+
import dialogTitle from './title.proto';
|
|
7
|
+
import dialogTrigger from './trigger.proto';
|
|
8
8
|
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
9
|
export { dialogRoot, dialogTrigger, dialogMask, dialogContent, dialogTitle, dialogDescription, dialogClose, };
|
|
10
|
-
export { default as shadcnDialogRoot } from './root';
|
|
11
|
-
export { default as shadcnDialogTrigger } from './trigger';
|
|
12
|
-
export { default as shadcnDialogMask } from './overlay';
|
|
13
|
-
export { default as shadcnDialogContent } from './content';
|
|
14
|
-
export { default as shadcnDialogTitle } from './title';
|
|
15
|
-
export { default as shadcnDialogDescription } from './description';
|
|
16
|
-
export { default as shadcnDialogClose } from './close';
|
|
10
|
+
export { default as shadcnDialogRoot } from './root.proto';
|
|
11
|
+
export { default as shadcnDialogTrigger } from './trigger.proto';
|
|
12
|
+
export { default as shadcnDialogMask } from './overlay.proto';
|
|
13
|
+
export { default as shadcnDialogContent } from './content.proto';
|
|
14
|
+
export { default as shadcnDialogTitle } from './title.proto';
|
|
15
|
+
export { default as shadcnDialogDescription } from './description.proto';
|
|
16
|
+
export { default as shadcnDialogClose } from './close.proto';
|
package/dist/dialog/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import dialogClose from './close';
|
|
2
|
-
import dialogContent from './content';
|
|
3
|
-
import dialogDescription from './description';
|
|
4
|
-
import dialogMask from './overlay';
|
|
5
|
-
import dialogRoot from './root';
|
|
6
|
-
import dialogTitle from './title';
|
|
7
|
-
import dialogTrigger from './trigger';
|
|
1
|
+
import dialogClose from './close.proto';
|
|
2
|
+
import dialogContent from './content.proto';
|
|
3
|
+
import dialogDescription from './description.proto';
|
|
4
|
+
import dialogMask from './overlay.proto';
|
|
5
|
+
import dialogRoot from './root.proto';
|
|
6
|
+
import dialogTitle from './title.proto';
|
|
7
|
+
import dialogTrigger from './trigger.proto';
|
|
8
8
|
export { dialogRoot, dialogTrigger, dialogMask, dialogContent, dialogTitle, dialogDescription, dialogClose, };
|
|
9
|
-
export { default as shadcnDialogRoot } from './root';
|
|
10
|
-
export { default as shadcnDialogTrigger } from './trigger';
|
|
11
|
-
export { default as shadcnDialogMask } from './overlay';
|
|
12
|
-
export { default as shadcnDialogContent } from './content';
|
|
13
|
-
export { default as shadcnDialogTitle } from './title';
|
|
14
|
-
export { default as shadcnDialogDescription } from './description';
|
|
15
|
-
export { default as shadcnDialogClose } from './close';
|
|
9
|
+
export { default as shadcnDialogRoot } from './root.proto';
|
|
10
|
+
export { default as shadcnDialogTrigger } from './trigger.proto';
|
|
11
|
+
export { default as shadcnDialogMask } from './overlay.proto';
|
|
12
|
+
export { default as shadcnDialogContent } from './content.proto';
|
|
13
|
+
export { default as shadcnDialogTitle } from './title.proto';
|
|
14
|
+
export { default as shadcnDialogDescription } from './description.proto';
|
|
15
|
+
export { default as shadcnDialogClose } from './close.proto';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ShadcnDialogMaskExposes, ShadcnDialogMaskProps } from './types';
|
|
2
|
+
declare const dialogMask: import("@proto.ui/core").Prototype<ShadcnDialogMaskProps, ShadcnDialogMaskExposes>;
|
|
3
|
+
/** P-SHADCN-DIALOG-MASK-DIRECT-ENTRY; parity is bounded by P-SHADCN-DIALOG-MASK-COMPATIBILITY-SUBSET. */
|
|
4
|
+
export default dialogMask;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { definePrototype, tw } from '@proto.ui/core';
|
|
2
|
+
import { asDialogMask } from '@proto.ui/prototypes-base/dialog';
|
|
3
|
+
const dialogMask = definePrototype({
|
|
4
|
+
name: 'shadcn-dialog-mask',
|
|
5
|
+
setup(def) {
|
|
6
|
+
// P-SHADCN-DIALOG-MASK-BASE-INHERITANCE,
|
|
7
|
+
// P-SHADCN-DIALOG-MASK-PUBLIC-BOUNDARY-DEVIATION
|
|
8
|
+
const dialog = asDialogMask();
|
|
9
|
+
// P-SHADCN-DIALOG-MASK-TRANSITION
|
|
10
|
+
dialog.asTransition.configure({ enterDuration: 150, leaveDuration: 150 });
|
|
11
|
+
const dialogState = dialog.stateHandles;
|
|
12
|
+
const { open } = dialogState;
|
|
13
|
+
// P-SHADCN-DIALOG-MASK-CURRENT-VISUAL-SURFACE
|
|
14
|
+
def.feedback.style.use(tw('fixed inset-0 bg-black/50 backdrop-blur-xs'));
|
|
15
|
+
def.rule({
|
|
16
|
+
when: (w) => w.state(open).eq(true),
|
|
17
|
+
intent: (i) => i.feedback.style.use(tw('animate-in fade-in-0')),
|
|
18
|
+
});
|
|
19
|
+
def.rule({
|
|
20
|
+
when: (w) => w.state(open).eq(false),
|
|
21
|
+
intent: (i) => i.feedback.style.use(tw('animate-out fade-out-0')),
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
/** P-SHADCN-DIALOG-MASK-DIRECT-ENTRY; parity is bounded by P-SHADCN-DIALOG-MASK-COMPATIBILITY-SUBSET. */
|
|
26
|
+
export default dialogMask;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const dialogRoot: import("@proto.ui/core").Prototype<import("@proto.ui/prototypes-base/dialog").DialogRootProps, import("@proto.ui/prototypes-base/dialog").DialogRootExposes>;
|
|
2
|
+
/** P-SHADCN-DIALOG-DIRECT-ENTRY; parity is bounded by P-SHADCN-DIALOG-COMPATIBILITY-SUBSET. */
|
|
3
|
+
export default dialogRoot;
|