sprint-asia-custom-component 0.1.67 → 0.1.69

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
@@ -349,26 +349,24 @@
349
349
  type = "success",
350
350
  onClick
351
351
  }) => {
352
- return /*#__PURE__*/React__default["default"].createElement("div", {
353
- className: "w-fit",
354
- onClick: onClick
355
- }, /*#__PURE__*/React__default["default"].createElement("div", {
352
+ return /*#__PURE__*/React__default["default"].createElement("a", {
356
353
  className: `
357
- ${type == "neutral" && "text-neutral300 border-neutral300 bg-neutral30 cursor-pointer"}
358
- ${type == "success" && "text-success600 border-success600 bg-success50"}
359
- ${type == "primary" && "text-primary500 border-primary500 bg-primary50"}
360
- ${type == "dropdown" && "text-primary500 border-primary500 bg-primary50"}
361
- ${type == "warning" && "text-warning800 border-warning800 bg-warning50"}
362
- ${type == "danger" && "text-danger800 border-danger800 bg-danger50"}
363
- ' rounded-full text-xs border-2 flex items-center justify-center px-3.5`
354
+ ${type == "neutral" && "text-neutral300 border-neutral300 bg-neutral30 cursor-pointer"}
355
+ ${type == "success" && "text-success600 border-success600 bg-success50"}
356
+ ${type == "primary" && "text-primary500 border-primary500 bg-primary50"}
357
+ ${type == "dropdown" && "text-primary500 border-primary500 bg-primary50"}
358
+ ${type == "warning" && "text-warning800 border-warning800 bg-warning50"}
359
+ ${type == "danger" && "text-danger800 border-danger800 bg-danger50"}
360
+ ' rounded-full text-xs border-2 flex items-center px-3.5 justify-center`,
361
+ onClick: onClick
364
362
  }, /*#__PURE__*/React__default["default"].createElement("div", {
365
- className: "flex items-center justify-center"
363
+ className: "flex items-center"
366
364
  }, /*#__PURE__*/React__default["default"].createElement("p", {
367
- className: "py-1 text-center"
365
+ className: "py-1"
368
366
  }, title), type == "dropdown" && /*#__PURE__*/React__default["default"].createElement("p", {
369
367
  className: "text-md pl-2 cursor-pointer",
370
368
  onClick: onClick
371
- }, "x"))));
369
+ }, "x")));
372
370
  };
373
371
 
374
372
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -24070,7 +24068,8 @@
24070
24068
  isEdited = true,
24071
24069
  mode = "default",
24072
24070
  footer = null,
24073
- currentOption = ""
24071
+ currentOption = "",
24072
+ className = ""
24074
24073
  }) => {
24075
24074
  const [isOpen, setIsOpen] = React.useState(false);
24076
24075
  const dropdownRef = React.useRef(null);
@@ -24103,7 +24102,7 @@
24103
24102
  return val.value === currentOption;
24104
24103
  });
