@surreal-ui/web 0.5.2 → 0.5.3
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/CHANGELOG.md +6 -0
- package/package.json +2 -2
- package/src/components/GlassmorphismAlert.ts +1 -2
- package/src/components/GlassmorphismButton.ts +1 -2
- package/src/components/GlassmorphismCard.ts +6 -3
- package/src/components/GlassmorphismEmptyState.ts +8 -2
- package/src/components/GlassmorphismInputGroup.ts +9 -6
- package/src/components/GlassmorphismMenubar.ts +1 -1
- package/src/components/GlassmorphismScrollArea.ts +7 -4
- package/src/components/GlassmorphismTable.ts +1 -1
- package/src/components/GlassmorphismTypography.ts +5 -2
- package/src/components/MinimalistAccordion.ts +14 -10
- package/src/components/MinimalistAlert.ts +1 -2
- package/src/components/MinimalistAlertDialog.ts +8 -6
- package/src/components/MinimalistAspectRatio.ts +7 -5
- package/src/components/MinimalistAvatar.ts +3 -4
- package/src/components/MinimalistBadge.ts +8 -9
- package/src/components/MinimalistBreadcrumb.ts +6 -6
- package/src/components/MinimalistButton.ts +9 -10
- package/src/components/MinimalistButtonGroup.ts +14 -12
- package/src/components/MinimalistCalendar.ts +14 -15
- package/src/components/MinimalistCard.ts +1 -2
- package/src/components/MinimalistCarousel.ts +4 -5
- package/src/components/MinimalistChart.ts +6 -7
- package/src/components/MinimalistCheckbox.ts +7 -8
- package/src/components/MinimalistCodeBlock.ts +4 -5
- package/src/components/MinimalistCollapsible.ts +13 -8
- package/src/components/MinimalistCommand.ts +7 -8
- package/src/components/MinimalistContextMenu.ts +7 -5
- package/src/components/MinimalistDialog.ts +4 -5
- package/src/components/MinimalistDrawer.ts +8 -9
- package/src/components/MinimalistDropdownMenu.ts +12 -7
- package/src/components/MinimalistEmpty.ts +11 -12
- package/src/components/MinimalistEmptyState.ts +5 -2
- package/src/components/MinimalistField.ts +27 -22
- package/src/components/MinimalistForm.ts +9 -8
- package/src/components/MinimalistHoverCard.ts +3 -4
- package/src/components/MinimalistInput.ts +7 -8
- package/src/components/MinimalistInputGroup.ts +10 -8
- package/src/components/MinimalistInputOtp.ts +6 -7
- package/src/components/MinimalistItem.ts +7 -8
- package/src/components/MinimalistKbd.ts +4 -5
- package/src/components/MinimalistLabel.ts +4 -5
- package/src/components/MinimalistMenubar.ts +7 -8
- package/src/components/MinimalistNativeSelect.ts +12 -7
- package/src/components/MinimalistNavigationMenu.ts +11 -6
- package/src/components/MinimalistPagination.ts +4 -5
- package/src/components/MinimalistPopover.ts +3 -4
- package/src/components/MinimalistProgress.ts +4 -5
- package/src/components/MinimalistRadioGroup.ts +10 -8
- package/src/components/MinimalistRangeCalendar.ts +18 -13
- package/src/components/MinimalistResizable.ts +1 -1
- package/src/components/MinimalistScrollArea.ts +34 -3
- package/src/components/MinimalistSelect.ts +3 -4
- package/src/components/MinimalistSeparator.ts +4 -5
- package/src/components/MinimalistSheet.ts +4 -5
- package/src/components/MinimalistSidebar.ts +3 -4
- package/src/components/MinimalistSkeleton.ts +3 -4
- package/src/components/MinimalistSlider.ts +7 -8
- package/src/components/MinimalistSonner.ts +5 -6
- package/src/components/MinimalistSpinner.ts +3 -4
- package/src/components/MinimalistSwitch.ts +5 -6
- package/src/components/MinimalistTable.ts +1 -1
- package/src/components/MinimalistTabs.ts +5 -6
- package/src/components/MinimalistTextarea.ts +9 -10
- package/src/components/MinimalistToggle.ts +11 -12
- package/src/components/MinimalistToggleGroup.ts +8 -6
- package/src/components/MinimalistTooltip.ts +3 -4
- package/src/components/MinimalistTypography.ts +1 -2
- package/src/components/NeubrutalismCard.ts +1 -1
- package/src/components/NeubrutalismItem.ts +1 -1
- package/src/components/ShadcnAccordion.ts +14 -10
- package/src/components/ShadcnAlertDialog.ts +4 -5
- package/src/components/ShadcnAspectRatio.ts +3 -4
- package/src/components/ShadcnAvatar.ts +3 -4
- package/src/components/ShadcnBadge.ts +8 -9
- package/src/components/ShadcnBreadcrumb.ts +6 -6
- package/src/components/ShadcnButton.ts +9 -10
- package/src/components/ShadcnButtonGroup.ts +10 -11
- package/src/components/ShadcnCalendar.ts +14 -15
- package/src/components/ShadcnCarousel.ts +4 -5
- package/src/components/ShadcnChart.ts +6 -7
- package/src/components/ShadcnCheckbox.ts +7 -8
- package/src/components/ShadcnCodeBlock.ts +4 -5
- package/src/components/ShadcnCollapsible.ts +9 -7
- package/src/components/ShadcnCommand.ts +7 -8
- package/src/components/ShadcnContextMenu.ts +3 -4
- package/src/components/ShadcnDialog.ts +4 -5
- package/src/components/ShadcnDrawer.ts +8 -9
- package/src/components/ShadcnDropdownMenu.ts +8 -6
- package/src/components/ShadcnEmpty.ts +11 -12
- package/src/components/ShadcnField.ts +27 -22
- package/src/components/ShadcnForm.ts +9 -8
- package/src/components/ShadcnHoverCard.ts +3 -4
- package/src/components/ShadcnInput.ts +7 -8
- package/src/components/ShadcnInputGroup.ts +6 -7
- package/src/components/ShadcnInputOtp.ts +6 -7
- package/src/components/ShadcnItem.ts +7 -8
- package/src/components/ShadcnKbd.ts +4 -5
- package/src/components/ShadcnLabel.ts +4 -5
- package/src/components/ShadcnMenubar.ts +7 -8
- package/src/components/ShadcnNativeSelect.ts +8 -6
- package/src/components/ShadcnNavigationMenu.ts +7 -5
- package/src/components/ShadcnPagination.ts +4 -5
- package/src/components/ShadcnPopover.ts +3 -4
- package/src/components/ShadcnProgress.ts +4 -5
- package/src/components/ShadcnRadioGroup.ts +6 -7
- package/src/components/ShadcnRangeCalendar.ts +14 -12
- package/src/components/ShadcnSelect.ts +3 -4
- package/src/components/ShadcnSeparator.ts +4 -5
- package/src/components/ShadcnSheet.ts +4 -5
- package/src/components/ShadcnSidebar.ts +3 -4
- package/src/components/ShadcnSkeleton.ts +3 -4
- package/src/components/ShadcnSlider.ts +7 -8
- package/src/components/ShadcnSonner.ts +5 -6
- package/src/components/ShadcnSpinner.ts +3 -4
- package/src/components/ShadcnSwitch.ts +5 -6
- package/src/components/ShadcnTabs.ts +5 -6
- package/src/components/ShadcnTextarea.ts +9 -10
- package/src/components/ShadcnToggle.ts +11 -12
- package/src/components/ShadcnToggleGroup.ts +4 -5
- package/src/components/ShadcnTooltip.ts +3 -4
|
@@ -26,7 +26,7 @@ class SurrealShadcnCarousel extends HTMLElement {
|
|
|
26
26
|
|
|
27
27
|
private setupListeners() {
|
|
28
28
|
this.container = this.querySelector(
|
|
29
|
-
'[data-slot="carousel-content"] > [data-embla-container], [data-embla-container]'
|
|
29
|
+
'[data-slot="carousel-content"] > [data-embla-container], [data-embla-container]'
|
|
30
30
|
);
|
|
31
31
|
this.prevButton = this.querySelector('[data-slot="carousel-previous"]');
|
|
32
32
|
this.nextButton = this.querySelector('[data-slot="carousel-next"]');
|
|
@@ -108,11 +108,10 @@ class SurrealShadcnCarousel extends HTMLElement {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
if (!customElements.get('surreal-carousel')) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn-carousel')) {
|
|
112
|
+
customElements.define('surreal-shadcn-carousel', SurrealShadcnCarousel);
|
|
113
|
+
}
|
|
114
114
|
}
|
|
115
|
-
};
|
|
116
115
|
export { SurrealShadcnCarousel as MinimalistCarousel, SurrealShadcnCarousel };
|
|
117
116
|
|
|
118
117
|
if (typeof customElements !== 'undefined' && !customElements.get('surreal-minimalist-carousel')) {
|
|
@@ -65,7 +65,7 @@ class SurrealShadcnChartContainer extends HTMLElement {
|
|
|
65
65
|
render() {
|
|
66
66
|
this.className = [
|
|
67
67
|
'flex aspect-video justify-center overflow-visible text-xs w-full',
|
|
68
|
-
this.className
|
|
68
|
+
this.className
|
|
69
69
|
].join(' ');
|
|
70
70
|
this.applyConfigStyles();
|
|
71
71
|
}
|
|
@@ -97,7 +97,7 @@ class SurrealShadcnChartTooltip extends HTMLElement {
|
|
|
97
97
|
this.setAttribute('data-slot', 'chart-tooltip');
|
|
98
98
|
this.className = [
|
|
99
99
|
'grid min-w-[9rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl',
|
|
100
|
-
this.className
|
|
100
|
+
this.className
|
|
101
101
|
].join(' ');
|
|
102
102
|
|
|
103
103
|
let html = '';
|
|
@@ -133,15 +133,14 @@ class SurrealShadcnChartTooltip extends HTMLElement {
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
if (!customElements.get('surreal-chart-container')) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
136
|
+
if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn-chart')) {
|
|
137
|
+
customElements.define('surreal-shadcn-chart', SurrealShadcnChartContainer);
|
|
138
|
+
}
|
|
140
139
|
}
|
|
141
140
|
|
|
142
141
|
if (!customElements.get('surreal-chart-tooltip')) {
|
|
143
142
|
customElements.define('surreal-shadcn-chart', SurrealShadcnChartTooltip);
|
|
144
|
-
}
|
|
143
|
+
}
|
|
145
144
|
export { SurrealShadcnChartContainer as MinimalistChart, SurrealShadcnChartContainer };
|
|
146
145
|
|
|
147
146
|
if (typeof customElements !== 'undefined' && !customElements.get('surreal-minimalist-chart')) {
|
|
@@ -80,8 +80,8 @@ class SurrealShadcnCheckbox extends HTMLElement {
|
|
|
80
80
|
new CustomEvent('change', {
|
|
81
81
|
detail: { checked: this.checked },
|
|
82
82
|
bubbles: true,
|
|
83
|
-
composed: true
|
|
84
|
-
})
|
|
83
|
+
composed: true
|
|
84
|
+
})
|
|
85
85
|
);
|
|
86
86
|
};
|
|
87
87
|
|
|
@@ -103,13 +103,13 @@ class SurrealShadcnCheckbox extends HTMLElement {
|
|
|
103
103
|
this._button.setAttribute('role', 'checkbox');
|
|
104
104
|
this._button.setAttribute(
|
|
105
105
|
'aria-checked',
|
|
106
|
-
isIndeterminate ? 'mixed' : isChecked ? 'true' : 'false'
|
|
106
|
+
isIndeterminate ? 'mixed' : isChecked ? 'true' : 'false'
|
|
107
107
|
);
|
|
108
108
|
this._button.setAttribute('aria-required', isRequired ? 'true' : 'false');
|
|
109
109
|
this._button.setAttribute('data-slot', 'checkbox');
|
|
110
110
|
this._button.setAttribute(
|
|
111
111
|
'data-state',
|
|
112
|
-
isIndeterminate ? 'indeterminate' : isChecked ? 'checked' : 'unchecked'
|
|
112
|
+
isIndeterminate ? 'indeterminate' : isChecked ? 'checked' : 'unchecked'
|
|
113
113
|
);
|
|
114
114
|
this._button.disabled = isDisabled;
|
|
115
115
|
if (isDisabled) {
|
|
@@ -165,10 +165,9 @@ class SurrealShadcnCheckbox extends HTMLElement {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
if (typeof customElements !== 'undefined' && !customElements.get('surreal-checkbox')) {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
168
|
+
if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn-checkbox')) {
|
|
169
|
+
customElements.define('surreal-shadcn-checkbox', SurrealShadcnCheckbox);
|
|
170
|
+
}
|
|
172
171
|
}
|
|
173
172
|
|
|
174
173
|
export { SurrealShadcnCheckbox };
|
|
@@ -49,7 +49,7 @@ class SurrealShadcnCodeBlock extends HTMLElement {
|
|
|
49
49
|
? lines
|
|
50
50
|
.map(
|
|
51
51
|
(line, idx) =>
|
|
52
|
-
`<span class="inline-block min-w-10 mr-4 text-right select-none text-muted-foreground">${idx + 1}</span>${line}
|
|
52
|
+
`<span class="inline-block min-w-10 mr-4 text-right select-none text-muted-foreground">${idx + 1}</span>${line}`
|
|
53
53
|
)
|
|
54
54
|
.join('\n')
|
|
55
55
|
: escaped;
|
|
@@ -99,11 +99,10 @@ class SurrealShadcnCodeBlock extends HTMLElement {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
if (typeof customElements !== 'undefined' && !customElements.get('surreal-code-block')) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn-code-block')) {
|
|
103
|
+
customElements.define('surreal-shadcn-code-block', SurrealShadcnCodeBlock);
|
|
104
|
+
}
|
|
105
105
|
}
|
|
106
|
-
};
|
|
107
106
|
export { SurrealShadcnCodeBlock as MinimalistCodeBlock, SurrealShadcnCodeBlock };
|
|
108
107
|
|
|
109
108
|
if (typeof customElements !== 'undefined' && !customElements.get('surreal-minimalist-code-block')) {
|
|
@@ -51,7 +51,7 @@ export class SurrealShadcnCollapsible extends HTMLElement {
|
|
|
51
51
|
if (this._disabled) return;
|
|
52
52
|
this.open = !this.open;
|
|
53
53
|
this.dispatchEvent(
|
|
54
|
-
new CustomEvent('openchange', { detail: { open: this.open }, bubbles: true })
|
|
54
|
+
new CustomEvent('openchange', { detail: { open: this.open }, bubbles: true })
|
|
55
55
|
);
|
|
56
56
|
}
|
|
57
57
|
|
|
@@ -73,7 +73,7 @@ export class SurrealShadcnCollapsible extends HTMLElement {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
const triggers = this.querySelectorAll(
|
|
76
|
-
'surreal-collapsible-trigger, [data-slot="collapsible-trigger"]'
|
|
76
|
+
'surreal-collapsible-trigger, [data-slot="collapsible-trigger"]'
|
|
77
77
|
);
|
|
78
78
|
triggers.forEach((trigger) => {
|
|
79
79
|
trigger.setAttribute('data-state', state);
|
|
@@ -83,7 +83,7 @@ export class SurrealShadcnCollapsible extends HTMLElement {
|
|
|
83
83
|
});
|
|
84
84
|
|
|
85
85
|
const contents = this.querySelectorAll(
|
|
86
|
-
'surreal-collapsible-content, [data-slot="collapsible-content"]'
|
|
86
|
+
'surreal-collapsible-content, [data-slot="collapsible-content"]'
|
|
87
87
|
);
|
|
88
88
|
contents.forEach((content) => {
|
|
89
89
|
content.setAttribute('data-state', state);
|
|
@@ -139,16 +139,21 @@ export class SurrealShadcnCollapsibleContent extends HTMLElement {
|
|
|
139
139
|
|
|
140
140
|
if (typeof customElements !== 'undefined') {
|
|
141
141
|
if (!customElements.get('surreal-collapsible'))
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
142
|
+
if (
|
|
143
|
+
typeof customElements !== 'undefined' &&
|
|
144
|
+
!customElements.get('surreal-shadcn-collapsible')
|
|
145
|
+
) {
|
|
146
|
+
customElements.define('surreal-shadcn-collapsible', SurrealShadcnCollapsible);
|
|
147
|
+
}
|
|
146
148
|
if (!customElements.get('surreal-collapsible-trigger'))
|
|
147
149
|
customElements.define('surreal-shadcn-collapsible', SurrealShadcnCollapsibleTrigger);
|
|
148
150
|
if (!customElements.get('surreal-collapsible-content'))
|
|
149
151
|
customElements.define('surreal-shadcn-collapsible', SurrealShadcnCollapsibleContent);
|
|
150
152
|
}
|
|
151
|
-
if (
|
|
153
|
+
if (
|
|
154
|
+
typeof customElements !== 'undefined' &&
|
|
155
|
+
!customElements.get('surreal-minimalist-collapsible')
|
|
156
|
+
) {
|
|
152
157
|
customElements.define('surreal-minimalist-collapsible', SurrealShadcnCollapsible);
|
|
153
158
|
}
|
|
154
159
|
|
|
@@ -18,7 +18,7 @@ export class SurrealShadcnCommand extends HTMLElement {
|
|
|
18
18
|
'overflow-hidden',
|
|
19
19
|
'border',
|
|
20
20
|
'border-border',
|
|
21
|
-
'shadow-md'
|
|
21
|
+
'shadow-md'
|
|
22
22
|
);
|
|
23
23
|
this.setAttribute('data-slot', 'command');
|
|
24
24
|
|
|
@@ -37,7 +37,7 @@ export class SurrealShadcnCommand extends HTMLElement {
|
|
|
37
37
|
private filterItems(query: string) {
|
|
38
38
|
const items = Array.from(this.querySelectorAll('[data-slot="command-item"]')) as HTMLElement[];
|
|
39
39
|
const groups = Array.from(
|
|
40
|
-
this.querySelectorAll('[data-slot="command-group"]')
|
|
40
|
+
this.querySelectorAll('[data-slot="command-group"]')
|
|
41
41
|
) as HTMLElement[];
|
|
42
42
|
const empty = this.querySelector('[data-slot="command-empty"]') as HTMLElement | null;
|
|
43
43
|
|
|
@@ -52,7 +52,7 @@ export class SurrealShadcnCommand extends HTMLElement {
|
|
|
52
52
|
|
|
53
53
|
groups.forEach((group) => {
|
|
54
54
|
const groupItems = Array.from(
|
|
55
|
-
group.querySelectorAll('[data-slot="command-item"]')
|
|
55
|
+
group.querySelectorAll('[data-slot="command-item"]')
|
|
56
56
|
) as HTMLElement[];
|
|
57
57
|
const hasVisible = groupItems.some((i) => i.style.display !== 'none');
|
|
58
58
|
group.style.display = hasVisible ? 'block' : 'none';
|
|
@@ -65,7 +65,7 @@ export class SurrealShadcnCommand extends HTMLElement {
|
|
|
65
65
|
|
|
66
66
|
private handleKeydown(e: KeyboardEvent) {
|
|
67
67
|
const items = Array.from(
|
|
68
|
-
this.querySelectorAll('[data-slot="command-item"]:not([data-disabled="true"])')
|
|
68
|
+
this.querySelectorAll('[data-slot="command-item"]:not([data-disabled="true"])')
|
|
69
69
|
) as HTMLElement[];
|
|
70
70
|
const visibleItems = items.filter((i) => i.style.display !== 'none');
|
|
71
71
|
|
|
@@ -100,10 +100,9 @@ export class SurrealShadcnCommand extends HTMLElement {
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
if (!customElements.get('surreal-command')) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
103
|
+
if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn-command')) {
|
|
104
|
+
customElements.define('surreal-shadcn-command', SurrealShadcnCommand);
|
|
105
|
+
}
|
|
107
106
|
}
|
|
108
107
|
if (typeof customElements !== 'undefined' && !customElements.get('surreal-minimalist-command')) {
|
|
109
108
|
customElements.define('surreal-minimalist-command', SurrealShadcnCommand);
|
|
@@ -85,14 +85,16 @@ class SurrealShadcnContextMenu extends HTMLElement {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
if (typeof customElements !== 'undefined' && !customElements.get('surreal-context-menu')) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn-context-menu')) {
|
|
89
|
+
customElements.define('surreal-shadcn-context-menu', SurrealShadcnContextMenu);
|
|
90
|
+
}
|
|
91
91
|
}
|
|
92
|
-
};
|
|
93
92
|
export { SurrealShadcnContextMenu as MinimalistContextMenu, SurrealShadcnContextMenu };
|
|
94
93
|
|
|
95
|
-
if (
|
|
94
|
+
if (
|
|
95
|
+
typeof customElements !== 'undefined' &&
|
|
96
|
+
!customElements.get('surreal-minimalist-context-menu')
|
|
97
|
+
) {
|
|
96
98
|
customElements.define('surreal-minimalist-context-menu', SurrealShadcnContextMenu);
|
|
97
99
|
}
|
|
98
100
|
|
|
@@ -90,13 +90,12 @@ class SurrealShadcnDialog extends HTMLElement {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
if (!customElements.get('surreal-dialog')) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
93
|
+
if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn-dialog')) {
|
|
94
|
+
customElements.define('surreal-shadcn-dialog', SurrealShadcnDialog);
|
|
95
|
+
}
|
|
97
96
|
}
|
|
98
97
|
|
|
99
|
-
export default SurrealShadcnDialog
|
|
98
|
+
export default SurrealShadcnDialog;
|
|
100
99
|
export { SurrealShadcnDialog as MinimalistDialog, SurrealShadcnDialog };
|
|
101
100
|
|
|
102
101
|
if (typeof customElements !== 'undefined' && !customElements.get('surreal-minimalist-dialog')) {
|
|
@@ -125,7 +125,7 @@ class SurrealShadcnDrawer extends HTMLElement {
|
|
|
125
125
|
'w-3/4',
|
|
126
126
|
'max-w-sm',
|
|
127
127
|
'rounded-l-xl',
|
|
128
|
-
'border-l'
|
|
128
|
+
'border-l'
|
|
129
129
|
);
|
|
130
130
|
|
|
131
131
|
if (this._direction === 'bottom') {
|
|
@@ -135,7 +135,7 @@ class SurrealShadcnDrawer extends HTMLElement {
|
|
|
135
135
|
'mt-24',
|
|
136
136
|
'max-h-[80vh]',
|
|
137
137
|
'rounded-t-xl',
|
|
138
|
-
'border-t'
|
|
138
|
+
'border-t'
|
|
139
139
|
);
|
|
140
140
|
} else if (this._direction === 'top') {
|
|
141
141
|
this.contentEl.classList.add(
|
|
@@ -144,7 +144,7 @@ class SurrealShadcnDrawer extends HTMLElement {
|
|
|
144
144
|
'mb-24',
|
|
145
145
|
'max-h-[80vh]',
|
|
146
146
|
'rounded-b-xl',
|
|
147
|
-
'border-b'
|
|
147
|
+
'border-b'
|
|
148
148
|
);
|
|
149
149
|
} else if (this._direction === 'left') {
|
|
150
150
|
this.contentEl.classList.add(
|
|
@@ -153,7 +153,7 @@ class SurrealShadcnDrawer extends HTMLElement {
|
|
|
153
153
|
'w-3/4',
|
|
154
154
|
'max-w-sm',
|
|
155
155
|
'rounded-r-xl',
|
|
156
|
-
'border-r'
|
|
156
|
+
'border-r'
|
|
157
157
|
);
|
|
158
158
|
} else if (this._direction === 'right') {
|
|
159
159
|
this.contentEl.classList.add(
|
|
@@ -162,7 +162,7 @@ class SurrealShadcnDrawer extends HTMLElement {
|
|
|
162
162
|
'w-3/4',
|
|
163
163
|
'max-w-sm',
|
|
164
164
|
'rounded-l-xl',
|
|
165
|
-
'border-l'
|
|
165
|
+
'border-l'
|
|
166
166
|
);
|
|
167
167
|
}
|
|
168
168
|
}
|
|
@@ -209,11 +209,10 @@ class SurrealShadcnDrawer extends HTMLElement {
|
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
if (!customElements.get('surreal-drawer')) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
212
|
+
if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn-drawer')) {
|
|
213
|
+
customElements.define('surreal-shadcn-drawer', SurrealShadcnDrawer);
|
|
214
|
+
}
|
|
215
215
|
}
|
|
216
|
-
};
|
|
217
216
|
export { SurrealShadcnDrawer as MinimalistDrawer, SurrealShadcnDrawer };
|
|
218
217
|
|
|
219
218
|
if (typeof customElements !== 'undefined' && !customElements.get('surreal-minimalist-drawer')) {
|
|
@@ -84,7 +84,7 @@ export class SurrealShadcnDropdownMenu extends HTMLElement {
|
|
|
84
84
|
e.stopPropagation();
|
|
85
85
|
this.open = !this.open;
|
|
86
86
|
this.dispatchEvent(
|
|
87
|
-
new CustomEvent('open-change', { detail: { open: this.open }, bubbles: true })
|
|
87
|
+
new CustomEvent('open-change', { detail: { open: this.open }, bubbles: true })
|
|
88
88
|
);
|
|
89
89
|
});
|
|
90
90
|
}
|
|
@@ -93,7 +93,7 @@ export class SurrealShadcnDropdownMenu extends HTMLElement {
|
|
|
93
93
|
if (!this.contains(e.target as Node) && this.open) {
|
|
94
94
|
this.open = false;
|
|
95
95
|
this.dispatchEvent(
|
|
96
|
-
new CustomEvent('open-change', { detail: { open: false }, bubbles: true })
|
|
96
|
+
new CustomEvent('open-change', { detail: { open: false }, bubbles: true })
|
|
97
97
|
);
|
|
98
98
|
}
|
|
99
99
|
});
|
|
@@ -108,12 +108,17 @@ export class SurrealShadcnDropdownMenu extends HTMLElement {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
if (!customElements.get('surreal-dropdown-menu')) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
111
|
+
if (
|
|
112
|
+
typeof customElements !== 'undefined' &&
|
|
113
|
+
!customElements.get('surreal-shadcn-dropdown-menu')
|
|
114
|
+
) {
|
|
115
|
+
customElements.define('surreal-shadcn-dropdown-menu', SurrealShadcnDropdownMenu);
|
|
116
|
+
}
|
|
115
117
|
}
|
|
116
|
-
if (
|
|
118
|
+
if (
|
|
119
|
+
typeof customElements !== 'undefined' &&
|
|
120
|
+
!customElements.get('surreal-minimalist-dropdown-menu')
|
|
121
|
+
) {
|
|
117
122
|
customElements.define('surreal-minimalist-dropdown-menu', SurrealShadcnDropdownMenu);
|
|
118
123
|
}
|
|
119
124
|
|
|
@@ -6,13 +6,13 @@ const emptyMediaVariants = cva(
|
|
|
6
6
|
variants: {
|
|
7
7
|
variant: {
|
|
8
8
|
default: 'bg-transparent',
|
|
9
|
-
icon: "flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4"
|
|
10
|
-
}
|
|
9
|
+
icon: "flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4"
|
|
10
|
+
}
|
|
11
11
|
},
|
|
12
12
|
defaultVariants: {
|
|
13
|
-
variant: 'default'
|
|
14
|
-
}
|
|
15
|
-
}
|
|
13
|
+
variant: 'default'
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
16
|
);
|
|
17
17
|
|
|
18
18
|
export class UiEmpty extends HTMLElement {
|
|
@@ -20,7 +20,7 @@ export class UiEmpty extends HTMLElement {
|
|
|
20
20
|
this.setAttribute('data-slot', 'empty');
|
|
21
21
|
this.className = cn(
|
|
22
22
|
'gap-4 rounded-xl border border-dashed p-6 flex w-full min-w-0 flex-1 flex-col items-center justify-center text-center text-balance',
|
|
23
|
-
this.className
|
|
23
|
+
this.className
|
|
24
24
|
);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -65,7 +65,7 @@ export class UiEmptyDescription extends HTMLElement {
|
|
|
65
65
|
this.setAttribute('data-slot', 'empty-description');
|
|
66
66
|
this.className = cn(
|
|
67
67
|
'text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary',
|
|
68
|
-
this.className
|
|
68
|
+
this.className
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -75,16 +75,15 @@ export class UiEmptyContent extends HTMLElement {
|
|
|
75
75
|
this.setAttribute('data-slot', 'empty-content');
|
|
76
76
|
this.className = cn(
|
|
77
77
|
'gap-2.5 text-sm flex w-full max-w-sm min-w-0 flex-col items-center text-balance',
|
|
78
|
-
this.className
|
|
78
|
+
this.className
|
|
79
79
|
);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
if (!customElements.get('ui-empty')) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
84
|
+
if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn-empty')) {
|
|
85
|
+
customElements.define('surreal-shadcn-empty', UiEmpty);
|
|
86
|
+
}
|
|
88
87
|
customElements.define('surreal-shadcn-empty', UiEmptyHeader);
|
|
89
88
|
customElements.define('surreal-shadcn-empty', UiEmptyMedia);
|
|
90
89
|
customElements.define('surreal-shadcn-empty', UiEmptyTitle);
|
|
@@ -30,9 +30,12 @@ class SurrealMinimalistEmptyState extends HTMLElement {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
if (
|
|
33
|
+
if (
|
|
34
|
+
typeof customElements !== 'undefined' &&
|
|
35
|
+
!customElements.get('surreal-minimalist-empty-state')
|
|
36
|
+
) {
|
|
34
37
|
customElements.define('surreal-minimalist-empty-state', SurrealMinimalistEmptyState);
|
|
35
|
-
}
|
|
38
|
+
}
|
|
36
39
|
export { SurrealMinimalistEmptyState as MinimalistEmptyState, SurrealMinimalistEmptyState };
|
|
37
40
|
|
|
38
41
|
export default SurrealMinimalistEmptyState;
|
|
@@ -7,12 +7,12 @@ const fieldVariants = cva('gap-2 data-[invalid=true]:text-destructive group/fiel
|
|
|
7
7
|
horizontal:
|
|
8
8
|
'cn-field-orientation-horizontal flex-row items-center has-[>[data-slot=field-content]]:items-start [&>[data-slot=field-label]]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',
|
|
9
9
|
responsive:
|
|
10
|
-
'cn-field-orientation-responsive flex-col @md/field-group:flex-row @md/field-group:items-center @md/field-group:has-[>[data-slot=field-content]]:items-start [&>*]:w-full @md/field-group:[&>*]:w-auto [&>.sr-only]:w-auto @md/field-group:[&>[data-slot=field-label]]:flex-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px'
|
|
11
|
-
}
|
|
10
|
+
'cn-field-orientation-responsive flex-col @md/field-group:flex-row @md/field-group:items-center @md/field-group:has-[>[data-slot=field-content]]:items-start [&>*]:w-full @md/field-group:[&>*]:w-auto [&>.sr-only]:w-auto @md/field-group:[&>[data-slot=field-label]]:flex-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px'
|
|
11
|
+
}
|
|
12
12
|
},
|
|
13
13
|
defaultVariants: {
|
|
14
|
-
orientation: 'vertical'
|
|
15
|
-
}
|
|
14
|
+
orientation: 'vertical'
|
|
15
|
+
}
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
export class UIField extends HTMLElement {
|
|
@@ -41,28 +41,29 @@ export class UIField extends HTMLElement {
|
|
|
41
41
|
this.className = cn(fieldVariants({ orientation }), userClass);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
if (!customElements.get('ui-field'))
|
|
45
|
-
if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn-field')) {
|
|
46
|
-
|
|
47
|
-
}
|
|
44
|
+
if (!customElements.get('ui-field'))
|
|
45
|
+
if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn-field')) {
|
|
46
|
+
customElements.define('surreal-shadcn-field', UIField);
|
|
47
|
+
}
|
|
48
48
|
|
|
49
49
|
export class UIFieldGroup extends HTMLElement {
|
|
50
50
|
connectedCallback() {
|
|
51
51
|
this.setAttribute('data-slot', 'field-group');
|
|
52
52
|
this.className = cn(
|
|
53
53
|
'gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4 group/field-group @container/field-group flex w-full flex-col',
|
|
54
|
-
this.getAttribute('class') || ''
|
|
54
|
+
this.getAttribute('class') || ''
|
|
55
55
|
);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
if (!customElements.get('ui-field-group'))
|
|
58
|
+
if (!customElements.get('ui-field-group'))
|
|
59
|
+
customElements.define('surreal-shadcn-field', UIFieldGroup);
|
|
59
60
|
|
|
60
61
|
export class UIFieldSet extends HTMLElement {
|
|
61
62
|
connectedCallback() {
|
|
62
63
|
this.setAttribute('data-slot', 'field-set');
|
|
63
64
|
this.className = cn(
|
|
64
65
|
'gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3 flex flex-col border-0 p-0 m-0',
|
|
65
|
-
this.getAttribute('class') || ''
|
|
66
|
+
this.getAttribute('class') || ''
|
|
66
67
|
);
|
|
67
68
|
}
|
|
68
69
|
}
|
|
@@ -73,7 +74,7 @@ export class UIFieldContent extends HTMLElement {
|
|
|
73
74
|
this.setAttribute('data-slot', 'field-content');
|
|
74
75
|
this.className = cn(
|
|
75
76
|
'gap-0.5 group/field-content flex flex-1 flex-col leading-snug',
|
|
76
|
-
this.getAttribute('class') || ''
|
|
77
|
+
this.getAttribute('class') || ''
|
|
77
78
|
);
|
|
78
79
|
}
|
|
79
80
|
}
|
|
@@ -85,11 +86,12 @@ export class UIFieldLabel extends HTMLElement {
|
|
|
85
86
|
this.setAttribute('data-slot', 'field-label');
|
|
86
87
|
this.className = cn(
|
|
87
88
|
'gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10 group/field-label peer/field-label flex w-fit cursor-pointer text-sm font-medium text-foreground has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col',
|
|
88
|
-
this.getAttribute('class') || ''
|
|
89
|
+
this.getAttribute('class') || ''
|
|
89
90
|
);
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
|
-
if (!customElements.get('ui-field-label'))
|
|
93
|
+
if (!customElements.get('ui-field-label'))
|
|
94
|
+
customElements.define('surreal-shadcn-field', UIFieldLabel);
|
|
93
95
|
|
|
94
96
|
export class UIFieldLegend extends HTMLElement {
|
|
95
97
|
static get observedAttributes() {
|
|
@@ -107,29 +109,31 @@ export class UIFieldLegend extends HTMLElement {
|
|
|
107
109
|
this.setAttribute('data-variant', variant);
|
|
108
110
|
this.className = cn(
|
|
109
111
|
'mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base text-foreground block',
|
|
110
|
-
this.getAttribute('class') || ''
|
|
112
|
+
this.getAttribute('class') || ''
|
|
111
113
|
);
|
|
112
114
|
}
|
|
113
115
|
}
|
|
114
|
-
if (!customElements.get('ui-field-legend'))
|
|
116
|
+
if (!customElements.get('ui-field-legend'))
|
|
117
|
+
customElements.define('surreal-shadcn-field', UIFieldLegend);
|
|
115
118
|
|
|
116
119
|
export class UIFieldTitle extends HTMLElement {
|
|
117
120
|
connectedCallback() {
|
|
118
121
|
this.setAttribute('data-slot', 'field-label');
|
|
119
122
|
this.className = cn(
|
|
120
123
|
'gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50 flex w-fit items-center text-foreground',
|
|
121
|
-
this.getAttribute('class') || ''
|
|
124
|
+
this.getAttribute('class') || ''
|
|
122
125
|
);
|
|
123
126
|
}
|
|
124
127
|
}
|
|
125
|
-
if (!customElements.get('ui-field-title'))
|
|
128
|
+
if (!customElements.get('ui-field-title'))
|
|
129
|
+
customElements.define('surreal-shadcn-field', UIFieldTitle);
|
|
126
130
|
|
|
127
131
|
export class UIFieldDescription extends HTMLElement {
|
|
128
132
|
connectedCallback() {
|
|
129
133
|
this.setAttribute('data-slot', 'field-description');
|
|
130
134
|
this.className = cn(
|
|
131
135
|
'text-left text-sm text-muted-foreground [[data-variant=legend]+&]:-mt-1.5 leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance last:mt-0 nth-last-2:-mt-1 [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary block',
|
|
132
|
-
this.getAttribute('class') || ''
|
|
136
|
+
this.getAttribute('class') || ''
|
|
133
137
|
);
|
|
134
138
|
}
|
|
135
139
|
}
|
|
@@ -142,11 +146,12 @@ export class UIFieldError extends HTMLElement {
|
|
|
142
146
|
this.setAttribute('data-slot', 'field-error');
|
|
143
147
|
this.className = cn(
|
|
144
148
|
'text-sm text-destructive font-normal block',
|
|
145
|
-
this.getAttribute('class') || ''
|
|
149
|
+
this.getAttribute('class') || ''
|
|
146
150
|
);
|
|
147
151
|
}
|
|
148
152
|
}
|
|
149
|
-
if (!customElements.get('ui-field-error'))
|
|
153
|
+
if (!customElements.get('ui-field-error'))
|
|
154
|
+
customElements.define('surreal-shadcn-field', UIFieldError);
|
|
150
155
|
|
|
151
156
|
export class UIFieldSeparator extends HTMLElement {
|
|
152
157
|
connectedCallback() {
|
|
@@ -154,7 +159,7 @@ export class UIFieldSeparator extends HTMLElement {
|
|
|
154
159
|
const content = this.innerHTML.trim();
|
|
155
160
|
this.className = cn(
|
|
156
161
|
'-my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2 relative flex items-center justify-center',
|
|
157
|
-
this.getAttribute('class') || ''
|
|
162
|
+
this.getAttribute('class') || ''
|
|
158
163
|
);
|
|
159
164
|
this.innerHTML = `
|
|
160
165
|
<div class="absolute inset-0 top-1/2 -translate-y-1/2 border-t border-border w-full"></div>
|
|
@@ -19,7 +19,7 @@ export class FormLabelElement extends HTMLElement {
|
|
|
19
19
|
this.className = cn(
|
|
20
20
|
'block text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70',
|
|
21
21
|
isError && 'text-destructive',
|
|
22
|
-
this.className
|
|
22
|
+
this.className
|
|
23
23
|
);
|
|
24
24
|
this.setAttribute('data-slot', 'form-label');
|
|
25
25
|
}
|
|
@@ -51,7 +51,7 @@ export class FormLegendElement extends HTMLElement {
|
|
|
51
51
|
this.className = cn(
|
|
52
52
|
'block text-sm leading-none font-medium',
|
|
53
53
|
isError && 'text-destructive',
|
|
54
|
-
this.className
|
|
54
|
+
this.className
|
|
55
55
|
);
|
|
56
56
|
this.setAttribute('data-slot', 'form-legend');
|
|
57
57
|
}
|
|
@@ -70,17 +70,18 @@ export class FormButtonElement extends HTMLElement {
|
|
|
70
70
|
variant === 'secondary' && 'bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
|
71
71
|
variant === 'ghost' && 'hover:bg-accent hover:text-accent-foreground',
|
|
72
72
|
variant === 'link' && 'text-primary underline-offset-4 hover:underline',
|
|
73
|
-
this.className
|
|
73
|
+
this.className
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
if (typeof customElements !== 'undefined') {
|
|
79
|
-
if (!customElements.get('ui-form'))
|
|
80
|
-
if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn-form')) {
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
if (!customElements.get('ui-form-item'))
|
|
79
|
+
if (!customElements.get('ui-form'))
|
|
80
|
+
if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn-form')) {
|
|
81
|
+
customElements.define('surreal-shadcn-form', FormElement);
|
|
82
|
+
}
|
|
83
|
+
if (!customElements.get('ui-form-item'))
|
|
84
|
+
customElements.define('surreal-shadcn-form', FormItemElement);
|
|
84
85
|
if (!customElements.get('ui-form-label'))
|
|
85
86
|
customElements.define('surreal-shadcn-form', FormLabelElement);
|
|
86
87
|
if (!customElements.get('ui-form-description'))
|
|
@@ -136,10 +136,9 @@ class SurrealShadcnHoverCard extends HTMLElement {
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
if (!customElements.get('surreal-hover-card')) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
139
|
+
if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn-hover-card')) {
|
|
140
|
+
customElements.define('surreal-shadcn-hover-card', SurrealShadcnHoverCard);
|
|
141
|
+
}
|
|
143
142
|
}
|
|
144
143
|
|
|
145
144
|
export { SurrealShadcnHoverCard };
|