@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
|
@@ -35,7 +35,7 @@ export class SurrealShadcnInput extends HTMLElement {
|
|
|
35
35
|
const target = e.target as HTMLInputElement;
|
|
36
36
|
this.setAttribute('value', target.value);
|
|
37
37
|
this.dispatchEvent(
|
|
38
|
-
new CustomEvent('input', { detail: { value: target.value }, bubbles: true, composed: true })
|
|
38
|
+
new CustomEvent('input', { detail: { value: target.value }, bubbles: true, composed: true })
|
|
39
39
|
);
|
|
40
40
|
};
|
|
41
41
|
|
|
@@ -45,8 +45,8 @@ export class SurrealShadcnInput extends HTMLElement {
|
|
|
45
45
|
new CustomEvent('change', {
|
|
46
46
|
detail: { value: target.value, files: target.files },
|
|
47
47
|
bubbles: true,
|
|
48
|
-
composed: true
|
|
49
|
-
})
|
|
48
|
+
composed: true
|
|
49
|
+
})
|
|
50
50
|
);
|
|
51
51
|
};
|
|
52
52
|
|
|
@@ -87,16 +87,15 @@ export class SurrealShadcnInput extends HTMLElement {
|
|
|
87
87
|
this.inputElement.setAttribute('data-slot', 'input');
|
|
88
88
|
this.inputElement.className = cn(
|
|
89
89
|
'h-8 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors file:h-6 file:text-sm file:font-medium focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:bg-input/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',
|
|
90
|
-
className
|
|
90
|
+
className
|
|
91
91
|
);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
if (!customElements.get('surreal-input')) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
96
|
+
if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn-input')) {
|
|
97
|
+
customElements.define('surreal-shadcn-input', SurrealShadcnInput);
|
|
98
|
+
}
|
|
100
99
|
}
|
|
101
100
|
if (typeof customElements !== 'undefined' && !customElements.get('surreal-minimalist-input')) {
|
|
102
101
|
customElements.define('surreal-minimalist-input', SurrealShadcnInput);
|
|
@@ -21,7 +21,7 @@ class InputGroupAddonElement extends HTMLElement {
|
|
|
21
21
|
'block-start':
|
|
22
22
|
'px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2 order-first w-full justify-start',
|
|
23
23
|
'block-end':
|
|
24
|
-
'px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2 order-last w-full justify-start'
|
|
24
|
+
'px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2 order-last w-full justify-start'
|
|
25
25
|
}[align] || 'pl-2 order-first';
|
|
26
26
|
|
|
27
27
|
this.className =
|
|
@@ -42,7 +42,7 @@ class InputGroupButtonElement extends HTMLElement {
|
|
|
42
42
|
xs: "h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
|
|
43
43
|
sm: 'h-7 gap-1.5 rounded-md px-2 text-xs',
|
|
44
44
|
'icon-xs': 'size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0',
|
|
45
|
-
'icon-sm': 'size-8 p-0 has-[>svg]:p-0'
|
|
45
|
+
'icon-sm': 'size-8 p-0 has-[>svg]:p-0'
|
|
46
46
|
}[size] || '';
|
|
47
47
|
|
|
48
48
|
this.setAttribute('data-size', size);
|
|
@@ -67,10 +67,9 @@ class InputGroupTextElement extends HTMLElement {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
if (!customElements.get('input-group')) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
70
|
+
if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn-input-group')) {
|
|
71
|
+
customElements.define('surreal-shadcn-input-group', InputGroupElement);
|
|
72
|
+
}
|
|
74
73
|
}
|
|
75
74
|
if (!customElements.get('input-group-addon')) {
|
|
76
75
|
customElements.define('surreal-shadcn-input-group', InputGroupAddonElement);
|
|
@@ -83,10 +82,13 @@ if (!customElements.get('input-group-input')) {
|
|
|
83
82
|
}
|
|
84
83
|
if (!customElements.get('input-group-text')) {
|
|
85
84
|
customElements.define('surreal-shadcn-input-group', InputGroupTextElement);
|
|
86
|
-
}
|
|
85
|
+
}
|
|
87
86
|
export { InputGroupElement as MinimalistInputGroup, InputGroupElement };
|
|
88
87
|
|
|
89
|
-
if (
|
|
88
|
+
if (
|
|
89
|
+
typeof customElements !== 'undefined' &&
|
|
90
|
+
!customElements.get('surreal-minimalist-input-group')
|
|
91
|
+
) {
|
|
90
92
|
customElements.define('surreal-minimalist-input-group', InputGroupElement);
|
|
91
93
|
}
|
|
92
94
|
|
|
@@ -57,11 +57,11 @@ class SurrealInputOTP extends HTMLElement {
|
|
|
57
57
|
input.addEventListener('input', () => {
|
|
58
58
|
this._value = input.value.slice(0, this._maxLength);
|
|
59
59
|
this.dispatchEvent(
|
|
60
|
-
new CustomEvent('change', { detail: { value: this._value }, bubbles: true })
|
|
60
|
+
new CustomEvent('change', { detail: { value: this._value }, bubbles: true })
|
|
61
61
|
);
|
|
62
62
|
if (this._value.length === this._maxLength) {
|
|
63
63
|
this.dispatchEvent(
|
|
64
|
-
new CustomEvent('complete', { detail: { value: this._value }, bubbles: true })
|
|
64
|
+
new CustomEvent('complete', { detail: { value: this._value }, bubbles: true })
|
|
65
65
|
);
|
|
66
66
|
}
|
|
67
67
|
this.syncSlots();
|
|
@@ -132,10 +132,9 @@ class SurrealInputOTPSeparator extends HTMLElement {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
if (!customElements.get('surreal-input-otp')) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
135
|
+
if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn-input-otp')) {
|
|
136
|
+
customElements.define('surreal-shadcn-input-otp', SurrealInputOTP);
|
|
137
|
+
}
|
|
139
138
|
}
|
|
140
139
|
if (!customElements.get('surreal-input-otp-group')) {
|
|
141
140
|
customElements.define('surreal-shadcn-input-otp', SurrealInputOTPGroup);
|
|
@@ -145,7 +144,7 @@ if (!customElements.get('surreal-input-otp-slot')) {
|
|
|
145
144
|
}
|
|
146
145
|
if (!customElements.get('surreal-input-otp-separator')) {
|
|
147
146
|
customElements.define('surreal-shadcn-input-otp', SurrealInputOTPSeparator);
|
|
148
|
-
}
|
|
147
|
+
}
|
|
149
148
|
export { SurrealInputOTP as MinimalistInputOtp, SurrealInputOTP };
|
|
150
149
|
|
|
151
150
|
if (typeof customElements !== 'undefined' && !customElements.get('surreal-minimalist-input-otp')) {
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
const itemVariantMap = {
|
|
2
2
|
default: 'border-transparent',
|
|
3
3
|
outline: 'border-border',
|
|
4
|
-
muted: 'border-transparent bg-muted/50'
|
|
4
|
+
muted: 'border-transparent bg-muted/50'
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
const itemSizeMap = {
|
|
8
8
|
default: 'gap-2.5 px-3 py-2.5',
|
|
9
9
|
sm: 'gap-2.5 px-3 py-2.5',
|
|
10
|
-
xs: 'gap-2 px-2.5 py-2 in-data-[slot=dropdown-menu-content]:p-0'
|
|
10
|
+
xs: 'gap-2 px-2.5 py-2 in-data-[slot=dropdown-menu-content]:p-0'
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
const itemMediaVariantMap = {
|
|
14
14
|
default: 'bg-transparent',
|
|
15
15
|
icon: "[&_svg:not([class*='size-'])]:size-4",
|
|
16
16
|
image:
|
|
17
|
-
'size-10 overflow-hidden rounded-sm group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 [&_img]:size-full [&_img]:object-cover'
|
|
17
|
+
'size-10 overflow-hidden rounded-sm group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 [&_img]:size-full [&_img]:object-cover'
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
class UIItem extends HTMLElement {
|
|
@@ -137,10 +137,9 @@ class UIItemSeparator extends HTMLElement {
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
if (!customElements.get('ui-item')) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
140
|
+
if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn-item')) {
|
|
141
|
+
customElements.define('surreal-shadcn-item', UIItem);
|
|
142
|
+
}
|
|
144
143
|
customElements.define('surreal-shadcn-item', UIItemGroup);
|
|
145
144
|
customElements.define('surreal-shadcn-item', UIItemHeader);
|
|
146
145
|
customElements.define('surreal-shadcn-item', UIItemFooter);
|
|
@@ -150,7 +149,7 @@ if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn
|
|
|
150
149
|
customElements.define('surreal-shadcn-item', UIItemActions);
|
|
151
150
|
customElements.define('surreal-shadcn-item', UIItemMedia);
|
|
152
151
|
customElements.define('surreal-shadcn-item', UIItemSeparator);
|
|
153
|
-
}
|
|
152
|
+
}
|
|
154
153
|
export { UIItem as MinimalistItem, UIItem };
|
|
155
154
|
|
|
156
155
|
if (typeof customElements !== 'undefined' && !customElements.get('surreal-minimalist-item')) {
|
|
@@ -9,7 +9,7 @@ export class SurrealShadcnKbd extends HTMLElement {
|
|
|
9
9
|
const className = this.getAttribute('class') || '';
|
|
10
10
|
this.className = cn(
|
|
11
11
|
"h-5 w-fit min-w-5 gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3 pointer-events-none inline-flex items-center justify-center select-none",
|
|
12
|
-
className
|
|
12
|
+
className
|
|
13
13
|
);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -23,10 +23,9 @@ export class SurrealShadcnKbdGroup extends HTMLElement {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
if (!customElements.get('surreal-kbd')) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
26
|
+
if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn-kbd')) {
|
|
27
|
+
customElements.define('surreal-shadcn-kbd', SurrealShadcnKbd);
|
|
28
|
+
}
|
|
30
29
|
}
|
|
31
30
|
if (!customElements.get('surreal-kbd-group')) {
|
|
32
31
|
customElements.define('surreal-shadcn-kbd', SurrealShadcnKbdGroup);
|
|
@@ -36,16 +36,15 @@ export class SurrealShadcnLabel extends HTMLElement {
|
|
|
36
36
|
const customClass = this.getAttribute('class') || '';
|
|
37
37
|
this.labelEl.className = cn(
|
|
38
38
|
'gap-2 text-sm leading-none font-medium group-data-[disabled=true]:opacity-50 peer-disabled:opacity-50 flex items-center select-none group-data-[disabled=true]:pointer-events-none peer-disabled:cursor-not-allowed',
|
|
39
|
-
customClass
|
|
39
|
+
customClass
|
|
40
40
|
);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
if (!customElements.get('surreal-label')) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
45
|
+
if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn-label')) {
|
|
46
|
+
customElements.define('surreal-shadcn-label', SurrealShadcnLabel);
|
|
47
|
+
}
|
|
49
48
|
}
|
|
50
49
|
if (typeof customElements !== 'undefined' && !customElements.get('surreal-minimalist-label')) {
|
|
51
50
|
customElements.define('surreal-minimalist-label', SurrealShadcnLabel);
|
|
@@ -33,7 +33,7 @@ class SurrealShadcnMenubar extends HTMLElement {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
const item = (e.target as HTMLElement).closest(
|
|
36
|
-
'[data-slot="menubar-item"], [data-slot="menubar-checkbox-item"], [data-slot="menubar-radio-item"]'
|
|
36
|
+
'[data-slot="menubar-item"], [data-slot="menubar-checkbox-item"], [data-slot="menubar-radio-item"]'
|
|
37
37
|
);
|
|
38
38
|
if (item) {
|
|
39
39
|
this.closeAll();
|
|
@@ -48,10 +48,10 @@ class SurrealShadcnMenubar extends HTMLElement {
|
|
|
48
48
|
|
|
49
49
|
private closeAll() {
|
|
50
50
|
this.querySelectorAll('[data-slot="menubar-content"]').forEach((el) =>
|
|
51
|
-
el.classList.add('hidden')
|
|
51
|
+
el.classList.add('hidden')
|
|
52
52
|
);
|
|
53
53
|
this.querySelectorAll('[data-slot="menubar-trigger"]').forEach((el) =>
|
|
54
|
-
el.setAttribute('aria-expanded', 'false')
|
|
54
|
+
el.setAttribute('aria-expanded', 'false')
|
|
55
55
|
);
|
|
56
56
|
this._activeMenu = null;
|
|
57
57
|
}
|
|
@@ -65,14 +65,13 @@ class SurrealShadcnMenubarMenu extends HTMLElement {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
if (!customElements.get('surreal-menubar')) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
68
|
+
if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn-menubar')) {
|
|
69
|
+
customElements.define('surreal-shadcn-menubar', SurrealShadcnMenubar);
|
|
70
|
+
}
|
|
72
71
|
}
|
|
73
72
|
if (!customElements.get('surreal-menubar-menu')) {
|
|
74
73
|
customElements.define('surreal-shadcn-menubar', SurrealShadcnMenubarMenu);
|
|
75
|
-
}
|
|
74
|
+
}
|
|
76
75
|
export { SurrealShadcnMenubar as MinimalistMenubar, SurrealShadcnMenubar };
|
|
77
76
|
|
|
78
77
|
if (typeof customElements !== 'undefined' && !customElements.get('surreal-minimalist-menubar')) {
|
|
@@ -101,8 +101,8 @@ export class SurrealShadcnNativeSelect extends HTMLElement {
|
|
|
101
101
|
new CustomEvent('change', {
|
|
102
102
|
detail: { value: this.selectEl.value },
|
|
103
103
|
bubbles: true,
|
|
104
|
-
composed: true
|
|
105
|
-
})
|
|
104
|
+
composed: true
|
|
105
|
+
})
|
|
106
106
|
);
|
|
107
107
|
});
|
|
108
108
|
}
|
|
@@ -132,12 +132,17 @@ export class SurrealShadcnNativeSelect extends HTMLElement {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
if (!customElements.get('surreal-native-select')) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
135
|
+
if (
|
|
136
|
+
typeof customElements !== 'undefined' &&
|
|
137
|
+
!customElements.get('surreal-shadcn-native-select')
|
|
138
|
+
) {
|
|
139
|
+
customElements.define('surreal-shadcn-native-select', SurrealShadcnNativeSelect);
|
|
140
|
+
}
|
|
139
141
|
}
|
|
140
|
-
if (
|
|
142
|
+
if (
|
|
143
|
+
typeof customElements !== 'undefined' &&
|
|
144
|
+
!customElements.get('surreal-minimalist-native-select')
|
|
145
|
+
) {
|
|
141
146
|
customElements.define('surreal-minimalist-native-select', SurrealShadcnNativeSelect);
|
|
142
147
|
}
|
|
143
148
|
|
|
@@ -17,7 +17,7 @@ class NavigationMenuElement extends HTMLElement {
|
|
|
17
17
|
|
|
18
18
|
private handleClick(e: Event) {
|
|
19
19
|
const target = (e.target as HTMLElement).closest(
|
|
20
|
-
'[data-slot="navigation-menu-trigger"]'
|
|
20
|
+
'[data-slot="navigation-menu-trigger"]'
|
|
21
21
|
) as HTMLElement | null;
|
|
22
22
|
if (!target) return;
|
|
23
23
|
|
|
@@ -84,14 +84,19 @@ class NavigationMenuElement extends HTMLElement {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
if (typeof customElements !== 'undefined' && !customElements.get('surreal-navigation-menu')) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
if (
|
|
88
|
+
typeof customElements !== 'undefined' &&
|
|
89
|
+
!customElements.get('surreal-shadcn-navigation-menu')
|
|
90
|
+
) {
|
|
91
|
+
customElements.define('surreal-shadcn-navigation-menu', NavigationMenuElement);
|
|
92
|
+
}
|
|
90
93
|
}
|
|
91
|
-
};
|
|
92
94
|
export { NavigationMenuElement as MinimalistNavigationMenu, NavigationMenuElement };
|
|
93
95
|
|
|
94
|
-
if (
|
|
96
|
+
if (
|
|
97
|
+
typeof customElements !== 'undefined' &&
|
|
98
|
+
!customElements.get('surreal-minimalist-navigation-menu')
|
|
99
|
+
) {
|
|
95
100
|
customElements.define('surreal-minimalist-navigation-menu', NavigationMenuElement);
|
|
96
101
|
}
|
|
97
102
|
|
|
@@ -109,10 +109,9 @@ class SurrealShadcnPaginationEllipsis extends HTMLElement {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
if (!customElements.get('surreal-pagination')) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
112
|
+
if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn-pagination')) {
|
|
113
|
+
customElements.define('surreal-shadcn-pagination', SurrealShadcnPagination);
|
|
114
|
+
}
|
|
116
115
|
}
|
|
117
116
|
if (!customElements.get('surreal-pagination-content')) {
|
|
118
117
|
customElements.define('surreal-shadcn-pagination', SurrealShadcnPaginationContent);
|
|
@@ -131,7 +130,7 @@ if (!customElements.get('surreal-pagination-next')) {
|
|
|
131
130
|
}
|
|
132
131
|
if (!customElements.get('surreal-pagination-ellipsis')) {
|
|
133
132
|
customElements.define('surreal-shadcn-pagination', SurrealShadcnPaginationEllipsis);
|
|
134
|
-
}
|
|
133
|
+
}
|
|
135
134
|
export { SurrealShadcnPagination as MinimalistPagination, SurrealShadcnPagination };
|
|
136
135
|
|
|
137
136
|
if (typeof customElements !== 'undefined' && !customElements.get('surreal-minimalist-pagination')) {
|
|
@@ -99,11 +99,10 @@ class SurrealShadcnPopover extends HTMLElement {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
if (typeof customElements !== 'undefined' && !customElements.get('surreal-popover')) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn-popover')) {
|
|
103
|
+
customElements.define('surreal-shadcn-popover', SurrealShadcnPopover);
|
|
104
|
+
}
|
|
105
105
|
}
|
|
106
|
-
};
|
|
107
106
|
export { SurrealShadcnPopover as MinimalistPopover, SurrealShadcnPopover };
|
|
108
107
|
|
|
109
108
|
if (typeof customElements !== 'undefined' && !customElements.get('surreal-minimalist-popover')) {
|
|
@@ -49,7 +49,7 @@ export class ProgressElement extends HTMLElement {
|
|
|
49
49
|
const customClass = this.getAttribute('class') || '';
|
|
50
50
|
this.className = cn(
|
|
51
51
|
'h-1 rounded-full bg-muted relative flex w-full items-center overflow-x-hidden',
|
|
52
|
-
customClass
|
|
52
|
+
customClass
|
|
53
53
|
);
|
|
54
54
|
this.setAttribute('data-slot', 'progress');
|
|
55
55
|
this.innerHTML = `<div data-slot="progress-indicator" class="bg-primary size-full flex-1 transition-all duration-300"></div>`;
|
|
@@ -59,10 +59,9 @@ export class ProgressElement extends HTMLElement {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
if (!customElements.get('ui-progress')) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
62
|
+
if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn-progress')) {
|
|
63
|
+
customElements.define('surreal-shadcn-progress', ProgressElement);
|
|
64
|
+
}
|
|
66
65
|
}
|
|
67
66
|
if (typeof customElements !== 'undefined' && !customElements.get('surreal-minimalist-progress')) {
|
|
68
67
|
customElements.define('surreal-minimalist-progress', ProgressElement);
|
|
@@ -106,8 +106,8 @@ class SurrealRadioItem extends HTMLElement {
|
|
|
106
106
|
new CustomEvent('item-selected', {
|
|
107
107
|
detail: { value: this._value },
|
|
108
108
|
bubbles: true,
|
|
109
|
-
composed: true
|
|
110
|
-
})
|
|
109
|
+
composed: true
|
|
110
|
+
})
|
|
111
111
|
);
|
|
112
112
|
}
|
|
113
113
|
});
|
|
@@ -209,17 +209,19 @@ class SurrealRadioItem extends HTMLElement {
|
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
if (!customElements.get('surreal-radio-group')) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}
|
|
212
|
+
if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn-radio-group')) {
|
|
213
|
+
customElements.define('surreal-shadcn-radio-group', SurrealShadcnRadioGroup);
|
|
214
|
+
}
|
|
216
215
|
}
|
|
217
216
|
if (!customElements.get('surreal-radio-item')) {
|
|
218
217
|
customElements.define('surreal-shadcn-radio-group', SurrealRadioItem);
|
|
219
|
-
}
|
|
218
|
+
}
|
|
220
219
|
export { SurrealShadcnRadioGroup as MinimalistRadioGroup, SurrealShadcnRadioGroup };
|
|
221
220
|
|
|
222
|
-
if (
|
|
221
|
+
if (
|
|
222
|
+
typeof customElements !== 'undefined' &&
|
|
223
|
+
!customElements.get('surreal-minimalist-radio-group')
|
|
224
|
+
) {
|
|
223
225
|
customElements.define('surreal-minimalist-radio-group', SurrealShadcnRadioGroup);
|
|
224
226
|
}
|
|
225
227
|
|
|
@@ -64,8 +64,8 @@ class RangeCalendarComponent extends HTMLElement {
|
|
|
64
64
|
this.dispatchEvent(
|
|
65
65
|
new CustomEvent('range-change', {
|
|
66
66
|
detail: { start: this._startDate, end: this._endDate },
|
|
67
|
-
bubbles: true
|
|
68
|
-
})
|
|
67
|
+
bubbles: true
|
|
68
|
+
})
|
|
69
69
|
);
|
|
70
70
|
this.render();
|
|
71
71
|
}
|
|
@@ -104,12 +104,12 @@ class RangeCalendarComponent extends HTMLElement {
|
|
|
104
104
|
const target = new Date(
|
|
105
105
|
this._currentMonth.getFullYear(),
|
|
106
106
|
this._currentMonth.getMonth() + m,
|
|
107
|
-
1
|
|
107
|
+
1
|
|
108
108
|
);
|
|
109
109
|
const matrix = this.getMonthMatrix(target.getFullYear(), target.getMonth());
|
|
110
110
|
const monthTitle = new Intl.DateTimeFormat(this._locale, {
|
|
111
111
|
month: 'long',
|
|
112
|
-
year: 'numeric'
|
|
112
|
+
year: 'numeric'
|
|
113
113
|
}).format(target);
|
|
114
114
|
|
|
115
115
|
const rowsHtml = matrix
|
|
@@ -164,7 +164,7 @@ class RangeCalendarComponent extends HTMLElement {
|
|
|
164
164
|
})
|
|
165
165
|
.join('')}
|
|
166
166
|
</tr>
|
|
167
|
-
|
|
167
|
+
`
|
|
168
168
|
)
|
|
169
169
|
.join('');
|
|
170
170
|
|
|
@@ -179,7 +179,7 @@ class RangeCalendarComponent extends HTMLElement {
|
|
|
179
179
|
${weekdays
|
|
180
180
|
.map(
|
|
181
181
|
(w) =>
|
|
182
|
-
`<th class="w-9 rounded-md text-[0.8rem] font-normal text-muted-foreground text-center">${w}</th
|
|
182
|
+
`<th class="w-9 rounded-md text-[0.8rem] font-normal text-muted-foreground text-center">${w}</th>`
|
|
183
183
|
)
|
|
184
184
|
.join('')}
|
|
185
185
|
</tr>
|
|
@@ -223,7 +223,7 @@ class RangeCalendarComponent extends HTMLElement {
|
|
|
223
223
|
this._currentMonth = new Date(
|
|
224
224
|
this._currentMonth.getFullYear(),
|
|
225
225
|
this._currentMonth.getMonth() - 1,
|
|
226
|
-
1
|
|
226
|
+
1
|
|
227
227
|
);
|
|
228
228
|
this.render();
|
|
229
229
|
});
|
|
@@ -232,7 +232,7 @@ class RangeCalendarComponent extends HTMLElement {
|
|
|
232
232
|
this._currentMonth = new Date(
|
|
233
233
|
this._currentMonth.getFullYear(),
|
|
234
234
|
this._currentMonth.getMonth() + 1,
|
|
235
|
-
1
|
|
235
|
+
1
|
|
236
236
|
);
|
|
237
237
|
this.render();
|
|
238
238
|
});
|
|
@@ -253,14 +253,19 @@ class RangeCalendarComponent extends HTMLElement {
|
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
if (!customElements.get('range-calendar')) {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
256
|
+
if (
|
|
257
|
+
typeof customElements !== 'undefined' &&
|
|
258
|
+
!customElements.get('surreal-shadcn-range-calendar')
|
|
259
|
+
) {
|
|
260
|
+
customElements.define('surreal-shadcn-range-calendar', RangeCalendarComponent);
|
|
261
|
+
}
|
|
259
262
|
}
|
|
260
|
-
};
|
|
261
263
|
export { RangeCalendarComponent as MinimalistRangeCalendar, RangeCalendarComponent };
|
|
262
264
|
|
|
263
|
-
if (
|
|
265
|
+
if (
|
|
266
|
+
typeof customElements !== 'undefined' &&
|
|
267
|
+
!customElements.get('surreal-minimalist-range-calendar')
|
|
268
|
+
) {
|
|
264
269
|
customElements.define('surreal-minimalist-range-calendar', RangeCalendarComponent);
|
|
265
270
|
}
|
|
266
271
|
|
|
@@ -38,7 +38,7 @@ class SurrealMinimalistResizable extends HTMLElement {
|
|
|
38
38
|
|
|
39
39
|
if (typeof customElements !== 'undefined' && !customElements.get('surreal-minimalist-resizable')) {
|
|
40
40
|
customElements.define('surreal-minimalist-resizable', SurrealMinimalistResizable);
|
|
41
|
-
}
|
|
41
|
+
}
|
|
42
42
|
export { SurrealMinimalistResizable as MinimalistResizable, SurrealMinimalistResizable };
|
|
43
43
|
|
|
44
44
|
export default SurrealMinimalistResizable;
|
|
@@ -1,10 +1,41 @@
|
|
|
1
|
-
class SurrealModernScrollArea extends HTMLElement {
|
|
1
|
+
class SurrealModernScrollArea extends HTMLElement {
|
|
2
|
+
constructor() {
|
|
3
|
+
super();
|
|
4
|
+
this.attachShadow({ mode: 'open' });
|
|
5
|
+
this._code = '';
|
|
6
|
+
this._copied = false;
|
|
7
|
+
}
|
|
8
|
+
static get observedAttributes() {
|
|
9
|
+
return ['code', 'copied', 'active-platform'];
|
|
10
|
+
}
|
|
11
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
12
|
+
if (name === 'code') this._code = newValue;
|
|
13
|
+
if (name === 'copied') this._copied = newValue !== null;
|
|
14
|
+
this.render();
|
|
15
|
+
}
|
|
16
|
+
connectedCallback() {
|
|
17
|
+
this.render();
|
|
18
|
+
this.shadowRoot.addEventListener('click', (e) => {
|
|
19
|
+
const btn = e.composedPath().find((el) => el && el.tagName === 'BUTTON');
|
|
20
|
+
if (btn) {
|
|
21
|
+
this.dispatchEvent(new CustomEvent('copy', { bubbles: true, composed: true }));
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
render() {
|
|
26
|
+
const formatted = (this._code || '').trim();
|
|
27
|
+
this.shadowRoot.innerHTML = `<style>@import "https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css";</style><div class="relative"><button class="absolute right-4 top-4 px-3 py-1.5 bg-slate-800/80 hover:bg-slate-700 text-slate-200 text-xs font-semibold rounded-lg border border-slate-700 flex items-center gap-1.5 transition-colors z-10">${this._copied ? '<span class="text-emerald-400">Copied!</span>' : '<span>Copy Code</span>'}</button><pre class="p-6 rounded-2xl bg-slate-950 border border-slate-800 text-xs font-mono text-indigo-200 overflow-x-auto leading-relaxed"><code>${formatted}</code></pre></div>`;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
2
30
|
if (typeof customElements !== 'undefined' && !customElements.get('surreal-modern-scroll-area')) {
|
|
3
31
|
customElements.define('surreal-modern-scroll-area', SurrealModernScrollArea);
|
|
4
|
-
}
|
|
32
|
+
}
|
|
5
33
|
export { SurrealModernScrollArea as MinimalistScrollArea, SurrealModernScrollArea };
|
|
6
34
|
|
|
7
|
-
if (
|
|
35
|
+
if (
|
|
36
|
+
typeof customElements !== 'undefined' &&
|
|
37
|
+
!customElements.get('surreal-minimalist-scroll-area')
|
|
38
|
+
) {
|
|
8
39
|
customElements.define('surreal-minimalist-scroll-area', SurrealModernScrollArea);
|
|
9
40
|
}
|
|
10
41
|
|
|
@@ -90,11 +90,10 @@ class SurrealShadcnSelect extends HTMLElement {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
if (!customElements.get('surreal-select')) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn-select')) {
|
|
94
|
+
customElements.define('surreal-shadcn-select', SurrealShadcnSelect);
|
|
95
|
+
}
|
|
96
96
|
}
|
|
97
|
-
};
|
|
98
97
|
export { SurrealShadcnSelect as MinimalistSelect, SurrealShadcnSelect };
|
|
99
98
|
|
|
100
99
|
if (typeof customElements !== 'undefined' && !customElements.get('surreal-minimalist-select')) {
|
|
@@ -35,16 +35,15 @@ export class SurrealShadcnSeparator extends HTMLElement {
|
|
|
35
35
|
|
|
36
36
|
this.className = cn(
|
|
37
37
|
'shrink-0 bg-border block data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:h-full',
|
|
38
|
-
customClass
|
|
38
|
+
customClass
|
|
39
39
|
);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
if (!customElements.get('surreal-separator')) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
44
|
+
if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn-separator')) {
|
|
45
|
+
customElements.define('surreal-shadcn-separator', SurrealShadcnSeparator);
|
|
46
|
+
}
|
|
48
47
|
}
|
|
49
48
|
if (typeof customElements !== 'undefined' && !customElements.get('surreal-minimalist-separator')) {
|
|
50
49
|
customElements.define('surreal-minimalist-separator', SurrealShadcnSeparator);
|
|
@@ -62,7 +62,7 @@ class SurrealShadcnSheet extends HTMLElement {
|
|
|
62
62
|
right: 'top-0 right-0 h-full w-3/4 max-w-sm border-l translate-x-0',
|
|
63
63
|
left: 'top-0 left-0 h-full w-3/4 max-w-sm border-r translate-x-0',
|
|
64
64
|
top: 'top-0 inset-x-0 h-auto border-b translate-y-0',
|
|
65
|
-
bottom: 'bottom-0 inset-x-0 h-auto border-t translate-y-0'
|
|
65
|
+
bottom: 'bottom-0 inset-x-0 h-auto border-t translate-y-0'
|
|
66
66
|
}[side] || 'top-0 right-0 h-full w-3/4 max-w-sm border-l';
|
|
67
67
|
|
|
68
68
|
this.shadowRoot.innerHTML = `
|
|
@@ -152,11 +152,10 @@ class SurrealShadcnSheet extends HTMLElement {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
if (!customElements.get('surreal-sheet')) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
if (typeof customElements !== 'undefined' && !customElements.get('surreal-shadcn-sheet')) {
|
|
156
|
+
customElements.define('surreal-shadcn-sheet', SurrealShadcnSheet);
|
|
157
|
+
}
|
|
158
158
|
}
|
|
159
|
-
};
|
|
160
159
|
export { SurrealShadcnSheet as MinimalistSheet, SurrealShadcnSheet };
|
|
161
160
|
|
|
162
161
|
if (typeof customElements !== 'undefined' && !customElements.get('surreal-minimalist-sheet')) {
|