@semcore/time-picker 4.53.0-prerelease.0 → 4.53.0-prerelease.4

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.
Files changed (78) hide show
  1. package/lib/cjs/PickerFormat.js +85 -0
  2. package/lib/cjs/PickerFormat.js.map +1 -0
  3. package/lib/cjs/{component/PickerInput/PickerInput.js → PickerInput.js} +108 -89
  4. package/lib/cjs/PickerInput.js.map +1 -0
  5. package/lib/cjs/TimePicker.js +360 -0
  6. package/lib/cjs/TimePicker.js.map +1 -0
  7. package/lib/cjs/index.d.js +2 -0
  8. package/lib/cjs/index.d.js.map +1 -0
  9. package/lib/cjs/index.js +5 -6
  10. package/lib/cjs/index.js.map +1 -1
  11. package/lib/cjs/{component/PickerFormat/picker-format.shadow.css → style/time-picker.shadow.css} +62 -2
  12. package/lib/cjs/translations/__intergalactic-dynamic-locales.js +5 -4
  13. package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
  14. package/lib/es6/PickerFormat.js +79 -0
  15. package/lib/es6/PickerFormat.js.map +1 -0
  16. package/lib/es6/{component/PickerInput/PickerInput.js → PickerInput.js} +106 -90
  17. package/lib/es6/PickerInput.js.map +1 -0
  18. package/lib/es6/TimePicker.js +348 -0
  19. package/lib/es6/TimePicker.js.map +1 -0
  20. package/lib/es6/index.d.js +2 -0
  21. package/lib/es6/index.d.js.map +1 -0
  22. package/lib/es6/index.js +2 -2
  23. package/lib/es6/index.js.map +1 -1
  24. package/lib/{esm/component/PickerFormat/picker-format.shadow.css → es6/style/time-picker.shadow.css} +62 -2
  25. package/lib/es6/translations/__intergalactic-dynamic-locales.js +2 -2
  26. package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
  27. package/lib/esm/PickerFormat.mjs +70 -0
  28. package/lib/esm/{component/PickerInput/PickerInput.mjs → PickerInput.mjs} +100 -92
  29. package/lib/esm/TimePicker.mjs +305 -0
  30. package/lib/esm/index.mjs +7 -3
  31. package/lib/{es6/component/PickerFormat/picker-format.shadow.css → esm/style/time-picker.shadow.css} +62 -2
  32. package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +2 -2
  33. package/lib/types/index.d.ts +63 -2
  34. package/package.json +7 -7
  35. package/lib/cjs/component/PickerFormat/PickerFormat.js +0 -93
  36. package/lib/cjs/component/PickerFormat/PickerFormat.js.map +0 -1
  37. package/lib/cjs/component/PickerFormat/PickerFormat.type.js +0 -2
  38. package/lib/cjs/component/PickerFormat/PickerFormat.type.js.map +0 -1
  39. package/lib/cjs/component/PickerInput/PickerInput.js.map +0 -1
  40. package/lib/cjs/component/PickerInput/PickerInput.type.js +0 -2
  41. package/lib/cjs/component/PickerInput/PickerInput.type.js.map +0 -1
  42. package/lib/cjs/component/PickerInput/picker-input.shadow.css +0 -11
  43. package/lib/cjs/component/TimePicker/TimePicker.js +0 -254
  44. package/lib/cjs/component/TimePicker/TimePicker.js.map +0 -1
  45. package/lib/cjs/component/TimePicker/TimePicker.type.js +0 -2
  46. package/lib/cjs/component/TimePicker/TimePicker.type.js.map +0 -1
  47. package/lib/cjs/component/TimePicker/time-picker.shadow.css +0 -34
  48. package/lib/cjs/entity/TimePickerEntity.js +0 -101
  49. package/lib/cjs/entity/TimePickerEntity.js.map +0 -1
  50. package/lib/es6/component/PickerFormat/PickerFormat.js +0 -88
  51. package/lib/es6/component/PickerFormat/PickerFormat.js.map +0 -1
  52. package/lib/es6/component/PickerFormat/PickerFormat.type.js +0 -2
  53. package/lib/es6/component/PickerFormat/PickerFormat.type.js.map +0 -1
  54. package/lib/es6/component/PickerInput/PickerInput.js.map +0 -1
  55. package/lib/es6/component/PickerInput/PickerInput.type.js +0 -2
  56. package/lib/es6/component/PickerInput/PickerInput.type.js.map +0 -1
  57. package/lib/es6/component/PickerInput/picker-input.shadow.css +0 -11
  58. package/lib/es6/component/TimePicker/TimePicker.js +0 -250
  59. package/lib/es6/component/TimePicker/TimePicker.js.map +0 -1
  60. package/lib/es6/component/TimePicker/TimePicker.type.js +0 -2
  61. package/lib/es6/component/TimePicker/TimePicker.type.js.map +0 -1
  62. package/lib/es6/component/TimePicker/time-picker.shadow.css +0 -34
  63. package/lib/es6/entity/TimePickerEntity.js +0 -94
  64. package/lib/es6/entity/TimePickerEntity.js.map +0 -1
  65. package/lib/esm/component/PickerFormat/PickerFormat.mjs +0 -86
  66. package/lib/esm/component/PickerInput/picker-input.shadow.css +0 -11
  67. package/lib/esm/component/TimePicker/TimePicker.mjs +0 -233
  68. package/lib/esm/component/TimePicker/TimePicker.type.mjs +0 -1
  69. package/lib/esm/component/TimePicker/time-picker.shadow.css +0 -34
  70. package/lib/esm/entity/TimePickerEntity.mjs +0 -90
  71. package/lib/types/component/PickerFormat/PickerFormat.d.ts +0 -17
  72. package/lib/types/component/PickerFormat/PickerFormat.type.d.ts +0 -16
  73. package/lib/types/component/PickerInput/PickerInput.d.ts +0 -54
  74. package/lib/types/component/PickerInput/PickerInput.type.d.ts +0 -13
  75. package/lib/types/component/TimePicker/TimePicker.d.ts +0 -3
  76. package/lib/types/component/TimePicker/TimePicker.type.d.ts +0 -50
  77. package/lib/types/entity/TimePickerEntity.d.ts +0 -22
  78. package/lib/types/translations/__intergalactic-dynamic-locales.d.ts +0 -114
