@gunjo/ui 0.0.1-alpha.0 → 0.0.1-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/LICENSE +21 -0
- package/README.ja.md +90 -0
- package/README.md +52 -91
- package/package.json +47 -6
- package/src/components/display/Accordion.tsx +185 -0
- package/src/components/display/AccordionGroup.tsx +155 -0
- package/src/components/display/ActionDataTable.tsx +413 -0
- package/src/components/display/ActivityTimelineCard.tsx +483 -0
- package/src/components/display/AnalyticsCard.tsx +167 -0
- package/src/components/display/AssetCard.tsx +242 -0
- package/src/components/display/AssetGrid.tsx +164 -0
- package/src/components/display/Avatar.tsx +127 -0
- package/src/components/display/AvatarGroup.tsx +131 -0
- package/src/components/{atoms → display}/Badge.tsx +3 -3
- package/src/components/display/BarChart.tsx +247 -0
- package/src/components/{molecules → display}/Card.tsx +1 -1
- package/src/components/display/Carousel.tsx +593 -0
- package/src/components/display/ChartLegend.tsx +124 -0
- package/src/components/display/ChatMessage.tsx +382 -0
- package/src/components/display/ChoroplethMap.tsx +613 -0
- package/src/components/display/Code.tsx +42 -0
- package/src/components/display/CodeBlock.tsx +338 -0
- package/src/components/display/ColorSwatch.tsx +71 -0
- package/src/components/display/ConcentricProgressCard.tsx +545 -0
- package/src/components/display/DataTable.tsx +522 -0
- package/src/components/display/DistributionBar.tsx +102 -0
- package/src/components/display/DocNote.tsx +36 -0
- package/src/components/display/DonutChart.tsx +257 -0
- package/src/components/display/EmptyState.tsx +44 -0
- package/src/components/display/FileTree.tsx +180 -0
- package/src/components/display/GaugeChart.tsx +219 -0
- package/src/components/display/HeatmapChart.tsx +266 -0
- package/src/components/display/Icon.tsx +66 -0
- package/src/components/display/ImagePreview.tsx +140 -0
- package/src/components/{atoms → display}/Img.tsx +46 -12
- package/src/components/display/LabeledDonutCard.tsx +475 -0
- package/src/components/display/LineChart.tsx +464 -0
- package/src/components/{molecules → display}/List.tsx +20 -13
- package/src/components/display/MarkdownRenderer.tsx +157 -0
- package/src/components/display/MetadataList.tsx +81 -0
- package/src/components/display/MiniDistributionBarCard.tsx +314 -0
- package/src/components/display/PieChart.tsx +234 -0
- package/src/components/display/QuadrantMatrix.tsx +330 -0
- package/src/components/display/RadarChart.tsx +335 -0
- package/src/components/display/RadialBarChart.tsx +264 -0
- package/src/components/display/RetentionCohortCard.tsx +350 -0
- package/src/components/display/RibbonChart.tsx +618 -0
- package/src/components/display/SearchableAccordion.tsx +270 -0
- package/src/components/display/SegmentTimelineCard.tsx +452 -0
- package/src/components/display/SegmentedGaugeCard.tsx +607 -0
- package/src/components/display/Spacer.tsx +51 -0
- package/src/components/display/SparklineChart.tsx +394 -0
- package/src/components/display/StackedBarChart.tsx +393 -0
- package/src/components/display/Statistic.tsx +70 -0
- package/src/components/{molecules → display}/Table.tsx +22 -7
- package/src/components/display/Tag.tsx +80 -0
- package/src/components/display/TagEditor.tsx +141 -0
- package/src/components/display/Timeline.tsx +121 -0
- package/src/components/{atoms → display}/ToolPill.tsx +42 -18
- package/src/components/display/TreeView.tsx +226 -0
- package/src/components/display/chart-tooltip.tsx +423 -0
- package/src/components/display/chart-utils.ts +71 -0
- package/src/components/display/circular-chart-utils.ts +147 -0
- package/src/components/display/generated/default-variant-keys.ts +90 -0
- package/src/components/display/generated/variant-keys.ts +169 -0
- package/src/components/{atoms → feedback}/Alert.tsx +12 -5
- package/src/components/feedback/Banner.tsx +90 -0
- package/src/components/{molecules → feedback}/NotificationCenter.tsx +64 -31
- package/src/components/feedback/ProgressWidget.tsx +44 -0
- package/src/components/{atoms → feedback}/Spinner.tsx +2 -2
- package/src/components/{molecules → feedback}/StatusBar.tsx +4 -4
- package/src/components/feedback/StatusScreen.tsx +148 -0
- package/src/components/{molecules → feedback}/Stepper.tsx +10 -5
- package/src/components/feedback/Toast.tsx +108 -0
- package/src/components/feedback/ToastProvider.tsx +78 -0
- package/src/components/feedback/generated/default-variant-keys.ts +16 -0
- package/src/components/feedback/generated/variant-keys.ts +21 -0
- package/src/components/generated/component-manifest.ts +1568 -454
- package/src/components/generated/component-style-hints.ts +1958 -718
- package/src/components/{atoms → inputs}/ButtonVariants.ts +13 -3
- package/src/components/inputs/Calendar.tsx +212 -0
- package/src/components/inputs/ChatComposer.tsx +75 -0
- package/src/components/inputs/ChatInput.tsx +528 -0
- package/src/components/{atoms → inputs}/Checkbox.tsx +2 -2
- package/src/components/inputs/Combobox.tsx +175 -0
- package/src/components/inputs/CopyButton.tsx +187 -0
- package/src/components/inputs/DatePicker.tsx +519 -0
- package/src/components/inputs/DateRangePicker.tsx +878 -0
- package/src/components/inputs/EditableField.tsx +182 -0
- package/src/components/{organisms → inputs}/FileUploader.tsx +24 -9
- package/src/components/inputs/FilterButton.tsx +163 -0
- package/src/components/{molecules → inputs}/Form.tsx +20 -3
- package/src/components/{atoms → inputs}/Input.tsx +2 -0
- package/src/components/inputs/InputOTP.tsx +75 -0
- package/src/components/inputs/Mention.tsx +279 -0
- package/src/components/inputs/NumberInput.tsx +109 -0
- package/src/components/inputs/PasswordGroup.tsx +138 -0
- package/src/components/inputs/PasswordInput.tsx +74 -0
- package/src/components/inputs/PasswordRequirementList.tsx +96 -0
- package/src/components/inputs/PasswordStrengthMeter.tsx +93 -0
- package/src/components/inputs/PhoneInput.tsx +99 -0
- package/src/components/inputs/PostalCodeInput.tsx +98 -0
- package/src/components/inputs/RangeSlider.tsx +129 -0
- package/src/components/inputs/SearchInput.tsx +76 -0
- package/src/components/inputs/Select.tsx +39 -0
- package/src/components/{atoms → inputs}/Slider.tsx +18 -5
- package/src/components/{molecules → inputs}/SortButton.tsx +5 -2
- package/src/components/{atoms → inputs}/Switch.tsx +15 -4
- package/src/components/inputs/TagInput.tsx +114 -0
- package/src/components/{atoms → inputs}/Textarea.tsx +1 -0
- package/src/components/inputs/TimePicker.tsx +150 -0
- package/src/components/inputs/Toggle.tsx +48 -0
- package/src/components/{atoms → inputs}/ToggleGroup.tsx +2 -2
- package/src/components/inputs/TooltipButton.tsx +148 -0
- package/src/components/inputs/VoiceInputButton.tsx +317 -0
- package/src/components/inputs/calendar-holidays.ts +56 -0
- package/src/components/inputs/generated/default-variant-keys.ts +32 -0
- package/src/components/{atoms → inputs}/generated/variant-keys.ts +19 -27
- package/src/components/layout/AspectRatio.tsx +12 -0
- package/src/components/layout/AssetInspectorPanel.tsx +416 -0
- package/src/components/layout/Cluster.tsx +56 -0
- package/src/components/layout/CollapsiblePanelToggle.tsx +94 -0
- package/src/components/layout/Container.tsx +43 -0
- package/src/components/layout/DeviceFrame.tsx +227 -0
- package/src/components/layout/Grid.tsx +65 -0
- package/src/components/layout/HStack.tsx +73 -0
- package/src/components/{organisms → layout}/InspectorPanel.tsx +6 -5
- package/src/components/layout/MarqueeFrame.tsx +158 -0
- package/src/components/layout/Resizable.tsx +94 -0
- package/src/components/layout/ScrollArea.tsx +71 -0
- package/src/components/{organisms → layout}/SpatialCanvas.tsx +12 -7
- package/src/components/layout/VStack.tsx +69 -0
- package/src/components/layout/generated/default-variant-keys.ts +16 -0
- package/src/components/layout/generated/variant-keys.ts +21 -0
- package/src/components/{molecules → navigation}/Breadcrumb.tsx +5 -4
- package/src/components/navigation/Command.tsx +266 -0
- package/src/components/navigation/CommandPalette.tsx +83 -0
- package/src/components/navigation/DocumentPager.tsx +171 -0
- package/src/components/navigation/Footer.tsx +88 -0
- package/src/components/navigation/Header.tsx +80 -0
- package/src/components/{molecules → navigation}/Menubar.tsx +45 -12
- package/src/components/navigation/NavigationMenu.tsx +128 -0
- package/src/components/navigation/PageAside.tsx +84 -0
- package/src/components/{molecules → navigation}/Pagination.tsx +60 -7
- package/src/components/{organisms → navigation}/RightRail.tsx +1 -1
- package/src/components/navigation/Sidebar.tsx +223 -0
- package/src/components/navigation/SidebarItem.tsx +160 -0
- package/src/components/{molecules → navigation}/Tabs.tsx +2 -2
- package/src/components/navigation/TextLink.tsx +71 -0
- package/src/components/navigation/generated/default-variant-keys.ts +12 -0
- package/src/components/navigation/generated/variant-keys.ts +13 -0
- package/src/components/overlay/AIChatInput.tsx +5 -0
- package/src/components/overlay/AIChatMessage.tsx +6 -0
- package/src/components/overlay/AlertDialog.tsx +145 -0
- package/src/components/overlay/ChatPanel.tsx +180 -0
- package/src/components/{molecules → overlay}/ContextMenu.tsx +65 -29
- package/src/components/{molecules → overlay}/Dialog.tsx +21 -13
- package/src/components/overlay/Drawer.tsx +131 -0
- package/src/components/{molecules → overlay}/DropdownMenu.tsx +52 -17
- package/src/components/overlay/FloatingPanel.tsx +90 -0
- package/src/components/overlay/HoverCard.tsx +36 -0
- package/src/components/overlay/MediaLightbox.tsx +403 -0
- package/src/components/overlay/MediaPickerDialog.tsx +198 -0
- package/src/components/overlay/Modal.tsx +103 -0
- package/src/components/overlay/OnboardingFlow.tsx +172 -0
- package/src/components/overlay/Popover.tsx +36 -0
- package/src/components/overlay/ShareModal.tsx +324 -0
- package/src/components/{molecules → overlay}/Sheet.tsx +76 -19
- package/src/components/overlay/Tooltip.tsx +130 -0
- package/src/components/overlay/generated/default-variant-keys.ts +14 -0
- package/src/components/overlay/generated/variant-keys.ts +17 -0
- package/src/components/patterns/BlogTemplate.tsx +46 -0
- package/src/components/{templates → patterns}/DashboardTemplate.tsx +2 -2
- package/src/components/patterns/DocsTemplate.tsx +41 -0
- package/src/components/{templates → patterns}/MediaLibraryTemplate.tsx +1 -1
- package/src/components/patterns/OnboardingTemplate.tsx +32 -0
- package/src/components/patterns/PricingTemplate.tsx +106 -0
- package/src/globals.css +173 -22
- package/src/index.ts +177 -76
- package/tailwind-theme-extend.cjs +48 -3
- package/design/atoms-metadata.json +0 -82
- package/design/molecules-metadata.json +0 -130
- package/design/organisms-metadata.json +0 -38
- package/design/templates-metadata.json +0 -38
- package/src/components/atoms/Avatar.tsx +0 -57
- package/src/components/atoms/Select.tsx +0 -28
- package/src/components/atoms/generated/default-variant-keys.ts +0 -36
- package/src/components/molecules/AIChatInput.tsx +0 -140
- package/src/components/molecules/AIChatMessage.tsx +0 -109
- package/src/components/molecules/Accordion.tsx +0 -99
- package/src/components/molecules/Calendar.tsx +0 -60
- package/src/components/molecules/Carousel.tsx +0 -261
- package/src/components/molecules/Command.tsx +0 -152
- package/src/components/molecules/FilterButton.tsx +0 -133
- package/src/components/molecules/HoverCard.tsx +0 -29
- package/src/components/molecules/Modal.tsx +0 -66
- package/src/components/molecules/Popover.tsx +0 -31
- package/src/components/molecules/ProgressWidget.tsx +0 -40
- package/src/components/molecules/Resizable.tsx +0 -47
- package/src/components/molecules/ScrollArea.tsx +0 -48
- package/src/components/molecules/SidebarItem.tsx +0 -134
- package/src/components/molecules/Toast.tsx +0 -57
- package/src/components/molecules/Tooltip.tsx +0 -30
- package/src/components/molecules/generated/default-variant-keys.ts +0 -22
- package/src/components/molecules/generated/variant-keys.ts +0 -33
- package/src/components/organisms/CommandPalette.tsx +0 -58
- package/src/components/organisms/FloatingPanel.tsx +0 -46
- package/src/components/organisms/ShareModal.tsx +0 -182
- package/src/components/organisms/ToastProvider.tsx +0 -49
- /package/src/components/{atoms → display}/Kbd.tsx +0 -0
- /package/src/components/{atoms → display}/Separator.tsx +0 -0
- /package/src/components/{atoms → display}/Skeleton.tsx +0 -0
- /package/src/components/{atoms → feedback}/Progress.tsx +0 -0
- /package/src/components/{atoms → inputs}/Button.tsx +0 -0
- /package/src/components/{atoms → inputs}/Label.tsx +0 -0
- /package/src/components/{atoms → inputs}/RadioGroup.tsx +0 -0
- /package/src/components/{organisms → navigation}/AppRail.tsx +0 -0
- /package/src/components/{templates → patterns}/AuthTemplate.tsx +0 -0
- /package/src/components/{templates → patterns}/BannalyzeTemplate.tsx +0 -0
- /package/src/components/{templates → patterns}/ChatTemplate.tsx +0 -0
- /package/src/components/{templates → patterns}/EditorTemplate.tsx +0 -0
- /package/src/components/{templates → patterns}/KanbanTemplate.tsx +0 -0
- /package/src/components/{templates → patterns}/LandingTemplate.tsx +0 -0
- /package/src/components/{templates → patterns}/SettingsTemplate.tsx +0 -0
|
@@ -4,9 +4,17 @@ import { buttonDefaultVariantKey } from "./generated/default-variant-keys"
|
|
|
4
4
|
|
|
5
5
|
const buttonVariantClasses: Record<ButtonVariantKey, string> = {
|
|
6
6
|
default:
|
|
7
|
-
"bg-foreground text-
|
|
7
|
+
"bg-foreground text-background shadow hover:bg-foreground/90",
|
|
8
|
+
primary:
|
|
9
|
+
"bg-primary-strong text-primary-strong-foreground shadow-sm hover:bg-primary-strong",
|
|
10
|
+
info:
|
|
11
|
+
"bg-info-strong text-info-strong-foreground shadow-sm hover:bg-info-strong",
|
|
12
|
+
success:
|
|
13
|
+
"bg-success-strong text-success-strong-foreground shadow-sm hover:bg-success-strong",
|
|
14
|
+
warning:
|
|
15
|
+
"bg-warning-strong text-warning-strong-foreground shadow-sm hover:bg-warning-strong",
|
|
8
16
|
destructive:
|
|
9
|
-
"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive
|
|
17
|
+
"bg-destructive-strong text-destructive-strong-foreground shadow-sm hover:bg-destructive-strong",
|
|
10
18
|
outline:
|
|
11
19
|
"border border-border bg-transparent shadow-sm hover:bg-muted hover:text-foreground",
|
|
12
20
|
secondary:
|
|
@@ -16,14 +24,16 @@ const buttonVariantClasses: Record<ButtonVariantKey, string> = {
|
|
|
16
24
|
}
|
|
17
25
|
|
|
18
26
|
export const buttonVariants = cva(
|
|
19
|
-
"inline-flex items-center justify-center w-fit gap-2 rounded-lg rounded-[var(--radius)] text-sm font-medium transition-colors duration-150 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
27
|
+
"inline-flex items-center justify-center w-fit gap-2 rounded-lg rounded-[var(--radius)] text-sm font-medium transition-colors duration-150 cursor-pointer focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
20
28
|
{
|
|
21
29
|
variants: {
|
|
22
30
|
variant: buttonVariantClasses,
|
|
23
31
|
size: {
|
|
32
|
+
xs: "h-7 rounded-md px-2 text-xs",
|
|
24
33
|
default: "h-9 px-4 py-2",
|
|
25
34
|
sm: "h-8 rounded-md px-3 text-xs",
|
|
26
35
|
lg: "h-10 rounded-md px-8",
|
|
36
|
+
xl: "h-11 rounded-md px-10 text-base",
|
|
27
37
|
icon: "h-9 w-9",
|
|
28
38
|
},
|
|
29
39
|
},
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { ja } from "date-fns/locale/ja"
|
|
5
|
+
import {
|
|
6
|
+
DayButton as DayPickerDayButton,
|
|
7
|
+
DayPicker,
|
|
8
|
+
type DayButtonProps,
|
|
9
|
+
type Matcher,
|
|
10
|
+
type Modifiers,
|
|
11
|
+
} from "react-day-picker"
|
|
12
|
+
|
|
13
|
+
import { cn } from "../../lib/utils"
|
|
14
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "../overlay/Tooltip"
|
|
15
|
+
import { calendarDateKey, japaneseHolidays, type CalendarHoliday } from "./calendar-holidays"
|
|
16
|
+
|
|
17
|
+
export type CalendarProps = React.ComponentProps<typeof DayPicker> & {
|
|
18
|
+
holidays?: CalendarHoliday[]
|
|
19
|
+
showHolidays?: boolean
|
|
20
|
+
showWeekendStyle?: boolean
|
|
21
|
+
/**
|
|
22
|
+
* Shared explanation shown when a disabled day is hovered, focused, or
|
|
23
|
+
* tapped. Use `getDisabledReason` when the reason depends on the date.
|
|
24
|
+
*/
|
|
25
|
+
disabledReason?: React.ReactNode
|
|
26
|
+
getDisabledReason?: (date: Date, modifiers: Modifiers) => React.ReactNode
|
|
27
|
+
disabledReasonLabel?: string | ((date: Date, modifiers: Modifiers) => string)
|
|
28
|
+
disabledReasonPortalContainer?: HTMLElement | null
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function Calendar({
|
|
32
|
+
className,
|
|
33
|
+
classNames,
|
|
34
|
+
components,
|
|
35
|
+
locale = ja,
|
|
36
|
+
holidays = japaneseHolidays,
|
|
37
|
+
showHolidays = true,
|
|
38
|
+
showWeekendStyle = true,
|
|
39
|
+
disabledReason,
|
|
40
|
+
getDisabledReason,
|
|
41
|
+
disabledReasonLabel,
|
|
42
|
+
disabledReasonPortalContainer,
|
|
43
|
+
modifiers,
|
|
44
|
+
modifiersClassNames,
|
|
45
|
+
showOutsideDays = true,
|
|
46
|
+
captionLayout = "dropdown",
|
|
47
|
+
startMonth,
|
|
48
|
+
endMonth,
|
|
49
|
+
formatters,
|
|
50
|
+
labels,
|
|
51
|
+
fixedWeeks = true,
|
|
52
|
+
...props
|
|
53
|
+
}: CalendarProps) {
|
|
54
|
+
const holidayMatcher = React.useMemo<Matcher>(() => {
|
|
55
|
+
const holidayKeys = new Set(holidays.map((item) => calendarDateKey(item.date)))
|
|
56
|
+
return (date: Date) => holidayKeys.has(calendarDateKey(date))
|
|
57
|
+
}, [holidays])
|
|
58
|
+
|
|
59
|
+
const numberOfMonths = "numberOfMonths" in props ? props.numberOfMonths : undefined
|
|
60
|
+
const today = React.useMemo(() => new Date(), [])
|
|
61
|
+
const defaultStartMonth = React.useMemo(
|
|
62
|
+
() => new Date(today.getFullYear() - 10, 0, 1),
|
|
63
|
+
[today]
|
|
64
|
+
)
|
|
65
|
+
const defaultEndMonth = React.useMemo(
|
|
66
|
+
() => new Date(today.getFullYear() + 10, 11, 31),
|
|
67
|
+
[today]
|
|
68
|
+
)
|
|
69
|
+
const isJapaneseLocale = (locale as { code?: string })?.code === "ja"
|
|
70
|
+
const BaseDayButton = components?.DayButton ?? DayPickerDayButton
|
|
71
|
+
const DayButtonWithDisabledReason = React.useCallback(
|
|
72
|
+
(dayButtonProps: DayButtonProps) => {
|
|
73
|
+
const reason = dayButtonProps.modifiers.disabled
|
|
74
|
+
? getDisabledReason?.(dayButtonProps.day.date, dayButtonProps.modifiers) ?? disabledReason
|
|
75
|
+
: null
|
|
76
|
+
const button = <BaseDayButton {...dayButtonProps} />
|
|
77
|
+
|
|
78
|
+
if (!reason) return button
|
|
79
|
+
|
|
80
|
+
const label =
|
|
81
|
+
typeof disabledReasonLabel === "function"
|
|
82
|
+
? disabledReasonLabel(dayButtonProps.day.date, dayButtonProps.modifiers)
|
|
83
|
+
: disabledReasonLabel ?? (typeof reason === "string" ? reason : undefined)
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<Tooltip>
|
|
87
|
+
<TooltipTrigger asChild>
|
|
88
|
+
<span
|
|
89
|
+
className="inline-flex h-10 w-10 items-center justify-center"
|
|
90
|
+
tabIndex={0}
|
|
91
|
+
aria-label={label}
|
|
92
|
+
>
|
|
93
|
+
{button}
|
|
94
|
+
</span>
|
|
95
|
+
</TooltipTrigger>
|
|
96
|
+
<TooltipContent
|
|
97
|
+
portalContainer={disabledReasonPortalContainer}
|
|
98
|
+
className="max-w-64 text-left"
|
|
99
|
+
>
|
|
100
|
+
{reason}
|
|
101
|
+
</TooltipContent>
|
|
102
|
+
</Tooltip>
|
|
103
|
+
)
|
|
104
|
+
},
|
|
105
|
+
[
|
|
106
|
+
BaseDayButton,
|
|
107
|
+
disabledReason,
|
|
108
|
+
disabledReasonLabel,
|
|
109
|
+
disabledReasonPortalContainer,
|
|
110
|
+
getDisabledReason,
|
|
111
|
+
]
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
<DayPicker
|
|
116
|
+
locale={locale}
|
|
117
|
+
showOutsideDays={showOutsideDays}
|
|
118
|
+
fixedWeeks={fixedWeeks}
|
|
119
|
+
captionLayout={captionLayout}
|
|
120
|
+
startMonth={startMonth ?? defaultStartMonth}
|
|
121
|
+
endMonth={endMonth ?? defaultEndMonth}
|
|
122
|
+
components={{
|
|
123
|
+
...components,
|
|
124
|
+
DayButton: DayButtonWithDisabledReason,
|
|
125
|
+
}}
|
|
126
|
+
formatters={{
|
|
127
|
+
...(isJapaneseLocale
|
|
128
|
+
? {
|
|
129
|
+
formatYearDropdown: (year: Date) => `${year.getFullYear()}年`,
|
|
130
|
+
}
|
|
131
|
+
: {}),
|
|
132
|
+
...formatters,
|
|
133
|
+
}}
|
|
134
|
+
labels={{
|
|
135
|
+
...(isJapaneseLocale
|
|
136
|
+
? {
|
|
137
|
+
labelMonthDropdown: () => "月を選択",
|
|
138
|
+
labelYearDropdown: () => "年を選択",
|
|
139
|
+
labelPrevious: () => "前の月へ",
|
|
140
|
+
labelNext: () => "次の月へ",
|
|
141
|
+
}
|
|
142
|
+
: {}),
|
|
143
|
+
...labels,
|
|
144
|
+
}}
|
|
145
|
+
className={cn(
|
|
146
|
+
"w-[320px] max-w-full rounded-lg border bg-card p-4",
|
|
147
|
+
Number(numberOfMonths ?? 1) > 1 && "sm:!w-fit",
|
|
148
|
+
className
|
|
149
|
+
)}
|
|
150
|
+
modifiers={{
|
|
151
|
+
...(showWeekendStyle
|
|
152
|
+
? {
|
|
153
|
+
sunday: { dayOfWeek: [0] },
|
|
154
|
+
saturday: { dayOfWeek: [6] },
|
|
155
|
+
}
|
|
156
|
+
: {}),
|
|
157
|
+
...(showHolidays ? { holiday: holidayMatcher } : {}),
|
|
158
|
+
...modifiers,
|
|
159
|
+
}}
|
|
160
|
+
modifiersClassNames={{
|
|
161
|
+
sunday: "[&:not(.gunjo-calendar-selected):not(.gunjo-calendar-disabled):not(.gunjo-calendar-outside)>button]:text-destructive",
|
|
162
|
+
saturday: "[&:not(.gunjo-calendar-selected):not(.gunjo-calendar-disabled):not(.gunjo-calendar-outside)>button]:text-info",
|
|
163
|
+
holiday: "[&:not(.gunjo-calendar-selected):not(.gunjo-calendar-disabled):not(.gunjo-calendar-outside)>button]:font-semibold [&:not(.gunjo-calendar-selected):not(.gunjo-calendar-disabled):not(.gunjo-calendar-outside)>button]:text-destructive",
|
|
164
|
+
...modifiersClassNames,
|
|
165
|
+
}}
|
|
166
|
+
classNames={{
|
|
167
|
+
months: "relative flex flex-col gap-4 sm:flex-row",
|
|
168
|
+
month: "space-y-3",
|
|
169
|
+
month_caption: "relative flex h-8 w-full items-center justify-center",
|
|
170
|
+
caption_label: "text-sm sr-only font-semibold",
|
|
171
|
+
dropdowns: "flex items-center justify-center gap-0 text-sm font-semibold",
|
|
172
|
+
dropdown_root: "relative inline-flex items-center",
|
|
173
|
+
dropdown:
|
|
174
|
+
"h-8 cursor-pointer appearance-none rounded-md bg-transparent px-1.5 py-1 text-center font-semibold text-foreground outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
175
|
+
months_dropdown: "w-12",
|
|
176
|
+
years_dropdown: "w-[4.25rem]",
|
|
177
|
+
nav: "pointer-events-none absolute inset-x-0 top-0 z-10 flex items-center justify-between",
|
|
178
|
+
button_previous: "pointer-events-auto relative z-20 flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground disabled:cursor-not-allowed disabled:opacity-40",
|
|
179
|
+
button_next: "pointer-events-auto relative z-20 flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground disabled:cursor-not-allowed disabled:opacity-40",
|
|
180
|
+
chevron: "h-4 w-4",
|
|
181
|
+
month_grid: "w-full border-collapse",
|
|
182
|
+
weekdays: "border-0",
|
|
183
|
+
head_cell: "text-xs",
|
|
184
|
+
weekday: "h-8 w-10 select-none text-center text-xs font-normal text-muted-foreground",
|
|
185
|
+
week: "mt-1",
|
|
186
|
+
day: "relative h-10 w-10 p-0 text-center text-sm focus-within:relative focus-within:z-20",
|
|
187
|
+
day_button:
|
|
188
|
+
"relative flex h-10 w-10 items-center justify-center rounded-md p-0 font-normal transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none",
|
|
189
|
+
selected:
|
|
190
|
+
"gunjo-calendar-selected [&>button]:bg-primary [&>button]:text-primary-foreground [&>button]:hover:bg-primary [&>button]:hover:text-primary-foreground [&>button]:focus:bg-primary [&>button]:focus:text-primary-foreground",
|
|
191
|
+
today:
|
|
192
|
+
"gunjo-calendar-today [&>button]:bg-accent [&>button]:text-accent-foreground [&>button]:ring-1 [&>button]:ring-primary-border [&>button]:ring-offset-1 [&>button]:ring-offset-background",
|
|
193
|
+
outside:
|
|
194
|
+
"gunjo-calendar-outside [&>button]:text-muted-foreground [&>button]:opacity-45",
|
|
195
|
+
disabled:
|
|
196
|
+
"gunjo-calendar-disabled [&>button]:cursor-not-allowed [&>button]:text-muted-foreground [&>button]:opacity-35 [&>button]:line-through [&>button]:hover:bg-transparent",
|
|
197
|
+
range_start:
|
|
198
|
+
"gunjo-calendar-selected [&>button]:rounded-l-md [&>button]:rounded-r-none [&>button]:bg-primary [&>button]:text-primary-foreground",
|
|
199
|
+
range_middle:
|
|
200
|
+
"gunjo-calendar-selected [&>button]:rounded-none [&>button]:bg-accent [&>button]:text-accent-foreground",
|
|
201
|
+
range_end:
|
|
202
|
+
"gunjo-calendar-selected [&>button]:rounded-l-none [&>button]:rounded-r-md [&>button]:bg-info [&>button]:text-info-foreground",
|
|
203
|
+
hidden: "invisible",
|
|
204
|
+
...classNames,
|
|
205
|
+
}}
|
|
206
|
+
{...props}
|
|
207
|
+
/>
|
|
208
|
+
)
|
|
209
|
+
}
|
|
210
|
+
Calendar.displayName = "Calendar"
|
|
211
|
+
|
|
212
|
+
export { Calendar }
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../../lib/utils";
|
|
5
|
+
import { ChatInput, type ChatInputProps } from "./ChatInput";
|
|
6
|
+
import { chatComposerDefaultVariantKey } from "./generated/default-variant-keys";
|
|
7
|
+
import type { ChatComposerVariantKey } from "./generated/variant-keys";
|
|
8
|
+
|
|
9
|
+
const chatComposerVariantClassNames: Record<ChatComposerVariantKey, string> = {
|
|
10
|
+
context: "",
|
|
11
|
+
default: "",
|
|
12
|
+
prompt: "",
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export interface ChatComposerLabels {
|
|
16
|
+
context?: string;
|
|
17
|
+
prompt?: string;
|
|
18
|
+
status?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface ChatComposerProps extends React.HTMLAttributes<HTMLElement> {
|
|
22
|
+
variant?: ChatComposerVariantKey;
|
|
23
|
+
inputProps: ChatInputProps;
|
|
24
|
+
context?: React.ReactNode;
|
|
25
|
+
prompt?: React.ReactNode;
|
|
26
|
+
status?: React.ReactNode;
|
|
27
|
+
footer?: React.ReactNode;
|
|
28
|
+
accessory?: React.ReactNode;
|
|
29
|
+
labels?: ChatComposerLabels;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function ChatComposer({
|
|
33
|
+
variant = chatComposerDefaultVariantKey,
|
|
34
|
+
inputProps,
|
|
35
|
+
context,
|
|
36
|
+
prompt,
|
|
37
|
+
status,
|
|
38
|
+
footer,
|
|
39
|
+
accessory,
|
|
40
|
+
labels,
|
|
41
|
+
className,
|
|
42
|
+
...props
|
|
43
|
+
}: ChatComposerProps) {
|
|
44
|
+
return (
|
|
45
|
+
<section
|
|
46
|
+
className={cn("inline-flex w-full flex-col items-center gap-3 [&>*]:w-full", chatComposerVariantClassNames[variant], className)}
|
|
47
|
+
{...props}
|
|
48
|
+
>
|
|
49
|
+
{context ? (
|
|
50
|
+
<div aria-label={labels?.context} className="space-y-2">
|
|
51
|
+
{context}
|
|
52
|
+
</div>
|
|
53
|
+
) : null}
|
|
54
|
+
{prompt ? (
|
|
55
|
+
<div aria-label={labels?.prompt} className="space-y-2">
|
|
56
|
+
{prompt}
|
|
57
|
+
</div>
|
|
58
|
+
) : null}
|
|
59
|
+
{status ? (
|
|
60
|
+
<div aria-label={labels?.status} className="space-y-2">
|
|
61
|
+
{status}
|
|
62
|
+
</div>
|
|
63
|
+
) : null}
|
|
64
|
+
<div className={cn("relative", accessory && "pt-6")}>
|
|
65
|
+
{accessory ? (
|
|
66
|
+
<div className="pointer-events-none absolute right-8 top-0 z-10">
|
|
67
|
+
{accessory}
|
|
68
|
+
</div>
|
|
69
|
+
) : null}
|
|
70
|
+
<ChatInput {...inputProps} />
|
|
71
|
+
</div>
|
|
72
|
+
{footer ? <div>{footer}</div> : null}
|
|
73
|
+
</section>
|
|
74
|
+
);
|
|
75
|
+
}
|