@propellerads/time-picker 2.0.3 → 3.0.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/dist/index.d.ts CHANGED
@@ -1,4 +1,20 @@
1
- import { FunctionComponent } from 'react';
2
- import { TimePickerProps } from './types';
3
- declare const TimePicker: FunctionComponent<TimePickerProps>;
4
- export default TimePicker;
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ type TimePickerProps = {
5
+ elementId: string;
6
+ onChange: (value: string) => void;
7
+ value: string;
8
+ minTime?: string;
9
+ maxTime?: string;
10
+ label?: ReactNode;
11
+ errors?: string[];
12
+ isRequired?: boolean;
13
+ isReadonly?: boolean;
14
+ showErrorLabel?: boolean;
15
+ };
16
+
17
+ declare const TimePicker: ({ elementId, onChange, errors, value, minTime, maxTime, label, isRequired, isReadonly, showErrorLabel, }: TimePickerProps) => react_jsx_runtime.JSX.Element;
18
+
19
+ export { TimePicker as default };
20
+ export type { TimePickerProps };
package/dist/index.js CHANGED
@@ -1,8 +1,74 @@
1
+ import { jsxs as m, Fragment as T, jsx as t } from "react/jsx-runtime";
2
+ import $ from "@propellerads/error-label";
3
+ import E from "@propellerads/label";
4
+ import i from "styled-components";
5
+ import { gray80 as v, gray95 as k, errorColor as u, spacing as I } from "@propellerads/stylevariables";
6
+ import { inputStyles as L } from "@propellerads/theme-annotation";
7
+ const M = i.div`
8
+ display: flex;
9
+ position: relative;
10
+ width: 82px;
11
+ `, S = i.input`
12
+ border: 1px solid ${v};
13
+ border-radius: 8px;
14
+ padding: 0 7px;
15
+ font-size: 14px;
16
+ height: 36px;
17
+ ${L}
1
18
 
2
- 'use strict'
19
+ &[disabled] {
20
+ background-color: ${k};
21
+ }
3
22
 
4
- if (process.env.NODE_ENV === 'production') {
5
- module.exports = require('./time-picker.cjs.production.min.js')
6
- } else {
7
- module.exports = require('./time-picker.cjs.development.js')
8
- }
23
+ ${({ $hasErrors: r }) => r && `
24
+ border: 1px solid ${u} !important;
25
+ color: ${u};
26
+
27
+ &::-webkit-calendar-picker-indicator {
28
+ filter: invert(22%) sepia(63%) saturate(7197%) hue-rotate(353deg) brightness(106%) contrast(87%);
29
+ }
30
+ `}
31
+ `, _ = i.div`
32
+ position: absolute;
33
+ right: 1px;
34
+ top: calc(50% - ${I * 2.5}px);
35
+ `, A = "00:00", B = "23:59", U = ({
36
+ elementId: r,
37
+ onChange: n,
38
+ errors: s,
39
+ value: f,
40
+ minTime: a = A,
41
+ maxTime: l = B,
42
+ label: p,
43
+ isRequired: c = !1,
44
+ isReadonly: g = !1,
45
+ showErrorLabel: x
46
+ }) => {
47
+ const h = !!s?.length, b = (e) => {
48
+ const { value: o } = e.target, y = o < a ? a : o > l ? l : o;
49
+ n(y);
50
+ }, d = `${r}-input-time`;
51
+ return /* @__PURE__ */ m(T, { children: [
52
+ p && /* @__PURE__ */ t(E, { for: d, label: p, required: c }),
53
+ /* @__PURE__ */ m(M, { children: [
54
+ /* @__PURE__ */ t(
55
+ S,
56
+ {
57
+ id: d,
58
+ $hasErrors: h,
59
+ required: c,
60
+ disabled: g,
61
+ onChange: (e) => n(e.target.value),
62
+ onBlur: b,
63
+ type: "time",
64
+ value: f
65
+ }
66
+ ),
67
+ x && /* @__PURE__ */ t(_, { children: /* @__PURE__ */ t($, { elementId: r, errors: s?.slice() ?? [] }) })
68
+ ] })
69
+ ] });
70
+ };
71
+ export {
72
+ U as default
73
+ };
74
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/style.tsx","../src/index.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport {spacing, errorColor, gray80, gray95} from '@propellerads/stylevariables';\nimport {inputStyles} from '@propellerads/theme-annotation';\n\ntype StyledInputTimeProps = {\n $hasErrors: boolean;\n};\n\nexport const StyledTimeContainer = styled.div`\n display: flex;\n position: relative;\n width: 82px;\n`;\n\nexport const StyledInputTime = styled.input<StyledInputTimeProps>`\n border: 1px solid ${gray80};\n border-radius: 8px;\n padding: 0 7px;\n font-size: 14px;\n height: 36px;\n ${inputStyles}\n\n &[disabled] {\n background-color: ${gray95};\n }\n\n ${({$hasErrors}) =>\n $hasErrors &&\n `\n border: 1px solid ${errorColor} !important;\n color: ${errorColor};\n\n &::-webkit-calendar-picker-indicator {\n filter: invert(22%) sepia(63%) saturate(7197%) hue-rotate(353deg) brightness(106%) contrast(87%);\n }\n `}\n`;\n\nexport const StyledTimePickerHelper = styled.div`\n position: absolute;\n right: 1px;\n top: calc(50% - ${spacing * 2.5}px);\n`;\n","import ErrorLabel from '@propellerads/error-label';\nimport Label from '@propellerads/label';\nimport type {FocusEventHandler} from 'react';\nimport {StyledInputTime, StyledTimeContainer, StyledTimePickerHelper} from './style';\nimport type {TimePickerProps} from './types';\n\nconst DEFAULT_MIN_TIME = '00:00' as const;\nconst DEFAULT_MAX_TIME = '23:59' as const;\n\nconst TimePicker = ({\n elementId,\n onChange,\n errors,\n value,\n minTime = DEFAULT_MIN_TIME,\n maxTime = DEFAULT_MAX_TIME,\n label,\n isRequired = false,\n isReadonly = false,\n showErrorLabel,\n}: TimePickerProps) => {\n const hasErrors = Boolean(errors?.length);\n\n const onBlurCorrectTime: FocusEventHandler<HTMLInputElement> = (event) => {\n const {value: nextValue} = event.target;\n const correctTime = nextValue < minTime ? minTime : nextValue > maxTime ? maxTime : nextValue;\n\n onChange(correctTime);\n };\n\n const inputTimeElementId = `${elementId}-input-time`;\n\n return (\n <>\n {label && <Label for={inputTimeElementId} label={label} required={isRequired} />}\n <StyledTimeContainer>\n <StyledInputTime\n id={inputTimeElementId}\n $hasErrors={hasErrors}\n required={isRequired}\n disabled={isReadonly}\n onChange={(e) => onChange(e.target.value)}\n onBlur={onBlurCorrectTime}\n type=\"time\"\n value={value}\n />\n {showErrorLabel && (\n <StyledTimePickerHelper>\n <ErrorLabel elementId={elementId} errors={errors?.slice() ?? []} />\n </StyledTimePickerHelper>\n )}\n </StyledTimeContainer>\n </>\n );\n};\n\nexport default TimePicker;\nexport type {TimePickerProps} from './types';\n"],"names":["StyledTimeContainer","styled","StyledInputTime","gray80","inputStyles","gray95","$hasErrors","errorColor","StyledTimePickerHelper","spacing","DEFAULT_MIN_TIME","DEFAULT_MAX_TIME","TimePicker","elementId","onChange","errors","value","minTime","maxTime","label","isRequired","isReadonly","showErrorLabel","hasErrors","onBlurCorrectTime","event","nextValue","correctTime","inputTimeElementId","jsxs","Fragment","Label","jsx","ErrorLabel"],"mappings":";;;;;;AAQO,MAAMA,IAAsBC,EAAO;AAAA;AAAA;AAAA;AAAA,GAM7BC,IAAkBD,EAAO;AAAA,sBAChBE,CAAM;AAAA;AAAA;AAAA;AAAA;AAAA,IAKxBC,CAAW;AAAA;AAAA;AAAA,wBAGSC,CAAM;AAAA;AAAA;AAAA,IAG1B,CAAC,EAAC,YAAAC,EAAA,MACFA,KACA;AAAA,0BACsBC,CAAU;AAAA,eACrBA,CAAU;AAAA;AAAA;AAAA;AAAA;AAAA,KAKpB;AAAA,GAGQC,IAAyBP,EAAO;AAAA;AAAA;AAAA,oBAGzBQ,IAAU,GAAG;AAAA,GCnC3BC,IAAmB,SACnBC,IAAmB,SAEnBC,IAAa,CAAC;AAAA,EAClB,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC,IAAUP;AAAA,EACV,SAAAQ,IAAUP;AAAA,EACV,OAAAQ;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,YAAAC,IAAa;AAAA,EACb,gBAAAC;AACF,MAAuB;AACrB,QAAMC,IAAY,EAAQR,GAAQ,QAE5BS,IAAyD,CAACC,MAAU;AACxE,UAAM,EAAC,OAAOC,EAAA,IAAaD,EAAM,QAC3BE,IAAcD,IAAYT,IAAUA,IAAUS,IAAYR,IAAUA,IAAUQ;AAEpF,IAAAZ,EAASa,CAAW;AAAA,EACtB,GAEMC,IAAqB,GAAGf,CAAS;AAEvC,SACE,gBAAAgB,EAAAC,GAAA,EACG,UAAA;AAAA,IAAAX,uBAAUY,GAAA,EAAM,KAAKH,GAAoB,OAAAT,GAAc,UAAUC,GAAY;AAAA,sBAC7EpB,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAgC;AAAA,QAAC9B;AAAA,QAAA;AAAA,UACC,IAAI0B;AAAA,UACJ,YAAYL;AAAA,UACZ,UAAUH;AAAA,UACV,UAAUC;AAAA,UACV,UAAU,CAAC,MAAMP,EAAS,EAAE,OAAO,KAAK;AAAA,UACxC,QAAQU;AAAA,UACR,MAAK;AAAA,UACL,OAAAR;AAAA,QAAA;AAAA,MAAA;AAAA,MAEDM,KACC,gBAAAU,EAACxB,GAAA,EACC,UAAA,gBAAAwB,EAACC,GAAA,EAAW,WAAApB,GAAsB,QAAQE,GAAQ,MAAA,KAAW,CAAA,EAAC,CAAG,EAAA,CACnE;AAAA,IAAA,EAAA,CAEJ;AAAA,EAAA,GACF;AAEJ;"}
package/package.json CHANGED
@@ -1,39 +1,44 @@
1
1
  {
2
2
  "name": "@propellerads/time-picker",
3
- "version": "2.0.3",
4
- "repository": "https://github.com/propellerads/ui-components",
5
- "author": "n.milantyeva@propellerads.net",
6
- "license": "MIT",
7
- "private": false,
8
- "main": "dist/index.js",
9
- "typings": "dist/index.d.ts",
3
+ "version": "3.0.0",
4
+ "type": "module",
5
+ "types": "dist/index.d.ts",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./dist/index.js"
10
+ }
11
+ },
10
12
  "files": [
11
- "dist",
12
- "src"
13
+ "dist"
13
14
  ],
