@blenx-dev/core 0.1.0

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.
Files changed (172) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/LICENSE +21 -0
  3. package/package.json +49 -0
  4. package/src/DataTable/data-table-column-toggle.tsx +73 -0
  5. package/src/DataTable/data-table-empty.tsx +27 -0
  6. package/src/DataTable/data-table-error.tsx +25 -0
  7. package/src/DataTable/data-table-infinite-loader.tsx +73 -0
  8. package/src/DataTable/data-table-loading.tsx +67 -0
  9. package/src/DataTable/data-table-pagination.tsx +80 -0
  10. package/src/DataTable/data-table-toolbar.tsx +62 -0
  11. package/src/DataTable/data-table.css.ts +420 -0
  12. package/src/DataTable/data-table.tsx +507 -0
  13. package/src/DataTable/index.ts +24 -0
  14. package/src/DataTable/types.ts +169 -0
  15. package/src/DataTable/use-infinite-scroll.ts +67 -0
  16. package/src/components/Accordion/accordion.css.ts +84 -0
  17. package/src/components/Accordion/accordion.tsx +87 -0
  18. package/src/components/Accordion/index.ts +8 -0
  19. package/src/components/Alert/alert.css.ts +29 -0
  20. package/src/components/Alert/alert.tsx +40 -0
  21. package/src/components/Alert/index.ts +1 -0
  22. package/src/components/AlertDialog/alert-dialog.css.ts +62 -0
  23. package/src/components/AlertDialog/alert-dialog.tsx +199 -0
  24. package/src/components/AlertDialog/index.ts +1 -0
  25. package/src/components/AspectRatio/aspect-ratio.css.ts +7 -0
  26. package/src/components/AspectRatio/aspect-ratio.tsx +20 -0
  27. package/src/components/AspectRatio/index.ts +1 -0
  28. package/src/components/Autocomplete/autocomplete.css.ts +167 -0
  29. package/src/components/Autocomplete/autocomplete.tsx +226 -0
  30. package/src/components/Autocomplete/index.ts +1 -0
  31. package/src/components/Avatar/avatar.css.ts +65 -0
  32. package/src/components/Avatar/avatar.tsx +44 -0
  33. package/src/components/Avatar/index.ts +1 -0
  34. package/src/components/Badge/badge.css.ts +180 -0
  35. package/src/components/Badge/badge.tsx +47 -0
  36. package/src/components/Badge/index.ts +1 -0
  37. package/src/components/Box/box.css.ts +5 -0
  38. package/src/components/Box/box.tsx +21 -0
  39. package/src/components/Box/index.ts +1 -0
  40. package/src/components/Breadcrumbs/breadcrumbs.css.ts +72 -0
  41. package/src/components/Breadcrumbs/breadcrumbs.tsx +79 -0
  42. package/src/components/Breadcrumbs/index.ts +9 -0
  43. package/src/components/Button/button.css.ts +200 -0
  44. package/src/components/Button/button.tsx +55 -0
  45. package/src/components/Button/index.ts +1 -0
  46. package/src/components/Calendar/calendar.css.ts +187 -0
  47. package/src/components/Calendar/calendar.tsx +143 -0
  48. package/src/components/Calendar/index.ts +1 -0
  49. package/src/components/Card/card.tsx +32 -0
  50. package/src/components/Card/index.ts +1 -0
  51. package/src/components/Checkbox/checkbox.css.ts +76 -0
  52. package/src/components/Checkbox/checkbox.tsx +94 -0
  53. package/src/components/Checkbox/index.ts +1 -0
  54. package/src/components/CloseButton/close-button.css.ts +11 -0
  55. package/src/components/CloseButton/close-button.tsx +15 -0
  56. package/src/components/CloseButton/index.ts +2 -0
  57. package/src/components/ColorPicker/color-picker.tsx +123 -0
  58. package/src/components/ColorPicker/index.ts +1 -0
  59. package/src/components/ColorSwatch/color-swatch.tsx +21 -0
  60. package/src/components/ColorSwatch/index.ts +1 -0
  61. package/src/components/Combobox/combobox.css.ts +333 -0
  62. package/src/components/Combobox/combobox.tsx +350 -0
  63. package/src/components/Combobox/index.ts +1 -0
  64. package/src/components/Command/command.css.ts +130 -0
  65. package/src/components/Command/command.tsx +413 -0
  66. package/src/components/Command/index.ts +7 -0
  67. package/src/components/Container/container.css.ts +41 -0
  68. package/src/components/Container/container.tsx +25 -0
  69. package/src/components/Container/index.ts +1 -0
  70. package/src/components/CopyButton/copy-button.css.ts +11 -0
  71. package/src/components/CopyButton/copy-button.tsx +45 -0
  72. package/src/components/CopyButton/index.ts +2 -0
  73. package/src/components/DatePicker/date-picker.tsx +75 -0
  74. package/src/components/DatePicker/index.ts +1 -0
  75. package/src/components/Dialog/dialog.css.ts +57 -0
  76. package/src/components/Dialog/dialog.tsx +181 -0
  77. package/src/components/Dialog/index.ts +1 -0
  78. package/src/components/Drawer/drawer.css.ts +404 -0
  79. package/src/components/Drawer/drawer.tsx +573 -0
  80. package/src/components/Drawer/index.ts +1 -0
  81. package/src/components/Field/field.css.ts +35 -0
  82. package/src/components/Field/field.tsx +101 -0
  83. package/src/components/Field/index.ts +1 -0
  84. package/src/components/Grid/grid.css.ts +12 -0
  85. package/src/components/Grid/grid.tsx +32 -0
  86. package/src/components/Grid/index.ts +1 -0
  87. package/src/components/Icon/icon.css.ts +10 -0
  88. package/src/components/Icon/icon.tsx +15 -0
  89. package/src/components/Icon/index.ts +1 -0
  90. package/src/components/IconButton/icon-button.css.ts +6 -0
  91. package/src/components/IconButton/icon-button.tsx +11 -0
  92. package/src/components/IconButton/index.ts +2 -0
  93. package/src/components/Input/index.ts +1 -0
  94. package/src/components/Input/input.css.ts +72 -0
  95. package/src/components/Input/input.tsx +50 -0
  96. package/src/components/InputGroup/index.ts +1 -0
  97. package/src/components/InputGroup/input-group.css.ts +156 -0
  98. package/src/components/InputGroup/input-group.tsx +133 -0
  99. package/src/components/Menu/index.ts +1 -0
  100. package/src/components/Menu/menu.css.ts +121 -0
  101. package/src/components/Menu/menu.tsx +115 -0
  102. package/src/components/OTPField/index.ts +1 -0
  103. package/src/components/OTPField/otp-field.css.ts +54 -0
  104. package/src/components/OTPField/otp-field.tsx +46 -0
  105. package/src/components/Popover/index.ts +1 -0
  106. package/src/components/Popover/popover.css.ts +81 -0
  107. package/src/components/Popover/popover.tsx +113 -0
  108. package/src/components/Progress/index.ts +7 -0
  109. package/src/components/Progress/progress.css.ts +37 -0
  110. package/src/components/Progress/progress.tsx +62 -0
  111. package/src/components/Radio/index.ts +1 -0
  112. package/src/components/Radio/radio.css.ts +72 -0
  113. package/src/components/Radio/radio.tsx +49 -0
  114. package/src/components/ScrollArea/index.ts +1 -0
  115. package/src/components/ScrollArea/scroll-area.css.ts +79 -0
  116. package/src/components/ScrollArea/scroll-area.tsx +96 -0
  117. package/src/components/SegmentedControl/index.ts +1 -0
  118. package/src/components/SegmentedControl/segmented-control.tsx +42 -0
  119. package/src/components/Select/index.ts +1 -0
  120. package/src/components/Select/select.css.ts +182 -0
  121. package/src/components/Select/select.tsx +165 -0
  122. package/src/components/Separator/index.ts +1 -0
  123. package/src/components/Separator/separator.css.ts +59 -0
  124. package/src/components/Separator/separator.tsx +34 -0
  125. package/src/components/Sheet/index.ts +1 -0
  126. package/src/components/Sheet/sheet.css.ts +184 -0
  127. package/src/components/Sheet/sheet.tsx +215 -0
  128. package/src/components/Slider/index.ts +1 -0
  129. package/src/components/Slider/slider.css.ts +81 -0
  130. package/src/components/Slider/slider.tsx +100 -0
  131. package/src/components/Spinner/index.ts +1 -0
  132. package/src/components/Spinner/spinner.css.ts +17 -0
  133. package/src/components/Spinner/spinner.tsx +15 -0
  134. package/src/components/Splitter/index.ts +1 -0
  135. package/src/components/Splitter/splitter.css.ts +69 -0
  136. package/src/components/Splitter/splitter.tsx +521 -0
  137. package/src/components/Stack/index.ts +1 -0
  138. package/src/components/Stack/stack.css.ts +42 -0
  139. package/src/components/Stack/stack.tsx +32 -0
  140. package/src/components/Surface/index.ts +1 -0
  141. package/src/components/Surface/surface.css.ts +40 -0
  142. package/src/components/Surface/surface.tsx +19 -0
  143. package/src/components/Switch/index.ts +1 -0
  144. package/src/components/Switch/switch.css.ts +46 -0
  145. package/src/components/Switch/switch.tsx +25 -0
  146. package/src/components/Table/index.ts +2 -0
  147. package/src/components/Table/table.css.ts +71 -0
  148. package/src/components/Table/table.tsx +117 -0
  149. package/src/components/Tabs/index.ts +1 -0
  150. package/src/components/Tabs/tabs.css.ts +250 -0
  151. package/src/components/Tabs/tabs.tsx +119 -0
  152. package/src/components/Text/index.ts +2 -0
  153. package/src/components/Text/text.css.ts +118 -0
  154. package/src/components/Text/text.tsx +66 -0
  155. package/src/components/Textarea/index.ts +1 -0
  156. package/src/components/Textarea/textarea.css.ts +66 -0
  157. package/src/components/Textarea/textarea.tsx +48 -0
  158. package/src/components/Toggle/index.ts +1 -0
  159. package/src/components/Toggle/toggle.css.ts +91 -0
  160. package/src/components/Toggle/toggle.tsx +44 -0
  161. package/src/components/ToggleGroup/index.ts +1 -0
  162. package/src/components/ToggleGroup/toggle-group.css.ts +77 -0
  163. package/src/components/ToggleGroup/toggle-group.tsx +131 -0
  164. package/src/components/index.ts +54 -0
  165. package/src/index.ts +3 -0
  166. package/src/utils/drawer-styles.css.ts +85 -0
  167. package/src/utils/heights.ts +16 -0
  168. package/src/utils/sprinkles.css.ts +197 -0
  169. package/src/utils/sprinkles.tokens.ts +74 -0
  170. package/src/utils/types.ts +10 -0
  171. package/src/utils/ve-style.utils.ts +51 -0
  172. package/tsconfig.json +10 -0