24105
24104
  return /*#__PURE__*/React__default["default"].createElement("div", {
24106
- className: "relative inline-block text-left w-full",
24105
+ className: `relative inline-block text-left w-full ${className}`,
24107
24106
  ref: dropdownRef
24108
24107
  }, title && /*#__PURE__*/React__default["default"].createElement("div", {
24109
24108
  className: "flex"
@@ -28926,11 +28925,12 @@
28926
28925
  rightIcon = null,
28927
28926
  placeholder = "",
28928
28927
  footer = null,
28929
- type = 'text',
28928
+ type = "text",
28930
28929
  mode = "default",
28931
28930
  isRequired = true,
28932
28931
  value,
28933
- onChangeInput
28932
+ onChangeInput,
28933
+ className = ""
28934
28934
  }) => {
28935
28935
  const [isFocused, setIsFocused] = React.useState(false);
28936
28936
  const [showPassword, setShowPassword] = React.useState(false);
@@ -28944,7 +28944,7 @@
28944
28944
  setShowPassword(!showPassword);
28945
28945
  };
28946
28946
  return /*#__PURE__*/React__default["default"].createElement("div", {
28947
- className: "w-full"
28947
+ className: `w-full ${className}`
28948
28948
  }, title && /*#__PURE__*/React__default["default"].createElement("div", {
28949
28949
  className: "flex"
28950
28950
  }, /*#__PURE__*/React__default["default"].createElement("p", {
@@ -28963,22 +28963,22 @@
28963
28963
  ${mode === "danger" && "text-danger500"}
28964
28964
  `
28965
28965
  })), /*#__PURE__*/React__default["default"].createElement("input", {
28966
- type: type === 'password' ? showPassword ? 'text' : 'password' : type,
28966
+ type: type === "password" ? showPassword ? "text" : "password" : type,
28967
28967
  className: `py-2.5 px-4 w-full font-normal text-sm text-neutral300 rounded-md border
28968
- ${!value && mode === "default" && 'bg-neutral20 border-neutral50 focus:outline-2 outline-primary500'}
28969
- ${value && mode === "default" && 'bg-neutral20 border-black focus:outline-2 outline-primary500'}
28970
- ${isFocused && mode === "default" && 'bg-neutral20 border-primary500'}
28971
- ${mode === "disable" && 'bg-neutral30 border-neutral50'}
28972
- ${mode === "danger" && 'bg-danger50 border-danger500 focus:outline-2 outline-danger500'}
28973
- ${leftIcon ? 'pl-10' : 'pl-3'}
28974
- ${rightIcon ? 'pr-10' : 'pr-3'}`,
28968
+ ${!value && mode === "default" && "bg-neutral20 border-neutral50 focus:outline-2 outline-primary500"}
28969
+ ${value && mode === "default" && "bg-neutral20 border-black focus:outline-2 outline-primary500"}
28970
+ ${isFocused && mode === "default" && "bg-neutral20 border-primary500"}
28971
+ ${mode === "disable" && "bg-neutral30 border-neutral50"}
28972
+ ${mode === "danger" && "bg-danger50 border-danger500 focus:outline-2 outline-danger500"}
28973
+ ${leftIcon ? "pl-10" : "pl-3"}
28974
+ ${rightIcon ? "pr-10" : "pr-3"}`,
28975
28975
  placeholder: placeholder,
28976
28976
  disabled: mode === "disable",
28977
28977
  value: value,
28978
28978
  onChange: onChangeInput,
28979
28979
  onFocus: handleFocus,
28980
28980
  onBlur: handleBlur
28981
- }), type === 'password' && /*#__PURE__*/React__default["default"].createElement("span", {
28981
+ }), type === "password" && /*#__PURE__*/React__default["default"].createElement("span", {
28982
28982
  className: "absolute inset-y-0 right-0 pr-4 flex items-center cursor-pointer",
28983
28983
  onClick: handleTogglePasswordVisibility
28984
28984
  }, showPassword ? /*#__PURE__*/React__default["default"].createElement(PiEye, {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sprint-asia-custom-component",
3
3
  "main": "dist/index.js",
4
- "version": "0.1.67",
4
+ "version": "0.1.69",
5
5
  "private": false,
6
6
  "dependencies": {
7
7
  "@headlessui/react": "^1.7.18",
@@ -1,30 +1,28 @@
1
- import React from 'react'
1
+ import React from "react";
2
2
 
3
- const Chip = ({
4
- title = "Approve",
5
- type = "success",
6
- onClick
7
- }) => {
3
+ const Chip = ({ title = "Approve", type = "success", onClick }) => {
8
4
  return (
9
- <div className='w-fit' onClick={onClick}>
10
- <div className={`
11
- ${type == "neutral" && "text-neutral300 border-neutral300 bg-neutral30 cursor-pointer"}
12
- ${type == "success" && "text-success600 border-success600 bg-success50"}
13
- ${type == "primary" && "text-primary500 border-primary500 bg-primary50"}
14
- ${type == "dropdown" && "text-primary500 border-primary500 bg-primary50"}
15
- ${type == "warning" && "text-warning800 border-warning800 bg-warning50"}
16
- ${type == "danger" && "text-danger800 border-danger800 bg-danger50"}
17
- ' rounded-full text-xs border-2 flex items-center justify-center px-3.5`}>
5
+ <a
6
+ className={`
7
+ ${type == "neutral" && "text-neutral300 border-neutral300 bg-neutral30 cursor-pointer"}
8
+ ${type == "success" && "text-success600 border-success600 bg-success50"}
9
+ ${type == "primary" && "text-primary500 border-primary500 bg-primary50"}
10
+ ${type == "dropdown" && "text-primary500 border-primary500 bg-primary50"}
11
+ ${type == "warning" && "text-warning800 border-warning800 bg-warning50"}
12
+ ${type == "danger" && "text-danger800 border-danger800 bg-danger50"}
13
+ ' rounded-full text-xs border-2 flex items-center px-3.5 justify-center`}
14
+ onClick={onClick}
15
+ >
16
+ <div className="flex items-center">
17
+ <p className="py-1">{title}</p>
18
+ {type == "dropdown" && (
19
+ <p className="text-md pl-2 cursor-pointer" onClick={onClick}>
20
+ x
21
+ </p>
22
+ )}
23
+ </div>
24
+ </a>
25
+ );
26
+ };
18
27
 
19
- <div className='flex items-center justify-center'>
20
- <p className='py-1 text-center'>{title}</p>
21
- {
22
- type == "dropdown" && <p className='text-md pl-2 cursor-pointer' onClick={onClick}>x</p>
23
- }
24
- </div>
25
- </div>
26
- </div>
27
- )
28
- }
29
-
30
- export default Chip
28
+ export default Chip;
@@ -11,6 +11,7 @@ const DropdownText = ({
11
11
  mode = "default",
12
12
  footer = null,
13
13
  currentOption = "",
14
+ className = "",
14
15
  }) => {
15
16
  const [isOpen, setIsOpen] = useState(false);
16
17
  const dropdownRef = useRef(null);
@@ -47,7 +48,7 @@ const DropdownText = ({
47
48
  });
48
49
 
49
50
  return (
50
- <div className="relative inline-block text-left w-full" ref={dropdownRef}>
51
+ <div className={`relative inline-block text-left w-full ${className}`} ref={dropdownRef}>
51
52
  {title && (
52
53
  <div className="flex">
53
54
  <p className="text-sm font-normal text-black mb-1">{title}</p>
@@ -1,106 +1,122 @@
1
- import React, { useState } from 'react';
2
- import { PiEyeClosedLight, PiEye, PiInfo } from 'react-icons/pi';
1
+ import React, { useState } from "react";
2
+ import { PiEyeClosedLight, PiEye, PiInfo } from "react-icons/pi";
3
3
 
4
4
  const TextInput = ({
5
- title = "",
6
- leftIcon = null,
7
- rightIcon = null,
8
- placeholder = "",
9
- footer = null,
10
- type = 'text',
11
- mode = "default",
12
- isRequired = true,
13
- value,
14
- onChangeInput
5
+ title = "",
6
+ leftIcon = null,
7
+ rightIcon = null,
8
+ placeholder = "",
9
+ footer = null,
10
+ type = "text",
11
+ mode = "default",
12
+ isRequired = true,
13
+ value,
14
+ onChangeInput,
15
+ className = "",
15
16
  }) => {
16
- const [isFocused, setIsFocused] = useState(false);
17
- const [showPassword, setShowPassword] = useState(false);
17
+ const [isFocused, setIsFocused] = useState(false);
18
+ const [showPassword, setShowPassword] = useState(false);
18
19
 
19
- const handleFocus = () => {
20
- setIsFocused(true);
21
- };
20
+ const handleFocus = () => {
21
+ setIsFocused(true);
22
+ };
22
23
 
23
- const handleBlur = () => {
24
- setIsFocused(false);
25
- };
24
+ const handleBlur = () => {
25
+ setIsFocused(false);
26
+ };
26
27
 
27
- const handleTogglePasswordVisibility = () => {
28
- setShowPassword(!showPassword);
29
- };
28
+ const handleTogglePasswordVisibility = () => {
29
+ setShowPassword(!showPassword);
30
+ };
30
31
 
31
- return (
32
- <div className='w-full'>
33
- {title &&
34
- <div className='flex'>
35
- <p className="text-sm font-normal text-black mb-1">{title}</p>
36
- {
37
- isRequired && <p className="text-sm font-normal text-danger500 ml-1">*</p>
38
- }
39
- </div>
40
- }
32
+ return (
33
+ <div className={`w-full ${className}`}>
34
+ {title && (
35
+ <div className="flex">
36
+ <p className="text-sm font-normal text-black mb-1">{title}</p>
37
+ {isRequired && <p className="text-sm font-normal text-danger500 ml-1">*</p>}
38
+ </div>
39
+ )}
41
40
 
42
- <div className="relative rounded-md">
43
- {leftIcon && (
44
- <span className="absolute inset-y-0 left-0 pl-4 flex items-center pointer-events-none">
45
- <PiInfo size={16} className={`
41
+ <div className="relative rounded-md">
42
+ {leftIcon && (
43
+ <span className="absolute inset-y-0 left-0 pl-4 flex items-center pointer-events-none">
44
+ <PiInfo
45
+ size={16}
46
+ className={`
46
47
  ${mode === "primary" && "text-black"}
47
48
  ${mode === "disable" && "text-neutral50"}
48
49
  ${mode === "danger" && "text-danger500"}
49
- `}/>
50
- </span>
51
- )}
50
+ `}
51
+ />
52
+ </span>
53
+ )}
52
54
 
53
- <input
54
- type={type === 'password' ? (showPassword ? 'text' : 'password') : type}
55
- className={`py-2.5 px-4 w-full font-normal text-sm text-neutral300 rounded-md border
56
- ${!value && mode === "default" && 'bg-neutral20 border-neutral50 focus:outline-2 outline-primary500'}
57
- ${value && mode === "default" && 'bg-neutral20 border-black focus:outline-2 outline-primary500'}
58
- ${isFocused && mode === "default" && 'bg-neutral20 border-primary500'}
59
- ${mode === "disable" && 'bg-neutral30 border-neutral50'}
60
- ${mode === "danger" && 'bg-danger50 border-danger500 focus:outline-2 outline-danger500'}
61
- ${leftIcon ? 'pl-10' : 'pl-3'}
62
- ${rightIcon ? 'pr-10' : 'pr-3'}`}
63
- placeholder={placeholder}
64
- disabled={mode === "disable"}
65
- value={value}
66
- onChange={onChangeInput}
67
- onFocus={handleFocus}
68
- onBlur={handleBlur}
69
- />
55
+ <input
56
+ type={type === "password" ? (showPassword ? "text" : "password") : type}
57
+ className={`py-2.5 px-4 w-full font-normal text-sm text-neutral300 rounded-md border
58
+ ${
59
+ !value &&
60
+ mode === "default" &&
61
+ "bg-neutral20 border-neutral50 focus:outline-2 outline-primary500"
62
+ }
63
+ ${value && mode === "default" && "bg-neutral20 border-black focus:outline-2 outline-primary500"}
64
+ ${isFocused && mode === "default" && "bg-neutral20 border-primary500"}
65
+ ${mode === "disable" && "bg-neutral30 border-neutral50"}
66
+ ${mode === "danger" && "bg-danger50 border-danger500 focus:outline-2 outline-danger500"}
67
+ ${leftIcon ? "pl-10" : "pl-3"}
68
+ ${rightIcon ? "pr-10" : "pr-3"}`}
69
+ placeholder={placeholder}
70
+ disabled={mode === "disable"}
71
+ value={value}
72
+ onChange={onChangeInput}
73
+ onFocus={handleFocus}
74
+ onBlur={handleBlur}
75
+ />
70
76
 
71
- {type === 'password' && (
72
- <span className="absolute inset-y-0 right-0 pr-4 flex items-center cursor-pointer" onClick={handleTogglePasswordVisibility}>
73
- {showPassword ? <PiEye size={16} className={`text-black ${mode === "danger" && "text-danger500"}`} /> : <PiEyeClosedLight size={16} className={`text-black ${mode === "danger" && "text-danger500"}`} />}
74
- </span>
75
- )}
77
+ {type === "password" && (
78
+ <span
79
+ className="absolute inset-y-0 right-0 pr-4 flex items-center cursor-pointer"
80
+ onClick={handleTogglePasswordVisibility}
81
+ >
82
+ {showPassword ? (
83
+ <PiEye size={16} className={`text-black ${mode === "danger" && "text-danger500"}`} />
84
+ ) : (
85
+ <PiEyeClosedLight size={16} className={`text-black ${mode === "danger" && "text-danger500"}`} />
86
+ )}
87
+ </span>
88
+ )}
76
89
 
77
- {rightIcon && (
78
- <span className="absolute inset-y-0 right-0 pr-4 flex items-center pointer-events-none">
79
- <PiInfo size={16} className={`
90
+ {rightIcon && (
91
+ <span className="absolute inset-y-0 right-0 pr-4 flex items-center pointer-events-none">
92
+ <PiInfo
93
+ size={16}
94
+ className={`
80
95
  ${mode === "primary" && "text-black"}
81
96
  ${mode === "disable" && "text-neutral50"}
82
97
  ${mode === "danger" && "text-danger500"}
83
- `}/>
84
- </span>
85
- )}
86
- </div>
98
+ `}
99
+ />
100
+ </span>
101
+ )}
102
+ </div>
87
103
 
88
- {footer && (
89
- <div className='mt-1'>
90
- {mode === "danger" ? (
91
- <div className='flex'>
92
- <div>
93
- <PiInfo size={16} className='text-danger500' />
94
- </div>
95
- <p className="text-danger500 text-xs ml-1">{footer}</p>
96
- </div>
97
- ) : (
98
- <p className="text-black text-xs">{footer}</p>
99
- )}
100
- </div>
101
- )}
104
+ {footer && (
105
+ <div className="mt-1">
106
+ {mode === "danger" ? (
107
+ <div className="flex">
108
+ <div>
109
+ <PiInfo size={16} className="text-danger500" />
110
+ </div>
111
+ <p className="text-danger500 text-xs ml-1">{footer}</p>
112
+ </div>
113
+ ) : (
114
+ <p className="text-black text-xs">{footer}</p>
115
+ )}
102
116
  </div>
103
- );
117
+ )}
118
+ </div>
119
+ );
104
120
  };
105
121
 
106
- export default TextInput;
122
+ export default TextInput;