@pedidopago/ui 1.3.26 → 1.3.29
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 +93 -93
- package/dist/components/Button/Button.test.js +4 -31
- package/dist/components/Button/index.d.ts +1 -1
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +25 -36
- package/dist/components/Button/types.d.ts +0 -9
- package/dist/components/Button/types.d.ts.map +1 -1
- package/dist/components/DateInput/components/ModalWrapper/index.d.ts.map +1 -1
- package/dist/components/DateInput/components/ModalWrapper/index.js +4 -3
- package/dist/components/DateInput/components/ModalWrapper/styles.d.ts +2 -1
- package/dist/components/DateInput/components/ModalWrapper/styles.d.ts.map +1 -1
- package/dist/components/DateInput/components/ModalWrapper/styles.js +2 -2
- package/dist/components/DateInput/components/ModalWrapper/types.d.ts +2 -0
- package/dist/components/DateInput/components/ModalWrapper/types.d.ts.map +1 -1
- package/dist/components/DateInput/index.d.ts +1 -1
- package/dist/components/DateInput/index.d.ts.map +1 -1
- package/dist/components/DateInput/index.js +11 -6
- package/dist/components/DateInput/types.d.ts +2 -0
- package/dist/components/DateInput/types.d.ts.map +1 -1
- package/dist/components/DatePicker/components/DatePickerContent.d.ts +1 -1
- package/dist/components/DatePicker/components/DatePickerContent.d.ts.map +1 -1
- package/dist/components/DatePicker/components/DatePickerContent.js +13 -7
- package/dist/components/DatePicker/index.d.ts +1 -1
- package/dist/components/DatePicker/index.d.ts.map +1 -1
- package/dist/components/DatePicker/index.js +67 -19
- package/dist/components/DatePicker/styles.d.ts +1 -0
- package/dist/components/DatePicker/styles.d.ts.map +1 -1
- package/dist/components/DatePicker/styles.js +2 -2
- package/dist/components/DatePicker/types.d.ts +6 -2
- package/dist/components/DatePicker/types.d.ts.map +1 -1
- package/dist/components/Icon/data/dash.d.ts.map +1 -1
- package/dist/components/Icon/data/dash.js +1 -1
- package/dist/components/Icon/types.d.ts +1 -1
- package/dist/components/Icon/types.d.ts.map +1 -1
- package/dist/components/Pagination/styles.d.ts.map +1 -1
- package/dist/components/Pagination/styles.js +3 -3
- package/dist/components/Select/components/OptionsSelect/index.d.ts.map +1 -1
- package/dist/components/Select/components/OptionsSelect/index.js +2 -0
- package/dist/components/Select/components/OptionsSelect/styles.d.ts +1 -0
- package/dist/components/Select/components/OptionsSelect/styles.d.ts.map +1 -1
- package/dist/components/Select/components/OptionsSelect/styles.js +1 -1
- package/dist/components/Select/components/OptionsSelect/types.d.ts +3 -1
- package/dist/components/Select/components/OptionsSelect/types.d.ts.map +1 -1
- package/dist/components/Select/index.d.ts.map +1 -1
- package/dist/components/Select/index.js +3 -1
- package/dist/components/Select/types.d.ts +1 -0
- package/dist/components/Select/types.d.ts.map +1 -1
- package/dist/components/Slider/SliderExample.js +1 -1
- package/dist/components/Slider/index.d.ts +1 -0
- package/dist/components/Slider/index.d.ts.map +1 -1
- package/dist/components/Slider/index.js +38 -3
- package/dist/components/Slider/styles.d.ts.map +1 -1
- package/dist/components/Slider/styles.js +1 -1
- package/dist/components/Slider/types.d.ts +1 -0
- package/dist/components/Slider/types.d.ts.map +1 -1
- package/dist/components/Tabs/components/Tabs.js +1 -1
- package/dist/shared/formatters/format-number.d.ts +6 -0
- package/dist/shared/formatters/format-number.d.ts.map +1 -0
- package/dist/shared/formatters/format-number.js +47 -0
- package/dist/shared/formatters/types.d.ts +6 -0
- package/dist/shared/formatters/types.d.ts.map +1 -0
- package/dist/shared/formatters/types.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
<h1 align="center">
|
|
2
|
-
<img src="https://user-images.githubusercontent.com/75874462/145101826-9244932f-7072-4727-9124-8c26620ad786.png" alt="Logo"/>
|
|
3
|
-
<br/>
|
|
4
|
-
</h1>
|
|
5
|
-
|
|
6
|
-
<div align="center">
|
|
7
|
-
<img src="https://img.shields.io/badge/React-v17.0.2-1DD195?style=for-the-badge&logo=react&link=http://google.com" />
|
|
8
|
-
<img src="https://img.shields.io/badge/Emotion-v11.3.0-1DD195?style=for-the-badge&logo=styled-components" />
|
|
9
|
-
<img src="https://img.shields.io/badge/Storybook-v6.3.7-1DD195?style=for-the-badge&logo=storybook" />
|
|
10
|
-
<img src="https://img.shields.io/badge/React Testing Library-v11.1.0-1DD195?style=for-the-badge&logo=testinglibrary" />
|
|
11
|
-
<img src="https://img.shields.io/badge/FrameMotion-v4.1.17-1DD195?style=for-the-badge&logo=framer" />
|
|
12
|
-
<img src="https://img.shields.io/badge/Typescript-v4.3.5-1DD195?style=for-the-badge&logo=typescript" />
|
|
13
|
-
</div>
|
|
14
|
-
|
|
15
|
-
<p align="center">
|
|
16
|
-
<a href="#iniciar-">Iniciar </a> |
|
|
17
|
-
<a href="#estrutura-de-codigo-">Estrutura de codigo </a> |
|
|
18
|
-
<a href="#roadmap-">Roadmap </a> |
|
|
19
|
-
<a href="#contribuir-">Contribuir </a>
|
|
20
|
-
</p>
|
|
21
|
-
|
|
22
|
-
## Iniciar 🚀
|
|
23
|
-
|
|
24
|
-
### Requisitos:
|
|
25
|
-
- [Nodejs](https://github.com/nodejs/node)
|
|
26
|
-
- [Yarn](https://github.com/yarnpkg/yarn)
|
|
27
|
-
|
|
28
|
-
### Instalação:
|
|
29
|
-
|
|
30
|
-
1. Clone o Repositorio
|
|
31
|
-
|
|
32
|
-
``` bash
|
|
33
|
-
git clone git@github.com:pedidopago/pedidopago-ui.git
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
2. Instalar as dependencias:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
yarn
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### Executar o projeto localmente:
|
|
43
|
-
|
|
44
|
-
Iniciar o projeto com o storybook:
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
yarn storybook
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
Para executar os testes use o script:
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
yarn test
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
> Para mais detalhes dos scripts considere consultar o package.json na raiz do projeto.
|
|
57
|
-
|
|
58
|
-
#### 📌 Ira precisar tambem das variaveis de ambiente `CHROMATIC_PROJECT_TOKEN` e `SKIP_PREFLIGHT_CHECK`.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
## Estrutura de codigo
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
> Ao entrar no projeto sempre entre em `packages/pedidopago-ui` para trabalhar/executar os scripts
|
|
66
|
-
|
|
67
|
-
## Roadmap 🌐
|
|
68
|
-
|
|
69
|
-
- [ ] Mudar a estrutura de pastas
|
|
70
|
-
|
|
71
|
-
- [ ] Sessão de novos componentes
|
|
72
|
-
|
|
73
|
-
- [ ] Atualização de pacotes
|
|
74
|
-
|
|
75
|
-
- [ ] Incrementação dos testes
|
|
76
|
-
|
|
77
|
-
- [ ] Melhorias na documentação
|
|
78
|
-
|
|
79
|
-
- [ ] Adicionar license
|
|
80
|
-
|
|
81
|
-
## Contribuir 💡
|
|
82
|
-
|
|
83
|
-
1. Crie uma branch apartir da **`dev`** com o prefixo **`lib`-[número da issue]-[nome da issue]**.
|
|
84
|
-
exemplo:
|
|
85
|
-
```bash
|
|
86
|
-
git checkout -b lib-99-buttom
|
|
87
|
-
```
|
|
88
|
-
2. Desenvolver
|
|
89
|
-
|
|
90
|
-
3. Criar a pull request
|
|
91
|
-
- Número da issue no inicio da pr.
|
|
92
|
-
- Descritivo com pontos importantes do que foi feito.
|
|
93
|
-
- Print dos tests no terminal e video de apresentação que pode ser feito via [loom](https://www.loom.com/).
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
<img src="https://user-images.githubusercontent.com/75874462/145101826-9244932f-7072-4727-9124-8c26620ad786.png" alt="Logo"/>
|
|
3
|
+
<br/>
|
|
4
|
+
</h1>
|
|
5
|
+
|
|
6
|
+
<div align="center">
|
|
7
|
+
<img src="https://img.shields.io/badge/React-v17.0.2-1DD195?style=for-the-badge&logo=react&link=http://google.com" />
|
|
8
|
+
<img src="https://img.shields.io/badge/Emotion-v11.3.0-1DD195?style=for-the-badge&logo=styled-components" />
|
|
9
|
+
<img src="https://img.shields.io/badge/Storybook-v6.3.7-1DD195?style=for-the-badge&logo=storybook" />
|
|
10
|
+
<img src="https://img.shields.io/badge/React Testing Library-v11.1.0-1DD195?style=for-the-badge&logo=testinglibrary" />
|
|
11
|
+
<img src="https://img.shields.io/badge/FrameMotion-v4.1.17-1DD195?style=for-the-badge&logo=framer" />
|
|
12
|
+
<img src="https://img.shields.io/badge/Typescript-v4.3.5-1DD195?style=for-the-badge&logo=typescript" />
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<p align="center">
|
|
16
|
+
<a href="#iniciar-">Iniciar </a> |
|
|
17
|
+
<a href="#estrutura-de-codigo-">Estrutura de codigo </a> |
|
|
18
|
+
<a href="#roadmap-">Roadmap </a> |
|
|
19
|
+
<a href="#contribuir-">Contribuir </a>
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
## Iniciar 🚀
|
|
23
|
+
|
|
24
|
+
### Requisitos:
|
|
25
|
+
- [Nodejs](https://github.com/nodejs/node)
|
|
26
|
+
- [Yarn](https://github.com/yarnpkg/yarn)
|
|
27
|
+
|
|
28
|
+
### Instalação:
|
|
29
|
+
|
|
30
|
+
1. Clone o Repositorio
|
|
31
|
+
|
|
32
|
+
``` bash
|
|
33
|
+
git clone git@github.com:pedidopago/pedidopago-ui.git
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
2. Instalar as dependencias:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
yarn
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Executar o projeto localmente:
|
|
43
|
+
|
|
44
|
+
Iniciar o projeto com o storybook:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
yarn storybook
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Para executar os testes use o script:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
yarn test
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
> Para mais detalhes dos scripts considere consultar o package.json na raiz do projeto.
|
|
57
|
+
|
|
58
|
+
#### 📌 Ira precisar tambem das variaveis de ambiente `CHROMATIC_PROJECT_TOKEN` e `SKIP_PREFLIGHT_CHECK`.
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
## Estrutura de codigo
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
> Ao entrar no projeto sempre entre em `packages/pedidopago-ui` para trabalhar/executar os scripts
|
|
66
|
+
|
|
67
|
+
## Roadmap 🌐
|
|
68
|
+
|
|
69
|
+
- [ ] Mudar a estrutura de pastas
|
|
70
|
+
|
|
71
|
+
- [ ] Sessão de novos componentes
|
|
72
|
+
|
|
73
|
+
- [ ] Atualização de pacotes
|
|
74
|
+
|
|
75
|
+
- [ ] Incrementação dos testes
|
|
76
|
+
|
|
77
|
+
- [ ] Melhorias na documentação
|
|
78
|
+
|
|
79
|
+
- [ ] Adicionar license
|
|
80
|
+
|
|
81
|
+
## Contribuir 💡
|
|
82
|
+
|
|
83
|
+
1. Crie uma branch apartir da **`dev`** com o prefixo **`lib`-[número da issue]-[nome da issue]**.
|
|
84
|
+
exemplo:
|
|
85
|
+
```bash
|
|
86
|
+
git checkout -b lib-99-buttom
|
|
87
|
+
```
|
|
88
|
+
2. Desenvolver
|
|
89
|
+
|
|
90
|
+
3. Criar a pull request
|
|
91
|
+
- Número da issue no inicio da pr.
|
|
92
|
+
- Descritivo com pontos importantes do que foi feito.
|
|
93
|
+
- Print dos tests no terminal e video de apresentação que pode ser feito via [loom](https://www.loom.com/).
|
|
@@ -12,10 +12,6 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
12
12
|
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
14
|
|
|
15
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
16
|
-
|
|
17
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
18
|
-
|
|
19
15
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
20
16
|
|
|
21
17
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -69,29 +65,6 @@ describe('Button', function () {
|
|
|
69
65
|
|
|
70
66
|
expect(handleClick).toHaveBeenCalledTimes(1);
|
|
71
67
|
});
|
|
72
|
-
it('should render a loading button', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
73
|
-
var _setup2, getSkeleton;
|
|
74
|
-
|
|
75
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
76
|
-
while (1) {
|
|
77
|
-
switch (_context.prev = _context.next) {
|
|
78
|
-
case 0:
|
|
79
|
-
(0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
80
|
-
variant: "solid",
|
|
81
|
-
children: "Click Me"
|
|
82
|
-
}));
|
|
83
|
-
_setup2 = setup({
|
|
84
|
-
isLoading: true
|
|
85
|
-
}), getSkeleton = _setup2.getSkeleton;
|
|
86
|
-
expect(getSkeleton()).toBeInTheDocument();
|
|
87
|
-
|
|
88
|
-
case 3:
|
|
89
|
-
case "end":
|
|
90
|
-
return _context.stop();
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}, _callee);
|
|
94
|
-
})));
|
|
95
68
|
it('should render a disabled button', function () {
|
|
96
69
|
var handleClick = jest.fn();
|
|
97
70
|
(0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
|
|
@@ -168,10 +141,10 @@ describe('Button', function () {
|
|
|
168
141
|
children: "Click Me"
|
|
169
142
|
}));
|
|
170
143
|
|
|
171
|
-
var
|
|
144
|
+
var _setup2 = setup({
|
|
172
145
|
leftIcon: 'airplay'
|
|
173
146
|
}),
|
|
174
|
-
getLeftIcon =
|
|
147
|
+
getLeftIcon = _setup2.getLeftIcon;
|
|
175
148
|
|
|
176
149
|
expect(getLeftIcon()).toBeInTheDocument();
|
|
177
150
|
});
|
|
@@ -182,10 +155,10 @@ describe('Button', function () {
|
|
|
182
155
|
children: "Click Me"
|
|
183
156
|
}));
|
|
184
157
|
|
|
185
|
-
var
|
|
158
|
+
var _setup3 = setup({
|
|
186
159
|
rightIcon: 'airplay'
|
|
187
160
|
}),
|
|
188
|
-
getRightIcon =
|
|
161
|
+
getRightIcon = _setup3.getRightIcon;
|
|
189
162
|
|
|
190
163
|
expect(getRightIcon()).toBeInTheDocument();
|
|
191
164
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ButtonHTMLAttributes } from 'react';
|
|
2
2
|
import { ButtonProps } from './types';
|
|
3
|
-
export default function Button({ children, leftIcon, rightIcon,
|
|
3
|
+
export default function Button({ children, leftIcon, rightIcon, variant, bgColor, size, fullWidth, textColor, type, iconColor, ...props }: ButtonProps & ButtonHTMLAttributes<HTMLButtonElement>): JSX.Element;
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Button/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Button/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAK7C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC7B,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,OAAiB,EACjB,OAAY,EACZ,IAAW,EACX,SAAS,EACT,SAAc,EACd,IAAe,EACf,SAAc,EACd,GAAG,KAAK,EACT,EAAE,WAAW,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,eA0DvD"}
|
|
@@ -5,21 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = Button;
|
|
7
7
|
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
|
|
10
8
|
var _index = require("../../shared/theme/index");
|
|
11
9
|
|
|
12
10
|
var _getColorValue = require("../../utils/getColorValue");
|
|
13
11
|
|
|
14
12
|
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
15
13
|
|
|
16
|
-
var _Skeleton = _interopRequireDefault(require("../Skeleton"));
|
|
17
|
-
|
|
18
14
|
var _styles = require("./styles");
|
|
19
15
|
|
|
20
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
17
|
|
|
22
|
-
var _excluded = ["children", "leftIcon", "rightIcon", "
|
|
18
|
+
var _excluded = ["children", "leftIcon", "rightIcon", "variant", "bgColor", "size", "fullWidth", "textColor", "type", "iconColor"];
|
|
23
19
|
|
|
24
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
21
|
|
|
@@ -37,7 +33,6 @@ function Button(_ref) {
|
|
|
37
33
|
var children = _ref.children,
|
|
38
34
|
leftIcon = _ref.leftIcon,
|
|
39
35
|
rightIcon = _ref.rightIcon,
|
|
40
|
-
isLoading = _ref.isLoading,
|
|
41
36
|
_ref$variant = _ref.variant,
|
|
42
37
|
variant = _ref$variant === void 0 ? 'solid' : _ref$variant,
|
|
43
38
|
_ref$bgColor = _ref.bgColor,
|
|
@@ -79,36 +74,30 @@ function Button(_ref) {
|
|
|
79
74
|
parsedIconColor = (0, _getColorValue.getThemeHex)(parsedIconColor, theme);
|
|
80
75
|
}
|
|
81
76
|
|
|
82
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
name: rightIcon,
|
|
105
|
-
color: parsedIconColor,
|
|
106
|
-
size: iconSize,
|
|
107
|
-
"data-testid": "rightIconId"
|
|
108
|
-
})
|
|
109
|
-
})]
|
|
77
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.ButtonContainer, _objectSpread(_objectSpread({
|
|
78
|
+
bgColor: parsedBgColor,
|
|
79
|
+
textColor: parsedTextColor,
|
|
80
|
+
fullWidth: fullWidth,
|
|
81
|
+
variant: variant,
|
|
82
|
+
size: size,
|
|
83
|
+
type: type
|
|
84
|
+
}, props), {}, {
|
|
85
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.IconContainer, {
|
|
86
|
+
children: [leftIcon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.IconWrapper, {
|
|
87
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
88
|
+
color: parsedIconColor,
|
|
89
|
+
name: leftIcon,
|
|
90
|
+
size: iconSize,
|
|
91
|
+
"data-testid": "leftIconId"
|
|
92
|
+
})
|
|
93
|
+
}), children, !leftIcon && rightIcon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.IconWrapper, {
|
|
94
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
95
|
+
name: rightIcon,
|
|
96
|
+
color: parsedIconColor,
|
|
97
|
+
size: iconSize,
|
|
98
|
+
"data-testid": "rightIconId"
|
|
110
99
|
})
|
|
111
|
-
})
|
|
100
|
+
})]
|
|
112
101
|
})
|
|
113
|
-
});
|
|
102
|
+
}));
|
|
114
103
|
}
|
|
@@ -40,15 +40,6 @@ export interface ButtonProps {
|
|
|
40
40
|
* @memberof ButtonProps
|
|
41
41
|
*/
|
|
42
42
|
rightIcon?: IconName;
|
|
43
|
-
/**
|
|
44
|
-
* The button rendered changes to a LoadingButton component
|
|
45
|
-
*
|
|
46
|
-
* @default false
|
|
47
|
-
* @type boolean
|
|
48
|
-
* @memberof ButtonProps
|
|
49
|
-
* @example true
|
|
50
|
-
*/
|
|
51
|
-
isLoading?: boolean;
|
|
52
43
|
/**
|
|
53
44
|
* The button height changes based on the string passed to this prop
|
|
54
45
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Button/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,aAAK,aAAa,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;AAC5D,aAAK,WAAW,GAAG,iBAAiB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AACrD,aAAK,iBAAiB,CAAC,CAAC,GAAG,GAAG,IAAI;IAChC,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,EAAE,CAAC,EAAE,CAAC,CAAC;IACP,EAAE,CAAC,EAAE,CAAC,CAAC;IACP,EAAE,CAAC,EAAE,CAAC,CAAC;IACP,EAAE,CAAC,EAAE,CAAC,CAAC;IACP,GAAG,CAAC,EAAE,CAAC,CAAC;CACT,CAAC;AACF,aAAK,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEpD,MAAM,WAAW,WAAW;IAC1B;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,QAAQ,CAAC;IAErB;;;;;;;OAOG;IACH,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Button/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,aAAK,aAAa,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;AAC5D,aAAK,WAAW,GAAG,iBAAiB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AACrD,aAAK,iBAAiB,CAAC,CAAC,GAAG,GAAG,IAAI;IAChC,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,EAAE,CAAC,EAAE,CAAC,CAAC;IACP,EAAE,CAAC,EAAE,CAAC,CAAC;IACP,EAAE,CAAC,EAAE,CAAC,CAAC;IACP,EAAE,CAAC,EAAE,CAAC,CAAC;IACP,GAAG,CAAC,EAAE,CAAC,CAAC;CACT,CAAC;AACF,aAAK,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEpD,MAAM,WAAW,WAAW;IAC1B;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,QAAQ,CAAC;IAErB;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IAExB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,SAAS,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAAC;IAEvC;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAEjD;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,WAAW,CAAC;CACzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/DateInput/components/ModalWrapper/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/DateInput/components/ModalWrapper/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,YAAY,8GAmBxB,CAAC"}
|
|
@@ -13,13 +13,13 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
13
13
|
|
|
14
14
|
var ModalWrapper = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
15
15
|
var open = _ref.open,
|
|
16
|
-
|
|
17
|
-
left = _ref$left === void 0 ? '50vw' : _ref$left,
|
|
16
|
+
left = _ref.left,
|
|
18
17
|
_ref$top = _ref.top,
|
|
19
18
|
top = _ref$top === void 0 ? '' : _ref$top,
|
|
20
19
|
_ref$offsetX = _ref.offsetX,
|
|
21
20
|
offsetX = _ref$offsetX === void 0 ? '0px' : _ref$offsetX,
|
|
22
21
|
maxWidth = _ref.maxWidth,
|
|
22
|
+
right = _ref.right,
|
|
23
23
|
children = _ref.children;
|
|
24
24
|
var optionsContainerRef = (0, _react.useRef)(null);
|
|
25
25
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
@@ -29,7 +29,8 @@ var ModalWrapper = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
29
29
|
ref: optionsContainerRef,
|
|
30
30
|
open: open,
|
|
31
31
|
maxWidth: typeof maxWidth === 'number' ? "".concat(maxWidth, "px") : maxWidth,
|
|
32
|
-
left: "calc(".concat(left, " + ").concat(offsetX, ")"),
|
|
32
|
+
left: left && "calc(".concat(left, " + ").concat(offsetX, ")"),
|
|
33
|
+
right: right && "calc(".concat(right, " + ").concat(offsetX, ")"),
|
|
33
34
|
top: top,
|
|
34
35
|
children: children
|
|
35
36
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/DateInput/components/ModalWrapper/styles.ts"],"names":[],"mappings":";AAIA,UAAU,0BAA0B;IAClC,IAAI,EAAE,OAAO,CAAC;IAEd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/DateInput/components/ModalWrapper/styles.ts"],"names":[],"mappings":";AAIA,UAAU,0BAA0B;IAClC,IAAI,EAAE,OAAO,CAAC;IAEd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uCA6BjC,CAAC"}
|
|
@@ -11,7 +11,7 @@ var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
|
11
11
|
|
|
12
12
|
var _framerMotion = require("framer-motion");
|
|
13
13
|
|
|
14
|
-
var _templateObject;
|
|
14
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
15
15
|
|
|
16
16
|
var _excluded = ["theme"];
|
|
17
17
|
|
|
@@ -27,6 +27,6 @@ var ModalWrapperContainer = (0, _styled.default)(_framerMotion.motion.div)(funct
|
|
|
27
27
|
var theme = _ref.theme,
|
|
28
28
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
29
29
|
|
|
30
|
-
return (0, _react.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n width: auto;\n position: fixed;\n
|
|
30
|
+
return (0, _react.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n width: auto;\n position: fixed;\n ", "\n ", "\n top: ", ";\n z-index: ", ";\n opacity: ", ";\n pointer-events: ", ";\n transition: opacity ease ", ";\n background: ", ";\n border-radius: ", ";\n box-shadow: ", ";\n\n li {\n list-style: none;\n }\n "])), props.left && (0, _react.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n left: ", ";\n "])), props.left), props.right && (0, _react.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n right: ", ";\n "])), props.right), props.top, theme.zIndex.level24, props.open ? 1 : 0, props.open ? 'auto' : 'none', theme.transition.speed, theme.colors.background.light, theme.borderRadius.default, theme.shadow.level3);
|
|
31
31
|
});
|
|
32
32
|
exports.ModalWrapperContainer = ModalWrapperContainer;
|
|
@@ -4,6 +4,8 @@ export interface ModalWrapperProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
4
4
|
open: boolean;
|
|
5
5
|
/** Optional. Sets the left position where the modal will be shown. */
|
|
6
6
|
left?: string;
|
|
7
|
+
/** Optional. Sets the right position where the modal will be shown. */
|
|
8
|
+
right?: string;
|
|
7
9
|
/** Optional. Sets the top position where the modal will be shown. */
|
|
8
10
|
top?: string;
|
|
9
11
|
/** Optional. Offsets the Modal horizontally. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/DateInput/components/ModalWrapper/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,iBAAkB,SAAQ,cAAc,CAAC,cAAc,CAAC;IACvE,mCAAmC;IACnC,IAAI,EAAE,OAAO,CAAC;IAEd,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/DateInput/components/ModalWrapper/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,iBAAkB,SAAQ,cAAc,CAAC,cAAc,CAAC;IACvE,mCAAmC;IACnC,IAAI,EAAE,OAAO,CAAC;IAEd,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC5B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { DateInputProps } from './types';
|
|
3
|
-
export declare function DateInput({ label, placeholder, alert, helperText, value, locales, localeOptions, minDate, maxDate, onChange, disabled, ...rest }: DateInputProps): JSX.Element;
|
|
3
|
+
export declare function DateInput({ label, placeholder, alert, helperText, value, locales, localeOptions, minDate, maxDate, onChange, disabled, datePickerPosition, disableWeekendDays, ...rest }: DateInputProps): JSX.Element;
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DateInput/index.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,WAAW,EACX,KAAK,EACL,UAAU,EACV,KAAK,EACL,OAAO,EACP,aAAa,EACb,OAAO,EACP,OAAO,EACP,QAAQ,EACR,QAAgB,EAChB,GAAG,IAAI,EACR,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DateInput/index.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,WAAW,EACX,KAAK,EACL,UAAU,EACV,KAAK,EACL,OAAO,EACP,aAAa,EACb,OAAO,EACP,OAAO,EACP,QAAQ,EACR,QAAgB,EAChB,kBAA2B,EAC3B,kBAAkB,EAClB,GAAG,IAAI,EACR,EAAE,cAAc,eA0GhB"}
|
|
@@ -23,7 +23,7 @@ var _useDisableBodyScroll = require("../../shared/hooks/useDisableBodyScroll");
|
|
|
23
23
|
|
|
24
24
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
25
|
|
|
26
|
-
var _excluded = ["label", "placeholder", "alert", "helperText", "value", "locales", "localeOptions", "minDate", "maxDate", "onChange", "disabled"];
|
|
26
|
+
var _excluded = ["label", "placeholder", "alert", "helperText", "value", "locales", "localeOptions", "minDate", "maxDate", "onChange", "disabled", "datePickerPosition", "disableWeekendDays"];
|
|
27
27
|
|
|
28
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
29
|
|
|
@@ -50,7 +50,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
50
50
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
51
51
|
|
|
52
52
|
function DateInput(_ref) {
|
|
53
|
-
var _containerRef$current, _containerRef$current3, _containerRef$current4, _containerRef$current5;
|
|
53
|
+
var _containerRef$current, _containerRef$current3, _containerRef$current4, _containerRef$current5, _containerRef$current6, _containerRef$current7;
|
|
54
54
|
|
|
55
55
|
var label = _ref.label,
|
|
56
56
|
placeholder = _ref.placeholder,
|
|
@@ -64,6 +64,9 @@ function DateInput(_ref) {
|
|
|
64
64
|
onChange = _ref.onChange,
|
|
65
65
|
_ref$disabled = _ref.disabled,
|
|
66
66
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
67
|
+
_ref$datePickerPositi = _ref.datePickerPosition,
|
|
68
|
+
datePickerPosition = _ref$datePickerPositi === void 0 ? 'left' : _ref$datePickerPositi,
|
|
69
|
+
disableWeekendDays = _ref.disableWeekendDays,
|
|
67
70
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
68
71
|
|
|
69
72
|
var containerRef = (0, _react.useRef)(null);
|
|
@@ -118,7 +121,7 @@ function DateInput(_ref) {
|
|
|
118
121
|
}),
|
|
119
122
|
disabled: disabled,
|
|
120
123
|
tabIndex: disabled ? -1 : 0,
|
|
121
|
-
value: currentValue ? Array.isArray(currentValue) ? "".concat(currentValue[0].toLocaleDateString(locales, localeOptions), " - ").concat(currentValue[1].toLocaleDateString(locales, localeOptions)) : new Date(currentValue).toLocaleDateString() : '',
|
|
124
|
+
value: currentValue ? Array.isArray(currentValue) ? String(currentValue[0]) !== String(currentValue[1]) ? "".concat(currentValue[0].toLocaleDateString(locales, localeOptions), " - ").concat(currentValue[1].toLocaleDateString(locales, localeOptions)) : new Date(currentValue[0]).toLocaleDateString() : new Date(currentValue).toLocaleDateString() : '',
|
|
122
125
|
onClick: toggleOptionsAreaView,
|
|
123
126
|
onMouseOver: handleRepositionModal
|
|
124
127
|
}), datePickerOpen && /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
@@ -130,15 +133,17 @@ function DateInput(_ref) {
|
|
|
130
133
|
}
|
|
131
134
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ModalWrapper.ModalWrapper, {
|
|
132
135
|
open: datePickerOpen,
|
|
133
|
-
left: "".concat((_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.getBoundingClientRect().left, "px"),
|
|
134
|
-
|
|
136
|
+
left: datePickerPosition === 'left' ? "".concat((_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.getBoundingClientRect().left, "px") : undefined,
|
|
137
|
+
right: datePickerPosition === 'right' ? "".concat(window.innerWidth - Number(containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current4 = containerRef.current) === null || _containerRef$current4 === void 0 ? void 0 : _containerRef$current4.offsetLeft) - Number(containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current5 = containerRef.current) === null || _containerRef$current5 === void 0 ? void 0 : _containerRef$current5.offsetWidth), "px") : undefined,
|
|
138
|
+
top: Number(positionContainer) < 540 ? "calc(".concat(((_containerRef$current6 = containerRef.current) === null || _containerRef$current6 === void 0 ? void 0 : _containerRef$current6.getBoundingClientRect().bottom) || 0, "px + 10px)") : "calc(".concat(((_containerRef$current7 = containerRef.current) === null || _containerRef$current7 === void 0 ? void 0 : _containerRef$current7.getBoundingClientRect().top) || 0, "px - ", 360, "px)"),
|
|
135
139
|
ref: optionsModalRef,
|
|
136
140
|
maxWidth: "auto",
|
|
137
141
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DatePicker.default, _objectSpread({
|
|
138
142
|
value: currentValue,
|
|
139
143
|
onChange: selectDate,
|
|
140
144
|
minDate: minDate,
|
|
141
|
-
maxDate: maxDate
|
|
145
|
+
maxDate: maxDate,
|
|
146
|
+
disableWeekendDays: disableWeekendDays
|
|
142
147
|
}, rest))
|
|
143
148
|
})]
|
|
144
149
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/DateInput/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,oBAAY,wBAAwB,GAAG;IACrC,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;CAC7B,CAAC;AAEF,MAAM,WAAW,cAAe,SAAQ,eAAe;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B,aAAa,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC;IAC3C,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,OAAO,CAAC,EAAE,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/DateInput/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,oBAAY,wBAAwB,GAAG;IACrC,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;CAC7B,CAAC;AAEF,MAAM,WAAW,cAAe,SAAQ,eAAe;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B,aAAa,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC;IAC3C,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,kBAAkB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACtC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { DatePickerContentProps } from '../types';
|
|
3
|
-
export declare const DatePickerContent: ({ type, date, startDate, endDate, isInTheRange, maxDate, minDate, handleChange, handleMouseOver, handleChangeDate, variant, enableYearPicker, handleToggleYearPicker, }: DatePickerContentProps) => JSX.Element;
|
|
3
|
+
export declare const DatePickerContent: ({ type, date, startDate, endDate, isInTheRange, maxDate, minDate, handleChange, handleMouseOver, handleChangeDate, variant, enableYearPicker, handleToggleYearPicker, hideNextMonthButton, hidePrevMonthButton, disableWeekendDays, }: DatePickerContentProps) => JSX.Element;
|
|
4
4
|
//# sourceMappingURL=DatePickerContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePickerContent.d.ts","sourceRoot":"","sources":["../../../../src/components/DatePicker/components/DatePickerContent.tsx"],"names":[],"mappings":";AAkBA,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAElD,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"DatePickerContent.d.ts","sourceRoot":"","sources":["../../../../src/components/DatePicker/components/DatePickerContent.tsx"],"names":[],"mappings":";AAkBA,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAElD,eAAO,MAAM,iBAAiB,0OAiB3B,sBAAsB,gBAyOxB,CAAC"}
|
|
@@ -42,7 +42,10 @@ var DatePickerContent = function DatePickerContent(_ref) {
|
|
|
42
42
|
handleChangeDate = _ref.handleChangeDate,
|
|
43
43
|
variant = _ref.variant,
|
|
44
44
|
enableYearPicker = _ref.enableYearPicker,
|
|
45
|
-
handleToggleYearPicker = _ref.handleToggleYearPicker
|
|
45
|
+
handleToggleYearPicker = _ref.handleToggleYearPicker,
|
|
46
|
+
hideNextMonthButton = _ref.hideNextMonthButton,
|
|
47
|
+
hidePrevMonthButton = _ref.hidePrevMonthButton,
|
|
48
|
+
disableWeekendDays = _ref.disableWeekendDays;
|
|
46
49
|
|
|
47
50
|
var handleChangeSelectDate = function handleChangeSelectDate(newDate) {
|
|
48
51
|
handleChangeDate(newDate);
|
|
@@ -122,7 +125,7 @@ var DatePickerContent = function DatePickerContent(_ref) {
|
|
|
122
125
|
onClick: function onClick() {
|
|
123
126
|
return handleChangeMonth(date.getMonth(), 'down');
|
|
124
127
|
},
|
|
125
|
-
isHidden: minDate && minDate.getMonth() === date.getMonth(),
|
|
128
|
+
isHidden: minDate && minDate.getMonth() === date.getMonth() || hidePrevMonthButton,
|
|
126
129
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
127
130
|
name: "arrow-left"
|
|
128
131
|
})
|
|
@@ -140,7 +143,7 @@ var DatePickerContent = function DatePickerContent(_ref) {
|
|
|
140
143
|
onClick: function onClick() {
|
|
141
144
|
return handleChangeMonth(date.getMonth(), 'up');
|
|
142
145
|
},
|
|
143
|
-
isHidden: maxDate && maxDate.getMonth() === date.getMonth(),
|
|
146
|
+
isHidden: maxDate && maxDate.getMonth() === date.getMonth() || hideNextMonthButton,
|
|
144
147
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
145
148
|
name: "arrow-right"
|
|
146
149
|
})
|
|
@@ -178,11 +181,13 @@ var DatePickerContent = function DatePickerContent(_ref) {
|
|
|
178
181
|
var dateMonth = isPreviousMonth ? date.getMonth() - 1 : isNextMonth ? date.getMonth() + 1 : date.getMonth();
|
|
179
182
|
var cellDate = new Date(date.getFullYear(), dateMonth, day);
|
|
180
183
|
var cellTitle = cellDate.toLocaleDateString();
|
|
181
|
-
var isToday = cellDate.
|
|
182
|
-
var isStartDateOfRange =
|
|
183
|
-
|
|
184
|
+
var isToday = cellDate.getTime() === Date.now();
|
|
185
|
+
var isStartDateOfRange = // setHours(0, 0, 0, 0) set the time to midnight
|
|
186
|
+
cellDate.getTime() === startDate.setHours(0, 0, 0, 0);
|
|
187
|
+
var isEndDateOfRange = cellDate.getTime() === endDate.getTime();
|
|
184
188
|
var outOfCurrentMonthInRange = type === 'range' && (isPreviousMonth || isNextMonth);
|
|
185
|
-
var
|
|
189
|
+
var isWeekendDay = disableWeekendDays ? cellDate.getDay() === 0 || cellDate.getDay() === 6 : false;
|
|
190
|
+
var isDisabled = day === 0 || minDate && cellDate.getTime() < minDate.getTime() || maxDate && cellDate.getTime() > maxDate.getTime() || outOfCurrentMonthInRange || isWeekendDay;
|
|
186
191
|
var isExtended = variant === 'extended';
|
|
187
192
|
var removeZeros = days.filter(function (day) {
|
|
188
193
|
return day !== 0;
|
|
@@ -191,6 +196,7 @@ var DatePickerContent = function DatePickerContent(_ref) {
|
|
|
191
196
|
role: "gridcell",
|
|
192
197
|
title: cellTitle,
|
|
193
198
|
"data-date": cellDate,
|
|
199
|
+
isTheSameDate: cellDate.getTime() === endDate.getTime() && cellDate.getTime() === startDate.getTime(),
|
|
194
200
|
tabIndex: -1,
|
|
195
201
|
disabled: isDisabled,
|
|
196
202
|
"aria-label": cellDate.toLocaleDateString('pt-BR', {
|