@nattstack/ui 0.0.1

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.
@@ -0,0 +1,95 @@
1
+ .button_spinner {
2
+ position: relative;
3
+ width: var(--size);
4
+ height: var(--size);
5
+ scale: -1 1;
6
+ animation: spinner 1000ms steps(12, end) infinite;
7
+ }
8
+
9
+ @keyframes spinner {
10
+ to {
11
+ rotate: 1turn;
12
+ }
13
+ }
14
+
15
+ .button_spinner > div {
16
+ position: absolute;
17
+ top: 50%;
18
+ right: 0;
19
+ width: calc(var(--size) / 2);
20
+ height: calc(var(--size) / 12);
21
+ pointer-events: none;
22
+ transform-origin: center left;
23
+ translate: 0 -50%;
24
+ transition: all 150ms;
25
+ }
26
+
27
+ .button_spinner > div::after {
28
+ position: absolute;
29
+ right: 0;
30
+ width: 50%;
31
+ height: 100%;
32
+ content: "";
33
+ background-color: currentColor;
34
+ border-radius: 9999px;
35
+ }
36
+
37
+ .button_spinner > div:nth-child(1) {
38
+ opacity: 1;
39
+ rotate: 0deg;
40
+ }
41
+
42
+ .button_spinner > div:nth-child(2) {
43
+ opacity: 0.925;
44
+ rotate: 30deg;
45
+ }
46
+
47
+ .button_spinner > div:nth-child(3) {
48
+ opacity: 0.85;
49
+ rotate: 60deg;
50
+ }
51
+
52
+ .button_spinner > div:nth-child(4) {
53
+ opacity: 0.775;
54
+ rotate: 90deg;
55
+ }
56
+
57
+ .button_spinner > div:nth-child(5) {
58
+ opacity: 0.7;
59
+ rotate: 120deg;
60
+ }
61
+
62
+ .button_spinner > div:nth-child(6) {
63
+ opacity: 0.625;
64
+ rotate: 150deg;
65
+ }
66
+
67
+ .button_spinner > div:nth-child(7) {
68
+ opacity: 0.55;
69
+ rotate: 180deg;
70
+ }
71
+
72
+ .button_spinner > div:nth-child(8) {
73
+ opacity: 0.475;
74
+ rotate: 210deg;
75
+ }
76
+
77
+ .button_spinner > div:nth-child(9) {
78
+ opacity: 0.4;
79
+ rotate: 240deg;
80
+ }
81
+
82
+ .button_spinner > div:nth-child(10) {
83
+ opacity: 0.325;
84
+ rotate: 270deg;
85
+ }
86
+
87
+ .button_spinner > div:nth-child(11) {
88
+ opacity: 0.25;
89
+ rotate: 300deg;
90
+ }
91
+
92
+ .button_spinner > div:nth-child(12) {
93
+ opacity: 0.15;
94
+ rotate: 330deg;
95
+ }
@@ -0,0 +1,209 @@
1
+ /* ===================================================== */
2
+ /* Base */
3
+ /* ===================================================== */
4
+ .button {
5
+ align-items: safe center;
6
+ border-style: none;
7
+ column-gap: 8px;
8
+ cursor: pointer;
9
+ display: flex;
10
+ flex-shrink: 0;
11
+ font-family: var(--font-sans, sans-serif);
12
+ font-size: 14px;
13
+ font-weight: 500;
14
+ height: var(--size);
15
+ justify-content: safe center;
16
+ line-height: 1.5;
17
+ outline-color: var(--color-primary-9);
18
+ outline-offset: 2px;
19
+ outline-style: solid;
20
+ outline-width: 0px;
21
+ overflow: hidden;
22
+ transition-duration: 150ms;
23
+ transition-property: background-color, box-shadow, opacity, translate;
24
+ user-select: none;
25
+ }
26
+
27
+ /* When pressed, move the button down */
28
+ .button:active:not(:disabled),
29
+ .button[aria-pressed="true"]:not(:disabled) {
30
+ translate: 0 1px;
31
+ }
32
+
33
+ /* When disabled, disable cursor and reduce opacity */
34
+ .button:disabled {
35
+ cursor: not-allowed;
36
+ opacity: 0.5;
37
+ }
38
+
39
+ /* When keyboard focused, show outline */
40
+ .button:focus-visible {
41
+ outline-width: 2px;
42
+ }
43
+
44
+ /* ===================================================== */
45
+ /* Icon only */
46
+ /* ===================================================== */
47
+ .button__icon_only {
48
+ width: var(--size) !important;
49
+ padding: 0 !important;
50
+ }
51
+
52
+ /* ===================================================== */
53
+ /* Rounded */
54
+ /* ===================================================== */
55
+ .button__rounded_base {
56
+ border-radius: 12px;
57
+ }
58
+
59
+ .button__rounded_full {
60
+ border-radius: 9999px !important;
61
+ }
62
+
63
+ /* ===================================================== */
64
+ /* Size */
65
+ /* ===================================================== */
66
+ .button__size_32 {
67
+ --size: 32px;
68
+ padding: 0 10px;
69
+ border-radius: 8px;
70
+ }
71
+
72
+ .button__size_36 {
73
+ --size: 36px;
74
+ padding: 0 12px;
75
+ border-radius: 10px;
76
+ }
77
+
78
+ .button__size_40 {
79
+ --size: 40px;
80
+ padding: 0 14px;
81
+ border-radius: 12px;
82
+ }
83
+
84
+ .button__size_44 {
85
+ --size: 44px;
86
+ padding: 0 16px;
87
+ border-radius: 14px;
88
+ }
89
+
90
+ .button__size_48 {
91
+ --size: 48px;
92
+ padding: 0 18px;
93
+ border-radius: 16px;
94
+ }
95
+
96
+ /* ===================================================== */
97
+ /* Variant */
98
+ /* ===================================================== */
99
+ /* Accent */
100
+ .button__variant_accent {
101
+ color: var(--color-white);
102
+ background-color: var(--color-primary-9);
103
+ background-image: linear-gradient(
104
+ to bottom,
105
+ color-mix(in oklab, transparent 100%, #ffffff 5%) 50%,
106
+ color-mix(in oklab, transparent 100%, #ffffff 0%) 50%
107
+ );
108
+ }
109
+
110
+ .button__variant_accent:active:not(:disabled),
111
+ .button__variant_accent:hover:not(:disabled),
112
+ .button__variant_accent[aria-pressed="true"]:not(:disabled) {
113
+ background-color: color-mix(in oklab, var(--color-primary-9) 100%, #ffffff 10%);
114
+ }
115
+
116
+ :global(.dark) .button__variant_accent {
117
+ background-image: linear-gradient(
118
+ to bottom,
119
+ color-mix(in oklab, transparent 100%, #000000 0%) 50%,
120
+ color-mix(in oklab, transparent 100%, #000000 5%) 50%
121
+ );
122
+ }
123
+
124
+ /* Ghost */
125
+ .button__variant_ghost {
126
+ color: var(--color-black);
127
+ background-color: transparent;
128
+ }
129
+
130
+ .button__variant_ghost:active:not(:disabled),
131
+ .button__variant_ghost:hover:not(:disabled),
132
+ .button__variant_ghost[aria-pressed="true"]:not(:disabled) {
133
+ background-color: var(--color-gray-3);
134
+ }
135
+
136
+ :global(.dark) .button__variant_ghost {
137
+ color: var(--color-white);
138
+ }
139
+
140
+ /* Primary */
141
+ .button__variant_primary {
142
+ color: var(--color-white);
143
+ background-color: var(--color-gray-dark-1);
144
+ background-image: linear-gradient(
145
+ to bottom,
146
+ color-mix(in oklab, transparent 100%, #ffffff 2.5%) 50%,
147
+ color-mix(in oklab, transparent 100%, #ffffff 0%) 50%
148
+ );
149
+ }
150
+
151
+ .button__variant_primary:active:not(:disabled),
152
+ .button__variant_primary:hover:not(:disabled),
153
+ .button__variant_primary[aria-pressed="true"]:not(:disabled) {
154
+ background-color: color-mix(in oklab, var(--color-gray-dark-2) 100%, #ffffff 10%);
155
+ }
156
+
157
+ :global(.dark) .button__variant_primary {
158
+ color: var(--color-black);
159
+ background-color: var(--color-gray-light-1);
160
+ background-image: linear-gradient(
161
+ to bottom,
162
+ color-mix(in oklab, transparent 100%, #000000 0%) 50%,
163
+ color-mix(in oklab, transparent 100%, #000000 5%) 50%
164
+ );
165
+ }
166
+
167
+ :global(.dark) .button__variant_primary:active:not(:disabled),
168
+ :global(.dark) .button__variant_primary:hover:not(:disabled),
169
+ :global(.dark) .button__variant_primary[aria-pressed="true"]:not(:disabled) {
170
+ background-color: color-mix(in oklab, var(--color-gray-light-2) 100%, #000000 10%);
171
+ }
172
+
173
+ /* Secondary */
174
+ .button__variant_secondary {
175
+ color: var(--color-black);
176
+ background-color: var(--color-gray-2);
177
+ background-image: linear-gradient(
178
+ to bottom,
179
+ color-mix(in oklab, transparent 100%, #000000 0%) 50%,
180
+ color-mix(in oklab, transparent 100%, #000000 2%) 50%
181
+ );
182
+ box-shadow: 0 0 0 1px var(--color-gray-4) inset;
183
+ }
184
+
185
+ .button__variant_secondary:active:not(:disabled),
186
+ .button__variant_secondary:hover:not(:disabled),
187
+ .button__variant_secondary[aria-pressed="true"]:not(:disabled) {
188
+ background-color: var(--color-gray-3);
189
+ }
190
+
191
+ :global(.dark) .button__variant_secondary {
192
+ color: var(--color-white);
193
+ background-image: linear-gradient(
194
+ to bottom,
195
+ color-mix(in oklab, transparent 100%, #ffffff 1%) 50%,
196
+ color-mix(in oklab, transparent 100%, #ffffff 0%) 50%
197
+ );
198
+ }
199
+
200
+ /* ===================================================== */
201
+ /* Width */
202
+ /* ===================================================== */
203
+ .button__width_base {
204
+ width: max-content; /* Fit the button content */
205
+ }
206
+
207
+ .button__width_full {
208
+ width: 100%;
209
+ }
@@ -0,0 +1,4 @@
1
+ .column {
2
+ display: flex;
3
+ flex-direction: column;
4
+ }
@@ -0,0 +1,250 @@
1
+ import { ComponentProps, ReactNode, JSX, ElementType, CSSProperties } from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import { Switch as Switch$1, Tabs as Tabs$1, Tooltip as Tooltip$1 } from '@base-ui/react';
4
+
5
+ interface ButtonIconProps extends ButtonInternalProps {
6
+ children?: ReactNode;
7
+ iconEnd?: never;
8
+ iconStart?: never;
9
+ isIconOnly: true;
10
+ }
11
+ interface ButtonProps extends ButtonInternalProps {
12
+ children?: string | string[];
13
+ isIconOnly?: false;
14
+ }
15
+ interface ButtonInternalProps extends Omit<ComponentProps<"button">, "aria-pressed" | "disabled"> {
16
+ iconEnd?: ReactNode;
17
+ iconStart?: ReactNode;
18
+ isActive?: boolean;
19
+ isDisabled?: boolean;
20
+ isFullWidth?: boolean;
21
+ isIconOnly?: boolean;
22
+ isLoading?: boolean;
23
+ isRounded?: boolean;
24
+ size?: 32 | 36 | 40 | 44 | 48;
25
+ variant?: "accent" | "ghost" | "primary" | "secondary";
26
+ }
27
+ type ButtonUnionProps = ButtonIconProps | ButtonProps;
28
+ declare function Button(props: ButtonUnionProps): JSX.Element;
29
+ declare const BUTTON_CLASS_NAME: {
30
+ readonly BASE: string;
31
+ readonly ICON_ONLY: string;
32
+ readonly ROUNDED: {
33
+ readonly BASE: string;
34
+ readonly FULL: string;
35
+ };
36
+ readonly SIZE: {
37
+ readonly 32: string;
38
+ readonly 36: string;
39
+ readonly 40: string;
40
+ readonly 44: string;
41
+ readonly 48: string;
42
+ };
43
+ readonly VARIANT: {
44
+ readonly ACCENT: string;
45
+ readonly GHOST: string;
46
+ readonly PRIMARY: string;
47
+ readonly SECONDARY: string;
48
+ };
49
+ readonly WIDTH: {
50
+ readonly BASE: string;
51
+ readonly FULL: string;
52
+ };
53
+ };
54
+
55
+ type ButtonLinkProps<ComponentType extends ElementType = "a"> = ButtonLinkInternalProps & ComponentProps<ComponentType>;
56
+ interface ButtonLinkInternalProps extends Pick<ButtonProps, "isFullWidth" | "isIconOnly" | "isRounded" | "size" | "variant"> {
57
+ as?: ElementType;
58
+ }
59
+ declare function ButtonLink<ComponentType extends ElementType = "a">(props: ButtonLinkProps<ComponentType>): JSX.Element;
60
+
61
+ type ColumnProps<ComponentType extends ElementType = "div"> = ColumnInternalProps & ComponentProps<ComponentType>;
62
+ interface ColumnInternalProps {
63
+ alignItems?: CSSProperties["alignItems"];
64
+ as?: keyof JSX.IntrinsicElements;
65
+ flexWrap?: CSSProperties["flexWrap"];
66
+ gap?: CSSProperties["gap"];
67
+ gapX?: CSSProperties["columnGap"];
68
+ gapY?: CSSProperties["rowGap"];
69
+ justifyContent?: CSSProperties["justifyContent"];
70
+ }
71
+ declare function Column(props: ColumnProps): JSX.Element;
72
+ declare const COLUMN_CLASS_NAME: {
73
+ readonly BASE: string;
74
+ };
75
+
76
+ interface InputProps extends Omit<ComponentProps<"input">, "aria-pressed" | "disabled" | "readOnly" | "required"> {
77
+ isActive?: boolean;
78
+ isDisabled?: boolean;
79
+ isInvalid?: boolean;
80
+ isReadOnly?: boolean;
81
+ isRequired?: boolean;
82
+ isRounded?: boolean;
83
+ isValid?: boolean;
84
+ size?: 32 | 36 | 40 | 44 | 48;
85
+ }
86
+ declare function Input(props: InputProps): JSX.Element;
87
+ declare const INPUT_CLASS_NAME: {
88
+ readonly BASE: string;
89
+ readonly PASSWORD: string;
90
+ readonly ROUNDED: {
91
+ readonly BASE: string;
92
+ readonly FULL: string;
93
+ };
94
+ readonly SIZE: {
95
+ readonly 32: string;
96
+ readonly 36: string;
97
+ readonly 40: string;
98
+ readonly 44: string;
99
+ readonly 48: string;
100
+ };
101
+ };
102
+
103
+ interface LabelProps extends ComponentProps<"label"> {
104
+ }
105
+ declare function Label(props: LabelProps): JSX.Element;
106
+ declare const LABEL_CLASS_NAME: {
107
+ readonly BASE: string;
108
+ };
109
+
110
+ type RowProps<ComponentType extends ElementType = "div"> = ComponentProps<ComponentType> & RowInternalProps;
111
+ interface RowInternalProps {
112
+ alignItems?: CSSProperties["alignItems"];
113
+ as?: keyof JSX.IntrinsicElements;
114
+ flexWrap?: CSSProperties["flexWrap"];
115
+ gap?: CSSProperties["gap"];
116
+ gapX?: CSSProperties["columnGap"];
117
+ gapY?: CSSProperties["rowGap"];
118
+ justifyContent?: CSSProperties["justifyContent"];
119
+ }
120
+ declare function Row(props: RowProps): JSX.Element;
121
+ declare const ROW_CLASS_NAME: {
122
+ readonly BASE: string;
123
+ };
124
+
125
+ interface SpacerProps extends Omit<ComponentProps<"div">, "children"> {
126
+ height?: CSSProperties["height"];
127
+ width?: CSSProperties["width"];
128
+ }
129
+ declare function Spacer(props: SpacerProps): react_jsx_runtime.JSX.Element;
130
+ declare const SPACER_CLASS_NAME: {
131
+ readonly BASE: string;
132
+ };
133
+
134
+ interface SwitchProps extends Omit<ComponentProps<typeof Switch$1.Root>, "checked" | "defaultChecked" | "disabled" | "nativeButton" | "readOnly" | "required"> {
135
+ isChecked?: boolean;
136
+ isDefaultChecked?: boolean;
137
+ isDisabled?: boolean;
138
+ isReadOnly?: boolean;
139
+ isRequired?: boolean;
140
+ size?: 18 | 24;
141
+ }
142
+ declare function Switch(props: SwitchProps): JSX.Element;
143
+ declare const SWITCH_CLASS_NAME: {
144
+ readonly BASE: string;
145
+ readonly SIZE: {
146
+ readonly 18: string;
147
+ readonly 24: string;
148
+ };
149
+ };
150
+
151
+ interface TabsPillListProps extends Tabs$1.List.Props {
152
+ }
153
+ declare function TabsPillList(props: TabsPillListProps): react_jsx_runtime.JSX.Element;
154
+ declare const TABS_PILL_LIST_CLASS_NAME: {
155
+ readonly BASE: string;
156
+ };
157
+
158
+ interface TabsPillTabProps extends Omit<Tabs$1.Tab.Props, "nativeButton"> {
159
+ isNativeButton?: Tabs$1.Tab.Props["nativeButton"];
160
+ }
161
+ declare function TabsPillTab(props: TabsPillTabProps): react_jsx_runtime.JSX.Element;
162
+ declare const TABS_PILL_TAB_CLASS_NAME: {
163
+ readonly BACKGROUND: string;
164
+ readonly BASE: string;
165
+ readonly WRAPPER: string;
166
+ };
167
+
168
+ interface TabsSegmentedListProps extends Tabs$1.List.Props {
169
+ }
170
+ declare function TabsSegmentedList(props: TabsSegmentedListProps): react_jsx_runtime.JSX.Element;
171
+ declare const TABS_SEGMENTED_LIST_CLASS_NAME: {
172
+ readonly BASE: string;
173
+ };
174
+
175
+ interface TabsSegmentedTabProps extends Omit<Tabs$1.Tab.Props, "nativeButton"> {
176
+ isNativeButton?: Tabs$1.Tab.Props["nativeButton"];
177
+ }
178
+ declare function TabsSegmentedTab(props: TabsSegmentedTabProps): react_jsx_runtime.JSX.Element;
179
+ declare const TABS_SEGMENTED_TAB_CLASS_NAME: {
180
+ readonly BASE: string;
181
+ };
182
+
183
+ interface TabsUnderlineListProps extends Tabs$1.List.Props {
184
+ }
185
+ declare function TabsUnderlineList(props: TabsUnderlineListProps): react_jsx_runtime.JSX.Element;
186
+ declare const TABS_UNDERLINE_LIST_CLASS_NAME: {
187
+ readonly BASE: string;
188
+ };
189
+
190
+ interface TabsUnderlineTabProps extends Omit<Tabs$1.Tab.Props, "nativeButton"> {
191
+ isNativeButton?: Tabs$1.Tab.Props["nativeButton"];
192
+ }
193
+ declare function TabsUnderlineTab(props: TabsUnderlineTabProps): react_jsx_runtime.JSX.Element;
194
+ declare const TABS_UNDERLINE_TAB_CLASS_NAME: {
195
+ readonly BASE: string;
196
+ };
197
+
198
+ interface TabsProps extends Tabs$1.Root.Props {
199
+ }
200
+ declare function Tabs(props: TabsProps): react_jsx_runtime.JSX.Element;
201
+ declare const TABS_CLASS_NAME: {
202
+ readonly BASE: string;
203
+ };
204
+
205
+ interface TabsPanelProps extends Tabs$1.Panel.Props {
206
+ }
207
+ declare function TabsPanel(props: TabsPanelProps): react_jsx_runtime.JSX.Element;
208
+ declare const TABS_PANEL_CLASS_NAME: {
209
+ readonly BASE: string;
210
+ };
211
+
212
+ interface TextareaProps extends Omit<ComponentProps<"textarea">, "aria-pressed" | "disabled" | "readOnly" | "required"> {
213
+ isActive?: boolean;
214
+ isDisabled?: boolean;
215
+ isInvalid?: boolean;
216
+ isReadOnly?: boolean;
217
+ isRequired?: boolean;
218
+ isRounded?: boolean;
219
+ isValid?: boolean;
220
+ }
221
+ declare function Textarea(props: TextareaProps): JSX.Element;
222
+ declare const TEXTAREA_CLASS_NAME: {
223
+ readonly BASE: string;
224
+ readonly INPUT: string;
225
+ readonly ROUNDED: {
226
+ readonly BASE: string;
227
+ readonly FULL: string;
228
+ };
229
+ };
230
+
231
+ interface TooltipProps extends Tooltip$1.Root.Props {
232
+ }
233
+ declare function Tooltip(props: TooltipProps): react_jsx_runtime.JSX.Element;
234
+
235
+ interface TooltipContentProps extends Pick<Tooltip$1.Positioner.Props, "side">, Tooltip$1.Popup.Props {
236
+ }
237
+ declare function TooltipContent(props: TooltipContentProps): react_jsx_runtime.JSX.Element;
238
+ declare const TOOLTIP_CONTENT_CLASS_NAME: {
239
+ readonly BASE: string;
240
+ };
241
+
242
+ interface TooltipProviderProps extends Tooltip$1.Provider.Props {
243
+ }
244
+ declare function TooltipProvider(props: TooltipProviderProps): react_jsx_runtime.JSX.Element;
245
+
246
+ interface TooltipTriggerProps extends Tooltip$1.Trigger.Props {
247
+ }
248
+ declare function TooltipTrigger(props: TooltipTriggerProps): react_jsx_runtime.JSX.Element;
249
+
250
+ export { BUTTON_CLASS_NAME, Button, type ButtonIconProps, ButtonLink, type ButtonLinkProps, type ButtonProps, COLUMN_CLASS_NAME, Column, type ColumnProps, INPUT_CLASS_NAME, Input, type InputProps, LABEL_CLASS_NAME, Label, type LabelProps, ROW_CLASS_NAME, Row, type RowProps, SPACER_CLASS_NAME, SWITCH_CLASS_NAME, Spacer, type SpacerProps, Switch, type SwitchProps, TABS_CLASS_NAME, TABS_PANEL_CLASS_NAME, TABS_PILL_LIST_CLASS_NAME, TABS_PILL_TAB_CLASS_NAME, TABS_SEGMENTED_LIST_CLASS_NAME, TABS_SEGMENTED_TAB_CLASS_NAME, TABS_UNDERLINE_LIST_CLASS_NAME, TABS_UNDERLINE_TAB_CLASS_NAME, TEXTAREA_CLASS_NAME, TOOLTIP_CONTENT_CLASS_NAME, Tabs, TabsPanel, type TabsPanelProps, TabsPillList, type TabsPillListProps, TabsPillTab, type TabsPillTabProps, type TabsProps, TabsSegmentedList, type TabsSegmentedListProps, TabsSegmentedTab, type TabsSegmentedTabProps, TabsUnderlineList, type TabsUnderlineListProps, TabsUnderlineTab, type TabsUnderlineTabProps, Textarea, type TextareaProps, Tooltip, TooltipContent, type TooltipContentProps, type TooltipProps, TooltipProvider, type TooltipProviderProps, TooltipTrigger, type TooltipTriggerProps };