@surreal-ui/web 0.5.2 → 0.5.4
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 +12 -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
|
@@ -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 };
|
|
@@ -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,15 +87,14 @@ 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
|
export default 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,7 +82,7 @@ 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 ShadcnInputGroup, InputGroupElement };
|
|
88
87
|
|
|
89
88
|
export default InputGroupElement;
|
|
@@ -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 ShadcnInputOtp, SurrealInputOTP };
|
|
150
149
|
|
|
151
150
|
export default SurrealInputOTP;
|
|
@@ -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 ShadcnItem, UIItem };
|
|
155
154
|
|
|
156
155
|
export default UIItem;
|
|
@@ -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,15 +36,14 @@ 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
|
export default 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 ShadcnMenubar, SurrealShadcnMenubar };
|
|
77
76
|
|
|
78
77
|
export default SurrealShadcnMenubar;
|
|
@@ -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,9 +132,11 @@ 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
142
|
export default SurrealShadcnNativeSelect;
|
|
@@ -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,11 +84,13 @@ 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 ShadcnNavigationMenu, NavigationMenuElement };
|
|
93
95
|
|
|
94
96
|
export default NavigationMenuElement;
|
|
@@ -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 ShadcnPagination, SurrealShadcnPagination };
|
|
136
135
|
|
|
137
136
|
export default SurrealShadcnPagination;
|
|
@@ -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 ShadcnPopover, SurrealShadcnPopover };
|
|
108
107
|
|
|
109
108
|
export default SurrealShadcnPopover;
|
|
@@ -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,9 +59,8 @@ 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
|
export default 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,14 +209,13 @@ 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 ShadcnRadioGroup, SurrealShadcnRadioGroup };
|
|
221
220
|
|
|
222
221
|
export default SurrealShadcnRadioGroup;
|