@maestro-js/components 1.0.0-alpha.19 → 1.0.0-alpha.2
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/commands/add.ts +1 -16
- package/dist/components.json +1 -1
- package/dist/index.js +1 -14
- package/package.json +5 -5
- package/registry.json +790 -598
- package/scripts/build.ts +4 -11
- package/src/components/alert-dialog.tsx +3 -3
- package/src/components/avatar.tsx +1 -1
- package/src/components/button-link.tsx +0 -3
- package/src/components/button.tsx +0 -4
- package/src/components/checkbox.tsx +7 -7
- package/src/components/chip.tsx +7 -7
- package/src/components/container.tsx +3 -3
- package/src/components/dialog.tsx +7 -21
- package/src/components/disclosure.tsx +1 -1
- package/src/components/drawer.tsx +5 -19
- package/src/components/form.tsx +5 -27
- package/src/components/helpers/form-field.tsx +8 -7
- package/src/components/helpers/get-button-classes.ts +23 -23
- package/src/components/helpers/headless-button.tsx +1 -1
- package/src/components/inline-alert.tsx +3 -3
- package/src/components/labeled-value.tsx +2 -2
- package/src/components/menu.tsx +26 -60
- package/src/components/month-day-input.tsx +1 -2
- package/src/components/multiselect.tsx +70 -74
- package/src/components/radio.tsx +8 -8
- package/src/components/select.tsx +8 -9
- package/src/components/stepper.tsx +6 -6
- package/src/components/switch.tsx +7 -7
- package/src/components/tabs.tsx +1 -1
- package/src/components/tag-field.tsx +3 -3
- package/src/components/text-area.tsx +1 -1
- package/src/components/text-field.tsx +1 -4
- package/src/components/toast.tsx +6 -6
- package/src/components/toggle-button-group.tsx +2 -2
- package/src/utils/icons.d.ts +1 -2
- package/src/utils/use-tab-indicator.ts +9 -9
- package/src/components/date-range.tsx +0 -138
- package/src/components/optional-link.tsx +0 -15
- package/src/components/table/headless-templated-row-table.ts +0 -550
- package/src/components/table/index.tsx +0 -41
- package/src/components/table/server-table.ts +0 -143
- package/src/components/table/table-actions.tsx +0 -76
- package/src/components/table/table-container.tsx +0 -173
- package/src/components/table/table-container.type-test.ts +0 -155
- package/src/components/table/table-filters/date-range-filter.tsx +0 -227
- package/src/components/table/table-filters/select-filter.tsx +0 -211
- package/src/components/table/table-filters/sort.tsx +0 -85
- package/src/components/table/table-primitives.tsx +0 -226
- package/src/components/table/table-toolbar.tsx +0 -300
- package/src/components/table/table-types.ts +0 -61
- package/src/components/table/use-client-table.ts +0 -157
- package/src/components/table/use-client-table.type-test.ts +0 -217
- package/src/components/table/use-server-table.ts +0 -192
- package/src/components/table/use-server-table.type-test.ts +0 -174
- package/src/utils/use-query-state.ts +0 -626
|
@@ -3,7 +3,7 @@ import * as React from 'react'
|
|
|
3
3
|
// --- Shared Tab Styles ---
|
|
4
4
|
|
|
5
5
|
export const TAB_BASE_CLASSES = 'relative px-4 py-2 text-sm cursor-default transition-colors duration-200'
|
|
6
|
-
export const TAB_INACTIVE_CLASSES = 'text-neutral-
|
|
6
|
+
export const TAB_INACTIVE_CLASSES = 'text-neutral-500 font-medium'
|
|
7
7
|
export const TAB_DISABLED_CLASSES = 'opacity-50 cursor-not-allowed'
|
|
8
8
|
|
|
9
9
|
// --- Tab Variant ---
|
|
@@ -14,9 +14,9 @@ export type TabVariant = 'underline' | 'oval'
|
|
|
14
14
|
|
|
15
15
|
export const tabColorMap = {
|
|
16
16
|
primary: {
|
|
17
|
-
text: 'text-primary-
|
|
18
|
-
bg: 'bg-primary-
|
|
19
|
-
outline: 'outline-primary-
|
|
17
|
+
text: 'text-primary-500',
|
|
18
|
+
bg: 'bg-primary-500',
|
|
19
|
+
outline: 'outline-primary-500'
|
|
20
20
|
},
|
|
21
21
|
neutral: {
|
|
22
22
|
text: 'text-neutral-800',
|
|
@@ -31,7 +31,7 @@ export type TabColor = keyof typeof tabColorMap
|
|
|
31
31
|
|
|
32
32
|
export const tabListContainerClasses: Record<TabVariant, string> = {
|
|
33
33
|
underline: 'relative',
|
|
34
|
-
oval: 'relative inline-flex bg-neutral-100 rounded-
|
|
34
|
+
oval: 'relative inline-flex bg-neutral-100 rounded-full p-1'
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export const tabListInnerClasses: Record<TabVariant, string> = {
|
|
@@ -41,13 +41,13 @@ export const tabListInnerClasses: Record<TabVariant, string> = {
|
|
|
41
41
|
|
|
42
42
|
export function getIndicatorClasses(variant: TabVariant, color: TabColor): string {
|
|
43
43
|
if (variant === 'underline') {
|
|
44
|
-
return `absolute bottom-0 h-
|
|
44
|
+
return `absolute bottom-0 h-[3px] rounded-full ${tabColorMap[color].bg}`
|
|
45
45
|
}
|
|
46
|
-
return
|
|
46
|
+
return `absolute inset-y-1 rounded-full ${tabColorMap[color].bg}`
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
export const TAB_OVAL_BASE_CLASSES = 'relative z-10 px-4 py-1.5 text-sm cursor-default transition-colors duration-200 rounded-
|
|
50
|
-
export const TAB_OVAL_SELECTED_CLASSES = 'text-
|
|
49
|
+
export const TAB_OVAL_BASE_CLASSES = 'relative z-10 px-4 py-1.5 text-sm cursor-default transition-colors duration-200 rounded-full'
|
|
50
|
+
export const TAB_OVAL_SELECTED_CLASSES = 'text-white font-semibold'
|
|
51
51
|
|
|
52
52
|
// --- Animated Indicator Hook ---
|
|
53
53
|
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
|
-
import {
|
|
3
|
-
RangeCalendar,
|
|
4
|
-
CalendarGrid,
|
|
5
|
-
CalendarCell,
|
|
6
|
-
Heading,
|
|
7
|
-
CalendarGridHeader,
|
|
8
|
-
CalendarHeaderCell,
|
|
9
|
-
CalendarGridBody,
|
|
10
|
-
Button,
|
|
11
|
-
I18nProvider
|
|
12
|
-
} from 'react-aria-components'
|
|
13
|
-
import { twMerge } from 'tailwind-merge'
|
|
14
|
-
import { parseDate, type CalendarDate, type DateValue } from '@internationalized/date'
|
|
15
|
-
import type { Iso } from 'iso-fns'
|
|
16
|
-
import { Icon } from './icon'
|
|
17
|
-
|
|
18
|
-
export type DateRangeRootAdditionalProps = {
|
|
19
|
-
defaultStart: Iso.Date | null
|
|
20
|
-
defaultEnd: Iso.Date | null
|
|
21
|
-
shouldDisableDate: (date: string) => boolean
|
|
22
|
-
shouldDisableStartDate: (date: string) => boolean
|
|
23
|
-
shouldDisableEndDate: (date: string) => boolean
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
type DateRangePickerProps = {
|
|
27
|
-
start: Iso.Date | null
|
|
28
|
-
end: Iso.Date | null
|
|
29
|
-
onStartChange: (value: Iso.Date | null, field: 'start' | 'end' | null) => void
|
|
30
|
-
onEndChange: (value: Iso.Date | null, field: 'start' | 'end' | null) => void
|
|
31
|
-
currentField: 'start' | 'end' | null
|
|
32
|
-
shouldDisableDate?: (date: string) => boolean
|
|
33
|
-
shouldDisableStartDate?: (date: string) => boolean
|
|
34
|
-
shouldDisableEndDate?: (date: string) => boolean
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function DateRangePicker(props: DateRangePickerProps) {
|
|
38
|
-
const ariaValue = React.useMemo(() => {
|
|
39
|
-
if (!props.start || !props.end) return null
|
|
40
|
-
try {
|
|
41
|
-
return { start: parseDate(props.start), end: parseDate(props.end) }
|
|
42
|
-
} catch {
|
|
43
|
-
return null
|
|
44
|
-
}
|
|
45
|
-
}, [props.start, props.end])
|
|
46
|
-
|
|
47
|
-
const handleChange = (range: { start: CalendarDate; end: CalendarDate } | null) => {
|
|
48
|
-
if (!range) {
|
|
49
|
-
props.onStartChange(null, null)
|
|
50
|
-
props.onEndChange(null, null)
|
|
51
|
-
return
|
|
52
|
-
}
|
|
53
|
-
const start = range.start.toString() as Iso.Date
|
|
54
|
-
const end = range.end.toString() as Iso.Date
|
|
55
|
-
props.onStartChange(start, 'end')
|
|
56
|
-
props.onEndChange(end, null)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const isDateUnavailable = React.useCallback(
|
|
60
|
-
(date: DateValue) => {
|
|
61
|
-
const dateStr = date.toString()
|
|
62
|
-
return props.shouldDisableDate?.(dateStr) ?? false
|
|
63
|
-
},
|
|
64
|
-
[props.shouldDisableDate]
|
|
65
|
-
)
|
|
66
|
-
|
|
67
|
-
return (
|
|
68
|
-
<I18nProvider locale="en">
|
|
69
|
-
<RangeCalendar
|
|
70
|
-
value={ariaValue}
|
|
71
|
-
onChange={handleChange}
|
|
72
|
-
isDateUnavailable={isDateUnavailable}
|
|
73
|
-
visibleDuration={{ months: 2 }}
|
|
74
|
-
className="text-sm"
|
|
75
|
-
>
|
|
76
|
-
<header className="flex items-center justify-between mb-2 px-1">
|
|
77
|
-
<Button slot="previous" className="p-1 hover:bg-neutral-100 rounded cursor-pointer">
|
|
78
|
-
<Icon name="chevron-left" />
|
|
79
|
-
</Button>
|
|
80
|
-
<Heading className="text-sm font-semibold text-neutral-900 flex-1 text-center" />
|
|
81
|
-
<Button slot="next" className="p-1 hover:bg-neutral-100 rounded cursor-pointer">
|
|
82
|
-
<Icon name="chevron-right" />
|
|
83
|
-
</Button>
|
|
84
|
-
</header>
|
|
85
|
-
<div className="flex gap-4">
|
|
86
|
-
<CalendarGrid>
|
|
87
|
-
<CalendarGridHeader>
|
|
88
|
-
{(day) => (
|
|
89
|
-
<CalendarHeaderCell className="text-xs text-neutral-500 font-medium w-8 h-8">{day}</CalendarHeaderCell>
|
|
90
|
-
)}
|
|
91
|
-
</CalendarGridHeader>
|
|
92
|
-
<CalendarGridBody>
|
|
93
|
-
{(date) => (
|
|
94
|
-
<CalendarCell
|
|
95
|
-
date={date}
|
|
96
|
-
className={({ isSelected, isSelectionStart, isSelectionEnd, isOutsideMonth, isDisabled, isUnavailable }) =>
|
|
97
|
-
twMerge(
|
|
98
|
-
'w-8 h-8 text-sm rounded cursor-pointer flex items-center justify-center',
|
|
99
|
-
'hover:bg-neutral-100',
|
|
100
|
-
isOutsideMonth && 'text-neutral-300',
|
|
101
|
-
(isDisabled || isUnavailable) && 'text-neutral-300 cursor-not-allowed',
|
|
102
|
-
isSelected && !isSelectionStart && !isSelectionEnd && 'bg-primary-500/20',
|
|
103
|
-
(isSelectionStart || isSelectionEnd) && 'bg-primary-500 text-white hover:bg-primary-500'
|
|
104
|
-
)
|
|
105
|
-
}
|
|
106
|
-
/>
|
|
107
|
-
)}
|
|
108
|
-
</CalendarGridBody>
|
|
109
|
-
</CalendarGrid>
|
|
110
|
-
<CalendarGrid offset={{ months: 1 }}>
|
|
111
|
-
<CalendarGridHeader>
|
|
112
|
-
{(day) => (
|
|
113
|
-
<CalendarHeaderCell className="text-xs text-neutral-500 font-medium w-8 h-8">{day}</CalendarHeaderCell>
|
|
114
|
-
)}
|
|
115
|
-
</CalendarGridHeader>
|
|
116
|
-
<CalendarGridBody>
|
|
117
|
-
{(date) => (
|
|
118
|
-
<CalendarCell
|
|
119
|
-
date={date}
|
|
120
|
-
className={({ isSelected, isSelectionStart, isSelectionEnd, isOutsideMonth, isDisabled, isUnavailable }) =>
|
|
121
|
-
twMerge(
|
|
122
|
-
'w-8 h-8 text-sm rounded cursor-pointer flex items-center justify-center',
|
|
123
|
-
'hover:bg-neutral-100',
|
|
124
|
-
isOutsideMonth && 'text-neutral-300',
|
|
125
|
-
(isDisabled || isUnavailable) && 'text-neutral-300 cursor-not-allowed',
|
|
126
|
-
isSelected && !isSelectionStart && !isSelectionEnd && 'bg-primary-500/20',
|
|
127
|
-
(isSelectionStart || isSelectionEnd) && 'bg-primary-500 text-white hover:bg-primary-500'
|
|
128
|
-
)
|
|
129
|
-
}
|
|
130
|
-
/>
|
|
131
|
-
)}
|
|
132
|
-
</CalendarGridBody>
|
|
133
|
-
</CalendarGrid>
|
|
134
|
-
</div>
|
|
135
|
-
</RangeCalendar>
|
|
136
|
-
</I18nProvider>
|
|
137
|
-
)
|
|
138
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type LinkProps, Link } from 'react-router'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
|
|
4
|
-
export type OptionalLinkProps = Omit<LinkProps, 'to'> & { to?: LinkProps['to']; disabled?: boolean }
|
|
5
|
-
|
|
6
|
-
export const OptionalLink = React.forwardRef<HTMLAnchorElement, OptionalLinkProps>(
|
|
7
|
-
({ to, onClick, disabled, ...props }, ref) => {
|
|
8
|
-
if (to && !disabled) {
|
|
9
|
-
return <Link to={to} onClick={onClick} {...props} ref={ref} />
|
|
10
|
-
} else {
|
|
11
|
-
return <span {...props} ref={ref} />
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
)
|
|
15
|
-
OptionalLink.displayName = 'OptionalLink'
|