@toptal/picasso-date-select 1.0.72 → 1.0.73-alpha-1757603192867.0

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/package.json CHANGED
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "@toptal/picasso-date-select",
3
- "version": "1.0.72",
3
+ "version": "1.0.73-alpha-1757603192867.0",
4
4
  "description": "Toptal UI components library - DateSelect",
5
5
  "publishConfig": {
6
- "access": "public"
6
+ "access": "public",
7
+ "provenance": true
7
8
  },
8
9
  "main": "./dist-package/src/index.js",
9
10
  "module": "./dist-package/src/index.js",
10
11
  "scripts": {
11
12
  "build:package": "tsc -b tsconfig.json",
12
- "prepublishOnly": "yarn build:package"
13
+ "prepublishOnly": "echo 0"
13
14
  },
14
15
  "repository": {
15
16
  "type": "git",
@@ -22,8 +23,8 @@
22
23
  },
23
24
  "homepage": "https://github.com/toptal/picasso/tree/master/packages/picasso#readme",
24
25
  "dependencies": {
25
- "@toptal/picasso-select": "4.1.2",
26
- "@toptal/picasso-utils": "3.1.0"
26
+ "@toptal/picasso-select": "4.1.3-alpha-1757603192867.0",
27
+ "@toptal/picasso-utils": "3.1.1-alpha-1757603192867.0"
27
28
  },
28
29
  "sideEffects": [
29
30
  "**/styles.ts",
@@ -36,7 +37,7 @@
36
37
  ".": "./dist-package/src/index.js"
37
38
  },
38
39
  "devDependencies": {
39
- "@toptal/picasso-test-utils": "1.1.1"
40
+ "@toptal/picasso-test-utils": "1.1.2-alpha-1757603192867.0"
40
41
  },
