@open-mercato/ui 0.6.7-develop.6788.1.c2a1520a30 → 0.6.7-develop.6814.1.0627c7e9f1
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/AGENTS.md +4 -2
- package/dist/backend/NextStepCallout.js +4 -4
- package/dist/backend/NextStepCallout.js.map +1 -1
- package/dist/backend/detail/AddressTiles.js +4 -5
- package/dist/backend/detail/AddressTiles.js.map +2 -2
- package/dist/backend/detail/AttachmentMetadataDialog.js.map +1 -1
- package/dist/backend/schedule/ScheduleToolbar.js +87 -70
- package/dist/backend/schedule/ScheduleToolbar.js.map +2 -2
- package/figma/alert.figma.tsx +35 -0
- package/figma/badge.figma.tsx +33 -0
- package/figma/button.figma.tsx +33 -0
- package/figma/checkbox.figma.tsx +28 -0
- package/figma/drawer.figma.tsx +40 -0
- package/figma/input-variants.figma.tsx +58 -0
- package/figma/radio.figma.tsx +16 -0
- package/figma/select.figma.tsx +24 -0
- package/figma/status-badge.figma.tsx +24 -0
- package/figma/switch.figma.tsx +28 -0
- package/figma/tabs.figma.tsx +22 -0
- package/figma/tag.figma.tsx +27 -0
- package/figma.config.json +6 -0
- package/package.json +17 -16
- package/src/backend/NextStepCallout.tsx +4 -4
- package/src/backend/__tests__/CrudForm.groupInjectionColumn.test.tsx +98 -0
- package/src/backend/detail/AddressTiles.tsx +3 -6
- package/src/backend/detail/AttachmentMetadataDialog.tsx +1 -1
- package/src/backend/detail/__tests__/AttachmentAssignmentsEditor.test.tsx +21 -0
- package/src/backend/schedule/ScheduleToolbar.tsx +89 -68
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import figma from '@figma/code-connect'
|
|
3
|
+
import { Tag } from '../src/primitives/tag'
|
|
4
|
+
|
|
5
|
+
// TODO(figma): resolve the real node id in the DS file before ds:code-connect:publish.
|
|
6
|
+
figma.connect(Tag, 'https://www.figma.com/design/qCq9z6q1if0mpoRstV5OEA/Design-System?node-id=0-1', {
|
|
7
|
+
imports: ["import { Tag } from '@open-mercato/ui/primitives/tag'"],
|
|
8
|
+
props: {
|
|
9
|
+
variant: figma.enum('Variant', {
|
|
10
|
+
Default: 'default',
|
|
11
|
+
Success: 'success',
|
|
12
|
+
Warning: 'warning',
|
|
13
|
+
Error: 'error',
|
|
14
|
+
Info: 'info',
|
|
15
|
+
Neutral: 'neutral',
|
|
16
|
+
Brand: 'brand',
|
|
17
|
+
Pink: 'pink',
|
|
18
|
+
}),
|
|
19
|
+
dot: figma.boolean('Dot'),
|
|
20
|
+
label: figma.string('Label'),
|
|
21
|
+
},
|
|
22
|
+
example: ({ variant, dot, label }) => (
|
|
23
|
+
<Tag variant={variant} dot={dot}>
|
|
24
|
+
{label}
|
|
25
|
+
</Tag>
|
|
26
|
+
),
|
|
27
|
+
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-mercato/ui",
|
|
3
|
-
"version": "0.6.7-develop.
|
|
3
|
+
"version": "0.6.7-develop.6814.1.0627c7e9f1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -137,31 +137,32 @@
|
|
|
137
137
|
"@dnd-kit/sortable": "^10.0.0",
|
|
138
138
|
"@dnd-kit/utilities": "^3.2.2",
|
|
139
139
|
"@mdxeditor/editor": "^4.0.4",
|
|
140
|
-
"@radix-ui/react-accordion": "^1.2.
|
|
141
|
-
"@radix-ui/react-dialog": "^1.1.
|
|
142
|
-
"@radix-ui/react-popover": "^1.1.
|
|
143
|
-
"@radix-ui/react-radio-group": "^1.4.
|
|
144
|
-
"@radix-ui/react-scroll-area": "^1.2.
|
|
145
|
-
"@radix-ui/react-select": "^2.3.
|
|
146
|
-
"@radix-ui/react-slider": "^1.4.
|
|
147
|
-
"@radix-ui/react-tooltip": "^1.2.
|
|
140
|
+
"@radix-ui/react-accordion": "^1.2.20",
|
|
141
|
+
"@radix-ui/react-dialog": "^1.1.23",
|
|
142
|
+
"@radix-ui/react-popover": "^1.1.23",
|
|
143
|
+
"@radix-ui/react-radio-group": "^1.4.7",
|
|
144
|
+
"@radix-ui/react-scroll-area": "^1.2.18",
|
|
145
|
+
"@radix-ui/react-select": "^2.3.7",
|
|
146
|
+
"@radix-ui/react-slider": "^1.4.7",
|
|
147
|
+
"@radix-ui/react-tooltip": "^1.2.16",
|
|
148
148
|
"@tanstack/react-virtual": "^3.14.6",
|
|
149
149
|
"cmdk": "^1.0.0",
|
|
150
150
|
"date-fns": "4.4.0",
|
|
151
151
|
"react-big-calendar": "^1.20.0",
|
|
152
152
|
"react-day-picker": "^10.0.1",
|
|
153
153
|
"react-markdown": "^10.1.0",
|
|
154
|
-
"recharts": "^3.
|
|
154
|
+
"recharts": "^3.10.1",
|
|
155
155
|
"remark-gfm": "^4.0.1"
|
|
156
156
|
},
|
|
157
157
|
"peerDependencies": {
|
|
158
|
-
"@open-mercato/shared": "0.6.7-develop.
|
|
158
|
+
"@open-mercato/shared": "0.6.7-develop.6814.1.0627c7e9f1",
|
|
159
159
|
"react": ">=18.0.0",
|
|
160
160
|
"react-dom": ">=18.0.0",
|
|
161
161
|
"react-is": ">=18.0.0"
|
|
162
162
|
},
|
|
163
163
|
"devDependencies": {
|
|
164
|
-
"@
|
|
164
|
+
"@figma/code-connect": "^1.3.4",
|
|
165
|
+
"@open-mercato/shared": "0.6.7-develop.6814.1.0627c7e9f1",
|
|
165
166
|
"@testing-library/dom": "^10.4.1",
|
|
166
167
|
"@testing-library/jest-dom": "^6.9.1",
|
|
167
168
|
"@testing-library/react": "^16.3.1",
|
|
@@ -170,10 +171,10 @@
|
|
|
170
171
|
"@types/react-dom": "^19.2.3",
|
|
171
172
|
"jest": "^30.4.2",
|
|
172
173
|
"jest-environment-jsdom": "^30.4.1",
|
|
173
|
-
"react": "19.2.
|
|
174
|
-
"react-dom": "19.2.
|
|
175
|
-
"react-is": "^19.2.
|
|
176
|
-
"ts-jest": "^29.4.
|
|
174
|
+
"react": "19.2.8",
|
|
175
|
+
"react-dom": "19.2.8",
|
|
176
|
+
"react-is": "^19.2.8",
|
|
177
|
+
"ts-jest": "^29.4.12",
|
|
177
178
|
"ts-morph": "^28.0.0",
|
|
178
179
|
"typescript": "7.0.2"
|
|
179
180
|
},
|
|
@@ -42,16 +42,16 @@ type NextStepCalloutProps = {
|
|
|
42
42
|
const STEP_STYLES: Record<NonNullable<NextStepCalloutStep['state']>, string> = {
|
|
43
43
|
pending: '',
|
|
44
44
|
active: 'border-primary/40 bg-primary/10 text-primary',
|
|
45
|
-
completed: 'border-
|
|
45
|
+
completed: 'border-status-success-border bg-status-success-bg text-status-success-text',
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
const STATUS_STYLES: Record<NextStepCalloutStatusTone, string> = {
|
|
49
49
|
default: 'border-border bg-background/80 text-foreground',
|
|
50
50
|
info: 'border-primary/20 bg-primary/5 text-primary',
|
|
51
|
-
success: 'border-
|
|
52
|
-
warning: 'border-
|
|
51
|
+
success: 'border-status-success-border bg-status-success-bg text-status-success-text',
|
|
52
|
+
warning: 'border-status-warning-border bg-status-warning-bg text-status-warning-text',
|
|
53
53
|
danger: 'border-destructive/20 bg-destructive/5 text-destructive',
|
|
54
|
-
muted: 'border-
|
|
54
|
+
muted: 'border-status-neutral-border bg-status-neutral-bg text-status-neutral-text',
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
export function NextStepCallout({
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/** @jest-environment jsdom */
|
|
2
|
+
jest.setTimeout(15000)
|
|
3
|
+
|
|
4
|
+
// Regression guard for #4400: an injected group widget placed in column 1 must
|
|
5
|
+
// render as a full-width row in the main stack — CrudForm must NOT switch to
|
|
6
|
+
// the narrow 7fr/3fr secondary-column layout unless a widget explicitly asks
|
|
7
|
+
// for column 2. The hook is mocked so the test drives the injected widgets
|
|
8
|
+
// directly, following the CrudForm.fieldInjection.test.tsx pattern.
|
|
9
|
+
let injectedGroupWidgets: unknown[] = []
|
|
10
|
+
|
|
11
|
+
jest.mock('next/navigation', () => ({
|
|
12
|
+
useRouter: () => ({ push: () => {} }),
|
|
13
|
+
usePathname: () => '/',
|
|
14
|
+
useSearchParams: () => new URLSearchParams(),
|
|
15
|
+
}))
|
|
16
|
+
jest.mock('remark-gfm', () => ({ __esModule: true, default: {} }))
|
|
17
|
+
jest.mock('../injection/InjectionSpot', () => ({
|
|
18
|
+
__esModule: true,
|
|
19
|
+
InjectionSpot: () => null,
|
|
20
|
+
useInjectionWidgets: () => ({ widgets: injectedGroupWidgets, loading: false, error: null }),
|
|
21
|
+
useInjectionSpotEvents: () => ({ triggerEvent: jest.fn(async () => ({ ok: true, data: {} })) }),
|
|
22
|
+
}))
|
|
23
|
+
jest.mock('../injection/useInjectionDataWidgets', () => ({
|
|
24
|
+
__esModule: true,
|
|
25
|
+
useInjectionDataWidgets: () => ({ widgets: [], isLoading: false, error: null }),
|
|
26
|
+
}))
|
|
27
|
+
|
|
28
|
+
import * as React from 'react'
|
|
29
|
+
import { waitFor } from '@testing-library/react'
|
|
30
|
+
import { renderWithProviders } from '@open-mercato/shared/lib/testing/renderWithProviders'
|
|
31
|
+
import { CrudForm, type CrudField, type CrudFormGroup } from '../CrudForm'
|
|
32
|
+
|
|
33
|
+
const fields: CrudField[] = [
|
|
34
|
+
{ id: 'name', label: 'Name', type: 'text' },
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
const groups: CrudFormGroup[] = [
|
|
38
|
+
{ id: 'contact', label: 'Contact', fields: ['name'] },
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
function makeGroupWidget(column: 1 | 2) {
|
|
42
|
+
return {
|
|
43
|
+
widgetId: 'customer_accounts.injection.company-users',
|
|
44
|
+
placement: { kind: 'group', column, groupLabel: 'Portal users', priority: 200 },
|
|
45
|
+
module: {
|
|
46
|
+
metadata: { title: 'Portal users', description: '' },
|
|
47
|
+
Widget: () => <div data-testid="portal-users-widget">portal users</div>,
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function renderForm() {
|
|
53
|
+
return renderWithProviders(
|
|
54
|
+
React.createElement(CrudForm as never, {
|
|
55
|
+
title: 'Company',
|
|
56
|
+
entityId: 'customers:company',
|
|
57
|
+
fields,
|
|
58
|
+
groups,
|
|
59
|
+
onSubmit: () => {},
|
|
60
|
+
}),
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
describe('CrudForm injected group column placement (#4400)', () => {
|
|
65
|
+
afterEach(() => {
|
|
66
|
+
injectedGroupWidgets = []
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
it('renders a column-1 group widget as a full-width row without the secondary column', async () => {
|
|
70
|
+
injectedGroupWidgets = [makeGroupWidget(1)]
|
|
71
|
+
|
|
72
|
+
const { container } = renderForm()
|
|
73
|
+
|
|
74
|
+
await waitFor(() => {
|
|
75
|
+
expect(container.querySelector('[data-testid="portal-users-widget"]')).toBeTruthy()
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
expect(container.querySelector('[data-crud-injection-region]')).toBeNull()
|
|
79
|
+
const twoColumnGrid = Array.from(container.querySelectorAll('div')).find((node) =>
|
|
80
|
+
node.className.includes('7fr_3fr'),
|
|
81
|
+
)
|
|
82
|
+
expect(twoColumnGrid).toBeUndefined()
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
it('still supports an explicit column-2 group widget via the secondary column (sanity)', async () => {
|
|
86
|
+
injectedGroupWidgets = [makeGroupWidget(2)]
|
|
87
|
+
|
|
88
|
+
const { container } = renderForm()
|
|
89
|
+
|
|
90
|
+
await waitFor(() => {
|
|
91
|
+
expect(container.querySelector('[data-testid="portal-users-widget"]')).toBeTruthy()
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
const secondaryRegion = container.querySelector('[data-crud-injection-region]')
|
|
95
|
+
expect(secondaryRegion).toBeTruthy()
|
|
96
|
+
expect(secondaryRegion?.querySelector('[data-testid="portal-users-widget"]')).toBeTruthy()
|
|
97
|
+
})
|
|
98
|
+
})
|
|
@@ -7,7 +7,7 @@ import { flash } from '@open-mercato/ui/backend/FlashMessages'
|
|
|
7
7
|
import { TabEmptyState } from '@open-mercato/ui/backend/detail'
|
|
8
8
|
import { useOrganizationScopeVersion } from '@open-mercato/shared/lib/frontend/useOrganizationScope'
|
|
9
9
|
import { normalizeCoordinateInput, validateCoordinateInput } from '@open-mercato/shared/lib/location/coordinates'
|
|
10
|
-
import { AddressView,
|
|
10
|
+
import { AddressView, type AddressFormatStrategy } from './addressFormat'
|
|
11
11
|
import AddressEditor, { type AddressTypesAdapter } from './AddressEditor'
|
|
12
12
|
import {
|
|
13
13
|
Dialog,
|
|
@@ -176,7 +176,7 @@ export function AddressTiles<C = unknown>({
|
|
|
176
176
|
t,
|
|
177
177
|
emptyLabel,
|
|
178
178
|
isSubmitting = false,
|
|
179
|
-
gridClassName = 'grid grid-cols-
|
|
179
|
+
gridClassName = 'grid grid-cols-[repeat(auto-fill,minmax(240px,1fr))] gap-2 sm:gap-4',
|
|
180
180
|
hideAddButton = false,
|
|
181
181
|
onAddActionChange,
|
|
182
182
|
emptyStateTitle,
|
|
@@ -480,7 +480,7 @@ export function AddressTiles<C = unknown>({
|
|
|
480
480
|
addressTypesAdapter={addressTypesAdapter}
|
|
481
481
|
addressTypesContext={addressTypesContext}
|
|
482
482
|
/>
|
|
483
|
-
{generalError ? <p className="text-xs text-
|
|
483
|
+
{generalError ? <p className="text-xs text-status-error-text">{generalError}</p> : null}
|
|
484
484
|
<div className="flex flex-wrap justify-end gap-2">
|
|
485
485
|
<Button type="button" variant="outline" onClick={handleCancel} disabled={disableActions}>
|
|
486
486
|
{label('cancel', 'Cancel')}
|
|
@@ -569,9 +569,6 @@ export function AddressTiles<C = unknown>({
|
|
|
569
569
|
</p>
|
|
570
570
|
) : null}
|
|
571
571
|
<AddressView address={address} format={format} className="text-sm text-foreground" />
|
|
572
|
-
<p className="text-xs text-muted-foreground">
|
|
573
|
-
{formatAddressString(address, format)}
|
|
574
|
-
</p>
|
|
575
572
|
</div>
|
|
576
573
|
<div className="flex items-center gap-1 opacity-100 md:opacity-0 transition-opacity md:group-hover:opacity-100 focus-within:opacity-100">
|
|
577
574
|
<Button
|
|
@@ -75,4 +75,25 @@ describe('AttachmentAssignmentsEditor (metadata dialog)', () => {
|
|
|
75
75
|
fireEvent.click(screen.getByRole('button', { name: 'Remove assignment' }))
|
|
76
76
|
expect(screen.queryByPlaceholderText('catalog.product')).toBeNull()
|
|
77
77
|
})
|
|
78
|
+
|
|
79
|
+
it('keeps the surviving assignment values after removing a middle row', () => {
|
|
80
|
+
render(
|
|
81
|
+
<EditorHarness
|
|
82
|
+
initial={[
|
|
83
|
+
{ type: 'catalog.product', id: 'p-1', href: '', label: '' },
|
|
84
|
+
{ type: 'sales.order', id: 'o-2', href: '', label: '' },
|
|
85
|
+
{ type: 'customers.person', id: 'c-3', href: '', label: '' },
|
|
86
|
+
]}
|
|
87
|
+
/>,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
fireEvent.click(screen.getAllByRole('button', { name: labels.remove })[1])
|
|
91
|
+
|
|
92
|
+
const typeInputs = screen.getAllByPlaceholderText('catalog.product') as HTMLInputElement[]
|
|
93
|
+
const idInputs = screen.getAllByPlaceholderText('Record ID') as HTMLInputElement[]
|
|
94
|
+
expect(typeInputs[0]).toHaveValue('catalog.product')
|
|
95
|
+
expect(idInputs[0]).toHaveValue('p-1')
|
|
96
|
+
expect(typeInputs[1]).toHaveValue('customers.person')
|
|
97
|
+
expect(idInputs[1]).toHaveValue('c-3')
|
|
98
|
+
})
|
|
78
99
|
})
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import * as React from 'react'
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { DateRangePicker } from '../../primitives/date-range-picker'
|
|
5
|
+
import { IconButton } from '../../primitives/icon-button'
|
|
6
|
+
import {
|
|
7
|
+
SegmentedControl,
|
|
8
|
+
SegmentedControlItem,
|
|
9
|
+
} from '../../primitives/segmented-control'
|
|
10
|
+
import {
|
|
11
|
+
Select,
|
|
12
|
+
SelectContent,
|
|
13
|
+
SelectItem,
|
|
14
|
+
SelectTrigger,
|
|
15
|
+
SelectValue,
|
|
16
|
+
} from '../../primitives/select'
|
|
6
17
|
import type { ScheduleRange, ScheduleViewMode } from './types'
|
|
7
18
|
import { cn } from '@open-mercato/shared/lib/utils'
|
|
8
19
|
import { useT } from '@open-mercato/shared/lib/i18n/context'
|
|
@@ -27,17 +38,19 @@ const VIEW_OPTIONS: Array<{ id: ScheduleViewMode; labelKey: string; fallback: st
|
|
|
27
38
|
{ id: 'agenda', labelKey: 'schedule.view.agenda', fallback: 'Agenda' },
|
|
28
39
|
]
|
|
29
40
|
|
|
30
|
-
function
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
function getTimezoneOptions(current?: string): string[] {
|
|
42
|
+
const options = new Set<string>()
|
|
43
|
+
if (current) options.add(current)
|
|
44
|
+
options.add('UTC')
|
|
45
|
+
const resolved = Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
46
|
+
if (resolved) options.add(resolved)
|
|
47
|
+
const intlWithSupportedValues = Intl as typeof Intl & { supportedValuesOf?: (input: 'timeZone') => string[] }
|
|
48
|
+
if (typeof intlWithSupportedValues.supportedValuesOf === 'function') {
|
|
49
|
+
intlWithSupportedValues.supportedValuesOf('timeZone').forEach((timezone) => {
|
|
50
|
+
if (timezone) options.add(timezone)
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
return Array.from(options).sort((a, b) => a.localeCompare(b))
|
|
41
54
|
}
|
|
42
55
|
|
|
43
56
|
export type ScheduleToolbarProps = {
|
|
@@ -120,68 +133,76 @@ export function ScheduleToolbar({
|
|
|
120
133
|
onRangeChange({ start: nextStart, end: endOfDay(addDays(nextStart, rangeLength - 1)) })
|
|
121
134
|
}, [onRangeChange, range.start, rangeLength, view])
|
|
122
135
|
|
|
136
|
+
const timezoneOptions = React.useMemo(() => getTimezoneOptions(timezone), [timezone])
|
|
137
|
+
|
|
123
138
|
return (
|
|
124
|
-
<div className={cn('flex flex-
|
|
125
|
-
<
|
|
139
|
+
<div className={cn('flex flex-wrap items-center gap-x-4 gap-y-2 rounded-xl border bg-card p-3', className)}>
|
|
140
|
+
<SegmentedControl
|
|
141
|
+
value={view}
|
|
142
|
+
onValueChange={(value) => {
|
|
143
|
+
const nextView = value as ScheduleViewMode
|
|
144
|
+
if (nextView === view) return
|
|
145
|
+
onViewChange(nextView)
|
|
146
|
+
onRangeChange(deriveRangeForView(new Date(), nextView))
|
|
147
|
+
}}
|
|
148
|
+
aria-label={t('schedule.view.label', 'Schedule view')}
|
|
149
|
+
className="shrink-0"
|
|
150
|
+
>
|
|
126
151
|
{VIEW_OPTIONS.map((option) => (
|
|
127
|
-
<
|
|
128
|
-
key={option.id}
|
|
129
|
-
variant={view === option.id ? 'default' : 'outline'}
|
|
130
|
-
size="sm"
|
|
131
|
-
onClick={() => {
|
|
132
|
-
if (option.id === view) return
|
|
133
|
-
onViewChange(option.id)
|
|
134
|
-
onRangeChange(deriveRangeForView(new Date(), option.id))
|
|
135
|
-
}}
|
|
136
|
-
>
|
|
152
|
+
<SegmentedControlItem key={option.id} value={option.id}>
|
|
137
153
|
{t(option.labelKey, option.fallback)}
|
|
138
|
-
</
|
|
154
|
+
</SegmentedControlItem>
|
|
139
155
|
))}
|
|
140
|
-
</
|
|
141
|
-
<div className="flex
|
|
142
|
-
<
|
|
156
|
+
</SegmentedControl>
|
|
157
|
+
<div className="flex shrink-0 items-center gap-1">
|
|
158
|
+
<IconButton
|
|
159
|
+
type="button"
|
|
160
|
+
variant="outline"
|
|
161
|
+
onClick={() => shiftRange('prev')}
|
|
162
|
+
aria-label={t('schedule.range.prev', 'Previous')}
|
|
163
|
+
>
|
|
143
164
|
<ChevronLeft className="size-4" aria-hidden />
|
|
144
|
-
</
|
|
145
|
-
<div className="text-sm font-medium text-foreground">{rangeLabel}</div>
|
|
146
|
-
<
|
|
165
|
+
</IconButton>
|
|
166
|
+
<div className="min-w-0 whitespace-nowrap px-1 text-sm font-medium text-foreground">{rangeLabel}</div>
|
|
167
|
+
<IconButton
|
|
168
|
+
type="button"
|
|
169
|
+
variant="outline"
|
|
170
|
+
onClick={() => shiftRange('next')}
|
|
171
|
+
aria-label={t('schedule.range.next', 'Next')}
|
|
172
|
+
>
|
|
147
173
|
<ChevronRight className="size-4" aria-hidden />
|
|
148
|
-
</
|
|
174
|
+
</IconButton>
|
|
149
175
|
</div>
|
|
150
|
-
<div className="flex flex-wrap items-center gap-3">
|
|
151
|
-
<
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
onChange={(event) => onTimezoneChange?.(event.target.value)}
|
|
181
|
-
className="h-8 w-full sm:w-[180px]"
|
|
182
|
-
placeholder={t('schedule.range.timezone.placeholder', 'UTC')}
|
|
183
|
-
/>
|
|
184
|
-
</label>
|
|
176
|
+
<div className="flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2 md:ml-auto">
|
|
177
|
+
<DateRangePicker
|
|
178
|
+
value={range}
|
|
179
|
+
onChange={(next) => {
|
|
180
|
+
if (!next) return
|
|
181
|
+
onRangeChange({ start: startOfDay(next.start), end: endOfDay(next.end) })
|
|
182
|
+
}}
|
|
183
|
+
size="sm"
|
|
184
|
+
showPresets={false}
|
|
185
|
+
numberOfMonths={2}
|
|
186
|
+
aria-label={t('schedule.range.label', 'Date range')}
|
|
187
|
+
/>
|
|
188
|
+
{onTimezoneChange ? (
|
|
189
|
+
<Select value={timezone ?? undefined} onValueChange={onTimezoneChange}>
|
|
190
|
+
<SelectTrigger
|
|
191
|
+
size="sm"
|
|
192
|
+
className="w-auto min-w-[10rem]"
|
|
193
|
+
aria-label={t('schedule.range.timezone', 'Timezone')}
|
|
194
|
+
>
|
|
195
|
+
<SelectValue placeholder={t('schedule.range.timezone.placeholder', 'UTC')} />
|
|
196
|
+
</SelectTrigger>
|
|
197
|
+
<SelectContent>
|
|
198
|
+
{timezoneOptions.map((option) => (
|
|
199
|
+
<SelectItem key={option} value={option}>
|
|
200
|
+
{option}
|
|
201
|
+
</SelectItem>
|
|
202
|
+
))}
|
|
203
|
+
</SelectContent>
|
|
204
|
+
</Select>
|
|
205
|
+
) : null}
|
|
185
206
|
</div>
|
|
186
207
|
</div>
|
|
187
208
|
)
|