sprint-asia-custom-component 0.1.142 → 0.1.143

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
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.MyComponent = {}, global.React));
5
- })(this, (function (exports, React) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('.components/dropdownbutton')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'react', '.components/dropdownbutton'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.MyComponent = {}, global.React, global.dropdownbutton));
5
+ })(this, (function (exports, React, dropdownbutton) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -26,6 +26,7 @@
26
26
 
27
27
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
28
28
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
29
+ var dropdownbutton__default = /*#__PURE__*/_interopDefaultLegacy(dropdownbutton);
29
30
 
30
31
  var DefaultContext = {
31
32
  color: undefined,
@@ -48834,6 +48835,10 @@
48834
48835
  }, footer)));
48835
48836
  };
48836
48837
 
48838
+ Object.defineProperty(exports, 'DropdownButton', {
48839
+ enumerable: true,
48840
+ get: function () { return dropdownbutton__default["default"]; }
48841
+ });
48837
48842
  exports.Alert = Alert;
48838
48843
  exports.BillerList = BillerList;
48839
48844
  exports.BillerProductList = BillerProductList;
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.142",
4
+ "version": "0.1.143",
5
5
  "private": false,
6
6
  "dependencies": {
7
7
  "@headlessui/react": "^1.7.18",
@@ -54,7 +54,7 @@
54
54
  "@rollup/plugin-json": "^6.1.0",
55
55
  "@rollup/plugin-node-resolve": "^15.2.3",
56
56
  "postcss": "^8.4.35",
57
- "rollup": "^2.79.1",
57
+ "rollup": "^2.79.2",
58
58
  "rollup-plugin-babel": "^4.4.0",
59
59
  "rollup-plugin-postcss": "^4.0.2"
60
60
  }
@@ -0,0 +1,71 @@
1
+ import React, { useState } from 'react';
2
+ import { FaChevronDown } from 'react-icons/fa'; // Install dengan `npm install react-icons`
3
+
4
+ const DropdownButton = ({ defaultType = 'Voucher Type' }) => {
5
+ const [isOpen, setIsOpen] = useState(false);
6
+ const [selectedValue, setSelectedValue] = useState(defaultType);
7
+
8
+ const toggleDropdown = () => {
9
+ setIsOpen(!isOpen);
10
+ };
11
+
12
+ const handleOptionClick = (value) => {
13
+ setSelectedValue(value);
14
+ setIsOpen(false);
15
+ };
16
+
17
+ return (
18
+ <div style={{ position: 'relative', display: 'inline-block' }}>
19
+ <button
20
+ onClick={toggleDropdown}
21
+ style={{
22
+ display: 'flex',
23
+ alignItems: 'center',
24
+ justifyContent: 'space-between',
25
+ border: '1px solid #007bff',
26
+ background: '#fff',
27
+ color: '#007bff',
28
+ borderRadius: '5px',
29
+ padding: '10px 15px',
30
+ cursor: 'pointer',
31
+ fontSize: '16px',
32
+ fontWeight: 'bold',
33
+ }}
34
+ >
35
+ {selectedValue}
36
+ <FaChevronDown style={{ marginLeft: '8px' }} />
37
+ </button>
38
+ {isOpen && (
39
+ <div
40
+ style={{
41
+ position: 'absolute',
42
+ top: '100%',
43
+ left: '0',
44
+ background: '#fff',
45
+ boxShadow: '0 4px 6px rgba(0, 0, 0, 0.1)',
46
+ borderRadius: '5px',
47
+ marginTop: '8px',
48
+ zIndex: 10,
49
+ }}
50
+ >
51
+ <ul style={{ listStyle: 'none', margin: 0, padding: '10px 0' }}>
52
+ <li
53
+ style={{ padding: '10px 20px', cursor: 'pointer' }}
54
+ onClick={() => handleOptionClick('Digital Voucher')}
55
+ >
56
+ Digital Voucher
57
+ </li>
58
+ <li
59
+ style={{ padding: '10px 20px', cursor: 'pointer' }}
60
+ onClick={() => handleOptionClick('PPOB Voucher')}
61
+ >
62
+ PPOB Voucher
63
+ </li>
64
+ </ul>
65
+ </div>
66
+ )}
67
+ </div>
68
+ );
69
+ };
70
+
71
+ export default DropdownButton;
package/src/index.js CHANGED
@@ -90,6 +90,7 @@ import Header from "./components/header";
90
90
  import TextEditor from "./components/texteditor";
