@lerianstudio/sindarian-ui 2.0.0-beta.25 → 2.0.0-beta.27
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/dist/charts/chart.js +4 -231
- package/dist/charts/index.js +1 -11
- package/dist/components/breadcrumb/get-breadcrumb-paths.js +1 -18
- package/dist/components/breadcrumb/index.js +1 -37
- package/dist/components/card/account-card/index.js +1 -69
- package/dist/components/card/basic-card/index.js +1 -20
- package/dist/components/card/dashboard-card/index.js +1 -20
- package/dist/components/card/entity-card/index.js +1 -68
- package/dist/components/card/index.js +1 -20
- package/dist/components/dialog/confirmation-dialog/index.js +1 -96
- package/dist/components/dialog/confirmation-dialog/use-confirm-dialog.js +1 -55
- package/dist/components/dialog/index.js +1 -19
- package/dist/components/dialog/large-dialog/index.js +1 -21
- package/dist/components/entity-box/index.js +1 -67
- package/dist/components/entity-data-table/index.js +1 -20
- package/dist/components/form/combo-box-field/index.js +1 -35
- package/dist/components/form/country-field/index.js +1 -11
- package/dist/components/form/date-picker-field/index.js +1 -83
- package/dist/components/form/date-range-field/index.js +1 -58
- package/dist/components/form/date-time-picker-field/index.js +1 -114
- package/dist/components/form/file-upload-field/index.js +1 -69
- package/dist/components/form/index.js +1 -31
- package/dist/components/form/input-field/index.js +1 -96
- package/dist/components/form/otp-field/index.js +1 -19
- package/dist/components/form/pagination-limit-field/index.js +1 -10
- package/dist/components/form/password-field/index.js +1 -16
- package/dist/components/form/radio-group-field/index.js +1 -36
- package/dist/components/form/renderable-label.js +1 -57
- package/dist/components/form/select-field/index.js +1 -68
- package/dist/components/form/state-field/index.js +1 -42
- package/dist/components/form/switch-field/index.js +1 -16
- package/dist/components/form/textarea-field/index.js +1 -23
- package/dist/components/page/index.js +1 -20
- package/dist/components/page-header/index.js +1 -80
- package/dist/components/pagination/index.js +1 -10
- package/dist/components/table/id-table-cell.js +1 -109
- package/dist/components/table/index.js +1 -19
- package/dist/components/table/locked-table-actions.js +1 -41
- package/dist/components/table/name-table-cell.js +1 -58
- package/dist/components/ui/accordion/index.js +1 -62
- package/dist/components/ui/alert/index.js +1 -45
- package/dist/components/ui/alert-dialog/index.js +1 -84
- package/dist/components/ui/autocomplete/index.js +1 -440
- package/dist/components/ui/autosize-textarea/index.js +1 -89
- package/dist/components/ui/avatar/index.js +1 -51
- package/dist/components/ui/badge/index.js +1 -83
- package/dist/components/ui/breadcrumb/index.js +1 -35
- package/dist/components/ui/button/index.js +1 -65
- package/dist/components/ui/calendar/index.js +1 -118
- package/dist/components/ui/card/index.js +1 -32
- package/dist/components/ui/checkbox/index.js +1 -44
- package/dist/components/ui/collapsible/index.js +1 -50
- package/dist/components/ui/command/index.js +1 -95
- package/dist/components/ui/copy-field/index.js +1 -163
- package/dist/components/ui/dialog/index.js +1 -80
- package/dist/components/ui/dialog/styles.css +1 -1
- package/dist/components/ui/dropdown-menu/index.js +1 -110
- package/dist/components/ui/field/index.js +1 -82
- package/dist/components/ui/file-upload/index.js +1 -574
- package/dist/components/ui/form.js +1 -162
- package/dist/components/ui/hover-card/index.js +1 -51
- package/dist/components/ui/icon-button/index.js +1 -35
- package/dist/components/ui/input/adornment.js +1 -21
- package/dist/components/ui/input/index.js +1 -99
- package/dist/components/ui/label/index.js +1 -45
- package/dist/components/ui/lerian-wordmark/index.js +1 -7
- package/dist/components/ui/loading-button/index.js +1 -9
- package/dist/components/ui/multiple-select/index.js +1 -235
- package/dist/components/ui/otp-input/index.js +1 -62
- package/dist/components/ui/paper/index.js +1 -8
- package/dist/components/ui/paper-collapsible/index.js +1 -24
- package/dist/components/ui/popover/index.js +1 -55
- package/dist/components/ui/progress/index.js +1 -66
- package/dist/components/ui/qr-code/index.js +1 -27
- package/dist/components/ui/radio-group/index.js +1 -48
- package/dist/components/ui/scroll-area/index.js +1 -49
- package/dist/components/ui/select/index.js +1 -119
- package/dist/components/ui/separator/index.js +1 -43
- package/dist/components/ui/sheet/index.js +1 -136
- package/dist/components/ui/sidebar/index.js +1 -27
- package/dist/components/ui/sidebar/next-router.cjs +1 -119
- package/dist/components/ui/sidebar/sidebar-back-button.js +1 -8
- package/dist/components/ui/sidebar/sidebar-components.js +1 -23
- package/dist/components/ui/sidebar/sidebar-expand-button.js +1 -49
- package/dist/components/ui/sidebar/sidebar-item-button.js +1 -21
- package/dist/components/ui/sidebar/sidebar-item-collapsible.js +1 -52
- package/dist/components/ui/sidebar/sidebar-item-icon-button.js +1 -18
- package/dist/components/ui/sidebar/sidebar-item.js +1 -44
- package/dist/components/ui/sidebar/sidebar-provider.js +1 -201
- package/dist/components/ui/sidebar/sidebar-root.js +1 -130
- package/dist/components/ui/sidebar/sidebar-router.js +1 -126
- package/dist/components/ui/sidebar/sidebar-trigger.js +1 -57
- package/dist/components/ui/skeleton/index.js +1 -8
- package/dist/components/ui/stepper/index.js +1 -29
- package/dist/components/ui/switch/index.js +1 -43
- package/dist/components/ui/table/index.js +1 -56
- package/dist/components/ui/tabs/index.js +1 -55
- package/dist/components/ui/tabs/styles.css +1 -1
- package/dist/components/ui/textarea/index.js +1 -8
- package/dist/components/ui/time-picker/index.js +1 -85
- package/dist/components/ui/toast/index.js +1 -3
- package/dist/components/ui/toast/toaster.js +1 -16
- package/dist/components/ui/toggle-group/index.js +1 -156
- package/dist/components/ui/tooltip/index.js +1 -81
- package/dist/domain/blotter/index.js +1 -20
- package/dist/domain/delinquency-aging/aging-buckets.js +1 -120
- package/dist/domain/delinquency-aging/index.js +1 -222
- package/dist/domain/figure/index.js +1 -19
- package/dist/domain/format.js +1 -137
- package/dist/domain/index.js +1 -43
- package/dist/domain/key-id/index.js +1 -174
- package/dist/domain/ledger-sheet/index.js +1 -28
- package/dist/domain/money-diff.js +1 -48
- package/dist/domain/money-math.js +1 -104
- package/dist/domain/money-text/index.js +1 -123
- package/dist/domain/section-label/index.js +1 -17
- package/dist/domain/status-rail/index.js +1 -76
- package/dist/domain/threshold-gauge/index.js +1 -161
- package/dist/enterprise/alert-banner/index.js +1 -24
- package/dist/enterprise/app-shell/index.js +1 -87
- package/dist/enterprise/cursor-pager/index.js +1 -26
- package/dist/enterprise/data-table/column-size.js +1 -103
- package/dist/enterprise/data-table/index.js +1 -345
- package/dist/enterprise/date-range-picker/index.js +1 -115
- package/dist/enterprise/detail-panel/index.js +1 -20
- package/dist/enterprise/empty-state/index.js +1 -14
- package/dist/enterprise/index.js +1 -39
- package/dist/enterprise/number-input/index.js +1 -252
- package/dist/enterprise/search-input/index.js +1 -121
- package/dist/enterprise/stat-card/index.js +1 -75
- package/dist/enterprise/status-badge/index.js +1 -120
- package/dist/enterprise/use-is-mobile.js +1 -68
- package/dist/enterprise/virtualized-table/index.js +1 -141
- package/dist/esm/charts/chart.js +4 -190
- package/dist/esm/charts/index.js +1 -3
- package/dist/esm/components/breadcrumb/get-breadcrumb-paths.js +1 -12
- package/dist/esm/components/breadcrumb/index.js +1 -30
- package/dist/esm/components/card/account-card/index.js +1 -53
- package/dist/esm/components/card/basic-card/index.js +1 -14
- package/dist/esm/components/card/dashboard-card/index.js +1 -14
- package/dist/esm/components/card/entity-card/index.js +1 -52
- package/dist/esm/components/card/index.js +1 -4
- package/dist/esm/components/dialog/confirmation-dialog/index.js +1 -60
- package/dist/esm/components/dialog/confirmation-dialog/use-confirm-dialog.js +1 -49
- package/dist/esm/components/dialog/index.js +1 -3
- package/dist/esm/components/dialog/large-dialog/index.js +1 -16
- package/dist/esm/components/entity-box/index.js +1 -56
- package/dist/esm/components/entity-data-table/index.js +1 -17
- package/dist/esm/components/form/combo-box-field/index.js +1 -28
- package/dist/esm/components/form/country-field/index.js +1 -7
- package/dist/esm/components/form/date-picker-field/index.js +1 -43
- package/dist/esm/components/form/date-range-field/index.js +1 -18
- package/dist/esm/components/form/date-time-picker-field/index.js +1 -74
- package/dist/esm/components/form/file-upload-field/index.js +1 -65
- package/dist/esm/components/form/index.js +1 -15
- package/dist/esm/components/form/input-field/index.js +1 -92
- package/dist/esm/components/form/otp-field/index.js +1 -15
- package/dist/esm/components/form/pagination-limit-field/index.js +1 -6
- package/dist/esm/components/form/password-field/index.js +1 -10
- package/dist/esm/components/form/radio-group-field/index.js +1 -32
- package/dist/esm/components/form/renderable-label.js +1 -54
- package/dist/esm/components/form/select-field/index.js +1 -64
- package/dist/esm/components/form/state-field/index.js +1 -35
- package/dist/esm/components/form/switch-field/index.js +1 -12
- package/dist/esm/components/form/textarea-field/index.js +1 -19
- package/dist/esm/components/page/index.js +1 -15
- package/dist/esm/components/page-header/index.js +1 -71
- package/dist/esm/components/pagination/index.js +1 -6
- package/dist/esm/components/table/id-table-cell.js +1 -105
- package/dist/esm/components/table/index.js +1 -3
- package/dist/esm/components/table/locked-table-actions.js +1 -37
- package/dist/esm/components/table/name-table-cell.js +1 -54
- package/dist/esm/components/ui/accordion/index.js +1 -24
- package/dist/esm/components/ui/alert/index.js +1 -38
- package/dist/esm/components/ui/alert-dialog/index.js +1 -39
- package/dist/esm/components/ui/autocomplete/index.js +1 -392
- package/dist/esm/components/ui/autosize-textarea/index.js +1 -51
- package/dist/esm/components/ui/avatar/index.js +1 -14
- package/dist/esm/components/ui/badge/index.js +1 -79
- package/dist/esm/components/ui/breadcrumb/index.js +1 -27
- package/dist/esm/components/ui/button/index.js +1 -60
- package/dist/esm/components/ui/calendar/index.js +1 -82
- package/dist/esm/components/ui/card/index.js +1 -24
- package/dist/esm/components/ui/checkbox/index.js +1 -9
- package/dist/esm/components/ui/collapsible/index.js +1 -13
- package/dist/esm/components/ui/command/index.js +1 -51
- package/dist/esm/components/ui/copy-field/index.js +1 -127
- package/dist/esm/components/ui/dialog/index.js +1 -36
- package/dist/esm/components/ui/dropdown-menu/index.js +1 -60
- package/dist/esm/components/ui/field/index.js +1 -71
- package/dist/esm/components/ui/file-upload/index.js +1 -536
- package/dist/esm/components/ui/form.js +1 -118
- package/dist/esm/components/ui/hover-card/index.js +1 -14
- package/dist/esm/components/ui/icon-button/index.js +1 -31
- package/dist/esm/components/ui/input/adornment.js +1 -17
- package/dist/esm/components/ui/input/index.js +1 -60
- package/dist/esm/components/ui/label/index.js +1 -10
- package/dist/esm/components/ui/lerian-wordmark/index.js +1 -4
- package/dist/esm/components/ui/loading-button/index.js +1 -7
- package/dist/esm/components/ui/multiple-select/index.js +1 -196
- package/dist/esm/components/ui/otp-input/index.js +1 -21
- package/dist/esm/components/ui/paper/index.js +1 -5
- package/dist/esm/components/ui/paper-collapsible/index.js +1 -19
- package/dist/esm/components/ui/popover/index.js +1 -17
- package/dist/esm/components/ui/progress/index.js +1 -31
- package/dist/esm/components/ui/qr-code/index.js +1 -24
- package/dist/esm/components/ui/radio-group/index.js +1 -12
- package/dist/esm/components/ui/scroll-area/index.js +1 -13
- package/dist/esm/components/ui/select/index.js +1 -74
- package/dist/esm/components/ui/separator/index.js +1 -8
- package/dist/esm/components/ui/sheet/index.js +1 -92
- package/dist/esm/components/ui/sidebar/index.js +1 -11
- package/dist/esm/components/ui/sidebar/next-router.cjs +1 -119
- package/dist/esm/components/ui/sidebar/sidebar-back-button.js +1 -5
- package/dist/esm/components/ui/sidebar/sidebar-components.js +1 -15
- package/dist/esm/components/ui/sidebar/sidebar-expand-button.js +1 -42
- package/dist/esm/components/ui/sidebar/sidebar-item-button.js +1 -18
- package/dist/esm/components/ui/sidebar/sidebar-item-collapsible.js +1 -44
- package/dist/esm/components/ui/sidebar/sidebar-item-icon-button.js +1 -14
- package/dist/esm/components/ui/sidebar/sidebar-item.js +1 -40
- package/dist/esm/components/ui/sidebar/sidebar-provider.js +1 -193
- package/dist/esm/components/ui/sidebar/sidebar-root.js +1 -126
- package/dist/esm/components/ui/sidebar/sidebar-router.js +1 -89
- package/dist/esm/components/ui/sidebar/sidebar-trigger.js +1 -53
- package/dist/esm/components/ui/skeleton/index.js +1 -6
- package/dist/esm/components/ui/stepper/index.js +1 -20
- package/dist/esm/components/ui/switch/index.js +1 -8
- package/dist/esm/components/ui/table/index.js +1 -44
- package/dist/esm/components/ui/tabs/index.js +1 -17
- package/dist/esm/components/ui/textarea/index.js +1 -6
- package/dist/esm/components/ui/time-picker/index.js +1 -49
- package/dist/esm/components/ui/toast/index.js +1 -2
- package/dist/esm/components/ui/toast/toaster.js +1 -13
- package/dist/esm/components/ui/toggle-group/index.js +1 -120
- package/dist/esm/components/ui/tooltip/index.js +1 -43
- package/dist/esm/domain/blotter/index.js +1 -16
- package/dist/esm/domain/delinquency-aging/aging-buckets.js +1 -115
- package/dist/esm/domain/delinquency-aging/index.js +1 -218
- package/dist/esm/domain/figure/index.js +1 -15
- package/dist/esm/domain/format.js +1 -128
- package/dist/esm/domain/index.js +1 -19
- package/dist/esm/domain/key-id/index.js +1 -169
- package/dist/esm/domain/ledger-sheet/index.js +1 -24
- package/dist/esm/domain/money-diff.js +1 -45
- package/dist/esm/domain/money-math.js +1 -98
- package/dist/esm/domain/money-text/index.js +1 -118
- package/dist/esm/domain/section-label/index.js +1 -14
- package/dist/esm/domain/status-rail/index.js +1 -71
- package/dist/esm/domain/threshold-gauge/index.js +1 -157
- package/dist/esm/enterprise/alert-banner/index.js +1 -21
- package/dist/esm/enterprise/app-shell/index.js +1 -51
- package/dist/esm/enterprise/cursor-pager/index.js +1 -23
- package/dist/esm/enterprise/data-table/column-size.js +1 -97
- package/dist/esm/enterprise/data-table/index.js +1 -342
- package/dist/esm/enterprise/date-range-picker/index.js +1 -112
- package/dist/esm/enterprise/detail-panel/index.js +1 -17
- package/dist/esm/enterprise/empty-state/index.js +1 -11
- package/dist/esm/enterprise/index.js +1 -22
- package/dist/esm/enterprise/number-input/index.js +1 -214
- package/dist/esm/enterprise/search-input/index.js +1 -85
- package/dist/esm/enterprise/stat-card/index.js +1 -72
- package/dist/esm/enterprise/status-badge/index.js +1 -116
- package/dist/esm/enterprise/use-is-mobile.js +1 -31
- package/dist/esm/enterprise/virtualized-table/index.js +1 -138
- package/dist/esm/hooks/use-click-away.js +1 -22
- package/dist/esm/hooks/use-pagination.js +1 -38
- package/dist/esm/hooks/use-stepper.js +1 -22
- package/dist/esm/hooks/use-time.js +1 -13
- package/dist/esm/hooks/use-toast.js +1 -107
- package/dist/esm/index.js +1 -77
- package/dist/esm/lib/storage/get-storage-object.js +1 -17
- package/dist/esm/lib/storage/get-storage.js +1 -14
- package/dist/esm/lib/storage/index.js +1 -2
- package/dist/esm/lib/typography.js +1 -31
- package/dist/esm/lib/utils.js +1 -41
- package/dist/esm/theme/get-theme-script.js +1 -41
- package/dist/esm/theme/index.js +1 -4
- package/dist/esm/theme/mode-toggle.js +1 -45
- package/dist/esm/theme/theme-provider.js +1 -122
- package/dist/esm/toast/helpers.js +1 -36
- package/dist/esm/toast/index.js +1 -4
- package/dist/esm/types/metadata-type.js +1 -1
- package/dist/esm/utils/countries.cjs +1 -17
- package/dist/esm/utils/country-utils.js +1 -18
- package/dist/esm/utils/currency-codes.js +1 -181
- package/dist/hooks/use-click-away.js +1 -29
- package/dist/hooks/use-pagination.js +1 -41
- package/dist/hooks/use-stepper.js +1 -26
- package/dist/hooks/use-time.js +1 -20
- package/dist/hooks/use-toast.js +1 -111
- package/dist/index.js +1 -96
- package/dist/lib/storage/get-storage-object.js +1 -23
- package/dist/lib/storage/get-storage.js +1 -17
- package/dist/lib/storage/index.js +1 -18
- package/dist/lib/typography.js +1 -34
- package/dist/lib/utils.js +1 -45
- package/dist/theme/get-theme-script.js +1 -44
- package/dist/theme/index.js +1 -11
- package/dist/theme/mode-toggle.js +1 -48
- package/dist/theme/theme-provider.js +1 -160
- package/dist/toast/helpers.js +1 -41
- package/dist/toast/index.js +1 -10
- package/dist/types/metadata-type.js +1 -2
- package/dist/utils/countries.cjs +1 -17
- package/dist/utils/country-utils.js +1 -25
- package/dist/utils/currency-codes.js +1 -184
- package/package.json +4 -3
|
@@ -1,71 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { cn } from '../../lib/utils.js';
|
|
3
|
-
import { Children, createContext, useContext, useState } from 'react';
|
|
4
|
-
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '../../components/ui/collapsible/index.js';
|
|
5
|
-
import { Button } from '../ui/button/index.js';
|
|
6
|
-
import { HelpCircle, ChevronUp, ExternalLink, Copy } from 'lucide-react';
|
|
7
|
-
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../../components/ui/tooltip/index.js';
|
|
8
|
-
import { useToast } from '../../hooks/use-toast.js';
|
|
9
|
-
import { Arrow } from '@radix-ui/react-tooltip';
|
|
10
|
-
const PageHeaderContext = createContext({ isOpen: false });
|
|
11
|
-
export function PageHeaderActionButtons({ className, ...props }) {
|
|
12
|
-
return (_jsx("div", { "data-slot": "page-header-action-buttons", className: cn('flex min-w-0 flex-wrap items-center gap-8', className), ...props }));
|
|
13
|
-
}
|
|
14
|
-
export function PageHeaderWrapper({ className, ...props }) {
|
|
15
|
-
const { isOpen } = useContext(PageHeaderContext);
|
|
16
|
-
return (_jsx("div", { "data-slot": "page-header-wrapper", className: cn('flex items-start justify-between', isOpen && 'border-b', className), ...props }));
|
|
17
|
-
}
|
|
18
|
-
export function PageHeader({ children, className, rootClassName }) {
|
|
19
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
20
|
-
return (_jsx(PageHeaderContext.Provider, { value: { isOpen }, children: _jsx("div", { "data-slot": "page-header", className: cn('mt-12', isOpen && 'mb-12', rootClassName), children: _jsx(Collapsible, { open: isOpen, onOpenChange: setIsOpen, className: className, children: children }) }) }));
|
|
21
|
-
}
|
|
22
|
-
export function PageHeaderInfoTitle({ title, subtitle, className, containerClassName, children, as: Heading = 'h1' }) {
|
|
23
|
-
return (_jsxs("div", { "data-slot": "page-header-info-title",
|
|
24
|
-
/*
|
|
25
|
-
Two utilities and one deliberate absence.
|
|
26
|
-
|
|
27
|
-
`flex-1` (basis 0) is #170: flex shrinking is shared in proportion to
|
|
28
|
-
flex-basis, so a title box at basis auto (its max-content width, which
|
|
29
|
-
a long subtitle inflates) absorbed almost none of the overflow and
|
|
30
|
-
starved the action row into one button per line. At basis 0 the line's
|
|
31
|
-
hypothetical size is the action row alone, so the row keeps its natural
|
|
32
|
-
width and the title grows into what is left, wrapping at spaces.
|
|
33
|
-
|
|
34
|
-
NO `min-w-0` is #174, and the absence is the fix. A flex item's
|
|
35
|
-
automatic minimum size is its own min-content, so left alone the box
|
|
36
|
-
cannot be squeezed below its longest word (of the title, the subtitle,
|
|
37
|
-
or a child chip) and nothing can overflow horizontally at any width.
|
|
38
|
-
beta.5 carried `min-w-0`, which waives that minimum: on Matcher's
|
|
39
|
-
exception-detail masthead the box collapsed to 68px and the `h1`
|
|
40
|
-
painted straight out of it and across the action row. That is gone.
|
|
41
|
-
|
|
42
|
-
A fixed floor was the other candidate and is wrong: any `sm:` gate keys
|
|
43
|
-
on the VIEWPORT while the overflow condition is the MASTHEAD width, so
|
|
44
|
-
a 1024px viewport with a 320px side panel open (a ~332px masthead)
|
|
45
|
-
would keep a 320px floor and scroll the body sideways.
|
|
46
|
-
|
|
47
|
-
The measured trade: on a masthead carrying a 520px action row the title
|
|
48
|
-
box shrinks to its longest word and the subtitle wraps to about three
|
|
49
|
-
lines. The remedy there is fewer controls in the action slot, not a
|
|
50
|
-
wider floor. A consumer that wants the collapse back passes
|
|
51
|
-
`containerClassName="min-w-0"`. jsdom does not lay out, so the geometry
|
|
52
|
-
is verified downstream.
|
|
53
|
-
*/
|
|
54
|
-
className: cn('mb-12 flex flex-1 flex-col gap-4', containerClassName), children: [_jsx(Heading, { className: cn('text-foreground text-4xl font-bold', className), "data-testid": "title", children: title }), _jsx("div", { className: "flex items-center gap-2", children: _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: subtitle }) }), Children.toArray(children).length > 0 ? (_jsx("div", { className: "flex flex-wrap items-center gap-2", children: children })) : null] }));
|
|
55
|
-
}
|
|
56
|
-
export function PageHeaderInfoTooltip({ subtitle }) {
|
|
57
|
-
const { toast } = useToast();
|
|
58
|
-
const handleCopyToClipboard = (value) => {
|
|
59
|
-
navigator.clipboard.writeText(value);
|
|
60
|
-
toast({
|
|
61
|
-
description: 'Copied to clipboard!'
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
return (_jsx("div", { "data-slot": "page-header-info-tooltip", children: _jsx(TooltipProvider, { children: _jsxs(Tooltip, { delayDuration: 300, children: [_jsx(TooltipTrigger, { onClick: () => handleCopyToClipboard(subtitle), children: _jsx(Copy, { size: 16, className: "cursor-pointer" }) }), _jsxs(TooltipContent, { className: "bg-shadcn-600 border-none", arrowPadding: 0, children: [_jsx("p", { className: "text-shadcn-300 text-sm font-medium", children: subtitle }), _jsx("p", { className: "text-center text-white", children: "Click to copy" }), _jsx(Arrow, { height: 8, width: 15 })] })] }) }) }));
|
|
65
|
-
}
|
|
66
|
-
export function PageHeaderCollapsibleInfoTrigger({ question }) {
|
|
67
|
-
return (_jsx("div", { "data-slot": "page-header-collapsible-info-trigger", children: _jsx(CollapsibleTrigger, { asChild: true, children: _jsxs(Button, { variant: "link", className: "flex gap-2 pr-0", children: [_jsx("span", { className: "text-foreground text-sm font-medium", children: question }), _jsx(HelpCircle, { className: "h-4 w-4" })] }) }) }));
|
|
68
|
-
}
|
|
69
|
-
export function PageHeaderCollapsibleInfo({ question, answer, seeMore, href }) {
|
|
70
|
-
return (_jsx("div", { "data-slot": "page-header-collapsible-info", children: _jsx(CollapsibleContent, { children: _jsxs("div", { className: "flex w-full justify-between pt-6", children: [_jsxs("div", { className: "mt-12 flex grow flex-col gap-3 pr-6", children: [_jsx("h2", { className: "text-foreground text-xl font-bold", children: question }), _jsxs("p", { className: "text-muted-foreground text-sm leading-relaxed font-medium", children: [answer, seeMore && href && (_jsxs(_Fragment, { children: [' ', _jsxs("a", { target: "_blank", rel: "noopener noreferrer", href: href, className: "text-muted-foreground font-medium", children: [_jsx("span", { className: "underline underline-offset-4", children: seeMore }), _jsx(ExternalLink, { size: 16, className: "ml-1 inline align-middle" })] })] }))] })] }), _jsx(CollapsibleTrigger, { asChild: true, children: _jsx(Button, { variant: "link", className: "cursor-pointer self-start", children: _jsx(ChevronUp, { size: 24, className: "text-muted-foreground" }) }) })] }) }) }));
|
|
71
|
-
}
|
|
1
|
+
import{jsx as e,jsxs as n,Fragment as m}from"react/jsx-runtime";import{cn as o}from"../../lib/utils.js";import{Children as f,createContext as h,useContext as g,useState as x}from"react";import{Collapsible as u,CollapsibleContent as N,CollapsibleTrigger as s}from"../../components/ui/collapsible/index.js";import{Button as d}from"../ui/button/index.js";import{HelpCircle as C,ChevronUp as b,ExternalLink as v,Copy as w}from"lucide-react";import{Tooltip as T,TooltipContent as P,TooltipProvider as H,TooltipTrigger as y}from"../../components/ui/tooltip/index.js";import{useToast as j}from"../../hooks/use-toast.js";import{Arrow as k}from"@radix-ui/react-tooltip";const c=h({isOpen:false});export function PageHeaderActionButtons({className:t,...r}){return e("div",{"data-slot":"page-header-action-buttons",className:o("flex min-w-0 flex-wrap items-center gap-8",t),...r})}export function PageHeaderWrapper({className:t,...r}){const{isOpen:a}=g(c);return e("div",{"data-slot":"page-header-wrapper",className:o("flex items-start justify-between",a&&"border-b",t),...r})}export function PageHeader({children:t,className:r,rootClassName:a}){const[l,i]=x(false);return e(c.Provider,{value:{isOpen:l},children:e("div",{"data-slot":"page-header",className:o("mt-12",l&&"mb-12",a),children:e(u,{open:l,onOpenChange:i,className:r,children:t})})})}export function PageHeaderInfoTitle({title:t,subtitle:r,className:a,containerClassName:l,children:i,as:p="h1"}){return n("div",{"data-slot":"page-header-info-title",className:o("mb-12 flex flex-1 flex-col gap-4",l),children:[e(p,{className:o("text-foreground text-4xl font-bold",a),"data-testid":"title",children:t}),e("div",{className:"flex items-center gap-2",children:e("p",{className:"text-muted-foreground text-sm font-medium",children:r})}),f.toArray(i).length>0?e("div",{className:"flex flex-wrap items-center gap-2",children:i}):null]})}export function PageHeaderInfoTooltip({subtitle:t}){const{toast:r}=j();const a=l=>{navigator.clipboard.writeText(l);r({description:"Copied to clipboard!"})};return e("div",{"data-slot":"page-header-info-tooltip",children:e(H,{children:n(T,{delayDuration:300,children:[e(y,{onClick:()=>a(t),children:e(w,{size:16,className:"cursor-pointer"})}),n(P,{className:"bg-shadcn-600 border-none",arrowPadding:0,children:[e("p",{className:"text-shadcn-300 text-sm font-medium",children:t}),e("p",{className:"text-center text-white",children:"Click to copy"}),e(k,{height:8,width:15})]})]})})})}export function PageHeaderCollapsibleInfoTrigger({question:t}){return e("div",{"data-slot":"page-header-collapsible-info-trigger",children:e(s,{asChild:true,children:n(d,{variant:"link",className:"flex gap-2 pr-0",children:[e("span",{className:"text-foreground text-sm font-medium",children:t}),e(C,{className:"h-4 w-4"})]})})})}export function PageHeaderCollapsibleInfo({question:t,answer:r,seeMore:a,href:l}){return e("div",{"data-slot":"page-header-collapsible-info",children:e(N,{children:n("div",{className:"flex w-full justify-between pt-6",children:[n("div",{className:"mt-12 flex grow flex-col gap-3 pr-6",children:[e("h2",{className:"text-foreground text-xl font-bold",children:t}),n("p",{className:"text-muted-foreground text-sm leading-relaxed font-medium",children:[r,a&&l&&n(m,{children:[" ",n("a",{target:"_blank",rel:"noopener noreferrer",href:l,className:"text-muted-foreground font-medium",children:[e("span",{className:"underline underline-offset-4",children:a}),e(v,{size:16,className:"ml-1 inline align-middle"})]})]})]})]}),e(s,{asChild:true,children:e(d,{variant:"link",className:"cursor-pointer self-start",children:e(b,{size:24,className:"text-muted-foreground"})})})]})})})}
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Button } from '../ui/button/index.js';
|
|
3
|
-
import { ChevronLeft, ChevronRight } from 'lucide-react';
|
|
4
|
-
export const Pagination = ({ page, limit, total = 0, previousLabel, nextLabel, nextPage, previousPage }) => {
|
|
5
|
-
return (_jsxs("div", { className: "flex items-center justify-end space-x-2", children: [_jsx(Button, { variant: "outline", size: "small", onClick: previousPage, disabled: page <= 1, icon: _jsx(ChevronLeft, { size: 16 }), iconPlacement: "start", children: previousLabel }), _jsx(Button, { variant: "outline", size: "small", onClick: nextPage, disabled: total < limit, icon: _jsx(ChevronRight, { size: 16 }), iconPlacement: "end", children: nextLabel })] }));
|
|
6
|
-
};
|
|
1
|
+
import{jsx as e,jsxs as c}from"react/jsx-runtime";import{Button as i}from"../ui/button/index.js";import{ChevronLeft as m,ChevronRight as d}from"lucide-react";export const Pagination=({page:n,limit:s,total:t=0,previousLabel:o,nextLabel:a,nextPage:r,previousPage:l})=>{return c("div",{className:"flex items-center justify-end space-x-2",children:[e(i,{variant:"outline",size:"small",onClick:l,disabled:n<=1,icon:e(m,{size:16}),iconPlacement:"start",children:o}),e(i,{variant:"outline",size:"small",onClick:r,disabled:t<s,icon:e(d,{size:16}),iconPlacement:"end",children:a})]})};
|
|
@@ -1,105 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { TableCell, TableCellWrapper } from '../../components/ui/table/index.js';
|
|
3
|
-
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../../components/ui/tooltip/index.js';
|
|
4
|
-
import { Copy } from 'lucide-react';
|
|
5
|
-
/**
|
|
6
|
-
* ⛔ TRUNCATE IN THE MIDDLE, NEVER FROM THE START.
|
|
7
|
-
*
|
|
8
|
-
* This cell renders UUIDs, and a ledger hands out long runs of them from a
|
|
9
|
-
* shared prefix — `00000000-0000-0000-0000-00000000000{1,2,3}`. Keeping the
|
|
10
|
-
* first 13 characters, which is what `truncate(id, { length: 16 })` did,
|
|
11
|
-
* rendered every one of those rows as the same string: the only part that told
|
|
12
|
-
* them apart was the part that was dropped, and the reader had to hover each
|
|
13
|
-
* row in turn to find the one they wanted.
|
|
14
|
-
*
|
|
15
|
-
* Both ends carry information — the head says which family the id belongs to,
|
|
16
|
-
* the tail says which member — so both ends stay.
|
|
17
|
-
*/
|
|
18
|
-
const DEFAULT_HEAD = 8;
|
|
19
|
-
const DEFAULT_TAIL = 4;
|
|
20
|
-
/**
|
|
21
|
-
* ⛔ A BAD LENGTH CANNOT THROW HERE. This runs in a render path, so refusing a
|
|
22
|
-
* malformed prop would unmount the whole table rather than one cell — a
|
|
23
|
-
* consumer computing `head` from data gets a broken cell, not a broken screen.
|
|
24
|
-
*
|
|
25
|
-
* `String.slice` reads a negative number as an offset from the END, so a
|
|
26
|
-
* negative `head` kept nearly the entire id and put an ellipsis in the middle
|
|
27
|
-
* of it, and `NaN` read as 0 and dropped the head — the exact failure middle
|
|
28
|
-
* truncation exists to prevent, and one character LONGER than the untruncated
|
|
29
|
-
* id. Clamped to a non-negative whole number; anything non-finite falls back
|
|
30
|
-
* to the default, which a caller passing `NaN` has already bypassed.
|
|
31
|
-
*/
|
|
32
|
-
function charCount(value, fallback) {
|
|
33
|
-
return Number.isFinite(value) ? Math.max(0, Math.trunc(value)) : fallback;
|
|
34
|
-
}
|
|
35
|
-
function truncateMiddle(id, head, tail) {
|
|
36
|
-
const start = charCount(head, DEFAULT_HEAD);
|
|
37
|
-
const end = charCount(tail, DEFAULT_TAIL);
|
|
38
|
-
// No ellipsis unless it actually saves characters: at head + tail + 1 the
|
|
39
|
-
// truncation is the same length as the id and hides a character for nothing.
|
|
40
|
-
return id.length <= start + end + 1
|
|
41
|
-
? id
|
|
42
|
-
: `${id.slice(0, start)}…${id.slice(id.length - end)}`;
|
|
43
|
-
}
|
|
44
|
-
export const IdTableCell = ({ id, onCopy, head = DEFAULT_HEAD, tail = DEFAULT_TAIL, copyLabel = 'Copy id', ...others }) => {
|
|
45
|
-
/**
|
|
46
|
-
* ⛔ THE COPY ACTION IS A NAMED BUTTON, NEVER A HANDLER ON THE `<td>`.
|
|
47
|
-
*
|
|
48
|
-
* On the cell it had no role, no tab stop and no accessible name: an
|
|
49
|
-
* operator who does not use a pointer could not copy an id from any table
|
|
50
|
-
* built on this kit, and a screen reader announced the cell as plain text.
|
|
51
|
-
* It also made the id column the one cell in a row-activating table that
|
|
52
|
-
* silently swallowed the click that opens the record.
|
|
53
|
-
*/
|
|
54
|
-
const handleCopyToClipboard = async (event) => {
|
|
55
|
-
// A row that opens a record on click must not also open it on a copy.
|
|
56
|
-
event.stopPropagation();
|
|
57
|
-
// The same guard `CopyField` uses: an insecure context, and a browser
|
|
58
|
-
// without the API, both leave `navigator.clipboard` undefined, and the
|
|
59
|
-
// only thing this cell would otherwise do about it is throw an unhandled
|
|
60
|
-
// rejection out of a click handler. There is no input here to select as a
|
|
61
|
-
// fallback, so a silent no-op is the whole of what it can honestly offer.
|
|
62
|
-
if (!id || typeof navigator.clipboard?.writeText !== 'function') {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
try {
|
|
66
|
-
// The WHOLE id, never what is rendered. The cell is the only place most
|
|
67
|
-
// consoles expose it, and a truncated id pasted into a query matches
|
|
68
|
-
// nothing.
|
|
69
|
-
await navigator.clipboard.writeText(id);
|
|
70
|
-
onCopy?.(id);
|
|
71
|
-
}
|
|
72
|
-
catch {
|
|
73
|
-
// The browser refused the write: nothing reached the clipboard, so
|
|
74
|
-
// `onCopy` — which consumers hang their "copied" toast off — must not
|
|
75
|
-
// claim otherwise.
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
return (_jsx(TableCell
|
|
79
|
-
// The tooltip is the styled affordance; `title` is the fallback that
|
|
80
|
-
// survives without it — a printed page, a portal that has not mounted,
|
|
81
|
-
// and the cell padding outside the trigger.
|
|
82
|
-
, {
|
|
83
|
-
// The tooltip is the styled affordance; `title` is the fallback that
|
|
84
|
-
// survives without it — a printed page, a portal that has not mounted,
|
|
85
|
-
// and the cell padding outside the trigger.
|
|
86
|
-
title: id, ...others, children: _jsxs(TableCellWrapper, { children: [_jsx(TooltipProvider, { children: _jsxs(Tooltip, { delayDuration: 300, children: [_jsx(TooltipTrigger, { children: id ? truncateMiddle(id, head, tail) : id }), _jsx(TooltipContent, { children: id })] }) }), id ? (_jsx("button", { type: "button", "aria-label": copyLabel, onClick: handleCopyToClipboard,
|
|
87
|
-
// ⛔ THREE RULES HERE, AND EVERY ONE IS A WAY THE CONTROL
|
|
88
|
-
// DISAPPEARS RATHER THAN A DECORATION.
|
|
89
|
-
//
|
|
90
|
-
// `focus-visible:opacity-100`: a keyboard stop the operator cannot
|
|
91
|
-
// see is the same dead end the `<td>` handler was.
|
|
92
|
-
//
|
|
93
|
-
// `[@media(hover:none)]:opacity-100`: a phone or a tablet has no
|
|
94
|
-
// pointer to hover with, so `group-hover` never fires and the only
|
|
95
|
-
// control that copies an id stayed fully transparent — invisible
|
|
96
|
-
// AND unexplained on the one device where the id is hardest to
|
|
97
|
-
// read off the screen. Written as an arbitrary variant because the
|
|
98
|
-
// kit's Tailwind theme defines no named one.
|
|
99
|
-
//
|
|
100
|
-
// `size-6` with `-my-0.5`: WCAG 2.5.8 wants 24×24 CSS px, and the
|
|
101
|
-
// glyph alone is 14. The negative margin pulls the button's outer
|
|
102
|
-
// box back to the 20px line box of the cell's `text-sm` text, so
|
|
103
|
-
// the target grows without the row growing under it.
|
|
104
|
-
className: "focus-visible:ring-ring -my-0.5 ml-4 inline-flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-sm opacity-0 transition-opacity group-hover/table-cell:opacity-100 focus-visible:opacity-100 focus-visible:ring-2 focus-visible:outline-none [@media(hover:none)]:opacity-100", children: _jsx(Copy, { className: "size-3.5" }) })) : null] }) }));
|
|
105
|
-
};
|
|
1
|
+
import{jsx as e,jsxs as l}from"react/jsx-runtime";import{TableCell as m,TableCellWrapper as b}from"../../components/ui/table/index.js";import{Tooltip as f,TooltipContent as y,TooltipProvider as T,TooltipTrigger as g}from"../../components/ui/tooltip/index.js";import{Copy as C}from"lucide-react";const a=8;const c=4;function s(t,o){return Number.isFinite(t)?Math.max(0,Math.trunc(t)):o}function d(t,o,i){const r=s(o,a);const n=s(i,c);return t.length<=r+n+1?t:`${t.slice(0,r)}\u2026${t.slice(t.length-n)}`}export const IdTableCell=({id:t,onCopy:o,head:i=a,tail:r=c,copyLabel:n="Copy id",...p})=>{const u=async h=>{h.stopPropagation();if(!t||typeof navigator.clipboard?.writeText!=="function"){return}try{await navigator.clipboard.writeText(t);o?.(t)}catch{}};return e(m,{title:t,...p,children:l(b,{children:[e(T,{children:l(f,{delayDuration:300,children:[e(g,{children:t?d(t,i,r):t}),e(y,{children:t})]})}),t?e("button",{type:"button","aria-label":n,onClick:u,className:"focus-visible:ring-ring -my-0.5 ml-4 inline-flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-sm opacity-0 transition-opacity group-hover/table-cell:opacity-100 focus-visible:opacity-100 focus-visible:ring-2 focus-visible:outline-none [@media(hover:none)]:opacity-100",children:e(C,{className:"size-3.5"})}):null]})})};
|
|
@@ -1,37 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { LockIcon } from 'lucide-react';
|
|
3
|
-
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../../components/ui/tooltip/index.js';
|
|
4
|
-
import { cn } from '../../lib/utils.js';
|
|
5
|
-
/**
|
|
6
|
-
* Where a row's action menu would be, on a record the ledger will not let
|
|
7
|
-
* anyone change — an external account, in double-entry terms.
|
|
8
|
-
*
|
|
9
|
-
* ⛔ THE TRIGGER IS A BUTTON. It used to be a `<div>`, so the ONLY explanation
|
|
10
|
-
* of why the menu is gone lived in a tooltip that a keyboard could not open and
|
|
11
|
-
* a screen reader had nothing to attach to: the row simply had one control
|
|
12
|
-
* fewer, unexplained.
|
|
13
|
-
*
|
|
14
|
-
* `aria-disabled`, not the `disabled` attribute: a truly disabled button takes
|
|
15
|
-
* no focus and fires no pointer events, so it would announce as unavailable and
|
|
16
|
-
* then refuse to open the tooltip that says WHY — the same dead end in a
|
|
17
|
-
* different shape. This one is reachable, announces its reason as its name,
|
|
18
|
-
* opens the tooltip on focus as well as hover, and does nothing when pressed.
|
|
19
|
-
*
|
|
20
|
-
* ⛔ DOING NOTHING TAKES A HANDLER. `aria-disabled` is a promise to the
|
|
21
|
-
* accessibility tree, not to the DOM: the press really does dispatch a click,
|
|
22
|
-
* and a click bubbles. Consumers put this where a row's action menu would be,
|
|
23
|
-
* in rows that open the record — so with no handler of its own the one control
|
|
24
|
-
* that says "you cannot change this" would open the record it refuses to
|
|
25
|
-
* change, from a pointer and, because a button turns Enter and Space into
|
|
26
|
-
* clicks, from a keyboard too.
|
|
27
|
-
*/
|
|
28
|
-
export const LockedTableActions = ({ message, className }) => {
|
|
29
|
-
return (_jsx(TooltipProvider, { children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { type: "button", "aria-disabled": "true", "aria-label": message, onClick: (event) => {
|
|
30
|
-
event.preventDefault();
|
|
31
|
-
event.stopPropagation();
|
|
32
|
-
}, className: cn('border-border bg-muted flex size-9 items-center justify-center rounded-md border',
|
|
33
|
-
// Reachable is half the fix: a `border` over a `bg-muted` can
|
|
34
|
-
// swallow the browser's default outline entirely, and the other
|
|
35
|
-
// two cells in this table carry the same ring.
|
|
36
|
-
'focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none', className), children: _jsx(LockIcon, { size: 14, className: "text-muted-foreground" }) }) }), _jsx(TooltipContent, { side: "left", children: message })] }) }));
|
|
37
|
-
};
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{LockIcon as s}from"lucide-react";import{Tooltip as n,TooltipContent as l,TooltipProvider as c,TooltipTrigger as d}from"../../components/ui/tooltip/index.js";import{cn as a}from"../../lib/utils.js";export const LockedTableActions=({message:o,className:i})=>{return e(c,{children:t(n,{children:[e(d,{asChild:true,children:e("button",{type:"button","aria-disabled":"true","aria-label":o,onClick:r=>{r.preventDefault();r.stopPropagation()},className:a("border-border bg-muted flex size-9 items-center justify-center rounded-md border","focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",i),children:e(s,{size:14,className:"text-muted-foreground"})})}),e(l,{side:"left",children:o})]})})};
|
|
@@ -1,54 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Search } from 'lucide-react';
|
|
3
|
-
import { TableCell, TableCellWrapper, TableCellAction } from '../ui/table/index.js';
|
|
4
|
-
/**
|
|
5
|
-
* The name column, which is how an operator opens a record from a list.
|
|
6
|
-
*
|
|
7
|
-
* ⛔ THE CLICK IS A BUTTON, NEVER THE `<td>`. The cell had no click prop at
|
|
8
|
-
* all, so a consumer wanting a clickable name put `onClick` on the `<td>`
|
|
9
|
-
* through the spread props: a pointer user saw an affordance under a
|
|
10
|
-
* `<p class="cursor-pointer">`, and a keyboard or screen-reader user got a
|
|
11
|
-
* table cell with no control in it — the row's only route to the record was
|
|
12
|
-
* unreachable. `onClick` is now `Omit`ed from the inherited cell props, so the
|
|
13
|
-
* `<td>` handler is unrepresentable and the compiler says so at the call site.
|
|
14
|
-
*
|
|
15
|
-
* And with no handler there is no pointer cursor: text that says it is
|
|
16
|
-
* clickable and is not is worse than plain text.
|
|
17
|
-
*
|
|
18
|
-
* ⛔ AN INTERACTIVE CELL CANNOT BE ANONYMOUS. `name` renders INSIDE the button,
|
|
19
|
-
* so whatever it renders is the button's accessible name — and a `ReactNode` is
|
|
20
|
-
* free to render no text at all, which announces as a bare "button" and leaves
|
|
21
|
-
* the row's only route to its record as unreachable as the `<td>` handler
|
|
22
|
-
* above. The props are a union rather than a comment: a text `name` names the
|
|
23
|
-
* button by itself, anything else has to pass `buttonLabel`, and a cell with no
|
|
24
|
-
* handler is exempt because it holds no control.
|
|
25
|
-
*
|
|
26
|
-
* `buttonLabel` and not an inherited `aria-label`, which the spread puts on the
|
|
27
|
-
* `<td>` — naming the CELL, never the control inside it.
|
|
28
|
-
*
|
|
29
|
-
* ⛔ AND THE UNION STILL LETS THE EMPTY STRING THROUGH, because every string
|
|
30
|
-
* type does. `name=""` satisfies the text arm and `buttonLabel=" "` satisfies
|
|
31
|
-
* the labelled one, so the last word is the component's, below.
|
|
32
|
-
*/
|
|
33
|
-
export const NameTableCell = ({ name, onClick, buttonLabel, ...props }) => {
|
|
34
|
-
// Whitespace names nothing. An `aria-label` of " " is worse than none: it
|
|
35
|
-
// OVERRIDES the text inside the button, so a perfectly good name is replaced
|
|
36
|
-
// by silence. Drop it and the text content names the control again.
|
|
37
|
-
const label = buttonLabel?.trim() ? buttonLabel : undefined;
|
|
38
|
-
// Only a text `name` can name the button by itself. Any other node is opaque
|
|
39
|
-
// here — which is why the type demands a label for it in the first place.
|
|
40
|
-
const textName = typeof name === 'string' ? name.trim() : '';
|
|
41
|
-
const named = Boolean(label) || textName !== '';
|
|
42
|
-
// ⛔ AN UNNAMED BUTTON LOSES ITS HANDLER, IT DOES NOT SHIP. The two failures
|
|
43
|
-
// are not symmetric: a button announcing "" is invisible to the developer who
|
|
44
|
-
// wrote it and fatal to the operator who cannot use a mouse, while a name
|
|
45
|
-
// that does not open its record shows itself on the very first render. So the
|
|
46
|
-
// cell degrades to the plain text it can still display correctly, and says so
|
|
47
|
-
// where a developer will see it. Never throws: one nameless row must not take
|
|
48
|
-
// the whole table down.
|
|
49
|
-
if (process.env.NODE_ENV !== 'production' && onClick && !named) {
|
|
50
|
-
console.error(`NameTableCell has no accessible name: \`${typeof name === 'string' ? 'name' : 'buttonLabel'}\` is empty, so its click handler was dropped rather than render a button announcing "".`);
|
|
51
|
-
}
|
|
52
|
-
const opensRecord = onClick && named;
|
|
53
|
-
return (_jsx(TableCell, { ...props, children: _jsxs(TableCellWrapper, { children: [opensRecord ? (_jsx("button", { type: "button", onClick: onClick, "aria-label": label, className: "focus-visible:ring-ring cursor-pointer rounded-sm text-left focus-visible:ring-2 focus-visible:outline-none", children: name })) : (_jsx("p", { children: name })), _jsx(TableCellAction, { children: _jsx(Search, { className: "size-3.5" }) })] }) }));
|
|
54
|
-
};
|
|
1
|
+
import{jsx as r,jsxs as c}from"react/jsx-runtime";import{Search as p}from"lucide-react";import{TableCell as d,TableCellWrapper as b,TableCellAction as m}from"../ui/table/index.js";export const NameTableCell=({name:e,onClick:o,buttonLabel:s,...l})=>{const n=s?.trim()?s:void 0;const i=typeof e==="string"?e.trim():"";const t=Boolean(n)||i!=="";if(process.env.NODE_ENV!=="production"&&o&&!t){console.error(`NameTableCell has no accessible name: \`${typeof e==="string"?"name":"buttonLabel"}\` is empty, so its click handler was dropped rather than render a button announcing "".`)}const a=o&&t;return r(d,{...l,children:c(b,{children:[a?r("button",{type:"button",onClick:o,"aria-label":n,className:"focus-visible:ring-ring cursor-pointer rounded-sm text-left focus-visible:ring-2 focus-visible:outline-none",children:e}):r("p",{children:e}),r(m,{children:r(p,{className:"size-3.5"})})]})})};
|
|
@@ -1,24 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
4
|
-
import { ChevronDown } from 'lucide-react';
|
|
5
|
-
import { cn } from '../../../lib/utils.js';
|
|
6
|
-
function Accordion({ ...props }) {
|
|
7
|
-
return _jsx(AccordionPrimitive.Root, { "data-slot": "accordion", ...props });
|
|
8
|
-
}
|
|
9
|
-
function AccordionItem({ className, ...props }) {
|
|
10
|
-
return (_jsx(AccordionPrimitive.Item, { "data-slot": "accordion-item", className: cn('border-b last:border-b-0', className), ...props }));
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* `asChild` is deliberately omitted: the trigger always renders the caller's
|
|
14
|
-
* children PLUS the chevron, and Radix's Slot cannot merge onto two children —
|
|
15
|
-
* it throws at runtime. Legacy sindarian-x carried the same two-child shape, so
|
|
16
|
-
* `asChild` never worked there either; here it is a compile error instead.
|
|
17
|
-
*/
|
|
18
|
-
function AccordionTrigger({ className, children, ...props }) {
|
|
19
|
-
return (_jsx(AccordionPrimitive.Header, { className: "flex", children: _jsxs(AccordionPrimitive.Trigger, { "data-slot": "accordion-trigger", className: cn('focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-colors outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180', className), ...props, children: [children, _jsx(ChevronDown, { className: "text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" })] }) }));
|
|
20
|
-
}
|
|
21
|
-
function AccordionContent({ className, children, ...props }) {
|
|
22
|
-
return (_jsx(AccordionPrimitive.Content, { "data-slot": "accordion-content", className: "motion-safe:data-[state=closed]:animate-accordion-up motion-safe:data-[state=open]:animate-accordion-down overflow-hidden text-sm", ...props, children: _jsx("div", { className: cn('pt-0 pb-4', className), children: children }) }));
|
|
23
|
-
}
|
|
24
|
-
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
|
|
1
|
+
"use client";import{jsx as o,jsxs as a}from"react/jsx-runtime";import*as n from"@radix-ui/react-accordion";import{ChevronDown as s}from"lucide-react";import{cn as i}from"../../../lib/utils.js";function c({...e}){return o(n.Root,{"data-slot":"accordion",...e})}function d({className:e,...t}){return o(n.Item,{"data-slot":"accordion-item",className:i("border-b last:border-b-0",e),...t})}function l({className:e,children:t,...r}){return o(n.Header,{className:"flex",children:a(n.Trigger,{"data-slot":"accordion-trigger",className:i("focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-colors outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",e),...r,children:[t,o(s,{className:"text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200"})]})})}function m({className:e,children:t,...r}){return o(n.Content,{"data-slot":"accordion-content",className:"motion-safe:data-[state=closed]:animate-accordion-up motion-safe:data-[state=open]:animate-accordion-down overflow-hidden text-sm",...r,children:o("div",{className:i("pt-0 pb-4",e),children:t})})}export{c as Accordion,d as AccordionItem,l as AccordionTrigger,m as AccordionContent};
|
|
@@ -1,38 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { cva } from 'class-variance-authority';
|
|
3
|
-
import { cn } from '../../../lib/utils.js';
|
|
4
|
-
import { IconButton } from '../icon-button/index.js';
|
|
5
|
-
import { X } from 'lucide-react';
|
|
6
|
-
const alertVariants = cva('alert', {
|
|
7
|
-
variants: {
|
|
8
|
-
variant: {
|
|
9
|
-
default: '',
|
|
10
|
-
informative: 'alert-informative',
|
|
11
|
-
destructive: 'alert-destructive',
|
|
12
|
-
warning: 'alert-warning',
|
|
13
|
-
success: 'alert-success'
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
defaultVariants: {
|
|
17
|
-
variant: 'default'
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
function Alert({ className, variant, ...props }) {
|
|
21
|
-
return (_jsx("div", { "data-slot": "alert", role: "alert", className: cn(alertVariants({ variant }), className), ...props }));
|
|
22
|
-
}
|
|
23
|
-
function AlertTitle({ className, ...props }) {
|
|
24
|
-
return (_jsx("div", { "data-slot": "alert-title", className: cn('alert-title', className), ...props }));
|
|
25
|
-
}
|
|
26
|
-
function AlertDescription({ className, ...props }) {
|
|
27
|
-
return (_jsx("div", { "data-slot": "alert-description", className: cn('alert-description', className), ...props }));
|
|
28
|
-
}
|
|
29
|
-
function AlertActions({ className, ...props }) {
|
|
30
|
-
return (_jsx("div", { "data-slot": "alert-actions", className: cn('alert-actions', className), ...props }));
|
|
31
|
-
}
|
|
32
|
-
function AlertTopAction({ className, ...props }) {
|
|
33
|
-
return (_jsx("div", { "data-slot": "alert-top-action", className: cn('alert-top-action', className), ...props }));
|
|
34
|
-
}
|
|
35
|
-
function AlertClose({ className, ...props }) {
|
|
36
|
-
return (_jsx(AlertTopAction, { children: _jsx(IconButton, { className: cn('alert-close', className), variant: "outline", size: "small", rounded: true, ...props, children: _jsx(X, {}) }) }));
|
|
37
|
-
}
|
|
38
|
-
export { Alert, AlertTitle, AlertDescription, AlertActions, AlertTopAction, AlertClose };
|
|
1
|
+
import{jsx as a}from"react/jsx-runtime";import{cva as n}from"class-variance-authority";import{cn as e}from"../../../lib/utils.js";import{IconButton as s}from"../icon-button/index.js";import{X as o}from"lucide-react";const c=n("alert",{variants:{variant:{default:"",informative:"alert-informative",destructive:"alert-destructive",warning:"alert-warning",success:"alert-success"}},defaultVariants:{variant:"default"}});function u({className:r,variant:t,...l}){return a("div",{"data-slot":"alert",role:t==="destructive"?"alert":"status",className:e(c({variant:t}),r),...l})}function d({className:r,...t}){return a("div",{"data-slot":"alert-title",className:e("alert-title",r),...t})}function m({className:r,...t}){return a("div",{"data-slot":"alert-description",className:e("alert-description",r),...t})}function f({className:r,...t}){return a("div",{"data-slot":"alert-actions",className:e("alert-actions",r),...t})}function i({className:r,...t}){return a("div",{"data-slot":"alert-top-action",className:e("alert-top-action",r),...t})}function v({className:r,...t}){return a(i,{children:a(s,{className:e("alert-close",r),variant:"outline",size:"small",rounded:true,...t,children:a(o,{})})})}export{u as Alert,d as AlertTitle,m as AlertDescription,f as AlertActions,i as AlertTopAction,v as AlertClose};
|
|
@@ -1,39 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
|
|
4
|
-
import { buttonVariants } from '../../../components/ui/button/index.js';
|
|
5
|
-
import { cn } from '../../../lib/utils.js';
|
|
6
|
-
function AlertDialog({ ...props }) {
|
|
7
|
-
return _jsx(AlertDialogPrimitive.Root, { "data-slot": "alert-dialog", ...props });
|
|
8
|
-
}
|
|
9
|
-
function AlertDialogTrigger({ ...props }) {
|
|
10
|
-
return (_jsx(AlertDialogPrimitive.Trigger, { "data-slot": "alert-dialog-trigger", ...props }));
|
|
11
|
-
}
|
|
12
|
-
function AlertDialogPortal({ ...props }) {
|
|
13
|
-
return (_jsx(AlertDialogPrimitive.Portal, { "data-slot": "alert-dialog-portal", ...props }));
|
|
14
|
-
}
|
|
15
|
-
function AlertDialogOverlay({ className, ...props }) {
|
|
16
|
-
return (_jsx(AlertDialogPrimitive.Overlay, { "data-slot": "alert-dialog-overlay", className: cn('dialog-overlay', className), ...props }));
|
|
17
|
-
}
|
|
18
|
-
function AlertDialogContent({ className, container, forceMount, ...props }) {
|
|
19
|
-
return (_jsxs(AlertDialogPortal, { container: container, forceMount: forceMount, children: [_jsx(AlertDialogOverlay, { forceMount: forceMount }), _jsx(AlertDialogPrimitive.Content, { "data-slot": "alert-dialog-content", className: cn('dialog-content', className), forceMount: forceMount, ...props })] }));
|
|
20
|
-
}
|
|
21
|
-
function AlertDialogHeader({ className, ...props }) {
|
|
22
|
-
return (_jsx("div", { "data-slot": "alert-dialog-header", className: cn('dialog-header', className), ...props }));
|
|
23
|
-
}
|
|
24
|
-
function AlertDialogFooter({ className, ...props }) {
|
|
25
|
-
return (_jsx("div", { "data-slot": "alert-dialog-footer", className: cn('dialog-footer', className), ...props }));
|
|
26
|
-
}
|
|
27
|
-
function AlertDialogTitle({ className, ...props }) {
|
|
28
|
-
return (_jsx(AlertDialogPrimitive.Title, { "data-slot": "alert-dialog-title", className: cn('dialog-title', className), ...props }));
|
|
29
|
-
}
|
|
30
|
-
function AlertDialogDescription({ className, ...props }) {
|
|
31
|
-
return (_jsx(AlertDialogPrimitive.Description, { "data-slot": "alert-dialog-description", className: cn('dialog-description', className), ...props }));
|
|
32
|
-
}
|
|
33
|
-
function AlertDialogAction({ className, variant = 'default', ...props }) {
|
|
34
|
-
return (_jsx(AlertDialogPrimitive.Action, { "data-slot": "alert-dialog-action", className: cn(buttonVariants({ variant }), className), ...props }));
|
|
35
|
-
}
|
|
36
|
-
function AlertDialogCancel({ className, variant = 'outline', ...props }) {
|
|
37
|
-
return (_jsx(AlertDialogPrimitive.Cancel, { "data-slot": "alert-dialog-cancel", className: cn(buttonVariants({ variant }), className), ...props }));
|
|
38
|
-
}
|
|
39
|
-
export { AlertDialog, AlertDialogPortal, AlertDialogOverlay, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, AlertDialogAction, AlertDialogCancel };
|
|
1
|
+
"use client";import{jsx as l,jsxs as d}from"react/jsx-runtime";import*as o from"@radix-ui/react-alert-dialog";import{buttonVariants as i}from"../../../components/ui/button/index.js";import{cn as e}from"../../../lib/utils.js";function g({...t}){return l(o.Root,{"data-slot":"alert-dialog",...t})}function u({...t}){return l(o.Trigger,{"data-slot":"alert-dialog-trigger",...t})}function n({...t}){return l(o.Portal,{"data-slot":"alert-dialog-portal",...t})}function s({className:t,...a}){return l(o.Overlay,{"data-slot":"alert-dialog-overlay",className:e("dialog-overlay",t),...a})}function f({className:t,container:a,forceMount:r,...c}){return d(n,{container:a,forceMount:r,children:[l(s,{forceMount:r}),l(o.Content,{"data-slot":"alert-dialog-content",className:e("dialog-content",t),forceMount:r,...c})]})}function m({className:t,...a}){return l("div",{"data-slot":"alert-dialog-header",className:e("dialog-header",t),...a})}function A({className:t,...a}){return l("div",{"data-slot":"alert-dialog-footer",className:e("dialog-footer",t),...a})}function D({className:t,...a}){return l(o.Title,{"data-slot":"alert-dialog-title",className:e("dialog-title",t),...a})}function p({className:t,...a}){return l(o.Description,{"data-slot":"alert-dialog-description",className:e("dialog-description",t),...a})}function N({className:t,variant:a="default",...r}){return l(o.Action,{"data-slot":"alert-dialog-action",className:e(i({variant:a}),t),...r})}function v({className:t,variant:a="outline",...r}){return l(o.Cancel,{"data-slot":"alert-dialog-cancel",className:e(i({variant:a}),t),...r})}export{g as AlertDialog,n as AlertDialogPortal,s as AlertDialogOverlay,u as AlertDialogTrigger,f as AlertDialogContent,m as AlertDialogHeader,A as AlertDialogFooter,D as AlertDialogTitle,p as AlertDialogDescription,N as AlertDialogAction,v as AlertDialogCancel};
|