@proto.ui/prototypes-shadcn 0.2.0 → 0.3.0-alpha.1
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 +16 -1
- package/dist/checkbox/index.d.ts +7 -0
- package/dist/checkbox/index.js +6 -0
- package/dist/checkbox/indicator.proto.d.ts +8 -0
- package/dist/checkbox/indicator.proto.js +76 -0
- package/dist/checkbox/preset.d.ts +15 -0
- package/dist/checkbox/preset.js +15 -0
- package/dist/checkbox/root.proto.d.ts +8 -0
- package/dist/checkbox/root.proto.js +60 -0
- package/dist/checkbox/types.d.ts +11 -0
- package/dist/checkbox/types.js +1 -0
- package/dist/component-presets.d.ts +12 -1
- package/dist/component-presets.js +3 -1
- package/dist/dialog/close-icon.proto.js +3 -1
- package/dist/dropdown/trigger.proto.js +1 -1
- package/dist/hover-card/content.proto.js +1 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +8 -1
- package/dist/scroll-area/index.d.ts +5 -0
- package/dist/scroll-area/index.js +4 -0
- package/dist/scroll-area/root.proto.d.ts +2 -0
- package/dist/scroll-area/root.proto.js +10 -0
- package/dist/scroll-area/scrollbar.proto.d.ts +2 -0
- package/dist/scroll-area/scrollbar.proto.js +22 -0
- package/dist/scroll-area/thumb.proto.d.ts +2 -0
- package/dist/scroll-area/thumb.proto.js +10 -0
- package/dist/scroll-area/types.d.ts +17 -0
- package/dist/scroll-area/types.js +1 -0
- package/dist/scroll-area/viewport.proto.d.ts +2 -0
- package/dist/scroll-area/viewport.proto.js +20 -0
- package/dist/select/trigger.proto.js +1 -1
- package/dist/separator/index.d.ts +2 -0
- package/dist/separator/index.js +1 -0
- package/dist/separator/root.proto.d.ts +10 -0
- package/dist/separator/root.proto.js +30 -0
- package/dist/separator/types.d.ts +6 -0
- package/dist/separator/types.js +1 -0
- package/dist/textarea/index.d.ts +2 -0
- package/dist/textarea/index.js +1 -0
- package/dist/textarea/root.proto.d.ts +1 -0
- package/dist/textarea/root.proto.js +54 -0
- package/dist/textarea/types.d.ts +3 -0
- package/dist/textarea/types.js +1 -0
- package/dist/tooltip/content.proto.d.ts +2 -0
- package/dist/tooltip/content.proto.js +23 -0
- package/dist/tooltip/group.proto.d.ts +2 -0
- package/dist/tooltip/group.proto.js +10 -0
- package/dist/tooltip/index.d.ts +5 -0
- package/dist/tooltip/index.js +4 -0
- package/dist/tooltip/root.proto.d.ts +2 -0
- package/dist/tooltip/root.proto.js +9 -0
- package/dist/tooltip/trigger.proto.d.ts +2 -0
- package/dist/tooltip/trigger.proto.js +27 -0
- package/dist/tooltip/types.d.ts +16 -0
- package/dist/tooltip/types.js +1 -0
- package/package.json +29 -3
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ Prototype library package intended to be consumed together with Proto UI adapter
|
|
|
22
22
|
## Install
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
|
-
npm install @proto.ui/prototypes-shadcn@0.
|
|
25
|
+
npm install @proto.ui/prototypes-shadcn@0.3.0-alpha.1
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
## Family Imports
|
|
@@ -32,6 +32,18 @@ Prefer anatomy-family subpaths so only the selected Shadcn family and its corres
|
|
|
32
32
|
```ts
|
|
33
33
|
import { shadcnButton } from '@proto.ui/prototypes-shadcn/button';
|
|
34
34
|
import { shadcnSelectRoot, shadcnSelectTrigger } from '@proto.ui/prototypes-shadcn/select';
|
|
35
|
+
import {
|
|
36
|
+
shadcnScrollAreaRoot,
|
|
37
|
+
shadcnScrollAreaViewport,
|
|
38
|
+
shadcnScrollAreaScrollbar,
|
|
39
|
+
shadcnScrollAreaThumb,
|
|
40
|
+
} from '@proto.ui/prototypes-shadcn/scroll-area';
|
|
41
|
+
import {
|
|
42
|
+
shadcnTooltipGroup,
|
|
43
|
+
shadcnTooltipRoot,
|
|
44
|
+
shadcnTooltipTrigger,
|
|
45
|
+
shadcnTooltipContent,
|
|
46
|
+
} from '@proto.ui/prototypes-shadcn/tooltip';
|
|
35
47
|
```
|
|
36
48
|
|
|
37
49
|
The root package export remains available for compatibility. Shadcn families do not depend on sibling Shadcn families.
|
|
@@ -46,13 +58,16 @@ The root package export remains available for compatibility. Shadcn families do
|
|
|
46
58
|
- `src/hover-card/`
|
|
47
59
|
- `src/index.ts`
|
|
48
60
|
- `src/select/`
|
|
61
|
+
- `src/scroll-area/`
|
|
49
62
|
- `src/switch/`
|
|
50
63
|
- `src/tabs/`
|
|
51
64
|
- `src/toggle/`
|
|
65
|
+
- `src/tooltip/`
|
|
52
66
|
|
|
53
67
|
## Related Internal Packages
|
|
54
68
|
|
|
55
69
|
- `@proto.ui/core`
|
|
70
|
+
- `@proto.ui/hooks`
|
|
56
71
|
- `@proto.ui/prototypes-base`
|
|
57
72
|
|
|
58
73
|
## License
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import checkboxIndicator from './indicator.proto.js';
|
|
2
|
+
import checkboxRoot from './root.proto.js';
|
|
3
|
+
export type { ShadcnCheckboxRootProps, ShadcnCheckboxRootExposes, ShadcnCheckboxRootStateHandles, ShadcnCheckboxRootAsHookContract, ShadcnCheckboxIndicatorProps, ShadcnCheckboxIndicatorExposes, ShadcnCheckboxIndicatorStateHandles, ShadcnCheckboxIndicatorAsHookContract, } from './types.js';
|
|
4
|
+
export { checkboxRoot, checkboxIndicator };
|
|
5
|
+
export { default as shadcnCheckboxRoot } from './root.proto.js';
|
|
6
|
+
export { default as shadcnCheckboxIndicator } from './indicator.proto.js';
|
|
7
|
+
export { default as componentPreset, shadcnCheckboxComponentPreset } from './preset.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import checkboxIndicator from './indicator.proto.js';
|
|
2
|
+
import checkboxRoot from './root.proto.js';
|
|
3
|
+
export { checkboxRoot, checkboxIndicator };
|
|
4
|
+
export { default as shadcnCheckboxRoot } from './root.proto.js';
|
|
5
|
+
export { default as shadcnCheckboxIndicator } from './indicator.proto.js';
|
|
6
|
+
export { default as componentPreset, shadcnCheckboxComponentPreset } from './preset.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ShadcnCheckboxIndicatorProps } from './types.js';
|
|
2
|
+
declare const checkboxIndicator: import("@proto.ui/core").Prototype<ShadcnCheckboxIndicatorProps, import("@proto.ui/prototypes-base").CheckboxIndicatorExposes>;
|
|
3
|
+
/**
|
|
4
|
+
* P-SHADCN-CHECKBOX-INDICATOR-DIRECT-ENTRY exposes the current anatomy part.
|
|
5
|
+
* P-SHADCN-CHECKBOX-INDICATOR-COMPATIBILITY-SUBSET keeps the upstream composition
|
|
6
|
+
* and token differences outside the passing claim.
|
|
7
|
+
*/
|
|
8
|
+
export default checkboxIndicator;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { definePrototype, delay, tw } from '@proto.ui/core';
|
|
2
|
+
import { asCheckboxIndicator } from '@proto.ui/prototypes-base/checkbox';
|
|
3
|
+
const INDICATOR_TOKENS = [
|
|
4
|
+
'flex',
|
|
5
|
+
'size-3.5',
|
|
6
|
+
'items-center',
|
|
7
|
+
'justify-center',
|
|
8
|
+
'transition-none',
|
|
9
|
+
].join(' ');
|
|
10
|
+
/** Mixed reads before checked, so a checkbox that is both never paints a tick. */
|
|
11
|
+
function glyphPath(checked, indeterminate) {
|
|
12
|
+
if (indeterminate)
|
|
13
|
+
return 'M5 12h14';
|
|
14
|
+
if (checked)
|
|
15
|
+
return 'm20 6-11 11-5-5';
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
function renderGlyph(renderer, d) {
|
|
19
|
+
if (!d)
|
|
20
|
+
return null;
|
|
21
|
+
return renderer.svg.root({
|
|
22
|
+
viewBox: '0 0 24 24',
|
|
23
|
+
// The Root already carries the checkbox role and its checked state, so the
|
|
24
|
+
// glyph would only add an unnamed node to the accessibility tree.
|
|
25
|
+
'aria-hidden': 'true',
|
|
26
|
+
width: '100%',
|
|
27
|
+
height: '100%',
|
|
28
|
+
fill: 'none',
|
|
29
|
+
stroke: 'currentColor',
|
|
30
|
+
strokeWidth: 2,
|
|
31
|
+
strokeLinecap: 'round',
|
|
32
|
+
strokeLinejoin: 'round',
|
|
33
|
+
}, renderer.svg.path({ d }));
|
|
34
|
+
}
|
|
35
|
+
const checkboxIndicator = definePrototype({
|
|
36
|
+
name: 'shadcn-checkbox-indicator',
|
|
37
|
+
setup(def) {
|
|
38
|
+
// P-SHADCN-CHECKBOX-INDICATOR-BASE-INHERITANCE,
|
|
39
|
+
// P-SHADCN-CHECKBOX-INDICATOR-CURRENT-BASE-DEVIATIONS,
|
|
40
|
+
// P-SHADCN-CHECKBOX-INDICATOR-CONTEXT-DERIVED
|
|
41
|
+
const indicatorState = asCheckboxIndicator().stateHandles;
|
|
42
|
+
if (!indicatorState) {
|
|
43
|
+
throw new Error('[shadcn-checkbox-indicator] asCheckboxIndicator must project Checkbox indicator state handles.');
|
|
44
|
+
}
|
|
45
|
+
const { checked, indeterminate } = indicatorState;
|
|
46
|
+
// P-SHADCN-CHECKBOX-INDICATOR-CURRENT-VISUAL-SURFACE
|
|
47
|
+
def.feedback.style.use(tw(INDICATOR_TOKENS));
|
|
48
|
+
let renderTask = null;
|
|
49
|
+
// P-SHADCN-CHECKBOX-INDICATOR-GLYPH-SELECTION
|
|
50
|
+
const requestGlyphUpdate = (run, event) => {
|
|
51
|
+
if (event.type !== 'next')
|
|
52
|
+
return;
|
|
53
|
+
renderTask?.cancel();
|
|
54
|
+
renderTask = delay(0, () => {
|
|
55
|
+
renderTask = null;
|
|
56
|
+
run.update();
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
checked.watch(requestGlyphUpdate);
|
|
60
|
+
indeterminate.watch(requestGlyphUpdate);
|
|
61
|
+
def.lifecycle.onUnmounted(() => {
|
|
62
|
+
renderTask?.cancel();
|
|
63
|
+
renderTask = null;
|
|
64
|
+
});
|
|
65
|
+
return (renderer) => [
|
|
66
|
+
renderer.r.slot(),
|
|
67
|
+
renderGlyph(renderer, glyphPath(checked.get(), indeterminate.get())),
|
|
68
|
+
];
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
/**
|
|
72
|
+
* P-SHADCN-CHECKBOX-INDICATOR-DIRECT-ENTRY exposes the current anatomy part.
|
|
73
|
+
* P-SHADCN-CHECKBOX-INDICATOR-COMPATIBILITY-SUBSET keeps the upstream composition
|
|
74
|
+
* and token differences outside the passing claim.
|
|
75
|
+
*/
|
|
76
|
+
export default checkboxIndicator;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component-local composition recipe for the Shadcn Checkbox convenience facade.
|
|
3
|
+
* Visual tokens remain owned by the referenced Root and Indicator prototypes.
|
|
4
|
+
*/
|
|
5
|
+
export declare const shadcnCheckboxComponentPreset: {
|
|
6
|
+
readonly kind: "replaceable-default-part";
|
|
7
|
+
readonly placement: "direct-child";
|
|
8
|
+
readonly exportName: "ShadcnCheckbox";
|
|
9
|
+
readonly rootPrototype: "shadcnCheckboxRoot";
|
|
10
|
+
readonly defaultPartPrototype: "shadcnCheckboxIndicator";
|
|
11
|
+
readonly inputName: "indicator";
|
|
12
|
+
readonly elementName: "proto-ui-shadcn-checkbox";
|
|
13
|
+
readonly omissionAttribute: "data-pui-no-default-indicator";
|
|
14
|
+
};
|
|
15
|
+
export default shadcnCheckboxComponentPreset;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component-local composition recipe for the Shadcn Checkbox convenience facade.
|
|
3
|
+
* Visual tokens remain owned by the referenced Root and Indicator prototypes.
|
|
4
|
+
*/
|
|
5
|
+
export const shadcnCheckboxComponentPreset = {
|
|
6
|
+
kind: 'replaceable-default-part',
|
|
7
|
+
placement: 'direct-child',
|
|
8
|
+
exportName: 'ShadcnCheckbox',
|
|
9
|
+
rootPrototype: 'shadcnCheckboxRoot',
|
|
10
|
+
defaultPartPrototype: 'shadcnCheckboxIndicator',
|
|
11
|
+
inputName: 'indicator',
|
|
12
|
+
elementName: 'proto-ui-shadcn-checkbox',
|
|
13
|
+
omissionAttribute: 'data-pui-no-default-indicator',
|
|
14
|
+
};
|
|
15
|
+
export default shadcnCheckboxComponentPreset;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ShadcnCheckboxRootProps } from './types.js';
|
|
2
|
+
declare const checkboxRoot: import("@proto.ui/core").Prototype<ShadcnCheckboxRootProps, import("@proto.ui/prototypes-base").CheckboxRootExposes>;
|
|
3
|
+
/**
|
|
4
|
+
* P-SHADCN-CHECKBOX-DIRECT-ENTRY exposes the current Root projection.
|
|
5
|
+
* P-SHADCN-CHECKBOX-COMPATIBILITY-SUBSET and P-SHADCN-CHECKBOX-AS-CHILD-OMISSION
|
|
6
|
+
* keep upstream parity outside the passing claim unless it is implemented and tested.
|
|
7
|
+
*/
|
|
8
|
+
export default checkboxRoot;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { definePrototype, tw } from '@proto.ui/core';
|
|
2
|
+
import { asCheckboxRoot } from '@proto.ui/prototypes-base/checkbox';
|
|
3
|
+
const ROOT_BASE_TOKENS = [
|
|
4
|
+
'size-4',
|
|
5
|
+
'shrink-0',
|
|
6
|
+
'rounded-[4px]',
|
|
7
|
+
'border',
|
|
8
|
+
'border-input',
|
|
9
|
+
'bg-transparent',
|
|
10
|
+
'shadow-xs',
|
|
11
|
+
'outline-none',
|
|
12
|
+
].join(' ');
|
|
13
|
+
const checkboxRoot = definePrototype({
|
|
14
|
+
name: 'shadcn-checkbox-root',
|
|
15
|
+
setup(def) {
|
|
16
|
+
// P-SHADCN-CHECKBOX-BASE-INHERITANCE,
|
|
17
|
+
// P-SHADCN-CHECKBOX-CURRENT-BASE-DEVIATIONS
|
|
18
|
+
const checkboxState = asCheckboxRoot().stateHandles;
|
|
19
|
+
if (!checkboxState) {
|
|
20
|
+
throw new Error('[shadcn-checkbox-root] asCheckboxRoot must project Checkbox root state handles.');
|
|
21
|
+
}
|
|
22
|
+
const { checked, indeterminate, disabled, focusVisible } = checkboxState;
|
|
23
|
+
// P-SHADCN-CHECKBOX-CURRENT-VISUAL-SURFACE
|
|
24
|
+
def.feedback.style.use(tw(ROOT_BASE_TOKENS));
|
|
25
|
+
// P-SHADCN-CHECKBOX-STATE-DRIVEN-STYLES
|
|
26
|
+
// Two rules rather than one `any`, because only `eq` and `all` reach the
|
|
27
|
+
// web lowering; an `any` condition would leave the fill on the runtime plan
|
|
28
|
+
// and paint the box after the first frame instead of with it.
|
|
29
|
+
def.rule({
|
|
30
|
+
when: (w) => w.state(checked).eq(true),
|
|
31
|
+
intent: (i) => i.feedback.style.use(tw('bg-primary text-primary-foreground border-primary')),
|
|
32
|
+
});
|
|
33
|
+
// Mixed carries the same fill as checked; only the Indicator glyph separates
|
|
34
|
+
// them.
|
|
35
|
+
def.rule({
|
|
36
|
+
when: (w) => w.state(indeterminate).eq(true),
|
|
37
|
+
intent: (i) => i.feedback.style.use(tw('bg-primary text-primary-foreground border-primary')),
|
|
38
|
+
});
|
|
39
|
+
def.rule({
|
|
40
|
+
when: (w) => w.state(focusVisible).eq(true),
|
|
41
|
+
intent: (i) => i.feedback.style.use(tw('border-ring ring-ring/50 ring-3')),
|
|
42
|
+
});
|
|
43
|
+
def.rule({
|
|
44
|
+
when: (w) => w.state(disabled).eq(true),
|
|
45
|
+
intent: (i) => i.feedback.style.use(tw('cursor-not-allowed opacity-50')),
|
|
46
|
+
});
|
|
47
|
+
// The unfilled box is the only surface this tint is for. Without the two
|
|
48
|
+
// state guards it also lands on the filled box and the fill loses.
|
|
49
|
+
def.rule({
|
|
50
|
+
when: (w) => w.all(w.meta('colorScheme').eq('dark'), w.state(checked).eq(false), w.state(indeterminate).eq(false)),
|
|
51
|
+
intent: (i) => i.feedback.style.use(tw('bg-input/30')),
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
/**
|
|
56
|
+
* P-SHADCN-CHECKBOX-DIRECT-ENTRY exposes the current Root projection.
|
|
57
|
+
* P-SHADCN-CHECKBOX-COMPATIBILITY-SUBSET and P-SHADCN-CHECKBOX-AS-CHILD-OMISSION
|
|
58
|
+
* keep upstream parity outside the passing claim unless it is implemented and tested.
|
|
59
|
+
*/
|
|
60
|
+
export default checkboxRoot;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CheckboxIndicatorAsHookContract, CheckboxIndicatorExposes, CheckboxIndicatorProps, CheckboxIndicatorStateHandles, CheckboxRootAsHookContract, CheckboxRootExposes, CheckboxRootProps, CheckboxRootStateHandles } from '@proto.ui/prototypes-base/checkbox';
|
|
2
|
+
export interface ShadcnCheckboxRootProps extends CheckboxRootProps {
|
|
3
|
+
}
|
|
4
|
+
export type ShadcnCheckboxRootExposes = CheckboxRootExposes;
|
|
5
|
+
export type ShadcnCheckboxRootStateHandles = CheckboxRootStateHandles;
|
|
6
|
+
export type ShadcnCheckboxRootAsHookContract = CheckboxRootAsHookContract;
|
|
7
|
+
export interface ShadcnCheckboxIndicatorProps extends CheckboxIndicatorProps {
|
|
8
|
+
}
|
|
9
|
+
export type ShadcnCheckboxIndicatorExposes = CheckboxIndicatorExposes;
|
|
10
|
+
export type ShadcnCheckboxIndicatorStateHandles = CheckboxIndicatorStateHandles;
|
|
11
|
+
export type ShadcnCheckboxIndicatorAsHookContract = CheckboxIndicatorAsHookContract;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { shadcnCheckboxComponentPreset } from './checkbox/preset.js';
|
|
1
2
|
import { shadcnDialogComponentPreset } from './dialog/preset.js';
|
|
2
3
|
import { shadcnSwitchComponentPreset } from './switch/preset.js';
|
|
3
4
|
export type { ShadcnComponentPresetRecipe } from './component-presets.types.js';
|
|
4
|
-
export { shadcnDialogComponentPreset, shadcnSwitchComponentPreset };
|
|
5
|
+
export { shadcnCheckboxComponentPreset, shadcnDialogComponentPreset, shadcnSwitchComponentPreset };
|
|
5
6
|
/**
|
|
6
7
|
* Aggregate surface for prototype-library-owned composition recipes.
|
|
7
8
|
*
|
|
@@ -31,5 +32,15 @@ export declare const shadcnComponentPresets: {
|
|
|
31
32
|
readonly elementName: "proto-ui-shadcn-dialog-content";
|
|
32
33
|
readonly omissionAttribute: "data-pui-no-default-close";
|
|
33
34
|
};
|
|
35
|
+
readonly 'shadcn-checkbox': {
|
|
36
|
+
readonly kind: "replaceable-default-part";
|
|
37
|
+
readonly placement: "direct-child";
|
|
38
|
+
readonly exportName: "ShadcnCheckbox";
|
|
39
|
+
readonly rootPrototype: "shadcnCheckboxRoot";
|
|
40
|
+
readonly defaultPartPrototype: "shadcnCheckboxIndicator";
|
|
41
|
+
readonly inputName: "indicator";
|
|
42
|
+
readonly elementName: "proto-ui-shadcn-checkbox";
|
|
43
|
+
readonly omissionAttribute: "data-pui-no-default-indicator";
|
|
44
|
+
};
|
|
34
45
|
};
|
|
35
46
|
export default shadcnComponentPresets;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { shadcnCheckboxComponentPreset } from './checkbox/preset.js';
|
|
1
2
|
import { shadcnDialogComponentPreset } from './dialog/preset.js';
|
|
2
3
|
import { shadcnSwitchComponentPreset } from './switch/preset.js';
|
|
3
|
-
export { shadcnDialogComponentPreset, shadcnSwitchComponentPreset };
|
|
4
|
+
export { shadcnCheckboxComponentPreset, shadcnDialogComponentPreset, shadcnSwitchComponentPreset };
|
|
4
5
|
/**
|
|
5
6
|
* Aggregate surface for prototype-library-owned composition recipes.
|
|
6
7
|
*
|
|
@@ -12,5 +13,6 @@ export { shadcnDialogComponentPreset, shadcnSwitchComponentPreset };
|
|
|
12
13
|
export const shadcnComponentPresets = {
|
|
13
14
|
'shadcn-switch': shadcnSwitchComponentPreset,
|
|
14
15
|
'shadcn-dialog': shadcnDialogComponentPreset,
|
|
16
|
+
'shadcn-checkbox': shadcnCheckboxComponentPreset,
|
|
15
17
|
};
|
|
16
18
|
export default shadcnComponentPresets;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import { asAccessible } from '@proto.ui/hooks';
|
|
1
2
|
import { definePrototype, tw } from '@proto.ui/core';
|
|
2
3
|
import { asDialogClose } from '@proto.ui/prototypes-base/dialog';
|
|
3
4
|
const dialogCloseIcon = definePrototype({
|
|
4
5
|
name: 'shadcn-dialog-close-icon',
|
|
5
6
|
setup(def) {
|
|
7
|
+
const accessible = asAccessible();
|
|
6
8
|
const state = asDialogClose().stateHandles;
|
|
7
9
|
if (!state)
|
|
8
10
|
throw new Error('[shadcn-dialog-close-icon] command states are required.');
|
|
9
11
|
const { disabled, hovered, focusVisible } = state;
|
|
10
|
-
|
|
12
|
+
accessible.name('Close');
|
|
11
13
|
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
14
|
def.rule({
|
|
13
15
|
when: (w) => w.state(hovered).eq(true),
|
|
@@ -88,7 +88,7 @@ const dropdownTrigger = definePrototype({
|
|
|
88
88
|
});
|
|
89
89
|
def.rule({
|
|
90
90
|
when: (w) => w.state(pressed).eq(true),
|
|
91
|
-
intent: (i) => i.feedback.style.use(tw('
|
|
91
|
+
intent: (i) => i.feedback.style.use(tw('bg-muted text-foreground')),
|
|
92
92
|
});
|
|
93
93
|
def.rule({
|
|
94
94
|
when: (w) => w.state(disabled).eq(true),
|
|
@@ -10,7 +10,7 @@ const hoverCardContent = definePrototype({
|
|
|
10
10
|
hoverCard.asTransition.configure({ enterDuration: 200, leaveDuration: 200 });
|
|
11
11
|
const { open } = hoverCard.stateHandles;
|
|
12
12
|
// P-SHADCN-HOVER-CARD-CONTENT-CURRENT-VISUAL-SURFACE
|
|
13
|
-
def.feedback.style.use(tw('z-50 w-64 rounded-md border bg-popover p-4 text-sm text-popover-foreground shadow-md outline-none transition-none duration-200'));
|
|
13
|
+
def.feedback.style.use(tw('z-50 w-64 rounded-md border border-border bg-popover p-4 text-sm text-popover-foreground shadow-md outline-none transition-none duration-200'));
|
|
14
14
|
// P-SHADCN-HOVER-CARD-CONTENT-OPEN-AND-SIDE-STYLES
|
|
15
15
|
def.rule({
|
|
16
16
|
when: (w) => w.state(open).eq(true),
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
export { default as button } from './button/index.js';
|
|
2
2
|
export { default as shadcnButton } from './button/index.js';
|
|
3
|
-
export { default as componentPresets, shadcnDialogComponentPreset, shadcnComponentPresets, shadcnSwitchComponentPreset, type ShadcnComponentPresetRecipe, } from './component-presets.js';
|
|
3
|
+
export { default as componentPresets, shadcnCheckboxComponentPreset, shadcnDialogComponentPreset, shadcnComponentPresets, shadcnSwitchComponentPreset, type ShadcnComponentPresetRecipe, } from './component-presets.js';
|
|
4
4
|
export { default as toggle } from './toggle/index.js';
|
|
5
5
|
export { default as shadcnToggle } from './toggle/index.js';
|
|
6
|
+
export { checkboxRoot, checkboxIndicator } from './checkbox/index.js';
|
|
7
|
+
export { default as shadcnCheckboxRoot } from './checkbox/root.proto.js';
|
|
8
|
+
export { default as shadcnCheckboxIndicator } from './checkbox/indicator.proto.js';
|
|
6
9
|
export { switchRoot, switchThumb } from './switch/index.js';
|
|
7
10
|
export { default as shadcnSwitchRoot } from './switch/root.proto.js';
|
|
8
11
|
export { default as shadcnSwitchThumb } from './switch/thumb.proto.js';
|
|
@@ -10,6 +13,7 @@ export { tabsRoot, tabsList, tabsTrigger, tabsContent } from './tabs/index.js';
|
|
|
10
13
|
export { hoverCardRoot, hoverCardTrigger, hoverCardContent } from './hover-card/index.js';
|
|
11
14
|
export { dropdownRoot, dropdownTrigger, dropdownContent, dropdownItem } from './dropdown/index.js';
|
|
12
15
|
export { selectRoot, selectTrigger, selectValue, selectContent, selectItem } from './select/index.js';
|
|
16
|
+
export { default as shadcnSeparatorRoot } from './separator/index.js';
|
|
13
17
|
export { default as shadcnTabsRoot } from './tabs/root.proto.js';
|
|
14
18
|
export { default as shadcnTabsList } from './tabs/list.proto.js';
|
|
15
19
|
export { default as shadcnTabsTrigger } from './tabs/trigger.proto.js';
|
|
@@ -39,9 +43,17 @@ export { default as shadcnDialogHeader } from './dialog/header.proto.js';
|
|
|
39
43
|
export { default as shadcnDialogFooter } from './dialog/footer.proto.js';
|
|
40
44
|
export type { ShadcnButtonProps, ShadcnButtonExposes, ShadcnButtonSize, ShadcnButtonVariant, } from './button/types.js';
|
|
41
45
|
export type { ShadcnToggleProps, ShadcnToggleExposes, ShadcnToggleStateHandles, ShadcnToggleAsHookContract, } from './toggle/types.js';
|
|
46
|
+
export type { ShadcnCheckboxRootProps, ShadcnCheckboxRootExposes, ShadcnCheckboxRootStateHandles, ShadcnCheckboxRootAsHookContract, ShadcnCheckboxIndicatorProps, ShadcnCheckboxIndicatorExposes, ShadcnCheckboxIndicatorStateHandles, ShadcnCheckboxIndicatorAsHookContract, } from './checkbox/types.js';
|
|
42
47
|
export type { ShadcnSwitchRootProps, ShadcnSwitchRootExposes, ShadcnSwitchRootStateHandles, ShadcnSwitchRootAsHookContract, ShadcnSwitchThumbProps, ShadcnSwitchThumbExposes, ShadcnSwitchThumbAsHookContract, } from './switch/types.js';
|
|
43
48
|
export type { ShadcnTabsRootProps, ShadcnTabsRootExposes, ShadcnTabsRootAsHookContract, ShadcnTabsListProps, ShadcnTabsListExposes, ShadcnTabsListAsHookContract, ShadcnTabsTriggerProps, ShadcnTabsTriggerExposes, ShadcnTabsTriggerStateHandles, ShadcnTabsTriggerAsHookContract, ShadcnTabsContentProps, ShadcnTabsContentExposes, ShadcnTabsContentAsHookContract, } from './tabs/types.js';
|
|
44
49
|
export type { ShadcnHoverCardRootProps, ShadcnHoverCardRootExposes, ShadcnHoverCardRootAsHookContract, ShadcnHoverCardTriggerProps, ShadcnHoverCardTriggerExposes, ShadcnHoverCardTriggerAsHookContract, ShadcnHoverCardContentProps, ShadcnHoverCardContentExposes, ShadcnHoverCardContentAsHookContract, } from './hover-card/types.js';
|
|
45
50
|
export type { ShadcnDropdownRootProps, ShadcnDropdownRootExposes, ShadcnDropdownRootAsHookContract, ShadcnDropdownTriggerProps, ShadcnDropdownTriggerExposes, ShadcnDropdownTriggerAsHookContract, ShadcnDropdownContentProps, ShadcnDropdownContentExposes, ShadcnDropdownContentAsHookContract, ShadcnDropdownItemProps, ShadcnDropdownItemExposes, ShadcnDropdownItemAsHookContract, } from './dropdown/types.js';
|
|
46
51
|
export type { ShadcnSelectRootProps, ShadcnSelectRootExposes, ShadcnSelectRootAsHookContract, ShadcnSelectTriggerProps, ShadcnSelectTriggerExposes, ShadcnSelectTriggerAsHookContract, ShadcnSelectValueProps, ShadcnSelectValueExposes, ShadcnSelectValueAsHookContract, ShadcnSelectContentProps, ShadcnSelectContentExposes, ShadcnSelectContentAsHookContract, ShadcnSelectItemProps, ShadcnSelectItemExposes, ShadcnSelectItemAsHookContract, } from './select/types.js';
|
|
52
|
+
export type { ShadcnSeparatorRootProps, ShadcnSeparatorRootExposes, ShadcnSeparatorRootStateHandles, ShadcnSeparatorRootAsHookContract, } from './separator/types.js';
|
|
47
53
|
export type { ShadcnDialogRootProps, ShadcnDialogRootExposes, ShadcnDialogRootAsHookContract, ShadcnDialogTriggerProps, ShadcnDialogTriggerExposes, ShadcnDialogTriggerAsHookContract, ShadcnDialogMaskProps, ShadcnDialogMaskExposes, ShadcnDialogMaskAsHookContract, ShadcnDialogContentProps, ShadcnDialogContentExposes, ShadcnDialogContentAsHookContract, ShadcnDialogTitleProps, ShadcnDialogTitleExposes, ShadcnDialogTitleAsHookContract, ShadcnDialogDescriptionProps, ShadcnDialogDescriptionExposes, ShadcnDialogDescriptionAsHookContract, ShadcnDialogCloseProps, ShadcnDialogCloseExposes, ShadcnDialogCloseAsHookContract, } from './dialog/types.js';
|
|
54
|
+
export { ShadcnTextareaRoot, shadcnTextareaRoot } from './textarea/index.js';
|
|
55
|
+
export type { ShadcnTextareaRootProps, ShadcnTextareaRootExposes } from './textarea/index.js';
|
|
56
|
+
export { ShadcnScrollAreaRoot, ShadcnScrollAreaViewport, ShadcnScrollAreaScrollbar, ShadcnScrollAreaThumb, shadcnScrollAreaRoot, shadcnScrollAreaViewport, shadcnScrollAreaScrollbar, shadcnScrollAreaThumb, } from './scroll-area/index.js';
|
|
57
|
+
export type { ShadcnScrollAreaRootProps, ShadcnScrollAreaRootExposes, ShadcnScrollAreaRootStateHandles, ShadcnScrollAreaRootAsHookContract, ShadcnScrollAreaViewportProps, ShadcnScrollAreaViewportExposes, ShadcnScrollAreaViewportStateHandles, ShadcnScrollAreaViewportAsHookContract, ShadcnScrollAreaScrollbarProps, ShadcnScrollAreaScrollbarExposes, ShadcnScrollAreaScrollbarStateHandles, ShadcnScrollAreaScrollbarAsHookContract, ShadcnScrollAreaThumbProps, ShadcnScrollAreaThumbExposes, ShadcnScrollAreaThumbStateHandles, ShadcnScrollAreaThumbAsHookContract, } from './scroll-area/index.js';
|
|
58
|
+
export { ShadcnTooltipGroup, ShadcnTooltipRoot, ShadcnTooltipTrigger, ShadcnTooltipContent, shadcnTooltipGroup, shadcnTooltipRoot, shadcnTooltipTrigger, shadcnTooltipContent, } from './tooltip/index.js';
|
|
59
|
+
export type { ShadcnTooltipGroupProps, ShadcnTooltipGroupExposes, ShadcnTooltipGroupAsHookContract, ShadcnTooltipRootProps, ShadcnTooltipRootExposes, ShadcnTooltipRootStateHandles, ShadcnTooltipRootAsHookContract, ShadcnTooltipTriggerProps, ShadcnTooltipTriggerExposes, ShadcnTooltipTriggerStateHandles, ShadcnTooltipTriggerAsHookContract, ShadcnTooltipContentProps, ShadcnTooltipContentExposes, ShadcnTooltipContentStateHandles, ShadcnTooltipContentAsHookContract, } from './tooltip/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
export { default as button } from './button/index.js';
|
|
2
2
|
export { default as shadcnButton } from './button/index.js';
|
|
3
|
-
export { default as componentPresets, shadcnDialogComponentPreset, shadcnComponentPresets, shadcnSwitchComponentPreset, } from './component-presets.js';
|
|
3
|
+
export { default as componentPresets, shadcnCheckboxComponentPreset, shadcnDialogComponentPreset, shadcnComponentPresets, shadcnSwitchComponentPreset, } from './component-presets.js';
|
|
4
4
|
export { default as toggle } from './toggle/index.js';
|
|
5
5
|
export { default as shadcnToggle } from './toggle/index.js';
|
|
6
|
+
export { checkboxRoot, checkboxIndicator } from './checkbox/index.js';
|
|
7
|
+
export { default as shadcnCheckboxRoot } from './checkbox/root.proto.js';
|
|
8
|
+
export { default as shadcnCheckboxIndicator } from './checkbox/indicator.proto.js';
|
|
6
9
|
export { switchRoot, switchThumb } from './switch/index.js';
|
|
7
10
|
export { default as shadcnSwitchRoot } from './switch/root.proto.js';
|
|
8
11
|
export { default as shadcnSwitchThumb } from './switch/thumb.proto.js';
|
|
@@ -10,6 +13,7 @@ export { tabsRoot, tabsList, tabsTrigger, tabsContent } from './tabs/index.js';
|
|
|
10
13
|
export { hoverCardRoot, hoverCardTrigger, hoverCardContent } from './hover-card/index.js';
|
|
11
14
|
export { dropdownRoot, dropdownTrigger, dropdownContent, dropdownItem } from './dropdown/index.js';
|
|
12
15
|
export { selectRoot, selectTrigger, selectValue, selectContent, selectItem } from './select/index.js';
|
|
16
|
+
export { default as shadcnSeparatorRoot } from './separator/index.js';
|
|
13
17
|
export { default as shadcnTabsRoot } from './tabs/root.proto.js';
|
|
14
18
|
export { default as shadcnTabsList } from './tabs/list.proto.js';
|
|
15
19
|
export { default as shadcnTabsTrigger } from './tabs/trigger.proto.js';
|
|
@@ -37,3 +41,6 @@ export { default as shadcnDialogClose } from './dialog/close.proto.js';
|
|
|
37
41
|
export { default as shadcnDialogCloseIcon } from './dialog/close-icon.proto.js';
|
|
38
42
|
export { default as shadcnDialogHeader } from './dialog/header.proto.js';
|
|
39
43
|
export { default as shadcnDialogFooter } from './dialog/footer.proto.js';
|
|
44
|
+
export { ShadcnTextareaRoot, shadcnTextareaRoot } from './textarea/index.js';
|
|
45
|
+
export { ShadcnScrollAreaRoot, ShadcnScrollAreaViewport, ShadcnScrollAreaScrollbar, ShadcnScrollAreaThumb, shadcnScrollAreaRoot, shadcnScrollAreaViewport, shadcnScrollAreaScrollbar, shadcnScrollAreaThumb, } from './scroll-area/index.js';
|
|
46
|
+
export { ShadcnTooltipGroup, ShadcnTooltipRoot, ShadcnTooltipTrigger, ShadcnTooltipContent, shadcnTooltipGroup, shadcnTooltipRoot, shadcnTooltipTrigger, shadcnTooltipContent, } from './tooltip/index.js';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as ShadcnScrollAreaRoot, default as shadcnScrollAreaRoot } from './root.proto.js';
|
|
2
|
+
export { default as ShadcnScrollAreaViewport, default as shadcnScrollAreaViewport, } from './viewport.proto.js';
|
|
3
|
+
export { default as ShadcnScrollAreaScrollbar, default as shadcnScrollAreaScrollbar, } from './scrollbar.proto.js';
|
|
4
|
+
export { default as ShadcnScrollAreaThumb, default as shadcnScrollAreaThumb } from './thumb.proto.js';
|
|
5
|
+
export type { ShadcnScrollAreaRootProps, ShadcnScrollAreaRootExposes, ShadcnScrollAreaRootStateHandles, ShadcnScrollAreaRootAsHookContract, ShadcnScrollAreaViewportProps, ShadcnScrollAreaViewportExposes, ShadcnScrollAreaViewportStateHandles, ShadcnScrollAreaViewportAsHookContract, ShadcnScrollAreaScrollbarProps, ShadcnScrollAreaScrollbarExposes, ShadcnScrollAreaScrollbarStateHandles, ShadcnScrollAreaScrollbarAsHookContract, ShadcnScrollAreaThumbProps, ShadcnScrollAreaThumbExposes, ShadcnScrollAreaThumbStateHandles, ShadcnScrollAreaThumbAsHookContract, } from './types.js';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as ShadcnScrollAreaRoot, default as shadcnScrollAreaRoot } from './root.proto.js';
|
|
2
|
+
export { default as ShadcnScrollAreaViewport, default as shadcnScrollAreaViewport, } from './viewport.proto.js';
|
|
3
|
+
export { default as ShadcnScrollAreaScrollbar, default as shadcnScrollAreaScrollbar, } from './scrollbar.proto.js';
|
|
4
|
+
export { default as ShadcnScrollAreaThumb, default as shadcnScrollAreaThumb } from './thumb.proto.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { definePrototype, tw } from '@proto.ui/core';
|
|
2
|
+
import { asScrollAreaRoot } from '@proto.ui/prototypes-base/scroll-area';
|
|
3
|
+
const scrollAreaRoot = definePrototype({
|
|
4
|
+
name: 'shadcn-scroll-area-root',
|
|
5
|
+
setup(def) {
|
|
6
|
+
asScrollAreaRoot();
|
|
7
|
+
def.feedback.style.use(tw('relative overflow-hidden'));
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
export default scrollAreaRoot;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { definePrototype, tw } from '@proto.ui/core';
|
|
2
|
+
import { asScrollAreaScrollbar } from '@proto.ui/prototypes-base/scroll-area';
|
|
3
|
+
const SCROLLBAR_SURFACE_TOKENS = 'absolute flex touch-none select-none transition-colors';
|
|
4
|
+
const scrollAreaScrollbar = definePrototype({
|
|
5
|
+
name: 'shadcn-scroll-area-scrollbar',
|
|
6
|
+
setup(def) {
|
|
7
|
+
const state = asScrollAreaScrollbar().stateHandles;
|
|
8
|
+
if (!state) {
|
|
9
|
+
throw new Error('[shadcn-scroll-area-scrollbar] asScrollAreaScrollbar must project Scrollbar state handles.');
|
|
10
|
+
}
|
|
11
|
+
def.feedback.style.use(tw(SCROLLBAR_SURFACE_TOKENS));
|
|
12
|
+
def.rule({
|
|
13
|
+
when: (when) => when.state(state.orientation).eq('vertical'),
|
|
14
|
+
intent: (intent) => intent.feedback.style.use(tw('h-full w-2.5 top-0 right-0 border-2 border-transparent')),
|
|
15
|
+
});
|
|
16
|
+
def.rule({
|
|
17
|
+
when: (when) => when.state(state.orientation).eq('horizontal'),
|
|
18
|
+
intent: (intent) => intent.feedback.style.use(tw('w-full h-2.5 flex-col bottom-0 left-0 border-2 border-transparent')),
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
export default scrollAreaScrollbar;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { definePrototype, tw } from '@proto.ui/core';
|
|
2
|
+
import { asScrollAreaThumb } from '@proto.ui/prototypes-base/scroll-area';
|
|
3
|
+
const scrollAreaThumb = definePrototype({
|
|
4
|
+
name: 'shadcn-scroll-area-thumb',
|
|
5
|
+
setup(def) {
|
|
6
|
+
asScrollAreaThumb();
|
|
7
|
+
def.feedback.style.use(tw('relative flex-1 rounded-full bg-border'));
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
export default scrollAreaThumb;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ScrollAreaRootAsHookContract, ScrollAreaRootExposes, ScrollAreaRootProps, ScrollAreaRootStateHandles, ScrollAreaScrollbarAsHookContract, ScrollAreaScrollbarExposes, ScrollAreaScrollbarProps, ScrollAreaScrollbarStateHandles, ScrollAreaThumbAsHookContract, ScrollAreaThumbExposes, ScrollAreaThumbProps, ScrollAreaThumbStateHandles, ScrollAreaViewportAsHookContract, ScrollAreaViewportExposes, ScrollAreaViewportProps, ScrollAreaViewportStateHandles } from '@proto.ui/prototypes-base/scroll-area';
|
|
2
|
+
export type ShadcnScrollAreaRootProps = ScrollAreaRootProps;
|
|
3
|
+
export type ShadcnScrollAreaRootExposes = ScrollAreaRootExposes;
|
|
4
|
+
export type ShadcnScrollAreaRootStateHandles = ScrollAreaRootStateHandles;
|
|
5
|
+
export type ShadcnScrollAreaRootAsHookContract = ScrollAreaRootAsHookContract;
|
|
6
|
+
export type ShadcnScrollAreaViewportProps = ScrollAreaViewportProps;
|
|
7
|
+
export type ShadcnScrollAreaViewportExposes = ScrollAreaViewportExposes;
|
|
8
|
+
export type ShadcnScrollAreaViewportStateHandles = ScrollAreaViewportStateHandles;
|
|
9
|
+
export type ShadcnScrollAreaViewportAsHookContract = ScrollAreaViewportAsHookContract;
|
|
10
|
+
export type ShadcnScrollAreaScrollbarProps = ScrollAreaScrollbarProps;
|
|
11
|
+
export type ShadcnScrollAreaScrollbarExposes = ScrollAreaScrollbarExposes;
|
|
12
|
+
export type ShadcnScrollAreaScrollbarStateHandles = ScrollAreaScrollbarStateHandles;
|
|
13
|
+
export type ShadcnScrollAreaScrollbarAsHookContract = ScrollAreaScrollbarAsHookContract;
|
|
14
|
+
export type ShadcnScrollAreaThumbProps = ScrollAreaThumbProps;
|
|
15
|
+
export type ShadcnScrollAreaThumbExposes = ScrollAreaThumbExposes;
|
|
16
|
+
export type ShadcnScrollAreaThumbStateHandles = ScrollAreaThumbStateHandles;
|
|
17
|
+
export type ShadcnScrollAreaThumbAsHookContract = ScrollAreaThumbAsHookContract;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { definePrototype, tw } from '@proto.ui/core';
|
|
2
|
+
import { asScrollSurface } from '@proto.ui/hooks';
|
|
3
|
+
import { asScrollAreaViewport } from '@proto.ui/prototypes-base/scroll-area';
|
|
4
|
+
const scrollAreaViewport = definePrototype({
|
|
5
|
+
name: 'shadcn-scroll-area-viewport',
|
|
6
|
+
setup(def) {
|
|
7
|
+
const state = asScrollAreaViewport().stateHandles;
|
|
8
|
+
if (!state) {
|
|
9
|
+
throw new Error('[shadcn-scroll-area-viewport] asScrollAreaViewport must project Viewport state handles.');
|
|
10
|
+
}
|
|
11
|
+
asScrollSurface().configure({ projection: 'composed' });
|
|
12
|
+
def.feedback.style.use(tw('h-full w-full rounded-md transition-[color,box-shadow] outline-none'));
|
|
13
|
+
def.rule({
|
|
14
|
+
when: (when) => when.state(state.focusVisible).eq(true),
|
|
15
|
+
intent: (intent) => intent.feedback.style.use(tw('ring-3 ring-ring/50 ring-inset outline-1 outline-ring')),
|
|
16
|
+
});
|
|
17
|
+
return (renderer) => [renderer.r.slot()];
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
export default scrollAreaViewport;
|
|
@@ -52,7 +52,7 @@ const selectTrigger = definePrototype({
|
|
|
52
52
|
});
|
|
53
53
|
def.rule({
|
|
54
54
|
when: (w) => w.state(pressed).eq(true),
|
|
55
|
-
intent: (i) => i.feedback.style.use(tw('bg-input/70')),
|
|
55
|
+
intent: (i) => i.feedback.style.use(tw('bg-input/70 translate-y-px')),
|
|
56
56
|
});
|
|
57
57
|
def.rule({
|
|
58
58
|
when: (w) => w.state(disabled).eq(true),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, default as shadcnSeparatorRoot } from './root.proto.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ShadcnSeparatorRootProps } from './types.js';
|
|
2
|
+
declare const separatorRoot: import("@proto.ui/core").Prototype<ShadcnSeparatorRootProps, import("@proto.ui/prototypes-base").SeparatorRootExposes>;
|
|
3
|
+
/**
|
|
4
|
+
* P-SHADCN-SEPARATOR-DIRECT-ENTRY exposes the current Root projection.
|
|
5
|
+
* P-SHADCN-SEPARATOR-COMPATIBILITY-SUBSET centralizes every upstream difference;
|
|
6
|
+
* P-SHADCN-SEPARATOR-AS-CHILD-OMISSION is intentional under D-AS-CHILD-OMISSION-0001,
|
|
7
|
+
* while data-slot, className and native prop forwarding remain parity gaps.
|
|
8
|
+
*/
|
|
9
|
+
export type { ShadcnSeparatorRootProps, ShadcnSeparatorRootExposes, ShadcnSeparatorRootStateHandles, ShadcnSeparatorRootAsHookContract, } from './types.js';
|
|
10
|
+
export default separatorRoot;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { definePrototype, tw } from '@proto.ui/core';
|
|
2
|
+
import { asSeparatorRoot } from '@proto.ui/prototypes-base/separator';
|
|
3
|
+
const ROOT_BASE_TOKENS = ['shrink-0', 'bg-border'].join(' ');
|
|
4
|
+
const separatorRoot = definePrototype({
|
|
5
|
+
name: 'shadcn-separator-root',
|
|
6
|
+
setup(def) {
|
|
7
|
+
// P-SHADCN-SEPARATOR-BASE-INHERITANCE,
|
|
8
|
+
// P-SHADCN-SEPARATOR-CURRENT-BASE-DEVIATIONS
|
|
9
|
+
const separatorState = asSeparatorRoot().stateHandles;
|
|
10
|
+
if (!separatorState) {
|
|
11
|
+
throw new Error('[shadcn-separator-root] asSeparatorRoot must project Separator root state handles.');
|
|
12
|
+
}
|
|
13
|
+
const { orientation } = separatorState;
|
|
14
|
+
// P-SHADCN-SEPARATOR-CURRENT-VISUAL-SURFACE
|
|
15
|
+
def.feedback.style.use(tw(ROOT_BASE_TOKENS));
|
|
16
|
+
// P-SHADCN-SEPARATOR-STATE-DRIVEN-GEOMETRY
|
|
17
|
+
def.rule({
|
|
18
|
+
when: (w) => w.state(orientation).eq('horizontal'),
|
|
19
|
+
intent: (i) => i.feedback.style.use(tw('h-px w-full')),
|
|
20
|
+
});
|
|
21
|
+
def.rule({
|
|
22
|
+
when: (w) => w.state(orientation).eq('vertical'),
|
|
23
|
+
intent: (i) => i.feedback.style.use(tw('h-full w-px')),
|
|
24
|
+
});
|
|
25
|
+
// P-SHADCN-SEPARATOR-CONTENTLESS: the caller prototype owns its own renderer,
|
|
26
|
+
// so the inherited Base contentless renderer has to be restated here.
|
|
27
|
+
return () => null;
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
export default separatorRoot;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SeparatorRootAsHookContract, SeparatorRootExposes, SeparatorRootProps, SeparatorRootStateHandles } from '@proto.ui/prototypes-base/separator';
|
|
2
|
+
export interface ShadcnSeparatorRootProps extends SeparatorRootProps {
|
|
3
|
+
}
|
|
4
|
+
export type ShadcnSeparatorRootExposes = SeparatorRootExposes;
|
|
5
|
+
export type ShadcnSeparatorRootStateHandles = SeparatorRootStateHandles;
|
|
6
|
+
export type ShadcnSeparatorRootAsHookContract = SeparatorRootAsHookContract;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ShadcnTextareaRoot as default, ShadcnTextareaRoot, ShadcnTextareaRoot as shadcnTextareaRoot, } from './root.proto.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ShadcnTextareaRoot: import("@proto.ui/core").Prototype<import("@proto.ui/prototypes-base").TextareaRootProps, import("@proto.ui/prototypes-base").TextareaRootExposes>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { definePrototype, tw } from '@proto.ui/core';
|
|
2
|
+
import { asTextareaRoot } from '@proto.ui/prototypes-base/textarea';
|
|
3
|
+
const ROOT_BASE_TOKENS = [
|
|
4
|
+
'flex',
|
|
5
|
+
'min-h-16',
|
|
6
|
+
'w-full',
|
|
7
|
+
'resize-y',
|
|
8
|
+
'rounded-md',
|
|
9
|
+
'border',
|
|
10
|
+
'border-input',
|
|
11
|
+
'bg-transparent',
|
|
12
|
+
'px-3',
|
|
13
|
+
'py-2',
|
|
14
|
+
'text-base',
|
|
15
|
+
'text-foreground',
|
|
16
|
+
'shadow-xs',
|
|
17
|
+
'transition-[color,box-shadow]',
|
|
18
|
+
'duration-150',
|
|
19
|
+
'ease-in-out',
|
|
20
|
+
'outline-none',
|
|
21
|
+
].join(' ');
|
|
22
|
+
export const ShadcnTextareaRoot = definePrototype({
|
|
23
|
+
name: 'shadcn-textarea-root',
|
|
24
|
+
modules: asTextareaRoot.modules,
|
|
25
|
+
setup(def) {
|
|
26
|
+
// P-SHADCN-TEXTAREA-BASE-INHERITANCE: Base owns value, editing lifecycle, IME,
|
|
27
|
+
// accessibility, and the single physical editor.
|
|
28
|
+
const state = asTextareaRoot().stateHandles;
|
|
29
|
+
if (!state) {
|
|
30
|
+
throw new Error('[shadcn-textarea-root] asTextareaRoot must project Textarea state handles.');
|
|
31
|
+
}
|
|
32
|
+
// P-SHADCN-TEXTAREA-CURRENT-VISUAL-SURFACE
|
|
33
|
+
def.feedback.style.use(tw(ROOT_BASE_TOKENS));
|
|
34
|
+
// P-SHADCN-TEXTAREA-STATE-DRIVEN-STYLES
|
|
35
|
+
// Upstream keys the ring on `:focus-visible`; Focus now honors the host
|
|
36
|
+
// `:focus-visible` determination for pointer-focused text controls (#438),
|
|
37
|
+
// so the projected `focusVisible` state matches upstream click behaviour.
|
|
38
|
+
def.rule({
|
|
39
|
+
when: (w) => w.state(state.focusVisible).eq(true),
|
|
40
|
+
intent: (i) => i.feedback.style.use(tw('border-ring ring-ring/50 ring-3')),
|
|
41
|
+
});
|
|
42
|
+
def.rule({
|
|
43
|
+
when: (w) => w.state(state.disabled).eq(true),
|
|
44
|
+
intent: (i) => i.feedback.style.use(tw('cursor-not-allowed opacity-50')),
|
|
45
|
+
});
|
|
46
|
+
def.rule({
|
|
47
|
+
when: (w) => w.meta('colorScheme').eq('dark'),
|
|
48
|
+
intent: (i) => i.feedback.style.use(tw('bg-input/30')),
|
|
49
|
+
});
|
|
50
|
+
// P-SHADCN-TEXTAREA-CONTENTLESS: the caller prototype owns its own renderer,
|
|
51
|
+
// so the inherited Base contentless renderer has to be restated here.
|
|
52
|
+
return () => null;
|
|
53
|
+
},
|
|
54
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { definePrototype, tw } from '@proto.ui/core';
|
|
2
|
+
import { asTooltipContent } from '@proto.ui/prototypes-base/tooltip';
|
|
3
|
+
const CONTENT_SURFACE_TOKENS = [
|
|
4
|
+
'z-50',
|
|
5
|
+
'overflow-hidden',
|
|
6
|
+
'rounded-md',
|
|
7
|
+
'border',
|
|
8
|
+
'bg-popover',
|
|
9
|
+
'px-3',
|
|
10
|
+
'py-1.5',
|
|
11
|
+
'text-xs',
|
|
12
|
+
'text-popover-foreground',
|
|
13
|
+
'shadow-md',
|
|
14
|
+
].join(' ');
|
|
15
|
+
const tooltipContent = definePrototype({
|
|
16
|
+
name: 'shadcn-tooltip-content',
|
|
17
|
+
setup(def) {
|
|
18
|
+
asTooltipContent();
|
|
19
|
+
def.feedback.style.use(tw(CONTENT_SURFACE_TOKENS));
|
|
20
|
+
return (renderer) => [renderer.r.slot()];
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
export default tooltipContent;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { definePrototype, tw } from '@proto.ui/core';
|
|
2
|
+
import { asTooltipGroup } from '@proto.ui/prototypes-base/tooltip';
|
|
3
|
+
const tooltipGroup = definePrototype({
|
|
4
|
+
name: 'shadcn-tooltip-group',
|
|
5
|
+
setup(def) {
|
|
6
|
+
asTooltipGroup();
|
|
7
|
+
def.feedback.style.use(tw('inline-flex'));
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
export default tooltipGroup;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as ShadcnTooltipGroup, default as shadcnTooltipGroup } from './group.proto.js';
|
|
2
|
+
export { default as ShadcnTooltipRoot, default as shadcnTooltipRoot } from './root.proto.js';
|
|
3
|
+
export { default as ShadcnTooltipTrigger, default as shadcnTooltipTrigger } from './trigger.proto.js';
|
|
4
|
+
export { default as ShadcnTooltipContent, default as shadcnTooltipContent } from './content.proto.js';
|
|
5
|
+
export type { ShadcnTooltipGroupProps, ShadcnTooltipGroupExposes, ShadcnTooltipGroupAsHookContract, ShadcnTooltipRootProps, ShadcnTooltipRootExposes, ShadcnTooltipRootStateHandles, ShadcnTooltipRootAsHookContract, ShadcnTooltipTriggerProps, ShadcnTooltipTriggerExposes, ShadcnTooltipTriggerStateHandles, ShadcnTooltipTriggerAsHookContract, ShadcnTooltipContentProps, ShadcnTooltipContentExposes, ShadcnTooltipContentStateHandles, ShadcnTooltipContentAsHookContract, } from './types.js';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as ShadcnTooltipGroup, default as shadcnTooltipGroup } from './group.proto.js';
|
|
2
|
+
export { default as ShadcnTooltipRoot, default as shadcnTooltipRoot } from './root.proto.js';
|
|
3
|
+
export { default as ShadcnTooltipTrigger, default as shadcnTooltipTrigger } from './trigger.proto.js';
|
|
4
|
+
export { default as ShadcnTooltipContent, default as shadcnTooltipContent } from './content.proto.js';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { definePrototype, tw } from '@proto.ui/core';
|
|
2
|
+
import { asTooltipTrigger } from '@proto.ui/prototypes-base/tooltip';
|
|
3
|
+
const tooltipTrigger = definePrototype({
|
|
4
|
+
name: 'shadcn-tooltip-trigger',
|
|
5
|
+
setup(def) {
|
|
6
|
+
const state = asTooltipTrigger().stateHandles;
|
|
7
|
+
if (!state) {
|
|
8
|
+
throw new Error('[shadcn-tooltip-trigger] asTooltipTrigger must project Tooltip Trigger state handles.');
|
|
9
|
+
}
|
|
10
|
+
const { disabled, hovered, focusVisible } = state;
|
|
11
|
+
const pressed = def.state.fromInteraction('pressed');
|
|
12
|
+
def.feedback.style.use(tw('inline-flex cursor-pointer outline-none'));
|
|
13
|
+
def.rule({
|
|
14
|
+
when: (when) => when.state(hovered).eq(true),
|
|
15
|
+
intent: (intent) => intent.feedback.style.use(tw('opacity-70')),
|
|
16
|
+
});
|
|
17
|
+
def.rule({
|
|
18
|
+
when: (when) => when.state(focusVisible).eq(true),
|
|
19
|
+
intent: (intent) => intent.feedback.style.use(tw('ring-2 ring-ring ring-offset-2 ring-offset-background')),
|
|
20
|
+
});
|
|
21
|
+
def.rule({
|
|
22
|
+
when: (when) => when.all(when.state(pressed).eq(true), when.state(disabled).eq(false)),
|
|
23
|
+
intent: (intent) => intent.feedback.style.use(tw('scale-[0.98]')),
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
export default tooltipTrigger;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TooltipContentAsHookContract, TooltipContentExposes, TooltipContentProps, TooltipContentStateHandles, TooltipGroupAsHookContract, TooltipGroupExposes, TooltipGroupProps, TooltipRootAsHookContract, TooltipRootExposes, TooltipRootProps, TooltipRootStateHandles, TooltipTriggerAsHookContract, TooltipTriggerExposes, TooltipTriggerProps, TooltipTriggerStateHandles } from '@proto.ui/prototypes-base/tooltip';
|
|
2
|
+
export type ShadcnTooltipGroupProps = TooltipGroupProps;
|
|
3
|
+
export type ShadcnTooltipGroupExposes = TooltipGroupExposes;
|
|
4
|
+
export type ShadcnTooltipGroupAsHookContract = TooltipGroupAsHookContract;
|
|
5
|
+
export type ShadcnTooltipRootProps = TooltipRootProps;
|
|
6
|
+
export type ShadcnTooltipRootExposes = TooltipRootExposes;
|
|
7
|
+
export type ShadcnTooltipRootStateHandles = TooltipRootStateHandles;
|
|
8
|
+
export type ShadcnTooltipRootAsHookContract = TooltipRootAsHookContract;
|
|
9
|
+
export type ShadcnTooltipTriggerProps = TooltipTriggerProps;
|
|
10
|
+
export type ShadcnTooltipTriggerExposes = TooltipTriggerExposes;
|
|
11
|
+
export type ShadcnTooltipTriggerStateHandles = TooltipTriggerStateHandles;
|
|
12
|
+
export type ShadcnTooltipTriggerAsHookContract = TooltipTriggerAsHookContract;
|
|
13
|
+
export type ShadcnTooltipContentProps = TooltipContentProps;
|
|
14
|
+
export type ShadcnTooltipContentExposes = TooltipContentExposes;
|
|
15
|
+
export type ShadcnTooltipContentStateHandles = TooltipContentStateHandles;
|
|
16
|
+
export type ShadcnTooltipContentAsHookContract = TooltipContentAsHookContract;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proto.ui/prototypes-shadcn",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-alpha.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"protoUi": {
|
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@proto.ui/core": "0.
|
|
15
|
-
"@proto.ui/
|
|
14
|
+
"@proto.ui/core": "0.3.0-alpha.1",
|
|
15
|
+
"@proto.ui/hooks": "0.3.0-alpha.1",
|
|
16
|
+
"@proto.ui/prototypes-base": "0.3.0-alpha.1"
|
|
16
17
|
},
|
|
17
18
|
"exports": {
|
|
18
19
|
".": {
|
|
@@ -25,6 +26,11 @@
|
|
|
25
26
|
"import": "./dist/button/index.js",
|
|
26
27
|
"default": "./dist/button/index.js"
|
|
27
28
|
},
|
|
29
|
+
"./checkbox": {
|
|
30
|
+
"types": "./dist/checkbox/index.d.ts",
|
|
31
|
+
"import": "./dist/checkbox/index.js",
|
|
32
|
+
"default": "./dist/checkbox/index.js"
|
|
33
|
+
},
|
|
28
34
|
"./component-presets": {
|
|
29
35
|
"types": "./dist/component-presets.d.ts",
|
|
30
36
|
"import": "./dist/component-presets.js",
|
|
@@ -50,6 +56,11 @@
|
|
|
50
56
|
"import": "./dist/select/index.js",
|
|
51
57
|
"default": "./dist/select/index.js"
|
|
52
58
|
},
|
|
59
|
+
"./separator": {
|
|
60
|
+
"types": "./dist/separator/index.d.ts",
|
|
61
|
+
"import": "./dist/separator/index.js",
|
|
62
|
+
"default": "./dist/separator/index.js"
|
|
63
|
+
},
|
|
53
64
|
"./switch": {
|
|
54
65
|
"types": "./dist/switch/index.d.ts",
|
|
55
66
|
"import": "./dist/switch/index.js",
|
|
@@ -60,10 +71,25 @@
|
|
|
60
71
|
"import": "./dist/tabs/index.js",
|
|
61
72
|
"default": "./dist/tabs/index.js"
|
|
62
73
|
},
|
|
74
|
+
"./textarea": {
|
|
75
|
+
"types": "./dist/textarea/index.d.ts",
|
|
76
|
+
"import": "./dist/textarea/index.js",
|
|
77
|
+
"default": "./dist/textarea/index.js"
|
|
78
|
+
},
|
|
63
79
|
"./toggle": {
|
|
64
80
|
"types": "./dist/toggle/index.d.ts",
|
|
65
81
|
"import": "./dist/toggle/index.js",
|
|
66
82
|
"default": "./dist/toggle/index.js"
|
|
83
|
+
},
|
|
84
|
+
"./scroll-area": {
|
|
85
|
+
"types": "./dist/scroll-area/index.d.ts",
|
|
86
|
+
"import": "./dist/scroll-area/index.js",
|
|
87
|
+
"default": "./dist/scroll-area/index.js"
|
|
88
|
+
},
|
|
89
|
+
"./tooltip": {
|
|
90
|
+
"types": "./dist/tooltip/index.d.ts",
|
|
91
|
+
"import": "./dist/tooltip/index.js",
|
|
92
|
+
"default": "./dist/tooltip/index.js"
|
|
67
93
|
}
|
|
68
94
|
},
|
|
69
95
|
"description": "shadcn-style Proto UI prototype library for adapter-driven components.",
|