@infonomic/uikit 5.44.0 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -3
- package/dist/components/accordion/accordion.d.ts +9 -9
- package/dist/components/accordion/accordion.d.ts.map +1 -1
- package/dist/components/accordion/accordion.js +4 -4
- package/dist/components/accordion/accordion.module.css +6 -5
- package/dist/components/accordion/accordion_module.css +4 -4
- package/dist/components/avatar/avatar.js +2 -2
- package/dist/components/badge/badge.d.ts +5 -13
- package/dist/components/badge/badge.d.ts.map +1 -1
- package/dist/components/badge/badge.js +12 -9
- package/dist/components/button/button-group.d.ts +9 -7
- package/dist/components/button/button-group.d.ts.map +1 -1
- package/dist/components/button/button-group.js +26 -36
- package/dist/components/button/button.d.ts +6 -13
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/button.js +19 -18
- package/dist/components/button/button.module.css +32 -54
- package/dist/components/button/button_module.css +7 -10
- package/dist/components/button/combo-button.d.ts +1 -1
- package/dist/components/button/combo-button.d.ts.map +1 -1
- package/dist/components/button/combo-button.js +13 -9
- package/dist/components/button/combo-button.module.css +16 -7
- package/dist/components/button/combo-button_module.css +22 -4
- package/dist/components/button/icon-button.d.ts +2 -3
- package/dist/components/button/icon-button.d.ts.map +1 -1
- package/dist/components/card/card.d.ts +5 -12
- package/dist/components/card/card.d.ts.map +1 -1
- package/dist/components/card/card.js +13 -9
- package/dist/components/chips/chip.d.ts +5 -11
- package/dist/components/chips/chip.d.ts.map +1 -1
- package/dist/components/chips/chip.js +36 -28
- package/dist/components/chips/chip.module.css +22 -36
- package/dist/components/chips/chip_module.css +3 -6
- package/dist/components/dropdown/dropdown.d.ts +28 -14
- package/dist/components/dropdown/dropdown.d.ts.map +1 -1
- package/dist/components/dropdown/dropdown.js +34 -20
- package/dist/components/forms/calendar.d.ts +1 -1
- package/dist/components/forms/calendar.d.ts.map +1 -1
- package/dist/components/forms/calendar.js +38 -29
- package/dist/components/forms/checkbox.astro +13 -8
- package/dist/components/forms/checkbox.d.ts +6 -2
- package/dist/components/forms/checkbox.d.ts.map +1 -1
- package/dist/components/forms/checkbox.js +11 -7
- package/dist/components/forms/checkbox.module.css +20 -20
- package/dist/components/forms/checkbox_module.css +13 -10
- package/dist/components/forms/input.module.css +10 -11
- package/dist/components/forms/input_module.css +3 -5
- package/dist/components/forms/radio-group.d.ts +6 -5
- package/dist/components/forms/radio-group.d.ts.map +1 -1
- package/dist/components/forms/radio-group.js +9 -4
- package/dist/components/forms/radio-group.module.css +13 -22
- package/dist/components/forms/radio-group_module.css +6 -24
- package/dist/components/forms/select.d.ts +4 -5
- package/dist/components/forms/select.d.ts.map +1 -1
- package/dist/components/forms/select.js +27 -29
- package/dist/components/forms/select.module.css +22 -22
- package/dist/components/forms/select.module.js +15 -15
- package/dist/components/forms/select_module.css +15 -15
- package/dist/components/notifications/@types/toast.d.ts +9 -7
- package/dist/components/notifications/@types/toast.d.ts.map +1 -1
- package/dist/components/notifications/toast.d.ts +12 -16
- package/dist/components/notifications/toast.d.ts.map +1 -1
- package/dist/components/notifications/toast.js +73 -57
- package/dist/components/notifications/toast.module.css +151 -177
- package/dist/components/notifications/toast.module.js +8 -12
- package/dist/components/notifications/toast_module.css +114 -159
- package/dist/components/pager/first-button.d.ts +2 -2
- package/dist/components/pager/first-button.d.ts.map +1 -1
- package/dist/components/pager/first-button.js +23 -16
- package/dist/components/pager/last-button.d.ts +2 -2
- package/dist/components/pager/last-button.d.ts.map +1 -1
- package/dist/components/pager/last-button.js +23 -16
- package/dist/components/pager/next-button.d.ts +2 -2
- package/dist/components/pager/next-button.d.ts.map +1 -1
- package/dist/components/pager/next-button.js +27 -20
- package/dist/components/pager/number-button.d.ts +2 -2
- package/dist/components/pager/number-button.d.ts.map +1 -1
- package/dist/components/pager/number-button.js +28 -23
- package/dist/components/pager/pagination.d.ts +8 -13
- package/dist/components/pager/pagination.d.ts.map +1 -1
- package/dist/components/pager/previous-button.d.ts +2 -2
- package/dist/components/pager/previous-button.d.ts.map +1 -1
- package/dist/components/pager/previous-button.js +25 -18
- package/dist/components/scroll-area/scroll-area.d.ts +2 -2
- package/dist/components/scroll-area/scroll-area.d.ts.map +1 -1
- package/dist/components/scroll-area/scroll-area.js +4 -2
- package/dist/components/tabs/tabs.d.ts +13 -13
- package/dist/components/tabs/tabs.d.ts.map +1 -1
- package/dist/components/tabs/tabs.js +8 -8
- package/dist/components/tabs/tabs.module.css +8 -17
- package/dist/components/tabs/tabs_module.css +1 -1
- package/dist/components/tooltip/tooltip.d.ts +6 -8
- package/dist/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/tooltip/tooltip.js +49 -20
- package/dist/components/tooltip/tooltip.module.css +43 -10
- package/dist/components/tooltip/tooltip.module.js +7 -1
- package/dist/components/tooltip/tooltip_module.css +36 -4
- package/dist/hooks/use-focus-trap/index.d.ts +2 -0
- package/dist/hooks/use-focus-trap/index.d.ts.map +1 -0
- package/dist/hooks/use-focus-trap/index.js +1 -0
- package/dist/hooks/use-focus-trap/scope-tab.d.ts +11 -0
- package/dist/hooks/use-focus-trap/scope-tab.d.ts.map +1 -0
- package/dist/hooks/use-focus-trap/scope-tab.js +19 -0
- package/dist/hooks/use-focus-trap/tabbable.d.ts +14 -0
- package/dist/hooks/use-focus-trap/tabbable.d.ts.map +1 -0
- package/dist/hooks/use-focus-trap/tabbable.js +36 -0
- package/dist/hooks/use-focus-trap/use-focus-trap.d.ts +11 -0
- package/dist/hooks/use-focus-trap/use-focus-trap.d.ts.map +1 -0
- package/dist/hooks/use-focus-trap/use-focus-trap.js +45 -0
- package/dist/icons/chevron-up-icon.d.ts +7 -0
- package/dist/icons/chevron-up-icon.d.ts.map +1 -0
- package/dist/icons/chevron-up-icon.js +27 -0
- package/dist/lib/ripple.d.ts +25 -0
- package/dist/lib/ripple.d.ts.map +1 -0
- package/dist/lib/ripple.js +53 -0
- package/dist/styles/components-vanilla.css +1 -1
- package/dist/widgets/datepicker/datepicker.d.ts +1 -1
- package/dist/widgets/datepicker/datepicker.d.ts.map +1 -1
- package/dist/widgets/datepicker/datepicker.js +118 -116
- package/dist/widgets/datepicker/datepicker.module.css +6 -5
- package/dist/widgets/datepicker/datepicker_module.css +4 -4
- package/dist/widgets/drawer/drawer-wrapper.d.ts.map +1 -1
- package/dist/widgets/drawer/drawer-wrapper.js +1 -1
- package/dist/widgets/modal/modal-wrapper.d.ts.map +1 -1
- package/dist/widgets/modal/modal-wrapper.js +1 -1
- package/package.json +2 -6
- package/src/components/accordion/accordion.module.css +6 -5
- package/src/components/accordion/accordion.stories.tsx +10 -13
- package/src/components/accordion/accordion.tsx +13 -13
- package/src/components/avatar/avatar.tsx +2 -2
- package/src/components/badge/badge.tsx +20 -29
- package/src/components/button/button-group.tsx +60 -44
- package/src/components/button/button.module.css +32 -54
- package/src/components/button/button.tsx +35 -47
- package/src/components/button/combo-button.module.css +16 -7
- package/src/components/button/combo-button.tsx +17 -9
- package/src/components/button/icon-button.tsx +3 -5
- package/src/components/card/card.tsx +20 -32
- package/src/components/chips/chip.module.css +22 -36
- package/src/components/chips/chip.stories.tsx +2 -2
- package/src/components/chips/chip.tsx +59 -57
- package/src/components/dropdown/dropdown.stories.tsx +2 -4
- package/src/components/dropdown/dropdown.tsx +86 -40
- package/src/components/forms/calendar.tsx +43 -33
- package/src/components/forms/checkbox-group.tsx +1 -1
- package/src/components/forms/checkbox.astro +13 -8
- package/src/components/forms/checkbox.module.css +20 -20
- package/src/components/forms/checkbox.tsx +11 -6
- package/src/components/forms/input.module.css +10 -11
- package/src/components/forms/radio-group.module.css +13 -22
- package/src/components/forms/radio-group.tsx +13 -11
- package/src/components/forms/select.module.css +22 -22
- package/src/components/forms/select.tsx +36 -33
- package/src/components/notifications/@types/toast.ts +9 -7
- package/src/components/notifications/toast.module.css +151 -177
- package/src/components/notifications/toast.stories.tsx +21 -23
- package/src/components/notifications/toast.tsx +90 -86
- package/src/components/pager/first-button.tsx +24 -26
- package/src/components/pager/last-button.tsx +24 -25
- package/src/components/pager/next-button.tsx +24 -23
- package/src/components/pager/number-button.tsx +37 -36
- package/src/components/pager/pagination.tsx +4 -11
- package/src/components/pager/previous-button.tsx +24 -24
- package/src/components/scroll-area/scroll-area.tsx +3 -3
- package/src/components/tabs/tabs.module.css +8 -17
- package/src/components/tabs/tabs.stories.tsx +5 -5
- package/src/components/tabs/tabs.tsx +17 -16
- package/src/components/tooltip/tooltip.module.css +43 -10
- package/src/components/tooltip/tooltip.stories.tsx +4 -4
- package/src/components/tooltip/tooltip.tsx +56 -28
- package/src/hooks/use-focus-trap/index.ts +1 -0
- package/src/hooks/use-focus-trap/scope-tab.ts +48 -0
- package/src/hooks/use-focus-trap/tabbable.ts +72 -0
- package/src/hooks/use-focus-trap/use-focus-trap.ts +83 -0
- package/src/icons/chevron-up-icon.tsx +37 -0
- package/src/lib/ripple.ts +95 -0
- package/src/widgets/datepicker/datepicker.module.css +6 -5
- package/src/widgets/datepicker/datepicker.tsx +137 -135
- package/src/widgets/drawer/drawer-wrapper.tsx +1 -1
- package/src/widgets/modal/modal-wrapper.tsx +1 -1
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Material-style ripple effect.
|
|
3
|
+
*
|
|
4
|
+
* Based on material-ripple-effects by Sajad Ahmad Nawabi (https://github.com/sajadevo/material-ripple-effects)
|
|
5
|
+
* Original work licensed under the MIT License.
|
|
6
|
+
* Copyright (c) 2021 Sajad Ahmad Nawabi
|
|
7
|
+
*
|
|
8
|
+
* Adapted for use as an internal ESM/TypeScript module with minor improvements.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export type RippleColor = 'light' | 'dark'
|
|
12
|
+
|
|
13
|
+
export class Ripple {
|
|
14
|
+
private x = 0
|
|
15
|
+
private y = 0
|
|
16
|
+
private z = 0
|
|
17
|
+
|
|
18
|
+
private findFurthestPoint(
|
|
19
|
+
clickPointX: number,
|
|
20
|
+
elementWidth: number,
|
|
21
|
+
offsetX: number,
|
|
22
|
+
clickPointY: number,
|
|
23
|
+
elementHeight: number,
|
|
24
|
+
offsetY: number
|
|
25
|
+
): number {
|
|
26
|
+
this.x = clickPointX - offsetX > elementWidth / 2 ? 0 : elementWidth
|
|
27
|
+
this.y = clickPointY - offsetY > elementHeight / 2 ? 0 : elementHeight
|
|
28
|
+
this.z = Math.hypot(this.x - (clickPointX - offsetX), this.y - (clickPointY - offsetY))
|
|
29
|
+
|
|
30
|
+
return this.z
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
private applyStyles(
|
|
34
|
+
element: HTMLSpanElement,
|
|
35
|
+
color: RippleColor,
|
|
36
|
+
rect: DOMRect,
|
|
37
|
+
radius: number,
|
|
38
|
+
clientX: number,
|
|
39
|
+
clientY: number
|
|
40
|
+
): void {
|
|
41
|
+
element.classList.add('ripple')
|
|
42
|
+
element.style.backgroundColor = color === 'dark' ? 'rgba(0,0,0, 0.2)' : 'rgba(255,255,255, 0.3)'
|
|
43
|
+
element.style.borderRadius = '50%'
|
|
44
|
+
element.style.pointerEvents = 'none'
|
|
45
|
+
element.style.position = 'absolute'
|
|
46
|
+
element.style.left = clientX - rect.left - radius + 'px'
|
|
47
|
+
element.style.top = clientY - rect.top - radius + 'px'
|
|
48
|
+
element.style.width = element.style.height = radius * 2 + 'px'
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
private applyAnimation(element: HTMLSpanElement): void {
|
|
52
|
+
element.animate(
|
|
53
|
+
[
|
|
54
|
+
{ transform: 'scale(0)', opacity: 1 },
|
|
55
|
+
{ transform: 'scale(1.5)', opacity: 0 },
|
|
56
|
+
],
|
|
57
|
+
{
|
|
58
|
+
duration: 500,
|
|
59
|
+
easing: 'linear',
|
|
60
|
+
}
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
create(
|
|
65
|
+
event: MouseEvent | { clientX: number; clientY: number; currentTarget: EventTarget | null },
|
|
66
|
+
color: RippleColor = 'light'
|
|
67
|
+
): void {
|
|
68
|
+
const element = event.currentTarget as HTMLElement
|
|
69
|
+
|
|
70
|
+
element.style.position = 'relative'
|
|
71
|
+
element.style.overflow = 'hidden'
|
|
72
|
+
|
|
73
|
+
const rect = element.getBoundingClientRect()
|
|
74
|
+
|
|
75
|
+
const radius = this.findFurthestPoint(
|
|
76
|
+
event.clientX,
|
|
77
|
+
element.offsetWidth,
|
|
78
|
+
rect.left,
|
|
79
|
+
event.clientY,
|
|
80
|
+
element.offsetHeight,
|
|
81
|
+
rect.top
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
const circle = document.createElement('span')
|
|
85
|
+
|
|
86
|
+
this.applyStyles(circle, color, rect, radius, event.clientX, event.clientY)
|
|
87
|
+
this.applyAnimation(circle)
|
|
88
|
+
|
|
89
|
+
element.appendChild(circle)
|
|
90
|
+
|
|
91
|
+
setTimeout(() => circle.remove(), 500)
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export default Ripple
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
@layer infonomic-base, infonomic-utilities, infonomic-theme, infonomic-components;
|
|
2
2
|
|
|
3
3
|
@layer infonomic-components {
|
|
4
|
+
|
|
4
5
|
.container,
|
|
5
6
|
:global(.infonomic-datepicker-container) {
|
|
6
7
|
position: relative;
|
|
@@ -33,19 +34,19 @@
|
|
|
33
34
|
box-shadow: var(--shadow-md);
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
&[data-
|
|
37
|
+
&[data-open][data-side="top"] {
|
|
37
38
|
animation-name: slideDownAndFade;
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
&[data-
|
|
41
|
+
&[data-open][data-side="right"] {
|
|
41
42
|
animation-name: slideLeftAndFade;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
&[data-
|
|
45
|
+
&[data-open][data-side="bottom"] {
|
|
45
46
|
animation-name: slideUpAndFade;
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
&[data-
|
|
49
|
+
&[data-open][data-side="left"] {
|
|
49
50
|
animation-name: slideRightAndFade;
|
|
50
51
|
}
|
|
51
52
|
}
|
|
@@ -204,4 +205,4 @@
|
|
|
204
205
|
transform: translateX(0);
|
|
205
206
|
}
|
|
206
207
|
}
|
|
207
|
-
}
|
|
208
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @file DatePicker component using react-day-picker and
|
|
4
|
+
* @file DatePicker component using react-day-picker and @base-ui/react
|
|
5
5
|
* Portions copyright (c) 2023 Maliksidk19 licensed under the MIT
|
|
6
6
|
* license found in the LICENSE file in the root directory of this source tree.
|
|
7
7
|
* of https://github.com/Maliksidk19/shadcn-datetime-picker/
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
import type React from 'react'
|
|
11
11
|
import { useEffect, useRef, useState } from 'react'
|
|
12
12
|
|
|
13
|
+
import { Popover } from '@base-ui/react/popover'
|
|
13
14
|
import cx from 'classnames'
|
|
14
15
|
import { format } from 'date-fns'
|
|
15
|
-
import { Popover } from 'radix-ui'
|
|
16
16
|
|
|
17
17
|
import { Button } from '../../components/button/button.js'
|
|
18
18
|
import { IconButton } from '../../components/button/icon-button.js'
|
|
@@ -70,8 +70,8 @@ export function DatePicker({
|
|
|
70
70
|
inputWrapperClassName,
|
|
71
71
|
containerClassName,
|
|
72
72
|
contentClassName,
|
|
73
|
-
onClear = () => {},
|
|
74
|
-
onDateChange = () => {},
|
|
73
|
+
onClear = () => { },
|
|
74
|
+
onDateChange = () => { },
|
|
75
75
|
validatorFn,
|
|
76
76
|
helpText,
|
|
77
77
|
errorText,
|
|
@@ -198,152 +198,154 @@ export function DatePicker({
|
|
|
198
198
|
</div>
|
|
199
199
|
|
|
200
200
|
<Popover.Root open={isOpen} onOpenChange={setIsOpen}>
|
|
201
|
-
<Popover.Trigger
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
201
|
+
<Popover.Trigger
|
|
202
|
+
nativeButton={false}
|
|
203
|
+
render={<div style={{ position: 'relative', height: '1px' }} />}
|
|
204
|
+
>
|
|
205
|
+
<span className="sr-only">Select date</span>
|
|
205
206
|
</Popover.Trigger>
|
|
206
207
|
<Popover.Portal>
|
|
207
|
-
<Popover.
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
>
|
|
211
|
-
<div
|
|
212
|
-
className={cx(
|
|
213
|
-
'infonomic-datepicker-content-components',
|
|
214
|
-
styles['content-components']
|
|
215
|
-
)}
|
|
208
|
+
<Popover.Positioner sideOffset={5}>
|
|
209
|
+
<Popover.Popup
|
|
210
|
+
className={cx('infonomic-datepicker-content', styles.content, contentClassName)}
|
|
216
211
|
>
|
|
217
|
-
<div
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
212
|
+
<div
|
|
213
|
+
className={cx(
|
|
214
|
+
'infonomic-datepicker-content-components',
|
|
215
|
+
styles['content-components']
|
|
216
|
+
)}
|
|
217
|
+
>
|
|
218
|
+
<div ref={calendarRef}>
|
|
219
|
+
<Calendar
|
|
220
|
+
mode="single"
|
|
221
|
+
required
|
|
222
|
+
captionLayout="dropdown"
|
|
223
|
+
selected={date ?? undefined}
|
|
224
|
+
month={month ?? undefined}
|
|
225
|
+
onMonthChange={setMonth}
|
|
226
|
+
onSelect={(selectedDate: Date) => {
|
|
227
|
+
if (selectedDate) {
|
|
228
|
+
const [hours, minutes] = time.split(':')
|
|
229
|
+
selectedDate.setHours(
|
|
230
|
+
Number.parseInt(hours, 10),
|
|
231
|
+
Number.parseInt(minutes, 10)
|
|
232
|
+
)
|
|
233
|
+
setDate(selectedDate)
|
|
234
|
+
setMonth(selectedDate)
|
|
235
|
+
handleOnDateChange(selectedDate)
|
|
236
|
+
}
|
|
237
|
+
}}
|
|
238
|
+
startMonth={new Date(new Date().getFullYear() - yearsInPast, 0)}
|
|
239
|
+
endMonth={new Date(new Date().getFullYear() + yearsInFuture, 0)}
|
|
239
240
|
// TODO: add props
|
|
240
241
|
// disabled={(date) =>
|
|
241
242
|
// Number(date) < Date.now() - 1000 * 60 * 60 * 24 ||
|
|
242
243
|
// Number(date) > Date.now() + 1000 * 60 * 60 * 24 * 30
|
|
243
244
|
// }
|
|
244
|
-
|
|
245
|
-
</div>
|
|
246
|
-
{mode === 'datetime' && (
|
|
247
|
-
<div className={styles['time-picker-container']}>
|
|
248
|
-
<ScrollArea className={styles['time-picker-scroll-area']}>
|
|
249
|
-
<div className={styles['time-picker']}>
|
|
250
|
-
{Array.from({ length: 96 }).map((_, i) => {
|
|
251
|
-
const hour = Math.floor(i / 4)
|
|
252
|
-
.toString()
|
|
253
|
-
.padStart(2, '0')
|
|
254
|
-
const minute = ((i % 4) * 15).toString().padStart(2, '0')
|
|
255
|
-
const timeValue = `${hour}:${minute}`
|
|
256
|
-
return (
|
|
257
|
-
<Button
|
|
258
|
-
key={i}
|
|
259
|
-
size="sm"
|
|
260
|
-
className={styles['time-picker-button']}
|
|
261
|
-
variant="outlined"
|
|
262
|
-
onClick={() => {
|
|
263
|
-
setTime(timeValue)
|
|
264
|
-
if (date) {
|
|
265
|
-
const newDate = new Date(date.getTime())
|
|
266
|
-
newDate.setHours(
|
|
267
|
-
Number.parseInt(hour, 10),
|
|
268
|
-
Number.parseInt(minute, 10),
|
|
269
|
-
0
|
|
270
|
-
)
|
|
271
|
-
setDate(newDate)
|
|
272
|
-
handleOnDateChange(newDate)
|
|
273
|
-
}
|
|
274
|
-
}}
|
|
275
|
-
>
|
|
276
|
-
{timeValue}
|
|
277
|
-
</Button>
|
|
278
|
-
)
|
|
279
|
-
})}
|
|
280
|
-
</div>
|
|
281
|
-
</ScrollArea>
|
|
245
|
+
/>
|
|
282
246
|
</div>
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
247
|
+
{mode === 'datetime' && (
|
|
248
|
+
<div className={styles['time-picker-container']}>
|
|
249
|
+
<ScrollArea className={styles['time-picker-scroll-area']}>
|
|
250
|
+
<div className={styles['time-picker']}>
|
|
251
|
+
{Array.from({ length: 96 }).map((_, i) => {
|
|
252
|
+
const hour = Math.floor(i / 4)
|
|
253
|
+
.toString()
|
|
254
|
+
.padStart(2, '0')
|
|
255
|
+
const minute = ((i % 4) * 15).toString().padStart(2, '0')
|
|
256
|
+
const timeValue = `${hour}:${minute}`
|
|
257
|
+
return (
|
|
258
|
+
<Button
|
|
259
|
+
key={i}
|
|
260
|
+
size="sm"
|
|
261
|
+
className={styles['time-picker-button']}
|
|
262
|
+
variant="outlined"
|
|
263
|
+
onClick={() => {
|
|
264
|
+
setTime(timeValue)
|
|
265
|
+
if (date) {
|
|
266
|
+
const newDate = new Date(date.getTime())
|
|
267
|
+
newDate.setHours(
|
|
268
|
+
Number.parseInt(hour, 10),
|
|
269
|
+
Number.parseInt(minute, 10),
|
|
270
|
+
0
|
|
271
|
+
)
|
|
272
|
+
setDate(newDate)
|
|
273
|
+
handleOnDateChange(newDate)
|
|
274
|
+
}
|
|
275
|
+
}}
|
|
276
|
+
>
|
|
277
|
+
{timeValue}
|
|
278
|
+
</Button>
|
|
279
|
+
)
|
|
280
|
+
})}
|
|
281
|
+
</div>
|
|
282
|
+
</ScrollArea>
|
|
283
|
+
</div>
|
|
284
|
+
)}
|
|
293
285
|
</div>
|
|
294
286
|
<div
|
|
295
|
-
className={cx(
|
|
287
|
+
className={cx(
|
|
288
|
+
'infonomic-datepicker-status-and-actions',
|
|
289
|
+
styles['status-and-actions']
|
|
290
|
+
)}
|
|
296
291
|
>
|
|
297
|
-
<div>
|
|
298
|
-
|
|
299
|
-
variant="outlined"
|
|
300
|
-
size="sm"
|
|
301
|
-
className={cx(
|
|
302
|
-
'infonomic-datepicker-content-actions-button',
|
|
303
|
-
styles['content-actions-button']
|
|
304
|
-
)}
|
|
305
|
-
onClick={() => {
|
|
306
|
-
const today = new Date()
|
|
307
|
-
setDate(today)
|
|
308
|
-
setMonth(today)
|
|
309
|
-
handleOnDateChange(today)
|
|
310
|
-
}}
|
|
311
|
-
>
|
|
312
|
-
Today
|
|
313
|
-
</Button>
|
|
292
|
+
<div className={cx('infonomic-datepicker-content-status', styles['content-status'])}>
|
|
293
|
+
{date ? format(date, mode === 'datetime' ? 'PPPp' : 'PPP') : 'No date selected'}
|
|
314
294
|
</div>
|
|
315
|
-
<div
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
295
|
+
<div
|
|
296
|
+
className={cx('infonomic-datepicker-content-actions', styles['content-actions'])}
|
|
297
|
+
>
|
|
298
|
+
<div>
|
|
299
|
+
<Button
|
|
300
|
+
variant="outlined"
|
|
301
|
+
size="sm"
|
|
302
|
+
className={cx(
|
|
303
|
+
'infonomic-datepicker-content-actions-button',
|
|
304
|
+
styles['content-actions-button']
|
|
305
|
+
)}
|
|
306
|
+
onClick={() => {
|
|
307
|
+
const today = new Date()
|
|
308
|
+
setDate(today)
|
|
309
|
+
setMonth(today)
|
|
310
|
+
handleOnDateChange(today)
|
|
311
|
+
}}
|
|
312
|
+
>
|
|
313
|
+
Today
|
|
314
|
+
</Button>
|
|
315
|
+
</div>
|
|
316
|
+
<div style={{ display: 'flex', gap: 'var(--spacing-12)' }}>
|
|
317
|
+
<Button
|
|
318
|
+
size="sm"
|
|
319
|
+
intent="noeffect"
|
|
320
|
+
className={cx(
|
|
321
|
+
'infonomic-datepicker-content-actions-button',
|
|
322
|
+
styles['content-actions-button']
|
|
323
|
+
)}
|
|
324
|
+
onClick={() => {
|
|
325
|
+
setIsOpen(false)
|
|
326
|
+
}}
|
|
327
|
+
>
|
|
328
|
+
Cancel
|
|
329
|
+
</Button>
|
|
330
|
+
<Button
|
|
331
|
+
variant="outlined"
|
|
332
|
+
size="sm"
|
|
333
|
+
className={cx(
|
|
334
|
+
'infonomic-datepicker-content-actions-button',
|
|
335
|
+
styles['content-actions-button']
|
|
336
|
+
)}
|
|
337
|
+
onClick={() => {
|
|
338
|
+
setIsOpen(false)
|
|
339
|
+
handleOnDateChange(date)
|
|
340
|
+
}}
|
|
341
|
+
>
|
|
342
|
+
Select
|
|
343
|
+
</Button>
|
|
344
|
+
</div>
|
|
343
345
|
</div>
|
|
344
346
|
</div>
|
|
345
|
-
</
|
|
346
|
-
</Popover.
|
|
347
|
+
</Popover.Popup>
|
|
348
|
+
</Popover.Positioner>
|
|
347
349
|
</Popover.Portal>
|
|
348
350
|
</Popover.Root>
|
|
349
351
|
</div>
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
import type React from 'react'
|
|
5
5
|
import { useEffect } from 'react'
|
|
6
6
|
|
|
7
|
-
import { useFocusTrap } from '@mantine/hooks'
|
|
8
7
|
import cx from 'classnames'
|
|
9
8
|
import type { HTMLMotionProps } from 'motion/react'
|
|
10
9
|
import { m } from 'motion/react'
|
|
11
10
|
|
|
11
|
+
import { useFocusTrap } from '../../hooks/use-focus-trap/index.js'
|
|
12
12
|
import styles from './drawer.module.css'
|
|
13
13
|
|
|
14
14
|
export interface DrawerWrapperProps extends HTMLMotionProps<'div'> {
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
import type React from 'react'
|
|
5
5
|
import { useEffect } from 'react'
|
|
6
6
|
|
|
7
|
-
import { useFocusTrap } from '@mantine/hooks'
|
|
8
7
|
import cx from 'classnames'
|
|
9
8
|
import type { HTMLMotionProps } from 'motion/react'
|
|
10
9
|
import { m } from 'motion/react'
|
|
11
10
|
|
|
11
|
+
import { useFocusTrap } from '../../hooks/use-focus-trap/index.js'
|
|
12
12
|
import styles from './modal.module.css'
|
|
13
13
|
|
|
14
14
|
export interface ModalWrapperProps extends HTMLMotionProps<'div'> {
|