wini-web-components 2.1.5 → 2.1.6

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 CHANGED
@@ -6,65 +6,13 @@ This project was bootstrapped with [Create React App](https://github.com/faceboo
6
6
 
7
7
  In the project directory, you can run:
8
8
 
9
- ### `npm start`
9
+ ### `npm i wini-web-components`
10
10
 
11
- Runs the app in the development mode.\
12
- Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
11
+ ### Using Skin
12
+ add this cdn link into your App.css file
13
+ @import url(https://cdn.jsdelivr.net/gh/WiniGit/web-component@latest/src/skin/root.css);
14
+ @import url(https://cdn.jsdelivr.net/gh/WiniGit/web-component@latest/src/skin/typography.css);
15
+ @import url(https://cdn.jsdelivr.net/gh/WiniGit/web-component@latest/src/skin/layout.css);
13
16
 
14
- The page will reload when you make changes.\
15
- You may also see any lint errors in the console.
16
17
 
17
- ### `npm test`
18
18
 
19
- Launches the test runner in the interactive watch mode.\
20
- See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21
-
22
- ### `npm run build`
23
-
24
- Builds the app for production to the `build` folder.\
25
- It correctly bundles React in production mode and optimizes the build for the best performance.
26
-
27
- The build is minified and the filenames include the hashes.\
28
- Your app is ready to be deployed!
29
-
30
- See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31
-
32
- ### `npm run eject`
33
-
34
- **Note: this is a one-way operation. Once you `eject`, you can't go back!**
35
-
36
- If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37
-
38
- Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
39
-
40
- You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
41
-
42
- ## Learn More
43
-
44
- You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45
-
46
- To learn React, check out the [React documentation](https://reactjs.org/).
47
-
48
- ### Code Splitting
49
-
50
- This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
51
-
52
- ### Analyzing the Bundle Size
53
-
54
- This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
55
-
56
- ### Making a Progressive Web App
57
-
58
- This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
59
-
60
- ### Advanced Configuration
61
-
62
- This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
63
-
64
- ### Deployment
65
-
66
- This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
67
-
68
- ### `npm run build` fails to minify
69
-
70
- This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
@@ -7,7 +7,10 @@ interface DatePickerProps {
7
7
  min?: Date;
8
8
  max?: Date;
9
9
  onChange?: (e?: string) => void;
10
+ onComplete?: React.KeyboardEventHandler<HTMLInputElement>;
11
+ onFocus?: React.FocusEventHandler<HTMLInputElement>;
10
12
  disabled?: boolean;
13
+ pickOnly?: boolean;
11
14
  helperText?: string;
12
15
  helperTextColor?: string;
13
16
  placeholder?: string;
@@ -27,6 +30,7 @@ export declare class DatePicker extends React.Component<DatePickerProps, DatePic
27
30
  constructor(props: DatePickerProps);
28
31
  getNewValue: (value?: string) => Date | undefined;
29
32
  componentDidUpdate(prevProps: DatePickerProps, prevState: DatePickerState): void;
33
+ private onOpenCalendar;
30
34
  render(): React.JSX.Element;
31
35
  }
32
36
  export {};
@@ -37,18 +37,6 @@ require("./date-picker.css");
37
37
  var index_1 = require("../../index");
38
38
  var calendar_1 = require("../calendar/calendar");
39
39
  var date_fns_1 = require("date-fns");
40
- var CalendarIcon = function (_a) {
41
- var _b = _a.color, color = _b === void 0 ? '#00204D99' : _b, _c = _a.width, width = _c === void 0 ? '1.6rem' : _c, _d = _a.height, height = _d === void 0 ? '1.6rem' : _d;
42
- return (react_1.default.createElement("svg", { xmlns: 'http://www.w3.org/2000/svg', width: '100%', height: '100%', viewBox: '0 0 17 16', fill: 'none', style: { width: width, height: height } },
43
- react_1.default.createElement("path", { d: 'M12.3876 2.99967V1.88856C12.3876 1.74122 12.3291 1.59991 12.2249 1.49573C12.1207 1.39154 11.9794 1.33301 11.832 1.33301C11.6847 1.33301 11.5434 1.39154 11.4392 1.49573C11.335 1.59991 11.2765 1.74122 11.2765 1.88856V2.99967H12.3876Z', fill: color }),
44
- react_1.default.createElement("path", { d: 'M5.72092 2.99967V1.88856C5.72092 1.74122 5.66239 1.59991 5.5582 1.49573C5.45401 1.39154 5.31271 1.33301 5.16536 1.33301C5.01802 1.33301 4.87671 1.39154 4.77253 1.49573C4.66834 1.59991 4.60981 1.74122 4.60981 1.88856V2.99967H5.72092Z', fill: color }),
45
- react_1.default.createElement("path", { d: 'M13.4987 14.1108H3.4987C3.05667 14.1108 2.63275 13.9352 2.32019 13.6226C2.00763 13.3101 1.83203 12.8861 1.83203 12.4441V5.2219C1.83203 4.77987 2.00763 4.35595 2.32019 4.04339C2.63275 3.73082 3.05667 3.55523 3.4987 3.55523H13.4987C13.9407 3.55523 14.3646 3.73082 14.6772 4.04339C14.9898 4.35595 15.1654 4.77987 15.1654 5.2219V12.4441C15.1654 12.8861 14.9898 13.3101 14.6772 13.6226C14.3646 13.9352 13.9407 14.1108 13.4987 14.1108ZM14.0543 6.33301H2.94314V12.4441C2.94314 12.5915 3.00167 12.7328 3.10586 12.837C3.21005 12.9411 3.35136 12.9997 3.4987 12.9997H13.4987C13.646 12.9997 13.7873 12.9411 13.8915 12.837C13.9957 12.7328 14.0543 12.5915 14.0543 12.4441V6.33301Z', fill: color }),
46
- react_1.default.createElement("path", { d: 'M6.27648 7.44412H4.05425V9.11079H6.27648V7.44412Z', fill: color }),
47
- react_1.default.createElement("path", { d: 'M9.60981 7.44412H7.38759V9.11079H9.60981V7.44412Z', fill: color }),
48
- react_1.default.createElement("path", { d: 'M6.27648 10.2219H4.05425V11.8886H6.27648V10.2219Z', fill: color }),
49
- react_1.default.createElement("path", { d: 'M9.60981 10.2219H7.38759V11.8886H9.60981V10.2219Z', fill: color }),
50
- react_1.default.createElement("path", { d: 'M12.9431 7.44412H10.7209V9.11079H12.9431V7.44412Z', fill: color })));
51
- };
52
40
  var dateToString = function (x, y) {
53
41
  if (y === void 0) { y = "dd/mm/yyyy"; }
54
42
  var splitDateTime = y.split(" ");
@@ -152,6 +140,11 @@ var DatePicker = /** @class */ (function (_super) {
152
140
  }
153
141
  return undefined;
154
142
  };
143
+ _this.onOpenCalendar = function (ev) {
144
+ if (!_this.state.isOpen) {
145
+ _this.setState(__assign(__assign({}, _this.state), { isOpen: true, style: undefined, offset: ev.target.closest('.date-picker-container').getBoundingClientRect() }));
146
+ }
147
+ };
155
148
  _this.state = {
156
149
  value: props.value,
157
150
  offset: {
@@ -216,7 +209,21 @@ var DatePicker = /** @class */ (function (_super) {
216
209
  }
217
210
  return react_1.default.createElement("div", { id: this.props.id, className: "date-picker-container row ".concat((_a = this.props.className) !== null && _a !== void 0 ? _a : 'body-3', " ").concat(this.props.disabled ? 'disabled' : '', " ").concat(((_b = this.props.helperText) === null || _b === void 0 ? void 0 : _b.length) && 'helper-text'), "helper-text": this.props.helperText, style: this.props.style ? __assign(__assign({}, { '--helper-text-color': (_c = this.props.helperTextColor) !== null && _c !== void 0 ? _c : '#e14337' }), this.props.style) : { '--helper-text-color': (_d = this.props.helperTextColor) !== null && _d !== void 0 ? _d : '#e14337' } },
218
211
  react_1.default.createElement("div", { className: 'input-field-value row', style: { height: '4rem' } },
219
- react_1.default.createElement("input", { autoComplete: 'off', value: (_e = this.state.value) !== null && _e !== void 0 ? _e : '', onChange: function (ev) { return _this.setState(__assign(__assign({}, _this.state), { value: ev.target.value })); }, placeholder: this.props.placeholder, maxLength: maxLength, onBlur: function (ev) {
212
+ react_1.default.createElement("input", { autoComplete: 'off', value: (_e = this.state.value) !== null && _e !== void 0 ? _e : '', onChange: function (ev) { return _this.setState(__assign(__assign({}, _this.state), { value: ev.target.value })); }, placeholder: this.props.placeholder, maxLength: maxLength, readOnly: this.props.pickOnly, onFocus: this.props.pickOnly ? function (ev) {
213
+ _this.onOpenCalendar(ev);
214
+ if (_this.props.onFocus)
215
+ _this.props.onFocus(ev);
216
+ } : this.props.onFocus, onKeyDown: this.props.onComplete ? function (ev) {
217
+ if (_this.props.onComplete) {
218
+ switch (ev.key.toLowerCase()) {
219
+ case "enter":
220
+ _this.props.onComplete(ev);
221
+ break;
222
+ default:
223
+ break;
224
+ }
225
+ }
226
+ } : undefined, onBlur: function (ev) {
220
227
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
221
228
  var inputValue = ev.target.value.trim();
222
229
  switch (_this.props.pickerType) {
@@ -298,13 +305,7 @@ var DatePicker = /** @class */ (function (_super) {
298
305
  break;
299
306
  }
300
307
  } })),
301
- react_1.default.createElement("button", { type: 'button', onClick: function (ev) {
302
- var _a;
303
- if (!_this.state.isOpen) {
304
- _this.setState(__assign(__assign({}, _this.state), { isOpen: true, style: undefined, offset: ((_a = ev.target.closest('.date-picker-container')) !== null && _a !== void 0 ? _a : ev.target).getBoundingClientRect() }));
305
- }
306
- }, className: 'row', style: { padding: '0.4rem' } },
307
- react_1.default.createElement(CalendarIcon, null)),
308
+ react_1.default.createElement(index_1.Winicon, { src: "outline/user interface/".concat(this.props.pickerType === index_1.CalendarType.DATETIME ? "opening-times" : "calendar-date-2"), size: '1.6rem', onClick: this.onOpenCalendar }),
308
309
  this.state.isOpen &&
309
310
  react_dom_1.default.createPortal(react_1.default.createElement("div", { className: "popup-overlay hidden-overlay", onClick: function (ev) {
310
311
  if (ev.target.classList.contains('popup-overlay'))
@@ -78,16 +78,19 @@ var Dialog = /** @class */ (function (_super) {
78
78
  return (react_1.default.createElement(react_1.default.Fragment, null, this.state.open &&
79
79
  react_dom_1.default.createPortal(react_1.default.createElement("div", { className: dialog_module_css_1.default['dialog-overlay'] },
80
80
  react_1.default.createElement("div", { className: "".concat(dialog_module_css_1.default['dialog-container'], " col"), style: { width: '41.4rem', alignItems: this.state.alignment }, "dialog-type": this.state.status, onClick: function (e) { return e.stopPropagation(); } },
81
- react_1.default.createElement("div", { key: 'dialog-body', className: "".concat(dialog_module_css_1.default['dialog-body'], " col"), style: { alignItems: 'inherit' } },
81
+ react_1.default.createElement("div", { className: "".concat(dialog_module_css_1.default['dialog-body'], " col"), style: { alignItems: 'inherit' } },
82
82
  react_1.default.createElement("div", { className: "".concat(dialog_module_css_1.default['dialog-status'], " row") }, (0, index_1.getStatusIcon)(this.state.status)),
83
- react_1.default.createElement("div", { className: dialog_module_css_1.default['dialog-title'], style: { textAlign: this.state.alignment === DialogAlignment.center ? 'center' : 'start' } }, this.state.title),
84
- react_1.default.createElement("div", { className: dialog_module_css_1.default['dialog-content'], style: { textAlign: this.state.alignment === DialogAlignment.center ? 'center' : 'start' } }, this.state.content)),
85
- react_1.default.createElement("div", { key: 'dialog-footer', className: "".concat(dialog_module_css_1.default['dialog-footer'], " row") },
86
- react_1.default.createElement("button", { type: 'button', style: this.state.alignment === DialogAlignment.center ? { flex: 1, width: '100%' } : undefined, onClick: function () { return _this.setState({ open: false }); }, className: dialog_module_css_1.default['dialog-action'] }, (_a = this.state.cancelTitle) !== null && _a !== void 0 ? _a : "Quay lại"),
83
+ react_1.default.createElement("div", { className: 'col' },
84
+ react_1.default.createElement(index_1.Text, { className: 'heading-6', style: { textAlign: this.state.alignment === DialogAlignment.center ? 'center' : 'start' } }, this.state.title),
85
+ react_1.default.createElement(index_1.Text, { className: 'body-3', style: { textAlign: this.state.alignment === DialogAlignment.center ? 'center' : 'start' } }, this.state.content))),
86
+ react_1.default.createElement("div", { className: "".concat(dialog_module_css_1.default['dialog-footer'], " row") },
87
+ react_1.default.createElement("button", { type: 'button', style: this.state.alignment === DialogAlignment.center ? { flex: 1, width: '100%' } : undefined, onClick: function () { return _this.setState({ open: false }); }, className: "".concat(dialog_module_css_1.default['dialog-action'], " row") },
88
+ react_1.default.createElement(index_1.Text, { className: 'button-text-3' }, (_a = this.state.cancelTitle) !== null && _a !== void 0 ? _a : "Cancel")),
87
89
  react_1.default.createElement("button", { type: 'button', style: this.state.alignment === DialogAlignment.center ? { flex: 1, width: '100%' } : undefined, onClick: function () {
88
90
  _this.state.onSubmit();
89
91
  _this.setState({ open: false });
90
- }, className: "".concat(dialog_module_css_1.default['dialog-action'], " ").concat(dialog_module_css_1.default['dialog-submit']) }, (_b = this.state.submitTitle) !== null && _b !== void 0 ? _b : 'Xác nhận')))), document.body)));
92
+ }, className: "".concat(dialog_module_css_1.default['dialog-action'], " row ").concat(dialog_module_css_1.default['dialog-submit']) },
93
+ react_1.default.createElement(index_1.Text, { className: 'button-text-3' }, (_b = this.state.submitTitle) !== null && _b !== void 0 ? _b : 'Submit'))))), document.body)));
91
94
  };
92
95
  return Dialog;
93
96
  }(react_1.default.Component));
@@ -279,7 +279,10 @@ var SelectMultiple = /** @class */ (function (_super) {
279
279
  if (_this.state.value.length)
280
280
  _this.setState(__assign(__assign({}, _this.state), { isOpen: true, value: [] }));
281
281
  } },
282
- react_1.default.createElement(winicon_1.Winicon, { src: "outline/user interface/c-remove", size: '1.6rem' })) : react_1.default.createElement("div", { className: 'row', style: { display: (this.containerRef.current && this.containerRef.current.getBoundingClientRect().width >= 120) ? "flex" : "none" } },
282
+ react_1.default.createElement(winicon_1.Winicon, { src: "outline/user interface/c-remove", size: '1.6rem' })) : react_1.default.createElement("div", { ref: function (iconRef) {
283
+ if ((iconRef === null || iconRef === void 0 ? void 0 : iconRef.parentElement) && iconRef.parentElement.getBoundingClientRect().width < 100)
284
+ iconRef.style.display = "none";
285
+ }, className: 'row' },
283
286
  react_1.default.createElement(winicon_1.Winicon, { src: this.state.isOpen ? "fill/arrows/up-arrow" : "fill/arrows/down-arrow", size: '1.2rem' })),
284
287
  this.state.isOpen &&
285
288
  react_dom_1.default.createPortal(react_1.default.createElement("div", { className: "".concat(input_multi_select_module_css_1.default['select-multi-popup'], " select-multi-popup col ").concat((_e = this.props.popupClassName) !== null && _e !== void 0 ? _e : ""), style: (_f = this.state.style) !== null && _f !== void 0 ? _f : {
@@ -304,7 +307,7 @@ var SelectMultiple = /** @class */ (function (_super) {
304
307
  _this.setState(__assign(__assign({}, _this.state), { value: newValue }));
305
308
  if (_this.props.onChange)
306
309
  _this.props.onChange(newValue);
307
- }, className: 'button-text-3', style: { color: _list.length ? 'var(--infor-main-color)' : 'var(--neutral-text-title-color)' } }, _list.length && isSelectedAll ? 'Bỏ chọn tất cả' : 'Chọn tất cả');
310
+ }, className: 'button-text-3', style: { color: _list.length ? 'var(--infor-main-color)' : 'var(--neutral-text-title-color)' } }, _list.length && isSelectedAll ? 'Remove all' : 'Select all');
308
311
  })()),
309
312
  react_1.default.createElement("div", { className: "col ".concat(input_multi_select_module_css_1.default['select-body']), onScroll: this.props.handleLoadmore ? function (ev) {
310
313
  if (_this.props.handleLoadmore) {
@@ -22,6 +22,7 @@ interface Select1Props {
22
22
  readOnly?: boolean;
23
23
  popupClassName?: string;
24
24
  prefix?: ReactNode;
25
+ suffix?: ReactNode;
25
26
  }
26
27
  interface Select1State {
27
28
  value?: string | number;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- import './skin/root.css';
2
- import './skin/layout.css';
3
- import './skin/typography.css';
4
1
  import { Checkbox } from './component/checkbox/checkbox';
5
2
  import { Select1, OptionsItem } from './component/select1/select1';
6
3
  import { Switch } from './component/switch/switch';