@surreal-ui/web 0.5.1 → 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 +13 -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
|
@@ -8,13 +8,13 @@ const buttonGroupVariants = cva(
|
|
|
8
8
|
horizontal:
|
|
9
9
|
'[&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg! [&>[data-slot]]:rounded-r-none [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0',
|
|
10
10
|
vertical:
|
|
11
|
-
'[&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg! flex-col [&>[data-slot]]:rounded-b-none [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0'
|
|
12
|
-
}
|
|
11
|
+
'[&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg! flex-col [&>[data-slot]]:rounded-b-none [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0'
|
|
12
|
+
}
|
|
13
13
|
},
|
|
14
14
|
defaultVariants: {
|
|
15
|
-
orientation: 'horizontal'
|
|
16
|
-
}
|
|
17
|
-
}
|
|
15
|
+
orientation: 'horizontal'
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
18
|
);
|
|
19
19
|
|
|
20
20
|
export class ButtonGroupElement extends HTMLElement {
|
|
@@ -63,7 +63,7 @@ export class ButtonGroupSeparatorElement extends HTMLElement {
|
|
|
63
63
|
const customClass = this.getAttribute('class') || '';
|
|
64
64
|
this.className = cn(
|
|
65
65
|
'bg-input relative self-stretch data-[orientation=horizontal]:mx-px data-[orientation=horizontal]:w-auto data-[orientation=vertical]:my-px data-[orientation=vertical]:h-auto',
|
|
66
|
-
customClass
|
|
66
|
+
customClass
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -86,16 +86,15 @@ export class ButtonGroupTextElement extends HTMLElement {
|
|
|
86
86
|
const customClass = this.getAttribute('class') || '';
|
|
87
87
|
this.className = cn(
|
|
88
88
|
"gap-2 rounded-lg border bg-muted px-2.5 text-sm font-medium [&_svg:not([class*='size-'])]:size-4 flex items-center [&_svg]:pointer-events-none",
|
|
89
|
-
customClass
|
|
89
|
+
customClass
|
|
90
90
|
);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
if (!customElements.get('surreal-button-group')) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
95
|
+
if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn-button-group')) {
|
|
96
|
+
customElements.define('surreal-shadcn-button-group', ButtonGroupElement);
|
|
97
|
+
}
|
|
99
98
|
}
|
|
100
99
|
if (!customElements.get('surreal-button-group-separator')) {
|
|
101
100
|
customElements.define('surreal-shadcn-button-group', ButtonGroupSeparatorElement);
|
|
@@ -55,7 +55,7 @@ export class SurrealShadcnCalendar extends HTMLElement {
|
|
|
55
55
|
this._currentMonth = new Date(
|
|
56
56
|
this._currentMonth.getFullYear(),
|
|
57
57
|
this._currentMonth.getMonth() - 1,
|
|
58
|
-
1
|
|
58
|
+
1
|
|
59
59
|
);
|
|
60
60
|
this.render();
|
|
61
61
|
};
|
|
@@ -64,7 +64,7 @@ export class SurrealShadcnCalendar extends HTMLElement {
|
|
|
64
64
|
this._currentMonth = new Date(
|
|
65
65
|
this._currentMonth.getFullYear(),
|
|
66
66
|
this._currentMonth.getMonth() + 1,
|
|
67
|
-
1
|
|
67
|
+
1
|
|
68
68
|
);
|
|
69
69
|
this.render();
|
|
70
70
|
};
|
|
@@ -73,7 +73,7 @@ export class SurrealShadcnCalendar extends HTMLElement {
|
|
|
73
73
|
this._value = date;
|
|
74
74
|
this.setAttribute('value', date.toISOString());
|
|
75
75
|
this.dispatchEvent(
|
|
76
|
-
new CustomEvent('change', { detail: { value: date }, bubbles: true, composed: true })
|
|
76
|
+
new CustomEvent('change', { detail: { value: date }, bubbles: true, composed: true })
|
|
77
77
|
);
|
|
78
78
|
this.render();
|
|
79
79
|
}
|
|
@@ -93,20 +93,20 @@ export class SurrealShadcnCalendar extends HTMLElement {
|
|
|
93
93
|
'September',
|
|
94
94
|
'October',
|
|
95
95
|
'November',
|
|
96
|
-
'December'
|
|
96
|
+
'December'
|
|
97
97
|
];
|
|
98
98
|
const monthStr = new Intl.DateTimeFormat(this._locale, { month: 'long' }).format(
|
|
99
|
-
this._currentMonth
|
|
99
|
+
this._currentMonth
|
|
100
100
|
);
|
|
101
101
|
const yearStr = new Intl.DateTimeFormat(this._locale, { year: 'numeric' }).format(
|
|
102
|
-
this._currentMonth
|
|
102
|
+
this._currentMonth
|
|
103
103
|
);
|
|
104
104
|
|
|
105
105
|
const weekdays = [];
|
|
106
106
|
const temp = new Date(2023, 0, 1);
|
|
107
107
|
for (let i = 0; i < 7; i++) {
|
|
108
108
|
weekdays.push(
|
|
109
|
-
new Intl.DateTimeFormat(this._locale, { weekday: 'short' }).format(temp).slice(0, 2)
|
|
109
|
+
new Intl.DateTimeFormat(this._locale, { weekday: 'short' }).format(temp).slice(0, 2)
|
|
110
110
|
);
|
|
111
111
|
temp.setDate(temp.getDate() + 1);
|
|
112
112
|
}
|
|
@@ -138,7 +138,7 @@ export class SurrealShadcnCalendar extends HTMLElement {
|
|
|
138
138
|
!!this._value &&
|
|
139
139
|
d.getFullYear() === this._value.getFullYear() &&
|
|
140
140
|
d.getMonth() === this._value.getMonth() &&
|
|
141
|
-
d.getDate() === this._value.getDate()
|
|
141
|
+
d.getDate() === this._value.getDate()
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
144
|
|
|
@@ -153,7 +153,7 @@ export class SurrealShadcnCalendar extends HTMLElement {
|
|
|
153
153
|
!!this._value &&
|
|
154
154
|
d.getFullYear() === this._value.getFullYear() &&
|
|
155
155
|
d.getMonth() === this._value.getMonth() &&
|
|
156
|
-
d.getDate() === this._value.getDate()
|
|
156
|
+
d.getDate() === this._value.getDate()
|
|
157
157
|
});
|
|
158
158
|
}
|
|
159
159
|
|
|
@@ -169,7 +169,7 @@ export class SurrealShadcnCalendar extends HTMLElement {
|
|
|
169
169
|
!!this._value &&
|
|
170
170
|
d.getFullYear() === this._value.getFullYear() &&
|
|
171
171
|
d.getMonth() === this._value.getMonth() &&
|
|
172
|
-
d.getDate() === this._value.getDate()
|
|
172
|
+
d.getDate() === this._value.getDate()
|
|
173
173
|
});
|
|
174
174
|
nextD++;
|
|
175
175
|
}
|
|
@@ -195,7 +195,7 @@ export class SurrealShadcnCalendar extends HTMLElement {
|
|
|
195
195
|
${Array.from({ length: 21 }, (_, i) => year - 10 + i)
|
|
196
196
|
.map(
|
|
197
197
|
(y) =>
|
|
198
|
-
`<option value="${y}" ${y === year ? 'selected' : ''}>${y}</option
|
|
198
|
+
`<option value="${y}" ${y === year ? 'selected' : ''}>${y}</option>`
|
|
199
199
|
)
|
|
200
200
|
.join('')}
|
|
201
201
|
</select>
|
|
@@ -270,9 +270,8 @@ export class SurrealShadcnCalendar extends HTMLElement {
|
|
|
270
270
|
}
|
|
271
271
|
|
|
272
272
|
if (!customElements.get('surreal-calendar')) {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
273
|
+
if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn-calendar')) {
|
|
274
|
+
customElements.define('surreal-shadcn-calendar', SurrealShadcnCalendar);
|
|
275
|
+
}
|
|
277
276
|
}
|
|
278
277
|
export default SurrealShadcnCalendar;
|
|
@@ -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 ShadcnCarousel, SurrealShadcnCarousel };
|
|
117
116
|
|
|
118
117
|
export default SurrealShadcnCarousel;
|
|
@@ -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 ShadcnChart, SurrealShadcnChartContainer };
|
|
146
145
|
|
|
147
146
|
export default SurrealShadcnChartContainer;
|
|
@@ -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 ShadcnCodeBlock, SurrealShadcnCodeBlock };
|
|
108
107
|
|
|
109
108
|
export default SurrealShadcnCodeBlock;
|
|
@@ -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,10 +139,12 @@ 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'))
|
|
@@ -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,9 +100,8 @@ 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
|
export default SurrealShadcnCommand;
|
|
@@ -85,11 +85,10 @@ 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 ShadcnContextMenu, SurrealShadcnContextMenu };
|
|
94
93
|
|
|
95
94
|
export default SurrealShadcnContextMenu;
|
|
@@ -90,11 +90,10 @@ 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 ShadcnDialog, SurrealShadcnDialog };
|
|
@@ -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 ShadcnDrawer, SurrealShadcnDrawer };
|
|
218
217
|
|
|
219
218
|
export default SurrealShadcnDrawer;
|
|
@@ -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,9 +108,11 @@ 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
118
|
export default SurrealShadcnDropdownMenu;
|
|
@@ -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);
|