banhaten 0.1.3 → 0.2.0
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/CHANGELOG.md +45 -0
- package/CONTRIBUTING.md +44 -0
- package/README.md +65 -13
- package/SECURITY.md +15 -0
- package/banhaten.config.example.json +0 -2
- package/docs/design-system/README.md +9 -0
- package/docs/design-system/adoption-quality-remediation.md +87 -0
- package/docs/design-system/agent-usage.md +13 -0
- package/docs/design-system/appearance-presets.md +6 -1
- package/docs/design-system/component-docs-pattern.md +81 -0
- package/docs/design-system/component-token-consistency-audit.md +13 -3
- package/docs/design-system/components/README.md +3 -2
- package/docs/design-system/components/accordion.md +16 -0
- package/docs/design-system/components/activity-feed.md +15 -1
- package/docs/design-system/components/alert-dialog.md +17 -0
- package/docs/design-system/components/alert.md +46 -14
- package/docs/design-system/components/aspect-ratio.md +15 -0
- package/docs/design-system/components/attribute.md +16 -0
- package/docs/design-system/components/autocomplete.md +19 -0
- package/docs/design-system/components/avatar.md +18 -0
- package/docs/design-system/components/badge.md +19 -0
- package/docs/design-system/components/banner.md +15 -1
- package/docs/design-system/components/breadcrumbs.md +14 -0
- package/docs/design-system/components/button-group.md +34 -0
- package/docs/design-system/components/button.md +18 -0
- package/docs/design-system/components/card.md +18 -1
- package/docs/design-system/components/carousel.md +20 -3
- package/docs/design-system/components/catalog-components.md +15 -1
- package/docs/design-system/components/chart.md +15 -0
- package/docs/design-system/components/checkbox.md +16 -0
- package/docs/design-system/components/collapsible.md +15 -0
- package/docs/design-system/components/command.md +15 -0
- package/docs/design-system/components/context-menu.md +15 -0
- package/docs/design-system/components/date-picker.md +21 -1
- package/docs/design-system/components/divider.md +16 -0
- package/docs/design-system/components/empty-state.md +17 -0
- package/docs/design-system/components/field.md +17 -0
- package/docs/design-system/components/file-upload.md +14 -0
- package/docs/design-system/components/hover-card.md +15 -0
- package/docs/design-system/components/input-group.md +17 -0
- package/docs/design-system/components/input-otp.md +18 -0
- package/docs/design-system/components/input.md +43 -7
- package/docs/design-system/components/item.md +72 -0
- package/docs/design-system/components/kbd.md +18 -0
- package/docs/design-system/components/label.md +16 -0
- package/docs/design-system/components/menu.md +17 -0
- package/docs/design-system/components/menubar.md +15 -0
- package/docs/design-system/components/modal.md +25 -4
- package/docs/design-system/components/native-select.md +18 -0
- package/docs/design-system/components/navigation-menu.md +15 -0
- package/docs/design-system/components/onboarding-step-list-item.md +15 -1
- package/docs/design-system/components/page-header.md +15 -1
- package/docs/design-system/components/pagination.md +30 -8
- package/docs/design-system/components/popover.md +19 -0
- package/docs/design-system/components/progress-slider.md +18 -0
- package/docs/design-system/components/progress.md +17 -0
- package/docs/design-system/components/radio-card.md +16 -0
- package/docs/design-system/components/radio-group.md +17 -0
- package/docs/design-system/components/resizable.md +15 -0
- package/docs/design-system/components/scroll-area.md +15 -0
- package/docs/design-system/components/segmented-control.md +71 -0
- package/docs/design-system/components/select.md +44 -7
- package/docs/design-system/components/sheet.md +17 -0
- package/docs/design-system/components/sidebar.md +15 -0
- package/docs/design-system/components/skeleton.md +18 -0
- package/docs/design-system/components/slideout.md +14 -0
- package/docs/design-system/components/slider.md +20 -0
- package/docs/design-system/components/social-button.md +21 -3
- package/docs/design-system/components/spinner.md +16 -0
- package/docs/design-system/components/steps.md +14 -0
- package/docs/design-system/components/table.md +15 -1
- package/docs/design-system/components/tabs.md +17 -0
- package/docs/design-system/components/tag.md +17 -0
- package/docs/design-system/components/textarea.md +16 -0
- package/docs/design-system/components/timeline.md +14 -0
- package/docs/design-system/components/toast.md +17 -0
- package/docs/design-system/components/toggle.md +17 -0
- package/docs/design-system/components/toolbar.md +21 -1
- package/docs/design-system/components/tooltip.md +18 -1
- package/docs/design-system/density-and-elevation.md +44 -0
- package/docs/design-system/direction-and-localization.md +23 -0
- package/docs/design-system/form-recipes.md +73 -0
- package/docs/design-system/gap-promotion-policy.md +21 -0
- package/docs/design-system/gap-promotion-report.md +166 -0
- package/docs/design-system/installation.md +68 -0
- package/docs/design-system/launch-comparison-shadcn.md +98 -0
- package/docs/design-system/registry-and-cli.md +30 -7
- package/docs/design-system/release-policy.md +30 -0
- package/docs/design-system/roadmap.md +14 -0
- package/docs/design-system/support-matrix.md +23 -0
- package/docs/design-system/tabs.md +1 -1
- package/docs/design-system/token-governance.md +23 -1
- package/package.json +29 -15
- package/registry/component-contract.json +40 -0
- package/registry/components/alert-dialog.tsx +1 -1
- package/registry/components/alert.tsx +86 -65
- package/registry/components/autocomplete.tsx +23 -9
- package/registry/components/avatar.tsx +7 -7
- package/registry/components/badge.tsx +1 -1
- package/registry/components/button-group.tsx +321 -4
- package/registry/components/button.tsx +38 -17
- package/registry/components/card.tsx +68 -59
- package/registry/components/carousel.tsx +53 -5
- package/registry/components/chart.tsx +36 -3
- package/registry/components/checkbox.tsx +3 -3
- package/registry/components/collapsible.tsx +1 -1
- package/registry/components/command.tsx +1 -1
- package/registry/components/context-menu.tsx +1 -1
- package/registry/components/date-picker.tsx +245 -104
- package/registry/components/expanded/ActivityFeed.tsx +6 -15
- package/registry/components/expanded/Banner.tsx +3 -3
- package/registry/components/expanded/Breadcrumbs.tsx +5 -5
- package/registry/components/expanded/CatalogComponentsShowcase.tsx +13 -13
- package/registry/components/expanded/CatalogDivider.tsx +1 -1
- package/registry/components/expanded/EmptyState.tsx +1 -1
- package/registry/components/expanded/FileUpload.tsx +9 -2
- package/registry/components/expanded/OnboardingStepListItem.tsx +2 -4
- package/registry/components/expanded/PageHeader.tsx +13 -13
- package/registry/components/expanded/Slideout.tsx +15 -415
- package/registry/components/expanded/Steps.tsx +4 -4
- package/registry/components/expanded/Table.tsx +116 -69
- package/registry/components/expanded/Timeline.tsx +3 -3
- package/registry/components/expanded/activityFeed.css +1 -1
- package/registry/components/expanded/breadcrumbs.css +1 -1
- package/registry/components/expanded/divider.css +1 -1
- package/registry/components/expanded/emptyState.css +1 -1
- package/registry/components/expanded/fileUpload.css +6 -6
- package/registry/components/expanded/slideout.css +9 -685
- package/registry/components/expanded/steps.css +3 -3
- package/registry/components/expanded/table.css +2 -2
- package/registry/components/expanded/timeline.css +2 -2
- package/registry/components/input-content.ts +1 -0
- package/registry/components/input-otp.tsx +13 -3
- package/registry/components/input.tsx +68 -43
- package/registry/components/item.tsx +189 -0
- package/registry/components/kbd.tsx +111 -4
- package/registry/components/menu.tsx +31 -245
- package/registry/components/menubar.tsx +1 -1
- package/registry/components/modal.tsx +142 -102
- package/registry/components/native-select.tsx +2 -2
- package/registry/components/pagination.tsx +80 -58
- package/registry/components/popover.tsx +162 -664
- package/registry/components/radio-card.tsx +116 -87
- package/registry/components/segmented-control.tsx +87 -0
- package/registry/components/select-content.tsx +2 -2
- package/registry/components/select.tsx +52 -16
- package/registry/components/sheet.tsx +1 -1
- package/registry/components/sidebar.tsx +1 -1
- package/registry/components/skeleton.css +0 -3
- package/registry/components/social-button.tsx +47 -25
- package/registry/components/spinner.tsx +18 -55
- package/registry/components/tabs.css +1 -1
- package/registry/components/tabs.tsx +8 -4
- package/registry/components/tag.tsx +2 -2
- package/registry/components/textarea.tsx +3 -3
- package/registry/components/toast.tsx +16 -11
- package/registry/components/toggle.tsx +2 -2
- package/registry/components/toolbar.tsx +89 -17
- package/registry/components/tooltip.tsx +1 -1
- package/registry/examples/alert-demo.tsx +25 -5
- package/registry/examples/attribute-demo.tsx +1 -1
- package/registry/examples/autocomplete-demo.tsx +3 -3
- package/registry/examples/avatar-demo.tsx +7 -7
- package/registry/examples/badge-demo.tsx +1 -1
- package/registry/examples/button-demo.tsx +6 -6
- package/registry/examples/button-group-demo.tsx +23 -2
- package/registry/examples/card-demo.tsx +46 -8
- package/registry/examples/carousel-demo.tsx +20 -2
- package/registry/examples/chart-demo.tsx +1 -1
- package/registry/examples/checkbox-demo.tsx +5 -5
- package/registry/examples/collection-filter-bar-demo.tsx +135 -0
- package/registry/examples/command-demo.tsx +3 -3
- package/registry/examples/{expanded/command-bar-demo.tsx → command-palette-demo.tsx} +5 -15
- package/registry/examples/context-menu-demo.tsx +1 -1
- package/registry/examples/control-density-contract-demo.tsx +61 -0
- package/registry/examples/date-picker-demo.tsx +12 -12
- package/registry/examples/divider-demo.tsx +3 -3
- package/registry/examples/expanded/banner-demo.tsx +1 -1
- package/registry/examples/expanded/breadcrumbs-demo.tsx +1 -1
- package/registry/examples/expanded/empty-state-demo.tsx +1 -1
- package/registry/examples/expanded/file-upload-demo.tsx +1 -1
- package/registry/examples/expanded/onboarding-step-demo.tsx +1 -1
- package/registry/examples/expanded/slideout-demo.tsx +2 -2
- package/registry/examples/expanded/steps-demo.tsx +1 -1
- package/registry/examples/expanded/tabs-demo.tsx +1 -1
- package/registry/examples/expanded/timeline-demo.tsx +1 -1
- package/registry/examples/hover-card-demo.tsx +2 -2
- package/registry/examples/input-demo.tsx +6 -6
- package/registry/examples/input-otp-demo.tsx +4 -4
- package/registry/examples/item-demo.tsx +46 -0
- package/registry/examples/kbd-demo.tsx +1 -1
- package/registry/examples/label-demo.tsx +1 -1
- package/registry/examples/menu-demo.tsx +1 -1
- package/registry/examples/modal-demo.tsx +67 -9
- package/registry/examples/navigation-menu-demo.tsx +1 -1
- package/registry/examples/pagination-demo.tsx +6 -3
- package/registry/examples/popover-demo.tsx +19 -19
- package/registry/examples/progress-demo.tsx +1 -1
- package/registry/examples/progress-slider-demo.tsx +1 -1
- package/registry/examples/radio-card-demo.tsx +4 -4
- package/registry/examples/radio-group-demo.tsx +2 -2
- package/registry/examples/resizable-demo.tsx +1 -1
- package/registry/examples/results-toolbar-demo.tsx +44 -0
- package/registry/examples/scroll-area-demo.tsx +3 -3
- package/registry/examples/segmented-control-demo.tsx +39 -0
- package/registry/examples/select-demo.tsx +1 -1
- package/registry/examples/sidebar-demo.tsx +1 -1
- package/registry/examples/slider-demo.tsx +3 -3
- package/registry/examples/social-button-demo.tsx +18 -8
- package/registry/examples/spinner-demo.tsx +13 -13
- package/registry/examples/tabs-demo.tsx +1 -1
- package/registry/examples/tag-demo.tsx +1 -1
- package/registry/examples/textarea-demo.tsx +4 -4
- package/registry/examples/toast-demo.tsx +1 -1
- package/registry/examples/toggle-demo.tsx +6 -6
- package/registry/examples/tooltip-demo.tsx +4 -4
- package/registry/guidance/USAGE.md +27 -0
- package/registry/hooks/use-direction.ts +193 -13
- package/registry/index.json +5311 -377
- package/registry/styles/globals.css +2440 -4061
- package/registry.json +119 -149
- package/schema/config.schema.json +11 -8
- package/schema/registry.schema.json +150 -45
- package/schema/tokens.schema.json +134 -34
- package/src/cli/command-line.js +194 -0
- package/src/cli/config-editors.js +9 -0
- package/src/cli/doctor.js +399 -0
- package/src/cli/file-transaction.js +295 -0
- package/src/cli/global-css.js +153 -0
- package/src/cli/index.js +567 -1613
- package/src/cli/install-plan.js +592 -0
- package/src/cli/install-receipt.js +171 -0
- package/src/cli/jsonc.js +203 -0
- package/src/cli/package-install-state.js +254 -0
- package/src/cli/package-manager.js +238 -0
- package/src/cli/package-plan.js +185 -0
- package/src/cli/package-version.js +97 -0
- package/src/cli/registry-query.js +207 -0
- package/src/cli/reporting.js +55 -0
- package/src/cli/schema-validation.js +19 -0
- package/src/cli/source-scanner.js +686 -0
- package/src/cli/vite-config.js +478 -0
- package/tokens/banhaten.tokens.json +4312 -309
- package/docs/design-system/components/command-bar.md +0 -57
- package/registry/components/expanded/BannerBoard.tsx +0 -225
- package/registry/components/expanded/CatalogTag.tsx +0 -85
- package/registry/components/expanded/CommandBar.tsx +0 -386
- package/registry/components/expanded/IconExplorer.tsx +0 -612
- package/registry/components/expanded/TimelineShowcase.tsx +0 -158
- package/registry/components/expanded/commandBar.css +0 -470
- package/registry/components/expanded/iconExplorer.css +0 -764
- package/registry/components/expanded/iconPacks.ts +0 -866
- package/registry/components/expanded/tag.css +0 -148
- package/registry/examples/expanded/icons-demo.tsx +0 -5
- package/tokens/Color mode.zip +0 -0
- package/tokens/Numbers.zip +0 -0
- package/tokens/Radius.zip +0 -0
- package/tokens/Theme.zip +0 -0
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
} from "lucide-react"
|
|
11
11
|
|
|
12
12
|
import { cn } from "@/lib/utils"
|
|
13
|
+
import { useResolvedDirection } from "@/hooks/use-direction"
|
|
13
14
|
|
|
14
15
|
const alertVariants = cva(
|
|
15
16
|
[
|
|
@@ -35,11 +36,11 @@ const alertVariants = cva(
|
|
|
35
36
|
false:
|
|
36
37
|
"h-[var(--bh-alert-compact-height)] w-[var(--bh-alert-compact-width)] items-center gap-[var(--bh-space-xl-12)] rounded-[var(--bh-alert-compact-radius)] p-[var(--bh-alert-compact-padding)]",
|
|
37
38
|
true:
|
|
38
|
-
"
|
|
39
|
+
"w-[var(--bh-alert-expanded-width)] items-start gap-[var(--bh-space-xl-12)] rounded-[var(--bh-alert-expanded-radius)] px-[var(--bh-alert-expanded-padding-x)] py-[var(--bh-alert-expanded-padding-y)]",
|
|
39
40
|
},
|
|
40
41
|
},
|
|
41
42
|
defaultVariants: {
|
|
42
|
-
status: "
|
|
43
|
+
status: "neutral",
|
|
43
44
|
isExpandable: false,
|
|
44
45
|
},
|
|
45
46
|
}
|
|
@@ -48,9 +49,21 @@ const alertVariants = cva(
|
|
|
48
49
|
type AlertStatus = "danger" | "success" | "warning" | "info" | "neutral"
|
|
49
50
|
type AlertDirection = "ltr" | "rtl"
|
|
50
51
|
|
|
52
|
+
type AlertMessages = {
|
|
53
|
+
close: string
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const defaultAlertMessages: AlertMessages = {
|
|
57
|
+
close: "Close alert",
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const arabicAlertMessages: AlertMessages = {
|
|
61
|
+
close: "\u0625\u063a\u0644\u0627\u0642 \u0627\u0644\u062a\u0646\u0628\u064a\u0647",
|
|
62
|
+
}
|
|
63
|
+
|
|
51
64
|
type AlertAction = {
|
|
52
65
|
label: React.ReactNode
|
|
53
|
-
onClick
|
|
66
|
+
onClick: () => void
|
|
54
67
|
}
|
|
55
68
|
|
|
56
69
|
type AlertProps = Omit<
|
|
@@ -62,6 +75,7 @@ type AlertProps = Omit<
|
|
|
62
75
|
closeLabel?: string
|
|
63
76
|
description?: React.ReactNode
|
|
64
77
|
dir?: AlertDirection
|
|
78
|
+
messages?: Partial<AlertMessages>
|
|
65
79
|
onClose?: () => void
|
|
66
80
|
showActions?: boolean
|
|
67
81
|
showCloseButton?: boolean
|
|
@@ -69,28 +83,6 @@ type AlertProps = Omit<
|
|
|
69
83
|
title?: React.ReactNode
|
|
70
84
|
}
|
|
71
85
|
|
|
72
|
-
const defaultActions: Record<AlertDirection, AlertAction[]> = {
|
|
73
|
-
ltr: [{ label: "Action" }, { label: "Action" }],
|
|
74
|
-
rtl: [
|
|
75
|
-
{ label: "\u0632\u0631 \u0627\u0644\u0631\u0627\u0628\u0637" },
|
|
76
|
-
{ label: "\u0632\u0631 \u0627\u0644\u0631\u0627\u0628\u0637" },
|
|
77
|
-
],
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const defaultCopy = {
|
|
81
|
-
ltr: {
|
|
82
|
-
title: "Alert title",
|
|
83
|
-
description:
|
|
84
|
-
"Lorem ipsum dolor sit amet consectetur. Libero feugiat velit risus egestas blandit eget curabitur.",
|
|
85
|
-
},
|
|
86
|
-
rtl: {
|
|
87
|
-
title:
|
|
88
|
-
"\u0623\u062f\u062e\u0644 \u0639\u0646\u0648\u0627\u0646 \u0627\u0644\u062a\u0646\u0628\u064a\u0647 \u0627\u0644\u062e\u0627\u0635 \u0628\u0643 \u0647\u0646\u0627!",
|
|
89
|
-
description:
|
|
90
|
-
"\u0623\u062f\u062e\u0644 \u0648\u0635\u0641 \u0627\u0644\u062a\u0646\u0628\u064a\u0647 \u0647\u0646\u0627\u060c \u0633\u064a\u0628\u062f\u0648 \u0623\u0641\u0636\u0644 \u0643\u0633\u0637\u0631\u064a\u0646 \u0645\u0646 \u0627\u0644\u0646\u0635.",
|
|
91
|
-
},
|
|
92
|
-
}
|
|
93
|
-
|
|
94
86
|
const Alert = React.forwardRef<HTMLElement, AlertProps>(function Alert(
|
|
95
87
|
{
|
|
96
88
|
actions,
|
|
@@ -98,37 +90,57 @@ const Alert = React.forwardRef<HTMLElement, AlertProps>(function Alert(
|
|
|
98
90
|
className,
|
|
99
91
|
closeLabel,
|
|
100
92
|
description,
|
|
101
|
-
dir
|
|
93
|
+
dir,
|
|
102
94
|
isExpandable = false,
|
|
95
|
+
messages: messageOverrides,
|
|
103
96
|
onClose,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
97
|
+
role,
|
|
98
|
+
showActions,
|
|
99
|
+
showCloseButton,
|
|
100
|
+
status = "neutral",
|
|
107
101
|
title,
|
|
108
102
|
...props
|
|
109
103
|
},
|
|
110
104
|
ref
|
|
111
105
|
) {
|
|
112
|
-
const
|
|
113
|
-
const
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
106
|
+
const rootRef = React.useRef<HTMLElement | null>(null)
|
|
107
|
+
const resolvedDirection = useResolvedDirection(dir, rootRef)
|
|
108
|
+
const setRootRef = React.useCallback(
|
|
109
|
+
(node: HTMLElement | null) => {
|
|
110
|
+
rootRef.current = node
|
|
111
|
+
if (typeof ref === "function") ref(node)
|
|
112
|
+
else if (ref) ref.current = node
|
|
113
|
+
},
|
|
114
|
+
[ref]
|
|
115
|
+
)
|
|
116
|
+
const resolvedStatus = status ?? "neutral"
|
|
117
|
+
const renderedTitle = title ?? children
|
|
118
|
+
const requestedActions = (showActions ?? Boolean(actions?.length))
|
|
119
|
+
? (actions ?? [])
|
|
120
|
+
: []
|
|
121
|
+
const expanded = Boolean(isExpandable && requestedActions.length > 0)
|
|
122
|
+
const visibleActions = requestedActions.slice(0, expanded ? 2 : 1)
|
|
123
|
+
const visibleCloseButton = showCloseButton ?? Boolean(onClose)
|
|
124
|
+
const resolvedCloseLabel =
|
|
125
|
+
closeLabel ?? messageOverrides?.close ?? defaultAlertMessages.close
|
|
126
|
+
const resolvedRole =
|
|
127
|
+
role ??
|
|
128
|
+
(resolvedStatus === "danger" || resolvedStatus === "warning"
|
|
129
|
+
? "alert"
|
|
130
|
+
: "status")
|
|
119
131
|
|
|
120
132
|
return (
|
|
121
133
|
<section
|
|
122
134
|
data-slot="alert"
|
|
123
135
|
data-status={resolvedStatus}
|
|
124
136
|
data-expandable={expanded ? "true" : "false"}
|
|
125
|
-
dir={
|
|
126
|
-
ref={
|
|
137
|
+
dir={resolvedDirection}
|
|
138
|
+
ref={setRootRef}
|
|
139
|
+
role={resolvedRole}
|
|
127
140
|
className={cn(
|
|
128
141
|
alertVariants({ status: resolvedStatus, isExpandable: expanded }),
|
|
129
|
-
expanded && dir === "rtl" && "h-[var(--bh-alert-expanded-rtl-height)]",
|
|
130
142
|
expanded &&
|
|
131
|
-
|
|
143
|
+
resolvedDirection === "ltr" &&
|
|
132
144
|
resolvedStatus === "neutral" &&
|
|
133
145
|
"[--alert-border:var(--bh-border-default)]",
|
|
134
146
|
className
|
|
@@ -154,36 +166,39 @@ const Alert = React.forwardRef<HTMLElement, AlertProps>(function Alert(
|
|
|
154
166
|
data-slot="alert-copy"
|
|
155
167
|
className={cn(
|
|
156
168
|
"flex flex-[1_0_0] min-w-0 text-start",
|
|
157
|
-
expanded && "flex-col
|
|
158
|
-
|
|
169
|
+
expanded && "flex-col gap-[var(--bh-space-xl-12)]",
|
|
170
|
+
resolvedDirection === "rtl" && "text-right"
|
|
159
171
|
)}
|
|
160
172
|
>
|
|
161
173
|
<div
|
|
162
174
|
data-slot="alert-info"
|
|
163
175
|
className={cn(
|
|
164
176
|
"flex w-full min-w-0 flex-[1_0_0] flex-col justify-center gap-[var(--bh-space-xs-4)]",
|
|
165
|
-
|
|
177
|
+
expanded && "flex-none",
|
|
178
|
+
resolvedDirection === "rtl" && "items-end text-right"
|
|
166
179
|
)}
|
|
167
180
|
>
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
181
|
+
{renderedTitle !== undefined ? (
|
|
182
|
+
<p
|
|
183
|
+
data-slot="alert-title"
|
|
184
|
+
dir="auto"
|
|
185
|
+
className={cn(
|
|
186
|
+
"m-0 min-w-0 w-full break-words text-[length:var(--bh-text-body-md-medium-font-size)] font-[var(--bh-font-weight-medium)] leading-[var(--bh-text-body-md-medium-line-height)] tracking-[var(--bh-text-body-md-medium-letter-spacing)] text-[var(--alert-title)]",
|
|
187
|
+
resolvedDirection === "rtl" && "[direction:rtl] text-right leading-[var(--bh-text-body-sm-regular-line-height)]"
|
|
188
|
+
)}
|
|
189
|
+
>
|
|
190
|
+
{renderedTitle}
|
|
191
|
+
</p>
|
|
192
|
+
) : null}
|
|
193
|
+
{expanded && description !== undefined ? (
|
|
179
194
|
<p
|
|
180
195
|
data-slot="alert-description"
|
|
181
196
|
dir="auto"
|
|
182
197
|
className="m-0 w-full break-words text-[length:var(--bh-text-body-sm-regular-font-size)] font-[var(--bh-font-weight-regular)] leading-[var(--bh-text-body-sm-regular-line-height)] tracking-[var(--bh-text-body-sm-regular-letter-spacing)] text-[var(--alert-description)] opacity-[var(--bh-opacity-80)]"
|
|
183
198
|
>
|
|
184
|
-
{
|
|
199
|
+
{description}
|
|
185
200
|
</p>
|
|
186
|
-
)}
|
|
201
|
+
) : null}
|
|
187
202
|
</div>
|
|
188
203
|
|
|
189
204
|
{expanded && visibleActions.length > 0 && (
|
|
@@ -196,10 +211,10 @@ const Alert = React.forwardRef<HTMLElement, AlertProps>(function Alert(
|
|
|
196
211
|
<AlertActions actions={visibleActions} />
|
|
197
212
|
)}
|
|
198
213
|
|
|
199
|
-
{
|
|
214
|
+
{visibleCloseButton && (
|
|
200
215
|
<button
|
|
201
216
|
data-slot="alert-close"
|
|
202
|
-
aria-label={
|
|
217
|
+
aria-label={resolvedCloseLabel}
|
|
203
218
|
className="inline-flex size-[var(--bh-alert-icon-size)] shrink-0 cursor-pointer items-center justify-center rounded-[var(--bh-radius-full)] border-0 bg-transparent p-0 text-[var(--bh-content-subtle)] outline-none focus-visible:shadow-[var(--shadow-button-focus)]"
|
|
204
219
|
onClick={onClose}
|
|
205
220
|
type="button"
|
|
@@ -211,7 +226,11 @@ const Alert = React.forwardRef<HTMLElement, AlertProps>(function Alert(
|
|
|
211
226
|
)
|
|
212
227
|
})
|
|
213
228
|
|
|
214
|
-
function AlertActions({
|
|
229
|
+
function AlertActions({
|
|
230
|
+
actions,
|
|
231
|
+
}: {
|
|
232
|
+
actions: AlertAction[]
|
|
233
|
+
}) {
|
|
215
234
|
return (
|
|
216
235
|
<div
|
|
217
236
|
data-slot="alert-actions"
|
|
@@ -234,35 +253,37 @@ function AlertActions({ actions }: { actions: AlertAction[] }) {
|
|
|
234
253
|
|
|
235
254
|
function AlertStatusIcon({ status }: { status: AlertStatus }) {
|
|
236
255
|
if (status === "success") {
|
|
237
|
-
return <CircleCheckIcon aria-hidden="true" className="size-[var(--bh-alert-icon-size)]" strokeWidth=
|
|
256
|
+
return <CircleCheckIcon aria-hidden="true" className="size-[var(--bh-alert-icon-size)]" strokeWidth="var(--bh-icon-stroke-225)" />
|
|
238
257
|
}
|
|
239
258
|
|
|
240
259
|
if (status === "warning") {
|
|
241
|
-
return <TriangleAlertIcon aria-hidden="true" className="size-[var(--bh-alert-icon-size)]" strokeWidth=
|
|
260
|
+
return <TriangleAlertIcon aria-hidden="true" className="size-[var(--bh-alert-icon-size)]" strokeWidth="var(--bh-icon-stroke-225)" />
|
|
242
261
|
}
|
|
243
262
|
|
|
244
263
|
if (status === "info") {
|
|
245
|
-
return <InfoIcon aria-hidden="true" className="size-[var(--bh-alert-icon-size)]" strokeWidth=
|
|
264
|
+
return <InfoIcon aria-hidden="true" className="size-[var(--bh-alert-icon-size)]" strokeWidth="var(--bh-icon-stroke-225)" />
|
|
246
265
|
}
|
|
247
266
|
|
|
248
267
|
if (status === "neutral") {
|
|
249
|
-
return <StarIcon aria-hidden="true" className="size-[var(--bh-alert-icon-size)]" strokeWidth=
|
|
268
|
+
return <StarIcon aria-hidden="true" className="size-[var(--bh-alert-icon-size)]" strokeWidth="var(--bh-icon-stroke-225)" />
|
|
250
269
|
}
|
|
251
270
|
|
|
252
|
-
return <CircleAlertIcon aria-hidden="true" className="size-[var(--bh-alert-icon-size)]" strokeWidth=
|
|
271
|
+
return <CircleAlertIcon aria-hidden="true" className="size-[var(--bh-alert-icon-size)]" strokeWidth="var(--bh-icon-stroke-225)" />
|
|
253
272
|
}
|
|
254
273
|
|
|
255
274
|
function CloseIcon() {
|
|
256
275
|
return (
|
|
257
|
-
<XIcon aria-hidden="true" className="size-[var(--bh-alert-icon-size)]" strokeWidth=
|
|
276
|
+
<XIcon aria-hidden="true" className="size-[var(--bh-alert-icon-size)]" strokeWidth="var(--bh-icon-stroke-225)" />
|
|
258
277
|
)
|
|
259
278
|
}
|
|
260
279
|
|
|
261
280
|
export {
|
|
281
|
+
arabicAlertMessages,
|
|
262
282
|
Alert,
|
|
263
283
|
alertVariants,
|
|
264
284
|
type AlertAction,
|
|
265
285
|
type AlertDirection,
|
|
286
|
+
type AlertMessages,
|
|
266
287
|
type AlertProps,
|
|
267
288
|
type AlertStatus,
|
|
268
289
|
}
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
type SelectItemType,
|
|
14
14
|
} from "./select"
|
|
15
15
|
import { Tag, type TagSize } from "./tag"
|
|
16
|
+
import { Popover, PopoverAnchor, PopoverContent } from "./popover"
|
|
16
17
|
|
|
17
18
|
import { cn } from "@/lib/utils"
|
|
18
19
|
|
|
@@ -404,8 +405,13 @@ const Autocomplete = React.forwardRef<HTMLDivElement, AutocompleteProps>(
|
|
|
404
405
|
</div>
|
|
405
406
|
) : null}
|
|
406
407
|
|
|
407
|
-
<
|
|
408
|
-
|
|
408
|
+
<Popover
|
|
409
|
+
className="w-full"
|
|
410
|
+
open={menuOpen}
|
|
411
|
+
onOpenChange={setMenuOpen}
|
|
412
|
+
>
|
|
413
|
+
<PopoverAnchor asChild>
|
|
414
|
+
<Input
|
|
409
415
|
aria-activedescendant={activeOptionId}
|
|
410
416
|
aria-autocomplete="list"
|
|
411
417
|
aria-controls={menuOpen ? listboxId : undefined}
|
|
@@ -424,7 +430,7 @@ const Autocomplete = React.forwardRef<HTMLDivElement, AutocompleteProps>(
|
|
|
424
430
|
aria-hidden="true"
|
|
425
431
|
className="size-[var(--bh-input-icon-size)]"
|
|
426
432
|
focusable="false"
|
|
427
|
-
strokeWidth=
|
|
433
|
+
strokeWidth="var(--bh-icon-stroke-225)"
|
|
428
434
|
/>
|
|
429
435
|
}
|
|
430
436
|
placeholder={placeholder}
|
|
@@ -439,14 +445,22 @@ const Autocomplete = React.forwardRef<HTMLDivElement, AutocompleteProps>(
|
|
|
439
445
|
onClick={handleInputClick}
|
|
440
446
|
onFocus={handleInputFocus}
|
|
441
447
|
onKeyDown={handleInputKeyDown}
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
448
|
+
/>
|
|
449
|
+
</PopoverAnchor>
|
|
450
|
+
|
|
451
|
+
<PopoverContent
|
|
452
|
+
align="start"
|
|
453
|
+
role="presentation"
|
|
454
|
+
showArrow={false}
|
|
455
|
+
size="auto"
|
|
456
|
+
className="w-[var(--bh-select-menu-width)] bg-transparent p-0 shadow-none"
|
|
457
|
+
onOpenAutoFocus={(event) => event.preventDefault()}
|
|
458
|
+
>
|
|
445
459
|
<SelectMenu
|
|
446
460
|
aria-multiselectable={isMultiple || undefined}
|
|
447
461
|
id={listboxId}
|
|
448
462
|
className={cn(
|
|
449
|
-
"
|
|
463
|
+
"max-h-[var(--bh-autocomplete-menu-max-height,var(--bh-space-18xl-320))] overflow-y-auto",
|
|
450
464
|
menuClassName
|
|
451
465
|
)}
|
|
452
466
|
>
|
|
@@ -486,8 +500,8 @@ const Autocomplete = React.forwardRef<HTMLDivElement, AutocompleteProps>(
|
|
|
486
500
|
</div>
|
|
487
501
|
)}
|
|
488
502
|
</SelectMenu>
|
|
489
|
-
|
|
490
|
-
</
|
|
503
|
+
</PopoverContent>
|
|
504
|
+
</Popover>
|
|
491
505
|
|
|
492
506
|
{shouldRenderHelper ? (
|
|
493
507
|
<SelectHelperText
|
|
@@ -212,7 +212,7 @@ function AvatarIcon({
|
|
|
212
212
|
<UserIcon
|
|
213
213
|
aria-hidden="true"
|
|
214
214
|
className="size-[var(--bh-avatar-icon-size)]"
|
|
215
|
-
strokeWidth=
|
|
215
|
+
strokeWidth="var(--bh-icon-stroke-210)"
|
|
216
216
|
/>
|
|
217
217
|
)}
|
|
218
218
|
</span>
|
|
@@ -253,7 +253,7 @@ function AvatarStatus({
|
|
|
253
253
|
<BanIcon
|
|
254
254
|
aria-hidden="true"
|
|
255
255
|
className="size-full"
|
|
256
|
-
strokeWidth=
|
|
256
|
+
strokeWidth="var(--bh-icon-stroke-240)"
|
|
257
257
|
/>
|
|
258
258
|
) : null}
|
|
259
259
|
</span>
|
|
@@ -298,7 +298,7 @@ function AvatarGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
298
298
|
function AvatarGroupCount({
|
|
299
299
|
className,
|
|
300
300
|
children,
|
|
301
|
-
dir
|
|
301
|
+
dir,
|
|
302
302
|
size,
|
|
303
303
|
...props
|
|
304
304
|
}: React.ComponentProps<"span"> & VariantProps<typeof avatarVariants>) {
|
|
@@ -327,7 +327,7 @@ function AvatarActionIcon({
|
|
|
327
327
|
<PencilIcon
|
|
328
328
|
aria-hidden="true"
|
|
329
329
|
className="size-[var(--bh-avatar-action-icon-size)]"
|
|
330
|
-
strokeWidth=
|
|
330
|
+
strokeWidth="var(--bh-icon-stroke-260)"
|
|
331
331
|
/>
|
|
332
332
|
)
|
|
333
333
|
}
|
|
@@ -337,7 +337,7 @@ function AvatarActionIcon({
|
|
|
337
337
|
<XIcon
|
|
338
338
|
aria-hidden="true"
|
|
339
339
|
className="size-[var(--bh-avatar-action-icon-size)]"
|
|
340
|
-
strokeWidth=
|
|
340
|
+
strokeWidth="var(--bh-icon-stroke-280)"
|
|
341
341
|
/>
|
|
342
342
|
)
|
|
343
343
|
}
|
|
@@ -347,7 +347,7 @@ function AvatarActionIcon({
|
|
|
347
347
|
<BadgeCheckIcon
|
|
348
348
|
aria-hidden="true"
|
|
349
349
|
className="size-[var(--bh-avatar-action-size)] fill-current text-[var(--bh-bg-accent-sky-base)] [stroke:var(--bh-content-on-brand)]"
|
|
350
|
-
strokeWidth=
|
|
350
|
+
strokeWidth="var(--bh-icon-stroke-240)"
|
|
351
351
|
/>
|
|
352
352
|
)
|
|
353
353
|
}
|
|
@@ -356,7 +356,7 @@ function AvatarActionIcon({
|
|
|
356
356
|
<PlusIcon
|
|
357
357
|
aria-hidden="true"
|
|
358
358
|
className="size-[var(--bh-avatar-action-icon-size)]"
|
|
359
|
-
strokeWidth=
|
|
359
|
+
strokeWidth="var(--bh-icon-stroke-260)"
|
|
360
360
|
/>
|
|
361
361
|
)
|
|
362
362
|
}
|
|
@@ -60,7 +60,7 @@ const legacyVariantMap: Record<
|
|
|
60
60
|
badgeStyle: "light",
|
|
61
61
|
color: "blue",
|
|
62
62
|
className:
|
|
63
|
-
"bg-[var(--bh-interactive-ghost-default)] px-[var(--bh-space-none)] text-[var(--bh-content-link)] underline-offset-4 [a&]:hover:underline",
|
|
63
|
+
"bg-[var(--bh-interactive-ghost-default)] px-[var(--bh-space-none)] text-[var(--bh-content-link)] underline-offset-[var(--bh-space-xs-4)] [a&]:hover:underline",
|
|
64
64
|
},
|
|
65
65
|
}
|
|
66
66
|
|