boflow-components 1.0.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.
package/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # Rslib project
2
+
3
+ ## Setup
4
+
5
+ Install the dependencies:
6
+
7
+ ```bash
8
+ bun install
9
+ ```
10
+
11
+ ## Get started
12
+
13
+ Build the library:
14
+
15
+ ```bash
16
+ bun run build
17
+ ```
18
+
19
+ Build the library in watch mode:
20
+
21
+ ```bash
22
+ bun run dev
23
+ ```
package/dist/App.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ declare const App: () => import("react/jsx-runtime").JSX.Element;
2
+ export default App;
package/dist/App.js ADDED
@@ -0,0 +1,411 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Button, Checkbox, Input } from "./components/index.js";
3
+ import { ButtonSize } from "./types/index.js";
4
+ const App = ()=>/*#__PURE__*/ jsxs("div", {
5
+ style: {
6
+ padding: '2rem',
7
+ maxWidth: '600px',
8
+ margin: '0 auto',
9
+ display: 'flex',
10
+ flexDirection: 'column',
11
+ gap: '2rem',
12
+ height: '100vh',
13
+ overflowY: 'auto'
14
+ },
15
+ children: [
16
+ /*#__PURE__*/ jsx("h1", {
17
+ children: "Input Component Examples"
18
+ }),
19
+ /*#__PURE__*/ jsxs("div", {
20
+ children: [
21
+ /*#__PURE__*/ jsx("h3", {
22
+ children: "Normal Input"
23
+ }),
24
+ /*#__PURE__*/ jsx(Input, {
25
+ label: "Label",
26
+ placeholder: "Placeholder",
27
+ hint: "This is a hint text to help user"
28
+ })
29
+ ]
30
+ }),
31
+ /*#__PURE__*/ jsxs("div", {
32
+ children: [
33
+ /*#__PURE__*/ jsx("h3", {
34
+ children: "With Left Icon / Prefix"
35
+ }),
36
+ /*#__PURE__*/ jsx(Input, {
37
+ label: "Label",
38
+ placeholder: "Phone number",
39
+ hint: "This is a hint text to help user",
40
+ leftIcon: /*#__PURE__*/ jsxs("span", {
41
+ style: {
42
+ display: 'flex',
43
+ alignItems: 'center',
44
+ gap: '4px',
45
+ fontSize: '14px'
46
+ },
47
+ children: [
48
+ "\uD83C\uDDFA\uD83C\uDDF8 +1",
49
+ ' ',
50
+ /*#__PURE__*/ jsxs("svg", {
51
+ width: "12",
52
+ height: "12",
53
+ viewBox: "0 0 24 24",
54
+ fill: "none",
55
+ stroke: "currentColor",
56
+ strokeWidth: "2",
57
+ strokeLinecap: "round",
58
+ strokeLinejoin: "round",
59
+ children: [
60
+ /*#__PURE__*/ jsx("title", {
61
+ children: "Expand"
62
+ }),
63
+ /*#__PURE__*/ jsx("polyline", {
64
+ points: "6 9 12 15 18 9"
65
+ })
66
+ ]
67
+ })
68
+ ]
69
+ })
70
+ })
71
+ ]
72
+ }),
73
+ /*#__PURE__*/ jsxs("div", {
74
+ children: [
75
+ /*#__PURE__*/ jsx("h3", {
76
+ children: "With Right Icon / Suffix"
77
+ }),
78
+ /*#__PURE__*/ jsx(Input, {
79
+ label: "Label",
80
+ placeholder: "Placeholder",
81
+ hint: "This is a hint text to help user",
82
+ leftIcon: /*#__PURE__*/ jsxs("svg", {
83
+ width: "20",
84
+ height: "20",
85
+ viewBox: "0 0 24 24",
86
+ fill: "none",
87
+ stroke: "currentColor",
88
+ strokeWidth: "2",
89
+ strokeLinecap: "round",
90
+ strokeLinejoin: "round",
91
+ children: [
92
+ /*#__PURE__*/ jsx("title", {
93
+ children: "Search"
94
+ }),
95
+ /*#__PURE__*/ jsx("circle", {
96
+ cx: "12",
97
+ cy: "12",
98
+ r: "10"
99
+ }),
100
+ /*#__PURE__*/ jsx("line", {
101
+ x1: "12",
102
+ y1: "16",
103
+ x2: "12",
104
+ y2: "12"
105
+ }),
106
+ /*#__PURE__*/ jsx("line", {
107
+ x1: "12",
108
+ y1: "8",
109
+ x2: "12.01",
110
+ y2: "8"
111
+ })
112
+ ]
113
+ }),
114
+ rightIcon: /*#__PURE__*/ jsxs("svg", {
115
+ width: "20",
116
+ height: "20",
117
+ viewBox: "0 0 24 24",
118
+ fill: "none",
119
+ stroke: "currentColor",
120
+ strokeWidth: "2",
121
+ strokeLinecap: "round",
122
+ strokeLinejoin: "round",
123
+ children: [
124
+ /*#__PURE__*/ jsx("title", {
125
+ children: "Toggle Visibility"
126
+ }),
127
+ /*#__PURE__*/ jsx("path", {
128
+ d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"
129
+ }),
130
+ /*#__PURE__*/ jsx("circle", {
131
+ cx: "12",
132
+ cy: "12",
133
+ r: "3"
134
+ })
135
+ ]
136
+ })
137
+ })
138
+ ]
139
+ }),
140
+ /*#__PURE__*/ jsxs("div", {
141
+ children: [
142
+ /*#__PURE__*/ jsx("h3", {
143
+ children: "Filled State"
144
+ }),
145
+ /*#__PURE__*/ jsx(Input, {
146
+ label: "Label",
147
+ defaultValue: "Filled value",
148
+ hint: "This is a hint text to help user"
149
+ })
150
+ ]
151
+ }),
152
+ /*#__PURE__*/ jsxs("div", {
153
+ children: [
154
+ /*#__PURE__*/ jsx("h3", {
155
+ children: "Error State"
156
+ }),
157
+ /*#__PURE__*/ jsx(Input, {
158
+ label: "Label",
159
+ placeholder: "Placeholder",
160
+ hint: "This is an error message",
161
+ error: true
162
+ })
163
+ ]
164
+ }),
165
+ /*#__PURE__*/ jsx("hr", {
166
+ style: {
167
+ borderColor: 'var(--neutral-4)'
168
+ }
169
+ }),
170
+ /*#__PURE__*/ jsx("h1", {
171
+ children: "Button Component Examples"
172
+ }),
173
+ /*#__PURE__*/ jsxs("div", {
174
+ style: {
175
+ display: 'flex',
176
+ flexWrap: 'wrap',
177
+ gap: '1rem',
178
+ alignItems: 'center'
179
+ },
180
+ children: [
181
+ /*#__PURE__*/ jsx(Button, {
182
+ size: ButtonSize.Small,
183
+ label: "Small Button"
184
+ }),
185
+ /*#__PURE__*/ jsx(Button, {
186
+ size: ButtonSize.Medium,
187
+ label: "Medium Button"
188
+ }),
189
+ /*#__PURE__*/ jsx(Button, {
190
+ size: ButtonSize.Big,
191
+ label: "Big Button"
192
+ }),
193
+ /*#__PURE__*/ jsx(Button, {
194
+ size: ButtonSize.Medium,
195
+ label: "With Left Icon",
196
+ leftIcon: /*#__PURE__*/ jsxs("svg", {
197
+ width: "16",
198
+ height: "16",
199
+ viewBox: "0 0 24 24",
200
+ fill: "none",
201
+ stroke: "currentColor",
202
+ strokeWidth: "2",
203
+ strokeLinecap: "round",
204
+ strokeLinejoin: "round",
205
+ children: [
206
+ /*#__PURE__*/ jsx("title", {
207
+ children: "Arrow Left"
208
+ }),
209
+ /*#__PURE__*/ jsx("line", {
210
+ x1: "19",
211
+ y1: "12",
212
+ x2: "5",
213
+ y2: "12"
214
+ }),
215
+ /*#__PURE__*/ jsx("polyline", {
216
+ points: "12 19 5 12 12 5"
217
+ })
218
+ ]
219
+ })
220
+ }),
221
+ /*#__PURE__*/ jsx(Button, {
222
+ size: ButtonSize.Medium,
223
+ label: "With Right Icon",
224
+ rightIcon: /*#__PURE__*/ jsxs("svg", {
225
+ width: "16",
226
+ height: "16",
227
+ viewBox: "0 0 24 24",
228
+ fill: "none",
229
+ stroke: "currentColor",
230
+ strokeWidth: "2",
231
+ strokeLinecap: "round",
232
+ strokeLinejoin: "round",
233
+ children: [
234
+ /*#__PURE__*/ jsx("title", {
235
+ children: "Arrow Right"
236
+ }),
237
+ /*#__PURE__*/ jsx("line", {
238
+ x1: "5",
239
+ y1: "12",
240
+ x2: "19",
241
+ y2: "12"
242
+ }),
243
+ /*#__PURE__*/ jsx("polyline", {
244
+ points: "12 5 19 12 12 19"
245
+ })
246
+ ]
247
+ })
248
+ }),
249
+ /*#__PURE__*/ jsx(Button, {
250
+ size: ButtonSize.Medium,
251
+ label: "Both Icons",
252
+ leftIcon: /*#__PURE__*/ jsxs("svg", {
253
+ width: "16",
254
+ height: "16",
255
+ viewBox: "0 0 24 24",
256
+ fill: "none",
257
+ stroke: "currentColor",
258
+ strokeWidth: "2",
259
+ strokeLinecap: "round",
260
+ strokeLinejoin: "round",
261
+ children: [
262
+ /*#__PURE__*/ jsx("title", {
263
+ children: "Arrow Left"
264
+ }),
265
+ /*#__PURE__*/ jsx("line", {
266
+ x1: "19",
267
+ y1: "12",
268
+ x2: "5",
269
+ y2: "12"
270
+ }),
271
+ /*#__PURE__*/ jsx("polyline", {
272
+ points: "12 19 5 12 12 5"
273
+ })
274
+ ]
275
+ }),
276
+ rightIcon: /*#__PURE__*/ jsxs("svg", {
277
+ width: "16",
278
+ height: "16",
279
+ viewBox: "0 0 24 24",
280
+ fill: "none",
281
+ stroke: "currentColor",
282
+ strokeWidth: "2",
283
+ strokeLinecap: "round",
284
+ strokeLinejoin: "round",
285
+ children: [
286
+ /*#__PURE__*/ jsx("title", {
287
+ children: "Arrow Right"
288
+ }),
289
+ /*#__PURE__*/ jsx("line", {
290
+ x1: "5",
291
+ y1: "12",
292
+ x2: "19",
293
+ y2: "12"
294
+ }),
295
+ /*#__PURE__*/ jsx("polyline", {
296
+ points: "12 5 19 12 12 19"
297
+ })
298
+ ]
299
+ })
300
+ }),
301
+ /*#__PURE__*/ jsx(Button, {
302
+ size: ButtonSize.Medium,
303
+ label: "Disabled Button",
304
+ disabled: true
305
+ })
306
+ ]
307
+ }),
308
+ /*#__PURE__*/ jsxs("div", {
309
+ children: [
310
+ /*#__PURE__*/ jsx("h3", {
311
+ children: "Disabled State"
312
+ }),
313
+ /*#__PURE__*/ jsx(Input, {
314
+ label: "Label",
315
+ placeholder: "Placeholder",
316
+ hint: "This is a hint text to help user",
317
+ disabled: true
318
+ })
319
+ ]
320
+ }),
321
+ /*#__PURE__*/ jsx("hr", {
322
+ style: {
323
+ borderColor: 'var(--neutral-4)'
324
+ }
325
+ }),
326
+ /*#__PURE__*/ jsx("h1", {
327
+ children: "Checkbox Component Examples"
328
+ }),
329
+ /*#__PURE__*/ jsxs("div", {
330
+ style: {
331
+ display: 'flex',
332
+ flexDirection: 'column',
333
+ gap: '2rem'
334
+ },
335
+ children: [
336
+ /*#__PURE__*/ jsxs("div", {
337
+ children: [
338
+ /*#__PURE__*/ jsx("h3", {
339
+ children: "Medium Size"
340
+ }),
341
+ /*#__PURE__*/ jsxs("div", {
342
+ style: {
343
+ display: 'flex',
344
+ gap: '24px'
345
+ },
346
+ children: [
347
+ /*#__PURE__*/ jsx(Checkbox, {
348
+ size: "medium"
349
+ }),
350
+ /*#__PURE__*/ jsx(Checkbox, {
351
+ size: "medium",
352
+ defaultChecked: true
353
+ }),
354
+ /*#__PURE__*/ jsx(Checkbox, {
355
+ size: "medium",
356
+ indeterminate: true
357
+ }),
358
+ /*#__PURE__*/ jsx(Checkbox, {
359
+ size: "medium",
360
+ disabled: true
361
+ }),
362
+ /*#__PURE__*/ jsx(Checkbox, {
363
+ size: "medium",
364
+ defaultChecked: true,
365
+ disabled: true
366
+ })
367
+ ]
368
+ })
369
+ ]
370
+ }),
371
+ /*#__PURE__*/ jsxs("div", {
372
+ children: [
373
+ /*#__PURE__*/ jsx("h3", {
374
+ children: "Small Size"
375
+ }),
376
+ /*#__PURE__*/ jsxs("div", {
377
+ style: {
378
+ display: 'flex',
379
+ gap: '24px'
380
+ },
381
+ children: [
382
+ /*#__PURE__*/ jsx(Checkbox, {
383
+ size: "small"
384
+ }),
385
+ /*#__PURE__*/ jsx(Checkbox, {
386
+ size: "small",
387
+ defaultChecked: true
388
+ }),
389
+ /*#__PURE__*/ jsx(Checkbox, {
390
+ size: "small",
391
+ indeterminate: true
392
+ }),
393
+ /*#__PURE__*/ jsx(Checkbox, {
394
+ size: "small",
395
+ disabled: true
396
+ }),
397
+ /*#__PURE__*/ jsx(Checkbox, {
398
+ size: "small",
399
+ defaultChecked: true,
400
+ disabled: true
401
+ })
402
+ ]
403
+ })
404
+ ]
405
+ })
406
+ ]
407
+ })
408
+ ]
409
+ });
410
+ const src_App = App;
411
+ export { src_App as default };
@@ -0,0 +1,3 @@
1
+ import { type ButtonProps } from '../../types';
2
+ import './button.scss';
3
+ export declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,37 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { ButtonSize } from "../../types/index.js";
3
+ import { forwardRef } from "react";
4
+ import "./button.css";
5
+ const Button = /*#__PURE__*/ forwardRef(({ primary = true, size = ButtonSize.Medium, label, children, leftIcon, rightIcon, className = '', disabled, ...props }, ref)=>{
6
+ const mode = primary ? 'bo-button--primary' : 'bo-button--secondary';
7
+ const sizeClass = `bo-button--${size}`;
8
+ const content = children || label;
9
+ return /*#__PURE__*/ jsxs("button", {
10
+ ref: ref,
11
+ type: "button",
12
+ disabled: disabled,
13
+ className: [
14
+ 'bo-button',
15
+ mode,
16
+ sizeClass,
17
+ className
18
+ ].filter(Boolean).join(' '),
19
+ ...props,
20
+ children: [
21
+ leftIcon && /*#__PURE__*/ jsx("span", {
22
+ className: "bo-button-icon-left",
23
+ children: leftIcon
24
+ }),
25
+ content && /*#__PURE__*/ jsx("span", {
26
+ className: "bo-button-content",
27
+ children: content
28
+ }),
29
+ rightIcon && /*#__PURE__*/ jsx("span", {
30
+ className: "bo-button-icon-right",
31
+ children: rightIcon
32
+ })
33
+ ]
34
+ });
35
+ });
36
+ Button.displayName = 'Button';
37
+ export { Button };
@@ -0,0 +1,71 @@
1
+ .bo-button {
2
+ cursor: pointer;
3
+ outline: none;
4
+ justify-content: center;
5
+ align-items: center;
6
+ gap: 12px;
7
+ font-family: Inter Tight, sans-serif;
8
+ font-weight: 500;
9
+ line-height: 1.4;
10
+ transition: all .2s ease-in-out;
11
+ display: inline-flex;
12
+ }
13
+
14
+ .bo-button--small {
15
+ padding: 10px 16px;
16
+ font-size: 14px;
17
+ }
18
+
19
+ .bo-button--medium {
20
+ padding: 12px 16px;
21
+ font-size: 14px;
22
+ }
23
+
24
+ .bo-button--big {
25
+ padding: 14px 24px;
26
+ font-size: 16px;
27
+ }
28
+
29
+ .bo-button-icon-left, .bo-button-icon-right {
30
+ justify-content: center;
31
+ align-items: center;
32
+ display: flex;
33
+ }
34
+
35
+ .bo-button--primary {
36
+ border: 1px solid var(--primary-500, #131313);
37
+ background: linear-gradient(180deg, var(--primary-400, #424242) 0%, var(--primary-500, #131313) 100%);
38
+ color: #fff;
39
+ border-radius: 10px;
40
+ box-shadow: inset 4px 4px 8px #fff6, 0 0 1px #0000001a, 0 2px 4px #0003;
41
+ }
42
+
43
+ .bo-button--primary:hover:not(:disabled) {
44
+ border: 1px solid var(--primary-200, #a1a1a1);
45
+ background: linear-gradient(180deg, var(--primary-300, #717171) 0%, var(--primary-400, #424242) 100%);
46
+ }
47
+
48
+ .bo-button--primary:active:not(:disabled) {
49
+ box-shadow: none;
50
+ background: #000;
51
+ border-color: #000;
52
+ border-radius: 10px;
53
+ }
54
+
55
+ .bo-button--primary:disabled {
56
+ background: var(--neutral-4, #eceff3);
57
+ color: var(--neutral-7, #a4acb9);
58
+ box-shadow: none;
59
+ cursor: not-allowed;
60
+ border: 1px solid #0000;
61
+ border-radius: 10px;
62
+ }
63
+
64
+ .bo-button--secondary {
65
+ color: #333;
66
+ background-color: #0000;
67
+ border: none;
68
+ border-radius: 10px;
69
+ box-shadow: inset 0 0 0 1px #00000026;
70
+ }
71
+
@@ -0,0 +1,3 @@
1
+ import type { CheckboxProps } from '../../types';
2
+ import './checkbox.scss';
3
+ export declare const Checkbox: import("react").ForwardRefExoticComponent<CheckboxProps & import("react").RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,33 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef, useEffect, useRef } from "react";
3
+ import "./checkbox.css";
4
+ const useMergedRef = (...refs)=>(current)=>{
5
+ refs.forEach((ref)=>{
6
+ if ('function' == typeof ref) ref(current);
7
+ else if (ref && !Object.isFrozen(ref)) ref.current = current;
8
+ });
9
+ };
10
+ const Checkbox = /*#__PURE__*/ forwardRef(({ size = 'medium', indeterminate = false, className = '', ...props }, ref)=>{
11
+ const internalRef = useRef(null);
12
+ const mergedRef = useMergedRef(internalRef, ref);
13
+ useEffect(()=>{
14
+ if (internalRef.current) internalRef.current.indeterminate = indeterminate;
15
+ }, [
16
+ indeterminate
17
+ ]);
18
+ const sizeClass = `bo-checkbox--${size}`;
19
+ const indeterminateClass = indeterminate ? 'bo-checkbox--indeterminate' : '';
20
+ return /*#__PURE__*/ jsx("input", {
21
+ type: "checkbox",
22
+ ref: mergedRef,
23
+ className: [
24
+ 'bo-checkbox',
25
+ sizeClass,
26
+ indeterminateClass,
27
+ className
28
+ ].filter(Boolean).join(' '),
29
+ ...props
30
+ });
31
+ });
32
+ Checkbox.displayName = 'Checkbox';
33
+ export { Checkbox };
@@ -0,0 +1,74 @@
1
+ .bo-checkbox {
2
+ appearance: none;
3
+ background-color: var(--neutral-1, #fff);
4
+ border: 1px solid var(--neutral-5, #dfe1e7);
5
+ cursor: pointer;
6
+ border-radius: 4px;
7
+ outline: none;
8
+ flex-shrink: 0;
9
+ justify-content: center;
10
+ align-items: center;
11
+ transition: all .2s ease-in-out;
12
+ display: inline-flex;
13
+ }
14
+
15
+ .bo-checkbox--small {
16
+ width: 16px;
17
+ height: 16px;
18
+ padding: 2.4px;
19
+ }
20
+
21
+ .bo-checkbox--medium {
22
+ width: 20px;
23
+ height: 20px;
24
+ }
25
+
26
+ .bo-checkbox:hover:not(:disabled):not(:checked):not(.bo-checkbox--indeterminate) {
27
+ border-color: var(--neutral-7, #a4acb9);
28
+ }
29
+
30
+ .bo-checkbox:focus-visible {
31
+ box-shadow: 0 0 0 2px var(--neutral-1, #fff), 0 0 0 4px var(--primary-500, #131313);
32
+ }
33
+
34
+ .bo-checkbox:checked, .bo-checkbox--indeterminate {
35
+ background-color: var(--primary-500, #131313);
36
+ border-color: var(--primary-500, #131313);
37
+ position: relative;
38
+ }
39
+
40
+ .bo-checkbox:checked:after, .bo-checkbox--indeterminate:after {
41
+ content: "";
42
+ background-color: #fff;
43
+ width: 100%;
44
+ height: 100%;
45
+ display: block;
46
+ mask-position: center;
47
+ mask-size: contain;
48
+ mask-repeat: no-repeat;
49
+ }
50
+
51
+ .bo-checkbox:checked:hover:not(:disabled), .bo-checkbox--indeterminate:hover:not(:disabled) {
52
+ background-color: var(--primary-400, #424242);
53
+ border-color: var(--primary-400, #424242);
54
+ }
55
+
56
+ .bo-checkbox:checked:not(.bo-checkbox--indeterminate):after {
57
+ mask-image: url("data:image/svg+xml;utf8,<svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\"><polyline points=\"20 6 9 17 4 12\"></polyline></svg>");
58
+ }
59
+
60
+ .bo-checkbox--indeterminate:after {
61
+ mask-image: url("data:image/svg+xml;utf8,<svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\"><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"></line></svg>");
62
+ }
63
+
64
+ .bo-checkbox:disabled {
65
+ cursor: not-allowed;
66
+ border-color: var(--neutral-4, #eceff3);
67
+ background-color: var(--neutral-3, #f1f3f5);
68
+ }
69
+
70
+ .bo-checkbox:disabled:checked, .bo-checkbox:disabled.bo-checkbox--indeterminate {
71
+ background-color: var(--neutral-5, #dfe1e7);
72
+ border-color: #0000;
73
+ }
74
+
@@ -0,0 +1,3 @@
1
+ import type { InputProps } from '../../types';
2
+ import './input.scss';
3
+ export declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;