torch-glare 2.5.5 → 2.6.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/README.md +4 -3
- package/dist/bin/index.js +9 -24
- package/dist/bin/index.js.map +1 -1
- package/dist/src/commands/add.d.ts +2 -2
- package/dist/src/commands/add.d.ts.map +1 -1
- package/dist/src/commands/add.js +4 -70
- package/dist/src/commands/add.js.map +1 -1
- package/dist/src/commands/hook.d.ts +5 -4
- package/dist/src/commands/hook.d.ts.map +1 -1
- package/dist/src/commands/hook.js +7 -75
- package/dist/src/commands/hook.js.map +1 -1
- package/dist/src/commands/init.js +1 -1
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/layout.d.ts +5 -4
- package/dist/src/commands/layout.d.ts.map +1 -1
- package/dist/src/commands/layout.js +7 -75
- package/dist/src/commands/layout.js.map +1 -1
- package/dist/src/commands/provider.d.ts +5 -4
- package/dist/src/commands/provider.d.ts.map +1 -1
- package/dist/src/commands/provider.js +7 -75
- package/dist/src/commands/provider.js.map +1 -1
- package/dist/src/commands/update.d.ts.map +1 -1
- package/dist/src/commands/update.js +78 -43
- package/dist/src/commands/update.js.map +1 -1
- package/dist/src/commands/utils.d.ts +5 -4
- package/dist/src/commands/utils.d.ts.map +1 -1
- package/dist/src/commands/utils.js +7 -80
- package/dist/src/commands/utils.js.map +1 -1
- package/dist/src/shared/addFromRegistry.d.ts +16 -0
- package/dist/src/shared/addFromRegistry.d.ts.map +1 -0
- package/dist/src/shared/addFromRegistry.js +88 -0
- package/dist/src/shared/addFromRegistry.js.map +1 -0
- package/dist/src/shared/getInstallCommand.d.ts.map +1 -1
- package/dist/src/shared/getInstallCommand.js +5 -0
- package/dist/src/shared/getInstallCommand.js.map +1 -1
- package/dist/src/shared/installDependencies.d.ts +0 -10
- package/dist/src/shared/installDependencies.d.ts.map +1 -1
- package/dist/src/shared/installDependencies.js +0 -17
- package/dist/src/shared/installDependencies.js.map +1 -1
- package/dist/src/shared/installFromPlan.d.ts +7 -5
- package/dist/src/shared/installFromPlan.d.ts.map +1 -1
- package/dist/src/shared/installFromPlan.js +103 -36
- package/dist/src/shared/installFromPlan.js.map +1 -1
- package/dist/src/shared/loadRegistry.d.ts +12 -3
- package/dist/src/shared/loadRegistry.d.ts.map +1 -1
- package/dist/src/shared/loadRegistry.js +19 -20
- package/dist/src/shared/loadRegistry.js.map +1 -1
- package/dist/src/shared/registryClient.d.ts +19 -0
- package/dist/src/shared/registryClient.d.ts.map +1 -0
- package/dist/src/shared/registryClient.js +128 -0
- package/dist/src/shared/registryClient.js.map +1 -0
- package/dist/src/shared/resolveEntry.d.ts +10 -7
- package/dist/src/shared/resolveEntry.d.ts.map +1 -1
- package/dist/src/shared/resolveEntry.js +18 -13
- package/dist/src/shared/resolveEntry.js.map +1 -1
- package/dist/src/shared/suggestOtherCommand.d.ts +7 -1
- package/dist/src/shared/suggestOtherCommand.d.ts.map +1 -1
- package/dist/src/shared/suggestOtherCommand.js +29 -23
- package/dist/src/shared/suggestOtherCommand.js.map +1 -1
- package/dist/src/types/main.d.ts +31 -2
- package/dist/src/types/main.d.ts.map +1 -1
- package/package.json +6 -11
- package/apps/lib/components/ActionButton.tsx +0 -93
- package/apps/lib/components/ActionsGroup.tsx +0 -27
- package/apps/lib/components/AlertDialog.tsx +0 -204
- package/apps/lib/components/Avatar.tsx +0 -46
- package/apps/lib/components/Badge.tsx +0 -250
- package/apps/lib/components/BadgeField.tsx +0 -338
- package/apps/lib/components/Breadcrumb.tsx +0 -280
- package/apps/lib/components/Button.tsx +0 -317
- package/apps/lib/components/ButtonGroup.tsx +0 -190
- package/apps/lib/components/Calendar.tsx +0 -115
- package/apps/lib/components/Card.tsx +0 -95
- package/apps/lib/components/Checkbox.tsx +0 -42
- package/apps/lib/components/ColorPicker.tsx +0 -441
- package/apps/lib/components/ConclusionHeader.tsx +0 -148
- package/apps/lib/components/ContextMenu.tsx +0 -571
- package/apps/lib/components/CountBadge.tsx +0 -52
- package/apps/lib/components/DataTable.tsx +0 -213
- package/apps/lib/components/DataViews/badge.ts +0 -49
- package/apps/lib/components/DataViews/cell.tsx +0 -324
- package/apps/lib/components/DataViews/context.ts +0 -144
- package/apps/lib/components/DataViews/data-views.tsx +0 -383
- package/apps/lib/components/DataViews/filters/children.tsx +0 -98
- package/apps/lib/components/DataViews/filters/custom.tsx +0 -34
- package/apps/lib/components/DataViews/filters/filters.tsx +0 -157
- package/apps/lib/components/DataViews/filters/index.ts +0 -4
- package/apps/lib/components/DataViews/filters/labelled.tsx +0 -20
- package/apps/lib/components/DataViews/filters/presets.tsx +0 -65
- package/apps/lib/components/DataViews/filters/sync.tsx +0 -35
- package/apps/lib/components/DataViews/filters/values.ts +0 -173
- package/apps/lib/components/DataViews/header.tsx +0 -220
- package/apps/lib/components/DataViews/hooks/index.ts +0 -5
- package/apps/lib/components/DataViews/hooks/useActiveRow.ts +0 -22
- package/apps/lib/components/DataViews/hooks/useControllable.ts +0 -52
- package/apps/lib/components/DataViews/index.ts +0 -84
- package/apps/lib/components/DataViews/panel/columns.tsx +0 -153
- package/apps/lib/components/DataViews/panel/controls.tsx +0 -106
- package/apps/lib/components/DataViews/panel/index.ts +0 -3
- package/apps/lib/components/DataViews/panel/panel.tsx +0 -164
- package/apps/lib/components/DataViews/panel/saved-views.tsx +0 -67
- package/apps/lib/components/DataViews/panel/section.tsx +0 -81
- package/apps/lib/components/DataViews/panel/sort.tsx +0 -42
- package/apps/lib/components/DataViews/panel/tab.tsx +0 -31
- package/apps/lib/components/DataViews/slots.ts +0 -63
- package/apps/lib/components/DataViews/states.tsx +0 -38
- package/apps/lib/components/DataViews/types.ts +0 -510
- package/apps/lib/components/DataViews/views/board-view.tsx +0 -381
- package/apps/lib/components/DataViews/views/card-rows.tsx +0 -36
- package/apps/lib/components/DataViews/views/inbox-view.tsx +0 -260
- package/apps/lib/components/DataViews/views/pane-views.tsx +0 -196
- package/apps/lib/components/DataViews/views/table-view.tsx +0 -493
- package/apps/lib/components/DataViews/views/tree-view.tsx +0 -367
- package/apps/lib/components/DatePicker.tsx +0 -232
- package/apps/lib/components/Dialog.tsx +0 -116
- package/apps/lib/components/Divider.tsx +0 -28
- package/apps/lib/components/Drawer.tsx +0 -420
- package/apps/lib/components/DropdownMenu.tsx +0 -540
- package/apps/lib/components/FieldHint.tsx +0 -69
- package/apps/lib/components/Form.tsx +0 -182
- package/apps/lib/components/FormBuilder/context.ts +0 -73
- package/apps/lib/components/FormBuilder/field-kind.ts +0 -28
- package/apps/lib/components/FormBuilder/fields/ChoiceFields.tsx +0 -60
- package/apps/lib/components/FormBuilder/fields/ColorField.tsx +0 -59
- package/apps/lib/components/FormBuilder/fields/CustomField.tsx +0 -11
- package/apps/lib/components/FormBuilder/fields/DateField.tsx +0 -32
- package/apps/lib/components/FormBuilder/fields/FieldArray.tsx +0 -74
- package/apps/lib/components/FormBuilder/fields/FieldShell.tsx +0 -163
- package/apps/lib/components/FormBuilder/fields/FileField.tsx +0 -39
- package/apps/lib/components/FormBuilder/fields/OptionListFields.tsx +0 -132
- package/apps/lib/components/FormBuilder/fields/OtpField.tsx +0 -31
- package/apps/lib/components/FormBuilder/fields/PhoneField.tsx +0 -109
- package/apps/lib/components/FormBuilder/fields/RichTextEditorField.tsx +0 -31
- package/apps/lib/components/FormBuilder/fields/SelectField.tsx +0 -91
- package/apps/lib/components/FormBuilder/fields/SignatureField.tsx +0 -157
- package/apps/lib/components/FormBuilder/fields/SliderField.tsx +0 -67
- package/apps/lib/components/FormBuilder/fields/SwitchBoxField.tsx +0 -41
- package/apps/lib/components/FormBuilder/fields/TableField.tsx +0 -336
- package/apps/lib/components/FormBuilder/fields/TextField.tsx +0 -213
- package/apps/lib/components/FormBuilder/fields/TreeSelectField.tsx +0 -43
- package/apps/lib/components/FormBuilder/fields/countries.ts +0 -303
- package/apps/lib/components/FormBuilder/fields/index.ts +0 -25
- package/apps/lib/components/FormBuilder/form-builder.tsx +0 -198
- package/apps/lib/components/FormBuilder/index.ts +0 -31
- package/apps/lib/components/FormBuilder/numberFormat.ts +0 -16
- package/apps/lib/components/FormBuilder/submit.tsx +0 -47
- package/apps/lib/components/FormBuilder/types.ts +0 -311
- package/apps/lib/components/FormRenderer/FormDrawer.tsx +0 -128
- package/apps/lib/components/FormRenderer/detail.tsx +0 -207
- package/apps/lib/components/FormRenderer/form-renderer.tsx +0 -297
- package/apps/lib/components/FormRenderer/header.tsx +0 -88
- package/apps/lib/components/FormRenderer/index.ts +0 -15
- package/apps/lib/components/FormRenderer/section.tsx +0 -39
- package/apps/lib/components/FormRenderer/stepper.tsx +0 -339
- package/apps/lib/components/FormRenderer/types.ts +0 -78
- package/apps/lib/components/FormSummary.tsx +0 -282
- package/apps/lib/components/HeaderBar.tsx +0 -117
- package/apps/lib/components/ImageAttachment.tsx +0 -209
- package/apps/lib/components/InnerLabelField.tsx +0 -154
- package/apps/lib/components/Input.tsx +0 -224
- package/apps/lib/components/InputField.tsx +0 -147
- package/apps/lib/components/InputOTP.tsx +0 -84
- package/apps/lib/components/Label.tsx +0 -129
- package/apps/lib/components/LabelField.tsx +0 -76
- package/apps/lib/components/LabeledCheckBox.tsx +0 -51
- package/apps/lib/components/LabeledRadio.tsx +0 -51
- package/apps/lib/components/LinkButton.tsx +0 -94
- package/apps/lib/components/LoginButton.tsx +0 -51
- package/apps/lib/components/PasswordLevel.tsx +0 -58
- package/apps/lib/components/Popover.tsx +0 -312
- package/apps/lib/components/ProfileMenu.tsx +0 -85
- package/apps/lib/components/Radio.tsx +0 -59
- package/apps/lib/components/RadioCard.tsx +0 -50
- package/apps/lib/components/ScrollArea.tsx +0 -54
- package/apps/lib/components/SearchField.tsx +0 -62
- package/apps/lib/components/SearchableSelect.tsx +0 -318
- package/apps/lib/components/SearchableTable.tsx +0 -344
- package/apps/lib/components/SearchableTree.tsx +0 -485
- package/apps/lib/components/SearchableTreeDialog.tsx +0 -502
- package/apps/lib/components/SectionBlock.tsx +0 -147
- package/apps/lib/components/Select.tsx +0 -347
- package/apps/lib/components/SimpleSelect.tsx +0 -225
- package/apps/lib/components/Skeleton.tsx +0 -12
- package/apps/lib/components/SlideDatePicker.tsx +0 -253
- package/apps/lib/components/SpinLoading.tsx +0 -174
- package/apps/lib/components/Stepper.tsx +0 -480
- package/apps/lib/components/Switch.tsx +0 -82
- package/apps/lib/components/TabFormItem.tsx +0 -153
- package/apps/lib/components/TabSwitch.tsx +0 -172
- package/apps/lib/components/Table.tsx +0 -610
- package/apps/lib/components/TextEditor/ChartBlockTool.ts +0 -676
- package/apps/lib/components/TextEditor/RichTextField.tsx +0 -46
- package/apps/lib/components/TextEditor/TableDnDWrapper.ts +0 -462
- package/apps/lib/components/TextEditor/TextEditor.tsx +0 -1164
- package/apps/lib/components/TextEditor/TextEditorToolbar.tsx +0 -429
- package/apps/lib/components/TextEditor/editor-tools/AlignmentTune.ts +0 -70
- package/apps/lib/components/TextEditor/editor-tools/ColorInlineTool.ts +0 -50
- package/apps/lib/components/TextEditor/editor-tools/StrikethroughInlineTool.ts +0 -48
- package/apps/lib/components/TextEditor/editor-tools/inlineFormat.ts +0 -98
- package/apps/lib/components/TextEditor/editorjs.d.ts +0 -60
- package/apps/lib/components/TextEditor/index.ts +0 -7
- package/apps/lib/components/TextEditor/markdownParser.ts +0 -346
- package/apps/lib/components/Textarea.tsx +0 -117
- package/apps/lib/components/Timeline.tsx +0 -263
- package/apps/lib/components/Toast.tsx +0 -87
- package/apps/lib/components/Toggle.tsx +0 -125
- package/apps/lib/components/ToggleButton.tsx +0 -140
- package/apps/lib/components/Tooltip.tsx +0 -116
- package/apps/lib/components/TransparentLabel.tsx +0 -71
- package/apps/lib/components/TreeDropDown.tsx +0 -115
- package/apps/lib/components/TreeFolder/TreeFolder.tsx +0 -380
- package/apps/lib/components/TreeFolder/TreeFolderBreadcrumb.tsx +0 -75
- package/apps/lib/components/TreeFolder/TreeFolderRow.tsx +0 -354
- package/apps/lib/components/TreeFolder/TreeFolderStyles.tsx +0 -60
- package/apps/lib/components/TreeFolder/icons.tsx +0 -60
- package/apps/lib/components/TreeFolder/index.ts +0 -24
- package/apps/lib/components/TreeFolder/treeFolderUtils.ts +0 -109
- package/apps/lib/components/TreeFolder/types.ts +0 -77
- package/apps/lib/components/TreeFolder/useTreeFolderDnD.ts +0 -118
- package/apps/lib/hooks/useActiveTreeItem.ts +0 -58
- package/apps/lib/hooks/useClickOutside.ts +0 -27
- package/apps/lib/hooks/useDragDrop.tsx +0 -365
- package/apps/lib/hooks/useInfiniteScroll.ts +0 -108
- package/apps/lib/hooks/useIsMobile.ts +0 -21
- package/apps/lib/hooks/useResize.ts +0 -67
- package/apps/lib/hooks/useTagSelection.ts +0 -214
- package/apps/lib/layouts/CNLayout.tsx +0 -372
- package/apps/lib/layouts/DataViewCard.tsx +0 -62
- package/apps/lib/layouts/FieldSection.tsx +0 -91
- package/apps/lib/layouts/TreeSubLayout.tsx +0 -173
- package/apps/lib/providers/ThemeProvider.tsx +0 -84
- package/apps/lib/registry.json +0 -1201
- package/apps/lib/tsconfig.json +0 -9
- package/apps/lib/tsconfig.tsbuildinfo +0 -1
- package/apps/lib/utils/cn.ts +0 -6
- package/apps/lib/utils/color.ts +0 -175
- package/apps/lib/utils/dataViews/path.ts +0 -67
- package/apps/lib/utils/dataViews/query.ts +0 -73
- package/apps/lib/utils/dataViews/types.ts +0 -187
- package/apps/lib/utils/dateFormat.ts +0 -108
- package/apps/lib/utils/resize.ts +0 -31
- package/apps/lib/utils/types.ts +0 -16
- package/docs/BLOCKS.md +0 -129
- package/docs/CHANGELOG-1.1.16.md +0 -108
- package/docs/Cover.png +0 -0
- package/docs/README.md +0 -215
- package/docs/components/action-button.md +0 -638
- package/docs/components/actions-group.md +0 -708
- package/docs/components/alert-dialog.md +0 -920
- package/docs/components/avatar.md +0 -709
- package/docs/components/badge-field.md +0 -712
- package/docs/components/badge.md +0 -301
- package/docs/components/breadcrumb.md +0 -930
- package/docs/components/button-group.md +0 -650
- package/docs/components/button.md +0 -639
- package/docs/components/calendar.md +0 -555
- package/docs/components/card.md +0 -622
- package/docs/components/chart-block-tool.md +0 -129
- package/docs/components/checkbox.md +0 -699
- package/docs/components/cn-layout.md +0 -854
- package/docs/components/color-picker.md +0 -101
- package/docs/components/conclusion-header.md +0 -80
- package/docs/components/context-menu.md +0 -483
- package/docs/components/count-badge.md +0 -560
- package/docs/components/data-table.md +0 -854
- package/docs/components/data-views/backend-response.md +0 -324
- package/docs/components/data-views/examples/a11y-rtl.md +0 -250
- package/docs/components/data-views/examples/api-orders-route.md +0 -130
- package/docs/components/data-views/examples/fields.md +0 -362
- package/docs/components/data-views/examples/filters.md +0 -307
- package/docs/components/data-views/examples/inbox-routing.md +0 -218
- package/docs/components/data-views/examples/index.md +0 -29
- package/docs/components/data-views/examples/overview.md +0 -244
- package/docs/components/data-views/examples/panel.md +0 -212
- package/docs/components/data-views/examples/scale.md +0 -231
- package/docs/components/data-views/examples/server-side.md +0 -210
- package/docs/components/data-views/examples/state.md +0 -250
- package/docs/components/data-views/examples/tree-custom.md +0 -388
- package/docs/components/data-views/examples/view-registry.md +0 -313
- package/docs/components/data-views/examples/views.md +0 -534
- package/docs/components/data-views/guide.md +0 -405
- package/docs/components/data-views/index.md +0 -1495
- package/docs/components/data-views/migration.md +0 -79
- package/docs/components/date-picker.md +0 -857
- package/docs/components/dialog.md +0 -929
- package/docs/components/divider.md +0 -766
- package/docs/components/drawer.md +0 -654
- package/docs/components/dropdown-menu.md +0 -668
- package/docs/components/field-hint.md +0 -898
- package/docs/components/field-section.md +0 -781
- package/docs/components/form-builder.md +0 -276
- package/docs/components/form-renderer.md +0 -326
- package/docs/components/form-summary.md +0 -138
- package/docs/components/form.md +0 -785
- package/docs/components/header-bar.md +0 -188
- package/docs/components/image-attachment.md +0 -906
- package/docs/components/inner-label-field.md +0 -819
- package/docs/components/input-field.md +0 -623
- package/docs/components/input-otp.md +0 -756
- package/docs/components/input.md +0 -634
- package/docs/components/label-field.md +0 -770
- package/docs/components/label.md +0 -761
- package/docs/components/labeled-check-box.md +0 -642
- package/docs/components/labeled-radio.md +0 -796
- package/docs/components/link-button.md +0 -685
- package/docs/components/login-button.md +0 -872
- package/docs/components/password-level.md +0 -803
- package/docs/components/popover.md +0 -649
- package/docs/components/profile-menu.md +0 -656
- package/docs/components/radio-card.md +0 -801
- package/docs/components/radio.md +0 -735
- package/docs/components/scroll-area.md +0 -691
- package/docs/components/search-field.md +0 -702
- package/docs/components/searchable-select.md +0 -368
- package/docs/components/searchable-table.md +0 -438
- package/docs/components/searchable-tree-dialog.md +0 -190
- package/docs/components/searchable-tree.md +0 -200
- package/docs/components/section-block.md +0 -477
- package/docs/components/select.md +0 -709
- package/docs/components/simple-select.md +0 -741
- package/docs/components/skeleton.md +0 -706
- package/docs/components/slide-date-picker.md +0 -837
- package/docs/components/spin-loading.md +0 -696
- package/docs/components/stepper.md +0 -316
- package/docs/components/switch.md +0 -770
- package/docs/components/tab-form-item.md +0 -773
- package/docs/components/tab-switch.md +0 -170
- package/docs/components/table-dnd-wrapper.md +0 -107
- package/docs/components/table.md +0 -1088
- package/docs/components/text-editor.md +0 -735
- package/docs/components/textarea.md +0 -681
- package/docs/components/timeline.md +0 -254
- package/docs/components/toast.md +0 -773
- package/docs/components/toggle-button.md +0 -643
- package/docs/components/toggle.md +0 -882
- package/docs/components/tooltip.md +0 -513
- package/docs/components/transparent-label.md +0 -721
- package/docs/components/tree-drop-down.md +0 -740
- package/docs/components/tree-folder.md +0 -110
- package/docs/components/tree-sub-layout.md +0 -707
- package/docs/explanation/architecture.md +0 -54
- package/docs/explanation/design-system.md +0 -52
- package/docs/how-to/form-and-list-recipes.md +0 -386
- package/docs/how-to/forms-with-form-builder.md +0 -472
- package/docs/how-to/guides.md +0 -1027
- package/docs/migration/changelog.md +0 -54
- package/docs/migration/form-builder-2.5.2.md +0 -113
- package/docs/reference/cli.md +0 -112
- package/docs/reference/components.md +0 -572
- package/docs/reference/hooks.md +0 -1500
- package/docs/reference/providers.md +0 -866
- package/docs/reference/tailwind-plugins.md +0 -942
- package/docs/reference/theme.md +0 -85
- package/docs/reference/types.md +0 -1016
- package/docs/reference/utilities.md +0 -704
- package/docs/tutorials/building-first-form.md +0 -846
- package/docs/tutorials/component-composition.md +0 -882
- package/docs/tutorials/getting-started.md +0 -302
- package/docs/tutorials/theming-basics.md +0 -785
|
@@ -1,610 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { cn } from "../utils/cn";
|
|
4
|
-
import { cva, VariantProps } from "class-variance-authority";
|
|
5
|
-
import { useRef } from "react";
|
|
6
|
-
import { Button } from "./Button";
|
|
7
|
-
import { Checkbox } from "./Checkbox";
|
|
8
|
-
import { useResize } from "../hooks/useResize";
|
|
9
|
-
|
|
10
|
-
type TableHeadVariantsProps = VariantProps<typeof tableHeadVariants>;
|
|
11
|
-
|
|
12
|
-
const Table = React.forwardRef<
|
|
13
|
-
HTMLTableElement,
|
|
14
|
-
React.HTMLAttributes<HTMLTableElement> & {
|
|
15
|
-
theme?: "dark" | "light" | "default";
|
|
16
|
-
}
|
|
17
|
-
>(({ className, theme, ...props }, ref) => (
|
|
18
|
-
<table
|
|
19
|
-
data-theme={theme}
|
|
20
|
-
ref={ref}
|
|
21
|
-
// `overflow-hidden` is the default, and it is load-bearing twice over: the table is `w-auto`,
|
|
22
|
-
// so one wider than its container would otherwise push the whole page wide and put a horizontal
|
|
23
|
-
// scrollbar on the layout; and callers that give the table a radius rely on it to clip the
|
|
24
|
-
// square header band out of the rounded corners.
|
|
25
|
-
//
|
|
26
|
-
// The cost is that it makes the table its own scroll container, and `TableHeader`'s `sticky`
|
|
27
|
-
// resolves against the *nearest* scrollport — so inside a clipping table the header pins to a
|
|
28
|
-
// box that never scrolls, i.e. does nothing. That is the right default: a header only benefits
|
|
29
|
-
// from sticking when the table sits in a scroller, and such a caller passes `overflow-visible`
|
|
30
|
-
// (tailwind-merge lets theirs win) to bind it to that scroller instead. Only do that where the
|
|
31
|
-
// scroller is `min-w-0`, or the width problem above comes back — `DataViews`' table view is the
|
|
32
|
-
// worked example.
|
|
33
|
-
//
|
|
34
|
-
// `[border-collapse:separate]` is what lets the header cells keep their borders while stuck.
|
|
35
|
-
className={cn("overflow-visible w-auto [border-collapse:separate] border-spacing-0", className)}
|
|
36
|
-
{...props}
|
|
37
|
-
>
|
|
38
|
-
{props.children}
|
|
39
|
-
</table>
|
|
40
|
-
));
|
|
41
|
-
Table.displayName = "Table";
|
|
42
|
-
|
|
43
|
-
const TableHeader = React.forwardRef<
|
|
44
|
-
HTMLTableSectionElement,
|
|
45
|
-
React.HTMLAttributes<HTMLTableSectionElement>
|
|
46
|
-
>(({ className, ...props }, ref) => (
|
|
47
|
-
<thead
|
|
48
|
-
ref={ref}
|
|
49
|
-
// The header band is one continuous bar, not a per-cell background — a background on each
|
|
50
|
-
// `<th>` would paint over the half of the previous column's resize handle that overhangs
|
|
51
|
-
// the boundary. That is also why `sticky` sits here rather than on the `<th>`s: per-cell
|
|
52
|
-
// sticky would leave this background behind and let rows show through it.
|
|
53
|
-
//
|
|
54
|
-
// `z-20` clears the `z-10` on the resize handle and sort button inside the cells. In a table
|
|
55
|
-
// that never scrolls vertically, `sticky` keeps the element in flow and changes nothing.
|
|
56
|
-
//
|
|
57
|
-
// The band's token is translucent (`#0003`), so once rows do slide under it they read through.
|
|
58
|
-
// Making it opaque is deliberately NOT done here: it would mean naming one surface colour, and
|
|
59
|
-
// this header paints over whatever its caller sits on — forcing a surface would visibly recolour
|
|
60
|
-
// every table not on that one. A caller whose table actually scrolls supplies the opaque
|
|
61
|
-
// background itself, where the surface is known; `DataViews`' table view is the worked example.
|
|
62
|
-
className={cn(
|
|
63
|
-
"bg-background-presentation-form-header backdrop-blur-[8px]",
|
|
64
|
-
"sticky top-0 z-20",
|
|
65
|
-
"shadow-[0px_4px_8px_0px_rgba(0,0,0,0.15)]",
|
|
66
|
-
className,
|
|
67
|
-
)}
|
|
68
|
-
{...props}
|
|
69
|
-
/>
|
|
70
|
-
));
|
|
71
|
-
TableHeader.displayName = "TableHeader";
|
|
72
|
-
|
|
73
|
-
const TableBody = React.forwardRef<
|
|
74
|
-
HTMLTableSectionElement,
|
|
75
|
-
React.HTMLAttributes<HTMLTableSectionElement>
|
|
76
|
-
>(({ className, ...props }, ref) => (
|
|
77
|
-
<tbody ref={ref} className={className} {...props}>
|
|
78
|
-
{props.children}
|
|
79
|
-
</tbody>
|
|
80
|
-
));
|
|
81
|
-
TableBody.displayName = "TableBody";
|
|
82
|
-
|
|
83
|
-
const TableFooter = React.forwardRef<
|
|
84
|
-
HTMLTableSectionElement,
|
|
85
|
-
React.HTMLAttributes<HTMLTableSectionElement>
|
|
86
|
-
>(({ className, ...props }, ref) => <tfoot ref={ref} className={cn(className)} {...props} />);
|
|
87
|
-
TableFooter.displayName = "TableFooter";
|
|
88
|
-
|
|
89
|
-
const TableRow = React.forwardRef<
|
|
90
|
-
HTMLTableRowElement,
|
|
91
|
-
React.HTMLAttributes<HTMLTableRowElement> & {
|
|
92
|
-
state?: "delete" | "update" | "add" | "selected" | "open";
|
|
93
|
-
}
|
|
94
|
-
>(({ className, state = "", ...props }, ref) => (
|
|
95
|
-
<tr
|
|
96
|
-
ref={ref}
|
|
97
|
-
className={cn(
|
|
98
|
-
[
|
|
99
|
-
"[&_button]:hover:opacity-100 hover:bg-background-presentation-table-row-hover transition-colors",
|
|
100
|
-
{
|
|
101
|
-
"bg-background-presentation-table-row-negative border-border-presentation-badge-red":
|
|
102
|
-
state === "delete",
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
"bg-background-presentation-table-row-information border-border-presentation-badge-navy":
|
|
106
|
-
state === "update",
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
"bg-background-presentation-table-row-success border-border-presentation-badge-green":
|
|
110
|
-
state === "add",
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
"bg-background-presentation-table-row-selected border-t border-[2px] border-border-presentation-table-selected":
|
|
114
|
-
state === "selected",
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
"bg-background-presentation-table-row-hover border-t border-[2px] border-border-presentation-table-dropdown":
|
|
118
|
-
state === "open",
|
|
119
|
-
},
|
|
120
|
-
],
|
|
121
|
-
className,
|
|
122
|
-
)}
|
|
123
|
-
{...props}
|
|
124
|
-
>
|
|
125
|
-
{props.children}
|
|
126
|
-
</tr>
|
|
127
|
-
));
|
|
128
|
-
TableRow.displayName = "TableRow";
|
|
129
|
-
|
|
130
|
-
/** Floor for a drag-resized column, so dragging past the column's own left edge can't invert it. */
|
|
131
|
-
const MIN_COLUMN_WIDTH = 40;
|
|
132
|
-
|
|
133
|
-
const TableHead = React.forwardRef<
|
|
134
|
-
HTMLTableCellElement,
|
|
135
|
-
React.ThHTMLAttributes<HTMLTableCellElement> &
|
|
136
|
-
TableHeadVariantsProps &
|
|
137
|
-
React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
138
|
-
sortType?: "asc" | "desc" | undefined;
|
|
139
|
-
onSort?: () => void;
|
|
140
|
-
/** Column name for the sort button's accessible label. */
|
|
141
|
-
sortLabel?: string;
|
|
142
|
-
/**
|
|
143
|
-
* Called with the new width (px) while the column is being drag-resized. Pass it to take
|
|
144
|
-
* **control** of the width — the header then renders `style.width` and expects you to
|
|
145
|
-
* feed the new value back. Required whenever the table needs a definite width
|
|
146
|
-
* (`table-layout: fixed`), because only the owner of every column width can total them.
|
|
147
|
-
* Omit for uncontrolled resizing, where the header keeps the width itself.
|
|
148
|
-
*/
|
|
149
|
-
onResize?: (width: number) => void;
|
|
150
|
-
/**
|
|
151
|
-
* Classes for the inner layout box (the flex row holding the label and sort toggle).
|
|
152
|
-
* `className` and every other prop go to the `<th>` — reach for this only when you need
|
|
153
|
-
* to restyle the content box itself, e.g. its typography or colour.
|
|
154
|
-
*/
|
|
155
|
-
contentClassName?: string;
|
|
156
|
-
isDummy?: boolean;
|
|
157
|
-
}
|
|
158
|
-
>(
|
|
159
|
-
(
|
|
160
|
-
{
|
|
161
|
-
className,
|
|
162
|
-
contentClassName,
|
|
163
|
-
children,
|
|
164
|
-
style,
|
|
165
|
-
size = "M",
|
|
166
|
-
disabled,
|
|
167
|
-
sortType,
|
|
168
|
-
onSort,
|
|
169
|
-
sortLabel,
|
|
170
|
-
onResize,
|
|
171
|
-
isDummy,
|
|
172
|
-
...props
|
|
173
|
-
},
|
|
174
|
-
forwardedRef,
|
|
175
|
-
) => {
|
|
176
|
-
const headRef = useRef<HTMLTableCellElement>(null);
|
|
177
|
-
const { width, handleStartResize } = useResize(headRef as React.RefObject<HTMLElement>);
|
|
178
|
-
|
|
179
|
-
const clampedWidth = width === undefined ? undefined : Math.max(width, MIN_COLUMN_WIDTH);
|
|
180
|
-
|
|
181
|
-
React.useEffect(() => {
|
|
182
|
-
if (clampedWidth !== undefined) onResize?.(clampedWidth);
|
|
183
|
-
// `onResize` is intentionally not a dep — callers pass an inline closure, and re-firing
|
|
184
|
-
// on every render would loop.
|
|
185
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
186
|
-
}, [clampedWidth]);
|
|
187
|
-
|
|
188
|
-
// Combine refs using useEffect
|
|
189
|
-
React.useEffect(() => {
|
|
190
|
-
if (!forwardedRef) return;
|
|
191
|
-
if (typeof forwardedRef === "function") forwardedRef(headRef.current);
|
|
192
|
-
else forwardedRef.current = headRef.current;
|
|
193
|
-
}, [forwardedRef]);
|
|
194
|
-
|
|
195
|
-
// The width has to land on the `<th>` — that is the element the browser sizes the column
|
|
196
|
-
// from. Written to an inner div (as it once was) it did nothing at all. When `onResize` is
|
|
197
|
-
// given the caller owns the value and feeds it back via `style.width`; otherwise the drag
|
|
198
|
-
// result is applied here directly.
|
|
199
|
-
const resolvedWidth = onResize ? style?.width : (clampedWidth ?? style?.width);
|
|
200
|
-
|
|
201
|
-
return (
|
|
202
|
-
<th
|
|
203
|
-
ref={headRef}
|
|
204
|
-
// EVERY caller prop lands here: `className`, `style`, `aria-*` and event handlers
|
|
205
|
-
// alike. They have to share one element — dnd-kit's `useSortable` returns `attributes`
|
|
206
|
-
// (role/tabIndex/aria-*) and `listeners` (onKeyDown/onPointerDown) as a matched pair,
|
|
207
|
-
// and splitting them across the <th> and the inner div left the focusable node with no
|
|
208
|
-
// key handler. Use `contentClassName` to reach the inner box.
|
|
209
|
-
{...props}
|
|
210
|
-
style={{ ...style, width: resolvedWidth }}
|
|
211
|
-
className={cn(
|
|
212
|
-
"relative h-[44px] py-[6px] px-[4px] border-b-[2px] border-border-presentation-table-header",
|
|
213
|
-
className,
|
|
214
|
-
)}
|
|
215
|
-
>
|
|
216
|
-
<div
|
|
217
|
-
className={cn(
|
|
218
|
-
tableHeadVariants({ size, disabled, isDummy }),
|
|
219
|
-
{
|
|
220
|
-
// Only when nothing has sized the column — otherwise this floor would overflow a
|
|
221
|
-
// column narrower than 100px.
|
|
222
|
-
"min-w-[100px]": !isDummy && resolvedWidth === undefined,
|
|
223
|
-
},
|
|
224
|
-
contentClassName,
|
|
225
|
-
)}
|
|
226
|
-
>
|
|
227
|
-
<div
|
|
228
|
-
className={cn("flex min-w-0 items-center justify-between flex-1", {
|
|
229
|
-
"justify-center": isDummy,
|
|
230
|
-
})}
|
|
231
|
-
>
|
|
232
|
-
{children}
|
|
233
|
-
{isDummy || !onSort ? null : (
|
|
234
|
-
<SortButton onSort={onSort} sortType={sortType} label={sortLabel} />
|
|
235
|
-
)}
|
|
236
|
-
</div>
|
|
237
|
-
</div>
|
|
238
|
-
{/* The grab target, straddling the column boundary. `z-10` keeps it above the next
|
|
239
|
-
column's content — it deliberately overhangs by half its width. The drag handlers
|
|
240
|
-
live here, not on the icon: the icon is `opacity-0` until hover, which made the
|
|
241
|
-
8px-wide SVG a near-impossible thing to grab. */}
|
|
242
|
-
<button
|
|
243
|
-
type="button"
|
|
244
|
-
disabled={isDummy}
|
|
245
|
-
aria-label="Resize column"
|
|
246
|
-
// Lets consumers exclude the grip from blanket `[&_button]` rules on a header row.
|
|
247
|
-
data-slot="resize-handle"
|
|
248
|
-
onMouseDown={handleStartResize}
|
|
249
|
-
onTouchStart={handleStartResize}
|
|
250
|
-
className={cn(
|
|
251
|
-
"group/resize absolute top-[50%] translate-y-[-50%] z-10",
|
|
252
|
-
"right-[-4px] rtl:left-[-4px] rtl:right-[unset]",
|
|
253
|
-
// `absolute` already makes this the containing block for the grip icon.
|
|
254
|
-
"flex h-[24px] w-[8px] items-center justify-center cursor-col-resize",
|
|
255
|
-
"disabled:cursor-default",
|
|
256
|
-
)}
|
|
257
|
-
>
|
|
258
|
-
<span className="h-[20px] w-[2px] rounded-full bg-border-presentation-action-primary" />
|
|
259
|
-
<ResizeIcon
|
|
260
|
-
className={cn("group-hover/resize:opacity-100", { "!opacity-0": isDummy })}
|
|
261
|
-
/>
|
|
262
|
-
</button>
|
|
263
|
-
</th>
|
|
264
|
-
);
|
|
265
|
-
},
|
|
266
|
-
);
|
|
267
|
-
TableHead.displayName = "TableHead";
|
|
268
|
-
|
|
269
|
-
const TableCell = React.forwardRef<
|
|
270
|
-
HTMLTableCellElement,
|
|
271
|
-
React.TdHTMLAttributes<HTMLTableCellElement> & {
|
|
272
|
-
isDummy?: boolean;
|
|
273
|
-
childrenClassName?: string;
|
|
274
|
-
className?: string;
|
|
275
|
-
/**
|
|
276
|
-
* Minimum width of the cell's content box, in px. Defaults to 200 — pass `0` when the
|
|
277
|
-
* column width is driven by the caller (e.g. `FormBuilder.Table`'s `column.width`),
|
|
278
|
-
* otherwise this floor silently overrides any narrower column.
|
|
279
|
-
*/
|
|
280
|
-
minWidth?: number;
|
|
281
|
-
/**
|
|
282
|
-
* Fade the last 25% of the cell's content, to signal text clipped by the column width.
|
|
283
|
-
* Defaults to `true`. Set `false` for cells holding a **control** rather than text — the
|
|
284
|
-
* fade washes out whatever sits at the right edge (a Select's chevron, a date button).
|
|
285
|
-
* The built-in `:has(input)` escape hatch can't catch those, since a Radix trigger is a
|
|
286
|
-
* `<button>`, not an `<input>`.
|
|
287
|
-
*/
|
|
288
|
-
fade?: boolean;
|
|
289
|
-
}
|
|
290
|
-
>(({ className, childrenClassName, isDummy, minWidth = 200, fade = true, ...props }, ref) => (
|
|
291
|
-
<td
|
|
292
|
-
ref={ref}
|
|
293
|
-
className={cn(
|
|
294
|
-
[
|
|
295
|
-
"h-[50px] text-content-presentation-action-light-primary",
|
|
296
|
-
"typography-body-small-regular relative",
|
|
297
|
-
"border-r border-b border-border-presentation-table-header px-[8px] rtl:border-l rtl:border-r-0",
|
|
298
|
-
"break-all",
|
|
299
|
-
],
|
|
300
|
-
className,
|
|
301
|
-
)}
|
|
302
|
-
{...props}
|
|
303
|
-
>
|
|
304
|
-
<div
|
|
305
|
-
style={isDummy ? undefined : { minWidth }}
|
|
306
|
-
className={cn(
|
|
307
|
-
"flex justify-start items-center gap-1",
|
|
308
|
-
// This div hugs the control exactly — same height, and the control is `w-full` — so
|
|
309
|
-
// `overflow-hidden` clips every side of a drop shadow drawn on it. Text cells still
|
|
310
|
-
// need the crop to feed the fade gradient; control cells need the shadow to escape.
|
|
311
|
-
fade ? "overflow-hidden" : "overflow-visible",
|
|
312
|
-
// Never fade a dummy cell — its content is a centred checkbox or drag handle, not
|
|
313
|
-
// clippable text.
|
|
314
|
-
fade &&
|
|
315
|
-
!isDummy && [
|
|
316
|
-
"[mask-image:linear-gradient(to_right,black_0%,black_0%,black_75%,transparent_100%)]",
|
|
317
|
-
"rtl:[mask-image:linear-gradient(to_left,black_0%,black_0%,black_75%,transparent_100%)]",
|
|
318
|
-
"[&:has(input)]:[mask-image:none]",
|
|
319
|
-
],
|
|
320
|
-
{ "min-w-fit justify-center": isDummy },
|
|
321
|
-
childrenClassName,
|
|
322
|
-
)}
|
|
323
|
-
>
|
|
324
|
-
{props.children}
|
|
325
|
-
</div>
|
|
326
|
-
</td>
|
|
327
|
-
));
|
|
328
|
-
TableCell.displayName = "TableCell";
|
|
329
|
-
|
|
330
|
-
const TableCheckbox = React.forwardRef<
|
|
331
|
-
HTMLButtonElement,
|
|
332
|
-
React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
333
|
-
id: string;
|
|
334
|
-
}
|
|
335
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- id destructured to exclude it from the props spread onto Checkbox
|
|
336
|
-
>(({ className, id, ...props }, ref) => {
|
|
337
|
-
return (
|
|
338
|
-
<div className={cn(["flex items-center justify-center"], className)}>
|
|
339
|
-
<Checkbox {...props} ref={ref} size="S" />
|
|
340
|
-
</div>
|
|
341
|
-
);
|
|
342
|
-
});
|
|
343
|
-
TableCheckbox.displayName = "TableCheckbox";
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* The full-width action bar that sits **below** a table — e.g. "+ Add New".
|
|
347
|
-
*
|
|
348
|
-
* Deliberately not a `<tr>`: it renders as a sibling of the table's horizontal scroll
|
|
349
|
-
* container, so it stays put while the columns scroll sideways under it. Use
|
|
350
|
-
* `TableFooterButton` instead when the action must scroll with the grid.
|
|
351
|
-
*/
|
|
352
|
-
const TableEndAction = React.forwardRef<
|
|
353
|
-
HTMLButtonElement,
|
|
354
|
-
React.ButtonHTMLAttributes<HTMLButtonElement>
|
|
355
|
-
>(({ className, children, ...props }, ref) => (
|
|
356
|
-
<button
|
|
357
|
-
ref={ref}
|
|
358
|
-
type="button"
|
|
359
|
-
className={cn(
|
|
360
|
-
"flex h-[40px] w-full items-center justify-start gap-[8px] px-[8px]",
|
|
361
|
-
// No border. Figma's Table-End-Action-1.0 has none — it rounds its own bottom corners
|
|
362
|
-
// so it can sit flush on the card edge. A rule here is invisible against the card until
|
|
363
|
-
// the hover fill lands behind it, at which point it reads as a hard line cutting across
|
|
364
|
-
// the bar.
|
|
365
|
-
"rounded-bl-[16px] rounded-br-[16px]",
|
|
366
|
-
"typography-body-medium-semibold text-content-presentation-action-light-primary",
|
|
367
|
-
// NB: the "acton" spelling is the token that actually exists; the correctly-spelled
|
|
368
|
-
// `…table-action-hover` is defined nowhere and would be a dead class.
|
|
369
|
-
"transition-[background-color,box-shadow] hover:bg-background-presentation-table-acton-hover",
|
|
370
|
-
// Hover draws a ring rather than a border: it renders inset, so it costs no layout and
|
|
371
|
-
// can't push the bar's 40px box around the way a border would.
|
|
372
|
-
"hover:ring-2 hover:ring-inset hover:ring-border-presentation-table-action-hover",
|
|
373
|
-
"outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-border-presentation-state-focus",
|
|
374
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
375
|
-
"[&_i]:text-[20px]",
|
|
376
|
-
className,
|
|
377
|
-
)}
|
|
378
|
-
{...props}
|
|
379
|
-
>
|
|
380
|
-
{children}
|
|
381
|
-
</button>
|
|
382
|
-
));
|
|
383
|
-
TableEndAction.displayName = "TableEndAction";
|
|
384
|
-
|
|
385
|
-
/**
|
|
386
|
-
* Horizontal scroll container for a table — the 14px scroller row from the design,
|
|
387
|
-
* with the thin track that thickens and turns blue on hover.
|
|
388
|
-
*/
|
|
389
|
-
const TableScroller = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
390
|
-
({ className, children, ...props }, ref) => (
|
|
391
|
-
<div
|
|
392
|
-
ref={ref}
|
|
393
|
-
className={cn(
|
|
394
|
-
"w-full overflow-x-auto overflow-y-hidden",
|
|
395
|
-
"[&::-webkit-scrollbar]:h-[14px]",
|
|
396
|
-
"[&::-webkit-scrollbar-track]:bg-transparent",
|
|
397
|
-
"[&::-webkit-scrollbar-thumb]:rounded-[7px]",
|
|
398
|
-
"[&::-webkit-scrollbar-thumb]:border-[5px] [&::-webkit-scrollbar-thumb]:border-solid",
|
|
399
|
-
"[&::-webkit-scrollbar-thumb]:border-transparent",
|
|
400
|
-
"[&::-webkit-scrollbar-thumb]:bg-clip-content",
|
|
401
|
-
"[&::-webkit-scrollbar-thumb]:bg-background-presentation-body-scroller-default",
|
|
402
|
-
"[&::-webkit-scrollbar-thumb:hover]:border-[3px]",
|
|
403
|
-
"[&::-webkit-scrollbar-thumb:hover]:bg-background-presentation-body-scroller-hover",
|
|
404
|
-
className,
|
|
405
|
-
)}
|
|
406
|
-
{...props}
|
|
407
|
-
>
|
|
408
|
-
{children}
|
|
409
|
-
</div>
|
|
410
|
-
),
|
|
411
|
-
);
|
|
412
|
-
TableScroller.displayName = "TableScroller";
|
|
413
|
-
|
|
414
|
-
const TableCaption = React.forwardRef<
|
|
415
|
-
HTMLTableCaptionElement,
|
|
416
|
-
React.HTMLAttributes<HTMLTableCaptionElement>
|
|
417
|
-
>(({ className, ...props }, ref) => (
|
|
418
|
-
<caption ref={ref} className={cn("mt-4 text-sm text-muted-foreground", className)} {...props} />
|
|
419
|
-
));
|
|
420
|
-
TableCaption.displayName = "TableCaption";
|
|
421
|
-
|
|
422
|
-
const TableFooterButton = React.forwardRef<
|
|
423
|
-
HTMLButtonElement,
|
|
424
|
-
React.PropsWithChildren<{
|
|
425
|
-
className?: string;
|
|
426
|
-
}>
|
|
427
|
-
>(({ children, className, ...props }, ref) => {
|
|
428
|
-
return (
|
|
429
|
-
<TableRow className={cn("h-[40px] overflow-hidden", className)}>
|
|
430
|
-
<TableCell
|
|
431
|
-
className={
|
|
432
|
-
// `h-[40px]` because the row asks for 40 and body cells default to 50 — the two sit
|
|
433
|
-
// on different elements, so CSS would otherwise take the larger and grow the footer.
|
|
434
|
-
"h-[40px] border-t-2 border-b-2 border-transparent hover:border-border-presentation-table-action-hover hover:bg-background-presentation-table-acton-hover"
|
|
435
|
-
}
|
|
436
|
-
colSpan={100}
|
|
437
|
-
>
|
|
438
|
-
<button
|
|
439
|
-
ref={ref}
|
|
440
|
-
{...props}
|
|
441
|
-
className={cn(
|
|
442
|
-
"overflow-hidden w-full flex items-center justify-start gap-2 typography-body-medium-semibold [&_i]:text-[20px]",
|
|
443
|
-
className,
|
|
444
|
-
)}
|
|
445
|
-
>
|
|
446
|
-
{children}
|
|
447
|
-
</button>
|
|
448
|
-
</TableCell>
|
|
449
|
-
</TableRow>
|
|
450
|
-
);
|
|
451
|
-
});
|
|
452
|
-
TableFooterButton.displayName = "TableFooterButton";
|
|
453
|
-
|
|
454
|
-
const SubTableButton = ({
|
|
455
|
-
isActive,
|
|
456
|
-
className,
|
|
457
|
-
dummy,
|
|
458
|
-
}: {
|
|
459
|
-
isActive?: boolean;
|
|
460
|
-
className?: string;
|
|
461
|
-
dummy?: boolean;
|
|
462
|
-
}) => {
|
|
463
|
-
return (
|
|
464
|
-
<Button
|
|
465
|
-
className={cn(
|
|
466
|
-
"transition-opacity duration-200 opacity-0 border-none bg-transparent focus:bg-background-presentation-state-information-primary active:bg-background-presentation-state-information-primary",
|
|
467
|
-
{
|
|
468
|
-
"hover:bg-transparent hover:text-black focus:bg-transparent focus:text-black active:bg-transparent active:text-black":
|
|
469
|
-
dummy,
|
|
470
|
-
},
|
|
471
|
-
className,
|
|
472
|
-
)}
|
|
473
|
-
variant={"PrimeStyle"}
|
|
474
|
-
buttonType={"icon"}
|
|
475
|
-
>
|
|
476
|
-
<i
|
|
477
|
-
className={cn(
|
|
478
|
-
"ri-arrow-right-s-line",
|
|
479
|
-
"rtl:rotate-180",
|
|
480
|
-
"transition-transform duration-200",
|
|
481
|
-
{ "rotate-90": isActive },
|
|
482
|
-
)}
|
|
483
|
-
></i>
|
|
484
|
-
</Button>
|
|
485
|
-
);
|
|
486
|
-
};
|
|
487
|
-
|
|
488
|
-
export {
|
|
489
|
-
Table,
|
|
490
|
-
TableHeader,
|
|
491
|
-
TableBody,
|
|
492
|
-
TableFooter,
|
|
493
|
-
TableHead,
|
|
494
|
-
TableRow,
|
|
495
|
-
TableCell,
|
|
496
|
-
TableCaption,
|
|
497
|
-
TableCheckbox,
|
|
498
|
-
SubTableButton,
|
|
499
|
-
TableFooterButton,
|
|
500
|
-
TableEndAction,
|
|
501
|
-
TableScroller,
|
|
502
|
-
};
|
|
503
|
-
|
|
504
|
-
interface ResizeIconProps {
|
|
505
|
-
className?: string;
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
/**
|
|
509
|
-
* The grip that appears on hover. Sized to its parent button (8px wide), so it can't spill
|
|
510
|
-
* past the grab target; the button is what deliberately straddles the column boundary.
|
|
511
|
-
*/
|
|
512
|
-
const ResizeIcon = ({ className }: ResizeIconProps) => {
|
|
513
|
-
return (
|
|
514
|
-
<svg
|
|
515
|
-
className={cn(
|
|
516
|
-
"pointer-events-none absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",
|
|
517
|
-
"opacity-0 transition-opacity duration-200",
|
|
518
|
-
className,
|
|
519
|
-
)}
|
|
520
|
-
width="8"
|
|
521
|
-
height="30"
|
|
522
|
-
viewBox="0 1 8 38"
|
|
523
|
-
fill="none"
|
|
524
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
525
|
-
>
|
|
526
|
-
<rect y="5" width="8" height="30" rx="3" fill="#3391FF" />
|
|
527
|
-
<circle cx="2.75" cy="15.5" r="0.75" fill="#F9F9F9" />
|
|
528
|
-
<circle cx="5.25" cy="15.5" r="0.75" fill="#F9F9F9" />
|
|
529
|
-
<circle cx="2.75" cy="18.5" r="0.75" fill="#F9F9F9" />
|
|
530
|
-
<circle cx="5.25" cy="18.5" r="0.75" fill="#F9F9F9" />
|
|
531
|
-
<circle cx="2.75" cy="21.5" r="0.75" fill="#F9F9F9" />
|
|
532
|
-
<circle cx="5.25" cy="21.5" r="0.75" fill="#F9F9F9" />
|
|
533
|
-
<circle cx="2.75" cy="24.5" r="0.75" fill="#F9F9F9" />
|
|
534
|
-
<circle cx="5.25" cy="24.5" r="0.75" fill="#F9F9F9" />
|
|
535
|
-
</svg>
|
|
536
|
-
);
|
|
537
|
-
};
|
|
538
|
-
|
|
539
|
-
const SortButton = ({
|
|
540
|
-
onSort,
|
|
541
|
-
sortType,
|
|
542
|
-
label,
|
|
543
|
-
}: {
|
|
544
|
-
onSort?: () => void;
|
|
545
|
-
sortType?: "asc" | "desc" | undefined;
|
|
546
|
-
/** What this button sorts — without it the control is an unnamed icon. */
|
|
547
|
-
label?: string;
|
|
548
|
-
}) => {
|
|
549
|
-
const next = sortType === "asc" ? "descending" : "ascending";
|
|
550
|
-
return (
|
|
551
|
-
// `type="button"` matters: this table renders inside a <form> (FormBuilder.Table),
|
|
552
|
-
// where an untyped button defaults to submit.
|
|
553
|
-
<button
|
|
554
|
-
type="button"
|
|
555
|
-
// `onClick`, not `onPointerDown`: a button activated from the keyboard fires
|
|
556
|
-
// `click` only, so pointer-down made this mouse-only.
|
|
557
|
-
onClick={onSort}
|
|
558
|
-
aria-label={label ? `Sort by ${label} ${next}` : `Sort ${next}`}
|
|
559
|
-
className={cn("cursor-pointer text-[16px] z-10")}
|
|
560
|
-
>
|
|
561
|
-
{sortType === "asc" ? (
|
|
562
|
-
<i className="ri-arrow-up-line text-border-presentation-state-focus" />
|
|
563
|
-
) : sortType === "desc" ? (
|
|
564
|
-
<i className="ri-arrow-down-line text-border-presentation-state-focus" />
|
|
565
|
-
) : (
|
|
566
|
-
<i className="ri-arrow-up-down-line text-content-presentation-global-secondary" />
|
|
567
|
-
)}
|
|
568
|
-
</button>
|
|
569
|
-
);
|
|
570
|
-
};
|
|
571
|
-
|
|
572
|
-
const tableHeadVariants = cva(
|
|
573
|
-
[
|
|
574
|
-
"text-content-presentation-global-primary",
|
|
575
|
-
"px-[8px]",
|
|
576
|
-
"w-full",
|
|
577
|
-
"flex",
|
|
578
|
-
"items-center",
|
|
579
|
-
"justify-center",
|
|
580
|
-
"text-start",
|
|
581
|
-
"bg-transparent",
|
|
582
|
-
"hover:bg-background-presentation-action-hover",
|
|
583
|
-
"hover:text-content-presentation-global-hover",
|
|
584
|
-
"transition-[background-color,color]",
|
|
585
|
-
"duration-200",
|
|
586
|
-
"rounded-[3px]",
|
|
587
|
-
],
|
|
588
|
-
{
|
|
589
|
-
variants: {
|
|
590
|
-
size: {
|
|
591
|
-
S: "h-[20px] min-w-[20px] typography-body-small-semibold",
|
|
592
|
-
M: "h-[32px] min-w-[32px] typography-body-medium-semibold",
|
|
593
|
-
},
|
|
594
|
-
disabled: {
|
|
595
|
-
true: [
|
|
596
|
-
"bg-background-presentation-table-row-disabled",
|
|
597
|
-
"cursor-not-allowed",
|
|
598
|
-
"hover:bg-background-presentation-table-row-disabled",
|
|
599
|
-
"hover:text-content-presentation-global-primary",
|
|
600
|
-
],
|
|
601
|
-
},
|
|
602
|
-
isDummy: {
|
|
603
|
-
true: ["hover:bg-transparent", "hover:text-content-presentation-global-primary"],
|
|
604
|
-
},
|
|
605
|
-
},
|
|
606
|
-
defaultVariants: {
|
|
607
|
-
size: "M",
|
|
608
|
-
},
|
|
609
|
-
},
|
|
610
|
-
);
|