jy-headless 0.0.25 → 0.0.27

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.
@@ -1,6 +1,6 @@
1
1
  import React, { CSSProperties, InputHTMLAttributes, ReactNode } from 'react';
2
2
  export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
3
- showLimit: boolean;
3
+ showLimit?: boolean;
4
4
  containerStyle?: CSSProperties;
5
5
  containerClassName?: string;
6
6
  prefixElement?: ReactNode;
package/dist/index.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import Button from './components/button/Button';
2
2
  import Input from './components/input/Input';
3
+ import NumberInput from './components/input/NumberInput';
3
4
  import DesktopKeyboardInput from './components/input/DesktopKeyboardInput';
4
5
  import Spinner from './components/spinner/Spinner';
5
6
  import RadioInput from './components/radio/RadioInput';
6
7
  import RadioGroup from './components/radio/RadioGroup';
7
8
  import Modal from './components/modal/Modal';
8
9
  import { CallIcon, CloseIcon, HomeIcon, SearchIcon } from './components/icons';
9
- export { Button, Input, DesktopKeyboardInput, Spinner, CallIcon, CloseIcon, HomeIcon, SearchIcon, RadioInput, RadioGroup, Modal, };
10
+ export { Button, Input, DesktopKeyboardInput, Spinner, CallIcon, CloseIcon, HomeIcon, SearchIcon, RadioInput, RadioGroup, Modal, NumberInput, };
package/dist/index.esm.js CHANGED
@@ -85,6 +85,63 @@ const Input = (_a) => {
85
85
  (typeof error === 'string' ? (React.createElement("span", { className: 'error-message', style: { position: 'absolute', top: '100%', left: 0 } }, error)) : (error))));
86
86
  };
87
87
 