14
- "engines": {
15
- "node": ">=10"
15
+ "repository": "https://github.com/propellerads/ui-components.git",
16
+ "author": "n.milantyeva@propellerads.net",
17
+ "license": "MIT",
18
+ "bugs": {
19
+ "url": "https://github.com/propellerads/ui-components/issues"
16
20
  },
17
21
  "scripts": {
18
- "start": "tsdx watch",
19
- "build": "tsdx build"
22
+ "build": "tsc && vite build && rollup -c rollup.dts.config.mjs"
23
+ },
24
+ "homepage": "https://github.com/propellerads/ui-components#readme",
25
+ "private": false,
26
+ "dependencies": {
27
+ "@propellerads/error-label": "^5.0.2",
28
+ "@propellerads/label": "^4.0.4",
29
+ "@propellerads/stylevariables": "^2.0.2",
30
+ "@propellerads/theme-annotation": "^2.0.0"
20
31
  },
21
32
  "peerDependencies": {
22
- "react": ">=18 <19",
23
- "styled-components": "5.1.1",
24
- "@types/styled-components": "^5.1.36"
33
+ "react": "^18.0.0 || ^19.0.0",
34
+ "styled-components": "^5.1.1 || ^6.0.0"
25
35
  },
26
- "module": "dist/time-picker.esm.js",
27
36
  "devDependencies": {
28
- "tsdx": "0.13.3",
29
- "tslib": "2.4.0",
30
- "typescript": "4.9.5",
31
- "@types/react": "18.3.24"
32
- },
33
- "dependencies": {
34
- "@propellerads/stylevariables": "^2.0.2",
35
- "@propellerads/error-label": "^5.0.0",
36
- "@propellerads/label": "^4.0.2",
37
- "@propellerads/theme-annotation": "1.2.1"
37
+ "@types/react": "^19.2.14",
38
+ "@vitejs/plugin-react": "^5.1.4",
39
+ "rollup": "^4.58.0",
40
+ "rollup-plugin-dts": "^6.3.0",
41
+ "typescript": "^5.9.3",
42
+ "vite": "^7.3.1"
38
43
  }
39
44
  }
