@momentum-design/components 0.130.8 → 0.131.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.
@@ -0,0 +1,24 @@
1
+ import type { IconNames } from '../icon/icon.types';
2
+ declare const TAG_NAME: "mdc-timepicker";
3
+ declare const ARROW_ICON: {
4
+ readonly ARROW_UP: Extract<IconNames, "arrow-up-bold">;
5
+ readonly ARROW_DOWN: Extract<IconNames, "arrow-down-bold">;
6
+ };
7
+ declare const TIME_FORMAT: {
8
+ readonly TWELVE_HOUR: "12h";
9
+ readonly TWENTY_FOUR_HOUR: "24h";
10
+ };
11
+ declare const TRIGGER_ID = "timepicker-triggerid";
12
+ declare const LISTBOX_ID = "timepicker-listbox";
13
+ declare const DEFAULTS: {
14
+ readonly TIME_FORMAT: "12h";
15
+ readonly INTERVAL: 30;
16
+ readonly MIN_HOUR_12: 1;
17
+ readonly MAX_HOUR_12: 12;
18
+ readonly MIN_HOUR_24: 0;
19
+ readonly MAX_HOUR_24: 23;
20
+ readonly MIN_MINUTE: 0;
21
+ readonly MAX_MINUTE: 59;
22
+ readonly DISABLE_FLIP: false;
23
+ };
24
+ export { ARROW_ICON, DEFAULTS, TAG_NAME, TIME_FORMAT, TRIGGER_ID, LISTBOX_ID };
@@ -0,0 +1,24 @@
1
+ import utils from '../../utils/tag-name';
2
+ const TAG_NAME = utils.constructTagName('timepicker');
3
+ const ARROW_ICON = {
4
+ ARROW_UP: 'arrow-up-bold',
5
+ ARROW_DOWN: 'arrow-down-bold',
6
+ };
7
+ const TIME_FORMAT = {
8
+ TWELVE_HOUR: '12h',
9
+ TWENTY_FOUR_HOUR: '24h',
10
+ };
11
+ const TRIGGER_ID = 'timepicker-triggerid';
12
+ const LISTBOX_ID = 'timepicker-listbox';
13
+ const DEFAULTS = {
14
+ TIME_FORMAT: TIME_FORMAT.TWELVE_HOUR,
15
+ INTERVAL: 30,
16
+ MIN_HOUR_12: 1,
17
+ MAX_HOUR_12: 12,
18
+ MIN_HOUR_24: 0,
19
+ MAX_HOUR_24: 23,
20
+ MIN_MINUTE: 0,
21
+ MAX_MINUTE: 59,
22
+ DISABLE_FLIP: false,
23
+ };
24
+ export { ARROW_ICON, DEFAULTS, TAG_NAME, TIME_FORMAT, TRIGGER_ID, LISTBOX_ID };
@@ -0,0 +1,2 @@
1
+ declare const _default: import("lit").CSSResult[];
2
+ export default _default;
@@ -0,0 +1,179 @@
1
+ import { css } from 'lit';
2
+ import { hostFocusRingStyles } from '../../utils/styles';
3
+ const styles = css `
4
+ :host {
5
+ --mdc-timepicker-background-color: var(--mds-color-theme-background-primary-ghost);
6
+ --mdc-timepicker-text-color: var(--mds-color-theme-text-primary-normal);
7
+ --mdc-timepicker-border-color: var(--mds-color-theme-outline-input-normal);
8
+ --mdc-timepicker-width: fit-content;
9
+ --mdc-timepicker-listbox-width: 100%;
10
+
11
+ display: flex;
12
+ flex-direction: column;
13
+ row-gap: 0.5rem;
14
+ align-items: unset;
15
+ width: var(--mdc-timepicker-width);
16
+ }
17
+
18
+ :host::part(native-input) {
19
+ margin: 0;
20
+ opacity: 0.1%;
21
+ overflow: visible;
22
+ padding: 0;
23
+ position: absolute;
24
+ width: 100%;
25
+ height: 100%;
26
+ top: 0;
27
+ left: 0;
28
+ z-index: -1;
29
+ }
30
+
31
+ :host::part(container) {
32
+ height: 2rem;
33
+ width: 100%;
34
+ position: relative;
35
+ display: flex;
36
+ }
37
+
38
+ :host::part(base-container) {
39
+ border-radius: 0.5rem;
40
+ padding: 0.34375rem 0.375rem 0.34375rem 0.75rem;
41
+ border: 1px solid var(--mdc-timepicker-border-color);
42
+ background: var(--mdc-timepicker-background-color);
43
+ display: flex;
44
+ gap: 0.25rem;
45
+ align-items: center;
46
+ user-select: none;
47
+ width: 100%;
48
+ cursor: default;
49
+ }
50
+
51
+ :host::part(base-container):hover {
52
+ --mdc-timepicker-background-color: var(--mds-color-theme-background-primary-hover);
53
+ }
54
+
55
+ :host::part(base-container):active {
56
+ --mdc-timepicker-background-color: var(--mds-color-theme-background-primary-active);
57
+ }
58
+
59
+ :host::part(spinbutton-group) {
60
+ display: flex;
61
+ align-items: center;
62
+ gap: 0;
63
+ flex: 1;
64
+ min-width: 0;
65
+ }
66
+
67
+ :host::part(spinbutton) {
68
+ background: transparent;
69
+ border: none;
70
+ color: var(--mdc-timepicker-text-color);
71
+ font-family: inherit;
72
+ font-size: 0.875rem;
73
+ line-height: 1.25rem;
74
+ text-align: center;
75
+ outline: none;
76
+ padding: 0;
77
+ margin: 0;
78
+ min-width: 1.25rem;
79
+ width: 1.25rem;
80
+ cursor: text;
81
+ -moz-appearance: textfield;
82
+ }
83
+
84
+ :host::part(spinbutton)::-webkit-inner-spin-button,
85
+ :host::part(spinbutton)::-webkit-outer-spin-button {
86
+ -webkit-appearance: none;
87
+ margin: 0;
88
+ }
89
+
90
+ :host::part(spinbutton):focus {
91
+ background: var(--mds-color-theme-background-accent-normal);
92
+ color: var(--mds-color-theme-common-text-primary-normal);
93
+ border-radius: 0.125rem;
94
+ }
95
+
96
+ :host::part(separator) {
97
+ color: var(--mdc-timepicker-text-color);
98
+ font-size: 0.875rem;
99
+ line-height: 1.25rem;
100
+ user-select: none;
101
+ pointer-events: none;
102
+ padding: 0 0.0625rem;
103
+ }
104
+
105
+ :host::part(period) {
106
+ background: transparent;
107
+ border: none;
108
+ color: var(--mdc-timepicker-text-color);
109
+ font-family: inherit;
110
+ font-size: 0.875rem;
111
+ line-height: 1.25rem;
112
+ text-align: center;
113
+ outline: none;
114
+ padding: 0;
115
+ margin: 0 0 0 0.25rem;
116
+ min-width: 1.5rem;
117
+ width: 1.5rem;
118
+ cursor: text;
119
+ }
120
+
121
+ :host::part(period):focus {
122
+ background: var(--mds-color-theme-background-accent-normal);
123
+ color: var(--mds-color-theme-common-text-primary-normal);
124
+ border-radius: 0.125rem;
125
+ }
126
+
127
+ :host::part(icon-container) {
128
+ flex-shrink: 0;
129
+ border-radius: 100px;
130
+ }
131
+
132
+ /* Popover height, width & padding overrides */
133
+ :host mdc-popover::part(popover-content) {
134
+ max-height: var(--mdc-popover-max-height);
135
+ min-width: var(--mdc-timepicker-listbox-width);
136
+ padding: 0.75rem 0.5rem;
137
+ }
138
+
139
+ /* Listbox container */
140
+ :host::part(listbox) {
141
+ display: flex;
142
+ flex-direction: column;
143
+ max-height: var(--mdc-popover-internal-available-height);
144
+ }
145
+
146
+ /* Help text border colors */
147
+ :host([help-text-type='success'])::part(base-container),
148
+ :host([help-text-type='warning'])::part(base-container),
149
+ :host([help-text-type='error'])::part(base-container) {
150
+ --mdc-timepicker-border-color: var(--mdc-help-text-color);
151
+ }
152
+
153
+ :host([readonly])::part(help-text-container) {
154
+ --mdc-help-text-color: var(--mds-color-theme-text-secondary-normal);
155
+ }
156
+
157
+ /* Disabled, soft-disabled, readonly */
158
+ :host([disabled])::part(base-container),
159
+ :host([soft-disabled])::part(base-container),
160
+ :host([readonly])::part(base-container) {
161
+ --mdc-timepicker-border-color: var(--mds-color-theme-outline-primary-disabled);
162
+ --mdc-timepicker-background-color: var(--mds-color-theme-background-input-disabled);
163
+ }
164
+ :host([disabled])::part(base-container):hover,
165
+ :host([soft-disabled])::part(base-container):hover,
166
+ :host([readonly])::part(base-container):hover {
167
+ --mdc-timepicker-background-color: var(--mds-color-theme-background-input-disabled);
168
+ }
169
+ :host([disabled])::part(spinbutton),
170
+ :host([soft-disabled])::part(spinbutton),
171
+ :host([disabled])::part(period),
172
+ :host([soft-disabled])::part(period),
173
+ :host([disabled])::part(separator),
174
+ :host([soft-disabled])::part(separator) {
175
+ --mdc-timepicker-text-color: var(--mds-color-theme-text-primary-disabled);
176
+ color: var(--mds-color-theme-text-primary-disabled);
177
+ }
178
+ `;
179
+ export default [styles, ...hostFocusRingStyles(true)];
@@ -0,0 +1,21 @@
1
+ import type { ValueOf, TypedCustomEvent } from '../../utils/types';
2
+ import type { PopoverPlacement, PopoverShownEvent, PopoverHiddenEvent } from '../popover/popover.types';
3
+ import type TimePicker from './timepicker.component';
4
+ import { TIME_FORMAT } from './timepicker.constants';
5
+ type TimeFormat = ValueOf<typeof TIME_FORMAT>;
6
+ type TimePickerChangeEvent = TypedCustomEvent<TimePicker, {
7
+ value: string;
8
+ }>;
9
+ type TimePickerInputEvent = TypedCustomEvent<TimePicker, {
10
+ value: string;
11
+ }>;
12
+ interface Events {
13
+ onChangeEvent: TimePickerChangeEvent;
14
+ onInputEvent: TimePickerInputEvent;
15
+ onFocusEvent: FocusEvent;
16
+ onBlurEvent: FocusEvent;
17
+ onShownEvent: PopoverShownEvent;
18
+ onHiddenEvent: PopoverHiddenEvent;
19
+ }
20
+ type Placement = Extract<PopoverPlacement, 'bottom-start' | 'top-start'>;
21
+ export type { Events, Placement, TimeFormat, TimePickerChangeEvent, TimePickerInputEvent };
@@ -0,0 +1 @@
1
+ export {};