@@ -0,0 +1,167 @@
1
+ import { style } from "@vanilla-extract/css";
2
+ import { semanticVars, tokenVars } from "@blenx-dev/theme/contract";
3
+
4
+ export const inputGroup = style({
5
+ position: "relative",
6
+ width: "100%",
7
+ minWidth: 0,
8
+ color: semanticVars.text.primary,
9
+ });
10
+
11
+ export const inputSize = style({
12
+ vars: {
13
+ "--autocomplete-input-padding-inline-start": "33px",
14
+ "--autocomplete-input-padding-inline-end": "28px",
15
+ },
16
+ });
17
+
18
+ export const inputSizeSm = style({
19
+ paddingInlineStart: "31px",
20
+ paddingInlineEnd: "26px",
21
+ });
22
+
23
+ export const inputSizeDefault = style({
24
+ paddingInlineStart: "33px",
25
+ paddingInlineEnd: "28px",
26
+ });
27
+
28
+ export const inputSizeLg = style({
29
+ paddingInlineStart: "35px",
30
+ paddingInlineEnd: "30px",
31
+ });
32
+
33
+ export const startAddon = style({
34
+ pointerEvents: "none",
35
+ position: "absolute",
36
+ insetBlock: 0,
37
+ insetInlineStart: tokenVars.borderWidth.thin,
38
+ zIndex: 1,
39
+ display: "flex",
40
+ alignItems: "center",
41
+ opacity: 0.8,
42
+ });
43
+
44
+ export const startAddonDefault = style({
45
+ paddingInlineStart: "11px",
46
+ });
47
+
48
+ export const startAddonSmall = style({
49
+ paddingInlineStart: "9px",
50
+ });
51
+
52
+ export const adornment = style({
53
+ position: "absolute",
54
+ top: "50%",
55
+ display: "inline-flex",
56
+ alignItems: "center",
57
+ justifyContent: "center",
58
+ flexShrink: 0,
59
+ transform: "translateY(-50%)",
60
+ borderRadius: tokenVars.borderRadius.md,
61
+ borderWidth: tokenVars.borderWidth.thin,
62
+ borderStyle: "solid",
63
+ borderColor: "transparent",
64
+ opacity: 0.8,
65
+ outline: "none",
66
+ transitionProperty: "color, background-color, box-shadow, opacity",
67
+ transitionDuration: "150ms",
68
+ });
69
+
70
+ export const adornmentSmall = style({
71
+ width: "28px",
72
+ height: "28px",
73
+ });
74
+
75
+ export const adornmentDefault = style({
76
+ width: "32px",
77
+ height: "32px",
78
+ });
79
+
80
+ export const adornmentEndSmall = style({
81
+ insetInlineEnd: tokenVars.spacing["0"],
82
+ });
83
+
84
+ export const adornmentEndDefault = style({
85
+ insetInlineEnd: tokenVars.spacing["0.5"],
86
+ });
87
+
88
+ export const positioner = style({
89
+ outline: "none",
90
+ });
91
+
92
+ export const popupShell = style({
93
+ position: "relative",
94
+ display: "flex",
95
+ maxHeight: "100%",
96
+ minWidth: "var(--anchor-width)",
97
+ maxWidth: "var(--available-width)",
98
+ borderWidth: tokenVars.borderWidth.thin,
99
+ borderStyle: "solid",
100
+ borderColor: semanticVars.border.default,
101
+ borderRadius: tokenVars.borderRadius.lg,
102
+ backgroundColor: semanticVars.surface.default,
103
+ boxShadow: tokenVars.shadow.lg,
104
+ transformOrigin: "var(--transform-origin)",
105
+ transitionProperty: "transform, opacity",
106
+ transitionDuration: "150ms",
107
+ });
108
+
109
+ export const popup = style({
110
+ display: "flex",
111
+ flex: 1,
112
+ flexDirection: "column",
113
+ maxHeight: "min(var(--available-height), 23rem)",
114
+ color: semanticVars.text.primary,
115
+ });
116
+
117
+ export const group = style({
118
+ display: "flex",
119
+ flexDirection: "column",
120
+ });
121
+
122
+ export const separator = style({
123
+ height: "1px",
124
+ marginBlock: tokenVars.spacing.xs,
125
+ marginInline: tokenVars.spacing.sm,
126
+ backgroundColor: semanticVars.border.default,
127
+ });
128
+
129
+ export const groupLabel = style({
130
+ paddingBlock: tokenVars.spacing["1"],
131
+ paddingInline: tokenVars.spacing["2"],
132
+ fontSize: tokenVars.fontSize.xs,
133
+ fontWeight: tokenVars.fontWeight.medium,
134
+ color: semanticVars.text.secondary,
135
+ });
136
+
137
+ export const empty = style({
138
+ padding: tokenVars.spacing.sm,
139
+ textAlign: "center",
140
+ fontSize: tokenVars.fontSize.sm,
141
+ color: semanticVars.text.secondary,
142
+ });
143
+
144
+ export const list = style({
145
+ padding: tokenVars.spacing.xs,
146
+ });
147
+
148
+ export const status = style({
149
+ paddingInline: tokenVars.spacing.md,
150
+ paddingBlock: tokenVars.spacing.sm,
151
+ fontSize: tokenVars.fontSize.xs,
152
+ fontWeight: tokenVars.fontWeight.medium,
153
+ color: semanticVars.text.secondary,
154
+ });
155
+
156
+ export const item = style({
157
+ display: "flex",
158
+ alignItems: "center",
159
+ paddingInline: tokenVars.spacing.sm,
160
+ paddingBlock: tokenVars.spacing["1"],
161
+ borderRadius: tokenVars.borderRadius.md,
162
+ cursor: "default",
163
+ userSelect: "none",
164
+ outline: "none",
165
+ minHeight: "32px",
166
+ fontSize: tokenVars.fontSize.md,
167
+ });
@@ -0,0 +1,226 @@
1
+ import { Autocomplete as AutocompletePrimitive } from "@base-ui/react/autocomplete";
2
+ import { CaretUpDownIcon } from "@phosphor-icons/react";
3
+ import clsx from "clsx";
4
+ import type React from "react";
5
+ import { Input } from "../Input/input";
6
+ import { ScrollArea } from "../ScrollArea/scroll-area";
7
+ import {
8
+ inputGroup,
9
+ inputSizeSm,
10
+ inputSizeDefault,
11
+ inputSizeLg,
12
+ startAddon,
13
+ startAddonDefault,
14
+ startAddonSmall,
15
+ adornment,
16
+ adornmentSmall,
17
+ adornmentDefault,
18
+ adornmentEndSmall,
19
+ adornmentEndDefault,
20
+ positioner,
21
+ popupShell,
22
+ popup,
23
+ group,
24
+ separator,
25
+ groupLabel,
26
+ empty,
27
+ list,
28
+ status,
29
+ item,
30
+ } from "./autocomplete.css";
31
+ import { CloseButton } from "../CloseButton";
32
+
33
+ const Autocomplete: typeof AutocompletePrimitive.Root = AutocompletePrimitive.Root;
34
+
35
+ export function AutocompleteItem(props: AutocompletePrimitive.Item.Props): React.ReactElement {
36
+ return <AutocompletePrimitive.Item className={item} data-slot="autocomplete-item" {...props} />;
37
+ }
38
+
39
+ export function AutocompleteSeparator(
40
+ props: AutocompletePrimitive.Separator.Props,
41
+ ): React.ReactElement {
42
+ return (
43
+ <AutocompletePrimitive.Separator
44
+ className={separator}
45
+ data-slot="autocomplete-separator"
46
+ {...props}
47
+ />
48
+ );
49
+ }
50
+
51
+ export function AutocompleteGroup(props: AutocompletePrimitive.Group.Props): React.ReactElement {
52
+ return (
53
+ <AutocompletePrimitive.Group className={group} data-slot="autocomplete-group" {...props} />
54
+ );
55
+ }
56
+
57
+ function AutocompleteInput({
58
+ showTrigger = false,
59
+ showClear = false,
60
+ startAddon: startAddonNode,
61
+ size,
62
+ triggerProps,
63
+ clearProps,
64
+ render: renderProp,
65
+ className,
66
+ ...props
67
+ }: Omit<AutocompletePrimitive.Input.Props, "size"> & {
68
+ showTrigger?: boolean;
69
+ showClear?: boolean;
70
+ startAddon?: React.ReactNode;
71
+ size?: "sm" | "default" | "lg";
72
+ ref?: React.Ref<HTMLInputElement>;
73
+ triggerProps?: AutocompletePrimitive.Trigger.Props;
74
+ clearProps?: AutocompletePrimitive.Clear.Props;
75
+ }): React.ReactElement {
76
+ const resolvedSize = size ?? "default";
77
+ const inputCls = clsx(
78
+ resolvedSize === "sm" ? inputSizeSm : resolvedSize === "lg" ? inputSizeLg : inputSizeDefault,
79
+ className,
80
+ );
81
+
82
+ return (
83
+ <AutocompletePrimitive.InputGroup className={inputGroup} data-slot="autocomplete-input-group">
84
+ {startAddonNode && (
85
+ <div
86
+ aria-hidden="true"
87
+ className={clsx(startAddon, resolvedSize === "sm" ? startAddonSmall : startAddonDefault)}
88
+ data-slot="autocomplete-start-addon"
89
+ >
90
+ {startAddonNode}
91
+ </div>
92
+ )}
93
+ <AutocompletePrimitive.Input
94
+ data-slot="autocomplete-input"
95
+ render={renderProp ?? <Input />}
96
+ className={inputCls}
97
+ {...props}
98
+ />
99
+ {showTrigger && (
100
+ <AutocompletePrimitive.Trigger
101
+ className={clsx(
102
+ adornment,
103
+ resolvedSize === "sm" ? adornmentSmall : adornmentDefault,
104
+ resolvedSize === "sm" ? adornmentEndSmall : adornmentEndDefault,
105
+ )}
106
+ data-slot="autocomplete-trigger"
107
+ {...triggerProps}
108
+ >
109
+ <CaretUpDownIcon size={resolvedSize === "sm" ? 16 : 18} weight="regular" />
110
+ </AutocompletePrimitive.Trigger>
111
+ )}
112
+ {showClear && (
113
+ <AutocompletePrimitive.Clear
114
+ className={clsx(
115
+ adornment,
116
+ resolvedSize === "sm" ? adornmentSmall : adornmentDefault,
117
+ resolvedSize === "sm" ? adornmentEndSmall : adornmentEndDefault,
118
+ )}
119
+ data-slot="autocomplete-clear"
120
+ render={<CloseButton />}
121
+ {...clearProps}
122
+ />
123
+ )}
124
+ </AutocompletePrimitive.InputGroup>
125
+ );
126
+ }
127
+
128
+ export function AutocompletePopup({
129
+ className,
130
+ children,
131
+ side = "bottom",
132
+ sideOffset = 4,
133
+ alignOffset,
134
+ align = "start",
135
+ anchor,
136
+ portalProps,
137
+ ...props
138
+ }: AutocompletePrimitive.Popup.Props & {
139
+ align?: AutocompletePrimitive.Positioner.Props["align"];
140
+ sideOffset?: AutocompletePrimitive.Positioner.Props["sideOffset"];
141
+ alignOffset?: AutocompletePrimitive.Positioner.Props["alignOffset"];
142
+ side?: AutocompletePrimitive.Positioner.Props["side"];
143
+ anchor?: AutocompletePrimitive.Positioner.Props["anchor"];
144
+ portalProps?: AutocompletePrimitive.Portal.Props;
145
+ }): React.ReactElement {
146
+ return (
147
+ <AutocompletePrimitive.Portal {...portalProps}>
148
+ <AutocompletePrimitive.Positioner
149
+ align={align}
150
+ alignOffset={alignOffset}
151
+ anchor={anchor}
152
+ className={positioner}
153
+ data-slot="autocomplete-positioner"
154
+ side={side}
155
+ sideOffset={sideOffset}
156
+ >
157
+ <span className={clsx(popupShell, className)}>
158
+ <AutocompletePrimitive.Popup className={popup} data-slot="autocomplete-popup" {...props}>
159
+ {children}
160
+ </AutocompletePrimitive.Popup>
161
+ </span>
162
+ </AutocompletePrimitive.Positioner>
163
+ </AutocompletePrimitive.Portal>
164
+ );
165
+ }
166
+
167
+ export function AutocompleteGroupLabel(
168
+ props: AutocompletePrimitive.GroupLabel.Props,
169
+ ): React.ReactElement {
170
+ return (
171
+ <AutocompletePrimitive.GroupLabel
172
+ className={groupLabel}
173
+ data-slot="autocomplete-group-label"
174
+ {...props}
175
+ />
176
+ );
177
+ }
178
+
179
+ export function AutocompleteEmpty(props: AutocompletePrimitive.Empty.Props): React.ReactElement {
180
+ return (
181
+ <AutocompletePrimitive.Empty className={empty} data-slot="autocomplete-empty" {...props} />
182
+ );
183
+ }
184
+
185
+ export function AutocompleteRow(props: AutocompletePrimitive.Row.Props): React.ReactElement {
186
+ return <AutocompletePrimitive.Row data-slot="autocomplete-row" {...props} />;
187
+ }
188
+
189
+ export function AutocompleteValue(props: AutocompletePrimitive.Value.Props): React.ReactElement {
190
+ return <AutocompletePrimitive.Value data-slot="autocomplete-value" {...props} />;
191
+ }
192
+
193
+ export function AutocompleteList(props: AutocompletePrimitive.List.Props): React.ReactElement {
194
+ return (
195
+ <ScrollArea scrollbarGutter scrollFade>
196
+ <AutocompletePrimitive.List className={list} data-slot="autocomplete-list" {...props} />
197
+ </ScrollArea>
198
+ );
199
+ }
200
+
201
+ export function AutocompleteClear(props: AutocompletePrimitive.Clear.Props): React.ReactElement {
202
+ return <AutocompletePrimitive.Clear data-slot="autocomplete-clear" {...props} />;
203
+ }
204
+
205
+ export function AutocompleteStatus(props: AutocompletePrimitive.Status.Props): React.ReactElement {
206
+ return (
207
+ <AutocompletePrimitive.Status className={status} data-slot="autocomplete-status" {...props} />
208
+ );
209
+ }
210
+
211
+ export function AutocompleteCollection(
212
+ props: AutocompletePrimitive.Collection.Props,
213
+ ): React.ReactElement {
214
+ return <AutocompletePrimitive.Collection data-slot="autocomplete-collection" {...props} />;
215
+ }
216
+
217
+ export function AutocompleteTrigger(
218
+ props: AutocompletePrimitive.Trigger.Props,
219
+ ): React.ReactElement {
220
+ return <AutocompletePrimitive.Trigger data-slot="autocomplete-trigger" {...props} />;
221
+ }
222
+
223
+ export const useAutocompleteFilter: typeof AutocompletePrimitive.useFilter =
224
+ AutocompletePrimitive.useFilter;
225
+
226
+ export { Autocomplete, AutocompleteInput };
@@ -0,0 +1 @@
1
+ export * from "./autocomplete";
@@ -0,0 +1,65 @@
1
+ import { style } from "@vanilla-extract/css";
2
+ import { recipe } from "@vanilla-extract/recipes";
3
+ import { semanticVars, tokenVars } from "@blenx-dev/theme/contract";
4
+
5
+ export const root = style({
6
+ display: "inline-flex",
7
+ alignItems: "center",
8
+ justifyContent: "center",
9
+ borderRadius: tokenVars.borderRadius.default,
10
+ backgroundColor: semanticVars.background.subtle,
11
+ color: semanticVars.text.secondary,
12
+ overflow: "hidden",
13
+ flexShrink: 0,
14
+ outline: "none",
15
+ border: "none",
16
+ borderWidth: 0,
17
+ });
18
+
19
+ export const image = style({
20
+ width: "100%",
21
+ height: "100%",
22
+ objectFit: "cover",
23
+ display: "block",
24
+ outline: "none",
25
+ border: "none",
26
+ borderWidth: 0,
27
+ });
28
+
29
+ export const fallback = style({
30
+ width: "100%",
31
+ height: "100%",
32
+ display: "flex",
33
+ alignItems: "center",
34
+ justifyContent: "center",
35
+ backgroundColor: semanticVars.background.subtle,
36
+ color: semanticVars.text.secondary,
37
+ fontSize: 12,
38
+ outline: "none",
39
+ border: "none",
40
+ borderWidth: 0,
41
+ fontWeight: 600,
42
+ lineHeight: 1,
43
+ });
44
+
45
+ export const avatarRecipes = recipe({
46
+ variants: {
47
+ size: {
48
+ sm: { width: tokenVars.spacing.lg, height: tokenVars.spacing.lg },
49
+ md: { width: tokenVars.spacing.xl, height: tokenVars.spacing.xl },
50
+ lg: { width: tokenVars.spacing.xxl, height: tokenVars.spacing.xxl },
51
+ xl: { width: tokenVars.spacing.xxxl, height: tokenVars.spacing.xxxl },
52
+ hero: { width: tokenVars.spacing.titanic, height: tokenVars.spacing.titanic },
53
+ },
54
+ radius: {
55
+ none: { borderRadius: 0 },
56
+ xs: { borderRadius: tokenVars.borderRadius.xs },
57
+ small: { borderRadius: tokenVars.borderRadius.sm },
58
+ medium: { borderRadius: tokenVars.borderRadius.md },
59
+ large: { borderRadius: tokenVars.borderRadius.lg },
60
+ xlarge: { borderRadius: tokenVars.borderRadius.xl },
61
+ xxlarge: { borderRadius: tokenVars.borderRadius.xxl },
62
+ full: { borderRadius: tokenVars.borderRadius.full },
63
+ },
64
+ },
65
+ });
@@ -0,0 +1,44 @@
1
+ import { Avatar as AvatarPrimitive, type AvatarRootProps } from "@base-ui/react/avatar";
2
+ import clsx from "clsx";
3
+ import { root, image, fallback, avatarRecipes } from "./avatar.css";
4
+ import type { RecipeVariants } from "@vanilla-extract/recipes";
5
+
6
+ type AvatarProps = AvatarRootProps &
7
+ RecipeVariants<typeof avatarRecipes> & {
8
+ className?: string;
9
+ style?: React.CSSProperties;
10
+ };
11
+
12
+ type AvatarImageProps = AvatarPrimitive.Image.Props & {
13
+ className?: string;
14
+ style?: React.CSSProperties;
15
+ };
16
+
17
+ type AvatarFallbackProps = AvatarPrimitive.Fallback.Props & {
18
+ className?: string;
19
+ style?: React.CSSProperties;
20
+ };
21
+
22
+ function Avatar({ children, size, radius: r, className, style }: AvatarProps) {
23
+ return (
24
+ <AvatarPrimitive.Root
25
+ className={clsx(root, avatarRecipes({ size, radius: r }), className)}
26
+ style={style}
27
+ >
28
+ {children}
29
+ </AvatarPrimitive.Root>
30
+ );
31
+ }
32
+
33
+ function AvatarImage({ className, style, ...props }: AvatarImageProps) {
34
+ return <AvatarPrimitive.Image className={clsx(image, className)} style={style} {...props} />;
35
+ }
36
+
37
+ function AvatarFallback({ className, style, ...props }: AvatarFallbackProps) {
38
+ return (
39
+ <AvatarPrimitive.Fallback className={clsx(fallback, className)} style={style} {...props} />
40
+ );
41
+ }
42
+
43
+ export type { AvatarFallbackProps, AvatarImageProps, AvatarProps };
44
+ export { Avatar, AvatarFallback, AvatarImage };
@@ -0,0 +1 @@
1
+ export * from "./avatar";
@@ -0,0 +1,180 @@
1
+ import { createVar, style } from "@vanilla-extract/css";
2
+ import { semanticVars, tokenVars } from "@blenx-dev/theme/contract";
3
+
4
+ export const badgeVars = {
5
+ bg: createVar(),
6
+ fg: createVar(),
7
+ borderColor: createVar(),
8
+ };
9
+
10
+ export const badgeBase = style({
11
+ display: "inline-block",
12
+ padding: tokenVars.spacing.xs,
13
+ borderRadius: tokenVars.borderRadius.default,
14
+ fontSize: 12,
15
+ lineHeight: 1.2,
16
+ border: "1px solid transparent",
17
+ });
18
+
19
+ export const badgeSolid = style({
20
+ backgroundColor: badgeVars.bg,
21
+ color: badgeVars.fg,
22
+ borderColor: badgeVars.borderColor,
23
+ });
24
+
25
+ export const badgeOutline = style({
26
+ backgroundColor: "transparent",
27
+ color: badgeVars.borderColor,
28
+ borderColor: badgeVars.borderColor,
29
+ });
30
+
31
+ export const badgeSoft = style({
32
+ backgroundColor: `color-mix(in srgb, ${badgeVars.bg} 25%, transparent)`,
33
+ color: badgeVars.fg,
34
+ borderColor: "transparent",
35
+ });
36
+
37
+ export const badgeDefault = style({
38
+ vars: {
39
+ [badgeVars.bg]: semanticVars.surface.raised,
40
+ [badgeVars.fg]: semanticVars.text.primary,
41
+ [badgeVars.borderColor]: semanticVars.border.default,
42
+ },
43
+ });
44
+
45
+ export const badgePrimary = style({
46
+ vars: {
47
+ [badgeVars.bg]: semanticVars.interactive.primary.default,
48
+ [badgeVars.fg]: semanticVars.interactive.primaryFg,
49
+ [badgeVars.borderColor]: semanticVars.interactive.primary.default,
50
+ },
51
+ });
52
+
53
+ export const badgeSecondary = style({
54
+ vars: {
55
+ [badgeVars.bg]: semanticVars.interactive.secondary.default,
56
+ [badgeVars.fg]: semanticVars.interactive.secondaryFg,
57
+ [badgeVars.borderColor]: semanticVars.interactive.secondary.default,
58
+ },
59
+ });
60
+
61
+ export const badgeSuccess = style({
62
+ vars: {
63
+ [badgeVars.bg]: semanticVars.status.success.default,
64
+ [badgeVars.fg]: semanticVars.text.inverse,
65
+ [badgeVars.borderColor]: semanticVars.status.success.default,
66
+ },
67
+ });
68
+
69
+ export const badgeDanger = style({
70
+ vars: {
71
+ [badgeVars.bg]: semanticVars.status.danger.default,
72
+ [badgeVars.fg]: semanticVars.text.inverse,
73
+ [badgeVars.borderColor]: semanticVars.status.danger.default,
74
+ },
75
+ });
76
+
77
+ import { recipe } from "@vanilla-extract/recipes";
78
+ export const badgeRecipe = recipe({
79
+ base: {
80
+ display: "inline-block",
81
+ padding: tokenVars.spacing.xs,
82
+ borderRadius: tokenVars.borderRadius.default,
83
+ fontSize: 12,
84
+ lineHeight: 1.2,
85
+ border: "1px solid transparent",
86
+ },
87
+
88
+ variants: {
89
+ appearance: {
90
+ solid: {},
91
+ soft: {
92
+ backgroundColor: "color-mix(in srgb, var(--badge-bg) 25%, transparent)",
93
+ },
94
+ outline: {
95
+ backgroundColor: "transparent",
96
+ },
97
+ },
98
+
99
+ variant: {
100
+ default: {
101
+ vars: {
102
+ [badgeVars.bg]: semanticVars.surface.raised,
103
+ [badgeVars.fg]: semanticVars.text.primary,
104
+ [badgeVars.borderColor]: semanticVars.border.default,
105
+ },
106
+ },
107
+
108
+ primary: {
109
+ vars: {
110
+ [badgeVars.bg]: semanticVars.interactive.primary.default,
111
+ [badgeVars.fg]: semanticVars.interactive.primaryFg,
112
+ [badgeVars.borderColor]: semanticVars.interactive.primary.default,
113
+ },
114
+ },
115
+
116
+ secondary: {
117
+ vars: {
118
+ [badgeVars.bg]: semanticVars.interactive.secondary.default,
119
+ [badgeVars.fg]: semanticVars.interactive.secondaryFg,
120
+ [badgeVars.borderColor]: semanticVars.interactive.secondary.default,
121
+ },
122
+ },
123
+
124
+ success: {
125
+ vars: {
126
+ [badgeVars.bg]: semanticVars.status.success.default,
127
+ [badgeVars.fg]: semanticVars.text.inverse,
128
+ [badgeVars.borderColor]: semanticVars.status.success.default,
129
+ },
130
+ },
131
+
132
+ danger: {
133
+ vars: {
134
+ [badgeVars.bg]: semanticVars.status.danger.default,
135
+ [badgeVars.fg]: semanticVars.text.inverse,
136
+ [badgeVars.borderColor]: semanticVars.status.danger.default,
137
+ },
138
+ },
139
+ },
140
+ },
141
+
142
+ compoundVariants: [
143
+ {
144
+ variants: {
145
+ appearance: "solid",
146
+ },
147
+ style: {
148
+ backgroundColor: badgeVars.bg,
149
+ color: badgeVars.fg,
150
+ borderColor: badgeVars.borderColor,
151
+ },
152
+ },
153
+
154
+ {
155
+ variants: {
156
+ appearance: "outline",
157
+ },
158
+ style: {
159
+ backgroundColor: "transparent",
160
+ color: badgeVars.borderColor,
161
+ borderColor: badgeVars.borderColor,
162
+ },
163
+ },
164
+
165
+ {
166
+ variants: {
167
+ appearance: "soft",
168
+ },
169
+ style: {
170
+ backgroundColor: `color-mix(in srgb, ${badgeVars.borderColor} 25%, transparent)`,
171
+ color: badgeVars.fg,
172
+ },
173
+ },
174
+ ],
175
+
176
+ defaultVariants: {
177
+ appearance: "solid",
178
+ variant: "default",
179
+ },
180
+ });