88
+ const UpArrowIcon = ({ color = '#000', size = '1em', bgColor = 'transparent', fill = 'none', }) => {
89
+ return (React.createElement("svg", { width: size, height: size, fill: color, style: { backgroundColor: bgColor }, viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" },
90
+ React.createElement("g", { id: "SVGRepo_bgCarrier", strokeWidth: "0" }),
91
+ React.createElement("g", { id: "SVGRepo_tracerCarrier", strokeLinecap: "round", strokeLinejoin: "round" }),
92
+ React.createElement("g", { id: "SVGRepo_iconCarrier" },
93
+ React.createElement("path", { d: "M3 19h18a1.002 1.002 0 0 0 .823-1.569l-9-13c-.373-.539-1.271-.539-1.645 0l-9 13A.999.999 0 0 0 3 19z" }))));
94
+ };
95
+ // COLLECTION: Boxicons Filled Icons
96
+ // LICENSE: CC Attribution License
97
+ // AUTHOR: boxicons
98
+ // https://www.svgrepo.com/svg/334957/up-arrow
99
+
100
+ const DownArrowIcon = ({ color = '#000', size = '1em', bgColor = 'transparent', fill = 'none', }) => {
101
+ return (React.createElement("svg", { width: size, height: size, fill: color, style: { backgroundColor: bgColor }, viewBox: "0 0 24 24", transform: "matrix(1, 0, 0, -1, 0, 0)", xmlns: "http://www.w3.org/2000/svg" },
102
+ React.createElement("g", { id: "SVGRepo_bgCarrier", strokeWidth: "0" }),
103
+ React.createElement("g", { id: "SVGRepo_tracerCarrier", strokeLinecap: "round", strokeLinejoin: "round" }),
104
+ React.createElement("g", { id: "SVGRepo_iconCarrier" },
105
+ React.createElement("path", { d: "M3 19h18a1.002 1.002 0 0 0 .823-1.569l-9-13c-.373-.539-1.271-.539-1.645 0l-9 13A.999.999 0 0 0 3 19z" }))));
106
+ };
107
+ // COLLECTION: Boxicons Filled Icons
108
+ // LICENSE: CC Attribution License
109
+ // AUTHOR: boxicons
110
+ // https://www.svgrepo.com/svg/334957/up-arrow
111
+
112
+ const NumberInput = (_a) => {
113
+ var { increaseElement = React.createElement(UpArrowIcon, null), decreaseElement = React.createElement(DownArrowIcon, null), step = 1, min = -Infinity, max = Infinity, value, onChange } = _a, restProps = __rest(_a, ["increaseElement", "decreaseElement", "step", "min", "max", "value", "onChange"]);
114
+ const onNumberInput = (e) => {
115
+ const newValue = Number(e.target.value);
116
+ if (isNaN(newValue)) {
117
+ return;
118
+ }
119
+ onChange(Object.assign(Object.assign({}, e), { target: Object.assign(Object.assign({}, e.target), { value: newValue.toString() }) }));
120
+ };
121
+ const onNumberChange = (dir) => {
122
+ if (isNaN(value)) {
123
+ onChange(null);
124
+ return;
125
+ }
126
+ let newValue = (value !== null && value !== undefined ? value : 0) + dir * (step || 1);
127
+ if (newValue > max)
128
+ newValue = max;
129
+ if (newValue < min)
130
+ newValue = min;
131
+ const event = {
132
+ target: Object.assign(Object.assign({}, {}), { value: newValue.toString() }),
133
+ };
134
+ onChange(event);
135
+ };
136
+ const onIncrease = () => {
137
+ onNumberChange(1);
138
+ };
139
+ const onDecrease = () => {
140
+ onNumberChange(-1);
141
+ };
142
+ return (React.createElement(Input, Object.assign({}, restProps, { value: value, onChange: onNumberInput, prefixElement: React.cloneElement(decreaseElement, { onClick: onDecrease }), suffixElement: React.cloneElement(increaseElement, { onClick: onIncrease }) })));
143
+ };
144
+
88
145
  const functionRow = [
89
146
  [
90
147
  { code: 'Escape', label: 'Esc', key: 'Escape' },
@@ -470,5 +527,5 @@ const SearchIcon = ({ color = '#000', size = '1em', bgColor = 'transparent', fil
470
527
  // AUTHOR: Ankush Syal
471
528
  // https://www.svgrepo.com/svg/520583/call
472
529
 
473
- export { Button, CallIcon, CloseIcon, DesktopKeyboardInput, HomeIcon, Input, Modal, RadioGroup, RadioInput, SearchIcon, Spinner };
530
+ export { Button, CallIcon, CloseIcon, DesktopKeyboardInput, HomeIcon, Input, Modal, NumberInput, RadioGroup, RadioInput, SearchIcon, Spinner };
474
531
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.js CHANGED
@@ -87,6 +87,63 @@ const Input = (_a) => {
87
87
  (typeof error === 'string' ? (React.createElement("span", { className: 'error-message', style: { position: 'absolute', top: '100%', left: 0 } }, error)) : (error))));
88
88
  };
89
89
 
90
+ const UpArrowIcon = ({ color = '#000', size = '1em', bgColor = 'transparent', fill = 'none', }) => {
91
+ return (React.createElement("svg", { width: size, height: size, fill: color, style: { backgroundColor: bgColor }, viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" },
92
+ React.createElement("g", { id: "SVGRepo_bgCarrier", strokeWidth: "0" }),
93
+ React.createElement("g", { id: "SVGRepo_tracerCarrier", strokeLinecap: "round", strokeLinejoin: "round" }),
94
+ React.createElement("g", { id: "SVGRepo_iconCarrier" },
95
+ React.createElement("path", { d: "M3 19h18a1.002 1.002 0 0 0 .823-1.569l-9-13c-.373-.539-1.271-.539-1.645 0l-9 13A.999.999 0 0 0 3 19z" }))));
96
+ };
97
+ // COLLECTION: Boxicons Filled Icons
98
+ // LICENSE: CC Attribution License
99
+ // AUTHOR: boxicons
100
+ // https://www.svgrepo.com/svg/334957/up-arrow
101
+
102
+ const DownArrowIcon = ({ color = '#000', size = '1em', bgColor = 'transparent', fill = 'none', }) => {
103
+ return (React.createElement("svg", { width: size, height: size, fill: color, style: { backgroundColor: bgColor }, viewBox: "0 0 24 24", transform: "matrix(1, 0, 0, -1, 0, 0)", xmlns: "http://www.w3.org/2000/svg" },
104
+ React.createElement("g", { id: "SVGRepo_bgCarrier", strokeWidth: "0" }),
105
+ React.createElement("g", { id: "SVGRepo_tracerCarrier", strokeLinecap: "round", strokeLinejoin: "round" }),
106
+ React.createElement("g", { id: "SVGRepo_iconCarrier" },
107
+ React.createElement("path", { d: "M3 19h18a1.002 1.002 0 0 0 .823-1.569l-9-13c-.373-.539-1.271-.539-1.645 0l-9 13A.999.999 0 0 0 3 19z" }))));
108
+ };
109
+ // COLLECTION: Boxicons Filled Icons
110
+ // LICENSE: CC Attribution License
111
+ // AUTHOR: boxicons
112
+ // https://www.svgrepo.com/svg/334957/up-arrow
113
+
114
+ const NumberInput = (_a) => {
115
+ var { increaseElement = React.createElement(UpArrowIcon, null), decreaseElement = React.createElement(DownArrowIcon, null), step = 1, min = -Infinity, max = Infinity, value, onChange } = _a, restProps = __rest(_a, ["increaseElement", "decreaseElement", "step", "min", "max", "value", "onChange"]);
116
+ const onNumberInput = (e) => {
117
+ const newValue = Number(e.target.value);
118
+ if (isNaN(newValue)) {
119
+ return;
120
+ }
121
+ onChange(Object.assign(Object.assign({}, e), { target: Object.assign(Object.assign({}, e.target), { value: newValue.toString() }) }));
122
+ };
123
+ const onNumberChange = (dir) => {
124
+ if (isNaN(value)) {
125
+ onChange(null);
126
+ return;
127
+ }
128
+ let newValue = (value !== null && value !== undefined ? value : 0) + dir * (step || 1);
129
+ if (newValue > max)
130
+ newValue = max;
131
+ if (newValue < min)
132
+ newValue = min;
133
+ const event = {
134
+ target: Object.assign(Object.assign({}, {}), { value: newValue.toString() }),
135
+ };
136
+ onChange(event);
137
+ };
138
+ const onIncrease = () => {
139
+ onNumberChange(1);
140
+ };
141
+ const onDecrease = () => {
142
+ onNumberChange(-1);
143
+ };
144
+ return (React.createElement(Input, Object.assign({}, restProps, { value: value, onChange: onNumberInput, prefixElement: React.cloneElement(decreaseElement, { onClick: onDecrease }), suffixElement: React.cloneElement(increaseElement, { onClick: onIncrease }) })));
145
+ };
146
+
90
147
  const functionRow = [
91
148
  [
92
149
  { code: 'Escape', label: 'Esc', key: 'Escape' },
@@ -479,6 +536,7 @@ exports.DesktopKeyboardInput = DesktopKeyboardInput;
479
536
  exports.HomeIcon = HomeIcon;
480
537
  exports.Input = Input;
481
538
  exports.Modal = Modal;
539
+ exports.NumberInput = NumberInput;
482
540
  exports.RadioGroup = RadioGroup;
483
541
  exports.RadioInput = RadioInput;
484
542
  exports.SearchIcon = SearchIcon;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jy-headless",
3
- "version": "0.0.25",
3
+ "version": "0.0.27",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs",
6
6
  "typings": "dist/index.d.ts",