@spies-ui/react 1.0.1 → 1.0.3

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/dist/index.js CHANGED
@@ -97,9 +97,10 @@ var require_dist = __commonJS({
97
97
  smokedWhite: "#f5f5f5",
98
98
  richBlack: "#000014",
99
99
  gray100: "#e0e0e0",
100
- gray200: "#a0a6ae",
101
- gray400: "#7a828e",
102
- gray500: "#4a5057",
100
+ gray200: "#CCCCCC",
101
+ gray300: "#ADADAD",
102
+ gray400: "#8F8F8F",
103
+ gray500: "#666F7A",
103
104
  gray600: "#40454c",
104
105
  gray700: "#2f3238",
105
106
  gray800: "#1f1f1f",
@@ -186,7 +187,15 @@ __export(src_exports, {
186
187
  Heading: () => Heading,
187
188
  Text: () => Text,
188
189
  TextArea: () => TextArea,
189
- TextInput: () => TextInput
190
+ TextInput: () => TextInput,
191
+ config: () => config,
192
+ createTheme: () => createTheme,
193
+ css: () => css,
194
+ getCssText: () => getCssText,
195
+ globalCss: () => globalCss,
196
+ keyframes: () => keyframes,
197
+ styled: () => styled,
198
+ theme: () => theme
190
199
  });
191
200
  module.exports = __toCommonJS(src_exports);
192
201
 
@@ -220,7 +229,7 @@ var {
220
229
 
221
230
  // src/components/Box.tsx
222
231
  var Box = styled("div", {
223
- padding: "$4",
232
+ padding: "$6",
224
233
  borderRadius: "$md",
225
234
  variants: {
226
235
  background: {
@@ -376,10 +385,10 @@ var Button = styled("button", {
376
385
  border: "2px solid $gray500",
377
386
  color: "$smokedWhite",
378
387
  "&:not(:disabled):hover": {
379
- // backgroundColor: '$smokedWhite',
380
- // borderColor: '$smokedWhite',
381
- // color: '$gray900',
382
388
  borderColor: "$gray600"
389
+ },
390
+ "&:focus": {
391
+ borderColor: "$primary"
383
392
  }
384
393
  },
385
394
  primary: {
@@ -389,6 +398,9 @@ var Button = styled("button", {
389
398
  "&:not(:disabled):hover": {
390
399
  backgroundColor: "$primaryLight",
391
400
  borderColor: "$primaryLight"
401
+ },
402
+ "&:focus": {
403
+ borderColor: "$smokedWhite"
392
404
  }
393
405
  }
394
406
  },
@@ -425,15 +437,17 @@ var Button = styled("button", {
425
437
  });
426
438
  Button.displayName = "Button";
427
439
 
440
+ // src/components/TextInput/index.tsx
441
+ var import_react2 = require("react");
442
+
428
443
  // src/components/TextInput/styles.ts
429
444
  var TextInputContainer = styled("div", {
430
445
  backgroundColor: "$gray900",
431
- padding: "$3 $4",
432
446
  borderRadius: "$sm",
433
447
  boxSizing: "border-box",
434
448
  border: "2px solid $gray900",
435
449
  display: "flex",
436
- alignItems: "baseline",
450
+ alignItems: "center",
437
451
  "&:has(input:focus)": {
438
452
  borderColor: "$primary"
439
453
  },
@@ -442,6 +456,14 @@ var TextInputContainer = styled("div", {
442
456
  cursor: "not-alowed"
443
457
  },
444
458
  variants: {
459
+ size: {
460
+ small: {
461
+ padding: "$2 $3"
462
+ },
463
+ default: {
464
+ padding: "$3 $4"
465
+ }
466
+ },
445
467
  errored: {
446
468
  true: {
447
469
  borderColor: "$danger"
@@ -449,6 +471,7 @@ var TextInputContainer = styled("div", {
449
471
  }
450
472
  },
451
473
  defaultVariants: {
474
+ size: "default",
452
475
  errored: false
453
476
  }
454
477
  });
@@ -472,7 +495,7 @@ var Input = styled("input", {
472
495
  "&:disabled": {
473
496
  cursor: "not-allowed"
474
497
  },
475
- "&:placeholder": {
498
+ "&::placeholder": {
476
499
  color: "$gray400"
477
500
  }
478
501
  });
@@ -497,15 +520,20 @@ InputBox.displayName = "InputBox";
497
520
 
498
521
  // src/components/TextInput/index.tsx
499
522
  var import_jsx_runtime3 = require("react/jsx-runtime");
500
- function TextInput(_a) {
501
- var _b = _a, { label, prefix, error } = _b, props = __objRest(_b, ["label", "prefix", "error"]);
502
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(InputBox, { label, error, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(TextInputContainer, { errored: !!error, children: [
503
- !!prefix && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Prefix, { children: prefix }),
504
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Input, __spreadValues({}, props))
505
- ] }) });
506
- }
523
+ var TextInput = (0, import_react2.forwardRef)(
524
+ (_a, ref) => {
525
+ var _b = _a, { label, prefix, error, size } = _b, props = __objRest(_b, ["label", "prefix", "error", "size"]);
526
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(InputBox, { label, error, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(TextInputContainer, { errored: !!error, size, children: [
527
+ !!prefix && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Prefix, { children: prefix }),
528
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Input, __spreadValues({ ref }, props))
529
+ ] }) });
530
+ }
531
+ );
507
532
  TextInput.displayName = "TextInput";
508
533
 
534
+ // src/components/TextArea/index.tsx
535
+ var import_react3 = require("react");
536
+
509
537
  // src/components/TextArea/styles.ts
510
538
  var TextAreaInput = styled("textarea", {
511
539
  backgroundColor: "$gray900",
@@ -527,7 +555,7 @@ var TextAreaInput = styled("textarea", {
527
555
  opacity: 0.5,
528
556
  cursor: "not-allowed"
529
557
  },
530
- "&:placeholder": {
558
+ "&::placeholder": {
531
559
  color: "$gray400"
532
560
  },
533
561
  variants: {
@@ -544,10 +572,10 @@ var TextAreaInput = styled("textarea", {
544
572
 
545
573
  // src/components/TextArea/index.tsx
546
574
  var import_jsx_runtime4 = require("react/jsx-runtime");
547
- function TextArea(_a) {
575
+ var TextArea = (0, import_react3.forwardRef)((_a, ref) => {
548
576
  var _b = _a, { label, error } = _b, props = __objRest(_b, ["label", "error"]);
549
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InputBox, { label, error, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TextAreaInput, __spreadProps(__spreadValues({}, props), { errored: !!error })) });
550
- }
577
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InputBox, { label, error, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TextAreaInput, __spreadProps(__spreadValues({ ref }, props), { errored: !!error })) });
578
+ });
551
579
  TextArea.displayName = "TextArea";
552
580
 
553
581
  // src/components/Checkbox/index.tsx
@@ -637,7 +665,7 @@ function Checkbox2(_a) {
637
665
  Checkbox2.displayName = "Checkbox";
638
666
 
639
667
  // src/components/Dropdown/index.tsx
640
- var import_react2 = require("react");
668
+ var import_react4 = require("react");
641
669
 
642
670
  // src/components/Dropdown/styles.ts
643
671
  var DropdownContainer = styled("div", {
@@ -707,9 +735,9 @@ var DropdownItem = styled("li", {
707
735
  // src/components/Dropdown/index.tsx
708
736
  var import_jsx_runtime6 = require("react/jsx-runtime");
709
737
  function Dropdown({ options, children, name }) {
710
- const [isOpen, setIsOpen] = (0, import_react2.useState)(false);
711
- const dropdownRef = (0, import_react2.useRef)(null);
712
- const buttonRef = (0, import_react2.useRef)(null);
738
+ const [isOpen, setIsOpen] = (0, import_react4.useState)(false);
739
+ const dropdownRef = (0, import_react4.useRef)(null);
740
+ const buttonRef = (0, import_react4.useRef)(null);
713
741
  const toggleDropdown = () => {
714
742
  setIsOpen(!isOpen);
715
743
  };
@@ -722,13 +750,13 @@ function Dropdown({ options, children, name }) {
722
750
  setIsOpen(false);
723
751
  }
724
752
  };
725
- (0, import_react2.useEffect)(() => {
753
+ (0, import_react4.useEffect)(() => {
726
754
  document.addEventListener("mousedown", handleClickOutside);
727
755
  return () => {
728
756
  document.removeEventListener("mousedown", handleClickOutside);
729
757
  };
730
758
  }, []);
731
- (0, import_react2.useEffect)(() => {
759
+ (0, import_react4.useEffect)(() => {
732
760
  const handleReposition = () => {
733
761
  if (isOpen && buttonRef.current && dropdownRef.current) {
734
762
  const buttonRect = buttonRef.current.getBoundingClientRect();
@@ -773,5 +801,13 @@ Dropdown.displayName = "Dropdown";
773
801
  Heading,
774
802
  Text,
775
803
  TextArea,
776
- TextInput
804
+ TextInput,
805
+ config,
806
+ createTheme,
807
+ css,
808
+ getCssText,
809
+ globalCss,
810
+ keyframes,
811
+ styled,
812
+ theme
777
813
  });
package/dist/index.mjs CHANGED
@@ -91,9 +91,10 @@ var require_dist = __commonJS({
91
91
  smokedWhite: "#f5f5f5",
92
92
  richBlack: "#000014",
93
93
  gray100: "#e0e0e0",
94
- gray200: "#a0a6ae",
95
- gray400: "#7a828e",
96
- gray500: "#4a5057",
94
+ gray200: "#CCCCCC",
95
+ gray300: "#ADADAD",
96
+ gray400: "#8F8F8F",
97
+ gray500: "#666F7A",
97
98
  gray600: "#40454c",
98
99
  gray700: "#2f3238",
99
100
  gray800: "#1f1f1f",
@@ -199,7 +200,7 @@ var {
199
200
 
200
201
  // src/components/Box.tsx
201
202
  var Box = styled("div", {
202
- padding: "$4",
203
+ padding: "$6",
203
204
  borderRadius: "$md",
204
205
  variants: {
205
206
  background: {
@@ -355,10 +356,10 @@ var Button = styled("button", {
355
356
  border: "2px solid $gray500",
356
357
  color: "$smokedWhite",
357
358
  "&:not(:disabled):hover": {
358
- // backgroundColor: '$smokedWhite',
359
- // borderColor: '$smokedWhite',
360
- // color: '$gray900',
361
359
  borderColor: "$gray600"
360
+ },
361
+ "&:focus": {
362
+ borderColor: "$primary"
362
363
  }
363
364
  },
364
365
  primary: {
@@ -368,6 +369,9 @@ var Button = styled("button", {
368
369
  "&:not(:disabled):hover": {
369
370
  backgroundColor: "$primaryLight",
370
371
  borderColor: "$primaryLight"
372
+ },
373
+ "&:focus": {
374
+ borderColor: "$smokedWhite"
371
375
  }
372
376
  }
373
377
  },
@@ -404,15 +408,17 @@ var Button = styled("button", {
404
408
  });
405
409
  Button.displayName = "Button";
406
410
 
411
+ // src/components/TextInput/index.tsx
412
+ import { forwardRef } from "react";
413
+
407
414
  // src/components/TextInput/styles.ts
408
415
  var TextInputContainer = styled("div", {
409
416
  backgroundColor: "$gray900",
410
- padding: "$3 $4",
411
417
  borderRadius: "$sm",
412
418
  boxSizing: "border-box",
413
419
  border: "2px solid $gray900",
414
420
  display: "flex",
415
- alignItems: "baseline",
421
+ alignItems: "center",
416
422
  "&:has(input:focus)": {
417
423
  borderColor: "$primary"
418
424
  },
@@ -421,6 +427,14 @@ var TextInputContainer = styled("div", {
421
427
  cursor: "not-alowed"
422
428
  },
423
429
  variants: {
430
+ size: {
431
+ small: {
432
+ padding: "$2 $3"
433
+ },
434
+ default: {
435
+ padding: "$3 $4"
436
+ }
437
+ },
424
438
  errored: {
425
439
  true: {
426
440
  borderColor: "$danger"
@@ -428,6 +442,7 @@ var TextInputContainer = styled("div", {
428
442
  }
429
443
  },
430
444
  defaultVariants: {
445
+ size: "default",
431
446
  errored: false
432
447
  }
433
448
  });
@@ -451,7 +466,7 @@ var Input = styled("input", {
451
466
  "&:disabled": {
452
467
  cursor: "not-allowed"
453
468
  },
454
- "&:placeholder": {
469
+ "&::placeholder": {
455
470
  color: "$gray400"
456
471
  }
457
472
  });
@@ -476,15 +491,20 @@ InputBox.displayName = "InputBox";
476
491
 
477
492
  // src/components/TextInput/index.tsx
478
493
  import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
479
- function TextInput(_a) {
480
- var _b = _a, { label, prefix, error } = _b, props = __objRest(_b, ["label", "prefix", "error"]);
481
- return /* @__PURE__ */ jsx3(InputBox, { label, error, children: /* @__PURE__ */ jsxs3(TextInputContainer, { errored: !!error, children: [
482
- !!prefix && /* @__PURE__ */ jsx3(Prefix, { children: prefix }),
483
- /* @__PURE__ */ jsx3(Input, __spreadValues({}, props))
484
- ] }) });
485
- }
494
+ var TextInput = forwardRef(
495
+ (_a, ref) => {
496
+ var _b = _a, { label, prefix, error, size } = _b, props = __objRest(_b, ["label", "prefix", "error", "size"]);
497
+ return /* @__PURE__ */ jsx3(InputBox, { label, error, children: /* @__PURE__ */ jsxs3(TextInputContainer, { errored: !!error, size, children: [
498
+ !!prefix && /* @__PURE__ */ jsx3(Prefix, { children: prefix }),
499
+ /* @__PURE__ */ jsx3(Input, __spreadValues({ ref }, props))
500
+ ] }) });
501
+ }
502
+ );
486
503
  TextInput.displayName = "TextInput";
487
504
 
505
+ // src/components/TextArea/index.tsx
506
+ import { forwardRef as forwardRef2 } from "react";
507
+
488
508
  // src/components/TextArea/styles.ts
489
509
  var TextAreaInput = styled("textarea", {
490
510
  backgroundColor: "$gray900",
@@ -506,7 +526,7 @@ var TextAreaInput = styled("textarea", {
506
526
  opacity: 0.5,
507
527
  cursor: "not-allowed"
508
528
  },
509
- "&:placeholder": {
529
+ "&::placeholder": {
510
530
  color: "$gray400"
511
531
  },
512
532
  variants: {
@@ -523,10 +543,10 @@ var TextAreaInput = styled("textarea", {
523
543
 
524
544
  // src/components/TextArea/index.tsx
525
545
  import { jsx as jsx4 } from "react/jsx-runtime";
526
- function TextArea(_a) {
546
+ var TextArea = forwardRef2((_a, ref) => {
527
547
  var _b = _a, { label, error } = _b, props = __objRest(_b, ["label", "error"]);
528
- return /* @__PURE__ */ jsx4(InputBox, { label, error, children: /* @__PURE__ */ jsx4(TextAreaInput, __spreadProps(__spreadValues({}, props), { errored: !!error })) });
529
- }
548
+ return /* @__PURE__ */ jsx4(InputBox, { label, error, children: /* @__PURE__ */ jsx4(TextAreaInput, __spreadProps(__spreadValues({ ref }, props), { errored: !!error })) });
549
+ });
530
550
  TextArea.displayName = "TextArea";
531
551
 
532
552
  // src/components/Checkbox/index.tsx
@@ -751,5 +771,13 @@ export {
751
771
  Heading,
752
772
  Text,
753
773
  TextArea,
754
- TextInput
774
+ TextInput,
775
+ config,
776
+ createTheme,
777
+ css,
778
+ getCssText,
779
+ globalCss,
780
+ keyframes,
781
+ styled,
782
+ theme
755
783
  };
package/package.json CHANGED
@@ -1,10 +1,13 @@
1
1
  {
2
2
  "name": "@spies-ui/react",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "",
5
5
  "main": "./dist/index.mjs",
6
6
  "module": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
8
11
  "scripts": {
9
12
  "build": "tsup src/index.tsx --format esm,cjs --dts --external react",
10
13
  "dev": "tsup src/index.tsx --format esm,cjs --dts --external react --watch",
package/.eslintrc.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "extends": "@spies-ui/eslint-config"
3
- }
@@ -1,18 +0,0 @@
1
-
2
- > @spies-ui/react@1.0.1 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.0.2
8
- CLI Target: es6
9
- ESM Build start
10
- CJS Build start
11
- CJS dist/index.js 20.79 KB
12
- CJS ⚡️ Build success in 23ms
13
- ESM dist/index.mjs 19.45 KB
14
- ESM ⚡️ Build success in 24ms
15
- DTS Build start
16
- DTS ⚡️ Build success in 1998ms
17
- DTS dist/index.d.mts 46.42 KB
18
- DTS dist/index.d.ts 46.42 KB
package/CHANGELOG.md DELETED
@@ -1,7 +0,0 @@
1
- # @spies-ui/react
2
-
3
- ## 1.0.1
4
-
5
- ### Patch Changes
6
-
7
- - Remove unnecessary comment
@@ -1,19 +0,0 @@
1
- import { ComponentProps } from 'react'
2
- import { AvatarContainer, AvatarFallback, AvatarImage } from './styles'
3
- import { User } from 'phosphor-react'
4
-
5
- export interface AvatarProps extends ComponentProps<typeof AvatarImage> {}
6
-
7
- export function Avatar(props: AvatarProps) {
8
- return (
9
- <AvatarContainer>
10
- <AvatarImage {...props} />
11
-
12
- <AvatarFallback delayMs={600}>
13
- <User />
14
- </AvatarFallback>
15
- </AvatarContainer>
16
- )
17
- }
18
-
19
- Avatar.displayName = 'Avatar'
@@ -1,31 +0,0 @@
1
- import * as Avatar from '@radix-ui/react-avatar'
2
- import { styled } from '../../styles'
3
-
4
- export const AvatarContainer = styled(Avatar.Root, {
5
- borderRadius: '$full',
6
- display: 'inline-block',
7
- width: '$12',
8
- height: '$12',
9
- overflow: 'hidden',
10
- })
11
-
12
- export const AvatarImage = styled(Avatar.Image, {
13
- width: '100%',
14
- height: '100%',
15
- objectFix: 'cover',
16
- borderRadius: 'inherit',
17
- })
18
- export const AvatarFallback = styled(Avatar.Fallback, {
19
- width: '100%',
20
- height: '100%',
21
- display: 'flex',
22
- alignItems: 'center',
23
- justifyContent: 'center',
24
- backgroundColor: '$gray600',
25
- color: '$gray800',
26
-
27
- svg: {
28
- width: '$6',
29
- height: '$6',
30
- },
31
- })
@@ -1,32 +0,0 @@
1
- import { ComponentProps, ElementType } from 'react'
2
- import { styled } from '../styles'
3
-
4
- export const Box = styled('div', {
5
- padding: '$4',
6
- borderRadius: '$md',
7
- variants: {
8
- background: {
9
- default: {
10
- backgroundColor: 'transparent',
11
- },
12
- gray600: {
13
- backgroundColor: '$gray600',
14
- },
15
- gray700: {
16
- backgroundColor: '$gray700',
17
- },
18
- gray800: {
19
- backgroundColor: '$gray800',
20
- },
21
- gray900: {
22
- backgroundColor: '$gray900',
23
- },
24
- },
25
- },
26
- })
27
-
28
- export interface BoxProps extends ComponentProps<typeof Box> {
29
- as?: ElementType
30
- }
31
-
32
- Box.displayName = 'Box'
@@ -1,97 +0,0 @@
1
- import { ComponentProps, ElementType } from 'react'
2
- import { styled } from '../styles'
3
-
4
- export const Button = styled('button', {
5
- all: 'unset',
6
- fontFamily: '$default',
7
- fontWeight: '$medium',
8
- fontSize: '$sm',
9
- textAlign: 'center',
10
- minWidth: 0,
11
- boxSizing: 'border-box',
12
-
13
- display: 'flex',
14
- alignItems: 'center',
15
- justifyContent: 'center',
16
- gap: '$2',
17
-
18
- cursor: 'pointer',
19
-
20
- transition: '0.2s',
21
-
22
- svg: {
23
- width: '$4',
24
- height: '$4',
25
- },
26
-
27
- '&:disabled': {
28
- cursor: 'not-allowed',
29
- backgroundColor: '$gray200',
30
- borderColor: '$gray200',
31
- },
32
-
33
- variants: {
34
- variant: {
35
- default: {
36
- backgroundColor: 'transparent',
37
- border: '2px solid $gray500',
38
- color: '$smokedWhite',
39
-
40
- '&:not(:disabled):hover': {
41
- // backgroundColor: '$smokedWhite',
42
- // borderColor: '$smokedWhite',
43
- // color: '$gray900',
44
- borderColor: '$gray600',
45
- },
46
- },
47
- primary: {
48
- backgroundColor: '$primary',
49
- border: '2px solid $primary',
50
- color: '$smokedWhite',
51
-
52
- '&:not(:disabled):hover': {
53
- backgroundColor: '$primaryLight',
54
- borderColor: '$primaryLight',
55
- },
56
- },
57
- },
58
-
59
- size: {
60
- default: {
61
- padding: '$3 $6',
62
- },
63
- fit: {
64
- width: '100%',
65
- paddingTop: '$3',
66
- paddingBottom: '$3',
67
- },
68
- small: {
69
- padding: '$3 $4',
70
- },
71
- },
72
-
73
- radius: {
74
- small: {
75
- borderRadius: '$sm',
76
- },
77
- default: {
78
- borderRadius: '$lg',
79
- },
80
- full: {
81
- borderRadius: '$full',
82
- },
83
- },
84
- },
85
-
86
- defaultVariants: {
87
- size: 'default',
88
- radius: 'default',
89
- variant: 'default',
90
- },
91
- })
92
-
93
- export interface ButtonProps extends ComponentProps<typeof Button> {
94
- as?: ElementType
95
- }
96
-
97
- Button.displayName = 'Button'
@@ -1,28 +0,0 @@
1
- import { Check } from 'phosphor-react'
2
- import { CheckboxContainer, CheckboxIndicator, CheckboxBox } from './styles'
3
- import { Text } from '../Text'
4
- import { InputBox } from '../InputBox'
5
- import { ComponentProps } from 'react'
6
-
7
- export interface CheckboxProps
8
- extends ComponentProps<typeof CheckboxContainer> {
9
- label?: string
10
- error?: string
11
- }
12
-
13
- export function Checkbox({ label, error, ...props }: CheckboxProps) {
14
- return (
15
- <InputBox error={error}>
16
- <CheckboxBox>
17
- <CheckboxContainer {...props} errored={!!error}>
18
- <CheckboxIndicator asChild>
19
- <Check weight="bold" />
20
- </CheckboxIndicator>
21
- </CheckboxContainer>
22
- {!!label && <Text size="sm">{label}</Text>}
23
- </CheckboxBox>
24
- </InputBox>
25
- )
26
- }
27
-
28
- Checkbox.displayName = 'Checkbox'