41
42
  "files": [
42
43
  "dist-package/**",
@@ -1,22 +0,0 @@
1
- import type { Ref } from 'react';
2
- import React from 'react';
3
- import type { SelectProps } from '@toptal/picasso-select';
4
- declare type AdjustedSelectProps<M extends boolean> = Omit<SelectProps<number, M>, 'options'>;
5
- /**
6
- * MonthSelect props are generalized over multiselect property. If you want `onChange`
7
- * to take handler that can take array (for multiselect) you should set `Multiple`
8
- * to `true`. By default it's single select.
9
- *
10
- * @param Multiple The `boolean` type of the `multiple` property to indicate whether `onChange` will expect handler to accept plain `number` or array of `number`s
11
- */
12
- export interface Props<Multiple extends boolean> extends AdjustedSelectProps<Multiple> {
13
- /** a number of month select starts from. e.g. 5 for May */
14
- from?: number;
15
- /** a number of month select ends at. e.g. 11 for November */
16
- to?: number;
17
- }
18
- export declare const MonthSelect: import("@toptal/picasso-utils").Component<(<M extends boolean = false>(props: Props<M> & {
19
- ref?: Ref<HTMLInputElement> | undefined;
20
- }) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null), unknown>;
21
- export default MonthSelect;
22
- //# sourceMappingURL=MonthSelect.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MonthSelect.d.ts","sourceRoot":"","sources":["../../../src/MonthSelect/MonthSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,KAAkB,MAAM,OAAO,CAAA;AAGtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEzD,aAAK,mBAAmB,CAAC,CAAC,SAAS,OAAO,IAAI,IAAI,CAChD,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,EACtB,SAAS,CACV,CAAA;AAED;;;;;;GAMG;AACH,MAAM,WAAW,KAAK,CAAC,QAAQ,SAAS,OAAO,CAC7C,SAAQ,mBAAmB,CAAC,QAAQ,CAAC;IACrC,2DAA2D;IAC3D,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,6DAA6D;IAC7D,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ;AAwBD,eAAO,MAAM,WAAW;;0FAuBvB,CAAA;AASD,eAAe,WAAW,CAAA"}
@@ -1,52 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import React, { useMemo } from 'react';
13
- import { Select } from '@toptal/picasso-select';
14
- import { documentable, forwardRef } from '@toptal/picasso-utils';
15
- const OPTIONS = [
16
- { value: 1, text: 'January' },
17
- { value: 2, text: 'February' },
18
- { value: 3, text: 'March' },
19
- { value: 4, text: 'April' },
20
- { value: 5, text: 'May' },
21
- { value: 6, text: 'June' },
22
- { value: 7, text: 'July' },
23
- { value: 8, text: 'August' },
24
- { value: 9, text: 'September' },
25
- { value: 10, text: 'October' },
26
- { value: 11, text: 'November' },
27
- { value: 12, text: 'December' },
28
- ];
29
- const getFilteredOptions = (from, to) => {
30
- return OPTIONS.slice(from - 1, to);
31
- };
32
- const FIRST_MONTH = 1;
33
- const LAST_MONTH = 12;
34
- export const MonthSelect = documentable(forwardRef((_a, ref) => {
35
- var { from = FIRST_MONTH, to = LAST_MONTH } = _a, rest = __rest(_a, ["from", "to"]);
36
- if (from < FIRST_MONTH ||
37
- from > LAST_MONTH ||
38
- to < FIRST_MONTH ||
39
- to > LAST_MONTH ||
40
- to < from) {
41
- throw new Error(`Invalid range. Please check the values you have passed: from: ${from}, to: ${to}`);
42
- }
43
- const options = useMemo(() => getFilteredOptions(from, to), [from, to]);
44
- return React.createElement(Select, Object.assign({}, rest, { ref: ref, options: options }));
45
- }));
46
- MonthSelect.defaultProps = {
47
- from: 1,
48
- to: 12,
49
- };
50
- MonthSelect.displayName = 'MonthSelect';
51
- export default MonthSelect;
52
- //# sourceMappingURL=MonthSelect.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MonthSelect.js","sourceRoot":"","sources":["../../../src/MonthSelect/MonthSelect.tsx"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE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;QAFF,EAAE,IAAI,GAAG,WAAW,EAAE,EAAE,GAAG,UAAU,OAAqB,EAAhB,IAAI,cAA9C,cAAgD,CAAF;IAG9C,IACE,IAAI,GAAG,WAAW;QAClB,IAAI,GAAG,UAAU;QACjB,EAAE,GAAG,WAAW;QAChB,EAAE,GAAG,UAAU;QACf,EAAE,GAAG,IAAI,EACT;QACA,MAAM,IAAI,KAAK,CACb,iEAAiE,IAAI,SAAS,EAAE,EAAE,CACnF,CAAA;KACF;IAED,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,kBAAkB,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAA;IAEvE,OAAO,oBAAC,MAAM,oBAAK,IAAI,IAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,IAAI,CAAA;AACzD,CAAC,CACF,CACF,CAAA;AAED,WAAW,CAAC,YAAY,GAAG;IACzB,IAAI,EAAE,CAAC;IACP,EAAE,EAAE,EAAE;CACP,CAAA;AAED,WAAW,CAAC,WAAW,GAAG,aAAa,CAAA;AAEvC,eAAe,WAAW,CAAA"}
@@ -1,3 +0,0 @@
1
- export type { Props as MonthSelectProps } from './MonthSelect';
2
- export { default as MonthSelect } from './MonthSelect';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/MonthSelect/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,KAAK,IAAI,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAC9D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAA"}
@@ -1,2 +0,0 @@
1
- export { default as MonthSelect } from './MonthSelect';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/MonthSelect/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAA"}
@@ -1,22 +0,0 @@
1
- import type { Ref } from 'react';
2
- import React from 'react';
3
- import type { SelectProps } from '@toptal/picasso-select';
4
- declare type AdjustedSelectProps<M extends boolean> = Omit<SelectProps<number, M>, 'options'>;
5
- /**
6
- * YearSelect props are generalized over multiselect property. If you want `onChange`
7
- * to take handler that can take array (for multiselect) you should set `Multiple`
8
- * to `true`. By default it's single select.
9
- *
10
- * @param Multiple The `boolean` type of the `multiple` property to indicate whether `onChange` will expect handler to accept plain `number` or array of `number`s
11
- */
12
- export interface Props<Multiple extends boolean> extends AdjustedSelectProps<Multiple> {
13
- /** a year select starts from. e.g. 2017 */
14
- from: number;
15
- /** a year select ends at. e.g. 2019 */
16
- to: number;
17
- }
18
- export declare const YearSelect: import("@toptal/picasso-utils").Component<(<M extends boolean = false>(props: Props<M> & {
19
- ref?: Ref<HTMLInputElement> | undefined;
20
- }) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null), unknown>;
21
- export default YearSelect;
22
- //# sourceMappingURL=YearSelect.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"YearSelect.d.ts","sourceRoot":"","sources":["../../../src/YearSelect/YearSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,KAAkB,MAAM,OAAO,CAAA;AAGtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEzD,aAAK,mBAAmB,CAAC,CAAC,SAAS,OAAO,IAAI,IAAI,CAChD,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,EACtB,SAAS,CACV,CAAA;AAED;;;;;;GAMG;AACH,MAAM,WAAW,KAAK,CAAC,QAAQ,SAAS,OAAO,CAC7C,SAAQ,mBAAmB,CAAC,QAAQ,CAAC;IACrC,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAA;IACZ,uCAAuC;IACvC,EAAE,EAAE,MAAM,CAAA;CACX;AAeD,eAAO,MAAM,UAAU;;0FAiBtB,CAAA;AAID,eAAe,UAAU,CAAA"}
@@ -1,35 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import React, { useMemo } from 'react';
13
- import { Select } from '@toptal/picasso-select';
14
- import { forwardRef, documentable } from '@toptal/picasso-utils';
15
- const generateOptions = (from, to) => {
16
- const length = Math.abs(to - from) + 1;
17
- return Array.from({ length }).map((_, index) => {
18
- const value = to < from ? from - index : index + from;
19
- return {
20
- value,
21
- text: value.toString(),
22
- };
23
- });
24
- };
25
- export const YearSelect = documentable(forwardRef((_a, ref) => {
26
- var { from, to } = _a, rest = __rest(_a, ["from", "to"]);
27
- if (!to || !from) {
28
- throw new Error(`Invalid range. Please check the values you have passed: from: ${from}, to: ${to}`);
29
- }
30
- const options = useMemo(() => generateOptions(from, to), [from, to]);
31
- return React.createElement(Select, Object.assign({}, rest, { ref: ref, options: options }));
32
- }));
33
- YearSelect.displayName = 'YearSelect';
34
- export default YearSelect;
35
- //# sourceMappingURL=YearSelect.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"YearSelect.js","sourceRoot":"","sources":["../../../src/YearSelect/YearSelect.tsx"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAuBhE,MAAM,eAAe,GAAG,CAAC,IAAY,EAAE,EAAU,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAA;IAEtC,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;QAC7C,MAAM,KAAK,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAA;QAErD,OAAO;YACL,KAAK;YACL,IAAI,EAAE,KAAK,CAAC,QAAQ,EAAE;SACvB,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,YAAY,CACpC,UAAU,CACR,CACE,EAA+B,EAC/B,GAA0B,EAC1B,EAAE;QAFF,EAAE,IAAI,EAAE,EAAE,OAAqB,EAAhB,IAAI,cAAnB,cAAqB,CAAF;IAGnB,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,EAAE;QAChB,MAAM,IAAI,KAAK,CACb,iEAAiE,IAAI,SAAS,EAAE,EAAE,CACnF,CAAA;KACF;IAED,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAA;IAEpE,OAAO,oBAAC,MAAM,oBAAK,IAAI,IAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,IAAI,CAAA;AACzD,CAAC,CACF,CACF,CAAA;AAED,UAAU,CAAC,WAAW,GAAG,YAAY,CAAA;AAErC,eAAe,UAAU,CAAA"}
@@ -1,3 +0,0 @@
1
- export type { Props as YearSelectProps } from './YearSelect';
2
- export { default as YearSelect } from './YearSelect';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/YearSelect/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,KAAK,IAAI,eAAe,EAAE,MAAM,cAAc,CAAA;AAC5D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAA"}
@@ -1,2 +0,0 @@
1
- export { default as YearSelect } from './YearSelect';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/YearSelect/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAA"}
@@ -1,3 +0,0 @@
1
- export * from './MonthSelect';
2
- export * from './YearSelect';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA"}
@@ -1,3 +0,0 @@
1
- export * from './MonthSelect';
2
- export * from './YearSelect';
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA"}