@dafaz-ui/react 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,18 @@
1
+
2
+ > @dafaz-ui/react@2.0.0 build
3
+ > tsup src/index.tsx --format esm,cjs --dts --external react
4
+
5
+ CLI Building entry: src/index.tsx
6
+ CLI Using tsconfig: tsconfig.json
7
+ CLI tsup v8.3.5
8
+ CLI Target: es6
9
+ ESM Build start
10
+ CJS Build start
11
+ CJS dist\index.js 4.71 KB
12
+ CJS ⚡️ Build success in 100ms
13
+ ESM dist\index.mjs 3.80 KB
14
+ ESM ⚡️ Build success in 101ms
15
+ DTS Build start
16
+ DTS ⚡️ Build success in 2091ms
17
+ DTS dist\index.d.mts 5.90 KB
18
+ DTS dist\index.d.ts 5.90 KB
package/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # @dafaz-ui/react
2
+
3
+ ## 2.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - Add display name to button
@@ -0,0 +1,223 @@
1
+ import * as _stitches_react_types_styled_component from '@stitches/react/types/styled-component';
2
+ import * as _stitches_react_types_css_util from '@stitches/react/types/css-util';
3
+ import { ComponentProps } from '@stitches/react';
4
+ import { ElementType } from 'react';
5
+
6
+ /** Primary UI component for user interaction */
7
+ declare const Button: _stitches_react_types_styled_component.StyledComponent<"button", {
8
+ variant?: "primary" | "secondary" | "tertiary" | undefined;
9
+ size?: "sm" | "md" | undefined;
10
+ }, {}, _stitches_react_types_css_util.CSS<{}, {
11
+ colors: {
12
+ white: string;
13
+ black: string;
14
+ gray100: string;
15
+ gray200: string;
16
+ gray400: string;
17
+ gray800: string;
18
+ dafaz100: string;
19
+ dafaz200: string;
20
+ dafaz400: string;
21
+ dafaz600: string;
22
+ dafaz800: string;
23
+ };
24
+ fontSizes: {
25
+ xxs: string;
26
+ xs: string;
27
+ sm: string;
28
+ md: string;
29
+ lg: string;
30
+ xl: string;
31
+ '2xl': string;
32
+ };
33
+ fontWeights: {
34
+ regular: string;
35
+ medium: string;
36
+ bold: string;
37
+ };
38
+ fonts: {
39
+ default: string;
40
+ app: string;
41
+ web: string;
42
+ offer: string;
43
+ code: string;
44
+ };
45
+ lineHeights: {
46
+ shorter: string;
47
+ short: string;
48
+ base: string;
49
+ tall: string;
50
+ };
51
+ radii: {
52
+ px: string;
53
+ sm: string;
54
+ md: string;
55
+ full: string;
56
+ };
57
+ space: {
58
+ 1: string;
59
+ 2: string;
60
+ 3: string;
61
+ 4: string;
62
+ 5: string;
63
+ 6: string;
64
+ 7: string;
65
+ 8: string;
66
+ 10: string;
67
+ 12: string;
68
+ 16: string;
69
+ 20: string;
70
+ 40: string;
71
+ 64: string;
72
+ 80: string;
73
+ };
74
+ opacities: {
75
+ opacity400: string;
76
+ opacity600: string;
77
+ opacity800: string;
78
+ opacity900: string;
79
+ };
80
+ }, {
81
+ height: "space";
82
+ width: "space";
83
+ gap: "space";
84
+ gridGap: "space";
85
+ columnGap: "space";
86
+ gridColumnGap: "space";
87
+ rowGap: "space";
88
+ gridRowGap: "space";
89
+ inset: "space";
90
+ insetBlock: "space";
91
+ insetBlockEnd: "space";
92
+ insetBlockStart: "space";
93
+ insetInline: "space";
94
+ insetInlineEnd: "space";
95
+ insetInlineStart: "space";
96
+ margin: "space";
97
+ marginTop: "space";
98
+ marginRight: "space";
99
+ marginBottom: "space";
100
+ marginLeft: "space";
101
+ marginBlock: "space";
102
+ marginBlockEnd: "space";
103
+ marginBlockStart: "space";
104
+ marginInline: "space";
105
+ marginInlineEnd: "space";
106
+ marginInlineStart: "space";
107
+ padding: "space";
108
+ paddingTop: "space";
109
+ paddingRight: "space";
110
+ paddingBottom: "space";
111
+ paddingLeft: "space";
112
+ paddingBlock: "space";
113
+ paddingBlockEnd: "space";
114
+ paddingBlockStart: "space";
115
+ paddingInline: "space";
116
+ paddingInlineEnd: "space";
117
+ paddingInlineStart: "space";
118
+ scrollMargin: "space";
119
+ scrollMarginTop: "space";
120
+ scrollMarginRight: "space";
121
+ scrollMarginBottom: "space";
122
+ scrollMarginLeft: "space";
123
+ scrollMarginBlock: "space";
124
+ scrollMarginBlockEnd: "space";
125
+ scrollMarginBlockStart: "space";
126
+ scrollMarginInline: "space";
127
+ scrollMarginInlineEnd: "space";
128
+ scrollMarginInlineStart: "space";
129
+ scrollPadding: "space";
130
+ scrollPaddingTop: "space";
131
+ scrollPaddingRight: "space";
132
+ scrollPaddingBottom: "space";
133
+ scrollPaddingLeft: "space";
134
+ scrollPaddingBlock: "space";
135
+ scrollPaddingBlockEnd: "space";
136
+ scrollPaddingBlockStart: "space";
137
+ scrollPaddingInline: "space";
138
+ scrollPaddingInlineEnd: "space";
139
+ scrollPaddingInlineStart: "space";
140
+ top: "space";
141
+ right: "space";
142
+ bottom: "space";
143
+ left: "space";
144
+ fontSize: "fontSizes";
145
+ background: "colors";
146
+ backgroundColor: "colors";
147
+ backgroundImage: "colors";
148
+ borderImage: "colors";
149
+ border: "colors";
150
+ borderBlock: "colors";
151
+ borderBlockEnd: "colors";
152
+ borderBlockStart: "colors";
153
+ borderBottom: "colors";
154
+ borderBottomColor: "colors";
155
+ borderColor: "colors";
156
+ borderInline: "colors";
157
+ borderInlineEnd: "colors";
158
+ borderInlineStart: "colors";
159
+ borderLeft: "colors";
160
+ borderLeftColor: "colors";
161
+ borderRight: "colors";
162
+ borderRightColor: "colors";
163
+ borderTop: "colors";
164
+ borderTopColor: "colors";
165
+ caretColor: "colors";
166
+ color: "colors";
167
+ columnRuleColor: "colors";
168
+ outline: "colors";
169
+ outlineColor: "colors";
170
+ fill: "colors";
171
+ stroke: "colors";
172
+ textDecorationColor: "colors";
173
+ fontFamily: "fonts";
174
+ fontWeight: "fontWeights";
175
+ lineHeight: "lineHeights";
176
+ letterSpacing: "letterSpacings";
177
+ blockSize: "sizes";
178
+ minBlockSize: "sizes";
179
+ maxBlockSize: "sizes";
180
+ inlineSize: "sizes";
181
+ minInlineSize: "sizes";
182
+ maxInlineSize: "sizes";
183
+ minWidth: "sizes";
184
+ maxWidth: "sizes";
185
+ minHeight: "sizes";
186
+ maxHeight: "sizes";
187
+ flexBasis: "sizes";
188
+ gridTemplateColumns: "sizes";
189
+ gridTemplateRows: "sizes";
190
+ borderWidth: "borderWidths";
191
+ borderTopWidth: "borderWidths";
192
+ borderLeftWidth: "borderWidths";
193
+ borderRightWidth: "borderWidths";
194
+ borderBottomWidth: "borderWidths";
195
+ borderStyle: "borderStyles";
196
+ borderTopStyle: "borderStyles";
197
+ borderLeftStyle: "borderStyles";
198
+ borderRightStyle: "borderStyles";
199
+ borderBottomStyle: "borderStyles";
200
+ borderRadius: "radii";
201
+ borderTopLeftRadius: "radii";
202
+ borderTopRightRadius: "radii";
203
+ borderBottomRightRadius: "radii";
204
+ borderBottomLeftRadius: "radii";
205
+ boxShadow: "shadows";
206
+ textShadow: "shadows";
207
+ transition: "transitions";
208
+ zIndex: "zIndices";
209
+ }, {}>>;
210
+ interface ButtonProps extends ComponentProps<typeof Button> {
211
+ as?: ElementType;
212
+ /** How large should the button be? */
213
+ size?: 'sm' | 'md';
214
+ /** Optional click handler */
215
+ onClick?: () => void;
216
+ /** Button contents */
217
+ label: string;
218
+ /** Button is disable? */
219
+ disabled?: boolean;
220
+ variant?: 'primary' | 'secondary' | 'tertiary';
221
+ }
222
+
223
+ export { Button, type ButtonProps };
@@ -0,0 +1,223 @@
1
+ import * as _stitches_react_types_styled_component from '@stitches/react/types/styled-component';
2
+ import * as _stitches_react_types_css_util from '@stitches/react/types/css-util';
3
+ import { ComponentProps } from '@stitches/react';
4
+ import { ElementType } from 'react';
5
+
6
+ /** Primary UI component for user interaction */
7
+ declare const Button: _stitches_react_types_styled_component.StyledComponent<"button", {
8
+ variant?: "primary" | "secondary" | "tertiary" | undefined;
9
+ size?: "sm" | "md" | undefined;
10
+ }, {}, _stitches_react_types_css_util.CSS<{}, {
11
+ colors: {
12
+ white: string;
13
+ black: string;
14
+ gray100: string;
15
+ gray200: string;
16
+ gray400: string;
17
+ gray800: string;
18
+ dafaz100: string;
19
+ dafaz200: string;
20
+ dafaz400: string;
21
+ dafaz600: string;
22
+ dafaz800: string;
23
+ };
24
+ fontSizes: {
25
+ xxs: string;
26
+ xs: string;
27
+ sm: string;
28
+ md: string;
29
+ lg: string;
30
+ xl: string;
31
+ '2xl': string;
32
+ };
33
+ fontWeights: {
34
+ regular: string;
35
+ medium: string;
36
+ bold: string;
37
+ };
38
+ fonts: {
39
+ default: string;
40
+ app: string;
41
+ web: string;
42
+ offer: string;
43
+ code: string;
44
+ };
45
+ lineHeights: {
46
+ shorter: string;
47
+ short: string;
48
+ base: string;
49
+ tall: string;
50
+ };
51
+ radii: {
52
+ px: string;
53
+ sm: string;
54
+ md: string;
55
+ full: string;
56
+ };
57
+ space: {
58
+ 1: string;
59
+ 2: string;
60
+ 3: string;
61
+ 4: string;
62
+ 5: string;
63
+ 6: string;
64
+ 7: string;
65
+ 8: string;
66
+ 10: string;
67
+ 12: string;
68
+ 16: string;
69
+ 20: string;
70
+ 40: string;
71
+ 64: string;
72
+ 80: string;
73
+ };
74
+ opacities: {
75
+ opacity400: string;
76
+ opacity600: string;
77
+ opacity800: string;
78
+ opacity900: string;
79
+ };
80
+ }, {
81
+ height: "space";
82
+ width: "space";
83
+ gap: "space";
84
+ gridGap: "space";
85
+ columnGap: "space";
86
+ gridColumnGap: "space";
87
+ rowGap: "space";
88
+ gridRowGap: "space";
89
+ inset: "space";
90
+ insetBlock: "space";
91
+ insetBlockEnd: "space";
92
+ insetBlockStart: "space";
93
+ insetInline: "space";
94
+ insetInlineEnd: "space";
95
+ insetInlineStart: "space";
96
+ margin: "space";
97
+ marginTop: "space";
98
+ marginRight: "space";
99
+ marginBottom: "space";
100
+ marginLeft: "space";
101
+ marginBlock: "space";
102
+ marginBlockEnd: "space";
103
+ marginBlockStart: "space";
104
+ marginInline: "space";
105
+ marginInlineEnd: "space";
106
+ marginInlineStart: "space";
107
+ padding: "space";
108
+ paddingTop: "space";
109
+ paddingRight: "space";
110
+ paddingBottom: "space";
111
+ paddingLeft: "space";
112
+ paddingBlock: "space";
113
+ paddingBlockEnd: "space";
114
+ paddingBlockStart: "space";
115
+ paddingInline: "space";
116
+ paddingInlineEnd: "space";
117
+ paddingInlineStart: "space";
118
+ scrollMargin: "space";
119
+ scrollMarginTop: "space";
120
+ scrollMarginRight: "space";
121
+ scrollMarginBottom: "space";
122
+ scrollMarginLeft: "space";
123
+ scrollMarginBlock: "space";
124
+ scrollMarginBlockEnd: "space";
125
+ scrollMarginBlockStart: "space";
126
+ scrollMarginInline: "space";
127
+ scrollMarginInlineEnd: "space";
128
+ scrollMarginInlineStart: "space";
129
+ scrollPadding: "space";
130
+ scrollPaddingTop: "space";
131
+ scrollPaddingRight: "space";
132
+ scrollPaddingBottom: "space";
133
+ scrollPaddingLeft: "space";
134
+ scrollPaddingBlock: "space";
135
+ scrollPaddingBlockEnd: "space";
136
+ scrollPaddingBlockStart: "space";
137
+ scrollPaddingInline: "space";
138
+ scrollPaddingInlineEnd: "space";
139
+ scrollPaddingInlineStart: "space";
140
+ top: "space";
141
+ right: "space";
142
+ bottom: "space";
143
+ left: "space";
144
+ fontSize: "fontSizes";
145
+ background: "colors";
146
+ backgroundColor: "colors";
147
+ backgroundImage: "colors";
148
+ borderImage: "colors";
149
+ border: "colors";
150
+ borderBlock: "colors";
151
+ borderBlockEnd: "colors";
152
+ borderBlockStart: "colors";
153
+ borderBottom: "colors";
154
+ borderBottomColor: "colors";
155
+ borderColor: "colors";
156
+ borderInline: "colors";
157
+ borderInlineEnd: "colors";
158
+ borderInlineStart: "colors";
159
+ borderLeft: "colors";
160
+ borderLeftColor: "colors";
161
+ borderRight: "colors";
162
+ borderRightColor: "colors";
163
+ borderTop: "colors";
164
+ borderTopColor: "colors";
165
+ caretColor: "colors";
166
+ color: "colors";
167
+ columnRuleColor: "colors";
168
+ outline: "colors";
169
+ outlineColor: "colors";
170
+ fill: "colors";
171
+ stroke: "colors";
172
+ textDecorationColor: "colors";
173
+ fontFamily: "fonts";
174
+ fontWeight: "fontWeights";
175
+ lineHeight: "lineHeights";
176
+ letterSpacing: "letterSpacings";
177
+ blockSize: "sizes";
178
+ minBlockSize: "sizes";
179
+ maxBlockSize: "sizes";
180
+ inlineSize: "sizes";
181
+ minInlineSize: "sizes";
182
+ maxInlineSize: "sizes";
183
+ minWidth: "sizes";
184
+ maxWidth: "sizes";
185
+ minHeight: "sizes";
186
+ maxHeight: "sizes";
187
+ flexBasis: "sizes";
188
+ gridTemplateColumns: "sizes";
189
+ gridTemplateRows: "sizes";
190
+ borderWidth: "borderWidths";
191
+ borderTopWidth: "borderWidths";
192
+ borderLeftWidth: "borderWidths";
193
+ borderRightWidth: "borderWidths";
194
+ borderBottomWidth: "borderWidths";
195
+ borderStyle: "borderStyles";
196
+ borderTopStyle: "borderStyles";
197
+ borderLeftStyle: "borderStyles";
198
+ borderRightStyle: "borderStyles";
199
+ borderBottomStyle: "borderStyles";
200
+ borderRadius: "radii";
201
+ borderTopLeftRadius: "radii";
202
+ borderTopRightRadius: "radii";
203
+ borderBottomRightRadius: "radii";
204
+ borderBottomLeftRadius: "radii";
205
+ boxShadow: "shadows";
206
+ textShadow: "shadows";
207
+ transition: "transitions";
208
+ zIndex: "zIndices";
209
+ }, {}>>;
210
+ interface ButtonProps extends ComponentProps<typeof Button> {
211
+ as?: ElementType;
212
+ /** How large should the button be? */
213
+ size?: 'sm' | 'md';
214
+ /** Optional click handler */
215
+ onClick?: () => void;
216
+ /** Button contents */
217
+ label: string;
218
+ /** Button is disable? */
219
+ disabled?: boolean;
220
+ variant?: 'primary' | 'secondary' | 'tertiary';
221
+ }
222
+
223
+ export { Button, type ButtonProps };
package/dist/index.js ADDED
@@ -0,0 +1,220 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
+ var __spreadValues = (a, b) => {
12
+ for (var prop in b || (b = {}))
13
+ if (__hasOwnProp.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ if (__getOwnPropSymbols)
16
+ for (var prop of __getOwnPropSymbols(b)) {
17
+ if (__propIsEnum.call(b, prop))
18
+ __defNormalProp(a, prop, b[prop]);
19
+ }
20
+ return a;
21
+ };
22
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
23
+ var __export = (target, all) => {
24
+ for (var name in all)
25
+ __defProp(target, name, { get: all[name], enumerable: true });
26
+ };
27
+ var __copyProps = (to, from, except, desc) => {
28
+ if (from && typeof from === "object" || typeof from === "function") {
29
+ for (let key of __getOwnPropNames(from))
30
+ if (!__hasOwnProp.call(to, key) && key !== except)
31
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
32
+ }
33
+ return to;
34
+ };
35
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
+
37
+ // src/index.tsx
38
+ var src_exports = {};
39
+ __export(src_exports, {
40
+ Button: () => Button
41
+ });
42
+ module.exports = __toCommonJS(src_exports);
43
+
44
+ // ../tokens/dist/index.mjs
45
+ var colors = {
46
+ white: "#FFF",
47
+ black: "#000",
48
+ gray100: "#D6D6D6",
49
+ gray200: "#666666",
50
+ gray400: "#444444",
51
+ gray800: "#282828",
52
+ dafaz100: "#EAEFEA",
53
+ dafaz200: "#52D058",
54
+ dafaz400: "#2FC136",
55
+ dafaz600: "#229E45",
56
+ dafaz800: "#2A6A2D"
57
+ };
58
+ var opacities = {
59
+ opacity400: "0.4",
60
+ opacity600: "0.6",
61
+ opacity800: "0.8",
62
+ opacity900: "0.9"
63
+ };
64
+ var space = {
65
+ 1: "0.25rem",
66
+ 2: "0.5rem",
67
+ 3: "0.75rem",
68
+ 4: "1rem",
69
+ 5: "1.25rem",
70
+ 6: "1.5rem",
71
+ 7: "1.75rem",
72
+ 8: "2rem",
73
+ 10: "2.5rem",
74
+ 12: "3rem",
75
+ 16: "4rem",
76
+ 20: "5rem",
77
+ 40: "10rem",
78
+ 64: "16rem",
79
+ 80: "20rem"
80
+ };
81
+ var radii = {
82
+ px: "1px",
83
+ sm: "3px",
84
+ md: "6px",
85
+ full: "99999px"
86
+ };
87
+ var fonts = {
88
+ default: "Roboto, sans-serif",
89
+ app: "Poppins",
90
+ web: "League Spartan",
91
+ offer: "KoHo",
92
+ code: "monospace"
93
+ };
94
+ var fontSizes = {
95
+ xxs: "0.5rem",
96
+ xs: "0.625rem",
97
+ sm: "0.75rem",
98
+ md: "0.875",
99
+ lg: "1rem",
100
+ xl: "1.25rem",
101
+ "2xl": "2rem"
102
+ };
103
+ var fontWeights = {
104
+ regular: "400",
105
+ medium: "500",
106
+ bold: "700"
107
+ };
108
+ var lineHeights = {
109
+ shorter: "125%",
110
+ short: "140%",
111
+ base: "160%",
112
+ tall: "180%"
113
+ };
114
+
115
+ // src/styles/index.ts
116
+ var import_react = require("@stitches/react");
117
+ var {
118
+ styled,
119
+ css,
120
+ globalCss,
121
+ keyframes,
122
+ getCssText,
123
+ theme,
124
+ createTheme,
125
+ config
126
+ } = (0, import_react.createStitches)({
127
+ themeMap: __spreadProps(__spreadValues({}, import_react.defaultThemeMap), {
128
+ height: "space",
129
+ width: "space"
130
+ }),
131
+ theme: {
132
+ colors,
133
+ fontSizes,
134
+ fontWeights,
135
+ fonts,
136
+ lineHeights,
137
+ radii,
138
+ space,
139
+ opacities
140
+ }
141
+ });
142
+
143
+ // src/components/Button.tsx
144
+ var Button = styled("button", {
145
+ all: "unset",
146
+ borderRadius: "$md",
147
+ fontSize: "$md",
148
+ fontWeight: "$regular",
149
+ fontFamily: "$app",
150
+ textAlign: "center",
151
+ minWidth: 120,
152
+ boxSizing: "border-box",
153
+ display: "flex",
154
+ alignItems: "center",
155
+ justifyContent: "center",
156
+ gap: "$2",
157
+ padding: "$2 $5",
158
+ cursor: "pointer",
159
+ "&:disabled": {
160
+ cursor: "not-allowed"
161
+ },
162
+ svg: {
163
+ width: "$4",
164
+ height: "$4"
165
+ },
166
+ variants: {
167
+ variant: {
168
+ primary: {
169
+ color: "$white",
170
+ background: "$dafaz600",
171
+ opacity: 0.8,
172
+ "&:not(:disabled):hover": {
173
+ opacity: 1
174
+ },
175
+ "&:disabled": {
176
+ background: "$gray200"
177
+ }
178
+ },
179
+ secondary: {
180
+ fontWeight: "$medium",
181
+ color: "$dafaz600",
182
+ border: "2px solid $dafaz600",
183
+ opacity: 0.8,
184
+ "&:not(:disabled):hover": {
185
+ opacity: 1
186
+ },
187
+ "&:disabled": {
188
+ color: "$gray200",
189
+ border: "2px solid $gray200"
190
+ }
191
+ },
192
+ tertiary: {
193
+ fontWeight: "$medium",
194
+ color: "$gray400",
195
+ "&:not(:disabled):hover": {
196
+ color: "$gray800"
197
+ },
198
+ "&:disabled": {
199
+ color: "$gray200"
200
+ }
201
+ }
202
+ },
203
+ size: {
204
+ sm: {
205
+ height: 38
206
+ },
207
+ md: {
208
+ height: 46
209
+ }
210
+ }
211
+ },
212
+ defaultVariants: {
213
+ variant: "primary",
214
+ size: "md"
215
+ }
216
+ });
217
+ // Annotate the CommonJS export names for ESM import in node:
218
+ 0 && (module.exports = {
219
+ Button
220
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,196 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+
21
+ // ../tokens/dist/index.mjs
22
+ var colors = {
23
+ white: "#FFF",
24
+ black: "#000",
25
+ gray100: "#D6D6D6",
26
+ gray200: "#666666",
27
+ gray400: "#444444",
28
+ gray800: "#282828",
29
+ dafaz100: "#EAEFEA",
30
+ dafaz200: "#52D058",
31
+ dafaz400: "#2FC136",
32
+ dafaz600: "#229E45",
33
+ dafaz800: "#2A6A2D"
34
+ };
35
+ var opacities = {
36
+ opacity400: "0.4",
37
+ opacity600: "0.6",
38
+ opacity800: "0.8",
39
+ opacity900: "0.9"
40
+ };
41
+ var space = {
42
+ 1: "0.25rem",
43
+ 2: "0.5rem",
44
+ 3: "0.75rem",
45
+ 4: "1rem",
46
+ 5: "1.25rem",
47
+ 6: "1.5rem",
48
+ 7: "1.75rem",
49
+ 8: "2rem",
50
+ 10: "2.5rem",
51
+ 12: "3rem",
52
+ 16: "4rem",
53
+ 20: "5rem",
54
+ 40: "10rem",
55
+ 64: "16rem",
56
+ 80: "20rem"
57
+ };
58
+ var radii = {
59
+ px: "1px",
60
+ sm: "3px",
61
+ md: "6px",
62
+ full: "99999px"
63
+ };
64
+ var fonts = {
65
+ default: "Roboto, sans-serif",
66
+ app: "Poppins",
67
+ web: "League Spartan",
68
+ offer: "KoHo",
69
+ code: "monospace"
70
+ };
71
+ var fontSizes = {
72
+ xxs: "0.5rem",
73
+ xs: "0.625rem",
74
+ sm: "0.75rem",
75
+ md: "0.875",
76
+ lg: "1rem",
77
+ xl: "1.25rem",
78
+ "2xl": "2rem"
79
+ };
80
+ var fontWeights = {
81
+ regular: "400",
82
+ medium: "500",
83
+ bold: "700"
84
+ };
85
+ var lineHeights = {
86
+ shorter: "125%",
87
+ short: "140%",
88
+ base: "160%",
89
+ tall: "180%"
90
+ };
91
+
92
+ // src/styles/index.ts
93
+ import { createStitches, defaultThemeMap } from "@stitches/react";
94
+ var {
95
+ styled,
96
+ css,
97
+ globalCss,
98
+ keyframes,
99
+ getCssText,
100
+ theme,
101
+ createTheme,
102
+ config
103
+ } = createStitches({
104
+ themeMap: __spreadProps(__spreadValues({}, defaultThemeMap), {
105
+ height: "space",
106
+ width: "space"
107
+ }),
108
+ theme: {
109
+ colors,
110
+ fontSizes,
111
+ fontWeights,
112
+ fonts,
113
+ lineHeights,
114
+ radii,
115
+ space,
116
+ opacities
117
+ }
118
+ });
119
+
120
+ // src/components/Button.tsx
121
+ var Button = styled("button", {
122
+ all: "unset",
123
+ borderRadius: "$md",
124
+ fontSize: "$md",
125
+ fontWeight: "$regular",
126
+ fontFamily: "$app",
127
+ textAlign: "center",
128
+ minWidth: 120,
129
+ boxSizing: "border-box",
130
+ display: "flex",
131
+ alignItems: "center",
132
+ justifyContent: "center",
133
+ gap: "$2",
134
+ padding: "$2 $5",
135
+ cursor: "pointer",
136
+ "&:disabled": {
137
+ cursor: "not-allowed"
138
+ },
139
+ svg: {
140
+ width: "$4",
141
+ height: "$4"
142
+ },
143
+ variants: {
144
+ variant: {
145
+ primary: {
146
+ color: "$white",
147
+ background: "$dafaz600",
148
+ opacity: 0.8,
149
+ "&:not(:disabled):hover": {
150
+ opacity: 1
151
+ },
152
+ "&:disabled": {
153
+ background: "$gray200"
154
+ }
155
+ },
156
+ secondary: {
157
+ fontWeight: "$medium",
158
+ color: "$dafaz600",
159
+ border: "2px solid $dafaz600",
160
+ opacity: 0.8,
161
+ "&:not(:disabled):hover": {
162
+ opacity: 1
163
+ },
164
+ "&:disabled": {
165
+ color: "$gray200",
166
+ border: "2px solid $gray200"
167
+ }
168
+ },
169
+ tertiary: {
170
+ fontWeight: "$medium",
171
+ color: "$gray400",
172
+ "&:not(:disabled):hover": {
173
+ color: "$gray800"
174
+ },
175
+ "&:disabled": {
176
+ color: "$gray200"
177
+ }
178
+ }
179
+ },
180
+ size: {
181
+ sm: {
182
+ height: 38
183
+ },
184
+ md: {
185
+ height: 46
186
+ }
187
+ }
188
+ },
189
+ defaultVariants: {
190
+ variant: "primary",
191
+ size: "md"
192
+ }
193
+ });
194
+ export {
195
+ Button
196
+ };
@@ -0,0 +1,4 @@
1
+ import * as pluginDafaz from '@dafaz-ui/eslint-config'
2
+
3
+ /** @type {import('eslint').Linter.Config[]} */
4
+ export default [...pluginDafaz.default]
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@dafaz-ui/react",
3
+ "version": "2.0.0",
4
+ "main": "./dist/index.js",
5
+ "module": "./dist/index.mjs",
6
+ "types": "./dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsup src/index.tsx --format esm,cjs --dts --external react",
9
+ "dev": "tsup src/index.tsx --format esm,cjs --dts --external react --watch",
10
+ "lint": "eslint src/**/*.ts* --fix"
11
+ },
12
+ "keywords": [],
13
+ "author": "",
14
+ "license": "MIT",
15
+ "description": "",
16
+ "devDependencies": {
17
+ "@dafaz-ui/eslint-config": "*",
18
+ "@dafaz-ui/tokens": "*",
19
+ "@dafaz-ui/ts-config": "*",
20
+ "@types/react": "^18.3.12",
21
+ "@types/react-dom": "^18.3.1",
22
+ "eslint-config-prettier": "^9.1.0",
23
+ "prettier": "^3.3.3",
24
+ "react": "^18.3.1",
25
+ "tsup": "^8.3.5",
26
+ "typescript": "^5.6.3"
27
+ },
28
+ "dependencies": {
29
+ "@stitches/react": "^1.2.8"
30
+ }
31
+ }
@@ -0,0 +1,104 @@
1
+ import type { ComponentProps } from '@stitches/react'
2
+ import { styled } from '../styles'
3
+ import type { ElementType } from 'react'
4
+
5
+ /** Primary UI component for user interaction */
6
+ export const Button = styled('button', {
7
+ all: 'unset',
8
+ borderRadius: '$md',
9
+ fontSize: '$md',
10
+ fontWeight: '$regular',
11
+ fontFamily: '$app',
12
+ textAlign: 'center',
13
+ minWidth: 120,
14
+ boxSizing: 'border-box',
15
+
16
+ display: 'flex',
17
+ alignItems: 'center',
18
+ justifyContent: 'center',
19
+ gap: '$2',
20
+ padding: '$2 $5',
21
+
22
+ cursor: 'pointer',
23
+
24
+ '&:disabled': {
25
+ cursor: 'not-allowed',
26
+ },
27
+
28
+ svg: {
29
+ width: '$4',
30
+ height: '$4',
31
+ },
32
+
33
+ variants: {
34
+ variant: {
35
+ primary: {
36
+ color: '$white',
37
+ background: '$dafaz600',
38
+ opacity: 0.8,
39
+
40
+ '&:not(:disabled):hover': {
41
+ opacity: 1,
42
+ },
43
+
44
+ '&:disabled': {
45
+ background: '$gray200',
46
+ },
47
+ },
48
+ secondary: {
49
+ fontWeight: '$medium',
50
+ color: '$dafaz600',
51
+ border: '2px solid $dafaz600',
52
+ opacity: 0.8,
53
+
54
+ '&:not(:disabled):hover': {
55
+ opacity: 1,
56
+ },
57
+
58
+ '&:disabled': {
59
+ color: '$gray200',
60
+ border: '2px solid $gray200',
61
+ },
62
+ },
63
+ tertiary: {
64
+ fontWeight: '$medium',
65
+ color: '$gray400',
66
+
67
+ '&:not(:disabled):hover': {
68
+ color: '$gray800',
69
+ },
70
+
71
+ '&:disabled': {
72
+ color: '$gray200',
73
+ },
74
+ },
75
+ },
76
+ size: {
77
+ sm: {
78
+ height: 38,
79
+ },
80
+ md: {
81
+ height: 46,
82
+ },
83
+ },
84
+ },
85
+
86
+ defaultVariants: {
87
+ variant: 'primary',
88
+ size: 'md',
89
+ },
90
+ })
91
+
92
+ export interface ButtonProps extends ComponentProps<typeof Button> {
93
+ as?: ElementType
94
+ /** How large should the button be? */
95
+ size?: 'sm' | 'md'
96
+ /** Optional click handler */
97
+ onClick?: () => void
98
+ /** Button contents */
99
+ label: string
100
+ /** Button is disable? */
101
+ disabled?: boolean
102
+ //** Button UI mode */
103
+ variant?: 'primary' | 'secondary' | 'tertiary'
104
+ }
package/src/index.tsx ADDED
@@ -0,0 +1 @@
1
+ export * from './components/Button'
@@ -0,0 +1,38 @@
1
+ import {
2
+ colors,
3
+ fontSizes,
4
+ fontWeights,
5
+ fonts,
6
+ lineHeights,
7
+ opacities,
8
+ radii,
9
+ space,
10
+ } from '@dafaz-ui/tokens'
11
+ import { createStitches, defaultThemeMap } from '@stitches/react'
12
+
13
+ export const {
14
+ styled,
15
+ css,
16
+ globalCss,
17
+ keyframes,
18
+ getCssText,
19
+ theme,
20
+ createTheme,
21
+ config,
22
+ } = createStitches({
23
+ themeMap: {
24
+ ...defaultThemeMap,
25
+ height: 'space',
26
+ width: 'space',
27
+ },
28
+ theme: {
29
+ colors: colors,
30
+ fontSizes: fontSizes,
31
+ fontWeights: fontWeights,
32
+ fonts: fonts,
33
+ lineHeights: lineHeights,
34
+ radii: radii,
35
+ space: space,
36
+ opacities: opacities,
37
+ },
38
+ })
package/tsconfig.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "@dafaz-ui/ts-config/react.json",
3
+ "include": ["src"],
4
+ }