@@ -1,90 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/esm/createClass";
4
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
5
- var TimePickerEntity = /* @__PURE__ */ (function() {
6
- function TimePickerEntity2() {
7
- var value = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ":";
8
- var is12Hour = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
9
- _classCallCheck(this, TimePickerEntity2);
10
- _defineProperty(this, "_hours", "");
11
- _defineProperty(this, "_minutes", "");
12
- _defineProperty(this, "_is12Hour", void 0);
13
- _defineProperty(this, "_meridiem", "AM");
14
- var _value$split = value.split(":"), _value$split2 = _slicedToArray(_value$split, 2), _value$split2$ = _value$split2[0], hours = _value$split2$ === void 0 ? "" : _value$split2$, _value$split2$2 = _value$split2[1], minutes = _value$split2$2 === void 0 ? "" : _value$split2$2;
15
- this._is12Hour = is12Hour;
16
- this._hours = hours;
17
- this._minutes = minutes;
18
- }
19
- return _createClass(TimePickerEntity2, [{
20
- key: "meridiem",
21
- get: function get() {
22
- return this._meridiem;
23
- },
24
- set: function set(newMeridiem) {
25
- this._meridiem = newMeridiem;
26
- }
27
- }, {
28
- key: "hours",
29
- get: function get() {
30
- return this._is12Hour ? this.formatHoursTo12(this._hours) : this.formatHoursTo24(this._hours);
31
- },
32
- set: function set(newHours) {
33
- this._hours = newHours;
34
- }
35
- }, {
36
- key: "minutes",
37
- get: function get() {
38
- return this._minutes && this.withLeadingZero(this._minutes);
39
- },
40
- set: function set(newMinutes) {
41
- this._minutes = newMinutes;
42
- }
43
- }, {
44
- key: "is12Hour",
45
- set: function set(newIs12Hour) {
46
- this._is12Hour = newIs12Hour;
47
- }
48
- }, {
49
- key: "withLeadingZero",
50
- value: function withLeadingZero(value) {
51
- return String(value).padStart(2, "0");
52
- }
53
- }, {
54
- key: "formatHoursTo12",
55
- value: function formatHoursTo12(hours) {
56
- var numberHours = Number.parseInt(hours, 10);
57
- if (Number.isNaN(numberHours)) return hours;
58
- if (numberHours === 0) {
59
- return "12";
60
- } else if (numberHours > 12) {
61
- return this.withLeadingZero(numberHours - 12);
62
- }
63
- return this.withLeadingZero(numberHours);
64
- }
65
- }, {
66
- key: "formatHoursTo24",
67
- value: function formatHoursTo24(hours) {
68
- var numberHours = Number.parseInt(hours, 10);
69
- if (Number.isNaN(numberHours)) return hours;
70
- if (this.meridiem === "AM") {
71
- return this.withLeadingZero(numberHours === 12 ? 0 : numberHours);
72
- }
73
- return this.withLeadingZero(numberHours < 12 ? numberHours + 12 : numberHours);
74
- }
75
- }, {
76
- key: "toggleMeridiem",
77
- value: function toggleMeridiem() {
78
- this.meridiem = this._meridiem === "AM" ? "PM" : "AM";
79
- }
80
- }, {
81
- key: "toString",
82
- value: function toString() {
83
- var hours = this._is12Hour ? this.formatHoursTo24(this.hours) : this.hours;
84
- return "".concat(hours, ":").concat(this.minutes);
85
- }
86
- }]);
87
- })();
88
- export {
89
- TimePickerEntity as default
90
- };
@@ -1,17 +0,0 @@
1
- import { Component } from '@semcore/core';
2
- import React from 'react';
3
- import type { TimePickerFormatProps, TimePickerFormatPropsInternal } from './PickerFormat.type';
4
- declare class TimePickerFormat extends Component<TimePickerFormatProps, typeof TimePickerFormat.enhance, {}, TimePickerFormatPropsInternal> {
5
- static style: {
6
- [key: string]: string;
7
- };
8
- static enhance: readonly [(props: any) => {
9
- uid: ReturnType<typeof import("@semcore/core/lib/utils/uniqueID").useUID>;
10
- }];
11
- state: {
12
- changedFormatNotice: string;
13
- };
14
- handleClick: () => void;
15
- render(): React.ReactNode;
16
- }
17
- export default TimePickerFormat;
@@ -1,16 +0,0 @@
1
- import type { BoxProps } from '@semcore/base-components';
2
- import type { useI18n } from '@semcore/core/lib/utils/enhances/WithI18n';
3
- import type { TimePickerMeridiem } from '../TimePicker/TimePicker.type';
4
- export type TimePickerFormatProps = BoxProps & {};
5
- export type TimePickerFormatPropsInternal = {
6
- /** @Internal */
7
- getI18nText: ReturnType<typeof useI18n>;
8
- /** @Internal */
9
- size: 'm' | 'l';
10
- /** @Internal */
11
- disabled: boolean;
12
- /** @Internal */
13
- meridiem: TimePickerMeridiem;
14
- /** @Internal */
15
- onClick: (event: React.SyntheticEvent) => void;
16
- };
@@ -1,54 +0,0 @@
1
- import { Component } from '@semcore/core';
2
- import React from 'react';
3
- import type { PickerInputMinMax, PickerInputProps } from './PickerInput.type';
4
- import type { TimePickerField } from '../TimePicker/TimePicker.type';
5
- type State = {
6
- dirtyValue?: string;
7
- visible: boolean;
8
- };
9
- declare abstract class AbstractPickerInput extends Component<PickerInputProps, [], {}, {}, State> {
10
- static style: {
11
- [key: string]: string;
12
- };
13
- static defaultProps: (_: PickerInputProps) => {
14
- placeholder: string;
15
- offset: number[];
16
- };
17
- state: State;
18
- inputRef: React.RefObject<unknown>;
19
- abstract get field(): TimePickerField;
20
- abstract get minMax(): PickerInputMinMax;
21
- abstract handleKeyDown(event: React.KeyboardEvent<HTMLInputElement>): void;
22
- parseValueWithMinMax: (value: string) => string;
23
- dispatchOnChange(value: string, event: React.SyntheticEvent): void;
24
- submitChanges(event: React.SyntheticEvent): void;
25
- handleChange: (value: string, event: React.SyntheticEvent) => void;
26
- handleBlur: (event: React.SyntheticEvent) => void;
27
- handleSelect: (value: string, event: React.SyntheticEvent) => void;
28
- handleVisibleChange: (visible: boolean) => void;
29
- render(): React.ReactNode;
30
- }
31
- declare class Hours extends AbstractPickerInput {
32
- static defaultProps: (props: PickerInputProps) => {
33
- ml: number | undefined;
34
- placeholder: string;
35
- offset: number[];
36
- };
37
- get field(): TimePickerField;
38
- get minMax(): PickerInputMinMax;
39
- focusNext(): void;
40
- handleKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => void;
41
- componentDidUpdate(_: PickerInputProps, prevState: State): void;
42
- }
43
- declare class Minutes extends AbstractPickerInput {
44
- static defaultProps: (props: PickerInputProps) => {
45
- mr: number | undefined;
46
- placeholder: string;
47
- offset: number[];
48
- };
49
- get field(): TimePickerField;
50
- get minMax(): PickerInputMinMax;
51
- focusPrev(): void;
52
- handleKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => void;
53
- }
54
- export { Hours, Minutes };
@@ -1,13 +0,0 @@
1
- import type { SelectProps } from '@semcore/select';
2
- import type { TimePickerField, TimePickerItemProps } from '../TimePicker/TimePicker.type';
3
- export type PickerInputProps = SelectProps & TimePickerItemProps & {
4
- time: string;
5
- size?: 'm' | 'l';
6
- is12Hour?: boolean;
7
- disabled?: boolean;
8
- $onValueChange: (value: string, field: TimePickerField, event: React.SyntheticEvent) => void;
9
- minutesInputRef: React.RefObject<HTMLElement>;
10
- hoursInputRef: React.RefObject<HTMLElement>;
11
- ariaLabel: string;
12
- };
13
- export type PickerInputMinMax = [number, number];
@@ -1,3 +0,0 @@
1
- import type { TimePickerComponent } from './TimePicker.type';
2
- declare const TimePicker: TimePickerComponent;
3
- export default TimePicker;
@@ -1,50 +0,0 @@
1
- import type { Box } from '@semcore/base-components';
2
- import type { PropGetterFn, Intergalactic } from '@semcore/core';
3
- import type { InputProps, InputValueProps } from '@semcore/input';
4
- import type { TimePickerFormatProps } from '../PickerFormat/PickerFormat.type';
5
- export type TimePickerProps = Omit<InputProps, 'size'> & {
6
- /** Time in the hh:mm format */
7
- value?: string;
8
- /** Default value if `value` property is not provided */
9
- defaultValue?: string;
10
- /** The event responses upon time changing */
11
- onChange?: (time: string, event?: React.SyntheticEvent) => void;
12
- /** In charge of the component blocking */
13
- disabled?: boolean;
14
- /** Control size
15
- * @default m */
16
- size?: 'm' | 'l';
17
- /** 12-hour time format */
18
- is12Hour?: boolean;
19
- /** Specifies the locale for i18n support */
20
- locale?: string;
21
- };
22
- export type TimePickerSeparatorProps = {
23
- /** @Internal */
24
- hoursInputRef: React.RefObject<HTMLElement>;
25
- /** @Internal */
26
- disabled?: boolean;
27
- };
28
- export type TimePickerItemProps = InputValueProps & {
29
- /** Step for changing of the values in the dropdown list */
30
- step?: number;
31
- };
32
- export type TimePickerContext = {
33
- getHoursProps: PropGetterFn;
34
- getFormatProps: PropGetterFn;
35
- getMinutesProps: PropGetterFn;
36
- getSeparatorProps: PropGetterFn;
37
- };
38
- export type TimePickerHandlers = {
39
- value: (value: string) => void;
40
- };
41
- export type TimePickerMeridiem = 'AM' | 'PM';
42
- export type TimePickerField = 'hours' | 'minutes';
43
- export type TimePickerComponent = Intergalactic.Component<'div', TimePickerProps, TimePickerContext, [
44
- handlers: TimePickerHandlers
45
- ]> & {
46
- Hours: Intergalactic.Component<'div', TimePickerItemProps>;
47
- Minutes: Intergalactic.Component<'div', TimePickerItemProps>;
48
- Separator: typeof Box;
49
- Format: Intergalactic.Component<'div', TimePickerFormatProps>;
50
- };
@@ -1,22 +0,0 @@
1
- import type { TimePickerMeridiem } from '../component/TimePicker/TimePicker.type';
2
- declare class TimePickerEntity {
3
- private _hours;
4
- private _minutes;
5
- private _is12Hour;
6
- private _meridiem;
7
- constructor(value?: string, // should be in the format 'HH:mm'
8
- is12Hour?: boolean);
9
- get meridiem(): TimePickerMeridiem;
10
- get hours(): string;
11
- get minutes(): string;
12
- set is12Hour(newIs12Hour: boolean);
13
- set hours(newHours: string);
14
- set minutes(newMinutes: string);
15
- private set meridiem(value);
16
- private withLeadingZero;
17
- private formatHoursTo12;
18
- private formatHoursTo24;
19
- toggleMeridiem(): void;
20
- toString(): string;
21
- }
22
- export default TimePickerEntity;
@@ -1,114 +0,0 @@
1
- export declare const localizedMessages: {
2
- de: {
3
- title: string;
4
- titleEmpty: string;
5
- hours: string;
6
- minutes: string;
7
- formatToggler: string;
8
- changedFormatNotice: string;
9
- };
10
- en: {
11
- title: string;
12
- titleEmpty: string;
13
- hours: string;
14
- minutes: string;
15
- formatToggler: string;
16
- changedFormatNotice: string;
17
- };
18
- es: {
19
- title: string;
20
- titleEmpty: string;
21
- hours: string;
22
- minutes: string;
23
- formatToggler: string;
24
- changedFormatNotice: string;
25
- };
26
- fr: {
27
- title: string;
28
- titleEmpty: string;
29
- hours: string;
30
- minutes: string;
31
- formatToggler: string;
32
- changedFormatNotice: string;
33
- };
34
- it: {
35
- title: string;
36
- titleEmpty: string;
37
- hours: string;
38
- minutes: string;
39
- formatToggler: string;
40
- changedFormatNotice: string;
41
- };
42
- ja: {
43
- title: string;
44
- titleEmpty: string;
45
- hours: string;
46
- minutes: string;
47
- formatToggler: string;
48
- changedFormatNotice: string;
49
- };
50
- ko: {
51
- title: string;
52
- titleEmpty: string;
53
- hours: string;
54
- minutes: string;
55
- formatToggler: string;
56
- changedFormatNotice: string;
57
- };
58
- nl: {
59
- title: string;
60
- titleEmpty: string;
61
- hours: string;
62
- minutes: string;
63
- formatToggler: string;
64
- changedFormatNotice: string;
65
- };
66
- pt: {
67
- title: string;
68
- titleEmpty: string;
69
- hours: string;
70
- minutes: string;
71
- formatToggler: string;
72
- changedFormatNotice: string;
73
- };
74
- tr: {
75
- title: string;
76
- titleEmpty: string;
77
- hours: string;
78
- minutes: string;
79
- formatToggler: string;
80
- changedFormatNotice: string;
81
- };
82
- vi: {
83
- title: string;
84
- titleEmpty: string;
85
- hours: string;
86
- minutes: string;
87
- formatToggler: string;
88
- changedFormatNotice: string;
89
- };
90
- zh: {
91
- title: string;
92
- titleEmpty: string;
93
- hours: string;
94
- minutes: string;
95
- formatToggler: string;
96
- changedFormatNotice: string;
97
- };
98
- pl: {
99
- title: string;
100
- titleEmpty: string;
101
- hours: string;
102
- minutes: string;
103
- formatToggler: string;
104
- changedFormatNotice: string;
105
- };
106
- sv: {
107
- title: string;
108
- titleEmpty: string;
109
- hours: string;
110
- minutes: string;
111
- formatToggler: string;
112
- changedFormatNotice: string;
113
- };
114
- };