@propellerads/time-picker 3.0.0 → 3.0.1

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.js CHANGED
@@ -1,74 +1,62 @@
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`
1
+ import e from "@propellerads/error-label";
2
+ import t from "@propellerads/label";
3
+ import n from "styled-components";
4
+ import { errorColor as r, gray80 as i, gray95 as a, spacing as o } from "@propellerads/stylevariables";
5
+ import { inputStyles as s } from "@propellerads/theme-annotation";
6
+ import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
7
+ //#region src/style.tsx
8
+ var d = n.div`
8
9
  display: flex;
9
10
  position: relative;
10
11
  width: 82px;
11
- `, S = i.input`
12
- border: 1px solid ${v};
12
+ `, f = n.input`
13
+ border: 1px solid ${i};
13
14
  border-radius: 8px;
14
15
  padding: 0 7px;
15
16
  font-size: 14px;
16
17
  height: 36px;
17
- ${L}
18
+ ${s}
18
19
 
19
20
  &[disabled] {
20
- background-color: ${k};
21
+ background-color: ${a};
21
22
  }
22
23
 
23
- ${({ $hasErrors: r }) => r && `
24
- border: 1px solid ${u} !important;
25
- color: ${u};
24
+ ${({ $hasErrors: e }) => e && `
25
+ border: 1px solid ${r} !important;
26
+ color: ${r};
26
27
 
27
28
  &::-webkit-calendar-picker-indicator {
28
29
  filter: invert(22%) sepia(63%) saturate(7197%) hue-rotate(353deg) brightness(106%) contrast(87%);
29
30
  }
30
31
  `}
31
- `, _ = i.div`
32
+ `, p = n.div`
32
33
  position: absolute;
33
34
  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
- ] });
35
+ top: calc(50% - ${o * 2.5}px);
36
+ `, m = "00:00", h = "23:59", g = ({ elementId: n, onChange: r, errors: i, value: a, minTime: o = m, maxTime: s = h, label: g, isRequired: _ = !1, isReadonly: v = !1, showErrorLabel: y }) => {
37
+ let b = !!i?.length, x = (e) => {
38
+ let { value: t } = e.target;
39
+ r(t < o ? o : t > s ? s : t);
40
+ }, S = `${n}-input-time`;
41
+ return /* @__PURE__ */ u(c, { children: [g && /* @__PURE__ */ l(t, {
42
+ for: S,
43
+ label: g,
44
+ required: _
45
+ }), /* @__PURE__ */ u(d, { children: [/* @__PURE__ */ l(f, {
46
+ id: S,
47
+ $hasErrors: b,
48
+ required: _,
49
+ disabled: v,
50
+ onChange: (e) => r(e.target.value),
51
+ onBlur: x,
52
+ type: "time",
53
+ value: a
54
+ }), y && /* @__PURE__ */ l(p, { children: /* @__PURE__ */ l(e, {
55
+ elementId: n,
56
+ errors: i?.slice() ?? []
57
+ }) })] })] });
70
58
  };
71
- export {
72
- U as default
73
- };
74
- //# sourceMappingURL=index.js.map
59
+ //#endregion
60
+ export { g as default };
61
+
62
+ //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +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;"}
1
+ {"version":3,"file":"index.js","names":[],"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"],"mappings":";;;;;;;AAQA,IAAa,IAAsB,EAAO,GAAG;;;;GAMhC,IAAkB,EAAO,KAA2B;sBAC3C,EAAO;;;;;IAKzB,EAAY;;;wBAGQ,EAAO;;;KAG1B,EAAC,oBACF,KACA;0BACsB,EAAW;eACtB,EAAW;;;;;MAKpB;GAGO,IAAyB,EAAO,GAAG;;;oBAG5B,IAAU,IAAI;GCnC5B,IAAmB,SACnB,IAAmB,SAEnB,KAAc,EAClB,cACA,aACA,WACA,UACA,aAAU,GACV,aAAU,GACV,UACA,gBAAa,IACb,gBAAa,IACb,wBACqB;CACrB,IAAM,IAAY,EAAQ,GAAQ,QAE5B,KAA0D,MAAU;EACxE,IAAM,EAAC,OAAO,MAAa,EAAM;EAGjC,EAFoB,IAAY,IAAU,IAAU,IAAY,IAAU,IAAU,EAE/D;IAGjB,IAAqB,GAAG,EAAU;CAExC,OACE,kBAAA,GAAA,EAAA,UAAA,CACG,KAAS,kBAAC,GAAD;EAAO,KAAK;EAA2B;EAAO,UAAU;EAAc,CAAA,EAChF,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD;EACE,IAAI;EACJ,YAAY;EACZ,UAAU;EACV,UAAU;EACV,WAAW,MAAM,EAAS,EAAE,OAAO,MAAM;EACzC,QAAQ;EACR,MAAK;EACE;EACP,CAAA,EACD,KACC,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD;EAAuB;EAAW,QAAQ,GAAQ,OAAO,IAAI,EAAE;EAAI,CAAA,EAC5C,CAAA,CAEP,EAAA,CAAA,CACrB,EAAA,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@propellerads/time-picker",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "type": "module",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {
@@ -19,15 +19,15 @@
19
19
  "url": "https://github.com/propellerads/ui-components/issues"
20
20
  },
21
21
  "scripts": {
22
- "build": "tsc && vite build && rollup -c rollup.dts.config.mjs"
22
+ "build": "tsc && vite build && bunx rollup -c rollup.dts.config.mjs"
23
23
  },
24
24
  "homepage": "https://github.com/propellerads/ui-components#readme",
25
25
  "private": false,
26
26
  "dependencies": {
27
- "@propellerads/error-label": "^5.0.2",
27
+ "@propellerads/error-label": "^6.0.0",
28
28
  "@propellerads/label": "^4.0.4",
29
29
  "@propellerads/stylevariables": "^2.0.2",
30
- "@propellerads/theme-annotation": "^2.0.0"
30
+ "@propellerads/theme-annotation": "^2.1.1"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "react": "^18.0.0 || ^19.0.0",
@@ -35,10 +35,10 @@
35
35
  },
36
36
  "devDependencies": {
37
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
+ "@vitejs/plugin-react": "^6.0.1",
39
+ "rollup": "^4.60.3",
40
+ "rollup-plugin-dts": "^6.4.1",
41
+ "typescript": "^6.0.3",
42
+ "vite": "^8.0.10"
43
43
  }
44
44
  }