@@ -1 +0,0 @@
1
- declare module '*';
package/dist/style.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import { StyledComponent } from 'styled-components';
2
- export declare const StyledTimeContainer: StyledComponent<"div", any, {}, never>;
3
- export declare const StyledInputTime: StyledComponent<"input", any, {}, never>;
4
- export declare const StyledTimePickerHelper: StyledComponent<"div", any, {}, never>;
@@ -1,66 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
-
7
- var React = _interopDefault(require('react'));
8
- var Label = _interopDefault(require('@propellerads/label'));
9
- var ErrorLabel = _interopDefault(require('@propellerads/error-label'));
10
- var styled = _interopDefault(require('styled-components'));
11
- var stylevariables = require('@propellerads/stylevariables');
12
- var themeAnnotation = require('@propellerads/theme-annotation');
13
-
14
- function _taggedTemplateLiteralLoose(e, t) {
15
- return t || (t = e.slice(0)), e.raw = t, e;
16
- }
17
-
18
- var _templateObject, _templateObject2, _templateObject3;
19
- var StyledTimeContainer = /*#__PURE__*/styled.div(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n position: relative;\n width: 82px;\n"])));
20
- var StyledInputTime = /*#__PURE__*/themeAnnotation.themeAnnotation(/*#__PURE__*/styled.input(_templateObject2 || (_templateObject2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border: 1px solid ", ";\n border-radius: 8px;\n padding: 0 7px;\n font-size: 14px;\n height: 36px;\n\n &[disabled] {\n background-color: ", ";\n }\n\n &[data-has-errors='true'] {\n border: 1px solid ", " !important;\n color: ", ";\n\n &::-webkit-calendar-picker-indicator {\n filter: invert(22%) sepia(63%) saturate(7197%) hue-rotate(353deg) brightness(106%) contrast(87%);\n }\n }\n "])), stylevariables.gray80, stylevariables.gray95, stylevariables.errorColor, stylevariables.errorColor), themeAnnotation.Input);
21
- var StyledTimePickerHelper = /*#__PURE__*/styled.div(_templateObject3 || (_templateObject3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: absolute;\n right: 1px;\n top: calc(50% - ", "px);\n"])), stylevariables.spacing * 2.5);
22
-
23
- var DEFAULT_MIN_TIME = '00:00';
24
- var DEFAULT_MAX_TIME = '23:59';
25
- var TimePicker = function TimePicker(_ref) {
26
- var _errors$slice;
27
- var elementId = _ref.elementId,
28
- onChange = _ref.onChange,
29
- errors = _ref.errors,
30
- value = _ref.value,
31
- minTime = _ref.minTime,
32
- maxTime = _ref.maxTime,
33
- label = _ref.label,
34
- isRequired = _ref.isRequired,
35
- isReadonly = _ref.isReadonly,
36
- showErrorLabel = _ref.showErrorLabel;
37
- var onChangeTime = function onChangeTime(event) {
38
- onChange(event.target.value);
39
- };
40
- var onChangeCorrectTime = function onChangeCorrectTime(event) {
41
- var timesArray = [minTime !== null && minTime !== void 0 ? minTime : DEFAULT_MIN_TIME, maxTime !== null && maxTime !== void 0 ? maxTime : DEFAULT_MAX_TIME, event.target.value];
42
- var correctTime = timesArray.sort()[1];
43
- onChange(correctTime);
44
- };
45
- var inputTimeElementId = elementId + "-input-time";
46
- return React.createElement(React.Fragment, null, label && React.createElement(Label, {
47
- "for": inputTimeElementId,
48
- label: label,
49
- required: isRequired
50
- }), React.createElement(StyledTimeContainer, null, React.createElement(StyledInputTime, {
51
- id: inputTimeElementId,
52
- "data-has-errors": Boolean(errors === null || errors === void 0 ? void 0 : errors.length),
53
- required: isRequired,
54
- disabled: isReadonly,
55
- onChange: onChangeTime,
56
- onBlur: onChangeCorrectTime,
57
- type: "time",
58
- value: value
59
- }), showErrorLabel && React.createElement(StyledTimePickerHelper, null, React.createElement(ErrorLabel, {
60
- elementId: elementId,
61
- errors: (_errors$slice = errors === null || errors === void 0 ? void 0 : errors.slice()) !== null && _errors$slice !== void 0 ? _errors$slice : []
62
- }))));
63
- };
64
-
65
- exports.default = TimePicker;
66
- //# sourceMappingURL=time-picker.cjs.development.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"time-picker.cjs.development.js","sources":["../src/style.tsx","../src/index.tsx"],"sourcesContent":["import styled, {AnyStyledComponent, StyledComponent} from 'styled-components';\nimport {spacing, errorColor, gray80, gray95} from '@propellerads/stylevariables';\nimport {Input, themeAnnotation} from '@propellerads/theme-annotation';\n\nexport const StyledTimeContainer = styled.div`\n display: flex;\n position: relative;\n width: 82px;\n`;\n\nexport const StyledInputTime = themeAnnotation(\n styled.input`\n border: 1px solid ${gray80};\n border-radius: 8px;\n padding: 0 7px;\n font-size: 14px;\n height: 36px;\n\n &[disabled] {\n background-color: ${gray95};\n }\n\n &[data-has-errors='true'] {\n border: 1px solid ${errorColor} !important;\n color: ${errorColor};\n\n &::-webkit-calendar-picker-indicator {\n filter: invert(22%) sepia(63%) saturate(7197%) hue-rotate(353deg) brightness(106%) contrast(87%);\n }\n }\n ` as AnyStyledComponent,\n Input,\n) as StyledComponent<'input', any>;\n\nexport const StyledTimePickerHelper = styled.div`\n position: absolute;\n right: 1px;\n top: calc(50% - ${spacing * 2.5}px);\n`;\n","import React, {ChangeEvent, FunctionComponent} from 'react';\n\nimport Label from '@propellerads/label';\nimport ErrorLabel from '@propellerads/error-label';\n\nimport {StyledTimeContainer, StyledInputTime, StyledTimePickerHelper} from './style';\nimport {TimePickerProps} from './types';\n\nconst DEFAULT_MIN_TIME = '00:00';\nconst DEFAULT_MAX_TIME = '23:59';\n\nconst TimePicker: FunctionComponent<TimePickerProps> = ({\n elementId,\n onChange,\n errors,\n value,\n minTime,\n maxTime,\n label,\n isRequired,\n isReadonly,\n showErrorLabel,\n}: TimePickerProps) => {\n const onChangeTime = (event: ChangeEvent<HTMLInputElement>) => {\n onChange(event.target.value);\n };\n\n const onChangeCorrectTime = (event: ChangeEvent<HTMLInputElement>) => {\n const timesArray = [minTime ?? DEFAULT_MIN_TIME, maxTime ?? DEFAULT_MAX_TIME, event.target.value];\n const correctTime = timesArray.sort()[1];\n\n onChange(correctTime);\n };\n\n const inputTimeElementId = `${elementId}-input-time`;\n\n return (\n <>\n {label && <Label for={inputTimeElementId} label={label} required={isRequired} />}\n <StyledTimeContainer>\n <StyledInputTime\n id={inputTimeElementId}\n data-has-errors={Boolean(errors?.length)}\n required={isRequired}\n disabled={isReadonly}\n onChange={onChangeTime}\n onBlur={onChangeCorrectTime}\n type=\"time\"\n value={value}\n />\n {showErrorLabel && (\n <StyledTimePickerHelper>\n <ErrorLabel elementId={elementId} errors={errors?.slice() ?? []} />\n </StyledTimePickerHelper>\n )}\n </StyledTimeContainer>\n </>\n );\n};\n\nexport default TimePicker;\n"],"names":["StyledTimeContainer","styled","div","_templateObject","_taggedTemplateLiteralLoose","StyledInputTime","themeAnnotation","input","_templateObject2","gray80","gray95","errorColor","Input","StyledTimePickerHelper","_templateObject3","spacing","DEFAULT_MIN_TIME","DEFAULT_MAX_TIME","TimePicker","_ref","elementId","onChange","errors","value","minTime","maxTime","label","isRequired","isReadonly","showErrorLabel","onChangeTime","event","target","onChangeCorrectTime","timesArray","correctTime","sort","inputTimeElementId","React","Label","required","id","Boolean","length","disabled","onBlur","type","ErrorLabel","_errors$slice","slice"],"mappings":";;;;;;;;;;;;;;;;;;AAIO,IAAMA,mBAAmB,gBAAGC,MAAM,CAACC,GAAG,CAAAC,eAAA,KAAAA,eAAA,gBAAAC,2BAAA,mEAI5C;AAEM,IAAMC,eAAe,gBAAGC,+BAAe,cAC5CL,MAAM,CAACM,KAAK,CAAAC,gBAAA,KAAAA,gBAAA,gBAAAJ,2BAAA,wcACUK,qBAAM,EAOJC,qBAAM,EAINC,yBAAU,EACrBA,yBAAU,GAOvBC,qBAAK,CAC2B;AAE3B,IAAMC,sBAAsB,gBAAGZ,MAAM,CAACC,GAAG,CAAAY,gBAAA,KAAAA,gBAAA,gBAAAV,2BAAA,6EAG5BW,sBAAO,GAAG,GAAG,CAChC;;AC9BD,IAAMC,gBAAgB,GAAG,OAAO;AAChC,IAAMC,gBAAgB,GAAG,OAAO;AAEhC,IAAMC,UAAU,GAAuC,SAAjDA,UAAUA,CAAAC,IAAA;;MACdC,SAAS,GAAAD,IAAA,CAATC,SAAS;IACTC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,MAAM,GAAAH,IAAA,CAANG,MAAM;IACNC,KAAK,GAAAJ,IAAA,CAALI,KAAK;IACLC,OAAO,GAAAL,IAAA,CAAPK,OAAO;IACPC,OAAO,GAAAN,IAAA,CAAPM,OAAO;IACPC,KAAK,GAAAP,IAAA,CAALO,KAAK;IACLC,UAAU,GAAAR,IAAA,CAAVQ,UAAU;IACVC,UAAU,GAAAT,IAAA,CAAVS,UAAU;IACVC,cAAc,GAAAV,IAAA,CAAdU,cAAc;EAEd,IAAMC,YAAY,GAAG,SAAfA,YAAYA,CAAIC,KAAoC;IACxDV,QAAQ,CAACU,KAAK,CAACC,MAAM,CAACT,KAAK,CAAC;GAC7B;EAED,IAAMU,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAIF,KAAoC;IAC/D,IAAMG,UAAU,GAAG,CAACV,OAAO,aAAPA,OAAO,cAAPA,OAAO,GAAIR,gBAAgB,EAAES,OAAO,aAAPA,OAAO,cAAPA,OAAO,GAAIR,gBAAgB,EAAEc,KAAK,CAACC,MAAM,CAACT,KAAK,CAAC;IACjG,IAAMY,WAAW,GAAGD,UAAU,CAACE,IAAI,EAAE,CAAC,CAAC,CAAC;IAExCf,QAAQ,CAACc,WAAW,CAAC;GACtB;EAED,IAAME,kBAAkB,GAAMjB,SAAS,gBAAa;EAEpD,OACEkB,0CACGZ,KAAK,IAAIY,oBAACC,KAAK;IAAC,OAAKF,kBAAkB;IAAEX,KAAK,EAAEA,KAAK;IAAEc,QAAQ,EAAEb;IAAc,EAChFW,oBAACtC,mBAAmB,QAClBsC,oBAACjC,eAAe;IACdoC,EAAE,EAAEJ,kBAAkB;uBACLK,OAAO,CAACpB,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEqB,MAAM,CAAC;IACxCH,QAAQ,EAAEb,UAAU;IACpBiB,QAAQ,EAAEhB,UAAU;IACpBP,QAAQ,EAAES,YAAY;IACtBe,MAAM,EAAEZ,mBAAmB;IAC3Ba,IAAI,EAAC,MAAM;IACXvB,KAAK,EAAEA;IACP,EACDM,cAAc,IACbS,oBAACzB,sBAAsB,QACrByB,oBAACS,UAAU;IAAC3B,SAAS,EAAEA,SAAS;IAAEE,MAAM,GAAA0B,aAAA,GAAE1B,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAE2B,KAAK,EAAE,cAAAD,aAAA,cAAAA,aAAA,GAAI;IAAM,CAEtE,CACmB,CACrB;AAEP,CAAC;;;;"}
@@ -1,2 +0,0 @@
1
- "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r,n,t,l=e(require("react")),a=e(require("@propellerads/label")),o=e(require("@propellerads/error-label")),i=e(require("styled-components")),u=require("@propellerads/stylevariables"),d=require("@propellerads/theme-annotation");function s(e,r){return r||(r=e.slice(0)),e.raw=r,e}var p=i.div(r||(r=s(["\n display: flex;\n position: relative;\n width: 82px;\n"]))),c=d.themeAnnotation(i.input(n||(n=s(["\n border: 1px solid ",";\n border-radius: 8px;\n padding: 0 7px;\n font-size: 14px;\n height: 36px;\n\n &[disabled] {\n background-color: ",";\n }\n\n &[data-has-errors='true'] {\n border: 1px solid "," !important;\n color: ",";\n\n &::-webkit-calendar-picker-indicator {\n filter: invert(22%) sepia(63%) saturate(7197%) hue-rotate(353deg) brightness(106%) contrast(87%);\n }\n }\n "])),u.gray80,u.gray95,u.errorColor,u.errorColor),d.Input),m=i.div(t||(t=s(["\n position: absolute;\n right: 1px;\n top: calc(50% - ","px);\n"])),2.5*u.spacing);exports.default=function(e){var r,n=e.elementId,t=e.onChange,i=e.errors,u=e.value,d=e.minTime,s=e.maxTime,b=e.label,v=e.isRequired,g=e.isReadonly,f=e.showErrorLabel,h=n+"-input-time";return l.createElement(l.Fragment,null,b&&l.createElement(a,{for:h,label:b,required:v}),l.createElement(p,null,l.createElement(c,{id:h,"data-has-errors":Boolean(null==i?void 0:i.length),required:v,disabled:g,onChange:function(e){t(e.target.value)},onBlur:function(e){var r=[null!=d?d:"00:00",null!=s?s:"23:59",e.target.value].sort()[1];t(r)},type:"time",value:u}),f&&l.createElement(m,null,l.createElement(o,{elementId:n,errors:null!==(r=null==i?void 0:i.slice())&&void 0!==r?r:[]}))))};
2
- //# sourceMappingURL=time-picker.cjs.production.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"time-picker.cjs.production.min.js","sources":["../src/style.tsx","../src/index.tsx"],"sourcesContent":["import styled, {AnyStyledComponent, StyledComponent} from 'styled-components';\nimport {spacing, errorColor, gray80, gray95} from '@propellerads/stylevariables';\nimport {Input, themeAnnotation} from '@propellerads/theme-annotation';\n\nexport const StyledTimeContainer = styled.div`\n display: flex;\n position: relative;\n width: 82px;\n`;\n\nexport const StyledInputTime = themeAnnotation(\n styled.input`\n border: 1px solid ${gray80};\n border-radius: 8px;\n padding: 0 7px;\n font-size: 14px;\n height: 36px;\n\n &[disabled] {\n background-color: ${gray95};\n }\n\n &[data-has-errors='true'] {\n border: 1px solid ${errorColor} !important;\n color: ${errorColor};\n\n &::-webkit-calendar-picker-indicator {\n filter: invert(22%) sepia(63%) saturate(7197%) hue-rotate(353deg) brightness(106%) contrast(87%);\n }\n }\n ` as AnyStyledComponent,\n Input,\n) as StyledComponent<'input', any>;\n\nexport const StyledTimePickerHelper = styled.div`\n position: absolute;\n right: 1px;\n top: calc(50% - ${spacing * 2.5}px);\n`;\n","import React, {ChangeEvent, FunctionComponent} from 'react';\n\nimport Label from '@propellerads/label';\nimport ErrorLabel from '@propellerads/error-label';\n\nimport {StyledTimeContainer, StyledInputTime, StyledTimePickerHelper} from './style';\nimport {TimePickerProps} from './types';\n\nconst DEFAULT_MIN_TIME = '00:00';\nconst DEFAULT_MAX_TIME = '23:59';\n\nconst TimePicker: FunctionComponent<TimePickerProps> = ({\n elementId,\n onChange,\n errors,\n value,\n minTime,\n maxTime,\n label,\n isRequired,\n isReadonly,\n showErrorLabel,\n}: TimePickerProps) => {\n const onChangeTime = (event: ChangeEvent<HTMLInputElement>) => {\n onChange(event.target.value);\n };\n\n const onChangeCorrectTime = (event: ChangeEvent<HTMLInputElement>) => {\n const timesArray = [minTime ?? DEFAULT_MIN_TIME, maxTime ?? DEFAULT_MAX_TIME, event.target.value];\n const correctTime = timesArray.sort()[1];\n\n onChange(correctTime);\n };\n\n const inputTimeElementId = `${elementId}-input-time`;\n\n return (\n <>\n {label && <Label for={inputTimeElementId} label={label} required={isRequired} />}\n <StyledTimeContainer>\n <StyledInputTime\n id={inputTimeElementId}\n data-has-errors={Boolean(errors?.length)}\n required={isRequired}\n disabled={isReadonly}\n onChange={onChangeTime}\n onBlur={onChangeCorrectTime}\n type=\"time\"\n value={value}\n />\n {showErrorLabel && (\n <StyledTimePickerHelper>\n <ErrorLabel elementId={elementId} errors={errors?.slice() ?? []} />\n </StyledTimePickerHelper>\n )}\n </StyledTimeContainer>\n </>\n );\n};\n\nexport default TimePicker;\n"],"names":["StyledTimeContainer","styled","div","_templateObject","_taggedTemplateLiteralLoose","StyledInputTime","themeAnnotation","input","_templateObject2","gray80","gray95","errorColor","Input","StyledTimePickerHelper","_templateObject3","spacing","_ref","elementId","onChange","errors","value","minTime","maxTime","label","isRequired","isReadonly","showErrorLabel","inputTimeElementId","React","Label","for","required","id","Boolean","length","disabled","event","target","onBlur","correctTime","sort","type","ErrorLabel","_errors$slice","slice"],"mappings":"maAIO,IAAMA,EAAsBC,EAAOC,IAAGC,IAAAA,EAAAC,qEAMhCC,EAAkBC,kBAC7BL,EAAOM,MAAKC,IAAAA,EAAAJ,ocACUK,SAOEC,SAIAC,aACXA,cAObC,SAGWC,EAAyBZ,EAAOC,IAAGY,IAAAA,EAAAV,4EAGlB,IAAVW,2BC1BmC,SAAvCC,SACdC,EAASD,EAATC,UACAC,EAAQF,EAARE,SACAC,EAAMH,EAANG,OACAC,EAAKJ,EAALI,MACAC,EAAOL,EAAPK,QACAC,EAAON,EAAPM,QACAC,EAAKP,EAALO,MACAC,EAAUR,EAAVQ,WACAC,EAAUT,EAAVS,WACAC,EAAcV,EAAdU,eAaMC,EAAwBV,gBAE9B,OACEW,gCACGL,GAASK,gBAACC,GAAMC,IAAKH,EAAoBJ,MAAOA,EAAOQ,SAAUP,IAClEI,gBAAC5B,OACC4B,gBAACvB,GACC2B,GAAIL,oBACaM,QAAQd,MAAAA,SAAAA,EAAQe,QACjCH,SAAUP,EACVW,SAAUV,EACVP,SAtBa,SAACkB,GACpBlB,EAASkB,EAAMC,OAAOjB,QAsBhBkB,OAnBoB,SAACF,GAC3B,IACMG,EADa,CAAClB,MAAAA,EAAAA,EApBC,QAoB4BC,MAAAA,EAAAA,EAnB5B,QAmByDc,EAAMC,OAAOjB,OAC5DoB,OAAO,GAEtCtB,EAASqB,IAgBHE,KAAK,OACLrB,MAAOA,IAERM,GACCE,gBAACf,OACCe,gBAACc,GAAWzB,UAAWA,EAAWE,eAAMwB,EAAExB,MAAAA,SAAAA,EAAQyB,mBAAOD,EAAAA,EAAI"}
@@ -1,60 +0,0 @@
1
- import React from 'react';
2
- import Label from '@propellerads/label';
3
- import ErrorLabel from '@propellerads/error-label';
4
- import styled from 'styled-components';
5
- import { gray80, gray95, errorColor, spacing } from '@propellerads/stylevariables';
6
- import { themeAnnotation, Input } from '@propellerads/theme-annotation';
7
-
8
- function _taggedTemplateLiteralLoose(e, t) {
9
- return t || (t = e.slice(0)), e.raw = t, e;
10
- }
11
-
12
- var _templateObject, _templateObject2, _templateObject3;
13
- var StyledTimeContainer = /*#__PURE__*/styled.div(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n position: relative;\n width: 82px;\n"])));
14
- var StyledInputTime = /*#__PURE__*/themeAnnotation(/*#__PURE__*/styled.input(_templateObject2 || (_templateObject2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border: 1px solid ", ";\n border-radius: 8px;\n padding: 0 7px;\n font-size: 14px;\n height: 36px;\n\n &[disabled] {\n background-color: ", ";\n }\n\n &[data-has-errors='true'] {\n border: 1px solid ", " !important;\n color: ", ";\n\n &::-webkit-calendar-picker-indicator {\n filter: invert(22%) sepia(63%) saturate(7197%) hue-rotate(353deg) brightness(106%) contrast(87%);\n }\n }\n "])), gray80, gray95, errorColor, errorColor), Input);
15
- var StyledTimePickerHelper = /*#__PURE__*/styled.div(_templateObject3 || (_templateObject3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: absolute;\n right: 1px;\n top: calc(50% - ", "px);\n"])), spacing * 2.5);
16
-
17
- var DEFAULT_MIN_TIME = '00:00';
18
- var DEFAULT_MAX_TIME = '23:59';
19
- var TimePicker = function TimePicker(_ref) {
20
- var _errors$slice;
21
- var elementId = _ref.elementId,
22
- onChange = _ref.onChange,
23
- errors = _ref.errors,
24
- value = _ref.value,
25
- minTime = _ref.minTime,
26
- maxTime = _ref.maxTime,
27
- label = _ref.label,
28
- isRequired = _ref.isRequired,
29
- isReadonly = _ref.isReadonly,
30
- showErrorLabel = _ref.showErrorLabel;
31
- var onChangeTime = function onChangeTime(event) {
32
- onChange(event.target.value);
33
- };
34
- var onChangeCorrectTime = function onChangeCorrectTime(event) {
35
- var timesArray = [minTime !== null && minTime !== void 0 ? minTime : DEFAULT_MIN_TIME, maxTime !== null && maxTime !== void 0 ? maxTime : DEFAULT_MAX_TIME, event.target.value];
36
- var correctTime = timesArray.sort()[1];
37
- onChange(correctTime);
38
- };
39
- var inputTimeElementId = elementId + "-input-time";
40
- return React.createElement(React.Fragment, null, label && React.createElement(Label, {
41
- "for": inputTimeElementId,
42
- label: label,
43
- required: isRequired
44
- }), React.createElement(StyledTimeContainer, null, React.createElement(StyledInputTime, {
45
- id: inputTimeElementId,
46
- "data-has-errors": Boolean(errors === null || errors === void 0 ? void 0 : errors.length),
47
- required: isRequired,
48
- disabled: isReadonly,
49
- onChange: onChangeTime,
50
- onBlur: onChangeCorrectTime,
51
- type: "time",
52
- value: value
53
- }), showErrorLabel && React.createElement(StyledTimePickerHelper, null, React.createElement(ErrorLabel, {
54
- elementId: elementId,
55
- errors: (_errors$slice = errors === null || errors === void 0 ? void 0 : errors.slice()) !== null && _errors$slice !== void 0 ? _errors$slice : []
56
- }))));
57
- };
58
-
59
- export default TimePicker;
60
- //# sourceMappingURL=time-picker.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"time-picker.esm.js","sources":["../src/style.tsx","../src/index.tsx"],"sourcesContent":["import styled, {AnyStyledComponent, StyledComponent} from 'styled-components';\nimport {spacing, errorColor, gray80, gray95} from '@propellerads/stylevariables';\nimport {Input, themeAnnotation} from '@propellerads/theme-annotation';\n\nexport const StyledTimeContainer = styled.div`\n display: flex;\n position: relative;\n width: 82px;\n`;\n\nexport const StyledInputTime = themeAnnotation(\n styled.input`\n border: 1px solid ${gray80};\n border-radius: 8px;\n padding: 0 7px;\n font-size: 14px;\n height: 36px;\n\n &[disabled] {\n background-color: ${gray95};\n }\n\n &[data-has-errors='true'] {\n border: 1px solid ${errorColor} !important;\n color: ${errorColor};\n\n &::-webkit-calendar-picker-indicator {\n filter: invert(22%) sepia(63%) saturate(7197%) hue-rotate(353deg) brightness(106%) contrast(87%);\n }\n }\n ` as AnyStyledComponent,\n Input,\n) as StyledComponent<'input', any>;\n\nexport const StyledTimePickerHelper = styled.div`\n position: absolute;\n right: 1px;\n top: calc(50% - ${spacing * 2.5}px);\n`;\n","import React, {ChangeEvent, FunctionComponent} from 'react';\n\nimport Label from '@propellerads/label';\nimport ErrorLabel from '@propellerads/error-label';\n\nimport {StyledTimeContainer, StyledInputTime, StyledTimePickerHelper} from './style';\nimport {TimePickerProps} from './types';\n\nconst DEFAULT_MIN_TIME = '00:00';\nconst DEFAULT_MAX_TIME = '23:59';\n\nconst TimePicker: FunctionComponent<TimePickerProps> = ({\n elementId,\n onChange,\n errors,\n value,\n minTime,\n maxTime,\n label,\n isRequired,\n isReadonly,\n showErrorLabel,\n}: TimePickerProps) => {\n const onChangeTime = (event: ChangeEvent<HTMLInputElement>) => {\n onChange(event.target.value);\n };\n\n const onChangeCorrectTime = (event: ChangeEvent<HTMLInputElement>) => {\n const timesArray = [minTime ?? DEFAULT_MIN_TIME, maxTime ?? DEFAULT_MAX_TIME, event.target.value];\n const correctTime = timesArray.sort()[1];\n\n onChange(correctTime);\n };\n\n const inputTimeElementId = `${elementId}-input-time`;\n\n return (\n <>\n {label && <Label for={inputTimeElementId} label={label} required={isRequired} />}\n <StyledTimeContainer>\n <StyledInputTime\n id={inputTimeElementId}\n data-has-errors={Boolean(errors?.length)}\n required={isRequired}\n disabled={isReadonly}\n onChange={onChangeTime}\n onBlur={onChangeCorrectTime}\n type=\"time\"\n value={value}\n />\n {showErrorLabel && (\n <StyledTimePickerHelper>\n <ErrorLabel elementId={elementId} errors={errors?.slice() ?? []} />\n </StyledTimePickerHelper>\n )}\n </StyledTimeContainer>\n </>\n );\n};\n\nexport default TimePicker;\n"],"names":["StyledTimeContainer","styled","div","_templateObject","_taggedTemplateLiteralLoose","StyledInputTime","themeAnnotation","input","_templateObject2","gray80","gray95","errorColor","Input","StyledTimePickerHelper","_templateObject3","spacing","DEFAULT_MIN_TIME","DEFAULT_MAX_TIME","TimePicker","_ref","elementId","onChange","errors","value","minTime","maxTime","label","isRequired","isReadonly","showErrorLabel","onChangeTime","event","target","onChangeCorrectTime","timesArray","correctTime","sort","inputTimeElementId","React","Label","required","id","Boolean","length","disabled","onBlur","type","ErrorLabel","_errors$slice","slice"],"mappings":";;;;;;;;;;;;AAIO,IAAMA,mBAAmB,gBAAGC,MAAM,CAACC,GAAG,CAAAC,eAAA,KAAAA,eAAA,gBAAAC,2BAAA,mEAI5C;AAEM,IAAMC,eAAe,gBAAGC,eAAe,cAC5CL,MAAM,CAACM,KAAK,CAAAC,gBAAA,KAAAA,gBAAA,gBAAAJ,2BAAA,wcACUK,MAAM,EAOJC,MAAM,EAINC,UAAU,EACrBA,UAAU,GAOvBC,KAAK,CAC2B;AAE3B,IAAMC,sBAAsB,gBAAGZ,MAAM,CAACC,GAAG,CAAAY,gBAAA,KAAAA,gBAAA,gBAAAV,2BAAA,6EAG5BW,OAAO,GAAG,GAAG,CAChC;;AC9BD,IAAMC,gBAAgB,GAAG,OAAO;AAChC,IAAMC,gBAAgB,GAAG,OAAO;AAEhC,IAAMC,UAAU,GAAuC,SAAjDA,UAAUA,CAAAC,IAAA;;MACdC,SAAS,GAAAD,IAAA,CAATC,SAAS;IACTC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,MAAM,GAAAH,IAAA,CAANG,MAAM;IACNC,KAAK,GAAAJ,IAAA,CAALI,KAAK;IACLC,OAAO,GAAAL,IAAA,CAAPK,OAAO;IACPC,OAAO,GAAAN,IAAA,CAAPM,OAAO;IACPC,KAAK,GAAAP,IAAA,CAALO,KAAK;IACLC,UAAU,GAAAR,IAAA,CAAVQ,UAAU;IACVC,UAAU,GAAAT,IAAA,CAAVS,UAAU;IACVC,cAAc,GAAAV,IAAA,CAAdU,cAAc;EAEd,IAAMC,YAAY,GAAG,SAAfA,YAAYA,CAAIC,KAAoC;IACxDV,QAAQ,CAACU,KAAK,CAACC,MAAM,CAACT,KAAK,CAAC;GAC7B;EAED,IAAMU,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAIF,KAAoC;IAC/D,IAAMG,UAAU,GAAG,CAACV,OAAO,aAAPA,OAAO,cAAPA,OAAO,GAAIR,gBAAgB,EAAES,OAAO,aAAPA,OAAO,cAAPA,OAAO,GAAIR,gBAAgB,EAAEc,KAAK,CAACC,MAAM,CAACT,KAAK,CAAC;IACjG,IAAMY,WAAW,GAAGD,UAAU,CAACE,IAAI,EAAE,CAAC,CAAC,CAAC;IAExCf,QAAQ,CAACc,WAAW,CAAC;GACtB;EAED,IAAME,kBAAkB,GAAMjB,SAAS,gBAAa;EAEpD,OACEkB,0CACGZ,KAAK,IAAIY,oBAACC,KAAK;IAAC,OAAKF,kBAAkB;IAAEX,KAAK,EAAEA,KAAK;IAAEc,QAAQ,EAAEb;IAAc,EAChFW,oBAACtC,mBAAmB,QAClBsC,oBAACjC,eAAe;IACdoC,EAAE,EAAEJ,kBAAkB;uBACLK,OAAO,CAACpB,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEqB,MAAM,CAAC;IACxCH,QAAQ,EAAEb,UAAU;IACpBiB,QAAQ,EAAEhB,UAAU;IACpBP,QAAQ,EAAES,YAAY;IACtBe,MAAM,EAAEZ,mBAAmB;IAC3Ba,IAAI,EAAC,MAAM;IACXvB,KAAK,EAAEA;IACP,EACDM,cAAc,IACbS,oBAACzB,sBAAsB,QACrByB,oBAACS,UAAU;IAAC3B,SAAS,EAAEA,SAAS;IAAEE,MAAM,GAAA0B,aAAA,GAAE1B,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAE2B,KAAK,EAAE,cAAAD,aAAA,cAAAA,aAAA,GAAI;IAAM,CAEtE,CACmB,CACrB;AAEP,CAAC;;;;"}
package/dist/types.d.ts DELETED
@@ -1,13 +0,0 @@
1
- declare type TimePickerProps = {
2
- elementId: string;
3
- onChange: (value: string) => void;
4
- value: string;
5
- minTime?: string | '00:00';
6
- maxTime?: string | '23:59';
7
- label?: string | null | undefined;
8
- errors?: Array<string> | undefined;
9
- isRequired?: boolean;
10
- isReadonly?: boolean;
11
- showErrorLabel?: boolean;
12
- };
13
- export { TimePickerProps };
@@ -1 +0,0 @@
1
- declare module '*';
package/src/index.tsx DELETED
@@ -1,61 +0,0 @@
1
- import React, {ChangeEvent, FunctionComponent} from 'react';
2
-
3
- import Label from '@propellerads/label';
4
- import ErrorLabel from '@propellerads/error-label';
5
-
6
- import {StyledTimeContainer, StyledInputTime, StyledTimePickerHelper} from './style';
7
- import {TimePickerProps} from './types';
8
-
9
- const DEFAULT_MIN_TIME = '00:00';
10
- const DEFAULT_MAX_TIME = '23:59';
11
-
12
- const TimePicker: FunctionComponent<TimePickerProps> = ({
13
- elementId,
14
- onChange,
15
- errors,
16
- value,
17
- minTime,
18
- maxTime,
19
- label,
20
- isRequired,
21
- isReadonly,
22
- showErrorLabel,
23
- }: TimePickerProps) => {
24
- const onChangeTime = (event: ChangeEvent<HTMLInputElement>) => {
25
- onChange(event.target.value);
26
- };
27
-
28
- const onChangeCorrectTime = (event: ChangeEvent<HTMLInputElement>) => {
29
- const timesArray = [minTime ?? DEFAULT_MIN_TIME, maxTime ?? DEFAULT_MAX_TIME, event.target.value];
30
- const correctTime = timesArray.sort()[1];
31
-
32
- onChange(correctTime);
33
- };
34
-
35
- const inputTimeElementId = `${elementId}-input-time`;
36
-
37
- return (
38
- <>
39
- {label && <Label for={inputTimeElementId} label={label} required={isRequired} />}
40
- <StyledTimeContainer>
41
- <StyledInputTime
42
- id={inputTimeElementId}
43
- data-has-errors={Boolean(errors?.length)}
44
- required={isRequired}
45
- disabled={isReadonly}
46
- onChange={onChangeTime}
47
- onBlur={onChangeCorrectTime}
48
- type="time"
49
- value={value}
50
- />
51
- {showErrorLabel && (
52
- <StyledTimePickerHelper>
53
- <ErrorLabel elementId={elementId} errors={errors?.slice() ?? []} />
54
- </StyledTimePickerHelper>
55
- )}
56
- </StyledTimeContainer>
57
- </>
58
- );
59
- };
60
-
61
- export default TimePicker;
package/src/style.tsx DELETED
@@ -1,39 +0,0 @@
1
- import styled, {AnyStyledComponent, StyledComponent} from 'styled-components';
2
- import {spacing, errorColor, gray80, gray95} from '@propellerads/stylevariables';
3
- import {Input, themeAnnotation} from '@propellerads/theme-annotation';
4
-
5
- export const StyledTimeContainer = styled.div`
6
- display: flex;
7
- position: relative;
8
- width: 82px;
9
- `;
10
-
11
- export const StyledInputTime = themeAnnotation(
12
- styled.input`
13
- border: 1px solid ${gray80};
14
- border-radius: 8px;
15
- padding: 0 7px;
16
- font-size: 14px;
17
- height: 36px;
18
-
19
- &[disabled] {
20
- background-color: ${gray95};
21
- }
22
-
23
- &[data-has-errors='true'] {
24
- border: 1px solid ${errorColor} !important;
25
- color: ${errorColor};
26
-
27
- &::-webkit-calendar-picker-indicator {
28
- filter: invert(22%) sepia(63%) saturate(7197%) hue-rotate(353deg) brightness(106%) contrast(87%);
29
- }
30
- }
31
- ` as AnyStyledComponent,
32
- Input,
33
- ) as StyledComponent<'input', any>;
34
-
35
- export const StyledTimePickerHelper = styled.div`
36
- position: absolute;
37
- right: 1px;
38
- top: calc(50% - ${spacing * 2.5}px);
39
- `;
package/src/types.ts DELETED
@@ -1,14 +0,0 @@
1
- type TimePickerProps = {
2
- elementId: string;
3
- onChange: (value: string) => void;
4
- value: string;
5
- minTime?: string | '00:00';
6
- maxTime?: string | '23:59';
7
- label?: string | null | undefined;
8
- errors?: Array<string> | undefined;
9
- isRequired?: boolean;
10
- isReadonly?: boolean;
11
- showErrorLabel?: boolean;
12
- };
13
-
14
- export {TimePickerProps};