@uxf/ui 1.0.0-beta.77 → 1.0.0-beta.79
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/config/icons-config.d.ts +1 -1
- package/config/icons-config.js +1 -1
- package/config/icons.d.ts +20 -0
- package/config/icons.js +4 -0
- package/css/chip.css +1 -1
- package/css/layout.css +47 -0
- package/css/pagination.css +27 -0
- package/css/tabs.css +26 -6
- package/css/time-picker-input.css +133 -0
- package/css/time-picker.css +27 -0
- package/input/input-element.d.ts +1 -1
- package/layout/index.d.ts +1 -0
- package/layout/index.js +17 -0
- package/layout/layout.d.ts +9 -0
- package/layout/layout.js +60 -0
- package/layout/layout.stories.d.ts +8 -0
- package/layout/layout.stories.js +21 -0
- package/layout/uxf-logo.d.ts +6 -0
- package/layout/uxf-logo.js +13 -0
- package/package.json +1 -1
- package/pagination/pagination.d.ts +7 -0
- package/pagination/pagination.js +49 -0
- package/pagination/pagination.stories.d.ts +7 -0
- package/pagination/pagination.stories.js +47 -0
- package/tabs/tabs.d.ts +1 -0
- package/tabs/tabs.js +7 -4
- package/tabs/tabs.stories.js +2 -2
- package/text-input/text-input.d.ts +1 -1
- package/text-input/text-input.stories.js +3 -1
- package/time-picker-input/index.d.ts +2 -0
- package/time-picker-input/index.js +18 -0
- package/time-picker-input/time-picker-hour.d.ts +5 -0
- package/time-picker-input/time-picker-hour.js +47 -0
- package/time-picker-input/time-picker-hours.d.ts +2 -0
- package/time-picker-input/time-picker-hours.js +14 -0
- package/time-picker-input/time-picker-input.d.ts +22 -0
- package/time-picker-input/time-picker-input.js +64 -0
- package/time-picker-input/time-picker-input.stories.d.ts +7 -0
- package/time-picker-input/time-picker-input.stories.js +45 -0
- package/time-picker-input/time-picker-minute.d.ts +5 -0
- package/time-picker-input/time-picker-minute.js +47 -0
- package/time-picker-input/time-picker-minutes.d.ts +2 -0
- package/time-picker-input/time-picker-minutes.js +14 -0
- package/time-picker-input/time-picker.d.ts +8 -0
- package/time-picker-input/time-picker.js +69 -0
- package/utils/icons-config.js +20 -0
- package/utils/tailwind-config.js +4 -2
package/config/icons-config.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const ICONS_VERSION = "
|
|
1
|
+
export declare const ICONS_VERSION = "1668632602549";
|
|
2
2
|
export declare const ICON_SPRITE = "/.storybook/static-assets/icons-generated/_icon-sprite.svg";
|
package/config/icons-config.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ICON_SPRITE = exports.ICONS_VERSION = void 0;
|
|
4
|
-
exports.ICONS_VERSION = "
|
|
4
|
+
exports.ICONS_VERSION = "1668632602549";
|
|
5
5
|
exports.ICON_SPRITE = "/.storybook/static-assets/icons-generated/_icon-sprite.svg";
|
package/config/icons.d.ts
CHANGED
|
@@ -11,6 +11,14 @@ export declare const ICONS: {
|
|
|
11
11
|
readonly w: 320;
|
|
12
12
|
readonly h: 512;
|
|
13
13
|
};
|
|
14
|
+
readonly clock: {
|
|
15
|
+
readonly w: 512;
|
|
16
|
+
readonly h: 512;
|
|
17
|
+
};
|
|
18
|
+
readonly bars: {
|
|
19
|
+
readonly w: 448;
|
|
20
|
+
readonly h: 512;
|
|
21
|
+
};
|
|
14
22
|
readonly check: {
|
|
15
23
|
readonly w: 512;
|
|
16
24
|
readonly h: 512;
|
|
@@ -23,10 +31,18 @@ export declare const ICONS: {
|
|
|
23
31
|
readonly w: 384;
|
|
24
32
|
readonly h: 512;
|
|
25
33
|
};
|
|
34
|
+
readonly chevronsLeft: {
|
|
35
|
+
readonly w: 512;
|
|
36
|
+
readonly h: 512;
|
|
37
|
+
};
|
|
26
38
|
readonly chevronRight: {
|
|
27
39
|
readonly w: 384;
|
|
28
40
|
readonly h: 512;
|
|
29
41
|
};
|
|
42
|
+
readonly chevronsRight: {
|
|
43
|
+
readonly w: 512;
|
|
44
|
+
readonly h: 512;
|
|
45
|
+
};
|
|
30
46
|
readonly chevronUp: {
|
|
31
47
|
readonly w: 512;
|
|
32
48
|
readonly h: 512;
|
|
@@ -46,10 +62,14 @@ declare module "@uxf/ui/icon/theme" {
|
|
|
46
62
|
calendar: true;
|
|
47
63
|
camera: true;
|
|
48
64
|
caretDown: true;
|
|
65
|
+
clock: true;
|
|
66
|
+
bars: true;
|
|
49
67
|
check: true;
|
|
50
68
|
chevronDown: true;
|
|
51
69
|
chevronLeft: true;
|
|
70
|
+
chevronsLeft: true;
|
|
52
71
|
chevronRight: true;
|
|
72
|
+
chevronsRight: true;
|
|
53
73
|
chevronUp: true;
|
|
54
74
|
user: true;
|
|
55
75
|
xmarkLarge: true;
|
package/config/icons.js
CHANGED
|
@@ -6,10 +6,14 @@ exports.ICONS = {
|
|
|
6
6
|
calendar: { w: 448, h: 512 },
|
|
7
7
|
camera: { w: 512, h: 512 },
|
|
8
8
|
caretDown: { w: 320, h: 512 },
|
|
9
|
+
clock: { w: 512, h: 512 },
|
|
10
|
+
bars: { w: 448, h: 512 },
|
|
9
11
|
check: { w: 512, h: 512 },
|
|
10
12
|
chevronDown: { w: 512, h: 512 },
|
|
11
13
|
chevronLeft: { w: 384, h: 512 },
|
|
14
|
+
chevronsLeft: { w: 512, h: 512 },
|
|
12
15
|
chevronRight: { w: 384, h: 512 },
|
|
16
|
+
chevronsRight: { w: 512, h: 512 },
|
|
13
17
|
chevronUp: { w: 512, h: 512 },
|
|
14
18
|
user: { w: 448, h: 512 },
|
|
15
19
|
xmarkLarge: { w: 448, h: 512 },
|
package/css/chip.css
CHANGED
package/css/layout.css
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
body {
|
|
2
|
+
@apply bg-neutral-100;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.uxf-layout {
|
|
6
|
+
&__content {
|
|
7
|
+
@apply flex flex-1 flex-col md:pl-64 pt-14;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.uxf-app-bar {
|
|
12
|
+
@apply fixed w-full top-0 left-0 flex items-center bg-primary-600 h-14;
|
|
13
|
+
|
|
14
|
+
&__left-container {
|
|
15
|
+
@apply flex items-center grow;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&__menu-button {
|
|
19
|
+
@apply px-5 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-indigo-500 md:hidden;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&__logo {
|
|
23
|
+
@apply md:px-2;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.uxf-sidebar {
|
|
28
|
+
@apply hidden md:fixed md:inset-y-0 md:flex md:w-64 md:flex-col bg-white;
|
|
29
|
+
|
|
30
|
+
&__content {
|
|
31
|
+
@apply flex flex-grow flex-col overflow-y-auto border-r border-r-gray-200 pt-14;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&__logo {
|
|
35
|
+
@apply flex justify-center;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.uxf-drawer {
|
|
40
|
+
&__content {
|
|
41
|
+
@apply flex flex-grow flex-col overflow-y-auto border-r border-r-gray-200;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&__logo {
|
|
45
|
+
@apply flex justify-center;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
.uxf-pagination {
|
|
2
|
+
@apply isolate inline-flex rounded-md -space-x-px;
|
|
3
|
+
|
|
4
|
+
&__button {
|
|
5
|
+
@apply relative inline-flex items-center border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-500 hover:bg-gray-50 focus:z-10 cursor-pointer h-10;
|
|
6
|
+
|
|
7
|
+
&.is-selected {
|
|
8
|
+
@apply z-10 bg-indigo-50 border border-primary-500 text-primary-600;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&.is-first {
|
|
12
|
+
@apply rounded-l-md;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&.is-last {
|
|
16
|
+
@apply rounded-r-md;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&.is-disabled {
|
|
20
|
+
@apply text-neutral-300 hover:bg-white cursor-not-allowed;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&.is-ellipsis {
|
|
24
|
+
@apply text-neutral-300 hover:bg-white pointer-events-none
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
package/css/tabs.css
CHANGED
|
@@ -68,11 +68,11 @@
|
|
|
68
68
|
before:opacity-0 before:transition;
|
|
69
69
|
|
|
70
70
|
:root .light & {
|
|
71
|
-
@apply text-
|
|
71
|
+
@apply text-lightMedium hover:bg-gray-100 focus-visible:ring-primary-500;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
:root .dark & {
|
|
75
|
-
@apply text-
|
|
75
|
+
@apply text-darkMedium hover:bg-gray-800 focus-visible:ring-primary-500
|
|
76
76
|
focus-visible:ring-offset-gray-900;
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -80,11 +80,21 @@
|
|
|
80
80
|
@apply before:opacity-100 ;
|
|
81
81
|
|
|
82
82
|
:root .light & {
|
|
83
|
-
@apply text-
|
|
83
|
+
@apply text-lightHigh before:border-b-primary-500 hover:bg-transparent;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
:root .dark & {
|
|
87
|
-
@apply text-
|
|
87
|
+
@apply text-darkHigh before:border-b-primary-500 hover:bg-transparent;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&.is-disabled {
|
|
92
|
+
:root .light & {
|
|
93
|
+
@apply text-lightLow;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
:root .dark & {
|
|
97
|
+
@apply text-darkLow;
|
|
88
98
|
}
|
|
89
99
|
}
|
|
90
100
|
}
|
|
@@ -93,12 +103,12 @@
|
|
|
93
103
|
@apply rounded;
|
|
94
104
|
|
|
95
105
|
:root .light & {
|
|
96
|
-
@apply text-
|
|
106
|
+
@apply text-lightMedium bg-gray-100 hover:text-primary-600 hover:bg-primary-100
|
|
97
107
|
focus-visible:ring-primary-500 focus-visible:ring-offset-gray-100;
|
|
98
108
|
}
|
|
99
109
|
|
|
100
110
|
:root .dark & {
|
|
101
|
-
@apply text-
|
|
111
|
+
@apply text-darkMedium bg-gray-700 hover:bg-gray-800 focus-visible:ring-primary-500
|
|
102
112
|
focus-visible:ring-offset-gray-700;
|
|
103
113
|
}
|
|
104
114
|
|
|
@@ -111,6 +121,16 @@
|
|
|
111
121
|
@apply text-white bg-primary-500;
|
|
112
122
|
}
|
|
113
123
|
}
|
|
124
|
+
|
|
125
|
+
&.is-disabled {
|
|
126
|
+
:root .light & {
|
|
127
|
+
@apply text-gray-400;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
:root .dark & {
|
|
131
|
+
@apply text-gray-500;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
114
134
|
}
|
|
115
135
|
}
|
|
116
136
|
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
.uxf-time-picker-input {
|
|
2
|
+
@apply w-full rounded-lg text-base;
|
|
3
|
+
|
|
4
|
+
&__element {
|
|
5
|
+
@apply w-full bg-transparent outline-none;
|
|
6
|
+
|
|
7
|
+
:root .light & {
|
|
8
|
+
@apply text-gray-900 placeholder:text-gray-400;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
:root .dark & {
|
|
12
|
+
@apply text-gray-300 placeholder:text-gray-400;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&__left-element {
|
|
17
|
+
@apply mr-2;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&__right-element {
|
|
21
|
+
@apply ml-2;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&__wrapper {
|
|
25
|
+
@apply flex items-center w-full h-12 rounded-lg border px-4;
|
|
26
|
+
|
|
27
|
+
:root .light & {
|
|
28
|
+
@apply bg-gray-100 text-gray-900 border-gray-200;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
:root .dark & {
|
|
32
|
+
@apply bg-gray-800 text-gray-300 border-gray-700;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&__popover {
|
|
37
|
+
@apply absolute left-0 z-dropdown mt-3 max-w-md rounded-lg border p-2 shadow-xl;
|
|
38
|
+
|
|
39
|
+
:root .light & {
|
|
40
|
+
@apply bg-white border-gray-500;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
:root .dark & {
|
|
44
|
+
@apply bg-gray-900 border-2 border-gray-700;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&--has-right-addon {
|
|
49
|
+
.uxf-time-picker-input__wrapper {
|
|
50
|
+
@apply rounded-r-none;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&.is-focused {
|
|
55
|
+
.uxf-time-picker-input__wrapper {
|
|
56
|
+
@apply ring-1 ring-inset ring-offset-0;
|
|
57
|
+
|
|
58
|
+
:root .light & {
|
|
59
|
+
@apply border-primary-500 ring-primary-500;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
:root .dark & {
|
|
63
|
+
@apply border-primary-500 ring-primary-500;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&.is-disabled {
|
|
69
|
+
@apply cursor-not-allowed;
|
|
70
|
+
|
|
71
|
+
.uxf-time-picker-input__wrapper {
|
|
72
|
+
:root .light & {
|
|
73
|
+
@apply text-gray-500 bg-gray-300;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
:root .dark & {
|
|
77
|
+
@apply text-gray-500 bg-gray-600;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.uxf-time-picker-input__element {
|
|
82
|
+
@apply cursor-not-allowed;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&.is-readonly {
|
|
87
|
+
@apply cursor-text;
|
|
88
|
+
|
|
89
|
+
.uxf-time-picker-input__element {
|
|
90
|
+
@apply cursor-text;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.uxf-time-picker-input__wrapper {
|
|
94
|
+
@apply ring-0;
|
|
95
|
+
|
|
96
|
+
:root .light & {
|
|
97
|
+
@apply bg-gray-200 text-gray-700 border-gray-300;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
:root .dark & {
|
|
101
|
+
@apply bg-gray-800 text-gray-300 border-gray-500;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
&.is-invalid {
|
|
107
|
+
&.is-focused {
|
|
108
|
+
.uxf-time-picker-input__wrapper {
|
|
109
|
+
:root .light & {
|
|
110
|
+
@apply ring-error-500 border-error-500;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
:root .dark & {
|
|
114
|
+
@apply ring-error-500 border-error-500;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.uxf-time-picker-input__wrapper {
|
|
120
|
+
@apply text-error-500 border-error-500 placeholder:text-error-300;
|
|
121
|
+
|
|
122
|
+
.uxf-time-picker-input__element {
|
|
123
|
+
:root .light & {
|
|
124
|
+
@apply border-gray-300 text-error-500;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
:root .dark & {
|
|
128
|
+
@apply border-gray-500 text-error-500;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
.uxf-time-picker {
|
|
2
|
+
&__global {
|
|
3
|
+
@apply flex items-center justify-between px-4 w-[180px];
|
|
4
|
+
|
|
5
|
+
&__column {
|
|
6
|
+
@apply flex flex-col items-center shrink-0;
|
|
7
|
+
|
|
8
|
+
& > :nth-child(1),
|
|
9
|
+
& > :nth-child(3) {
|
|
10
|
+
@apply h-6;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&__hours,
|
|
16
|
+
&__minutes {
|
|
17
|
+
@apply grid grid-cols-4 place-items-center gap-1;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
:root .light & {
|
|
21
|
+
@apply text-gray-900;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
:root .dark & {
|
|
25
|
+
@apply bg-gray-900 text-white;
|
|
26
|
+
}
|
|
27
|
+
}
|
package/input/input-element.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface InputElementProps extends FormControlProps<string> {
|
|
|
9
9
|
inputMode?: InputMode;
|
|
10
10
|
onKeyDown?: KeyboardEventHandler<HTMLInputElement>;
|
|
11
11
|
placeholder?: string;
|
|
12
|
-
type?: "email" | "number" | "password" | "search" | "tel" | "text" | "url";
|
|
12
|
+
type?: "email" | "number" | "password" | "search" | "tel" | "text" | "url" | "time";
|
|
13
13
|
maxLength?: number | undefined;
|
|
14
14
|
minLength?: number | undefined;
|
|
15
15
|
max?: number | string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./layout";
|
package/layout/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./layout"), exports);
|
package/layout/layout.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.Layout = void 0;
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const react_2 = require("@headlessui/react");
|
|
29
|
+
const icon_1 = require("../icon");
|
|
30
|
+
const uxf_logo_1 = require("./uxf-logo");
|
|
31
|
+
const Layout = (props) => {
|
|
32
|
+
var _a, _b;
|
|
33
|
+
const [sidebarOpen, setSidebarOpen] = (0, react_1.useState)(false);
|
|
34
|
+
return (react_1.default.createElement("div", { className: "uxf-layout" },
|
|
35
|
+
react_1.default.createElement("div", { className: "uxf-sidebar" },
|
|
36
|
+
react_1.default.createElement("div", { className: "uxf-sidebar__content" }, props.sidebar)),
|
|
37
|
+
react_1.default.createElement("div", { className: "uxf-app-bar" },
|
|
38
|
+
react_1.default.createElement("div", { className: "uxf-app-bar__left-container" },
|
|
39
|
+
react_1.default.createElement("button", { type: "button", className: "uxf-app-bar__menu-button", onClick: () => setSidebarOpen(true) },
|
|
40
|
+
react_1.default.createElement(icon_1.Icon, { name: "bars", className: "text-white", size: 26 })),
|
|
41
|
+
react_1.default.createElement("div", { className: "uxf-app-bar__logo" }, (_a = props.logo) !== null && _a !== void 0 ? _a : react_1.default.createElement(uxf_logo_1.UxfLogo, null))),
|
|
42
|
+
react_1.default.createElement("div", { className: "uxf-app-bar__right-container" }, props.toolbarRight)),
|
|
43
|
+
react_1.default.createElement(react_2.Transition.Root, { show: sidebarOpen, as: react_1.Fragment },
|
|
44
|
+
react_1.default.createElement(react_2.Dialog, { as: "div", className: "relative z-40 md:hidden", onClose: setSidebarOpen },
|
|
45
|
+
react_1.default.createElement(react_2.Transition.Child, { as: react_1.Fragment, enter: "transition-opacity ease-linear duration-300", enterFrom: "opacity-0", enterTo: "opacity-100", leave: "transition-opacity ease-linear duration-300", leaveFrom: "opacity-100", leaveTo: "opacity-0" },
|
|
46
|
+
react_1.default.createElement("div", { className: "fixed inset-0 bg-gray-600 bg-opacity-75" })),
|
|
47
|
+
react_1.default.createElement("div", { className: "fixed inset-0 z-40 flex" },
|
|
48
|
+
react_1.default.createElement(react_2.Transition.Child, { as: react_1.Fragment, enter: "transition ease-in-out duration-300 transform", enterFrom: "-translate-x-full", enterTo: "translate-x-0", leave: "transition ease-in-out duration-300 transform", leaveFrom: "translate-x-0", leaveTo: "-translate-x-full" },
|
|
49
|
+
react_1.default.createElement(react_2.Dialog.Panel, { className: "relative flex w-full max-w-xs flex-1 flex-col bg-white pt-5 pb-4" },
|
|
50
|
+
react_1.default.createElement(react_2.Transition.Child, { as: react_1.Fragment, enter: "ease-in-out duration-300", enterFrom: "opacity-0", enterTo: "opacity-100", leave: "ease-in-out duration-300", leaveFrom: "opacity-100", leaveTo: "opacity-0" },
|
|
51
|
+
react_1.default.createElement("div", { className: "absolute top-0 right-0 -mr-12 pt-2" },
|
|
52
|
+
react_1.default.createElement("button", { type: "button", className: "ml-1 flex h-10 w-10 items-center justify-center rounded-full focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white", onClick: () => setSidebarOpen(false) },
|
|
53
|
+
react_1.default.createElement("span", { className: "sr-only" }, "Close sidebar"),
|
|
54
|
+
react_1.default.createElement(icon_1.Icon, { name: "xmarkLarge", size: 24, className: "text-white" })))),
|
|
55
|
+
react_1.default.createElement("div", { className: "uxf-drawer__logo" }, (_b = props.logo) !== null && _b !== void 0 ? _b : react_1.default.createElement(uxf_logo_1.UxfLogo, { isDark: true })),
|
|
56
|
+
react_1.default.createElement("div", { className: "uxf-drawer__content" }, props.sidebar))),
|
|
57
|
+
react_1.default.createElement("div", { className: "w-14 flex-shrink-0", "aria-hidden": "true" })))),
|
|
58
|
+
react_1.default.createElement("main", { className: "uxf-layout__content" }, props.children)));
|
|
59
|
+
};
|
|
60
|
+
exports.Layout = Layout;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Default = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const layout_1 = require("./layout");
|
|
9
|
+
exports.default = {
|
|
10
|
+
title: "Admin/Layout",
|
|
11
|
+
component: layout_1.Layout,
|
|
12
|
+
layout: "fulscreen",
|
|
13
|
+
};
|
|
14
|
+
function Default() {
|
|
15
|
+
return (react_1.default.createElement(layout_1.Layout, { sidebar: react_1.default.createElement("div", { className: "p-8" },
|
|
16
|
+
react_1.default.createElement("div", { className: "flex h-64 items-center justify-center rounded-xl border-4 border-dashed border-gray-200 text-xl font-semibold text-gray-300" }, "sidebar")), toolbarRight: react_1.default.createElement("div", { className: "p-8" },
|
|
17
|
+
react_1.default.createElement("div", { className: "flex items-center justify-center rounded-xl border-4 border-dashed border-gray-200 px-5 text-xl font-semibold text-gray-300" }, "toolbarRight")) },
|
|
18
|
+
react_1.default.createElement("div", { className: "p-8" },
|
|
19
|
+
react_1.default.createElement("div", { className: "flex h-64 items-center justify-center rounded-xl border-4 border-dashed border-gray-200 text-xl font-semibold text-gray-300" }, "children"))));
|
|
20
|
+
}
|
|
21
|
+
exports.Default = Default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.UxfLogo = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const UxfLogo = (props) => {
|
|
9
|
+
return (react_1.default.createElement("svg", { width: "179", height: "40" },
|
|
10
|
+
react_1.default.createElement("path", { fill: "#FF4F06", fillRule: "evenodd", d: "M33.563 12.874a9.103 9.103 0 0 0 0-12.874L20.69 12.874l.107.105a9.103 9.103 0 0 0 12.766-.105Zm-20.69-6.437a9.103 9.103 0 0 1 .106 12.766l-.105.107L0 6.437a9.103 9.103 0 0 1 12.874 0ZM40 33.563 27.127 20.69l-.106.107a9.103 9.103 0 0 0 12.98 12.766Zm-20.69-6.437-.107-.105A9.103 9.103 0 0 0 6.437 40l12.874-12.874Z", clipRule: "evenodd" }),
|
|
11
|
+
react_1.default.createElement("path", { fill: props.isDark ? "#140939" : "#FFF", fillRule: "evenodd", d: "m84.325 7.295 5.133 8.675h.199l5.158-8.675h6.078l-7.768 12.727 7.942 12.727h-6.19l-5.22-8.687h-.199l-5.22 8.687h-6.165l7.967-12.727-7.818-12.727h6.103Zm-24.194 0v16.07c0 .97.214 1.832.64 2.586a4.58 4.58 0 0 0 1.809 1.777c.779.431 1.686.647 2.722.647 1.044 0 1.953-.216 2.728-.647a4.591 4.591 0 0 0 1.802-1.777c.427-.754.64-1.616.64-2.585V7.296h5.382v16.53c0 1.856-.441 3.48-1.324 4.872-.882 1.392-2.115 2.475-3.697 3.25-1.583.775-3.426 1.162-5.531 1.162-2.113 0-3.96-.387-5.543-1.162-1.583-.775-2.813-1.858-3.692-3.25-.878-1.392-1.317-3.016-1.317-4.872V7.296h5.381ZM170.25 13.41c2.411 0 4.311.51 5.698 1.529 1.388 1.019 2.198 2.407 2.43 4.164l-4.847.298a2.555 2.555 0 0 0-.534-1.125 2.942 2.942 0 0 0-1.075-.808c-.444-.203-.972-.304-1.585-.304-.821 0-1.512.172-2.076.515-.563.344-.845.802-.845 1.374 0 .456.182.84.547 1.156.364.315.99.567 1.877.758l3.455.696c1.856.381 3.24.994 4.151 1.84.912.845 1.367 1.955 1.367 3.33 0 1.252-.366 2.35-1.1 3.294-.733.945-1.736 1.68-3.007 2.206-1.272.526-2.737.79-4.394.79-2.527 0-4.539-.529-6.034-1.585-1.496-1.057-2.372-2.496-2.629-4.32l5.208-.273c.157.77.538 1.357 1.143 1.759.605.402 1.38.603 2.324.603.928 0 1.676-.18 2.244-.54.567-.361.855-.827.864-1.4-.009-.48-.212-.875-.609-1.186-.398-.31-1.011-.55-1.84-.715l-3.306-.659c-1.864-.372-3.25-1.019-4.157-1.938-.908-.92-1.361-2.093-1.361-3.518 0-1.226.333-2.283 1-3.17.667-.886 1.608-1.57 2.821-2.05 1.214-.48 2.637-.72 4.27-.72Zm-36.686.373a12.285 12.285 0 0 0-3.051-.373c-1.525 0-2.865.23-4.021.69-1.156.46-2.098 1.114-2.827 1.964-.73.849-1.219 1.854-1.467 3.014l4.897.397c.182-.63.555-1.153 1.119-1.572.563-.418 1.321-.627 2.274-.627.903 0 1.601.215 2.094.646.493.43.74 1.04.74 1.827v.075c0 .405-.153.712-.46.92-.307.206-.8.362-1.479.465-.68.104-1.574.214-2.685.33-.944.09-1.845.248-2.703.472a7.698 7.698 0 0 0-2.293.994 4.727 4.727 0 0 0-1.591 1.74c-.39.721-.584 1.612-.584 2.673 0 1.259.275 2.31.826 3.15a5.147 5.147 0 0 0 2.256 1.902c.953.427 2.038.64 3.257.64.944 0 1.777-.126 2.498-.38a5.55 5.55 0 0 0 1.852-1.055 5.31 5.31 0 0 0 1.23-1.573h.149v2.648h5.022V19.873c0-1.135-.22-2.11-.659-2.927a5.655 5.655 0 0 0-1.796-2.007 8.039 8.039 0 0 0-2.598-1.156Zm-13.424-2.05V7.294h-16.853v25.454h5.381V22.235h10.354v-4.438h-10.354v-6.065h11.472Zm32.603 1.677c1.326 0 2.482.29 3.468.87.986.58 1.753 1.407 2.3 2.48.546 1.073.82 2.35.82 3.834V32.75h-5.295V21.539c.008-1.169-.29-2.082-.895-2.74-.605-.66-1.437-.989-2.498-.989-.713 0-1.34.153-1.883.46a3.166 3.166 0 0 0-1.268 1.336c-.302.584-.458 1.286-.466 2.107V32.75h-5.295V13.659h5.047v3.368H147a5.358 5.358 0 0 1 2.126-2.641c.994-.65 2.2-.976 3.616-.976Zm-20.061 10.782c.286-.087.512-.184.678-.292v2.026c0 .671-.17 1.272-.51 1.802-.34.53-.808.951-1.404 1.262-.597.31-1.285.466-2.064.466-.812 0-1.481-.189-2.007-.566-.526-.377-.789-.925-.789-1.646 0-.497.128-.914.385-1.25.257-.335.617-.602 1.082-.801a6.547 6.547 0 0 1 1.628-.435l.969-.143a24.15 24.15 0 0 0 1.069-.186c.356-.071.677-.15.963-.237Z", clipRule: "evenodd" })));
|
|
12
|
+
};
|
|
13
|
+
exports.UxfLogo = UxfLogo;
|
package/package.json
CHANGED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Pagination = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const icon_1 = require("../icon");
|
|
9
|
+
const cx_1 = require("@uxf/core/utils/cx");
|
|
10
|
+
const usePagination_1 = require("@uxf/core/hooks/usePagination");
|
|
11
|
+
const Pagination = (props) => {
|
|
12
|
+
const isCurrentPageFirst = props.page === 1;
|
|
13
|
+
const isCurrentPageLast = props.page === props.count;
|
|
14
|
+
const pagination = (0, usePagination_1.usePagination)({
|
|
15
|
+
count: props.count,
|
|
16
|
+
page: props.page,
|
|
17
|
+
showFirstButton: true,
|
|
18
|
+
showLastButton: true,
|
|
19
|
+
});
|
|
20
|
+
const onClick = (item) => {
|
|
21
|
+
if (typeof item === "number") {
|
|
22
|
+
return props.onPageChange(item);
|
|
23
|
+
}
|
|
24
|
+
switch (item) {
|
|
25
|
+
case "first":
|
|
26
|
+
return props.onPageChange(1);
|
|
27
|
+
case "previous":
|
|
28
|
+
return props.onPageChange(props.page - 1);
|
|
29
|
+
case "next":
|
|
30
|
+
return props.onPageChange(props.page + 1);
|
|
31
|
+
case "last":
|
|
32
|
+
return props.onPageChange(props.count);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
return (react_1.default.createElement("nav", { className: "uxf-pagination" }, pagination.map((item, index) => {
|
|
36
|
+
const isDisabled = ((item === "first" || item === "previous") && isCurrentPageFirst) ||
|
|
37
|
+
((item === "last" || item === "next") && isCurrentPageLast);
|
|
38
|
+
return (react_1.default.createElement("a", { key: item, onClick: isDisabled ? undefined : () => onClick(item), className: (0, cx_1.cx)("uxf-pagination__button", isDisabled && "is-disabled", (item === "start-ellipsis" || item === "end-ellipsis") && "is-ellipsis", item === props.page && "is-selected", index === 0 && "is-first", index === pagination.length - 1 && "is-last") }, item === "first" ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
39
|
+
react_1.default.createElement("span", { className: "sr-only" }, "First"),
|
|
40
|
+
react_1.default.createElement(icon_1.Icon, { name: "chevronsLeft", size: 12 }))) : item === "previous" ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
41
|
+
react_1.default.createElement("span", { className: "sr-only" }, "Previous"),
|
|
42
|
+
react_1.default.createElement(icon_1.Icon, { name: "chevronLeft", size: 12 }))) : item === "start-ellipsis" || item === "end-ellipsis" ? (react_1.default.createElement(react_1.default.Fragment, null, "...")) : typeof item === "number" ? (react_1.default.createElement(react_1.default.Fragment, null, item)) : item === "next" ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
43
|
+
react_1.default.createElement("span", { className: "sr-only" }, "Next"),
|
|
44
|
+
react_1.default.createElement(icon_1.Icon, { name: "chevronRight", size: 12 }))) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
45
|
+
react_1.default.createElement("span", { className: "sr-only" }, "Last"),
|
|
46
|
+
react_1.default.createElement(icon_1.Icon, { name: "chevronsRight", size: 12 })))));
|
|
47
|
+
})));
|
|
48
|
+
};
|
|
49
|
+
exports.Pagination = Pagination;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.Default = void 0;
|
|
27
|
+
const pagination_1 = require("./pagination");
|
|
28
|
+
const react_1 = __importStar(require("react"));
|
|
29
|
+
exports.default = {
|
|
30
|
+
title: "UI/Pagination",
|
|
31
|
+
component: pagination_1.Pagination,
|
|
32
|
+
};
|
|
33
|
+
function Default() {
|
|
34
|
+
const [page, setPage] = (0, react_1.useState)(1);
|
|
35
|
+
return (react_1.default.createElement("div", { className: "flex flex-col gap-4" },
|
|
36
|
+
react_1.default.createElement("p", null,
|
|
37
|
+
"Je pot\u0159eba ikona ",
|
|
38
|
+
react_1.default.createElement("b", null, "chevronsLeft"),
|
|
39
|
+
", ",
|
|
40
|
+
react_1.default.createElement("b", null, "chevronLeft"),
|
|
41
|
+
", ",
|
|
42
|
+
react_1.default.createElement("b", null, "chevronRight"),
|
|
43
|
+
" a ",
|
|
44
|
+
react_1.default.createElement("b", null, "chevronsRight")),
|
|
45
|
+
react_1.default.createElement(pagination_1.Pagination, { count: 10, page: page, onPageChange: setPage })));
|
|
46
|
+
}
|
|
47
|
+
exports.Default = Default;
|
package/tabs/tabs.d.ts
CHANGED
package/tabs/tabs.js
CHANGED
|
@@ -53,13 +53,16 @@ const TabsRoot = (0, forwardRef_1.forwardRef)("Tabs", (props, ref) => {
|
|
|
53
53
|
return react_2.default.createElement("div", { className: tabsClassName, ref: ref });
|
|
54
54
|
}
|
|
55
55
|
const tabPanels = react_2.Children.toArray(props.children).filter((child) => (0, react_2.isValidElement)(child) && child.props.title);
|
|
56
|
-
const tabs = tabPanels.map((c) =>
|
|
56
|
+
const tabs = tabPanels.map((c) => ({
|
|
57
|
+
title: c.props.title,
|
|
58
|
+
disabled: c.props.disabled,
|
|
59
|
+
}));
|
|
57
60
|
return (react_2.default.createElement(react_1.Tab.Group, { as: "div", className: tabsClassName, defaultIndex: props.defaultIndex, onChange: props.onChange, ref: ref },
|
|
58
61
|
react_2.default.createElement(react_1.Tab.List, { className: (0, cx_1.cx)("uxf-tabs__tab-list__wrapper", `uxf-tabs__tab-list__wrapper--${(_a = props.variant) !== null && _a !== void 0 ? _a : "default"}`, props.tabListClassName) },
|
|
59
|
-
react_2.default.createElement("div", { className: (0, cx_1.cx)("uxf-tabs__tab-list", `uxf-tabs__tab-list--${(_b = props.variant) !== null && _b !== void 0 ? _b : "default"}`), ref: containerRef, style: { justifyContent: hasOverflow ? "flex-start" : undefined, ...dragStyle } }, tabs.map((tab, index) => (react_2.default.createElement(react_1.Tab, { className: ({ selected }) => {
|
|
62
|
+
react_2.default.createElement("div", { className: (0, cx_1.cx)("uxf-tabs__tab-list", `uxf-tabs__tab-list--${(_b = props.variant) !== null && _b !== void 0 ? _b : "default"}`), ref: containerRef, style: { justifyContent: hasOverflow ? "flex-start" : undefined, ...dragStyle } }, tabs.map((tab, index) => (react_2.default.createElement(react_1.Tab, { disabled: tab.disabled, className: ({ selected }) => {
|
|
60
63
|
var _a;
|
|
61
|
-
return (0, cx_1.cx)("uxf-tabs__tab", selected && classes_1.CLASSES.IS_ACTIVE, `uxf-tabs__tab--${(_a = props.variant) !== null && _a !== void 0 ? _a : "default"}`);
|
|
62
|
-
}, key: `${tab}--${index}` }, tab))))),
|
|
64
|
+
return (0, cx_1.cx)("uxf-tabs__tab", selected && classes_1.CLASSES.IS_ACTIVE, tab.disabled && classes_1.CLASSES.IS_DISABLED, `uxf-tabs__tab--${(_a = props.variant) !== null && _a !== void 0 ? _a : "default"}`);
|
|
65
|
+
}, key: `${tab.title}--${index}` }, tab.title))))),
|
|
63
66
|
react_2.default.createElement(react_1.Tab.Panels, { className: "uxf-tabs__panels" }, tabPanels.map((tab, index) => (react_2.default.createElement(react_1.Tab.Panel, { className: "outline-none", key: `${tab}--${index}` }, tab))))));
|
|
64
67
|
});
|
|
65
68
|
exports.Tabs = Object.assign(TabsRoot, { Panel });
|
package/tabs/tabs.stories.js
CHANGED
|
@@ -19,14 +19,14 @@ function Default() {
|
|
|
19
19
|
react_1.default.createElement(tabs_1.Tabs.Panel, { title: "Tab 1 title", className: "grid h-12 w-56 place-items-center bg-red-300" }, "content of the Tab 1"),
|
|
20
20
|
react_1.default.createElement(tabs_1.Tabs.Panel, { title: "Tab 2 title", className: "grid h-12 w-56 place-items-center bg-green-300" }, "content of the Tab 2"),
|
|
21
21
|
react_1.default.createElement(tabs_1.Tabs.Panel, { title: "Tab 3 title", className: "grid h-12 w-56 place-items-center bg-amber-300" }, "content of the Tab 3"),
|
|
22
|
-
react_1.default.createElement(tabs_1.Tabs.Panel, {
|
|
22
|
+
react_1.default.createElement(tabs_1.Tabs.Panel, { className: "grid h-12 w-56 place-items-center bg-gray-300", disabled: true, title: "Tab 4 title - disabled" }, "content of the Tab 4 which is disabled"))),
|
|
23
23
|
react_1.default.createElement("div", null,
|
|
24
24
|
react_1.default.createElement("p", { className: "mb-4 text-gray-500" }, "Segmented"),
|
|
25
25
|
react_1.default.createElement(tabs_1.Tabs, { variant: "segmented" },
|
|
26
26
|
react_1.default.createElement(tabs_1.Tabs.Panel, { title: "Tab 1 title", className: "grid h-12 w-56 place-items-center bg-red-300" }, "content of the Tab 1"),
|
|
27
27
|
react_1.default.createElement(tabs_1.Tabs.Panel, { title: "Tab 2 title", className: "grid h-12 w-56 place-items-center bg-green-300" }, "content of the Tab 2"),
|
|
28
28
|
react_1.default.createElement(tabs_1.Tabs.Panel, { title: "Tab 3 title", className: "grid h-12 w-56 place-items-center bg-amber-300" }, "content of the Tab 3"),
|
|
29
|
-
react_1.default.createElement(tabs_1.Tabs.Panel, {
|
|
29
|
+
react_1.default.createElement(tabs_1.Tabs.Panel, { className: "grid h-12 w-56 place-items-center bg-gray-300", disabled: true, title: "Tab 4 title - disabled" }, "content of the Tab 4 which is disabled")))),
|
|
30
30
|
react_1.default.createElement("div", { className: "w-[600px]" },
|
|
31
31
|
react_1.default.createElement("p", { className: "mb-4 text-gray-500" }, "Default grow"),
|
|
32
32
|
react_1.default.createElement(tabs_1.Tabs, { grow: true },
|
|
@@ -19,7 +19,7 @@ export interface TextInputProps extends FormControlProps<string>, Pick<InputProp
|
|
|
19
19
|
placeholder?: string;
|
|
20
20
|
rightAddon?: ReactNode;
|
|
21
21
|
rightElement?: ReactNode;
|
|
22
|
-
type?: "email" | "number" | "password" | "search" | "tel" | "text" | "url";
|
|
22
|
+
type?: "email" | "number" | "password" | "search" | "tel" | "text" | "url" | "time";
|
|
23
23
|
maxLength?: number | undefined;
|
|
24
24
|
minLength?: number | undefined;
|
|
25
25
|
max?: number | string;
|
|
@@ -36,11 +36,13 @@ exports.default = {
|
|
|
36
36
|
};
|
|
37
37
|
function Full() {
|
|
38
38
|
const [value, onChange] = (0, react_1.useState)("");
|
|
39
|
+
const [timeValue, onTimeChange] = (0, react_1.useState)("");
|
|
39
40
|
const storyTextInputs = (react_1.default.createElement("div", { className: "space-y-4" },
|
|
40
41
|
react_1.default.createElement(text_input_1.TextInput, { label: "Default input", value: value, onChange: onChange, helperText: "Helper text", leftAddon: "https://", rightAddon: ".cz", leftElement: "\uD83C\uDF37", rightElement: "\uD83D\uDD14", placeholder: "Some beautiful placeholder..." }),
|
|
41
42
|
react_1.default.createElement(text_input_1.TextInput, { label: "Error input", value: value, onChange: onChange, helperText: "Error helper text", leftAddon: "https://", rightAddon: ".cz", leftElement: "\uD83C\uDF37", rightElement: "\uD83D\uDD14", placeholder: "Some beautiful placeholder...", isInvalid: true }),
|
|
42
43
|
react_1.default.createElement(text_input_1.TextInput, { label: "Read only input", value: value, onChange: onChange, helperText: "Error helper text", leftAddon: "https://", rightAddon: ".cz", leftElement: "\uD83C\uDF37", rightElement: "\uD83D\uDD14", placeholder: "Some beautiful placeholder...", isReadOnly: true }),
|
|
43
|
-
react_1.default.createElement(text_input_1.TextInput, { label: "Disabled input", value: value, onChange: onChange, helperText: "Error helper text", leftAddon: "https://", rightAddon: ".cz", leftElement: "\uD83C\uDF37", rightElement: "\uD83D\uDD14", placeholder: "Some beautiful placeholder...", isDisabled: true })
|
|
44
|
+
react_1.default.createElement(text_input_1.TextInput, { label: "Disabled input", value: value, onChange: onChange, helperText: "Error helper text", leftAddon: "https://", rightAddon: ".cz", leftElement: "\uD83C\uDF37", rightElement: "\uD83D\uDD14", placeholder: "Some beautiful placeholder...", isDisabled: true }),
|
|
45
|
+
react_1.default.createElement(text_input_1.TextInput, { label: "Default tml time input", value: timeValue, onChange: onTimeChange, placeholder: "Some beautiful placeholder...", type: "time" })));
|
|
44
46
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
45
47
|
react_1.default.createElement("div", { className: "light space-y-2 p-20" }, storyTextInputs),
|
|
46
48
|
react_1.default.createElement("div", { className: "dark space-y-2 bg-gray-900 p-20" }, storyTextInputs)));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./time-picker"), exports);
|
|
18
|
+
__exportStar(require("./time-picker-input"), exports);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.TimePickerHour = void 0;
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const time_picker_context_1 = require("@uxf/datepicker/contexts/time-picker-context");
|
|
29
|
+
const use_hour_1 = require("@uxf/datepicker/hooks/use-hour");
|
|
30
|
+
const cx_1 = require("@uxf/core/utils/cx");
|
|
31
|
+
const classes_1 = require("@uxf/core/constants/classes");
|
|
32
|
+
const button_1 = require("../button");
|
|
33
|
+
const TimePickerHour = (props) => {
|
|
34
|
+
const hourRef = (0, react_1.useRef)(null);
|
|
35
|
+
const { focusedHour, isHourFocused, isHourSelected, onHourSelect, onHourFocus } = (0, react_1.useContext)(time_picker_context_1.TimePickerContext);
|
|
36
|
+
const { onClick, onKeyDown, tabIndex, isSelected } = (0, use_hour_1.useHour)({
|
|
37
|
+
hour: props.hour,
|
|
38
|
+
hourRef,
|
|
39
|
+
isHourFocused,
|
|
40
|
+
focusedHour,
|
|
41
|
+
isHourSelected,
|
|
42
|
+
onHourSelect,
|
|
43
|
+
onHourFocus,
|
|
44
|
+
});
|
|
45
|
+
return (react_1.default.createElement(button_1.Button, { variant: "text", tabIndex: tabIndex, onKeyDown: onKeyDown, onClick: onClick, className: (0, cx_1.cx)("uxf-time-picker__hour", isSelected && classes_1.CLASSES.IS_SELECTED), ref: hourRef }, props.label));
|
|
46
|
+
};
|
|
47
|
+
exports.TimePickerHour = TimePickerHour;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TimePickerHours = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const time_picker_hour_1 = require("./time-picker-hour");
|
|
9
|
+
const use_hours_1 = require("@uxf/datepicker/hooks/use-hours");
|
|
10
|
+
const TimePickerHours = () => {
|
|
11
|
+
const { hours } = (0, use_hours_1.useHours)({});
|
|
12
|
+
return (react_1.default.createElement("div", { className: "uxf-time-picker__hours" }, hours.map((hour) => (react_1.default.createElement(time_picker_hour_1.TimePickerHour, { hour: hour.value, label: hour.label, key: hour.value })))));
|
|
13
|
+
};
|
|
14
|
+
exports.TimePickerHours = TimePickerHours;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import { InputProps } from "../input/input";
|
|
3
|
+
import { FormControlProps } from "../types";
|
|
4
|
+
import { TimeType } from "@uxf/datepicker/hooks/use-time-picker";
|
|
5
|
+
export interface TimePickerInputProps extends Omit<FormControlProps<TimeType | null>, "value">, Pick<InputProps, "size" | "variant"> {
|
|
6
|
+
className?: string;
|
|
7
|
+
defaultValue?: string;
|
|
8
|
+
error?: ReactNode;
|
|
9
|
+
errorId?: string;
|
|
10
|
+
form?: string;
|
|
11
|
+
helperText?: ReactNode;
|
|
12
|
+
hiddenLabel?: boolean;
|
|
13
|
+
id?: string;
|
|
14
|
+
label?: ReactNode;
|
|
15
|
+
leftAddon?: ReactNode;
|
|
16
|
+
leftElement?: ReactNode;
|
|
17
|
+
placeholder?: TimeType;
|
|
18
|
+
rightAddon?: ReactNode;
|
|
19
|
+
rightElement?: ReactNode;
|
|
20
|
+
value?: TimeType | null;
|
|
21
|
+
}
|
|
22
|
+
export declare const TimePickerInput: React.ForwardRefExoticComponent<TimePickerInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.TimePickerInput = void 0;
|
|
27
|
+
const classes_1 = require("@uxf/core/constants/classes");
|
|
28
|
+
const cx_1 = require("@uxf/core/utils/cx");
|
|
29
|
+
const react_1 = __importStar(require("react"));
|
|
30
|
+
const form_control_1 = require("../form-control");
|
|
31
|
+
const forwardRef_1 = require("@uxf/core/utils/forwardRef");
|
|
32
|
+
const react_2 = require("@headlessui/react");
|
|
33
|
+
const time_picker_1 = require("./time-picker");
|
|
34
|
+
exports.TimePickerInput = (0, forwardRef_1.forwardRef)("TimePickerInput", (props, ref) => {
|
|
35
|
+
var _a;
|
|
36
|
+
const [isFocused, setIsFocused] = (0, react_1.useState)(false);
|
|
37
|
+
const generatedId = (0, react_1.useId)();
|
|
38
|
+
const id = (_a = props.id) !== null && _a !== void 0 ? _a : generatedId;
|
|
39
|
+
const errorId = props.isInvalid ? `${id}--error-message` : undefined;
|
|
40
|
+
const rootClassName = (0, cx_1.cx)("uxf-time-picker-input", isFocused && classes_1.CLASSES.IS_FOCUSED, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.isInvalid && classes_1.CLASSES.IS_INVALID, props.leftElement && "uxf-time-picker-input--has-left-element", props.rightElement && "uxf-time-picker-input--has-right-element", props.isRequired && classes_1.CLASSES.IS_REQUIRED, props.isReadOnly && classes_1.CLASSES.IS_READONLY);
|
|
41
|
+
const onFocus = (e) => {
|
|
42
|
+
var _a;
|
|
43
|
+
setIsFocused(true);
|
|
44
|
+
(_a = props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
45
|
+
};
|
|
46
|
+
const onBlur = (e) => {
|
|
47
|
+
var _a;
|
|
48
|
+
setIsFocused(false);
|
|
49
|
+
(_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
50
|
+
};
|
|
51
|
+
return (react_1.default.createElement(form_control_1.FormControl, { className: rootClassName, errorId: errorId, form: props.form, helperText: props.helperText, hiddenLabel: props.hiddenLabel, inputId: id, isRequired: props.isRequired, label: props.label },
|
|
52
|
+
react_1.default.createElement(react_2.Popover, { className: "relative" },
|
|
53
|
+
react_1.default.createElement(react_2.Popover.Button, { as: "div", className: "uxf-time-picker-input__wrapper" },
|
|
54
|
+
react_1.default.createElement("span", { className: "uxf-time-picker-input__left-element" }, props.leftElement),
|
|
55
|
+
react_1.default.createElement("input", { "aria-describedby": errorId, "aria-errormessage": props.error && errorId ? `${errorId}__error-message` : undefined, "aria-invalid": !!props.error, "aria-live": "polite", autoComplete: "off", className: "uxf-time-picker-input__element", disabled: props.isDisabled, form: props.form, id: id, inputMode: "text", name: props.name, onBlur: onBlur, onChange: () => props.onChange, onFocus: onFocus, placeholder: "Vyberte \u010Das...", readOnly: props.isReadOnly, ref: ref, required: props.isRequired, tabIndex: props.isReadOnly ? -1 : undefined, value: props.value
|
|
56
|
+
? `${props.value.hour}:${props.value.minute < 10 ? "0" + props.value.minute : props.value.minute}`
|
|
57
|
+
: "" }),
|
|
58
|
+
react_1.default.createElement("span", { className: "uxf-time-picker-input__right-element" }, props.rightElement)),
|
|
59
|
+
!props.isDisabled && !props.isReadOnly && (react_1.default.createElement(react_2.Transition, { as: react_1.Fragment, enter: "transition duration-200 ease-out", enterFrom: "origin-top scale-50 opacity-0", enterTo: "origin-top scale-100 opacity-100", leave: "transition duration-200 ease-out", leaveFrom: "origin-top scale-50 opacity-100", leaveTo: "origin-top scale-0 opacity-0" },
|
|
60
|
+
react_1.default.createElement(react_2.Popover.Panel, { className: "uxf-time-picker-input__popover", static: true }, ({ close }) => {
|
|
61
|
+
var _a;
|
|
62
|
+
return props.onChange ? (react_1.default.createElement(time_picker_1.TimePicker, { closePopoverHandler: close, onChange: props.onChange, selectedTime: (_a = props.value) !== null && _a !== void 0 ? _a : null })) : (react_1.default.createElement(react_1.default.Fragment, null));
|
|
63
|
+
}))))));
|
|
64
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const _default: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: React.ForwardRefExoticComponent<import("./time-picker-input").TimePickerInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|
|
7
|
+
export declare function Default(): JSX.Element;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.Default = void 0;
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const time_picker_input_1 = require("./time-picker-input");
|
|
29
|
+
const icon_1 = require("../icon");
|
|
30
|
+
exports.default = {
|
|
31
|
+
title: "UI/TimePickerInput",
|
|
32
|
+
component: time_picker_input_1.TimePickerInput,
|
|
33
|
+
};
|
|
34
|
+
function Default() {
|
|
35
|
+
const [time, setTime] = (0, react_1.useState)(null);
|
|
36
|
+
const testTimePickers = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
37
|
+
react_1.default.createElement(time_picker_input_1.TimePickerInput, { id: "time-test", name: "time", label: "\u010Cas \u010Dehokoliv", rightElement: react_1.default.createElement(icon_1.Icon, { name: "clock", size: 24 }), value: time, onChange: (data) => setTime(data) }),
|
|
38
|
+
react_1.default.createElement(time_picker_input_1.TimePickerInput, { id: "time-test-disabled", name: "time-disabled", label: "\u010Cas disabled", rightElement: react_1.default.createElement(icon_1.Icon, { name: "clock", size: 24 }), value: time, onChange: (data) => setTime(data), isDisabled: true }),
|
|
39
|
+
react_1.default.createElement(time_picker_input_1.TimePickerInput, { id: "time-test-readonly", name: "time-readonly", label: "\u010Cas readonly", rightElement: react_1.default.createElement(icon_1.Icon, { name: "clock", size: 24 }), value: time, onChange: (data) => setTime(data), isReadOnly: true }),
|
|
40
|
+
react_1.default.createElement(time_picker_input_1.TimePickerInput, { id: "time-test-invalid", name: "time-invalid", label: "\u010Cas invalid", rightElement: react_1.default.createElement(icon_1.Icon, { name: "clock", size: 24 }), value: time, onChange: (data) => setTime(data), isInvalid: true })));
|
|
41
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
42
|
+
react_1.default.createElement("div", { className: "light max-w-[640px] space-y-4 rounded bg-white p-8" }, testTimePickers),
|
|
43
|
+
react_1.default.createElement("div", { className: "dark max-w-[640px] space-y-4 rounded bg-gray-900 p-8 text-white" }, testTimePickers)));
|
|
44
|
+
}
|
|
45
|
+
exports.Default = Default;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.TimePickerMinute = void 0;
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const time_picker_context_1 = require("@uxf/datepicker/contexts/time-picker-context");
|
|
29
|
+
const use_minute_1 = require("@uxf/datepicker/hooks/use-minute");
|
|
30
|
+
const cx_1 = require("@uxf/core/utils/cx");
|
|
31
|
+
const classes_1 = require("@uxf/core/constants/classes");
|
|
32
|
+
const button_1 = require("../button");
|
|
33
|
+
const TimePickerMinute = (props) => {
|
|
34
|
+
const minuteRef = (0, react_1.useRef)(null);
|
|
35
|
+
const { focusedMinute, isMinuteFocused, isMinuteSelected, onMinuteSelect, onMinuteFocus } = (0, react_1.useContext)(time_picker_context_1.TimePickerContext);
|
|
36
|
+
const { isSelected, onClick, onKeyDown, tabIndex } = (0, use_minute_1.useMinute)({
|
|
37
|
+
minute: props.minute,
|
|
38
|
+
minuteRef,
|
|
39
|
+
focusedMinute,
|
|
40
|
+
isMinuteFocused,
|
|
41
|
+
isMinuteSelected,
|
|
42
|
+
onMinuteFocus,
|
|
43
|
+
onMinuteSelect,
|
|
44
|
+
});
|
|
45
|
+
return (react_1.default.createElement(button_1.Button, { variant: "text", tabIndex: tabIndex, onKeyDown: onKeyDown, onClick: onClick, className: (0, cx_1.cx)("uxf-time-picker__minute", isSelected && classes_1.CLASSES.IS_SELECTED), ref: minuteRef }, props.label));
|
|
46
|
+
};
|
|
47
|
+
exports.TimePickerMinute = TimePickerMinute;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TimePickerMinutes = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const time_picker_minute_1 = require("./time-picker-minute");
|
|
9
|
+
const use_minutes_1 = require("@uxf/datepicker/hooks/use-minutes");
|
|
10
|
+
const TimePickerMinutes = () => {
|
|
11
|
+
const { minutes } = (0, use_minutes_1.useMinutes)({});
|
|
12
|
+
return (react_1.default.createElement("div", { className: "uxf-time-picker__minutes" }, minutes.map((minute) => (react_1.default.createElement(time_picker_minute_1.TimePickerMinute, { minute: minute.value, label: minute.label, key: minute.value })))));
|
|
13
|
+
};
|
|
14
|
+
exports.TimePickerMinutes = TimePickerMinutes;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { OnTimeChangeType, TimeType } from "@uxf/datepicker/hooks/use-time-picker";
|
|
3
|
+
export interface TimePickerProps {
|
|
4
|
+
closePopoverHandler: () => void;
|
|
5
|
+
onChange: (data: OnTimeChangeType) => void;
|
|
6
|
+
selectedTime: TimeType | null;
|
|
7
|
+
}
|
|
8
|
+
export declare const TimePicker: FC<TimePickerProps>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.TimePicker = void 0;
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const time_picker_hours_1 = require("./time-picker-hours");
|
|
29
|
+
const time_picker_minutes_1 = require("./time-picker-minutes");
|
|
30
|
+
const use_time_picker_1 = require("@uxf/datepicker/hooks/use-time-picker");
|
|
31
|
+
const icon_1 = require("../icon");
|
|
32
|
+
const button_1 = require("../button");
|
|
33
|
+
const time_picker_context_1 = require("@uxf/datepicker/contexts/time-picker-context");
|
|
34
|
+
const TimePicker = (props) => {
|
|
35
|
+
const [viewMode, setViewMode] = (0, react_1.useState)("global");
|
|
36
|
+
const { goToNextMinute, goToPrevHour, goToPrevMinute, goToNextHour, ...contextProps } = (0, use_time_picker_1.useTimePicker)({
|
|
37
|
+
selectedTime: props.selectedTime,
|
|
38
|
+
onTimeChange: props.onChange,
|
|
39
|
+
onSelectCallback: () => setViewMode("global"),
|
|
40
|
+
});
|
|
41
|
+
const timePickerComponents = (0, react_1.useMemo)(() => {
|
|
42
|
+
var _a, _b;
|
|
43
|
+
return ({
|
|
44
|
+
global: (react_1.default.createElement("div", { className: "uxf-time-picker__global" },
|
|
45
|
+
react_1.default.createElement("div", { className: "uxf-time-picker__global__column" },
|
|
46
|
+
react_1.default.createElement(button_1.Button, { iconButton: true, onClick: goToNextHour, title: "Dal\u0161\u00ED", variant: "text" },
|
|
47
|
+
react_1.default.createElement(icon_1.Icon, { name: "chevronUp", size: 16 })),
|
|
48
|
+
react_1.default.createElement(button_1.Button, { variant: "text", onClick: () => setViewMode("hour") }, (_b = (_a = props.selectedTime) === null || _a === void 0 ? void 0 : _a.hour) !== null && _b !== void 0 ? _b : "0"),
|
|
49
|
+
react_1.default.createElement(button_1.Button, { iconButton: true, onClick: goToPrevHour, title: "P\u0159edchoz\u00ED", variant: "text" },
|
|
50
|
+
react_1.default.createElement(icon_1.Icon, { name: "chevronDown", size: 16 }))),
|
|
51
|
+
react_1.default.createElement("div", null, ":"),
|
|
52
|
+
react_1.default.createElement("div", { className: "uxf-time-picker__global__column" },
|
|
53
|
+
react_1.default.createElement(button_1.Button, { iconButton: true, onClick: goToNextMinute, title: "Dal\u0161\u00ED", variant: "text" },
|
|
54
|
+
react_1.default.createElement(icon_1.Icon, { name: "chevronUp", size: 16 })),
|
|
55
|
+
react_1.default.createElement(button_1.Button, { variant: "text", onClick: () => setViewMode("minute") }, props.selectedTime
|
|
56
|
+
? props.selectedTime.minute < 10
|
|
57
|
+
? "0" + props.selectedTime.minute
|
|
58
|
+
: props.selectedTime.minute
|
|
59
|
+
: "00"),
|
|
60
|
+
react_1.default.createElement(button_1.Button, { iconButton: true, onClick: goToPrevMinute, title: "P\u0159edchoz\u00ED", variant: "text" },
|
|
61
|
+
react_1.default.createElement(icon_1.Icon, { name: "chevronDown", size: 16 }))))),
|
|
62
|
+
hour: react_1.default.createElement(time_picker_hours_1.TimePickerHours, null),
|
|
63
|
+
minute: react_1.default.createElement(time_picker_minutes_1.TimePickerMinutes, null),
|
|
64
|
+
});
|
|
65
|
+
}, [goToPrevHour, props.selectedTime, goToNextHour, goToPrevMinute, goToNextMinute]);
|
|
66
|
+
return (react_1.default.createElement(time_picker_context_1.TimePickerContext.Provider, { value: contextProps },
|
|
67
|
+
react_1.default.createElement("div", null, timePickerComponents[viewMode])));
|
|
68
|
+
};
|
|
69
|
+
exports.TimePicker = TimePicker;
|
package/utils/icons-config.js
CHANGED
|
@@ -15,6 +15,16 @@ module.exports = {
|
|
|
15
15
|
height: 512,
|
|
16
16
|
data: `<path d="M137.4 374.6a32.05 32.05 0 0 0 45.3 0l128-128c9.2-9.2 11.9-22.9 6.9-34.9S301 191.9 288 191.9L32 192c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9l128 128z" fill="currentColor"/>`,
|
|
17
17
|
},
|
|
18
|
+
clock: {
|
|
19
|
+
width: 512,
|
|
20
|
+
height: 512,
|
|
21
|
+
data: `<path d="M232 120c0-13.3 10.7-24 24-24s24 10.7 24 24v123.2l85.3 56.8c11 7.4 14 22.3 5.8 33.3-6.5 11-21.4 14-32.4 5.8l-96-64c-6.7-3.6-10.7-11.1-10.7-20V120zM256 0c141.4 0 256 114.6 256 256S397.4 512 256 512 0 397.4 0 256 114.6 0 256 0zM48 256c0 114.9 93.1 208 208 208s208-93.1 208-208S370.9 48 256 48 48 141.1 48 256z" fill="currentColor"/>`,
|
|
22
|
+
},
|
|
23
|
+
bars: {
|
|
24
|
+
width: 448,
|
|
25
|
+
height: 512,
|
|
26
|
+
data: `<path d="M0 96C0 78.3 14.3 64 32 64H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z" fill="currentColor" />`,
|
|
27
|
+
},
|
|
18
28
|
check: {
|
|
19
29
|
width: 512,
|
|
20
30
|
height: 512,
|
|
@@ -30,11 +40,21 @@ module.exports = {
|
|
|
30
40
|
height: 512,
|
|
31
41
|
data: `<path d="M41.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 278.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z" fill="currentColor"/>`,
|
|
32
42
|
},
|
|
43
|
+
chevronsLeft: {
|
|
44
|
+
width: 512,
|
|
45
|
+
height: 512,
|
|
46
|
+
data: `<path d="M41.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 278.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192zm384-192l-192 192c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L301.3 256 470.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0z" fill="currentColor"/>`,
|
|
47
|
+
},
|
|
33
48
|
chevronRight: {
|
|
34
49
|
width: 384,
|
|
35
50
|
height: 512,
|
|
36
51
|
data: `<path d="M342.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L274.7 256 105.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z" fill="currentColor"/>`,
|
|
37
52
|
},
|
|
53
|
+
chevronsRight: {
|
|
54
|
+
width: 512,
|
|
55
|
+
height: 512,
|
|
56
|
+
data: `<path d="M470.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-192-192c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L402.7 256 233.4 425.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l192-192zm-384 192l192-192c12.5-12.5 12.5-32.8 0-45.3l-192-192c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L210.7 256 41.4 425.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0z" fill="currentColor"/>`,
|
|
57
|
+
},
|
|
38
58
|
chevronUp: {
|
|
39
59
|
width: 512,
|
|
40
60
|
height: 512,
|
package/utils/tailwind-config.js
CHANGED
|
@@ -33,11 +33,13 @@ module.exports = {
|
|
|
33
33
|
colors: {
|
|
34
34
|
inherit: "inherit",
|
|
35
35
|
lightHigh: "#111827",
|
|
36
|
-
lightMedium: "#
|
|
37
|
-
lightLow: "#
|
|
36
|
+
lightMedium: "#4b5563",
|
|
37
|
+
lightLow: "#9ca3af",
|
|
38
38
|
darkHigh: "#ffffff",
|
|
39
39
|
darkMedium: "#ffffffcc",
|
|
40
40
|
darkLow: "#ffffff80",
|
|
41
|
+
lightBorder: "#e5e7eb",
|
|
42
|
+
darkBorder: "#374151",
|
|
41
43
|
primary: {
|
|
42
44
|
50: "#eff6ff",
|
|
43
45
|
100: "#dbeafe",
|