91
91
  import CustomPhone from "./components/customphone";
92
92
  import TextArea from "./components/textarea";
93
+ import DropdownButton from ".components/dropdownbutton";
93
94
 
94
95
  export {
95
96
  Header,
@@ -152,4 +153,5 @@ export {
152
153
  TextEditor,
153
154
  CustomPhone,
154
155
  TextArea,
156
+ DropdownButton,
155
157
  };
@@ -62,6 +62,7 @@ import CellModelSeven from "../components/table/listTable/cellmodelseven";
62
62
  import CustomPhone from "../components/customphone";
63
63
  import DescriptionFile from "../components/description/file";
64
64
  import FilterCheckboxDropdown from "../components/filter/filterCheckboxDropdown";
65
+ import DropdownButton from "../components/dropdownbutton";
65
66
 
66
67
  const Templates = () => {
67
68
  const [startDate, setStartDate] = useState(null);
@@ -862,9 +863,9 @@ const Templates = () => {
862
863
  titleRightButton="Submit"
863
864
  isActiveLeftButton
864
865
  isActiveRightButton
865
- onClickLeftButton={() => {}}
866
- onClickRightButton={() => {}}
867
- additionalButton={<PrimaryButton title={"Additional"} onClick={() => {}} isActive={true} />}
866
+ onClickLeftButton={() => { }}
867
+ onClickRightButton={() => { }}
868
+ additionalButton={<PrimaryButton title={"Additional"} onClick={() => { }} isActive={true} />}
868
869
  />
869
870
  </div>
870
871
 
@@ -1094,18 +1095,24 @@ const Templates = () => {
1094
1095
  onChangeEndDate={setEndDate}
1095
1096
  />
1096
1097
 
1098
+ <div className="m-9"></div>
1099
+ <p className="text-black font-bold text-2xl text-center py-2">Dropdown Button</p>
1100
+ <DropdownButton
1101
+ defaultType="Voucher Type"
1102
+ />
1103
+
1097
1104
  <div className="m-9"></div>
1098
1105
  <p className="text-black font-bold text-2xl text-center py-2">Description</p>
1099
1106
  <Description
1100
1107
  title="Sample Title"
1101
1108
  value={"This is a sample description.\n HHEHEEH \n LOh"}
1102
- // image="https://static.promediateknologi.id/crop/0x0:0x0/0x0/webp/photo/jawapos/2022/09/one-piece-red.jpeg"
1109
+ // image="https://static.promediateknologi.id/crop/0x0:0x0/0x0/webp/photo/jawapos/2022/09/one-piece-red.jpeg"
1103
1110
  />
1104
1111
  <Description
1105
1112
  title="Sample Title"
1106
1113
  value={"This is a sample description.\n HHEHEEH \n LOh"}
1107
1114
  icon={<PiCalendarBlank size={20} />}
1108
- // image="https://static.promediateknologi.id/crop/0x0:0x0/0x0/webp/photo/jawapos/2022/09/one-piece-red.jpeg"
1115
+ // image="https://static.promediateknologi.id/crop/0x0:0x0/0x0/webp/photo/jawapos/2022/09/one-piece-red.jpeg"
1109
1116
  />
1110
1117
 
1111
1118
  <div className="m-9"></div>
@@ -1174,20 +1181,20 @@ const Templates = () => {
1174
1181
  <FilterText options={["Option 1", "Option 2", "Option 3"]} onSelect={handleSelect} />
1175
1182
 
1176
1183
  <div className="m-9"></div>
1177
- <FilterCheckboxDropdown
1184
+ <FilterCheckboxDropdown
1178
1185
  options={[
1179
1186
  {
1180
- option : "Option1",
1181
- value : "value 1"
1187
+ option: "Option1",
1188
+ value: "value 1"
1182
1189
  },
1183
1190
  {
1184
- option : "Option2",
1185
- value : "value 2"
1191
+ option: "Option2",
1192
+ value: "value 2"
1186
1193
  },
1187
1194
  ]}
1188
1195
  buttonText="Division"
1189
1196
  currentValue={valueSelectFilter}
1190
- onSelect={setValueSelectFilter}
1197
+ onSelect={setValueSelectFilter}
1191
1198
  />
1192
1199
 
1193
1200
  {