@noix-dev/brix-vue 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +74 -2
- package/package.json +117 -3
- package/src/components/address-field/AddressField.vue +337 -0
- package/src/components/address-field/index.ts +1 -0
- package/src/components/appearance-picker/AppearancePicker.vue +502 -0
- package/src/components/appearance-picker/AppearanceSegment.vue +175 -0
- package/src/components/appearance-picker/index.ts +44 -0
- package/src/components/autofill/AutoFillDialog.vue +264 -0
- package/src/components/autofill/index.ts +1 -0
- package/src/components/badge/Badge.vue +23 -0
- package/src/components/badge/index.ts +106 -0
- package/src/components/build-stamp/BuildStamp.vue +62 -0
- package/src/components/build-stamp/index.ts +1 -0
- package/src/components/button/Button.vue +31 -0
- package/src/components/button/index.ts +122 -0
- package/src/components/card/Card.vue +29 -0
- package/src/components/card/CardAction.vue +17 -0
- package/src/components/card/CardContent.vue +14 -0
- package/src/components/card/CardDescription.vue +14 -0
- package/src/components/card/CardFooter.vue +22 -0
- package/src/components/card/CardHeader.vue +22 -0
- package/src/components/card/CardTitle.vue +29 -0
- package/src/components/card/index.ts +47 -0
- package/src/components/chart/BarChart.vue +123 -0
- package/src/components/chart/StackedBarChart.vue +149 -0
- package/src/components/chart/appearanceRevision.ts +22 -0
- package/src/components/chart/chartColor.ts +59 -0
- package/src/components/chart/index.ts +6 -0
- package/src/components/checkbox/Checkbox.vue +61 -0
- package/src/components/checkbox/index.ts +1 -0
- package/src/components/code-editor/CodeEditor.vue +352 -0
- package/src/components/code-editor/index.ts +9 -0
- package/src/components/code-editor/syntaxTheme.ts +110 -0
- package/src/components/colour-picker/ColourPicker.vue +421 -0
- package/src/components/colour-picker/index.ts +1 -0
- package/src/components/combobox/Combobox.vue +337 -0
- package/src/components/combobox/index.ts +1 -0
- package/src/components/comments/CommentComposer.vue +302 -0
- package/src/components/comments/CommentMessage.vue +259 -0
- package/src/components/comments/CommentThread.vue +250 -0
- package/src/components/comments/commentBody.ts +185 -0
- package/src/components/comments/commentLevels.ts +139 -0
- package/src/components/comments/commentNode.ts +35 -0
- package/src/components/comments/composer.ts +20 -0
- package/src/components/comments/index.ts +29 -0
- package/src/components/confirm-dialog/ConfirmDialog.vue +153 -0
- package/src/components/confirm-dialog/index.ts +1 -0
- package/src/components/containers/Box.vue +42 -0
- package/src/components/containers/Section.vue +88 -0
- package/src/components/containers/SectionAction.vue +17 -0
- package/src/components/containers/SectionContent.vue +14 -0
- package/src/components/containers/SectionDescription.vue +14 -0
- package/src/components/containers/SectionHeader.vue +22 -0
- package/src/components/containers/SectionTitle.vue +17 -0
- package/src/components/containers/index.ts +9 -0
- package/src/components/data-table/ColumnMenu.vue +241 -0
- package/src/components/data-table/DataTable.vue +447 -0
- package/src/components/data-table/ExpandCaret.vue +34 -0
- package/src/components/data-table/SortableHead.vue +184 -0
- package/src/components/data-table/TableLoadingRow.vue +13 -0
- package/src/components/data-table/TableProgressRow.vue +26 -0
- package/src/components/data-table/columns.ts +13 -0
- package/src/components/data-table/index.ts +3 -0
- package/src/components/data-table/pinned.ts +19 -0
- package/src/components/data-table/rowActivation.ts +14 -0
- package/src/components/data-table/sort.ts +13 -0
- package/src/components/data-table/types.ts +23 -0
- package/src/components/date-picker/CalendarPanel.vue +432 -0
- package/src/components/date-picker/DateField.vue +293 -0
- package/src/components/date-picker/DatePicker.vue +147 -0
- package/src/components/date-picker/UntilDatePicker.vue +96 -0
- package/src/components/date-picker/dateFieldGuard.ts +87 -0
- package/src/components/date-picker/index.ts +4 -0
- package/src/components/date-picker/useDateField.ts +37 -0
- package/src/components/date-range-picker/DateRangePicker.vue +247 -0
- package/src/components/date-range-picker/index.ts +1 -0
- package/src/components/date-time-picker/DateTimePicker.vue +291 -0
- package/src/components/date-time-picker/index.ts +1 -0
- package/src/components/dialog/Dialog.vue +250 -0
- package/src/components/dialog/DialogSurface.vue +214 -0
- package/src/components/dialog/dialogEdges.ts +65 -0
- package/src/components/dialog/dialogSizes.ts +35 -0
- package/src/components/dialog/index.ts +12 -0
- package/src/components/dialog/toastHost.ts +18 -0
- package/src/components/dropdown/Dropdown.vue +101 -0
- package/src/components/dropdown/DropdownItems.vue +154 -0
- package/src/components/dropdown/dropdown.ts +64 -0
- package/src/components/dropdown/index.ts +2 -0
- package/src/components/file-preview/FilePreview.vue +78 -0
- package/src/components/file-preview/index.ts +1 -0
- package/src/components/file-upload/FileUpload.vue +234 -0
- package/src/components/file-upload/index.ts +1 -0
- package/src/components/filter-check-menu/FilterCheckMenu.vue +562 -0
- package/src/components/filter-check-menu/filterCheckOption.ts +10 -0
- package/src/components/filter-check-menu/index.ts +2 -0
- package/src/components/form-field/FormField.vue +74 -0
- package/src/components/form-field/index.ts +2 -0
- package/src/components/form-field/types.ts +5 -0
- package/src/components/frames/FrameCentred.vue +137 -0
- package/src/components/frames/FrameSidebar.vue +113 -0
- package/src/components/frames/FrameSplit.vue +109 -0
- package/src/components/frames/index.ts +3 -0
- package/src/components/icon/BellIcon.vue +27 -0
- package/src/components/icon/BoldIcon.vue +31 -0
- package/src/components/icon/CalendarDaysIcon.vue +33 -0
- package/src/components/icon/CheckIcon.vue +31 -0
- package/src/components/icon/ChevronDownIcon.vue +30 -0
- package/src/components/icon/ChevronLeftIcon.vue +31 -0
- package/src/components/icon/ChevronRightIcon.vue +31 -0
- package/src/components/icon/ChevronUpIcon.vue +30 -0
- package/src/components/icon/CircleAlertIcon.vue +29 -0
- package/src/components/icon/ClockIcon.vue +31 -0
- package/src/components/icon/Columns3Icon.vue +32 -0
- package/src/components/icon/FlipHorizontalIcon.vue +29 -0
- package/src/components/icon/ItalicIcon.vue +28 -0
- package/src/components/icon/LinkIcon.vue +27 -0
- package/src/components/icon/ListIcon.vue +29 -0
- package/src/components/icon/ListOrderedIcon.vue +28 -0
- package/src/components/icon/PenLineIcon.vue +31 -0
- package/src/components/icon/PlusIcon.vue +28 -0
- package/src/components/icon/RotateCcwIcon.vue +28 -0
- package/src/components/icon/RotateCwIcon.vue +28 -0
- package/src/components/icon/SearchIcon.vue +31 -0
- package/src/components/icon/StarIcon.vue +29 -0
- package/src/components/icon/TriangleAlertIcon.vue +29 -0
- package/src/components/icon/UnderlineIcon.vue +27 -0
- package/src/components/icon/Undo2Icon.vue +28 -0
- package/src/components/icon/XIcon.vue +31 -0
- package/src/components/icon/ZoomInIcon.vue +30 -0
- package/src/components/icon/ZoomOutIcon.vue +29 -0
- package/src/components/icon/index.ts +37 -0
- package/src/components/icon-picker/IconPicker.vue +560 -0
- package/src/components/icon-picker/index.ts +1 -0
- package/src/components/image-crop-dialog/CropRatioRow.vue +132 -0
- package/src/components/image-crop-dialog/CropVariantStrip.vue +277 -0
- package/src/components/image-crop-dialog/ImageCropDialog.vue +1541 -0
- package/src/components/image-crop-dialog/index.ts +16 -0
- package/src/components/image-upload/ImageUpload.vue +345 -0
- package/src/components/image-upload/index.ts +2 -0
- package/src/components/input/Input.vue +48 -0
- package/src/components/input/index.ts +1 -0
- package/src/components/keycap/Keycap.vue +49 -0
- package/src/components/keycap/index.ts +1 -0
- package/src/components/label/Label.vue +26 -0
- package/src/components/label/index.ts +1 -0
- package/src/components/menu/MenuCheckboxItem.vue +63 -0
- package/src/components/menu/MenuContent.vue +45 -0
- package/src/components/menu/MenuGroup.vue +22 -0
- package/src/components/menu/MenuItem.vue +34 -0
- package/src/components/menu/MenuLabel.vue +22 -0
- package/src/components/menu/MenuRadioGroup.vue +22 -0
- package/src/components/menu/MenuRadioItem.vue +50 -0
- package/src/components/menu/MenuRoot.vue +25 -0
- package/src/components/menu/MenuSeparator.vue +27 -0
- package/src/components/menu/MenuSub.vue +29 -0
- package/src/components/menu/MenuSubContent.vue +48 -0
- package/src/components/menu/MenuSubTrigger.vue +49 -0
- package/src/components/menu/MenuTrigger.vue +22 -0
- package/src/components/menu/index.ts +20 -0
- package/src/components/menu/menuClasses.ts +74 -0
- package/src/components/morph-select/MorphSelect.vue +150 -0
- package/src/components/morph-select/index.ts +1 -0
- package/src/components/nav/NavFlyout.vue +343 -0
- package/src/components/nav/NavGroup.vue +306 -0
- package/src/components/nav/NavItem.vue +243 -0
- package/src/components/nav/NavNodes.ts +66 -0
- package/src/components/nav/NavSection.vue +105 -0
- package/src/components/nav/NavSidebar.vue +137 -0
- package/src/components/nav/index.ts +5 -0
- package/src/components/nav/navChain.ts +112 -0
- package/src/components/nav/navClasses.ts +229 -0
- package/src/components/nav/navNode.ts +10 -0
- package/src/components/nav/navRegistry.ts +24 -0
- package/src/components/notification-list/NotificationList.vue +314 -0
- package/src/components/notification-list/index.ts +2 -0
- package/src/components/notification-list/notifications.ts +21 -0
- package/src/components/pagination/Pagination.vue +296 -0
- package/src/components/pagination/index.ts +1 -0
- package/src/components/pin-field/PinField.vue +332 -0
- package/src/components/pin-field/index.ts +1 -0
- package/src/components/popover-panel/PopoverPanel.vue +115 -0
- package/src/components/popover-panel/index.ts +5 -0
- package/src/components/rating/Rating.vue +201 -0
- package/src/components/rating/index.ts +1 -0
- package/src/components/record-avatar/RecordAvatar.vue +76 -0
- package/src/components/record-avatar/index.ts +1 -0
- package/src/components/result-window/ResultWindow.vue +399 -0
- package/src/components/result-window/index.ts +2 -0
- package/src/components/result-window/results.ts +75 -0
- package/src/components/rich-editor/RichEditor.vue +370 -0
- package/src/components/rich-editor/RichEditorLinkDialog.vue +133 -0
- package/src/components/rich-editor/index.ts +8 -0
- package/src/components/row-actions/RowActions.vue +262 -0
- package/src/components/row-actions/index.ts +2 -0
- package/src/components/row-actions/rowActions.ts +44 -0
- package/src/components/search-select/SearchSelect.vue +599 -0
- package/src/components/search-select/index.ts +2 -0
- package/src/components/search-select/types.ts +14 -0
- package/src/components/segmented-choice/SegmentedChoice.vue +136 -0
- package/src/components/segmented-choice/index.ts +2 -0
- package/src/components/segmented-choice/segmentedOption.ts +6 -0
- package/src/components/select/Select.vue +18 -0
- package/src/components/select/SelectContent.vue +73 -0
- package/src/components/select/SelectGroup.vue +21 -0
- package/src/components/select/SelectItem.vue +47 -0
- package/src/components/select/SelectItemText.vue +12 -0
- package/src/components/select/SelectLabel.vue +17 -0
- package/src/components/select/SelectScrollDownButton.vue +36 -0
- package/src/components/select/SelectScrollUpButton.vue +36 -0
- package/src/components/select/SelectSeparator.vue +19 -0
- package/src/components/select/SelectTrigger.vue +52 -0
- package/src/components/select/SelectValue.vue +12 -0
- package/src/components/select/index.ts +11 -0
- package/src/components/session/IdleTimer.vue +71 -0
- package/src/components/session/SessionDialogs.vue +177 -0
- package/src/components/session/index.ts +2 -0
- package/src/components/split-button/SplitButton.vue +122 -0
- package/src/components/split-button/index.ts +2 -0
- package/src/components/split-button/splitButtonItem.ts +7 -0
- package/src/components/switch/Switch.vue +60 -0
- package/src/components/switch/index.ts +1 -0
- package/src/components/table/Table.vue +51 -0
- package/src/components/table/TableBody.vue +14 -0
- package/src/components/table/TableCaption.vue +17 -0
- package/src/components/table/TableCell.vue +22 -0
- package/src/components/table/TableEmpty.vue +72 -0
- package/src/components/table/TableFooter.vue +17 -0
- package/src/components/table/TableHead.vue +22 -0
- package/src/components/table/TableHeader.vue +14 -0
- package/src/components/table/TableRow.vue +22 -0
- package/src/components/table/index.ts +9 -0
- package/src/components/tabs/Tabs.vue +173 -0
- package/src/components/tabs/index.ts +2 -0
- package/src/components/tabs/tabItem.ts +12 -0
- package/src/components/textarea/LimitedTextarea.vue +81 -0
- package/src/components/textarea/TextLimitCounter.vue +107 -0
- package/src/components/textarea/Textarea.vue +42 -0
- package/src/components/textarea/index.ts +4 -0
- package/src/components/textarea/textLimit.ts +43 -0
- package/src/components/time-picker/TimePicker.vue +522 -0
- package/src/components/time-picker/index.ts +1 -0
- package/src/components/toast/ToastHost.vue +276 -0
- package/src/components/toast/index.ts +1 -0
- package/src/components/update-notice/UpdateNotice.vue +103 -0
- package/src/components/update-notice/index.ts +1 -0
- package/src/components/user-menu/UserMenu.vue +154 -0
- package/src/components/user-menu/index.ts +1 -0
- package/src/index.ts +182 -0
- package/src/lib/cn.ts +21 -0
- package/src/lib/panelFocus.ts +65 -0
- package/src/lib/sessionMonitor.ts +390 -0
- package/src/lib/slotContent.ts +17 -0
- package/src/lib/updateCheck.ts +133 -0
- package/src/styles.css +82 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useUiLabels } from '@noix-dev/brix-core';
|
|
3
|
+
import { type ComponentPublicInstance, computed, ref } from 'vue';
|
|
4
|
+
import {
|
|
5
|
+
SESSION_WARNING_MS,
|
|
6
|
+
type SessionEndReason,
|
|
7
|
+
type SessionPhase,
|
|
8
|
+
formatRemaining,
|
|
9
|
+
} from '../../lib/sessionMonitor';
|
|
10
|
+
import { Button } from '../button';
|
|
11
|
+
import { Dialog } from '../dialog';
|
|
12
|
+
import { CircleAlertIcon, TriangleAlertIcon } from '../icon';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The two dialogs of a session's life, driven by the monitor's phase: a warning while the
|
|
16
|
+
* client deadline is two minutes away, and a notice once the session has ended. State enters by
|
|
17
|
+
* props and leaves by events (ADR 0017): the component owns no timer and no open flag, so the
|
|
18
|
+
* phase is the only thing that can open or close either dialog, and it cannot drift from it.
|
|
19
|
+
*
|
|
20
|
+
* - `warning` opens the warning: a countdown, a bar that follows it, and two answers, `stay`
|
|
21
|
+
* and `logout`;
|
|
22
|
+
* - `ended` opens the notice, whose body names why (`reason`: inactivity, expiry, or a sign-out
|
|
23
|
+
* in another window; no reason at all reads as inactivity) and whose one answer is `signIn`;
|
|
24
|
+
* - `stopped` and `active` draw nothing. The two are never open together.
|
|
25
|
+
*
|
|
26
|
+
* `busy` is a stay request in flight: both buttons lock, nothing closes.
|
|
27
|
+
*
|
|
28
|
+
* COMPOSITION. Each is `Dialog` and nothing else, the way `ConfirmDialog` composes it: the
|
|
29
|
+
* overlay, the portal, the focus trap and the stacking are its. `hideClose` and `persistent`
|
|
30
|
+
* together, because Escape and a press outside must not dismiss a dialog that is answered with
|
|
31
|
+
* its own buttons, and `role="alertdialog"` because both interrupt.
|
|
32
|
+
*
|
|
33
|
+
* FOCUS. The ended dialog has one button, which reka focuses on its own. The warning's focus
|
|
34
|
+
* opens on staying signed in, the safe answer to a dialog that appears while someone is typing;
|
|
35
|
+
* reka's own default would take the first button, which is the sign-out. The event is cancelled
|
|
36
|
+
* and the focus placed, so reordering the footer cannot make signing out the default.
|
|
37
|
+
*
|
|
38
|
+
* COLOUR. Roles only, no `dark:` branch. The tone rides in a 44px tile: a 10% `--warning` wash
|
|
39
|
+
* with `--warning-on-wash` ink for the warning, the same shape in `--primary` for the ended
|
|
40
|
+
* dialog. The panel is `--popover`, lighter than the page in dark; the tile's glyph is not text
|
|
41
|
+
* and the words are `--foreground` and `--muted-foreground`, so no text rests on a wash here.
|
|
42
|
+
* The bar is a tint and a fill of `--warning` with nothing read on it (the number beside it is
|
|
43
|
+
* the reading).
|
|
44
|
+
*/
|
|
45
|
+
const props = defineProps<{
|
|
46
|
+
phase: SessionPhase;
|
|
47
|
+
/** Milliseconds until the client deadline; the warning counts it down. */
|
|
48
|
+
remainingMs: number;
|
|
49
|
+
/** Why the session ended; picks the ended dialog's body. */
|
|
50
|
+
reason: SessionEndReason | null;
|
|
51
|
+
/** A stay request is in flight: the action buttons lock. */
|
|
52
|
+
busy?: boolean;
|
|
53
|
+
}>();
|
|
54
|
+
|
|
55
|
+
const emit = defineEmits<{
|
|
56
|
+
/** The reader chose to stay signed in. */
|
|
57
|
+
stay: [];
|
|
58
|
+
/** The reader chose to sign out now. */
|
|
59
|
+
logout: [];
|
|
60
|
+
/** The reader asked to sign in again after the session ended. */
|
|
61
|
+
signIn: [];
|
|
62
|
+
}>();
|
|
63
|
+
|
|
64
|
+
const labels = useUiLabels();
|
|
65
|
+
|
|
66
|
+
/** A component ref, so the element is behind `$el`. */
|
|
67
|
+
const stay = ref<ComponentPublicInstance | null>(null);
|
|
68
|
+
|
|
69
|
+
function focusStay(event: Event): void {
|
|
70
|
+
event.preventDefault();
|
|
71
|
+
(stay.value?.$el as HTMLElement | undefined)?.focus();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const countdown = computed(() => formatRemaining(props.remainingMs));
|
|
75
|
+
const barPercent = computed(() =>
|
|
76
|
+
Math.min(100, Math.max(0, (props.remainingMs / SESSION_WARNING_MS) * 100)),
|
|
77
|
+
);
|
|
78
|
+
const endedText = computed(() => {
|
|
79
|
+
switch (props.reason) {
|
|
80
|
+
case 'expired':
|
|
81
|
+
return labels.value.endedExpired;
|
|
82
|
+
case 'elsewhere':
|
|
83
|
+
return labels.value.endedElsewhere;
|
|
84
|
+
default:
|
|
85
|
+
return labels.value.endedIdle;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
</script>
|
|
89
|
+
|
|
90
|
+
<template>
|
|
91
|
+
<Dialog
|
|
92
|
+
:open="props.phase === 'warning'"
|
|
93
|
+
:title="labels.warningTitle"
|
|
94
|
+
:description="labels.warningText"
|
|
95
|
+
persistent
|
|
96
|
+
hide-close
|
|
97
|
+
role="alertdialog"
|
|
98
|
+
data-testid="session-warning"
|
|
99
|
+
size="md"
|
|
100
|
+
@open-auto-focus="focusStay"
|
|
101
|
+
>
|
|
102
|
+
<div class="flex items-start gap-3">
|
|
103
|
+
<span
|
|
104
|
+
data-testid="session-warning-tile"
|
|
105
|
+
class="bg-warning/10 text-warning-on-wash flex size-11 shrink-0 items-center justify-center rounded-xl"
|
|
106
|
+
>
|
|
107
|
+
<TriangleAlertIcon class="size-5" />
|
|
108
|
+
</span>
|
|
109
|
+
<div class="flex min-w-0 flex-1 flex-col gap-2.5">
|
|
110
|
+
<p class="text-muted-foreground text-sm">{{ labels.warningText }}</p>
|
|
111
|
+
<p
|
|
112
|
+
data-testid="session-countdown"
|
|
113
|
+
class="text-foreground text-2xl font-semibold tabular-nums"
|
|
114
|
+
>
|
|
115
|
+
{{ countdown }}
|
|
116
|
+
</p>
|
|
117
|
+
<div class="bg-warning/10 h-1.5 overflow-hidden rounded-full" aria-hidden="true">
|
|
118
|
+
<div
|
|
119
|
+
data-testid="session-countdown-bar"
|
|
120
|
+
class="bg-warning h-full rounded-full"
|
|
121
|
+
:style="{ width: `${barPercent}%` }"
|
|
122
|
+
/>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
<template #footer>
|
|
128
|
+
<Button
|
|
129
|
+
type="button"
|
|
130
|
+
variant="outline"
|
|
131
|
+
data-testid="session-logout"
|
|
132
|
+
:disabled="props.busy"
|
|
133
|
+
@click="emit('logout')"
|
|
134
|
+
>
|
|
135
|
+
{{ labels.warningLogout }}
|
|
136
|
+
</Button>
|
|
137
|
+
<Button
|
|
138
|
+
ref="stay"
|
|
139
|
+
type="button"
|
|
140
|
+
data-testid="session-stay"
|
|
141
|
+
:disabled="props.busy"
|
|
142
|
+
@click="emit('stay')"
|
|
143
|
+
>
|
|
144
|
+
{{ labels.warningStay }}
|
|
145
|
+
</Button>
|
|
146
|
+
</template>
|
|
147
|
+
</Dialog>
|
|
148
|
+
|
|
149
|
+
<Dialog
|
|
150
|
+
:open="props.phase === 'ended'"
|
|
151
|
+
:title="labels.endedTitle"
|
|
152
|
+
:description="endedText"
|
|
153
|
+
persistent
|
|
154
|
+
hide-close
|
|
155
|
+
role="alertdialog"
|
|
156
|
+
data-testid="session-ended"
|
|
157
|
+
size="md"
|
|
158
|
+
>
|
|
159
|
+
<div class="flex items-start gap-3">
|
|
160
|
+
<span
|
|
161
|
+
data-testid="session-ended-tile"
|
|
162
|
+
class="bg-primary/10 text-primary-on-wash flex size-11 shrink-0 items-center justify-center rounded-xl"
|
|
163
|
+
>
|
|
164
|
+
<CircleAlertIcon class="size-5" />
|
|
165
|
+
</span>
|
|
166
|
+
<p data-testid="session-ended-reason" class="text-muted-foreground text-sm">
|
|
167
|
+
{{ endedText }}
|
|
168
|
+
</p>
|
|
169
|
+
</div>
|
|
170
|
+
|
|
171
|
+
<template #footer>
|
|
172
|
+
<Button type="button" data-testid="session-sign-in" @click="emit('signIn')">
|
|
173
|
+
{{ labels.endedSignIn }}
|
|
174
|
+
</Button>
|
|
175
|
+
</template>
|
|
176
|
+
</Dialog>
|
|
177
|
+
</template>
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useUiLabels } from '@noix-dev/brix-core';
|
|
3
|
+
import { cn } from '../../lib/cn';
|
|
4
|
+
import { Button } from '../button';
|
|
5
|
+
import { ChevronDownIcon } from '../icon';
|
|
6
|
+
import { MenuContent, MenuItem, MenuRoot, MenuTrigger, menuItemHintClass } from '../menu';
|
|
7
|
+
import type { SplitButtonItem } from './splitButtonItem';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A filled primary pill with an arrow joined to it: the main part runs `primary`, the arrow
|
|
11
|
+
* opens a menu of the alternatives. With no `items` it is one plain button.
|
|
12
|
+
*
|
|
13
|
+
* It only reports what was chosen (`select` with the entry's value); what each value does is
|
|
14
|
+
* the caller's business.
|
|
15
|
+
*
|
|
16
|
+
* **This is the menu composition the package's other menus copy**: the menu family's `MenuRoot`
|
|
17
|
+
* around a `MenuTrigger` (as-child, so the trigger is a real `Button`) and the
|
|
18
|
+
* `../menu` family's `MenuContent` and `MenuItem`. Those carry the portal (no `to`,
|
|
19
|
+
* so the panel lands on `document.body`, the only place the playground's contrast walk can
|
|
20
|
+
* see it), the alignment, the offset, the look and the `data-slot` names; this file only
|
|
21
|
+
* decides what the rows say.
|
|
22
|
+
*
|
|
23
|
+
* KEYBOARD, which `SplitButton.test.ts` drives rather than assumes. The arrow is a tab stop; ArrowDown,
|
|
24
|
+
* Enter or Space opens the menu with focus on the first item; ArrowDown and ArrowUp move
|
|
25
|
+
* between items and **stop at the ends** (reka's `loop` is off, so this is the listbox shape in
|
|
26
|
+
* CLAUDE.md's "Keyboard ends", not the radio-group one); Enter or Space chooses; Escape closes
|
|
27
|
+
* and returns focus to the arrow. No item is a tab stop (every row is `tabindex=-1`, the
|
|
28
|
+
* focused one included) and Tab is held inside the open menu, so the arrows are the only way
|
|
29
|
+
* between rows; that is reka's modal menu, verified in the suite. That the screen reader announces this as a menu is
|
|
30
|
+
* reasoned from the roles reka sets (`menu`, `menuitem`, `aria-haspopup`, `aria-expanded`), not
|
|
31
|
+
* heard: there is no screen reader here.
|
|
32
|
+
*
|
|
33
|
+
* THE JOIN. Both parts are `Button`s. The main part drops its right corners and the arrow its
|
|
34
|
+
* left ones, and the arrow carries a light divider on its left edge. `Button` clips its
|
|
35
|
+
* background to the padding box (`bg-clip-padding`, so a transparent border shows the page),
|
|
36
|
+
* which would leave that divider painted over the page and not over the fill, and would
|
|
37
|
+
* inset the fill by the border's 1px on every side; both parts take `bg-clip-border`, so the
|
|
38
|
+
* fills meet and are the same height. The focused part is lifted (`relative
|
|
39
|
+
* focus-visible:z-10`) so its ring is not painted under its neighbour. The ring is `Button`'s
|
|
40
|
+
* own recipe, not restated.
|
|
41
|
+
*
|
|
42
|
+
* The divider is `primary-foreground/35` over `--primary`, a halved edge, and it is
|
|
43
|
+
* decoration: **1.74-2.63** against the fill across the six theme/mode pairs, under the 3:1 an
|
|
44
|
+
* edge something depends on needs (graphite 2.63 / 1.80, noix 1.98 / 1.74, kingfisher 2.54 /
|
|
45
|
+
* 1.93, light then dark). Nothing depends on it: each part is named by its own text or label,
|
|
46
|
+
* and each draws its own focus ring. A full-strength line would measure 5.79-9.65 and read as
|
|
47
|
+
* a hard rule down the middle of a pill.
|
|
48
|
+
*
|
|
49
|
+
* COLOUR. The fill and ink are `Button`'s `default` variant, so nothing here names a ramp
|
|
50
|
+
* rung. The panel is `--popover` (see `menu/menuClasses.ts`).
|
|
51
|
+
*
|
|
52
|
+
* The arrow's glyph is `trigger-icon`, a named slot (ADR 0013), and its accessible name is
|
|
53
|
+
* `menuLabel`, falling back to the contract's `moreActions`.
|
|
54
|
+
*/
|
|
55
|
+
const props = withDefaults(
|
|
56
|
+
defineProps<{
|
|
57
|
+
primary: SplitButtonItem;
|
|
58
|
+
items: SplitButtonItem[];
|
|
59
|
+
disabled?: boolean;
|
|
60
|
+
/** Prefix of the test ids: `{testid}`, `{testid}-menu`, `{testid}-item-{value}`. */
|
|
61
|
+
testid: string;
|
|
62
|
+
/** Accessible name of the arrow, which has no text of its own. Defaults to the contract's `moreActions`. */
|
|
63
|
+
menuLabel?: string;
|
|
64
|
+
}>(),
|
|
65
|
+
{ disabled: false, menuLabel: undefined },
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
const emit = defineEmits<{ (e: 'select', value: string): void }>();
|
|
69
|
+
|
|
70
|
+
defineSlots<{
|
|
71
|
+
/** The glyph on the arrow. Defaults to the package's own chevron. */
|
|
72
|
+
'trigger-icon'?: () => unknown;
|
|
73
|
+
}>();
|
|
74
|
+
|
|
75
|
+
const labels = useUiLabels();
|
|
76
|
+
</script>
|
|
77
|
+
|
|
78
|
+
<template>
|
|
79
|
+
<div data-slot="split-button" class="inline-flex">
|
|
80
|
+
<Button
|
|
81
|
+
type="button"
|
|
82
|
+
:data-testid="props.testid"
|
|
83
|
+
:disabled="props.disabled"
|
|
84
|
+
:class="
|
|
85
|
+
cn(
|
|
86
|
+
'relative bg-clip-border px-3 text-xs font-semibold focus-visible:z-10',
|
|
87
|
+
props.items.length > 0 && 'rounded-r-none',
|
|
88
|
+
)
|
|
89
|
+
"
|
|
90
|
+
@click="emit('select', props.primary.value)"
|
|
91
|
+
>
|
|
92
|
+
{{ props.primary.label }}
|
|
93
|
+
</Button>
|
|
94
|
+
<MenuRoot v-if="props.items.length > 0">
|
|
95
|
+
<MenuTrigger as-child>
|
|
96
|
+
<Button
|
|
97
|
+
type="button"
|
|
98
|
+
data-slot="split-button-trigger"
|
|
99
|
+
:data-testid="`${props.testid}-menu`"
|
|
100
|
+
:disabled="props.disabled"
|
|
101
|
+
:aria-label="props.menuLabel ?? labels.moreActions"
|
|
102
|
+
class="border-l-primary-foreground/35 relative rounded-l-none bg-clip-border px-2 focus-visible:z-10"
|
|
103
|
+
>
|
|
104
|
+
<slot name="trigger-icon">
|
|
105
|
+
<ChevronDownIcon class="size-3.5" />
|
|
106
|
+
</slot>
|
|
107
|
+
</Button>
|
|
108
|
+
</MenuTrigger>
|
|
109
|
+
<MenuContent>
|
|
110
|
+
<MenuItem
|
|
111
|
+
v-for="item in props.items"
|
|
112
|
+
:key="item.value"
|
|
113
|
+
:data-testid="`${props.testid}-item-${item.value}`"
|
|
114
|
+
@select="emit('select', item.value)"
|
|
115
|
+
>
|
|
116
|
+
<span>{{ item.label }}</span>
|
|
117
|
+
<span v-if="item.hint" :class="menuItemHintClass">{{ item.hint }}</span>
|
|
118
|
+
</MenuItem>
|
|
119
|
+
</MenuContent>
|
|
120
|
+
</MenuRoot>
|
|
121
|
+
</div>
|
|
122
|
+
</template>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { SwitchRoot, SwitchThumb } from 'reka-ui';
|
|
3
|
+
import type { HTMLAttributes } from 'vue';
|
|
4
|
+
import { cn } from '../../lib/cn';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* An on/off switch for a single boolean setting. Picking items from a list and accepting terms
|
|
8
|
+
* stay checkboxes. Renders `<button role="switch">` with `aria-checked`, `data-state` and
|
|
9
|
+
* `data-disabled`; `id` and any test id land on the button, so a `<label for>` or a wrapping
|
|
10
|
+
* `<label>` names and toggles it.
|
|
11
|
+
*
|
|
12
|
+
* The off track is the switch's only boundary, so it has to clear 3:1 non-text contrast
|
|
13
|
+
* against the card in both modes. That is why it is `muted-foreground` and not `input`: the
|
|
14
|
+
* resting edge of a field is about 1.3:1 in light, which leaves an off switch nearly invisible.
|
|
15
|
+
*/
|
|
16
|
+
const props = withDefaults(
|
|
17
|
+
defineProps<{
|
|
18
|
+
modelValue: boolean;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
id?: string;
|
|
21
|
+
size?: 'default' | 'sm';
|
|
22
|
+
class?: HTMLAttributes['class'];
|
|
23
|
+
}>(),
|
|
24
|
+
{ size: 'default' },
|
|
25
|
+
);
|
|
26
|
+
const emits = defineEmits<{ (e: 'update:modelValue', value: boolean): void }>();
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<SwitchRoot
|
|
31
|
+
:id="id"
|
|
32
|
+
:model-value="modelValue"
|
|
33
|
+
:disabled="disabled"
|
|
34
|
+
:class="
|
|
35
|
+
cn(
|
|
36
|
+
'relative inline-flex shrink-0 cursor-pointer items-center rounded-full bg-muted-foreground transition-colors',
|
|
37
|
+
'data-[state=checked]:bg-primary',
|
|
38
|
+
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background',
|
|
39
|
+
// `opacity-50` is the recipe's shared disabled fade (CLAUDE.md), not this
|
|
40
|
+
// control's own number.
|
|
41
|
+
'disabled:cursor-not-allowed disabled:opacity-50',
|
|
42
|
+
props.size === 'sm' ? 'h-4 w-7' : 'h-5 w-9',
|
|
43
|
+
props.class,
|
|
44
|
+
)
|
|
45
|
+
"
|
|
46
|
+
@update:model-value="(v: boolean) => emits('update:modelValue', v)"
|
|
47
|
+
>
|
|
48
|
+
<SwitchThumb
|
|
49
|
+
:class="
|
|
50
|
+
cn(
|
|
51
|
+
'pointer-events-none block rounded-full bg-background shadow transition-transform',
|
|
52
|
+
'translate-x-0.5 data-[state=checked]:bg-primary-foreground',
|
|
53
|
+
props.size === 'sm'
|
|
54
|
+
? 'h-3 w-3 data-[state=checked]:translate-x-3.5'
|
|
55
|
+
: 'h-4 w-4 data-[state=checked]:translate-x-4.5',
|
|
56
|
+
)
|
|
57
|
+
"
|
|
58
|
+
/>
|
|
59
|
+
</SwitchRoot>
|
|
60
|
+
</template>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Switch } from './Switch.vue';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue';
|
|
3
|
+
import { cn } from '../../lib/cn';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A table and the box that scrolls it. The box is `overflow-x-auto`, and a scrolling axis
|
|
7
|
+
* makes the other one clip too — so the container clips vertically whether or not anything
|
|
8
|
+
* ever scrolls that way.
|
|
9
|
+
*
|
|
10
|
+
* **It therefore owes the focus ring's 4px**, the same way the scrolling tab list does
|
|
11
|
+
* (CLAUDE.md, "Focus"): `py-1` for the ring, an equal `-my-1` so nothing moves. A table cell
|
|
12
|
+
* holds focusable controls — a checkbox, a row-actions kebab — and in the first and the last
|
|
13
|
+
* row they sit against the clip. Measured on the playground before this was paid: the header
|
|
14
|
+
* checkbox's halo was cut **2.3px** of its 4 at the top, and the kebab in the last row of the
|
|
15
|
+
* density tables **2.9px** at the bottom. The dense density is what makes it bite, since it
|
|
16
|
+
* takes a cell's `padding-block` down to 1px.
|
|
17
|
+
*
|
|
18
|
+
* The inline axis is not paid here and does not need to be: `TableCell` and `TableHead` carry
|
|
19
|
+
* `px-2.5`, ten pixels, and density never touches it, so a control in the first or the last
|
|
20
|
+
* column has more room than the ring asks for. The one carve-out is a cell's
|
|
21
|
+
* `[&:has([role=checkbox])]:pr-0` — a checkbox in the **last** column would sit flush against
|
|
22
|
+
* the right clip. There is no such table in the catalogue today; a container around one pays
|
|
23
|
+
* `px-1 -mx-1` through `containerClass`, which is why that prop reaches this element.
|
|
24
|
+
*/
|
|
25
|
+
const props = defineProps<{
|
|
26
|
+
class?: HTMLAttributes['class'];
|
|
27
|
+
/** Classes for the scrolling wrapper around the table, e.g. a top border. */
|
|
28
|
+
containerClass?: HTMLAttributes['class'];
|
|
29
|
+
/**
|
|
30
|
+
* Rows are on their way. Sets `aria-busy` on the table so assistive technology does not
|
|
31
|
+
* read a half-filled table as the finished one; `TableEmpty`'s own `loading` is what
|
|
32
|
+
* tells the reader that nothing is missing yet.
|
|
33
|
+
*/
|
|
34
|
+
loading?: boolean;
|
|
35
|
+
}>();
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<template>
|
|
39
|
+
<div
|
|
40
|
+
data-slot="table-container"
|
|
41
|
+
:class="cn('relative -my-1 w-full overflow-x-auto py-1', props.containerClass)"
|
|
42
|
+
>
|
|
43
|
+
<table
|
|
44
|
+
data-slot="table"
|
|
45
|
+
:aria-busy="props.loading ? 'true' : undefined"
|
|
46
|
+
:class="cn('w-full caption-bottom text-[12.5px]', props.class)"
|
|
47
|
+
>
|
|
48
|
+
<slot />
|
|
49
|
+
</table>
|
|
50
|
+
</div>
|
|
51
|
+
</template>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue';
|
|
3
|
+
import { cn } from '../../lib/cn';
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
class?: HTMLAttributes['class'];
|
|
7
|
+
}>();
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<tbody data-slot="table-body" :class="cn('[&_tr:last-child]:border-0', props.class)">
|
|
12
|
+
<slot />
|
|
13
|
+
</tbody>
|
|
14
|
+
</template>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue';
|
|
3
|
+
import { cn } from '../../lib/cn';
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
class?: HTMLAttributes['class'];
|
|
7
|
+
}>();
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<caption
|
|
12
|
+
data-slot="table-caption"
|
|
13
|
+
:class="cn('text-muted-foreground mt-4 text-sm', props.class)"
|
|
14
|
+
>
|
|
15
|
+
<slot />
|
|
16
|
+
</caption>
|
|
17
|
+
</template>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue';
|
|
3
|
+
import { cn } from '../../lib/cn';
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
class?: HTMLAttributes['class'];
|
|
7
|
+
}>();
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<td
|
|
12
|
+
data-slot="table-cell"
|
|
13
|
+
:class="
|
|
14
|
+
cn(
|
|
15
|
+
'px-2.5 py-1.5 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0',
|
|
16
|
+
props.class,
|
|
17
|
+
)
|
|
18
|
+
"
|
|
19
|
+
>
|
|
20
|
+
<slot />
|
|
21
|
+
</td>
|
|
22
|
+
</template>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useUiLabels } from '@noix-dev/brix-core';
|
|
3
|
+
import { reactiveOmit } from '@vueuse/core';
|
|
4
|
+
import type { HTMLAttributes } from 'vue';
|
|
5
|
+
import { cn } from '../../lib/cn';
|
|
6
|
+
import TableCell from './TableCell.vue';
|
|
7
|
+
import TableRow from './TableRow.vue';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The one row a table draws when it has no rows, and the one it draws while the rows are
|
|
11
|
+
* still on their way. Those are two different things to say to a reader — "nothing here" and
|
|
12
|
+
* "wait" — and a table that shows the first while it is still doing the second is telling
|
|
13
|
+
* them something untrue. So `loading` replaces the caller's message with the contract's
|
|
14
|
+
* `tableLoading`, whatever the caller put in the slot.
|
|
15
|
+
*
|
|
16
|
+
* The block inside is `role="status"` in both states and stays the same element between them.
|
|
17
|
+
* The loading line is a visual cue: the table is marked `aria-busy` (see `Table`), and a busy
|
|
18
|
+
* region holds its updates until it clears, so what the specification calls for is one
|
|
19
|
+
* announcement when loading ends, not a two-step narration. That is reasoned from the ARIA
|
|
20
|
+
* specification and has NOT been verified with a screen reader.
|
|
21
|
+
*/
|
|
22
|
+
const props = withDefaults(
|
|
23
|
+
defineProps<{
|
|
24
|
+
class?: HTMLAttributes['class'];
|
|
25
|
+
colspan?: number;
|
|
26
|
+
loading?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Overrides the contract's `tableLoading` for one call site, and only while `loading`.
|
|
29
|
+
* Omitted, the contract's sentence is what is shown.
|
|
30
|
+
*/
|
|
31
|
+
loadingText?: string;
|
|
32
|
+
}>(),
|
|
33
|
+
{
|
|
34
|
+
colspan: 1,
|
|
35
|
+
loading: false,
|
|
36
|
+
loadingText: undefined,
|
|
37
|
+
},
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
const labels = useUiLabels();
|
|
41
|
+
const delegatedProps = reactiveOmit(props, 'class', 'loading', 'loadingText');
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<template>
|
|
45
|
+
<TableRow>
|
|
46
|
+
<TableCell
|
|
47
|
+
:class="cn('text-foreground p-4 align-middle text-sm whitespace-nowrap', props.class)"
|
|
48
|
+
v-bind="delegatedProps"
|
|
49
|
+
>
|
|
50
|
+
<div
|
|
51
|
+
data-slot="table-empty"
|
|
52
|
+
:data-state="props.loading ? 'loading' : 'empty'"
|
|
53
|
+
role="status"
|
|
54
|
+
:class="
|
|
55
|
+
cn(
|
|
56
|
+
'flex items-center justify-center gap-2 py-10',
|
|
57
|
+
props.loading && 'text-muted-foreground',
|
|
58
|
+
)
|
|
59
|
+
"
|
|
60
|
+
>
|
|
61
|
+
<template v-if="props.loading">
|
|
62
|
+
<span
|
|
63
|
+
aria-hidden="true"
|
|
64
|
+
class="h-4 w-4 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent motion-reduce:animate-none"
|
|
65
|
+
/>
|
|
66
|
+
{{ props.loadingText ?? labels.tableLoading }}
|
|
67
|
+
</template>
|
|
68
|
+
<slot v-else />
|
|
69
|
+
</div>
|
|
70
|
+
</TableCell>
|
|
71
|
+
</TableRow>
|
|
72
|
+
</template>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue';
|
|
3
|
+
import { cn } from '../../lib/cn';
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
class?: HTMLAttributes['class'];
|
|
7
|
+
}>();
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<tfoot
|
|
12
|
+
data-slot="table-footer"
|
|
13
|
+
:class="cn('bg-muted/50 border-t font-medium [&>tr]:last:border-b-0', props.class)"
|
|
14
|
+
>
|
|
15
|
+
<slot />
|
|
16
|
+
</tfoot>
|
|
17
|
+
</template>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue';
|
|
3
|
+
import { cn } from '../../lib/cn';
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
class?: HTMLAttributes['class'];
|
|
7
|
+
}>();
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<th
|
|
12
|
+
data-slot="table-head"
|
|
13
|
+
:class="
|
|
14
|
+
cn(
|
|
15
|
+
'text-muted-foreground h-8 px-2.5 text-left align-middle text-[10px] font-bold tracking-wide whitespace-nowrap uppercase [&:has([role=checkbox])]:pr-0',
|
|
16
|
+
props.class,
|
|
17
|
+
)
|
|
18
|
+
"
|
|
19
|
+
>
|
|
20
|
+
<slot />
|
|
21
|
+
</th>
|
|
22
|
+
</template>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue';
|
|
3
|
+
import { cn } from '../../lib/cn';
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
class?: HTMLAttributes['class'];
|
|
7
|
+
}>();
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<thead data-slot="table-header" :class="cn('[&_tr]:border-b', props.class)">
|
|
12
|
+
<slot />
|
|
13
|
+
</thead>
|
|
14
|
+
</template>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue';
|
|
3
|
+
import { cn } from '../../lib/cn';
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
class?: HTMLAttributes['class'];
|
|
7
|
+
}>();
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<tr
|
|
12
|
+
data-slot="table-row"
|
|
13
|
+
:class="
|
|
14
|
+
cn(
|
|
15
|
+
'hover:bg-muted/50 data-[state=selected]:bg-muted has-aria-expanded:bg-muted/50 border-b transition-colors',
|
|
16
|
+
props.class,
|
|
17
|
+
)
|
|
18
|
+
"
|
|
19
|
+
>
|
|
20
|
+
<slot />
|
|
21
|
+
</tr>
|
|
22
|
+
</template>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { default as Table } from './Table.vue';
|
|
2
|
+
export { default as TableBody } from './TableBody.vue';
|
|
3
|
+
export { default as TableCaption } from './TableCaption.vue';
|
|
4
|
+
export { default as TableCell } from './TableCell.vue';
|
|
5
|
+
export { default as TableEmpty } from './TableEmpty.vue';
|
|
6
|
+
export { default as TableFooter } from './TableFooter.vue';
|
|
7
|
+
export { default as TableHead } from './TableHead.vue';
|
|
8
|
+
export { default as TableHeader } from './TableHeader.vue';
|
|
9
|
+
export { default as TableRow } from './TableRow.vue';
|