@actabldesign/bellhop-react 0.0.5 → 0.0.6
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/components/table/DataTable.d.ts +1 -1
- package/dist/components/table/DataTable.js +1 -1
- package/dist/components/table/index.d.ts +1 -1
- package/dist/components/table/index.js +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/llms.txt +3551 -0
- package/package.json +3 -2
package/llms.txt
ADDED
|
@@ -0,0 +1,3551 @@
|
|
|
1
|
+
This file is a merged representation of a subset of the codebase, containing specifically included files and files not matching ignore patterns, combined into a single document by Repomix.
|
|
2
|
+
The content has been processed where security check has been disabled.
|
|
3
|
+
|
|
4
|
+
================================================================
|
|
5
|
+
File Summary
|
|
6
|
+
================================================================
|
|
7
|
+
|
|
8
|
+
Purpose:
|
|
9
|
+
--------
|
|
10
|
+
This file contains a packed representation of a subset of the repository's contents that is considered the most important context.
|
|
11
|
+
It is designed to be easily consumable by AI systems for analysis, code review,
|
|
12
|
+
or other automated processes.
|
|
13
|
+
|
|
14
|
+
File Format:
|
|
15
|
+
------------
|
|
16
|
+
The content is organized as follows:
|
|
17
|
+
1. This summary section
|
|
18
|
+
2. Repository information
|
|
19
|
+
3. Directory structure
|
|
20
|
+
4. Repository files (if enabled)
|
|
21
|
+
5. Multiple file entries, each consisting of:
|
|
22
|
+
a. A separator line (================)
|
|
23
|
+
b. The file path (File: path/to/file)
|
|
24
|
+
c. Another separator line
|
|
25
|
+
d. The full contents of the file
|
|
26
|
+
e. A blank line
|
|
27
|
+
|
|
28
|
+
Usage Guidelines:
|
|
29
|
+
-----------------
|
|
30
|
+
- This file should be treated as read-only. Any changes should be made to the
|
|
31
|
+
original repository files, not this packed version.
|
|
32
|
+
- When processing this file, use the file path to distinguish
|
|
33
|
+
between different files in the repository.
|
|
34
|
+
- Be aware that this file may contain sensitive information. Handle it with
|
|
35
|
+
the same level of security as you would the original repository.
|
|
36
|
+
|
|
37
|
+
Notes:
|
|
38
|
+
------
|
|
39
|
+
- Some files may have been excluded based on .gitignore rules and Repomix's configuration
|
|
40
|
+
- Binary files are not included in this packed representation. Please refer to the Repository Structure section for a complete list of file paths, including binary files
|
|
41
|
+
- Only files matching these patterns are included: **/*.ts, **/*.tsx, **/*.js, **/*.jsx, **/*.css, **/*.scss, **/*.json, **/*.md
|
|
42
|
+
- Files matching these patterns are excluded: **/node_modules/**, **/dist/**, **/build/**, **/coverage/**, **/.angular/**, **/.nx/**, **/storybook-static/**, **/*.lock, **/*.log, **/*.svg, **/*.png, **/*.jpg, **/*.jpeg, **/*.gif, **/*.ico, **/*.webp, **/*.woff, **/*.woff2, **/*.ttf, **/*.eot, **/*.otf, **/*.min.js, **/*.min.css, **/*.map, **/package-lock.json, **/yarn.lock, **/pnpm-lock.yaml, **/.DS_Store, **/Thumbs.db, **/llms.txt, **/llms/**
|
|
43
|
+
- Files matching patterns in .gitignore are excluded
|
|
44
|
+
- Files matching default ignore patterns are excluded
|
|
45
|
+
- Security check has been disabled - content may contain sensitive information
|
|
46
|
+
- Files are sorted by Git change count (files with more changes are at the bottom)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
================================================================
|
|
50
|
+
Directory Structure
|
|
51
|
+
================================================================
|
|
52
|
+
src/
|
|
53
|
+
components/
|
|
54
|
+
stencil-generated/
|
|
55
|
+
components.ts
|
|
56
|
+
index.ts
|
|
57
|
+
table/
|
|
58
|
+
DataTable.tsx
|
|
59
|
+
index.tsx
|
|
60
|
+
index.ts
|
|
61
|
+
package.json
|
|
62
|
+
project.json
|
|
63
|
+
README.md
|
|
64
|
+
tsconfig.json
|
|
65
|
+
|
|
66
|
+
================================================================
|
|
67
|
+
Files
|
|
68
|
+
================================================================
|
|
69
|
+
|
|
70
|
+
================
|
|
71
|
+
File: src/components/stencil-generated/components.ts
|
|
72
|
+
================
|
|
73
|
+
'use client';
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* This file was automatically generated by the Stencil React Output Target.
|
|
77
|
+
* Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
/* eslint-disable */
|
|
81
|
+
|
|
82
|
+
import { type AutocompleteMenuItem, type BhAppbarCustomEvent, type BhAutocompleteMenuCustomEvent, type BhAvatarAddCustomEvent, type BhBreadcrumbsCustomEvent, type BhButtonCustomEvent, type BhButtonIconCustomEvent, type BhDataGridCustomEvent, type BhDatePickerContentCustomEvent, type BhDatePickerCustomEvent, type BhDateRangePickerContentCustomEvent, type BhDateRangePickerCustomEvent, type BhDropdownCustomEvent, type BhDropdownMenuCustomEvent, type BhInputAutocompleteCustomEvent, type BhLogoBoxCustomEvent, type BhMonthPickerContentCustomEvent, type BhMonthPickerCustomEvent, type BhPaginationCustomEvent, type BhPickerMenuCustomEvent, type BhPopoverCustomEvent, type BhProduct, type BhProductSwitcherCustomEvent, type BhPropertySwitcherCustomEvent, type BhSidebarCustomEvent, type BreadcrumbItem, type DataGridCellChangeEvent, type DataGridCellClickEvent, type DataGridEditCancelEvent, type DataGridEditSaveEvent, type DataGridEditStartEvent, type DataGridExpandChangeEvent, type DataGridFilterChangeEvent, type DataGridGroupToggleEvent, type DataGridPageChangeEvent, type DataGridRowClickEvent, type DataGridSelectionChangeEvent, type DataGridSortChangeEvent, type DataGridValidationErrorEvent, type DropdownMenuItem, type MonthYear, type PaginationChangeEvent, type PopoverItem, type PropertyOption, type SelectedDate, type SelectedDateRange } from "@actabldesign/bellhop-core";
|
|
83
|
+
import { BhAccordionItem as BhAccordionItemElement, defineCustomElement as defineBhAccordionItem } from "@actabldesign/bellhop-core/dist/components/bh-accordion-item.js";
|
|
84
|
+
import { BhAccordion as BhAccordionElement, defineCustomElement as defineBhAccordion } from "@actabldesign/bellhop-core/dist/components/bh-accordion.js";
|
|
85
|
+
import { BhAppbar as BhAppbarElement, defineCustomElement as defineBhAppbar } from "@actabldesign/bellhop-core/dist/components/bh-appbar.js";
|
|
86
|
+
import { BhAutocompleteMenu as BhAutocompleteMenuElement, defineCustomElement as defineBhAutocompleteMenu } from "@actabldesign/bellhop-core/dist/components/bh-autocomplete-menu.js";
|
|
87
|
+
import { BhAvatarAdd as BhAvatarAddElement, defineCustomElement as defineBhAvatarAdd } from "@actabldesign/bellhop-core/dist/components/bh-avatar-add.js";
|
|
88
|
+
import { BhAvatarStacked as BhAvatarStackedElement, defineCustomElement as defineBhAvatarStacked } from "@actabldesign/bellhop-core/dist/components/bh-avatar-stacked.js";
|
|
89
|
+
import { BhAvatar as BhAvatarElement, defineCustomElement as defineBhAvatar } from "@actabldesign/bellhop-core/dist/components/bh-avatar.js";
|
|
90
|
+
import { BhBadgeDot as BhBadgeDotElement, defineCustomElement as defineBhBadgeDot } from "@actabldesign/bellhop-core/dist/components/bh-badge-dot.js";
|
|
91
|
+
import { BhBadge as BhBadgeElement, defineCustomElement as defineBhBadge } from "@actabldesign/bellhop-core/dist/components/bh-badge.js";
|
|
92
|
+
import { BhBarChart as BhBarChartElement, defineCustomElement as defineBhBarChart } from "@actabldesign/bellhop-core/dist/components/bh-bar-chart.js";
|
|
93
|
+
import { BhBreadcrumbs as BhBreadcrumbsElement, defineCustomElement as defineBhBreadcrumbs } from "@actabldesign/bellhop-core/dist/components/bh-breadcrumbs.js";
|
|
94
|
+
import { BhButtonIcon as BhButtonIconElement, defineCustomElement as defineBhButtonIcon } from "@actabldesign/bellhop-core/dist/components/bh-button-icon.js";
|
|
95
|
+
import { BhButton as BhButtonElement, defineCustomElement as defineBhButton } from "@actabldesign/bellhop-core/dist/components/bh-button.js";
|
|
96
|
+
import { BhCardFooter as BhCardFooterElement, defineCustomElement as defineBhCardFooter } from "@actabldesign/bellhop-core/dist/components/bh-card-footer.js";
|
|
97
|
+
import { BhCardHeader as BhCardHeaderElement, defineCustomElement as defineBhCardHeader } from "@actabldesign/bellhop-core/dist/components/bh-card-header.js";
|
|
98
|
+
import { BhCard as BhCardElement, defineCustomElement as defineBhCard } from "@actabldesign/bellhop-core/dist/components/bh-card.js";
|
|
99
|
+
import { BhChartTooltip as BhChartTooltipElement, defineCustomElement as defineBhChartTooltip } from "@actabldesign/bellhop-core/dist/components/bh-chart-tooltip.js";
|
|
100
|
+
import { BhCheckboxGroupItem as BhCheckboxGroupItemElement, defineCustomElement as defineBhCheckboxGroupItem } from "@actabldesign/bellhop-core/dist/components/bh-checkbox-group-item.js";
|
|
101
|
+
import { BhCheckboxGroup as BhCheckboxGroupElement, defineCustomElement as defineBhCheckboxGroup } from "@actabldesign/bellhop-core/dist/components/bh-checkbox-group.js";
|
|
102
|
+
import { BhCheckbox as BhCheckboxElement, defineCustomElement as defineBhCheckbox } from "@actabldesign/bellhop-core/dist/components/bh-checkbox.js";
|
|
103
|
+
import { BhContainerFooter as BhContainerFooterElement, defineCustomElement as defineBhContainerFooter } from "@actabldesign/bellhop-core/dist/components/bh-container-footer.js";
|
|
104
|
+
import { BhContainer as BhContainerElement, defineCustomElement as defineBhContainer } from "@actabldesign/bellhop-core/dist/components/bh-container.js";
|
|
105
|
+
import { BhDataGrid as BhDataGridElement, defineCustomElement as defineBhDataGrid } from "@actabldesign/bellhop-core/dist/components/bh-data-grid.js";
|
|
106
|
+
import { BhDatePickerContent as BhDatePickerContentElement, defineCustomElement as defineBhDatePickerContent } from "@actabldesign/bellhop-core/dist/components/bh-date-picker-content.js";
|
|
107
|
+
import { BhDatePicker as BhDatePickerElement, defineCustomElement as defineBhDatePicker } from "@actabldesign/bellhop-core/dist/components/bh-date-picker.js";
|
|
108
|
+
import { BhDateRangePickerContent as BhDateRangePickerContentElement, defineCustomElement as defineBhDateRangePickerContent } from "@actabldesign/bellhop-core/dist/components/bh-date-range-picker-content.js";
|
|
109
|
+
import { BhDateRangePicker as BhDateRangePickerElement, defineCustomElement as defineBhDateRangePicker } from "@actabldesign/bellhop-core/dist/components/bh-date-range-picker.js";
|
|
110
|
+
import { BhDropdownMenu as BhDropdownMenuElement, defineCustomElement as defineBhDropdownMenu } from "@actabldesign/bellhop-core/dist/components/bh-dropdown-menu.js";
|
|
111
|
+
import { BhDropdown as BhDropdownElement, defineCustomElement as defineBhDropdown } from "@actabldesign/bellhop-core/dist/components/bh-dropdown.js";
|
|
112
|
+
import { BhEmptyState as BhEmptyStateElement, defineCustomElement as defineBhEmptyState } from "@actabldesign/bellhop-core/dist/components/bh-empty-state.js";
|
|
113
|
+
import { BhFeaturedIcon as BhFeaturedIconElement, defineCustomElement as defineBhFeaturedIcon } from "@actabldesign/bellhop-core/dist/components/bh-featured-icon.js";
|
|
114
|
+
import { BhIllustrations as BhIllustrationsElement, defineCustomElement as defineBhIllustrations } from "@actabldesign/bellhop-core/dist/components/bh-illustrations.js";
|
|
115
|
+
import { BhInputAutocomplete as BhInputAutocompleteElement, defineCustomElement as defineBhInputAutocomplete } from "@actabldesign/bellhop-core/dist/components/bh-input-autocomplete.js";
|
|
116
|
+
import { BhInputNumber as BhInputNumberElement, defineCustomElement as defineBhInputNumber } from "@actabldesign/bellhop-core/dist/components/bh-input-number.js";
|
|
117
|
+
import { BhInputPassword as BhInputPasswordElement, defineCustomElement as defineBhInputPassword } from "@actabldesign/bellhop-core/dist/components/bh-input-password.js";
|
|
118
|
+
import { BhInputText as BhInputTextElement, defineCustomElement as defineBhInputText } from "@actabldesign/bellhop-core/dist/components/bh-input-text.js";
|
|
119
|
+
import { BhInputVerification as BhInputVerificationElement, defineCustomElement as defineBhInputVerification } from "@actabldesign/bellhop-core/dist/components/bh-input-verification.js";
|
|
120
|
+
import { BhLabel as BhLabelElement, defineCustomElement as defineBhLabel } from "@actabldesign/bellhop-core/dist/components/bh-label.js";
|
|
121
|
+
import { BhLoaderSpinner as BhLoaderSpinnerElement, defineCustomElement as defineBhLoaderSpinner } from "@actabldesign/bellhop-core/dist/components/bh-loader-spinner.js";
|
|
122
|
+
import { BhLogoBox as BhLogoBoxElement, defineCustomElement as defineBhLogoBox } from "@actabldesign/bellhop-core/dist/components/bh-logo-box.js";
|
|
123
|
+
import { BhModalActions as BhModalActionsElement, defineCustomElement as defineBhModalActions } from "@actabldesign/bellhop-core/dist/components/bh-modal-actions.js";
|
|
124
|
+
import { BhModalHeader as BhModalHeaderElement, defineCustomElement as defineBhModalHeader } from "@actabldesign/bellhop-core/dist/components/bh-modal-header.js";
|
|
125
|
+
import { BhModal as BhModalElement, defineCustomElement as defineBhModal } from "@actabldesign/bellhop-core/dist/components/bh-modal.js";
|
|
126
|
+
import { BhMonthPickerContent as BhMonthPickerContentElement, defineCustomElement as defineBhMonthPickerContent } from "@actabldesign/bellhop-core/dist/components/bh-month-picker-content.js";
|
|
127
|
+
import { BhMonthPicker as BhMonthPickerElement, defineCustomElement as defineBhMonthPicker } from "@actabldesign/bellhop-core/dist/components/bh-month-picker.js";
|
|
128
|
+
import { BhNavItem as BhNavItemElement, defineCustomElement as defineBhNavItem } from "@actabldesign/bellhop-core/dist/components/bh-nav-item.js";
|
|
129
|
+
import { BhNotification as BhNotificationElement, defineCustomElement as defineBhNotification } from "@actabldesign/bellhop-core/dist/components/bh-notification.js";
|
|
130
|
+
import { BhPageNavigationChild as BhPageNavigationChildElement, defineCustomElement as defineBhPageNavigationChild } from "@actabldesign/bellhop-core/dist/components/bh-page-navigation-child.js";
|
|
131
|
+
import { BhPageNavigationMultiLevel as BhPageNavigationMultiLevelElement, defineCustomElement as defineBhPageNavigationMultiLevel } from "@actabldesign/bellhop-core/dist/components/bh-page-navigation-multi-level.js";
|
|
132
|
+
import { BhPageNavigationSingleLevel as BhPageNavigationSingleLevelElement, defineCustomElement as defineBhPageNavigationSingleLevel } from "@actabldesign/bellhop-core/dist/components/bh-page-navigation-single-level.js";
|
|
133
|
+
import { BhPageNavigation as BhPageNavigationElement, defineCustomElement as defineBhPageNavigation } from "@actabldesign/bellhop-core/dist/components/bh-page-navigation.js";
|
|
134
|
+
import { BhPagination as BhPaginationElement, defineCustomElement as defineBhPagination } from "@actabldesign/bellhop-core/dist/components/bh-pagination.js";
|
|
135
|
+
import { BhPickerMenu as BhPickerMenuElement, defineCustomElement as defineBhPickerMenu } from "@actabldesign/bellhop-core/dist/components/bh-picker-menu.js";
|
|
136
|
+
import { BhPieChart as BhPieChartElement, defineCustomElement as defineBhPieChart } from "@actabldesign/bellhop-core/dist/components/bh-pie-chart.js";
|
|
137
|
+
import { BhPopover as BhPopoverElement, defineCustomElement as defineBhPopover } from "@actabldesign/bellhop-core/dist/components/bh-popover.js";
|
|
138
|
+
import { BhProductSwitcher as BhProductSwitcherElement, defineCustomElement as defineBhProductSwitcher } from "@actabldesign/bellhop-core/dist/components/bh-product-switcher.js";
|
|
139
|
+
import { BhPropertySwitcher as BhPropertySwitcherElement, defineCustomElement as defineBhPropertySwitcher } from "@actabldesign/bellhop-core/dist/components/bh-property-switcher.js";
|
|
140
|
+
import { BhRadioButton as BhRadioButtonElement, defineCustomElement as defineBhRadioButton } from "@actabldesign/bellhop-core/dist/components/bh-radio-button.js";
|
|
141
|
+
import { BhSidebar as BhSidebarElement, defineCustomElement as defineBhSidebar } from "@actabldesign/bellhop-core/dist/components/bh-sidebar.js";
|
|
142
|
+
import { BhSkeletonLoader as BhSkeletonLoaderElement, defineCustomElement as defineBhSkeletonLoader } from "@actabldesign/bellhop-core/dist/components/bh-skeleton-loader.js";
|
|
143
|
+
import { BhTabItem as BhTabItemElement, defineCustomElement as defineBhTabItem } from "@actabldesign/bellhop-core/dist/components/bh-tab-item.js";
|
|
144
|
+
import { BhTabs as BhTabsElement, defineCustomElement as defineBhTabs } from "@actabldesign/bellhop-core/dist/components/bh-tabs.js";
|
|
145
|
+
import { BhTag as BhTagElement, defineCustomElement as defineBhTag } from "@actabldesign/bellhop-core/dist/components/bh-tag.js";
|
|
146
|
+
import { BhTextarea as BhTextareaElement, defineCustomElement as defineBhTextarea } from "@actabldesign/bellhop-core/dist/components/bh-textarea.js";
|
|
147
|
+
import { BhToggle as BhToggleElement, defineCustomElement as defineBhToggle } from "@actabldesign/bellhop-core/dist/components/bh-toggle.js";
|
|
148
|
+
import { BhTooltip as BhTooltipElement, defineCustomElement as defineBhTooltip } from "@actabldesign/bellhop-core/dist/components/bh-tooltip.js";
|
|
149
|
+
import { BhTrendChart as BhTrendChartElement, defineCustomElement as defineBhTrendChart } from "@actabldesign/bellhop-core/dist/components/bh-trend-chart.js";
|
|
150
|
+
import type { EventName, StencilReactComponent } from '@stencil/react-output-target/runtime';
|
|
151
|
+
import { createComponent } from '@stencil/react-output-target/runtime';
|
|
152
|
+
import React from 'react';
|
|
153
|
+
|
|
154
|
+
type BhAccordionEvents = { onBhAccordionChange: EventName<CustomEvent<string | string[]>> };
|
|
155
|
+
|
|
156
|
+
export const BhAccordion: StencilReactComponent<BhAccordionElement, BhAccordionEvents> = /*@__PURE__*/ createComponent<BhAccordionElement, BhAccordionEvents>({
|
|
157
|
+
tagName: 'bh-accordion',
|
|
158
|
+
elementClass: BhAccordionElement,
|
|
159
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
160
|
+
react: React,
|
|
161
|
+
events: { onBhAccordionChange: 'bhAccordionChange' } as BhAccordionEvents,
|
|
162
|
+
defineCustomElement: defineBhAccordion
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
type BhAccordionItemEvents = {
|
|
166
|
+
onBhAccordionToggle: EventName<CustomEvent<{ value: string; expanded: boolean }>>,
|
|
167
|
+
onBhAccordionClick: EventName<CustomEvent<string>>
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
export const BhAccordionItem: StencilReactComponent<BhAccordionItemElement, BhAccordionItemEvents> = /*@__PURE__*/ createComponent<BhAccordionItemElement, BhAccordionItemEvents>({
|
|
171
|
+
tagName: 'bh-accordion-item',
|
|
172
|
+
elementClass: BhAccordionItemElement,
|
|
173
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
174
|
+
react: React,
|
|
175
|
+
events: {
|
|
176
|
+
onBhAccordionToggle: 'bhAccordionToggle',
|
|
177
|
+
onBhAccordionClick: 'bhAccordionClick'
|
|
178
|
+
} as BhAccordionItemEvents,
|
|
179
|
+
defineCustomElement: defineBhAccordionItem
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
type BhAppbarEvents = {
|
|
183
|
+
onBhMenuToggle: EventName<CustomEvent<void>>,
|
|
184
|
+
onBhBreadcrumbClick: EventName<BhAppbarCustomEvent<BreadcrumbItem>>,
|
|
185
|
+
onBhNotificationClick: EventName<CustomEvent<void>>,
|
|
186
|
+
onBhCalendarClick: EventName<CustomEvent<void>>,
|
|
187
|
+
onBhSettingsClick: EventName<CustomEvent<void>>
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
export const BhAppbar: StencilReactComponent<BhAppbarElement, BhAppbarEvents> = /*@__PURE__*/ createComponent<BhAppbarElement, BhAppbarEvents>({
|
|
191
|
+
tagName: 'bh-appbar',
|
|
192
|
+
elementClass: BhAppbarElement,
|
|
193
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
194
|
+
react: React,
|
|
195
|
+
events: {
|
|
196
|
+
onBhMenuToggle: 'bhMenuToggle',
|
|
197
|
+
onBhBreadcrumbClick: 'bhBreadcrumbClick',
|
|
198
|
+
onBhNotificationClick: 'bhNotificationClick',
|
|
199
|
+
onBhCalendarClick: 'bhCalendarClick',
|
|
200
|
+
onBhSettingsClick: 'bhSettingsClick'
|
|
201
|
+
} as BhAppbarEvents,
|
|
202
|
+
defineCustomElement: defineBhAppbar
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
type BhAutocompleteMenuEvents = {
|
|
206
|
+
onBhItemClick: EventName<BhAutocompleteMenuCustomEvent<AutocompleteMenuItem>>,
|
|
207
|
+
onBhItemHover: EventName<CustomEvent<number>>
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
export const BhAutocompleteMenu: StencilReactComponent<BhAutocompleteMenuElement, BhAutocompleteMenuEvents> = /*@__PURE__*/ createComponent<BhAutocompleteMenuElement, BhAutocompleteMenuEvents>({
|
|
211
|
+
tagName: 'bh-autocomplete-menu',
|
|
212
|
+
elementClass: BhAutocompleteMenuElement,
|
|
213
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
214
|
+
react: React,
|
|
215
|
+
events: {
|
|
216
|
+
onBhItemClick: 'bhItemClick',
|
|
217
|
+
onBhItemHover: 'bhItemHover'
|
|
218
|
+
} as BhAutocompleteMenuEvents,
|
|
219
|
+
defineCustomElement: defineBhAutocompleteMenu
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
type BhAvatarEvents = {
|
|
223
|
+
onBhMouseEnter: EventName<CustomEvent<void>>,
|
|
224
|
+
onBhMouseLeave: EventName<CustomEvent<void>>
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
export const BhAvatar: StencilReactComponent<BhAvatarElement, BhAvatarEvents> = /*@__PURE__*/ createComponent<BhAvatarElement, BhAvatarEvents>({
|
|
228
|
+
tagName: 'bh-avatar',
|
|
229
|
+
elementClass: BhAvatarElement,
|
|
230
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
231
|
+
react: React,
|
|
232
|
+
events: {
|
|
233
|
+
onBhMouseEnter: 'bhMouseEnter',
|
|
234
|
+
onBhMouseLeave: 'bhMouseLeave'
|
|
235
|
+
} as BhAvatarEvents,
|
|
236
|
+
defineCustomElement: defineBhAvatar
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
type BhAvatarAddEvents = { onBhClick: EventName<BhAvatarAddCustomEvent<MouseEvent>> };
|
|
240
|
+
|
|
241
|
+
export const BhAvatarAdd: StencilReactComponent<BhAvatarAddElement, BhAvatarAddEvents> = /*@__PURE__*/ createComponent<BhAvatarAddElement, BhAvatarAddEvents>({
|
|
242
|
+
tagName: 'bh-avatar-add',
|
|
243
|
+
elementClass: BhAvatarAddElement,
|
|
244
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
245
|
+
react: React,
|
|
246
|
+
events: { onBhClick: 'bhClick' } as BhAvatarAddEvents,
|
|
247
|
+
defineCustomElement: defineBhAvatarAdd
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
type BhAvatarStackedEvents = NonNullable<unknown>;
|
|
251
|
+
|
|
252
|
+
export const BhAvatarStacked: StencilReactComponent<BhAvatarStackedElement, BhAvatarStackedEvents> = /*@__PURE__*/ createComponent<BhAvatarStackedElement, BhAvatarStackedEvents>({
|
|
253
|
+
tagName: 'bh-avatar-stacked',
|
|
254
|
+
elementClass: BhAvatarStackedElement,
|
|
255
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
256
|
+
react: React,
|
|
257
|
+
events: {} as BhAvatarStackedEvents,
|
|
258
|
+
defineCustomElement: defineBhAvatarStacked
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
type BhBadgeEvents = { onBhDismiss: EventName<CustomEvent<void>> };
|
|
262
|
+
|
|
263
|
+
export const BhBadge: StencilReactComponent<BhBadgeElement, BhBadgeEvents> = /*@__PURE__*/ createComponent<BhBadgeElement, BhBadgeEvents>({
|
|
264
|
+
tagName: 'bh-badge',
|
|
265
|
+
elementClass: BhBadgeElement,
|
|
266
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
267
|
+
react: React,
|
|
268
|
+
events: { onBhDismiss: 'bhDismiss' } as BhBadgeEvents,
|
|
269
|
+
defineCustomElement: defineBhBadge
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
type BhBadgeDotEvents = NonNullable<unknown>;
|
|
273
|
+
|
|
274
|
+
export const BhBadgeDot: StencilReactComponent<BhBadgeDotElement, BhBadgeDotEvents> = /*@__PURE__*/ createComponent<BhBadgeDotElement, BhBadgeDotEvents>({
|
|
275
|
+
tagName: 'bh-badge-dot',
|
|
276
|
+
elementClass: BhBadgeDotElement,
|
|
277
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
278
|
+
react: React,
|
|
279
|
+
events: {} as BhBadgeDotEvents,
|
|
280
|
+
defineCustomElement: defineBhBadgeDot
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
type BhBarChartEvents = NonNullable<unknown>;
|
|
284
|
+
|
|
285
|
+
export const BhBarChart: StencilReactComponent<BhBarChartElement, BhBarChartEvents> = /*@__PURE__*/ createComponent<BhBarChartElement, BhBarChartEvents>({
|
|
286
|
+
tagName: 'bh-bar-chart',
|
|
287
|
+
elementClass: BhBarChartElement,
|
|
288
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
289
|
+
react: React,
|
|
290
|
+
events: {} as BhBarChartEvents,
|
|
291
|
+
defineCustomElement: defineBhBarChart
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
type BhBreadcrumbsEvents = {
|
|
295
|
+
onBhItemClick: EventName<BhBreadcrumbsCustomEvent<BreadcrumbItem>>,
|
|
296
|
+
onBhNavigate: EventName<CustomEvent<string>>
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
export const BhBreadcrumbs: StencilReactComponent<BhBreadcrumbsElement, BhBreadcrumbsEvents> = /*@__PURE__*/ createComponent<BhBreadcrumbsElement, BhBreadcrumbsEvents>({
|
|
300
|
+
tagName: 'bh-breadcrumbs',
|
|
301
|
+
elementClass: BhBreadcrumbsElement,
|
|
302
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
303
|
+
react: React,
|
|
304
|
+
events: {
|
|
305
|
+
onBhItemClick: 'bhItemClick',
|
|
306
|
+
onBhNavigate: 'bhNavigate'
|
|
307
|
+
} as BhBreadcrumbsEvents,
|
|
308
|
+
defineCustomElement: defineBhBreadcrumbs
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
type BhButtonEvents = { onBhClick: EventName<BhButtonCustomEvent<MouseEvent>> };
|
|
312
|
+
|
|
313
|
+
export const BhButton: StencilReactComponent<BhButtonElement, BhButtonEvents> = /*@__PURE__*/ createComponent<BhButtonElement, BhButtonEvents>({
|
|
314
|
+
tagName: 'bh-button',
|
|
315
|
+
elementClass: BhButtonElement,
|
|
316
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
317
|
+
react: React,
|
|
318
|
+
events: { onBhClick: 'bhClick' } as BhButtonEvents,
|
|
319
|
+
defineCustomElement: defineBhButton
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
type BhButtonIconEvents = { onBhClick: EventName<BhButtonIconCustomEvent<MouseEvent>> };
|
|
323
|
+
|
|
324
|
+
export const BhButtonIcon: StencilReactComponent<BhButtonIconElement, BhButtonIconEvents> = /*@__PURE__*/ createComponent<BhButtonIconElement, BhButtonIconEvents>({
|
|
325
|
+
tagName: 'bh-button-icon',
|
|
326
|
+
elementClass: BhButtonIconElement,
|
|
327
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
328
|
+
react: React,
|
|
329
|
+
events: { onBhClick: 'bhClick' } as BhButtonIconEvents,
|
|
330
|
+
defineCustomElement: defineBhButtonIcon
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
type BhCardEvents = NonNullable<unknown>;
|
|
334
|
+
|
|
335
|
+
export const BhCard: StencilReactComponent<BhCardElement, BhCardEvents> = /*@__PURE__*/ createComponent<BhCardElement, BhCardEvents>({
|
|
336
|
+
tagName: 'bh-card',
|
|
337
|
+
elementClass: BhCardElement,
|
|
338
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
339
|
+
react: React,
|
|
340
|
+
events: {} as BhCardEvents,
|
|
341
|
+
defineCustomElement: defineBhCard
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
type BhCardFooterEvents = NonNullable<unknown>;
|
|
345
|
+
|
|
346
|
+
export const BhCardFooter: StencilReactComponent<BhCardFooterElement, BhCardFooterEvents> = /*@__PURE__*/ createComponent<BhCardFooterElement, BhCardFooterEvents>({
|
|
347
|
+
tagName: 'bh-card-footer',
|
|
348
|
+
elementClass: BhCardFooterElement,
|
|
349
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
350
|
+
react: React,
|
|
351
|
+
events: {} as BhCardFooterEvents,
|
|
352
|
+
defineCustomElement: defineBhCardFooter
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
type BhCardHeaderEvents = { onBhDropdownClick: EventName<CustomEvent<void>> };
|
|
356
|
+
|
|
357
|
+
export const BhCardHeader: StencilReactComponent<BhCardHeaderElement, BhCardHeaderEvents> = /*@__PURE__*/ createComponent<BhCardHeaderElement, BhCardHeaderEvents>({
|
|
358
|
+
tagName: 'bh-card-header',
|
|
359
|
+
elementClass: BhCardHeaderElement,
|
|
360
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
361
|
+
react: React,
|
|
362
|
+
events: { onBhDropdownClick: 'bhDropdownClick' } as BhCardHeaderEvents,
|
|
363
|
+
defineCustomElement: defineBhCardHeader
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
type BhChartTooltipEvents = NonNullable<unknown>;
|
|
367
|
+
|
|
368
|
+
export const BhChartTooltip: StencilReactComponent<BhChartTooltipElement, BhChartTooltipEvents> = /*@__PURE__*/ createComponent<BhChartTooltipElement, BhChartTooltipEvents>({
|
|
369
|
+
tagName: 'bh-chart-tooltip',
|
|
370
|
+
elementClass: BhChartTooltipElement,
|
|
371
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
372
|
+
react: React,
|
|
373
|
+
events: {} as BhChartTooltipEvents,
|
|
374
|
+
defineCustomElement: defineBhChartTooltip
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
type BhCheckboxEvents = { onBhChange: EventName<CustomEvent<boolean>> };
|
|
378
|
+
|
|
379
|
+
export const BhCheckbox: StencilReactComponent<BhCheckboxElement, BhCheckboxEvents> = /*@__PURE__*/ createComponent<BhCheckboxElement, BhCheckboxEvents>({
|
|
380
|
+
tagName: 'bh-checkbox',
|
|
381
|
+
elementClass: BhCheckboxElement,
|
|
382
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
383
|
+
react: React,
|
|
384
|
+
events: { onBhChange: 'bhChange' } as BhCheckboxEvents,
|
|
385
|
+
defineCustomElement: defineBhCheckbox
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
type BhCheckboxGroupEvents = { onBhChange: EventName<CustomEvent<string | string[]>> };
|
|
389
|
+
|
|
390
|
+
export const BhCheckboxGroup: StencilReactComponent<BhCheckboxGroupElement, BhCheckboxGroupEvents> = /*@__PURE__*/ createComponent<BhCheckboxGroupElement, BhCheckboxGroupEvents>({
|
|
391
|
+
tagName: 'bh-checkbox-group',
|
|
392
|
+
elementClass: BhCheckboxGroupElement,
|
|
393
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
394
|
+
react: React,
|
|
395
|
+
events: { onBhChange: 'bhChange' } as BhCheckboxGroupEvents,
|
|
396
|
+
defineCustomElement: defineBhCheckboxGroup
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
type BhCheckboxGroupItemEvents = { onBhItemChange: EventName<CustomEvent<{ value: string; checked: boolean }>> };
|
|
400
|
+
|
|
401
|
+
export const BhCheckboxGroupItem: StencilReactComponent<BhCheckboxGroupItemElement, BhCheckboxGroupItemEvents> = /*@__PURE__*/ createComponent<BhCheckboxGroupItemElement, BhCheckboxGroupItemEvents>({
|
|
402
|
+
tagName: 'bh-checkbox-group-item',
|
|
403
|
+
elementClass: BhCheckboxGroupItemElement,
|
|
404
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
405
|
+
react: React,
|
|
406
|
+
events: { onBhItemChange: 'bhItemChange' } as BhCheckboxGroupItemEvents,
|
|
407
|
+
defineCustomElement: defineBhCheckboxGroupItem
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
type BhContainerEvents = NonNullable<unknown>;
|
|
411
|
+
|
|
412
|
+
export const BhContainer: StencilReactComponent<BhContainerElement, BhContainerEvents> = /*@__PURE__*/ createComponent<BhContainerElement, BhContainerEvents>({
|
|
413
|
+
tagName: 'bh-container',
|
|
414
|
+
elementClass: BhContainerElement,
|
|
415
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
416
|
+
react: React,
|
|
417
|
+
events: {} as BhContainerEvents,
|
|
418
|
+
defineCustomElement: defineBhContainer
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
type BhContainerFooterEvents = { onBhButtonClick: EventName<CustomEvent<void>> };
|
|
422
|
+
|
|
423
|
+
export const BhContainerFooter: StencilReactComponent<BhContainerFooterElement, BhContainerFooterEvents> = /*@__PURE__*/ createComponent<BhContainerFooterElement, BhContainerFooterEvents>({
|
|
424
|
+
tagName: 'bh-container-footer',
|
|
425
|
+
elementClass: BhContainerFooterElement,
|
|
426
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
427
|
+
react: React,
|
|
428
|
+
events: { onBhButtonClick: 'bhButtonClick' } as BhContainerFooterEvents,
|
|
429
|
+
defineCustomElement: defineBhContainerFooter
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
type BhDataGridEvents = {
|
|
433
|
+
onBhSortChange: EventName<BhDataGridCustomEvent<DataGridSortChangeEvent>>,
|
|
434
|
+
onBhFilterChange: EventName<BhDataGridCustomEvent<DataGridFilterChangeEvent>>,
|
|
435
|
+
onBhSelectionChange: EventName<BhDataGridCustomEvent<DataGridSelectionChangeEvent>>,
|
|
436
|
+
onBhPageChange: EventName<BhDataGridCustomEvent<DataGridPageChangeEvent>>,
|
|
437
|
+
onBhRowClick: EventName<BhDataGridCustomEvent<DataGridRowClickEvent>>,
|
|
438
|
+
onBhCellClick: EventName<BhDataGridCustomEvent<DataGridCellClickEvent>>,
|
|
439
|
+
onBhExpandChange: EventName<BhDataGridCustomEvent<DataGridExpandChangeEvent>>,
|
|
440
|
+
onBhGroupToggle: EventName<BhDataGridCustomEvent<DataGridGroupToggleEvent>>,
|
|
441
|
+
onBhEditStart: EventName<BhDataGridCustomEvent<DataGridEditStartEvent>>,
|
|
442
|
+
onBhEditCancel: EventName<BhDataGridCustomEvent<DataGridEditCancelEvent>>,
|
|
443
|
+
onBhEditSave: EventName<BhDataGridCustomEvent<DataGridEditSaveEvent>>,
|
|
444
|
+
onBhCellChange: EventName<BhDataGridCustomEvent<DataGridCellChangeEvent>>,
|
|
445
|
+
onBhValidationError: EventName<BhDataGridCustomEvent<DataGridValidationErrorEvent>>
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
export const BhDataGrid: StencilReactComponent<BhDataGridElement, BhDataGridEvents> = /*@__PURE__*/ createComponent<BhDataGridElement, BhDataGridEvents>({
|
|
449
|
+
tagName: 'bh-data-grid',
|
|
450
|
+
elementClass: BhDataGridElement,
|
|
451
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
452
|
+
react: React,
|
|
453
|
+
events: {
|
|
454
|
+
onBhSortChange: 'bhSortChange',
|
|
455
|
+
onBhFilterChange: 'bhFilterChange',
|
|
456
|
+
onBhSelectionChange: 'bhSelectionChange',
|
|
457
|
+
onBhPageChange: 'bhPageChange',
|
|
458
|
+
onBhRowClick: 'bhRowClick',
|
|
459
|
+
onBhCellClick: 'bhCellClick',
|
|
460
|
+
onBhExpandChange: 'bhExpandChange',
|
|
461
|
+
onBhGroupToggle: 'bhGroupToggle',
|
|
462
|
+
onBhEditStart: 'bhEditStart',
|
|
463
|
+
onBhEditCancel: 'bhEditCancel',
|
|
464
|
+
onBhEditSave: 'bhEditSave',
|
|
465
|
+
onBhCellChange: 'bhCellChange',
|
|
466
|
+
onBhValidationError: 'bhValidationError'
|
|
467
|
+
} as BhDataGridEvents,
|
|
468
|
+
defineCustomElement: defineBhDataGrid
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
type BhDatePickerEvents = {
|
|
472
|
+
onBhChange: EventName<BhDatePickerCustomEvent<SelectedDate | null>>,
|
|
473
|
+
onBhDateSelect: EventName<BhDatePickerCustomEvent<SelectedDate | null>>
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
export const BhDatePicker: StencilReactComponent<BhDatePickerElement, BhDatePickerEvents> = /*@__PURE__*/ createComponent<BhDatePickerElement, BhDatePickerEvents>({
|
|
477
|
+
tagName: 'bh-date-picker',
|
|
478
|
+
elementClass: BhDatePickerElement,
|
|
479
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
480
|
+
react: React,
|
|
481
|
+
events: {
|
|
482
|
+
onBhChange: 'bhChange',
|
|
483
|
+
onBhDateSelect: 'bhDateSelect'
|
|
484
|
+
} as BhDatePickerEvents,
|
|
485
|
+
defineCustomElement: defineBhDatePicker
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
type BhDatePickerContentEvents = {
|
|
489
|
+
onBhChange: EventName<BhDatePickerContentCustomEvent<SelectedDate | null>>,
|
|
490
|
+
onBhDateSelect: EventName<BhDatePickerContentCustomEvent<SelectedDate | null>>,
|
|
491
|
+
onBhMonthChange: EventName<CustomEvent<{ month: number; year: number }>>,
|
|
492
|
+
onBhMonthYearChange: EventName<CustomEvent<{ month: number; year: number }>>
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
export const BhDatePickerContent: StencilReactComponent<BhDatePickerContentElement, BhDatePickerContentEvents> = /*@__PURE__*/ createComponent<BhDatePickerContentElement, BhDatePickerContentEvents>({
|
|
496
|
+
tagName: 'bh-date-picker-content',
|
|
497
|
+
elementClass: BhDatePickerContentElement,
|
|
498
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
499
|
+
react: React,
|
|
500
|
+
events: {
|
|
501
|
+
onBhChange: 'bhChange',
|
|
502
|
+
onBhDateSelect: 'bhDateSelect',
|
|
503
|
+
onBhMonthChange: 'bhMonthChange',
|
|
504
|
+
onBhMonthYearChange: 'bhMonthYearChange'
|
|
505
|
+
} as BhDatePickerContentEvents,
|
|
506
|
+
defineCustomElement: defineBhDatePickerContent
|
|
507
|
+
});
|
|
508
|
+
|
|
509
|
+
type BhDateRangePickerEvents = {
|
|
510
|
+
onBhChange: EventName<BhDateRangePickerCustomEvent<SelectedDateRange | null>>,
|
|
511
|
+
onBhDateRangeSelect: EventName<BhDateRangePickerCustomEvent<SelectedDateRange | null>>
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
export const BhDateRangePicker: StencilReactComponent<BhDateRangePickerElement, BhDateRangePickerEvents> = /*@__PURE__*/ createComponent<BhDateRangePickerElement, BhDateRangePickerEvents>({
|
|
515
|
+
tagName: 'bh-date-range-picker',
|
|
516
|
+
elementClass: BhDateRangePickerElement,
|
|
517
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
518
|
+
react: React,
|
|
519
|
+
events: {
|
|
520
|
+
onBhChange: 'bhChange',
|
|
521
|
+
onBhDateRangeSelect: 'bhDateRangeSelect'
|
|
522
|
+
} as BhDateRangePickerEvents,
|
|
523
|
+
defineCustomElement: defineBhDateRangePicker
|
|
524
|
+
});
|
|
525
|
+
|
|
526
|
+
type BhDateRangePickerContentEvents = {
|
|
527
|
+
onBhChange: EventName<BhDateRangePickerContentCustomEvent<SelectedDateRange | null>>,
|
|
528
|
+
onBhDateRangeSelect: EventName<BhDateRangePickerContentCustomEvent<SelectedDateRange | null>>
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
export const BhDateRangePickerContent: StencilReactComponent<BhDateRangePickerContentElement, BhDateRangePickerContentEvents> = /*@__PURE__*/ createComponent<BhDateRangePickerContentElement, BhDateRangePickerContentEvents>({
|
|
532
|
+
tagName: 'bh-date-range-picker-content',
|
|
533
|
+
elementClass: BhDateRangePickerContentElement,
|
|
534
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
535
|
+
react: React,
|
|
536
|
+
events: {
|
|
537
|
+
onBhChange: 'bhChange',
|
|
538
|
+
onBhDateRangeSelect: 'bhDateRangeSelect'
|
|
539
|
+
} as BhDateRangePickerContentEvents,
|
|
540
|
+
defineCustomElement: defineBhDateRangePickerContent
|
|
541
|
+
});
|
|
542
|
+
|
|
543
|
+
type BhDropdownEvents = { onBhItemClick: EventName<BhDropdownCustomEvent<DropdownMenuItem>> };
|
|
544
|
+
|
|
545
|
+
export const BhDropdown: StencilReactComponent<BhDropdownElement, BhDropdownEvents> = /*@__PURE__*/ createComponent<BhDropdownElement, BhDropdownEvents>({
|
|
546
|
+
tagName: 'bh-dropdown',
|
|
547
|
+
elementClass: BhDropdownElement,
|
|
548
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
549
|
+
react: React,
|
|
550
|
+
events: { onBhItemClick: 'bhItemClick' } as BhDropdownEvents,
|
|
551
|
+
defineCustomElement: defineBhDropdown
|
|
552
|
+
});
|
|
553
|
+
|
|
554
|
+
type BhDropdownMenuEvents = { onBhItemClick: EventName<BhDropdownMenuCustomEvent<DropdownMenuItem>> };
|
|
555
|
+
|
|
556
|
+
export const BhDropdownMenu: StencilReactComponent<BhDropdownMenuElement, BhDropdownMenuEvents> = /*@__PURE__*/ createComponent<BhDropdownMenuElement, BhDropdownMenuEvents>({
|
|
557
|
+
tagName: 'bh-dropdown-menu',
|
|
558
|
+
elementClass: BhDropdownMenuElement,
|
|
559
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
560
|
+
react: React,
|
|
561
|
+
events: { onBhItemClick: 'bhItemClick' } as BhDropdownMenuEvents,
|
|
562
|
+
defineCustomElement: defineBhDropdownMenu
|
|
563
|
+
});
|
|
564
|
+
|
|
565
|
+
type BhEmptyStateEvents = {
|
|
566
|
+
onBhPrimaryAction: EventName<CustomEvent<void>>,
|
|
567
|
+
onBhSecondaryAction: EventName<CustomEvent<void>>
|
|
568
|
+
};
|
|
569
|
+
|
|
570
|
+
export const BhEmptyState: StencilReactComponent<BhEmptyStateElement, BhEmptyStateEvents> = /*@__PURE__*/ createComponent<BhEmptyStateElement, BhEmptyStateEvents>({
|
|
571
|
+
tagName: 'bh-empty-state',
|
|
572
|
+
elementClass: BhEmptyStateElement,
|
|
573
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
574
|
+
react: React,
|
|
575
|
+
events: {
|
|
576
|
+
onBhPrimaryAction: 'bhPrimaryAction',
|
|
577
|
+
onBhSecondaryAction: 'bhSecondaryAction'
|
|
578
|
+
} as BhEmptyStateEvents,
|
|
579
|
+
defineCustomElement: defineBhEmptyState
|
|
580
|
+
});
|
|
581
|
+
|
|
582
|
+
type BhFeaturedIconEvents = NonNullable<unknown>;
|
|
583
|
+
|
|
584
|
+
export const BhFeaturedIcon: StencilReactComponent<BhFeaturedIconElement, BhFeaturedIconEvents> = /*@__PURE__*/ createComponent<BhFeaturedIconElement, BhFeaturedIconEvents>({
|
|
585
|
+
tagName: 'bh-featured-icon',
|
|
586
|
+
elementClass: BhFeaturedIconElement,
|
|
587
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
588
|
+
react: React,
|
|
589
|
+
events: {} as BhFeaturedIconEvents,
|
|
590
|
+
defineCustomElement: defineBhFeaturedIcon
|
|
591
|
+
});
|
|
592
|
+
|
|
593
|
+
type BhIllustrationsEvents = NonNullable<unknown>;
|
|
594
|
+
|
|
595
|
+
export const BhIllustrations: StencilReactComponent<BhIllustrationsElement, BhIllustrationsEvents> = /*@__PURE__*/ createComponent<BhIllustrationsElement, BhIllustrationsEvents>({
|
|
596
|
+
tagName: 'bh-illustrations',
|
|
597
|
+
elementClass: BhIllustrationsElement,
|
|
598
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
599
|
+
react: React,
|
|
600
|
+
events: {} as BhIllustrationsEvents,
|
|
601
|
+
defineCustomElement: defineBhIllustrations
|
|
602
|
+
});
|
|
603
|
+
|
|
604
|
+
type BhInputAutocompleteEvents = {
|
|
605
|
+
onBhChange: EventName<CustomEvent<string>>,
|
|
606
|
+
onBhSelectedItemsChange: EventName<BhInputAutocompleteCustomEvent<AutocompleteMenuItem[]>>,
|
|
607
|
+
onBhFocus: EventName<CustomEvent<void>>,
|
|
608
|
+
onBhBlur: EventName<CustomEvent<void>>,
|
|
609
|
+
onBhHelpClick: EventName<CustomEvent<void>>,
|
|
610
|
+
onBhOptionSelect: EventName<BhInputAutocompleteCustomEvent<AutocompleteMenuItem>>
|
|
611
|
+
};
|
|
612
|
+
|
|
613
|
+
export const BhInputAutocomplete: StencilReactComponent<BhInputAutocompleteElement, BhInputAutocompleteEvents> = /*@__PURE__*/ createComponent<BhInputAutocompleteElement, BhInputAutocompleteEvents>({
|
|
614
|
+
tagName: 'bh-input-autocomplete',
|
|
615
|
+
elementClass: BhInputAutocompleteElement,
|
|
616
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
617
|
+
react: React,
|
|
618
|
+
events: {
|
|
619
|
+
onBhChange: 'bhChange',
|
|
620
|
+
onBhSelectedItemsChange: 'bhSelectedItemsChange',
|
|
621
|
+
onBhFocus: 'bhFocus',
|
|
622
|
+
onBhBlur: 'bhBlur',
|
|
623
|
+
onBhHelpClick: 'bhHelpClick',
|
|
624
|
+
onBhOptionSelect: 'bhOptionSelect'
|
|
625
|
+
} as BhInputAutocompleteEvents,
|
|
626
|
+
defineCustomElement: defineBhInputAutocomplete
|
|
627
|
+
});
|
|
628
|
+
|
|
629
|
+
type BhInputNumberEvents = {
|
|
630
|
+
onBhChange: EventName<CustomEvent<number | null>>,
|
|
631
|
+
onBhFocus: EventName<CustomEvent<void>>,
|
|
632
|
+
onBhBlur: EventName<CustomEvent<void>>,
|
|
633
|
+
onBhHelpClick: EventName<CustomEvent<void>>
|
|
634
|
+
};
|
|
635
|
+
|
|
636
|
+
export const BhInputNumber: StencilReactComponent<BhInputNumberElement, BhInputNumberEvents> = /*@__PURE__*/ createComponent<BhInputNumberElement, BhInputNumberEvents>({
|
|
637
|
+
tagName: 'bh-input-number',
|
|
638
|
+
elementClass: BhInputNumberElement,
|
|
639
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
640
|
+
react: React,
|
|
641
|
+
events: {
|
|
642
|
+
onBhChange: 'bhChange',
|
|
643
|
+
onBhFocus: 'bhFocus',
|
|
644
|
+
onBhBlur: 'bhBlur',
|
|
645
|
+
onBhHelpClick: 'bhHelpClick'
|
|
646
|
+
} as BhInputNumberEvents,
|
|
647
|
+
defineCustomElement: defineBhInputNumber
|
|
648
|
+
});
|
|
649
|
+
|
|
650
|
+
type BhInputPasswordEvents = {
|
|
651
|
+
onBhInput: EventName<CustomEvent<string>>,
|
|
652
|
+
onBhFocus: EventName<CustomEvent<void>>,
|
|
653
|
+
onBhBlur: EventName<CustomEvent<void>>,
|
|
654
|
+
onBhHelpClick: EventName<CustomEvent<void>>,
|
|
655
|
+
onBhVisibilityToggle: EventName<CustomEvent<boolean>>
|
|
656
|
+
};
|
|
657
|
+
|
|
658
|
+
export const BhInputPassword: StencilReactComponent<BhInputPasswordElement, BhInputPasswordEvents> = /*@__PURE__*/ createComponent<BhInputPasswordElement, BhInputPasswordEvents>({
|
|
659
|
+
tagName: 'bh-input-password',
|
|
660
|
+
elementClass: BhInputPasswordElement,
|
|
661
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
662
|
+
react: React,
|
|
663
|
+
events: {
|
|
664
|
+
onBhInput: 'bhInput',
|
|
665
|
+
onBhFocus: 'bhFocus',
|
|
666
|
+
onBhBlur: 'bhBlur',
|
|
667
|
+
onBhHelpClick: 'bhHelpClick',
|
|
668
|
+
onBhVisibilityToggle: 'bhVisibilityToggle'
|
|
669
|
+
} as BhInputPasswordEvents,
|
|
670
|
+
defineCustomElement: defineBhInputPassword
|
|
671
|
+
});
|
|
672
|
+
|
|
673
|
+
type BhInputTextEvents = {
|
|
674
|
+
onBhInput: EventName<CustomEvent<string>>,
|
|
675
|
+
onBhFocus: EventName<CustomEvent<void>>,
|
|
676
|
+
onBhBlur: EventName<CustomEvent<void>>,
|
|
677
|
+
onBhHelpClick: EventName<CustomEvent<void>>
|
|
678
|
+
};
|
|
679
|
+
|
|
680
|
+
export const BhInputText: StencilReactComponent<BhInputTextElement, BhInputTextEvents> = /*@__PURE__*/ createComponent<BhInputTextElement, BhInputTextEvents>({
|
|
681
|
+
tagName: 'bh-input-text',
|
|
682
|
+
elementClass: BhInputTextElement,
|
|
683
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
684
|
+
react: React,
|
|
685
|
+
events: {
|
|
686
|
+
onBhInput: 'bhInput',
|
|
687
|
+
onBhFocus: 'bhFocus',
|
|
688
|
+
onBhBlur: 'bhBlur',
|
|
689
|
+
onBhHelpClick: 'bhHelpClick'
|
|
690
|
+
} as BhInputTextEvents,
|
|
691
|
+
defineCustomElement: defineBhInputText
|
|
692
|
+
});
|
|
693
|
+
|
|
694
|
+
type BhInputVerificationEvents = {
|
|
695
|
+
onBhChange: EventName<CustomEvent<string>>,
|
|
696
|
+
onBhComplete: EventName<CustomEvent<string>>
|
|
697
|
+
};
|
|
698
|
+
|
|
699
|
+
export const BhInputVerification: StencilReactComponent<BhInputVerificationElement, BhInputVerificationEvents> = /*@__PURE__*/ createComponent<BhInputVerificationElement, BhInputVerificationEvents>({
|
|
700
|
+
tagName: 'bh-input-verification',
|
|
701
|
+
elementClass: BhInputVerificationElement,
|
|
702
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
703
|
+
react: React,
|
|
704
|
+
events: {
|
|
705
|
+
onBhChange: 'bhChange',
|
|
706
|
+
onBhComplete: 'bhComplete'
|
|
707
|
+
} as BhInputVerificationEvents,
|
|
708
|
+
defineCustomElement: defineBhInputVerification
|
|
709
|
+
});
|
|
710
|
+
|
|
711
|
+
type BhLabelEvents = { onBhHelpClick: EventName<CustomEvent<void>> };
|
|
712
|
+
|
|
713
|
+
export const BhLabel: StencilReactComponent<BhLabelElement, BhLabelEvents> = /*@__PURE__*/ createComponent<BhLabelElement, BhLabelEvents>({
|
|
714
|
+
tagName: 'bh-label',
|
|
715
|
+
elementClass: BhLabelElement,
|
|
716
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
717
|
+
react: React,
|
|
718
|
+
events: { onBhHelpClick: 'bhHelpClick' } as BhLabelEvents,
|
|
719
|
+
defineCustomElement: defineBhLabel
|
|
720
|
+
});
|
|
721
|
+
|
|
722
|
+
type BhLoaderSpinnerEvents = NonNullable<unknown>;
|
|
723
|
+
|
|
724
|
+
export const BhLoaderSpinner: StencilReactComponent<BhLoaderSpinnerElement, BhLoaderSpinnerEvents> = /*@__PURE__*/ createComponent<BhLoaderSpinnerElement, BhLoaderSpinnerEvents>({
|
|
725
|
+
tagName: 'bh-loader-spinner',
|
|
726
|
+
elementClass: BhLoaderSpinnerElement,
|
|
727
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
728
|
+
react: React,
|
|
729
|
+
events: {} as BhLoaderSpinnerEvents,
|
|
730
|
+
defineCustomElement: defineBhLoaderSpinner
|
|
731
|
+
});
|
|
732
|
+
|
|
733
|
+
type BhLogoBoxEvents = { onBhProductSelect: EventName<BhLogoBoxCustomEvent<BhProduct>> };
|
|
734
|
+
|
|
735
|
+
export const BhLogoBox: StencilReactComponent<BhLogoBoxElement, BhLogoBoxEvents> = /*@__PURE__*/ createComponent<BhLogoBoxElement, BhLogoBoxEvents>({
|
|
736
|
+
tagName: 'bh-logo-box',
|
|
737
|
+
elementClass: BhLogoBoxElement,
|
|
738
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
739
|
+
react: React,
|
|
740
|
+
events: { onBhProductSelect: 'bhProductSelect' } as BhLogoBoxEvents,
|
|
741
|
+
defineCustomElement: defineBhLogoBox
|
|
742
|
+
});
|
|
743
|
+
|
|
744
|
+
type BhModalEvents = { onBhClose: EventName<CustomEvent<void>> };
|
|
745
|
+
|
|
746
|
+
export const BhModal: StencilReactComponent<BhModalElement, BhModalEvents> = /*@__PURE__*/ createComponent<BhModalElement, BhModalEvents>({
|
|
747
|
+
tagName: 'bh-modal',
|
|
748
|
+
elementClass: BhModalElement,
|
|
749
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
750
|
+
react: React,
|
|
751
|
+
events: { onBhClose: 'bhClose' } as BhModalEvents,
|
|
752
|
+
defineCustomElement: defineBhModal
|
|
753
|
+
});
|
|
754
|
+
|
|
755
|
+
type BhModalActionsEvents = {
|
|
756
|
+
onBhPrimaryAction: EventName<CustomEvent<void>>,
|
|
757
|
+
onBhSecondaryAction: EventName<CustomEvent<void>>
|
|
758
|
+
};
|
|
759
|
+
|
|
760
|
+
export const BhModalActions: StencilReactComponent<BhModalActionsElement, BhModalActionsEvents> = /*@__PURE__*/ createComponent<BhModalActionsElement, BhModalActionsEvents>({
|
|
761
|
+
tagName: 'bh-modal-actions',
|
|
762
|
+
elementClass: BhModalActionsElement,
|
|
763
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
764
|
+
react: React,
|
|
765
|
+
events: {
|
|
766
|
+
onBhPrimaryAction: 'bhPrimaryAction',
|
|
767
|
+
onBhSecondaryAction: 'bhSecondaryAction'
|
|
768
|
+
} as BhModalActionsEvents,
|
|
769
|
+
defineCustomElement: defineBhModalActions
|
|
770
|
+
});
|
|
771
|
+
|
|
772
|
+
type BhModalHeaderEvents = { onBhClose: EventName<CustomEvent<void>> };
|
|
773
|
+
|
|
774
|
+
export const BhModalHeader: StencilReactComponent<BhModalHeaderElement, BhModalHeaderEvents> = /*@__PURE__*/ createComponent<BhModalHeaderElement, BhModalHeaderEvents>({
|
|
775
|
+
tagName: 'bh-modal-header',
|
|
776
|
+
elementClass: BhModalHeaderElement,
|
|
777
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
778
|
+
react: React,
|
|
779
|
+
events: { onBhClose: 'bhClose' } as BhModalHeaderEvents,
|
|
780
|
+
defineCustomElement: defineBhModalHeader
|
|
781
|
+
});
|
|
782
|
+
|
|
783
|
+
type BhMonthPickerEvents = {
|
|
784
|
+
onBhChange: EventName<BhMonthPickerCustomEvent<MonthYear | null>>,
|
|
785
|
+
onBhMonthYearSelect: EventName<BhMonthPickerCustomEvent<MonthYear>>
|
|
786
|
+
};
|
|
787
|
+
|
|
788
|
+
export const BhMonthPicker: StencilReactComponent<BhMonthPickerElement, BhMonthPickerEvents> = /*@__PURE__*/ createComponent<BhMonthPickerElement, BhMonthPickerEvents>({
|
|
789
|
+
tagName: 'bh-month-picker',
|
|
790
|
+
elementClass: BhMonthPickerElement,
|
|
791
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
792
|
+
react: React,
|
|
793
|
+
events: {
|
|
794
|
+
onBhChange: 'bhChange',
|
|
795
|
+
onBhMonthYearSelect: 'bhMonthYearSelect'
|
|
796
|
+
} as BhMonthPickerEvents,
|
|
797
|
+
defineCustomElement: defineBhMonthPicker
|
|
798
|
+
});
|
|
799
|
+
|
|
800
|
+
type BhMonthPickerContentEvents = {
|
|
801
|
+
onBhChange: EventName<BhMonthPickerContentCustomEvent<MonthYear>>,
|
|
802
|
+
onBhMonthYearSelect: EventName<BhMonthPickerContentCustomEvent<MonthYear>>
|
|
803
|
+
};
|
|
804
|
+
|
|
805
|
+
export const BhMonthPickerContent: StencilReactComponent<BhMonthPickerContentElement, BhMonthPickerContentEvents> = /*@__PURE__*/ createComponent<BhMonthPickerContentElement, BhMonthPickerContentEvents>({
|
|
806
|
+
tagName: 'bh-month-picker-content',
|
|
807
|
+
elementClass: BhMonthPickerContentElement,
|
|
808
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
809
|
+
react: React,
|
|
810
|
+
events: {
|
|
811
|
+
onBhChange: 'bhChange',
|
|
812
|
+
onBhMonthYearSelect: 'bhMonthYearSelect'
|
|
813
|
+
} as BhMonthPickerContentEvents,
|
|
814
|
+
defineCustomElement: defineBhMonthPickerContent
|
|
815
|
+
});
|
|
816
|
+
|
|
817
|
+
type BhNavItemEvents = { onBhClick: EventName<CustomEvent<void>> };
|
|
818
|
+
|
|
819
|
+
export const BhNavItem: StencilReactComponent<BhNavItemElement, BhNavItemEvents> = /*@__PURE__*/ createComponent<BhNavItemElement, BhNavItemEvents>({
|
|
820
|
+
tagName: 'bh-nav-item',
|
|
821
|
+
elementClass: BhNavItemElement,
|
|
822
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
823
|
+
react: React,
|
|
824
|
+
events: { onBhClick: 'bhClick' } as BhNavItemEvents,
|
|
825
|
+
defineCustomElement: defineBhNavItem
|
|
826
|
+
});
|
|
827
|
+
|
|
828
|
+
type BhNotificationEvents = {
|
|
829
|
+
onBhAction: EventName<CustomEvent<void>>,
|
|
830
|
+
onBhDismiss: EventName<CustomEvent<void>>,
|
|
831
|
+
onBhClose: EventName<CustomEvent<void>>
|
|
832
|
+
};
|
|
833
|
+
|
|
834
|
+
export const BhNotification: StencilReactComponent<BhNotificationElement, BhNotificationEvents> = /*@__PURE__*/ createComponent<BhNotificationElement, BhNotificationEvents>({
|
|
835
|
+
tagName: 'bh-notification',
|
|
836
|
+
elementClass: BhNotificationElement,
|
|
837
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
838
|
+
react: React,
|
|
839
|
+
events: {
|
|
840
|
+
onBhAction: 'bhAction',
|
|
841
|
+
onBhDismiss: 'bhDismiss',
|
|
842
|
+
onBhClose: 'bhClose'
|
|
843
|
+
} as BhNotificationEvents,
|
|
844
|
+
defineCustomElement: defineBhNotification
|
|
845
|
+
});
|
|
846
|
+
|
|
847
|
+
type BhPageNavigationEvents = { onBhItemClick: EventName<CustomEvent<{ itemId: string; childIndex?: number }>> };
|
|
848
|
+
|
|
849
|
+
export const BhPageNavigation: StencilReactComponent<BhPageNavigationElement, BhPageNavigationEvents> = /*@__PURE__*/ createComponent<BhPageNavigationElement, BhPageNavigationEvents>({
|
|
850
|
+
tagName: 'bh-page-navigation',
|
|
851
|
+
elementClass: BhPageNavigationElement,
|
|
852
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
853
|
+
react: React,
|
|
854
|
+
events: { onBhItemClick: 'bhItemClick' } as BhPageNavigationEvents,
|
|
855
|
+
defineCustomElement: defineBhPageNavigation
|
|
856
|
+
});
|
|
857
|
+
|
|
858
|
+
type BhPageNavigationChildEvents = { onBhItemClick: EventName<CustomEvent<void>> };
|
|
859
|
+
|
|
860
|
+
export const BhPageNavigationChild: StencilReactComponent<BhPageNavigationChildElement, BhPageNavigationChildEvents> = /*@__PURE__*/ createComponent<BhPageNavigationChildElement, BhPageNavigationChildEvents>({
|
|
861
|
+
tagName: 'bh-page-navigation-child',
|
|
862
|
+
elementClass: BhPageNavigationChildElement,
|
|
863
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
864
|
+
react: React,
|
|
865
|
+
events: { onBhItemClick: 'bhItemClick' } as BhPageNavigationChildEvents,
|
|
866
|
+
defineCustomElement: defineBhPageNavigationChild
|
|
867
|
+
});
|
|
868
|
+
|
|
869
|
+
type BhPageNavigationMultiLevelEvents = {
|
|
870
|
+
onBhToggle: EventName<CustomEvent<void>>,
|
|
871
|
+
onBhChildClick: EventName<CustomEvent<number>>,
|
|
872
|
+
onBhAddClick: EventName<CustomEvent<void>>
|
|
873
|
+
};
|
|
874
|
+
|
|
875
|
+
export const BhPageNavigationMultiLevel: StencilReactComponent<BhPageNavigationMultiLevelElement, BhPageNavigationMultiLevelEvents> = /*@__PURE__*/ createComponent<BhPageNavigationMultiLevelElement, BhPageNavigationMultiLevelEvents>({
|
|
876
|
+
tagName: 'bh-page-navigation-multi-level',
|
|
877
|
+
elementClass: BhPageNavigationMultiLevelElement,
|
|
878
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
879
|
+
react: React,
|
|
880
|
+
events: {
|
|
881
|
+
onBhToggle: 'bhToggle',
|
|
882
|
+
onBhChildClick: 'bhChildClick',
|
|
883
|
+
onBhAddClick: 'bhAddClick'
|
|
884
|
+
} as BhPageNavigationMultiLevelEvents,
|
|
885
|
+
defineCustomElement: defineBhPageNavigationMultiLevel
|
|
886
|
+
});
|
|
887
|
+
|
|
888
|
+
type BhPageNavigationSingleLevelEvents = { onBhItemClick: EventName<CustomEvent<void>> };
|
|
889
|
+
|
|
890
|
+
export const BhPageNavigationSingleLevel: StencilReactComponent<BhPageNavigationSingleLevelElement, BhPageNavigationSingleLevelEvents> = /*@__PURE__*/ createComponent<BhPageNavigationSingleLevelElement, BhPageNavigationSingleLevelEvents>({
|
|
891
|
+
tagName: 'bh-page-navigation-single-level',
|
|
892
|
+
elementClass: BhPageNavigationSingleLevelElement,
|
|
893
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
894
|
+
react: React,
|
|
895
|
+
events: { onBhItemClick: 'bhItemClick' } as BhPageNavigationSingleLevelEvents,
|
|
896
|
+
defineCustomElement: defineBhPageNavigationSingleLevel
|
|
897
|
+
});
|
|
898
|
+
|
|
899
|
+
type BhPaginationEvents = {
|
|
900
|
+
onBhPageChange: EventName<BhPaginationCustomEvent<PaginationChangeEvent>>,
|
|
901
|
+
onBhPageSizeChange: EventName<BhPaginationCustomEvent<PaginationChangeEvent>>
|
|
902
|
+
};
|
|
903
|
+
|
|
904
|
+
export const BhPagination: StencilReactComponent<BhPaginationElement, BhPaginationEvents> = /*@__PURE__*/ createComponent<BhPaginationElement, BhPaginationEvents>({
|
|
905
|
+
tagName: 'bh-pagination',
|
|
906
|
+
elementClass: BhPaginationElement,
|
|
907
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
908
|
+
react: React,
|
|
909
|
+
events: {
|
|
910
|
+
onBhPageChange: 'bhPageChange',
|
|
911
|
+
onBhPageSizeChange: 'bhPageSizeChange'
|
|
912
|
+
} as BhPaginationEvents,
|
|
913
|
+
defineCustomElement: defineBhPagination
|
|
914
|
+
});
|
|
915
|
+
|
|
916
|
+
type BhPickerMenuEvents = {
|
|
917
|
+
onBhChange: EventName<BhPickerMenuCustomEvent<MonthYear | null>>,
|
|
918
|
+
onBhMonthYearSelect: EventName<BhPickerMenuCustomEvent<MonthYear>>,
|
|
919
|
+
onBhCancel: EventName<CustomEvent<void>>,
|
|
920
|
+
onBhApply: EventName<CustomEvent<void>>,
|
|
921
|
+
onBhToday: EventName<CustomEvent<void>>
|
|
922
|
+
};
|
|
923
|
+
|
|
924
|
+
export const BhPickerMenu: StencilReactComponent<BhPickerMenuElement, BhPickerMenuEvents> = /*@__PURE__*/ createComponent<BhPickerMenuElement, BhPickerMenuEvents>({
|
|
925
|
+
tagName: 'bh-picker-menu',
|
|
926
|
+
elementClass: BhPickerMenuElement,
|
|
927
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
928
|
+
react: React,
|
|
929
|
+
events: {
|
|
930
|
+
onBhChange: 'bhChange',
|
|
931
|
+
onBhMonthYearSelect: 'bhMonthYearSelect',
|
|
932
|
+
onBhCancel: 'bhCancel',
|
|
933
|
+
onBhApply: 'bhApply',
|
|
934
|
+
onBhToday: 'bhToday'
|
|
935
|
+
} as BhPickerMenuEvents,
|
|
936
|
+
defineCustomElement: defineBhPickerMenu
|
|
937
|
+
});
|
|
938
|
+
|
|
939
|
+
type BhPieChartEvents = NonNullable<unknown>;
|
|
940
|
+
|
|
941
|
+
export const BhPieChart: StencilReactComponent<BhPieChartElement, BhPieChartEvents> = /*@__PURE__*/ createComponent<BhPieChartElement, BhPieChartEvents>({
|
|
942
|
+
tagName: 'bh-pie-chart',
|
|
943
|
+
elementClass: BhPieChartElement,
|
|
944
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
945
|
+
react: React,
|
|
946
|
+
events: {} as BhPieChartEvents,
|
|
947
|
+
defineCustomElement: defineBhPieChart
|
|
948
|
+
});
|
|
949
|
+
|
|
950
|
+
type BhPopoverEvents = {
|
|
951
|
+
onBhItemSelect: EventName<BhPopoverCustomEvent<PopoverItem>>,
|
|
952
|
+
onBhPortfolioClick: EventName<CustomEvent<void>>,
|
|
953
|
+
onBhSearchChange: EventName<CustomEvent<string>>
|
|
954
|
+
};
|
|
955
|
+
|
|
956
|
+
export const BhPopover: StencilReactComponent<BhPopoverElement, BhPopoverEvents> = /*@__PURE__*/ createComponent<BhPopoverElement, BhPopoverEvents>({
|
|
957
|
+
tagName: 'bh-popover',
|
|
958
|
+
elementClass: BhPopoverElement,
|
|
959
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
960
|
+
react: React,
|
|
961
|
+
events: {
|
|
962
|
+
onBhItemSelect: 'bhItemSelect',
|
|
963
|
+
onBhPortfolioClick: 'bhPortfolioClick',
|
|
964
|
+
onBhSearchChange: 'bhSearchChange'
|
|
965
|
+
} as BhPopoverEvents,
|
|
966
|
+
defineCustomElement: defineBhPopover
|
|
967
|
+
});
|
|
968
|
+
|
|
969
|
+
type BhProductSwitcherEvents = {
|
|
970
|
+
onBhClose: EventName<CustomEvent<void>>,
|
|
971
|
+
onBhProductSelect: EventName<BhProductSwitcherCustomEvent<BhProduct>>
|
|
972
|
+
};
|
|
973
|
+
|
|
974
|
+
export const BhProductSwitcher: StencilReactComponent<BhProductSwitcherElement, BhProductSwitcherEvents> = /*@__PURE__*/ createComponent<BhProductSwitcherElement, BhProductSwitcherEvents>({
|
|
975
|
+
tagName: 'bh-product-switcher',
|
|
976
|
+
elementClass: BhProductSwitcherElement,
|
|
977
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
978
|
+
react: React,
|
|
979
|
+
events: {
|
|
980
|
+
onBhClose: 'bhClose',
|
|
981
|
+
onBhProductSelect: 'bhProductSelect'
|
|
982
|
+
} as BhProductSwitcherEvents,
|
|
983
|
+
defineCustomElement: defineBhProductSwitcher
|
|
984
|
+
});
|
|
985
|
+
|
|
986
|
+
type BhPropertySwitcherEvents = { onBhPropertyChange: EventName<BhPropertySwitcherCustomEvent<PropertyOption>> };
|
|
987
|
+
|
|
988
|
+
export const BhPropertySwitcher: StencilReactComponent<BhPropertySwitcherElement, BhPropertySwitcherEvents> = /*@__PURE__*/ createComponent<BhPropertySwitcherElement, BhPropertySwitcherEvents>({
|
|
989
|
+
tagName: 'bh-property-switcher',
|
|
990
|
+
elementClass: BhPropertySwitcherElement,
|
|
991
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
992
|
+
react: React,
|
|
993
|
+
events: { onBhPropertyChange: 'bhPropertyChange' } as BhPropertySwitcherEvents,
|
|
994
|
+
defineCustomElement: defineBhPropertySwitcher
|
|
995
|
+
});
|
|
996
|
+
|
|
997
|
+
type BhRadioButtonEvents = { onBhChange: EventName<CustomEvent<string>> };
|
|
998
|
+
|
|
999
|
+
export const BhRadioButton: StencilReactComponent<BhRadioButtonElement, BhRadioButtonEvents> = /*@__PURE__*/ createComponent<BhRadioButtonElement, BhRadioButtonEvents>({
|
|
1000
|
+
tagName: 'bh-radio-button',
|
|
1001
|
+
elementClass: BhRadioButtonElement,
|
|
1002
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
1003
|
+
react: React,
|
|
1004
|
+
events: { onBhChange: 'bhChange' } as BhRadioButtonEvents,
|
|
1005
|
+
defineCustomElement: defineBhRadioButton
|
|
1006
|
+
});
|
|
1007
|
+
|
|
1008
|
+
type BhSidebarEvents = {
|
|
1009
|
+
onBhMenuItemClick: EventName<CustomEvent<string>>,
|
|
1010
|
+
onBhSearchClick: EventName<CustomEvent<void>>,
|
|
1011
|
+
onBhAvatarMenuClick: EventName<BhSidebarCustomEvent<DropdownMenuItem>>
|
|
1012
|
+
};
|
|
1013
|
+
|
|
1014
|
+
export const BhSidebar: StencilReactComponent<BhSidebarElement, BhSidebarEvents> = /*@__PURE__*/ createComponent<BhSidebarElement, BhSidebarEvents>({
|
|
1015
|
+
tagName: 'bh-sidebar',
|
|
1016
|
+
elementClass: BhSidebarElement,
|
|
1017
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
1018
|
+
react: React,
|
|
1019
|
+
events: {
|
|
1020
|
+
onBhMenuItemClick: 'bhMenuItemClick',
|
|
1021
|
+
onBhSearchClick: 'bhSearchClick',
|
|
1022
|
+
onBhAvatarMenuClick: 'bhAvatarMenuClick'
|
|
1023
|
+
} as BhSidebarEvents,
|
|
1024
|
+
defineCustomElement: defineBhSidebar
|
|
1025
|
+
});
|
|
1026
|
+
|
|
1027
|
+
type BhSkeletonLoaderEvents = NonNullable<unknown>;
|
|
1028
|
+
|
|
1029
|
+
export const BhSkeletonLoader: StencilReactComponent<BhSkeletonLoaderElement, BhSkeletonLoaderEvents> = /*@__PURE__*/ createComponent<BhSkeletonLoaderElement, BhSkeletonLoaderEvents>({
|
|
1030
|
+
tagName: 'bh-skeleton-loader',
|
|
1031
|
+
elementClass: BhSkeletonLoaderElement,
|
|
1032
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
1033
|
+
react: React,
|
|
1034
|
+
events: {} as BhSkeletonLoaderEvents,
|
|
1035
|
+
defineCustomElement: defineBhSkeletonLoader
|
|
1036
|
+
});
|
|
1037
|
+
|
|
1038
|
+
type BhTabItemEvents = { onBhTabItemClick: EventName<CustomEvent<string>> };
|
|
1039
|
+
|
|
1040
|
+
export const BhTabItem: StencilReactComponent<BhTabItemElement, BhTabItemEvents> = /*@__PURE__*/ createComponent<BhTabItemElement, BhTabItemEvents>({
|
|
1041
|
+
tagName: 'bh-tab-item',
|
|
1042
|
+
elementClass: BhTabItemElement,
|
|
1043
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
1044
|
+
react: React,
|
|
1045
|
+
events: { onBhTabItemClick: 'bhTabItemClick' } as BhTabItemEvents,
|
|
1046
|
+
defineCustomElement: defineBhTabItem
|
|
1047
|
+
});
|
|
1048
|
+
|
|
1049
|
+
type BhTabsEvents = { onBhTabChange: EventName<CustomEvent<string>> };
|
|
1050
|
+
|
|
1051
|
+
export const BhTabs: StencilReactComponent<BhTabsElement, BhTabsEvents> = /*@__PURE__*/ createComponent<BhTabsElement, BhTabsEvents>({
|
|
1052
|
+
tagName: 'bh-tabs',
|
|
1053
|
+
elementClass: BhTabsElement,
|
|
1054
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
1055
|
+
react: React,
|
|
1056
|
+
events: { onBhTabChange: 'bhTabChange' } as BhTabsEvents,
|
|
1057
|
+
defineCustomElement: defineBhTabs
|
|
1058
|
+
});
|
|
1059
|
+
|
|
1060
|
+
type BhTagEvents = { onBhDismiss: EventName<CustomEvent<void>> };
|
|
1061
|
+
|
|
1062
|
+
export const BhTag: StencilReactComponent<BhTagElement, BhTagEvents> = /*@__PURE__*/ createComponent<BhTagElement, BhTagEvents>({
|
|
1063
|
+
tagName: 'bh-tag',
|
|
1064
|
+
elementClass: BhTagElement,
|
|
1065
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
1066
|
+
react: React,
|
|
1067
|
+
events: { onBhDismiss: 'bhDismiss' } as BhTagEvents,
|
|
1068
|
+
defineCustomElement: defineBhTag
|
|
1069
|
+
});
|
|
1070
|
+
|
|
1071
|
+
type BhTextareaEvents = {
|
|
1072
|
+
onBhInput: EventName<CustomEvent<string>>,
|
|
1073
|
+
onBhFocus: EventName<CustomEvent<void>>,
|
|
1074
|
+
onBhBlur: EventName<CustomEvent<void>>,
|
|
1075
|
+
onBhHelpClick: EventName<CustomEvent<void>>
|
|
1076
|
+
};
|
|
1077
|
+
|
|
1078
|
+
export const BhTextarea: StencilReactComponent<BhTextareaElement, BhTextareaEvents> = /*@__PURE__*/ createComponent<BhTextareaElement, BhTextareaEvents>({
|
|
1079
|
+
tagName: 'bh-textarea',
|
|
1080
|
+
elementClass: BhTextareaElement,
|
|
1081
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
1082
|
+
react: React,
|
|
1083
|
+
events: {
|
|
1084
|
+
onBhInput: 'bhInput',
|
|
1085
|
+
onBhFocus: 'bhFocus',
|
|
1086
|
+
onBhBlur: 'bhBlur',
|
|
1087
|
+
onBhHelpClick: 'bhHelpClick'
|
|
1088
|
+
} as BhTextareaEvents,
|
|
1089
|
+
defineCustomElement: defineBhTextarea
|
|
1090
|
+
});
|
|
1091
|
+
|
|
1092
|
+
type BhToggleEvents = { onBhChange: EventName<CustomEvent<boolean>> };
|
|
1093
|
+
|
|
1094
|
+
export const BhToggle: StencilReactComponent<BhToggleElement, BhToggleEvents> = /*@__PURE__*/ createComponent<BhToggleElement, BhToggleEvents>({
|
|
1095
|
+
tagName: 'bh-toggle',
|
|
1096
|
+
elementClass: BhToggleElement,
|
|
1097
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
1098
|
+
react: React,
|
|
1099
|
+
events: { onBhChange: 'bhChange' } as BhToggleEvents,
|
|
1100
|
+
defineCustomElement: defineBhToggle
|
|
1101
|
+
});
|
|
1102
|
+
|
|
1103
|
+
type BhTooltipEvents = NonNullable<unknown>;
|
|
1104
|
+
|
|
1105
|
+
export const BhTooltip: StencilReactComponent<BhTooltipElement, BhTooltipEvents> = /*@__PURE__*/ createComponent<BhTooltipElement, BhTooltipEvents>({
|
|
1106
|
+
tagName: 'bh-tooltip',
|
|
1107
|
+
elementClass: BhTooltipElement,
|
|
1108
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
1109
|
+
react: React,
|
|
1110
|
+
events: {} as BhTooltipEvents,
|
|
1111
|
+
defineCustomElement: defineBhTooltip
|
|
1112
|
+
});
|
|
1113
|
+
|
|
1114
|
+
type BhTrendChartEvents = NonNullable<unknown>;
|
|
1115
|
+
|
|
1116
|
+
export const BhTrendChart: StencilReactComponent<BhTrendChartElement, BhTrendChartEvents> = /*@__PURE__*/ createComponent<BhTrendChartElement, BhTrendChartEvents>({
|
|
1117
|
+
tagName: 'bh-trend-chart',
|
|
1118
|
+
elementClass: BhTrendChartElement,
|
|
1119
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
1120
|
+
react: React,
|
|
1121
|
+
events: {} as BhTrendChartEvents,
|
|
1122
|
+
defineCustomElement: defineBhTrendChart
|
|
1123
|
+
});
|
|
1124
|
+
|
|
1125
|
+
================
|
|
1126
|
+
File: src/components/stencil-generated/index.ts
|
|
1127
|
+
================
|
|
1128
|
+
/**
|
|
1129
|
+
* Auto-generated React wrapper components
|
|
1130
|
+
*
|
|
1131
|
+
* This file exports all React wrapper components generated by @stencil/react-output-target.
|
|
1132
|
+
*/
|
|
1133
|
+
|
|
1134
|
+
export * from './components';
|
|
1135
|
+
|
|
1136
|
+
================
|
|
1137
|
+
File: src/components/table/DataTable.tsx
|
|
1138
|
+
================
|
|
1139
|
+
/**
|
|
1140
|
+
* BhDataTable - Dynamic Table with TanStack Table
|
|
1141
|
+
*
|
|
1142
|
+
* A composable data table component that combines Bellhop table primitives
|
|
1143
|
+
* with TanStack Table for sorting, filtering, pagination, selection,
|
|
1144
|
+
* expansion, grouping, and editing.
|
|
1145
|
+
* Uses existing Bellhop components where possible.
|
|
1146
|
+
*/
|
|
1147
|
+
|
|
1148
|
+
import React, {
|
|
1149
|
+
useState,
|
|
1150
|
+
useMemo,
|
|
1151
|
+
useRef,
|
|
1152
|
+
useEffect,
|
|
1153
|
+
useCallback,
|
|
1154
|
+
} from 'react';
|
|
1155
|
+
import {
|
|
1156
|
+
useReactTable,
|
|
1157
|
+
getCoreRowModel,
|
|
1158
|
+
getSortedRowModel,
|
|
1159
|
+
getFilteredRowModel,
|
|
1160
|
+
getPaginationRowModel,
|
|
1161
|
+
getExpandedRowModel,
|
|
1162
|
+
getGroupedRowModel,
|
|
1163
|
+
flexRender,
|
|
1164
|
+
ColumnDef,
|
|
1165
|
+
SortingState,
|
|
1166
|
+
ColumnFiltersState,
|
|
1167
|
+
RowSelectionState,
|
|
1168
|
+
ExpandedState,
|
|
1169
|
+
PaginationState,
|
|
1170
|
+
GroupingState,
|
|
1171
|
+
VisibilityState,
|
|
1172
|
+
Row,
|
|
1173
|
+
Column,
|
|
1174
|
+
Cell,
|
|
1175
|
+
Table as TanStackTable,
|
|
1176
|
+
} from '@tanstack/react-table';
|
|
1177
|
+
|
|
1178
|
+
import {
|
|
1179
|
+
Table,
|
|
1180
|
+
TableWrapper,
|
|
1181
|
+
TableHead,
|
|
1182
|
+
TableBody,
|
|
1183
|
+
TableRow,
|
|
1184
|
+
TableHeaderCell,
|
|
1185
|
+
TableCell,
|
|
1186
|
+
TableEmpty,
|
|
1187
|
+
TableActionBar,
|
|
1188
|
+
TablePagination,
|
|
1189
|
+
TableSize,
|
|
1190
|
+
TableVariant,
|
|
1191
|
+
} from './index';
|
|
1192
|
+
|
|
1193
|
+
// Import existing Bellhop components
|
|
1194
|
+
import { BhButtonIcon, BhInputText } from '../stencil-generated';
|
|
1195
|
+
|
|
1196
|
+
// =============================================================================
|
|
1197
|
+
// Types
|
|
1198
|
+
// =============================================================================
|
|
1199
|
+
|
|
1200
|
+
export type EditMode = 'cell' | 'row';
|
|
1201
|
+
|
|
1202
|
+
export interface EditState {
|
|
1203
|
+
rowId: string | null;
|
|
1204
|
+
columnId: string | null; // null means entire row in 'row' mode
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
export interface EditingValues {
|
|
1208
|
+
[columnId: string]: unknown;
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
export interface RowChanges<TData> {
|
|
1212
|
+
rowId: string;
|
|
1213
|
+
rowIndex: number;
|
|
1214
|
+
originalRow: TData;
|
|
1215
|
+
changes: Record<string, unknown>;
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
export interface DataTableColumnMeta {
|
|
1219
|
+
editable?: boolean;
|
|
1220
|
+
editType?: 'text' | 'number' | 'date' | 'select';
|
|
1221
|
+
editOptions?: { value: string; label: string }[];
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
// Extend TanStack Table's ColumnMeta
|
|
1225
|
+
declare module '@tanstack/react-table' {
|
|
1226
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-object-type
|
|
1227
|
+
interface ColumnMeta<TData, TValue> extends DataTableColumnMeta {}
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
// =============================================================================
|
|
1231
|
+
// TableCheckbox - Controlled checkbox for table selection
|
|
1232
|
+
// Uses native input with Bellhop styling for full control compatibility
|
|
1233
|
+
// =============================================================================
|
|
1234
|
+
|
|
1235
|
+
interface TableCheckboxProps {
|
|
1236
|
+
checked: boolean;
|
|
1237
|
+
indeterminate?: boolean;
|
|
1238
|
+
disabled?: boolean;
|
|
1239
|
+
onChange: () => void;
|
|
1240
|
+
'aria-label'?: string;
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
function TableCheckbox({
|
|
1244
|
+
checked,
|
|
1245
|
+
indeterminate = false,
|
|
1246
|
+
disabled = false,
|
|
1247
|
+
onChange,
|
|
1248
|
+
'aria-label': ariaLabel,
|
|
1249
|
+
}: TableCheckboxProps) {
|
|
1250
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
1251
|
+
|
|
1252
|
+
useEffect(() => {
|
|
1253
|
+
if (inputRef.current) {
|
|
1254
|
+
inputRef.current.indeterminate = indeterminate;
|
|
1255
|
+
}
|
|
1256
|
+
}, [indeterminate]);
|
|
1257
|
+
|
|
1258
|
+
return (
|
|
1259
|
+
<label className="bh-table-checkbox">
|
|
1260
|
+
<input
|
|
1261
|
+
ref={inputRef}
|
|
1262
|
+
type="checkbox"
|
|
1263
|
+
checked={checked}
|
|
1264
|
+
disabled={disabled}
|
|
1265
|
+
onChange={onChange}
|
|
1266
|
+
aria-label={ariaLabel}
|
|
1267
|
+
className="bh-table-checkbox__input"
|
|
1268
|
+
/>
|
|
1269
|
+
<span
|
|
1270
|
+
className={`bh-table-checkbox__box ${
|
|
1271
|
+
checked || indeterminate ? 'bh-table-checkbox__box--checked' : ''
|
|
1272
|
+
} ${disabled ? 'bh-table-checkbox__box--disabled' : ''}`}
|
|
1273
|
+
>
|
|
1274
|
+
{checked && !indeterminate && (
|
|
1275
|
+
<span className="material-symbols-outlined bh-table-checkbox__icon">
|
|
1276
|
+
check
|
|
1277
|
+
</span>
|
|
1278
|
+
)}
|
|
1279
|
+
{indeterminate && (
|
|
1280
|
+
<span className="material-symbols-outlined bh-table-checkbox__icon">
|
|
1281
|
+
remove
|
|
1282
|
+
</span>
|
|
1283
|
+
)}
|
|
1284
|
+
</span>
|
|
1285
|
+
</label>
|
|
1286
|
+
);
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
// =============================================================================
|
|
1290
|
+
// DataTableProps Interface
|
|
1291
|
+
// =============================================================================
|
|
1292
|
+
|
|
1293
|
+
export interface DataTableProps<TData> {
|
|
1294
|
+
/** Table data */
|
|
1295
|
+
data: TData[];
|
|
1296
|
+
/** Column definitions */
|
|
1297
|
+
columns: ColumnDef<TData, unknown>[];
|
|
1298
|
+
/** Table size variant */
|
|
1299
|
+
size?: TableSize;
|
|
1300
|
+
/** Table style variant */
|
|
1301
|
+
variant?: TableVariant;
|
|
1302
|
+
/** Enable row selection */
|
|
1303
|
+
enableRowSelection?: boolean;
|
|
1304
|
+
/** Enable multi-row selection */
|
|
1305
|
+
enableMultiRowSelection?: boolean;
|
|
1306
|
+
/** Enable sorting */
|
|
1307
|
+
enableSorting?: boolean;
|
|
1308
|
+
/** Enable column filters */
|
|
1309
|
+
enableFiltering?: boolean;
|
|
1310
|
+
/** Enable pagination */
|
|
1311
|
+
enablePagination?: boolean;
|
|
1312
|
+
/** Enable row expansion */
|
|
1313
|
+
enableExpanding?: boolean;
|
|
1314
|
+
/** Initial page size */
|
|
1315
|
+
pageSize?: number;
|
|
1316
|
+
/** Page size options */
|
|
1317
|
+
pageSizeOptions?: number[];
|
|
1318
|
+
/** Sticky header */
|
|
1319
|
+
stickyHeader?: boolean;
|
|
1320
|
+
/** Show rounded corners */
|
|
1321
|
+
rounded?: boolean;
|
|
1322
|
+
/** Enable row hover effect */
|
|
1323
|
+
hoverable?: boolean;
|
|
1324
|
+
/** Loading state */
|
|
1325
|
+
loading?: boolean;
|
|
1326
|
+
/** Empty state title */
|
|
1327
|
+
emptyTitle?: string;
|
|
1328
|
+
/** Empty state description */
|
|
1329
|
+
emptyDescription?: string;
|
|
1330
|
+
/** Row key accessor */
|
|
1331
|
+
getRowId?: (row: TData, index: number) => string;
|
|
1332
|
+
/** Sub-rows accessor for expansion */
|
|
1333
|
+
getSubRows?: (row: TData) => TData[] | undefined;
|
|
1334
|
+
/** Render expanded row content */
|
|
1335
|
+
renderExpandedRow?: (row: Row<TData>) => React.ReactNode;
|
|
1336
|
+
/** Callback when selection changes */
|
|
1337
|
+
onSelectionChange?: (selectedRows: TData[]) => void;
|
|
1338
|
+
/** Callback when sorting changes */
|
|
1339
|
+
onSortingChange?: (sorting: SortingState) => void;
|
|
1340
|
+
/** Callback when row is clicked */
|
|
1341
|
+
onRowClick?: (row: TData) => void;
|
|
1342
|
+
/** Action bar left content */
|
|
1343
|
+
actionBarLeft?: React.ReactNode;
|
|
1344
|
+
/** Action bar right content */
|
|
1345
|
+
actionBarRight?: React.ReactNode;
|
|
1346
|
+
/** Bulk actions when rows are selected */
|
|
1347
|
+
bulkActions?: React.ReactNode;
|
|
1348
|
+
/** Maximum height for scrolling */
|
|
1349
|
+
maxHeight?: string | number;
|
|
1350
|
+
/** Class name for the wrapper */
|
|
1351
|
+
className?: string;
|
|
1352
|
+
|
|
1353
|
+
// ==========================================================================
|
|
1354
|
+
// Grouping Props
|
|
1355
|
+
// ==========================================================================
|
|
1356
|
+
|
|
1357
|
+
/** Enable row grouping */
|
|
1358
|
+
enableGrouping?: boolean;
|
|
1359
|
+
/** Column IDs to group by */
|
|
1360
|
+
groupBy?: string[];
|
|
1361
|
+
/** Callback when grouping changes */
|
|
1362
|
+
onGroupingChange?: (grouping: string[]) => void;
|
|
1363
|
+
|
|
1364
|
+
// ==========================================================================
|
|
1365
|
+
// Editing Props
|
|
1366
|
+
// ==========================================================================
|
|
1367
|
+
|
|
1368
|
+
/** Enable cell/row editing */
|
|
1369
|
+
enableEditing?: boolean;
|
|
1370
|
+
/** Edit mode: 'cell' for single cell, 'row' for entire row */
|
|
1371
|
+
editMode?: EditMode;
|
|
1372
|
+
/** Show edit action buttons in row (for row edit mode) */
|
|
1373
|
+
showEditActions?: boolean;
|
|
1374
|
+
/** Callback when edit is saved */
|
|
1375
|
+
onEditSave?: (changes: RowChanges<TData>) => void;
|
|
1376
|
+
/** Callback when edit is cancelled */
|
|
1377
|
+
onEditCancel?: (rowId: string, row: TData) => void;
|
|
1378
|
+
/** Callback when cell value changes during editing (before save) */
|
|
1379
|
+
onCellChange?: (
|
|
1380
|
+
rowId: string,
|
|
1381
|
+
columnId: string,
|
|
1382
|
+
oldValue: unknown,
|
|
1383
|
+
newValue: unknown
|
|
1384
|
+
) => void;
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
// =============================================================================
|
|
1388
|
+
// Checkbox Column Helper
|
|
1389
|
+
// =============================================================================
|
|
1390
|
+
|
|
1391
|
+
export function createSelectColumn<TData>(): ColumnDef<TData, unknown> {
|
|
1392
|
+
return {
|
|
1393
|
+
id: 'select',
|
|
1394
|
+
header: ({ table }) => (
|
|
1395
|
+
<TableCheckbox
|
|
1396
|
+
checked={table.getIsAllPageRowsSelected()}
|
|
1397
|
+
indeterminate={table.getIsSomePageRowsSelected()}
|
|
1398
|
+
onChange={() => table.toggleAllPageRowsSelected()}
|
|
1399
|
+
aria-label="Select all rows"
|
|
1400
|
+
/>
|
|
1401
|
+
),
|
|
1402
|
+
cell: ({ row }) => (
|
|
1403
|
+
<TableCheckbox
|
|
1404
|
+
checked={row.getIsSelected()}
|
|
1405
|
+
disabled={!row.getCanSelect()}
|
|
1406
|
+
onChange={() => row.toggleSelected()}
|
|
1407
|
+
aria-label="Select row"
|
|
1408
|
+
/>
|
|
1409
|
+
),
|
|
1410
|
+
size: 40,
|
|
1411
|
+
enableSorting: false,
|
|
1412
|
+
enableColumnFilter: false,
|
|
1413
|
+
enableGrouping: false,
|
|
1414
|
+
};
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
// =============================================================================
|
|
1418
|
+
// Expand Column Helper
|
|
1419
|
+
// =============================================================================
|
|
1420
|
+
|
|
1421
|
+
export function createExpandColumn<TData>(): ColumnDef<TData, unknown> {
|
|
1422
|
+
return {
|
|
1423
|
+
id: 'expand',
|
|
1424
|
+
header: () => null,
|
|
1425
|
+
cell: ({ row }) =>
|
|
1426
|
+
row.getCanExpand() ? (
|
|
1427
|
+
<BhButtonIcon
|
|
1428
|
+
iconName={row.getIsExpanded() ? 'expand_more' : 'chevron_right'}
|
|
1429
|
+
size="sm"
|
|
1430
|
+
hierarchy="quaternary"
|
|
1431
|
+
onBhClick={() => row.toggleExpanded()}
|
|
1432
|
+
aria-label={row.getIsExpanded() ? 'Collapse row' : 'Expand row'}
|
|
1433
|
+
/>
|
|
1434
|
+
) : null,
|
|
1435
|
+
size: 32,
|
|
1436
|
+
enableSorting: false,
|
|
1437
|
+
enableColumnFilter: false,
|
|
1438
|
+
enableGrouping: false,
|
|
1439
|
+
};
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
// =============================================================================
|
|
1443
|
+
// Edit Actions Column Helper
|
|
1444
|
+
// =============================================================================
|
|
1445
|
+
|
|
1446
|
+
export function createEditActionsColumn<TData>(
|
|
1447
|
+
onEdit: (rowId: string) => void,
|
|
1448
|
+
onSave: () => void,
|
|
1449
|
+
onCancel: () => void,
|
|
1450
|
+
isEditing: (rowId: string) => boolean
|
|
1451
|
+
): ColumnDef<TData, unknown> {
|
|
1452
|
+
return {
|
|
1453
|
+
id: 'edit-actions',
|
|
1454
|
+
header: () => null,
|
|
1455
|
+
cell: ({ row }) => {
|
|
1456
|
+
const rowId = row.id;
|
|
1457
|
+
const editing = isEditing(rowId);
|
|
1458
|
+
|
|
1459
|
+
if (editing) {
|
|
1460
|
+
return (
|
|
1461
|
+
<div className="bh-td--edit-actions">
|
|
1462
|
+
<BhButtonIcon
|
|
1463
|
+
iconName="check"
|
|
1464
|
+
size="sm"
|
|
1465
|
+
hierarchy="quaternary"
|
|
1466
|
+
onBhClick={() => onSave()}
|
|
1467
|
+
aria-label="Save changes"
|
|
1468
|
+
/>
|
|
1469
|
+
<BhButtonIcon
|
|
1470
|
+
iconName="close"
|
|
1471
|
+
size="sm"
|
|
1472
|
+
hierarchy="quaternary"
|
|
1473
|
+
onBhClick={() => onCancel()}
|
|
1474
|
+
aria-label="Cancel editing"
|
|
1475
|
+
/>
|
|
1476
|
+
</div>
|
|
1477
|
+
);
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1480
|
+
return (
|
|
1481
|
+
<BhButtonIcon
|
|
1482
|
+
iconName="edit"
|
|
1483
|
+
size="sm"
|
|
1484
|
+
hierarchy="quaternary"
|
|
1485
|
+
onBhClick={() => onEdit(rowId)}
|
|
1486
|
+
aria-label="Edit row"
|
|
1487
|
+
/>
|
|
1488
|
+
);
|
|
1489
|
+
},
|
|
1490
|
+
size: 80,
|
|
1491
|
+
enableSorting: false,
|
|
1492
|
+
enableColumnFilter: false,
|
|
1493
|
+
enableGrouping: false,
|
|
1494
|
+
meta: {
|
|
1495
|
+
editable: false,
|
|
1496
|
+
},
|
|
1497
|
+
};
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
// =============================================================================
|
|
1501
|
+
// DataTable Component
|
|
1502
|
+
// =============================================================================
|
|
1503
|
+
|
|
1504
|
+
export function DataTable<TData>({
|
|
1505
|
+
data,
|
|
1506
|
+
columns,
|
|
1507
|
+
size = 'default',
|
|
1508
|
+
variant = 'default',
|
|
1509
|
+
enableRowSelection = false,
|
|
1510
|
+
enableMultiRowSelection = true,
|
|
1511
|
+
enableSorting = true,
|
|
1512
|
+
enableFiltering = false,
|
|
1513
|
+
enablePagination = true,
|
|
1514
|
+
enableExpanding = false,
|
|
1515
|
+
pageSize = 10,
|
|
1516
|
+
pageSizeOptions = [10, 25, 50, 100],
|
|
1517
|
+
stickyHeader = false,
|
|
1518
|
+
rounded = false,
|
|
1519
|
+
hoverable = true,
|
|
1520
|
+
loading = false,
|
|
1521
|
+
emptyTitle = 'No data',
|
|
1522
|
+
emptyDescription = 'There are no records to display.',
|
|
1523
|
+
getRowId,
|
|
1524
|
+
getSubRows,
|
|
1525
|
+
renderExpandedRow,
|
|
1526
|
+
onSelectionChange,
|
|
1527
|
+
onSortingChange,
|
|
1528
|
+
onRowClick,
|
|
1529
|
+
actionBarLeft,
|
|
1530
|
+
actionBarRight,
|
|
1531
|
+
bulkActions,
|
|
1532
|
+
maxHeight,
|
|
1533
|
+
className,
|
|
1534
|
+
// Grouping props
|
|
1535
|
+
enableGrouping = false,
|
|
1536
|
+
groupBy = [],
|
|
1537
|
+
onGroupingChange,
|
|
1538
|
+
// Editing props
|
|
1539
|
+
enableEditing = false,
|
|
1540
|
+
editMode = 'cell',
|
|
1541
|
+
showEditActions = true,
|
|
1542
|
+
onEditSave,
|
|
1543
|
+
onEditCancel,
|
|
1544
|
+
onCellChange,
|
|
1545
|
+
}: DataTableProps<TData>) {
|
|
1546
|
+
// ==========================================================================
|
|
1547
|
+
// State
|
|
1548
|
+
// ==========================================================================
|
|
1549
|
+
|
|
1550
|
+
const [sorting, setSorting] = useState<SortingState>([]);
|
|
1551
|
+
const [columnFilters, setColumnFilters] = useState<ColumnFiltersState>([]);
|
|
1552
|
+
const [rowSelection, setRowSelection] = useState<RowSelectionState>({});
|
|
1553
|
+
const [expanded, setExpanded] = useState<ExpandedState>({});
|
|
1554
|
+
const [pagination, setPagination] = useState<PaginationState>({
|
|
1555
|
+
pageIndex: 0,
|
|
1556
|
+
pageSize,
|
|
1557
|
+
});
|
|
1558
|
+
const [globalFilter, setGlobalFilter] = useState('');
|
|
1559
|
+
|
|
1560
|
+
// Grouping state
|
|
1561
|
+
const [grouping, setGrouping] = useState<GroupingState>(groupBy);
|
|
1562
|
+
|
|
1563
|
+
// Editing state
|
|
1564
|
+
const [editState, setEditState] = useState<EditState>({
|
|
1565
|
+
rowId: null,
|
|
1566
|
+
columnId: null,
|
|
1567
|
+
});
|
|
1568
|
+
const [editingValues, setEditingValues] = useState<EditingValues>({});
|
|
1569
|
+
|
|
1570
|
+
// Sync groupBy prop with internal state
|
|
1571
|
+
useEffect(() => {
|
|
1572
|
+
setGrouping(groupBy);
|
|
1573
|
+
}, [groupBy]);
|
|
1574
|
+
|
|
1575
|
+
// Track previous rowSelection to detect changes for onSelectionChange callback
|
|
1576
|
+
const prevRowSelectionRef = useRef<RowSelectionState>(rowSelection);
|
|
1577
|
+
|
|
1578
|
+
// Compute column visibility to hide grouping columns when grouping is enabled
|
|
1579
|
+
const columnVisibility = useMemo<VisibilityState>(() => {
|
|
1580
|
+
if (!enableGrouping || grouping.length === 0) {
|
|
1581
|
+
return {};
|
|
1582
|
+
}
|
|
1583
|
+
// Hide all columns that are being used for grouping
|
|
1584
|
+
const visibility: VisibilityState = {};
|
|
1585
|
+
grouping.forEach((columnId) => {
|
|
1586
|
+
visibility[columnId] = false;
|
|
1587
|
+
});
|
|
1588
|
+
return visibility;
|
|
1589
|
+
}, [enableGrouping, grouping]);
|
|
1590
|
+
|
|
1591
|
+
// ==========================================================================
|
|
1592
|
+
// Editing Handlers
|
|
1593
|
+
// ==========================================================================
|
|
1594
|
+
|
|
1595
|
+
const isEditing = useCallback(
|
|
1596
|
+
(rowId: string, columnId?: string): boolean => {
|
|
1597
|
+
if (editState.rowId !== rowId) return false;
|
|
1598
|
+
|
|
1599
|
+
if (editMode === 'cell') {
|
|
1600
|
+
return columnId ? editState.columnId === columnId : false;
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
return true; // Row mode - entire row is editing
|
|
1604
|
+
},
|
|
1605
|
+
[editState, editMode]
|
|
1606
|
+
);
|
|
1607
|
+
|
|
1608
|
+
const isRowEditing = useCallback(
|
|
1609
|
+
(rowId: string): boolean => {
|
|
1610
|
+
return editState.rowId === rowId;
|
|
1611
|
+
},
|
|
1612
|
+
[editState.rowId]
|
|
1613
|
+
);
|
|
1614
|
+
|
|
1615
|
+
const startEditing = useCallback(
|
|
1616
|
+
(rowId: string, columnId?: string) => {
|
|
1617
|
+
// Initialize editing values from current row
|
|
1618
|
+
const initialValues: EditingValues = {};
|
|
1619
|
+
columns.forEach((col) => {
|
|
1620
|
+
const colId =
|
|
1621
|
+
'accessorKey' in col
|
|
1622
|
+
? String(col.accessorKey)
|
|
1623
|
+
: 'id' in col
|
|
1624
|
+
? col.id
|
|
1625
|
+
: '';
|
|
1626
|
+
if (colId && col.meta?.editable !== false) {
|
|
1627
|
+
// Find row data
|
|
1628
|
+
const rowIndex = data.findIndex(
|
|
1629
|
+
(_, i) => (getRowId ? getRowId(data[i], i) : String(i)) === rowId
|
|
1630
|
+
);
|
|
1631
|
+
if (rowIndex !== -1) {
|
|
1632
|
+
const row = data[rowIndex];
|
|
1633
|
+
initialValues[colId] = (row as Record<string, unknown>)[colId];
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
1636
|
+
});
|
|
1637
|
+
|
|
1638
|
+
setEditingValues(initialValues);
|
|
1639
|
+
setEditState({
|
|
1640
|
+
rowId,
|
|
1641
|
+
columnId: editMode === 'cell' ? columnId || null : null,
|
|
1642
|
+
});
|
|
1643
|
+
},
|
|
1644
|
+
[columns, data, editMode, getRowId]
|
|
1645
|
+
);
|
|
1646
|
+
|
|
1647
|
+
const cancelEditing = useCallback(() => {
|
|
1648
|
+
if (!editState.rowId) return;
|
|
1649
|
+
|
|
1650
|
+
const rowIndex = data.findIndex(
|
|
1651
|
+
(_, i) =>
|
|
1652
|
+
(getRowId ? getRowId(data[i], i) : String(i)) === editState.rowId
|
|
1653
|
+
);
|
|
1654
|
+
if (rowIndex !== -1) {
|
|
1655
|
+
onEditCancel?.(editState.rowId, data[rowIndex]);
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
setEditState({ rowId: null, columnId: null });
|
|
1659
|
+
setEditingValues({});
|
|
1660
|
+
}, [editState.rowId, data, getRowId, onEditCancel]);
|
|
1661
|
+
|
|
1662
|
+
const saveEditing = useCallback(() => {
|
|
1663
|
+
if (!editState.rowId) return;
|
|
1664
|
+
|
|
1665
|
+
const rowIndex = data.findIndex(
|
|
1666
|
+
(_, i) =>
|
|
1667
|
+
(getRowId ? getRowId(data[i], i) : String(i)) === editState.rowId
|
|
1668
|
+
);
|
|
1669
|
+
if (rowIndex === -1) return;
|
|
1670
|
+
|
|
1671
|
+
const originalRow = data[rowIndex];
|
|
1672
|
+
const changes: Record<string, unknown> = {};
|
|
1673
|
+
|
|
1674
|
+
// Determine what changed
|
|
1675
|
+
Object.entries(editingValues).forEach(([columnId, newValue]) => {
|
|
1676
|
+
const originalValue = (originalRow as Record<string, unknown>)[columnId];
|
|
1677
|
+
if (originalValue !== newValue) {
|
|
1678
|
+
changes[columnId] = newValue;
|
|
1679
|
+
}
|
|
1680
|
+
});
|
|
1681
|
+
|
|
1682
|
+
if (Object.keys(changes).length > 0) {
|
|
1683
|
+
onEditSave?.({
|
|
1684
|
+
rowId: editState.rowId,
|
|
1685
|
+
rowIndex,
|
|
1686
|
+
originalRow,
|
|
1687
|
+
changes,
|
|
1688
|
+
});
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
setEditState({ rowId: null, columnId: null });
|
|
1692
|
+
setEditingValues({});
|
|
1693
|
+
}, [editState.rowId, editingValues, data, getRowId, onEditSave]);
|
|
1694
|
+
|
|
1695
|
+
const handleEditValueChange = useCallback(
|
|
1696
|
+
(columnId: string, newValue: unknown) => {
|
|
1697
|
+
const oldValue = editingValues[columnId];
|
|
1698
|
+
|
|
1699
|
+
setEditingValues((prev) => ({
|
|
1700
|
+
...prev,
|
|
1701
|
+
[columnId]: newValue,
|
|
1702
|
+
}));
|
|
1703
|
+
|
|
1704
|
+
if (editState.rowId) {
|
|
1705
|
+
onCellChange?.(editState.rowId, columnId, oldValue, newValue);
|
|
1706
|
+
}
|
|
1707
|
+
},
|
|
1708
|
+
[editingValues, editState.rowId, onCellChange]
|
|
1709
|
+
);
|
|
1710
|
+
|
|
1711
|
+
const handleEditKeyDown = useCallback(
|
|
1712
|
+
(e: React.KeyboardEvent, columnId: string) => {
|
|
1713
|
+
if (e.key === 'Enter') {
|
|
1714
|
+
e.preventDefault();
|
|
1715
|
+
saveEditing();
|
|
1716
|
+
} else if (e.key === 'Escape') {
|
|
1717
|
+
e.preventDefault();
|
|
1718
|
+
cancelEditing();
|
|
1719
|
+
} else if (e.key === 'Tab' && editMode === 'cell') {
|
|
1720
|
+
e.preventDefault();
|
|
1721
|
+
// Move to next editable cell
|
|
1722
|
+
const editableColumns = columns.filter(
|
|
1723
|
+
(col) => col.meta?.editable !== false
|
|
1724
|
+
);
|
|
1725
|
+
const currentIndex = editableColumns.findIndex((c) => {
|
|
1726
|
+
const colId =
|
|
1727
|
+
'accessorKey' in c
|
|
1728
|
+
? String(c.accessorKey)
|
|
1729
|
+
: 'id' in c
|
|
1730
|
+
? c.id
|
|
1731
|
+
: '';
|
|
1732
|
+
return colId === columnId;
|
|
1733
|
+
});
|
|
1734
|
+
|
|
1735
|
+
if (currentIndex !== -1) {
|
|
1736
|
+
const nextIndex = e.shiftKey ? currentIndex - 1 : currentIndex + 1;
|
|
1737
|
+
|
|
1738
|
+
if (nextIndex >= 0 && nextIndex < editableColumns.length) {
|
|
1739
|
+
const nextCol = editableColumns[nextIndex];
|
|
1740
|
+
const nextColId =
|
|
1741
|
+
'accessorKey' in nextCol
|
|
1742
|
+
? String(nextCol.accessorKey)
|
|
1743
|
+
: 'id' in nextCol
|
|
1744
|
+
? nextCol.id
|
|
1745
|
+
: '';
|
|
1746
|
+
setEditState((prev) => ({
|
|
1747
|
+
...prev,
|
|
1748
|
+
columnId: nextColId || null,
|
|
1749
|
+
}));
|
|
1750
|
+
} else {
|
|
1751
|
+
saveEditing();
|
|
1752
|
+
}
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
},
|
|
1756
|
+
[editMode, columns, saveEditing, cancelEditing]
|
|
1757
|
+
);
|
|
1758
|
+
|
|
1759
|
+
// ==========================================================================
|
|
1760
|
+
// Build columns with selection/expansion/editing if enabled
|
|
1761
|
+
// ==========================================================================
|
|
1762
|
+
|
|
1763
|
+
const tableColumns = useMemo(() => {
|
|
1764
|
+
const cols: ColumnDef<TData, unknown>[] = [];
|
|
1765
|
+
|
|
1766
|
+
if (enableExpanding && !enableGrouping) {
|
|
1767
|
+
cols.push(createExpandColumn<TData>());
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
if (enableRowSelection) {
|
|
1771
|
+
cols.push(createSelectColumn<TData>());
|
|
1772
|
+
}
|
|
1773
|
+
|
|
1774
|
+
cols.push(...columns);
|
|
1775
|
+
|
|
1776
|
+
if (enableEditing && editMode === 'row' && showEditActions) {
|
|
1777
|
+
cols.push(
|
|
1778
|
+
createEditActionsColumn<TData>(
|
|
1779
|
+
startEditing,
|
|
1780
|
+
saveEditing,
|
|
1781
|
+
cancelEditing,
|
|
1782
|
+
isRowEditing
|
|
1783
|
+
)
|
|
1784
|
+
);
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
return cols;
|
|
1788
|
+
}, [
|
|
1789
|
+
columns,
|
|
1790
|
+
enableRowSelection,
|
|
1791
|
+
enableExpanding,
|
|
1792
|
+
enableGrouping,
|
|
1793
|
+
enableEditing,
|
|
1794
|
+
editMode,
|
|
1795
|
+
showEditActions,
|
|
1796
|
+
startEditing,
|
|
1797
|
+
saveEditing,
|
|
1798
|
+
cancelEditing,
|
|
1799
|
+
isRowEditing,
|
|
1800
|
+
]);
|
|
1801
|
+
|
|
1802
|
+
// ==========================================================================
|
|
1803
|
+
// Create table instance
|
|
1804
|
+
// ==========================================================================
|
|
1805
|
+
|
|
1806
|
+
const table = useReactTable({
|
|
1807
|
+
data,
|
|
1808
|
+
columns: tableColumns,
|
|
1809
|
+
state: {
|
|
1810
|
+
sorting,
|
|
1811
|
+
columnFilters,
|
|
1812
|
+
rowSelection,
|
|
1813
|
+
expanded,
|
|
1814
|
+
pagination,
|
|
1815
|
+
globalFilter,
|
|
1816
|
+
grouping,
|
|
1817
|
+
columnVisibility,
|
|
1818
|
+
},
|
|
1819
|
+
getRowId,
|
|
1820
|
+
getSubRows,
|
|
1821
|
+
getRowCanExpand:
|
|
1822
|
+
enableExpanding && renderExpandedRow ? () => true : undefined,
|
|
1823
|
+
enableRowSelection: enableRowSelection
|
|
1824
|
+
? enableMultiRowSelection
|
|
1825
|
+
? true
|
|
1826
|
+
: (row) => !Object.keys(rowSelection).length || rowSelection[row.id]
|
|
1827
|
+
: false,
|
|
1828
|
+
enableMultiRowSelection,
|
|
1829
|
+
enableSorting,
|
|
1830
|
+
enableFilters: enableFiltering,
|
|
1831
|
+
enableExpanding: enableExpanding || enableGrouping,
|
|
1832
|
+
enableGrouping,
|
|
1833
|
+
// Prevent TanStack Table from auto-resetting expanded state when data/columns change
|
|
1834
|
+
// This fixes the issue where grouped rows collapse when selecting items
|
|
1835
|
+
autoResetExpanded: false,
|
|
1836
|
+
onSortingChange: (updater) => {
|
|
1837
|
+
const newSorting =
|
|
1838
|
+
typeof updater === 'function' ? updater(sorting) : updater;
|
|
1839
|
+
setSorting(newSorting);
|
|
1840
|
+
onSortingChange?.(newSorting);
|
|
1841
|
+
},
|
|
1842
|
+
onColumnFiltersChange: setColumnFilters,
|
|
1843
|
+
onRowSelectionChange: (updater) => {
|
|
1844
|
+
const newSelection =
|
|
1845
|
+
typeof updater === 'function' ? updater(rowSelection) : updater;
|
|
1846
|
+
setRowSelection(newSelection);
|
|
1847
|
+
},
|
|
1848
|
+
onExpandedChange: setExpanded,
|
|
1849
|
+
onPaginationChange: setPagination,
|
|
1850
|
+
onGlobalFilterChange: setGlobalFilter,
|
|
1851
|
+
onGroupingChange: (updater) => {
|
|
1852
|
+
const newGrouping =
|
|
1853
|
+
typeof updater === 'function' ? updater(grouping) : updater;
|
|
1854
|
+
setGrouping(newGrouping);
|
|
1855
|
+
onGroupingChange?.(newGrouping);
|
|
1856
|
+
},
|
|
1857
|
+
getCoreRowModel: getCoreRowModel(),
|
|
1858
|
+
getSortedRowModel: enableSorting ? getSortedRowModel() : undefined,
|
|
1859
|
+
getFilteredRowModel: enableFiltering ? getFilteredRowModel() : undefined,
|
|
1860
|
+
// Disable pagination when grouping is enabled
|
|
1861
|
+
getPaginationRowModel:
|
|
1862
|
+
enablePagination && !enableGrouping ? getPaginationRowModel() : undefined,
|
|
1863
|
+
getExpandedRowModel:
|
|
1864
|
+
enableExpanding || enableGrouping ? getExpandedRowModel() : undefined,
|
|
1865
|
+
getGroupedRowModel: enableGrouping ? getGroupedRowModel() : undefined,
|
|
1866
|
+
});
|
|
1867
|
+
|
|
1868
|
+
// Handle selection change callback after table is stable (via useEffect)
|
|
1869
|
+
// This prevents issues with grouped rows collapsing when selecting items
|
|
1870
|
+
// IMPORTANT: We use a ref for the table to avoid the effect re-running when table changes
|
|
1871
|
+
// because table is recreated on every render, which would cause cascading state updates
|
|
1872
|
+
const tableRef = useRef(table);
|
|
1873
|
+
tableRef.current = table;
|
|
1874
|
+
|
|
1875
|
+
useEffect(() => {
|
|
1876
|
+
if (!onSelectionChange) return;
|
|
1877
|
+
if (prevRowSelectionRef.current === rowSelection) return;
|
|
1878
|
+
|
|
1879
|
+
prevRowSelectionRef.current = rowSelection;
|
|
1880
|
+
|
|
1881
|
+
// Use tableRef.current to get the latest table without adding it as a dependency
|
|
1882
|
+
const currentTable = tableRef.current;
|
|
1883
|
+
const selectedRows = Object.keys(rowSelection)
|
|
1884
|
+
.filter((key) => rowSelection[key])
|
|
1885
|
+
.map((key) => {
|
|
1886
|
+
const row = currentTable.getRow(key);
|
|
1887
|
+
return row?.original;
|
|
1888
|
+
})
|
|
1889
|
+
.filter(Boolean) as TData[];
|
|
1890
|
+
onSelectionChange(selectedRows);
|
|
1891
|
+
}, [rowSelection, onSelectionChange]);
|
|
1892
|
+
|
|
1893
|
+
// ==========================================================================
|
|
1894
|
+
// Render Helpers
|
|
1895
|
+
// ==========================================================================
|
|
1896
|
+
|
|
1897
|
+
const renderEditInput = (
|
|
1898
|
+
column: Column<TData, unknown>,
|
|
1899
|
+
cell: Cell<TData, unknown>
|
|
1900
|
+
) => {
|
|
1901
|
+
const columnId =
|
|
1902
|
+
'accessorKey' in column.columnDef
|
|
1903
|
+
? String(column.columnDef.accessorKey)
|
|
1904
|
+
: column.id;
|
|
1905
|
+
const currentValue = editingValues[columnId] ?? cell.getValue();
|
|
1906
|
+
const editType = column.columnDef.meta?.editType || 'text';
|
|
1907
|
+
const editOptions = column.columnDef.meta?.editOptions;
|
|
1908
|
+
|
|
1909
|
+
// Select type
|
|
1910
|
+
if (editType === 'select' && editOptions) {
|
|
1911
|
+
return (
|
|
1912
|
+
<select
|
|
1913
|
+
className="bh-edit-select"
|
|
1914
|
+
value={String(currentValue ?? '')}
|
|
1915
|
+
onChange={(e) => handleEditValueChange(columnId, e.target.value)}
|
|
1916
|
+
onKeyDown={(e) => handleEditKeyDown(e, columnId)}
|
|
1917
|
+
autoFocus
|
|
1918
|
+
>
|
|
1919
|
+
{editOptions.map((opt) => (
|
|
1920
|
+
<option key={opt.value} value={opt.value}>
|
|
1921
|
+
{opt.label}
|
|
1922
|
+
</option>
|
|
1923
|
+
))}
|
|
1924
|
+
</select>
|
|
1925
|
+
);
|
|
1926
|
+
}
|
|
1927
|
+
|
|
1928
|
+
// Text/Number/Date input
|
|
1929
|
+
return (
|
|
1930
|
+
<input
|
|
1931
|
+
type={
|
|
1932
|
+
editType === 'number' ? 'number' : editType === 'date' ? 'date' : 'text'
|
|
1933
|
+
}
|
|
1934
|
+
className="bh-edit-input"
|
|
1935
|
+
value={currentValue != null ? String(currentValue) : ''}
|
|
1936
|
+
onChange={(e) => {
|
|
1937
|
+
const newValue =
|
|
1938
|
+
editType === 'number' ? Number(e.target.value) : e.target.value;
|
|
1939
|
+
handleEditValueChange(columnId, newValue);
|
|
1940
|
+
}}
|
|
1941
|
+
onKeyDown={(e) => handleEditKeyDown(e, columnId)}
|
|
1942
|
+
autoFocus
|
|
1943
|
+
/>
|
|
1944
|
+
);
|
|
1945
|
+
};
|
|
1946
|
+
|
|
1947
|
+
const renderGroupRow = (row: Row<TData>) => {
|
|
1948
|
+
const groupingColumnId = row.groupingColumnId!;
|
|
1949
|
+
const groupValue = row.groupingValue;
|
|
1950
|
+
const isExpanded = row.getIsExpanded();
|
|
1951
|
+
const leafRows = row.getLeafRows();
|
|
1952
|
+
const depth = row.depth;
|
|
1953
|
+
|
|
1954
|
+
return (
|
|
1955
|
+
<TableRow
|
|
1956
|
+
key={row.id}
|
|
1957
|
+
className="bh-tr--group"
|
|
1958
|
+
onClick={() => row.toggleExpanded()}
|
|
1959
|
+
>
|
|
1960
|
+
<TableCell colSpan={tableColumns.length} className="bh-td--group-label">
|
|
1961
|
+
<div
|
|
1962
|
+
className="bh-group-content"
|
|
1963
|
+
style={{ paddingLeft: `${depth * 24}px` }}
|
|
1964
|
+
>
|
|
1965
|
+
<BhButtonIcon
|
|
1966
|
+
iconName={isExpanded ? 'expand_more' : 'chevron_right'}
|
|
1967
|
+
size="sm"
|
|
1968
|
+
hierarchy="quaternary"
|
|
1969
|
+
aria-label={isExpanded ? 'Collapse group' : 'Expand group'}
|
|
1970
|
+
/>
|
|
1971
|
+
<span className="bh-group-label__text">
|
|
1972
|
+
<span className="bh-group-label__column">{groupingColumnId}: </span>
|
|
1973
|
+
<span className="bh-group-label__value">{String(groupValue)}</span>
|
|
1974
|
+
</span>
|
|
1975
|
+
<span className="bh-group-label__count">
|
|
1976
|
+
({leafRows.length} {leafRows.length === 1 ? 'item' : 'items'})
|
|
1977
|
+
</span>
|
|
1978
|
+
</div>
|
|
1979
|
+
</TableCell>
|
|
1980
|
+
</TableRow>
|
|
1981
|
+
);
|
|
1982
|
+
};
|
|
1983
|
+
|
|
1984
|
+
const renderDataRow = (row: Row<TData>) => {
|
|
1985
|
+
const rowId = row.id;
|
|
1986
|
+
const rowIsEditing = isRowEditing(rowId);
|
|
1987
|
+
|
|
1988
|
+
return (
|
|
1989
|
+
<React.Fragment key={row.id}>
|
|
1990
|
+
<TableRow
|
|
1991
|
+
selected={row.getIsSelected()}
|
|
1992
|
+
clickable={!!onRowClick && !rowIsEditing}
|
|
1993
|
+
expandable={row.getCanExpand()}
|
|
1994
|
+
expanded={row.getIsExpanded()}
|
|
1995
|
+
className={rowIsEditing ? 'bh-tr--editing' : undefined}
|
|
1996
|
+
onClick={
|
|
1997
|
+
onRowClick && !rowIsEditing
|
|
1998
|
+
? () => onRowClick(row.original)
|
|
1999
|
+
: undefined
|
|
2000
|
+
}
|
|
2001
|
+
>
|
|
2002
|
+
{row.getVisibleCells().map((cell) => {
|
|
2003
|
+
const column = cell.column;
|
|
2004
|
+
const isCheckbox = column.id === 'select';
|
|
2005
|
+
const isExpand = column.id === 'expand';
|
|
2006
|
+
const isEditActions = column.id === 'edit-actions';
|
|
2007
|
+
const columnId =
|
|
2008
|
+
'accessorKey' in column.columnDef
|
|
2009
|
+
? String(column.columnDef.accessorKey)
|
|
2010
|
+
: column.id;
|
|
2011
|
+
const canEdit =
|
|
2012
|
+
enableEditing && column.columnDef.meta?.editable !== false;
|
|
2013
|
+
const isCellEditing = isEditing(rowId, columnId);
|
|
2014
|
+
|
|
2015
|
+
// For grouped cells, skip rendering aggregated/placeholder cells
|
|
2016
|
+
if (cell.getIsGrouped()) {
|
|
2017
|
+
return null;
|
|
2018
|
+
}
|
|
2019
|
+
if (cell.getIsAggregated()) {
|
|
2020
|
+
return (
|
|
2021
|
+
<TableCell key={cell.id}>
|
|
2022
|
+
{flexRender(
|
|
2023
|
+
column.columnDef.aggregatedCell ?? column.columnDef.cell,
|
|
2024
|
+
cell.getContext()
|
|
2025
|
+
)}
|
|
2026
|
+
</TableCell>
|
|
2027
|
+
);
|
|
2028
|
+
}
|
|
2029
|
+
if (cell.getIsPlaceholder()) {
|
|
2030
|
+
return <TableCell key={cell.id} />;
|
|
2031
|
+
}
|
|
2032
|
+
|
|
2033
|
+
return (
|
|
2034
|
+
<TableCell
|
|
2035
|
+
key={cell.id}
|
|
2036
|
+
checkbox={isCheckbox}
|
|
2037
|
+
expandTrigger={isExpand}
|
|
2038
|
+
shrink={isCheckbox || isExpand || isEditActions}
|
|
2039
|
+
className={
|
|
2040
|
+
canEdit && !isCellEditing && !isCheckbox && !isExpand && !isEditActions
|
|
2041
|
+
? 'bh-td--editable'
|
|
2042
|
+
: isCellEditing
|
|
2043
|
+
? 'bh-td--editing'
|
|
2044
|
+
: undefined
|
|
2045
|
+
}
|
|
2046
|
+
onClick={
|
|
2047
|
+
isCheckbox || isExpand || isEditActions
|
|
2048
|
+
? (e) => e.stopPropagation()
|
|
2049
|
+
: undefined
|
|
2050
|
+
}
|
|
2051
|
+
onDoubleClick={
|
|
2052
|
+
canEdit &&
|
|
2053
|
+
editMode === 'cell' &&
|
|
2054
|
+
!isCellEditing &&
|
|
2055
|
+
!isCheckbox &&
|
|
2056
|
+
!isExpand &&
|
|
2057
|
+
!isEditActions
|
|
2058
|
+
? () => startEditing(rowId, columnId)
|
|
2059
|
+
: undefined
|
|
2060
|
+
}
|
|
2061
|
+
style={{
|
|
2062
|
+
width:
|
|
2063
|
+
cell.column.getSize() !== 150
|
|
2064
|
+
? cell.column.getSize()
|
|
2065
|
+
: undefined,
|
|
2066
|
+
}}
|
|
2067
|
+
>
|
|
2068
|
+
{isCellEditing || (rowIsEditing && canEdit && editMode === 'row') ? (
|
|
2069
|
+
renderEditInput(column, cell)
|
|
2070
|
+
) : (
|
|
2071
|
+
flexRender(column.columnDef.cell, cell.getContext())
|
|
2072
|
+
)}
|
|
2073
|
+
</TableCell>
|
|
2074
|
+
);
|
|
2075
|
+
})}
|
|
2076
|
+
</TableRow>
|
|
2077
|
+
|
|
2078
|
+
{/* Expanded Row Content */}
|
|
2079
|
+
{row.getIsExpanded() && renderExpandedRow && !row.getIsGrouped() && (
|
|
2080
|
+
<TableRow expansion>
|
|
2081
|
+
<TableCell expansion colSpan={tableColumns.length}>
|
|
2082
|
+
{renderExpandedRow(row)}
|
|
2083
|
+
</TableCell>
|
|
2084
|
+
</TableRow>
|
|
2085
|
+
)}
|
|
2086
|
+
</React.Fragment>
|
|
2087
|
+
);
|
|
2088
|
+
};
|
|
2089
|
+
|
|
2090
|
+
// ==========================================================================
|
|
2091
|
+
// Render
|
|
2092
|
+
// ==========================================================================
|
|
2093
|
+
|
|
2094
|
+
const selectedCount = Object.keys(rowSelection).filter(
|
|
2095
|
+
(key) => rowSelection[key]
|
|
2096
|
+
).length;
|
|
2097
|
+
const showActionBar =
|
|
2098
|
+
actionBarLeft || actionBarRight || (selectedCount > 0 && bulkActions);
|
|
2099
|
+
|
|
2100
|
+
return (
|
|
2101
|
+
<div className={className}>
|
|
2102
|
+
{/* Action Bar */}
|
|
2103
|
+
{showActionBar && (
|
|
2104
|
+
<TableActionBar
|
|
2105
|
+
selectionCount={selectedCount}
|
|
2106
|
+
left={selectedCount > 0 ? bulkActions : actionBarLeft}
|
|
2107
|
+
right={actionBarRight}
|
|
2108
|
+
/>
|
|
2109
|
+
)}
|
|
2110
|
+
|
|
2111
|
+
{/* Table */}
|
|
2112
|
+
<TableWrapper maxHeight={maxHeight} scrollY={!!maxHeight}>
|
|
2113
|
+
<Table
|
|
2114
|
+
size={size}
|
|
2115
|
+
variant={variant}
|
|
2116
|
+
rounded={rounded}
|
|
2117
|
+
hoverable={hoverable}
|
|
2118
|
+
loading={loading}
|
|
2119
|
+
>
|
|
2120
|
+
{/* Header */}
|
|
2121
|
+
<TableHead sticky={stickyHeader}>
|
|
2122
|
+
{table.getHeaderGroups().map((headerGroup) => (
|
|
2123
|
+
<TableRow key={headerGroup.id}>
|
|
2124
|
+
{headerGroup.headers.map((header) => {
|
|
2125
|
+
const isSortable = header.column.getCanSort();
|
|
2126
|
+
const sortDirection = header.column.getIsSorted();
|
|
2127
|
+
const isCheckbox = header.id === 'select';
|
|
2128
|
+
const isExpand = header.id === 'expand';
|
|
2129
|
+
const isEditActions = header.id === 'edit-actions';
|
|
2130
|
+
|
|
2131
|
+
return (
|
|
2132
|
+
<TableHeaderCell
|
|
2133
|
+
key={header.id}
|
|
2134
|
+
sortable={isSortable}
|
|
2135
|
+
sortDirection={sortDirection || null}
|
|
2136
|
+
onClick={
|
|
2137
|
+
isSortable
|
|
2138
|
+
? header.column.getToggleSortingHandler()
|
|
2139
|
+
: undefined
|
|
2140
|
+
}
|
|
2141
|
+
checkbox={isCheckbox}
|
|
2142
|
+
shrink={isCheckbox || isExpand || isEditActions}
|
|
2143
|
+
style={{
|
|
2144
|
+
width:
|
|
2145
|
+
header.getSize() !== 150
|
|
2146
|
+
? header.getSize()
|
|
2147
|
+
: undefined,
|
|
2148
|
+
}}
|
|
2149
|
+
>
|
|
2150
|
+
{header.isPlaceholder
|
|
2151
|
+
? null
|
|
2152
|
+
: flexRender(
|
|
2153
|
+
header.column.columnDef.header,
|
|
2154
|
+
header.getContext()
|
|
2155
|
+
)}
|
|
2156
|
+
</TableHeaderCell>
|
|
2157
|
+
);
|
|
2158
|
+
})}
|
|
2159
|
+
</TableRow>
|
|
2160
|
+
))}
|
|
2161
|
+
|
|
2162
|
+
{/* Filter Row */}
|
|
2163
|
+
{enableFiltering && (
|
|
2164
|
+
<TableRow filter>
|
|
2165
|
+
{table.getHeaderGroups()[0]?.headers.map((header) => {
|
|
2166
|
+
const column = header.column;
|
|
2167
|
+
const canFilter = column.getCanFilter();
|
|
2168
|
+
const isCheckbox = header.id === 'select';
|
|
2169
|
+
const isExpand = header.id === 'expand';
|
|
2170
|
+
const isEditActions = header.id === 'edit-actions';
|
|
2171
|
+
|
|
2172
|
+
if (!canFilter || isCheckbox || isExpand || isEditActions) {
|
|
2173
|
+
return <TableCell key={header.id} filter />;
|
|
2174
|
+
}
|
|
2175
|
+
|
|
2176
|
+
return (
|
|
2177
|
+
<TableCell key={header.id} filter>
|
|
2178
|
+
<BhInputText
|
|
2179
|
+
placeholder=""
|
|
2180
|
+
label=""
|
|
2181
|
+
value={(column.getFilterValue() as string) ?? ''}
|
|
2182
|
+
onBhInput={(e: CustomEvent) =>
|
|
2183
|
+
column.setFilterValue(e.detail)
|
|
2184
|
+
}
|
|
2185
|
+
/>
|
|
2186
|
+
</TableCell>
|
|
2187
|
+
);
|
|
2188
|
+
})}
|
|
2189
|
+
</TableRow>
|
|
2190
|
+
)}
|
|
2191
|
+
</TableHead>
|
|
2192
|
+
|
|
2193
|
+
{/* Body */}
|
|
2194
|
+
<TableBody>
|
|
2195
|
+
{table.getRowModel().rows.length === 0 ? (
|
|
2196
|
+
<TableEmpty
|
|
2197
|
+
title={emptyTitle}
|
|
2198
|
+
description={emptyDescription}
|
|
2199
|
+
colSpan={tableColumns.length}
|
|
2200
|
+
icon={<span className="material-symbols-outlined">inbox</span>}
|
|
2201
|
+
/>
|
|
2202
|
+
) : (
|
|
2203
|
+
table.getRowModel().rows.map((row) => {
|
|
2204
|
+
// Check if this is a group row
|
|
2205
|
+
if (row.getIsGrouped()) {
|
|
2206
|
+
return renderGroupRow(row);
|
|
2207
|
+
}
|
|
2208
|
+
|
|
2209
|
+
// Regular data row
|
|
2210
|
+
return renderDataRow(row);
|
|
2211
|
+
})
|
|
2212
|
+
)}
|
|
2213
|
+
</TableBody>
|
|
2214
|
+
</Table>
|
|
2215
|
+
</TableWrapper>
|
|
2216
|
+
|
|
2217
|
+
{/* Pagination - hidden when grouping is enabled */}
|
|
2218
|
+
{enablePagination && !enableGrouping && data.length > 0 && (
|
|
2219
|
+
<TablePagination
|
|
2220
|
+
page={table.getState().pagination.pageIndex + 1}
|
|
2221
|
+
totalPages={table.getPageCount()}
|
|
2222
|
+
totalItems={data.length}
|
|
2223
|
+
pageSize={table.getState().pagination.pageSize}
|
|
2224
|
+
pageSizeOptions={pageSizeOptions}
|
|
2225
|
+
onPageChange={(page) => table.setPageIndex(page - 1)}
|
|
2226
|
+
onPageSizeChange={(newSize) => table.setPageSize(newSize)}
|
|
2227
|
+
/>
|
|
2228
|
+
)}
|
|
2229
|
+
</div>
|
|
2230
|
+
);
|
|
2231
|
+
}
|
|
2232
|
+
|
|
2233
|
+
// =============================================================================
|
|
2234
|
+
// useDataTable Hook - For more control
|
|
2235
|
+
// =============================================================================
|
|
2236
|
+
|
|
2237
|
+
export interface UseDataTableOptions<TData> {
|
|
2238
|
+
data: TData[];
|
|
2239
|
+
columns: ColumnDef<TData, unknown>[];
|
|
2240
|
+
enableSorting?: boolean;
|
|
2241
|
+
enableFiltering?: boolean;
|
|
2242
|
+
enablePagination?: boolean;
|
|
2243
|
+
enableRowSelection?: boolean;
|
|
2244
|
+
enableExpanding?: boolean;
|
|
2245
|
+
enableGrouping?: boolean;
|
|
2246
|
+
groupBy?: string[];
|
|
2247
|
+
pageSize?: number;
|
|
2248
|
+
getRowId?: (row: TData, index: number) => string;
|
|
2249
|
+
getSubRows?: (row: TData) => TData[] | undefined;
|
|
2250
|
+
}
|
|
2251
|
+
|
|
2252
|
+
export function useDataTable<TData>({
|
|
2253
|
+
data,
|
|
2254
|
+
columns,
|
|
2255
|
+
enableSorting = true,
|
|
2256
|
+
enableFiltering = false,
|
|
2257
|
+
enablePagination = true,
|
|
2258
|
+
enableRowSelection = false,
|
|
2259
|
+
enableExpanding = false,
|
|
2260
|
+
enableGrouping = false,
|
|
2261
|
+
groupBy = [],
|
|
2262
|
+
pageSize = 10,
|
|
2263
|
+
getRowId,
|
|
2264
|
+
getSubRows,
|
|
2265
|
+
}: UseDataTableOptions<TData>): TanStackTable<TData> {
|
|
2266
|
+
const [sorting, setSorting] = useState<SortingState>([]);
|
|
2267
|
+
const [columnFilters, setColumnFilters] = useState<ColumnFiltersState>([]);
|
|
2268
|
+
const [rowSelection, setRowSelection] = useState<RowSelectionState>({});
|
|
2269
|
+
const [expanded, setExpanded] = useState<ExpandedState>({});
|
|
2270
|
+
const [pagination, setPagination] = useState<PaginationState>({
|
|
2271
|
+
pageIndex: 0,
|
|
2272
|
+
pageSize,
|
|
2273
|
+
});
|
|
2274
|
+
const [grouping, setGrouping] = useState<GroupingState>(groupBy);
|
|
2275
|
+
|
|
2276
|
+
return useReactTable({
|
|
2277
|
+
data,
|
|
2278
|
+
columns,
|
|
2279
|
+
state: {
|
|
2280
|
+
sorting,
|
|
2281
|
+
columnFilters,
|
|
2282
|
+
rowSelection,
|
|
2283
|
+
expanded,
|
|
2284
|
+
pagination,
|
|
2285
|
+
grouping,
|
|
2286
|
+
},
|
|
2287
|
+
getRowId,
|
|
2288
|
+
getSubRows,
|
|
2289
|
+
enableRowSelection,
|
|
2290
|
+
enableSorting,
|
|
2291
|
+
enableFilters: enableFiltering,
|
|
2292
|
+
enableExpanding: enableExpanding || enableGrouping,
|
|
2293
|
+
enableGrouping,
|
|
2294
|
+
onSortingChange: setSorting,
|
|
2295
|
+
onColumnFiltersChange: setColumnFilters,
|
|
2296
|
+
onRowSelectionChange: setRowSelection,
|
|
2297
|
+
onExpandedChange: setExpanded,
|
|
2298
|
+
onPaginationChange: setPagination,
|
|
2299
|
+
onGroupingChange: setGrouping,
|
|
2300
|
+
getCoreRowModel: getCoreRowModel(),
|
|
2301
|
+
getSortedRowModel: enableSorting ? getSortedRowModel() : undefined,
|
|
2302
|
+
getFilteredRowModel: enableFiltering ? getFilteredRowModel() : undefined,
|
|
2303
|
+
getPaginationRowModel:
|
|
2304
|
+
enablePagination && !enableGrouping ? getPaginationRowModel() : undefined,
|
|
2305
|
+
getExpandedRowModel:
|
|
2306
|
+
enableExpanding || enableGrouping ? getExpandedRowModel() : undefined,
|
|
2307
|
+
getGroupedRowModel: enableGrouping ? getGroupedRowModel() : undefined,
|
|
2308
|
+
});
|
|
2309
|
+
}
|
|
2310
|
+
|
|
2311
|
+
// =============================================================================
|
|
2312
|
+
// Exports
|
|
2313
|
+
// =============================================================================
|
|
2314
|
+
|
|
2315
|
+
export { DataTable as BhDataTable };
|
|
2316
|
+
export type {
|
|
2317
|
+
ColumnDef,
|
|
2318
|
+
SortingState,
|
|
2319
|
+
ColumnFiltersState,
|
|
2320
|
+
RowSelectionState,
|
|
2321
|
+
GroupingState,
|
|
2322
|
+
};
|
|
2323
|
+
|
|
2324
|
+
================
|
|
2325
|
+
File: src/components/table/index.tsx
|
|
2326
|
+
================
|
|
2327
|
+
/**
|
|
2328
|
+
* Bellhop Table Primitives
|
|
2329
|
+
*
|
|
2330
|
+
* Composable table components for building static and dynamic tables.
|
|
2331
|
+
* These primitives can be used standalone or combined with TanStack Table
|
|
2332
|
+
* for advanced features like sorting, filtering, and pagination.
|
|
2333
|
+
* Uses existing Bellhop components for consistency.
|
|
2334
|
+
*/
|
|
2335
|
+
|
|
2336
|
+
import React, { forwardRef, createContext, useContext } from 'react';
|
|
2337
|
+
import { BhButtonIcon } from '../stencil-generated';
|
|
2338
|
+
|
|
2339
|
+
// =============================================================================
|
|
2340
|
+
// Types
|
|
2341
|
+
// =============================================================================
|
|
2342
|
+
|
|
2343
|
+
export type TableSize = 'compact' | 'default' | 'relaxed';
|
|
2344
|
+
export type TableVariant = 'default' | 'bordered' | 'striped';
|
|
2345
|
+
export type CellAlign = 'left' | 'center' | 'right';
|
|
2346
|
+
|
|
2347
|
+
interface TableContextValue {
|
|
2348
|
+
size: TableSize;
|
|
2349
|
+
variant: TableVariant;
|
|
2350
|
+
hoverable: boolean;
|
|
2351
|
+
}
|
|
2352
|
+
|
|
2353
|
+
// =============================================================================
|
|
2354
|
+
// Context
|
|
2355
|
+
// =============================================================================
|
|
2356
|
+
|
|
2357
|
+
const TableContext = createContext<TableContextValue>({
|
|
2358
|
+
size: 'default',
|
|
2359
|
+
variant: 'default',
|
|
2360
|
+
hoverable: true,
|
|
2361
|
+
});
|
|
2362
|
+
|
|
2363
|
+
const useTableContext = () => useContext(TableContext);
|
|
2364
|
+
|
|
2365
|
+
// =============================================================================
|
|
2366
|
+
// Utility Functions
|
|
2367
|
+
// =============================================================================
|
|
2368
|
+
|
|
2369
|
+
function clsx(...classes: (string | boolean | undefined | null)[]): string {
|
|
2370
|
+
return classes.filter(Boolean).join(' ');
|
|
2371
|
+
}
|
|
2372
|
+
|
|
2373
|
+
// =============================================================================
|
|
2374
|
+
// TableWrapper
|
|
2375
|
+
// =============================================================================
|
|
2376
|
+
|
|
2377
|
+
export interface TableWrapperProps
|
|
2378
|
+
extends React.HTMLAttributes<HTMLDivElement> {
|
|
2379
|
+
/** Maximum height for vertical scrolling */
|
|
2380
|
+
maxHeight?: string | number;
|
|
2381
|
+
/** Maximum width for horizontal scrolling */
|
|
2382
|
+
maxWidth?: string | number;
|
|
2383
|
+
/** Enable horizontal scrolling */
|
|
2384
|
+
scrollX?: boolean;
|
|
2385
|
+
/** Enable vertical scrolling */
|
|
2386
|
+
scrollY?: boolean;
|
|
2387
|
+
}
|
|
2388
|
+
|
|
2389
|
+
export const TableWrapper = forwardRef<HTMLDivElement, TableWrapperProps>(
|
|
2390
|
+
(
|
|
2391
|
+
{
|
|
2392
|
+
className,
|
|
2393
|
+
children,
|
|
2394
|
+
maxHeight,
|
|
2395
|
+
maxWidth,
|
|
2396
|
+
scrollX,
|
|
2397
|
+
scrollY,
|
|
2398
|
+
style,
|
|
2399
|
+
...props
|
|
2400
|
+
},
|
|
2401
|
+
ref
|
|
2402
|
+
) => {
|
|
2403
|
+
return (
|
|
2404
|
+
<div
|
|
2405
|
+
ref={ref}
|
|
2406
|
+
className={clsx(
|
|
2407
|
+
'bh-table-wrapper',
|
|
2408
|
+
scrollX && 'bh-table-wrapper--scroll-x',
|
|
2409
|
+
scrollY && 'bh-table-wrapper--scroll-y',
|
|
2410
|
+
className
|
|
2411
|
+
)}
|
|
2412
|
+
style={{
|
|
2413
|
+
maxHeight: maxHeight,
|
|
2414
|
+
maxWidth: maxWidth,
|
|
2415
|
+
...style,
|
|
2416
|
+
}}
|
|
2417
|
+
tabIndex={0}
|
|
2418
|
+
{...props}
|
|
2419
|
+
>
|
|
2420
|
+
{children}
|
|
2421
|
+
</div>
|
|
2422
|
+
);
|
|
2423
|
+
}
|
|
2424
|
+
);
|
|
2425
|
+
|
|
2426
|
+
TableWrapper.displayName = 'TableWrapper';
|
|
2427
|
+
|
|
2428
|
+
// =============================================================================
|
|
2429
|
+
// Table
|
|
2430
|
+
// =============================================================================
|
|
2431
|
+
|
|
2432
|
+
export interface TableProps
|
|
2433
|
+
extends React.TableHTMLAttributes<HTMLTableElement> {
|
|
2434
|
+
/** Table size variant */
|
|
2435
|
+
size?: TableSize;
|
|
2436
|
+
/** Table style variant */
|
|
2437
|
+
variant?: TableVariant;
|
|
2438
|
+
/** Show rounded corners */
|
|
2439
|
+
rounded?: boolean;
|
|
2440
|
+
/** Enable row hover effect */
|
|
2441
|
+
hoverable?: boolean;
|
|
2442
|
+
/** Enable responsive stacking on mobile */
|
|
2443
|
+
responsive?: boolean;
|
|
2444
|
+
/** Loading state */
|
|
2445
|
+
loading?: boolean;
|
|
2446
|
+
}
|
|
2447
|
+
|
|
2448
|
+
export const Table = forwardRef<HTMLTableElement, TableProps>(
|
|
2449
|
+
(
|
|
2450
|
+
{
|
|
2451
|
+
className,
|
|
2452
|
+
children,
|
|
2453
|
+
size = 'default',
|
|
2454
|
+
variant = 'default',
|
|
2455
|
+
rounded = false,
|
|
2456
|
+
hoverable = true,
|
|
2457
|
+
responsive = false,
|
|
2458
|
+
loading = false,
|
|
2459
|
+
...props
|
|
2460
|
+
},
|
|
2461
|
+
ref
|
|
2462
|
+
) => {
|
|
2463
|
+
return (
|
|
2464
|
+
<TableContext.Provider value={{ size, variant, hoverable }}>
|
|
2465
|
+
<table
|
|
2466
|
+
ref={ref}
|
|
2467
|
+
className={clsx(
|
|
2468
|
+
'bh-table',
|
|
2469
|
+
`bh-table--${size}`,
|
|
2470
|
+
variant === 'bordered' && 'bh-table--bordered',
|
|
2471
|
+
variant === 'striped' && 'bh-table--striped',
|
|
2472
|
+
rounded && 'bh-table--rounded',
|
|
2473
|
+
responsive && 'bh-table--responsive',
|
|
2474
|
+
loading && 'bh-table--loading',
|
|
2475
|
+
className
|
|
2476
|
+
)}
|
|
2477
|
+
{...props}
|
|
2478
|
+
>
|
|
2479
|
+
{children}
|
|
2480
|
+
</table>
|
|
2481
|
+
</TableContext.Provider>
|
|
2482
|
+
);
|
|
2483
|
+
}
|
|
2484
|
+
);
|
|
2485
|
+
|
|
2486
|
+
Table.displayName = 'Table';
|
|
2487
|
+
|
|
2488
|
+
// =============================================================================
|
|
2489
|
+
// TableCaption
|
|
2490
|
+
// =============================================================================
|
|
2491
|
+
|
|
2492
|
+
export interface TableCaptionProps
|
|
2493
|
+
extends React.HTMLAttributes<HTMLTableCaptionElement> {
|
|
2494
|
+
/** Position of caption */
|
|
2495
|
+
position?: 'top' | 'bottom';
|
|
2496
|
+
/** Screen reader only */
|
|
2497
|
+
srOnly?: boolean;
|
|
2498
|
+
}
|
|
2499
|
+
|
|
2500
|
+
export const TableCaption = forwardRef<
|
|
2501
|
+
HTMLTableCaptionElement,
|
|
2502
|
+
TableCaptionProps
|
|
2503
|
+
>(
|
|
2504
|
+
(
|
|
2505
|
+
{ className, children, position = 'top', srOnly = false, ...props },
|
|
2506
|
+
ref
|
|
2507
|
+
) => {
|
|
2508
|
+
return (
|
|
2509
|
+
<caption
|
|
2510
|
+
ref={ref}
|
|
2511
|
+
className={clsx(
|
|
2512
|
+
'bh-caption',
|
|
2513
|
+
position === 'bottom' && 'bh-caption--bottom',
|
|
2514
|
+
srOnly && 'bh-caption--sr-only',
|
|
2515
|
+
className
|
|
2516
|
+
)}
|
|
2517
|
+
{...props}
|
|
2518
|
+
>
|
|
2519
|
+
{children}
|
|
2520
|
+
</caption>
|
|
2521
|
+
);
|
|
2522
|
+
}
|
|
2523
|
+
);
|
|
2524
|
+
|
|
2525
|
+
TableCaption.displayName = 'TableCaption';
|
|
2526
|
+
|
|
2527
|
+
// =============================================================================
|
|
2528
|
+
// TableHead (thead)
|
|
2529
|
+
// =============================================================================
|
|
2530
|
+
|
|
2531
|
+
export interface TableHeadProps
|
|
2532
|
+
extends React.HTMLAttributes<HTMLTableSectionElement> {
|
|
2533
|
+
/** Make header sticky */
|
|
2534
|
+
sticky?: boolean;
|
|
2535
|
+
/** Use subtle styling */
|
|
2536
|
+
subtle?: boolean;
|
|
2537
|
+
}
|
|
2538
|
+
|
|
2539
|
+
export const TableHead = forwardRef<HTMLTableSectionElement, TableHeadProps>(
|
|
2540
|
+
({ className, children, sticky = false, subtle = false, ...props }, ref) => {
|
|
2541
|
+
return (
|
|
2542
|
+
<thead
|
|
2543
|
+
ref={ref}
|
|
2544
|
+
className={clsx(
|
|
2545
|
+
'bh-thead',
|
|
2546
|
+
sticky && 'bh-thead--sticky',
|
|
2547
|
+
subtle && 'bh-thead--subtle',
|
|
2548
|
+
className
|
|
2549
|
+
)}
|
|
2550
|
+
{...props}
|
|
2551
|
+
>
|
|
2552
|
+
{children}
|
|
2553
|
+
</thead>
|
|
2554
|
+
);
|
|
2555
|
+
}
|
|
2556
|
+
);
|
|
2557
|
+
|
|
2558
|
+
TableHead.displayName = 'TableHead';
|
|
2559
|
+
|
|
2560
|
+
// =============================================================================
|
|
2561
|
+
// TableBody (tbody)
|
|
2562
|
+
// =============================================================================
|
|
2563
|
+
|
|
2564
|
+
export interface TableBodyProps
|
|
2565
|
+
extends React.HTMLAttributes<HTMLTableSectionElement> {}
|
|
2566
|
+
|
|
2567
|
+
export const TableBody = forwardRef<HTMLTableSectionElement, TableBodyProps>(
|
|
2568
|
+
({ className, children, ...props }, ref) => {
|
|
2569
|
+
return (
|
|
2570
|
+
<tbody ref={ref} className={clsx('bh-tbody', className)} {...props}>
|
|
2571
|
+
{children}
|
|
2572
|
+
</tbody>
|
|
2573
|
+
);
|
|
2574
|
+
}
|
|
2575
|
+
);
|
|
2576
|
+
|
|
2577
|
+
TableBody.displayName = 'TableBody';
|
|
2578
|
+
|
|
2579
|
+
// =============================================================================
|
|
2580
|
+
// TableFooter (tfoot)
|
|
2581
|
+
// =============================================================================
|
|
2582
|
+
|
|
2583
|
+
export interface TableFooterProps
|
|
2584
|
+
extends React.HTMLAttributes<HTMLTableSectionElement> {}
|
|
2585
|
+
|
|
2586
|
+
export const TableFooter = forwardRef<
|
|
2587
|
+
HTMLTableSectionElement,
|
|
2588
|
+
TableFooterProps
|
|
2589
|
+
>(({ className, children, ...props }, ref) => {
|
|
2590
|
+
return (
|
|
2591
|
+
<tfoot ref={ref} className={clsx('bh-tfoot', className)} {...props}>
|
|
2592
|
+
{children}
|
|
2593
|
+
</tfoot>
|
|
2594
|
+
);
|
|
2595
|
+
});
|
|
2596
|
+
|
|
2597
|
+
TableFooter.displayName = 'TableFooter';
|
|
2598
|
+
|
|
2599
|
+
// =============================================================================
|
|
2600
|
+
// TableRow (tr)
|
|
2601
|
+
// =============================================================================
|
|
2602
|
+
|
|
2603
|
+
export interface TableRowProps
|
|
2604
|
+
extends React.HTMLAttributes<HTMLTableRowElement> {
|
|
2605
|
+
/** Row is selected */
|
|
2606
|
+
selected?: boolean;
|
|
2607
|
+
/** Row is clickable */
|
|
2608
|
+
clickable?: boolean;
|
|
2609
|
+
/** Row is expandable */
|
|
2610
|
+
expandable?: boolean;
|
|
2611
|
+
/** Row is expanded */
|
|
2612
|
+
expanded?: boolean;
|
|
2613
|
+
/** Row is a filter row */
|
|
2614
|
+
filter?: boolean;
|
|
2615
|
+
/** Row is an expansion content row */
|
|
2616
|
+
expansion?: boolean;
|
|
2617
|
+
}
|
|
2618
|
+
|
|
2619
|
+
export const TableRow = forwardRef<HTMLTableRowElement, TableRowProps>(
|
|
2620
|
+
(
|
|
2621
|
+
{
|
|
2622
|
+
className,
|
|
2623
|
+
children,
|
|
2624
|
+
selected = false,
|
|
2625
|
+
clickable = false,
|
|
2626
|
+
expandable = false,
|
|
2627
|
+
expanded = false,
|
|
2628
|
+
filter = false,
|
|
2629
|
+
expansion = false,
|
|
2630
|
+
...props
|
|
2631
|
+
},
|
|
2632
|
+
ref
|
|
2633
|
+
) => {
|
|
2634
|
+
const { hoverable } = useTableContext();
|
|
2635
|
+
|
|
2636
|
+
return (
|
|
2637
|
+
<tr
|
|
2638
|
+
ref={ref}
|
|
2639
|
+
className={clsx(
|
|
2640
|
+
'bh-tr',
|
|
2641
|
+
hoverable && 'bh-tr--hoverable',
|
|
2642
|
+
selected && 'bh-tr--selected',
|
|
2643
|
+
clickable && 'bh-tr--clickable',
|
|
2644
|
+
expandable && 'bh-tr--expandable',
|
|
2645
|
+
expanded && 'bh-tr--expanded',
|
|
2646
|
+
filter && 'bh-tr--filter',
|
|
2647
|
+
expansion && 'bh-tr--expansion',
|
|
2648
|
+
className
|
|
2649
|
+
)}
|
|
2650
|
+
{...props}
|
|
2651
|
+
>
|
|
2652
|
+
{children}
|
|
2653
|
+
</tr>
|
|
2654
|
+
);
|
|
2655
|
+
}
|
|
2656
|
+
);
|
|
2657
|
+
|
|
2658
|
+
TableRow.displayName = 'TableRow';
|
|
2659
|
+
|
|
2660
|
+
// =============================================================================
|
|
2661
|
+
// TableHeaderCell (th)
|
|
2662
|
+
// =============================================================================
|
|
2663
|
+
|
|
2664
|
+
export interface TableHeaderCellProps
|
|
2665
|
+
extends React.ThHTMLAttributes<HTMLTableCellElement> {
|
|
2666
|
+
/** Text alignment */
|
|
2667
|
+
align?: CellAlign;
|
|
2668
|
+
/** Column is sortable */
|
|
2669
|
+
sortable?: boolean;
|
|
2670
|
+
/** Current sort direction */
|
|
2671
|
+
sortDirection?: 'asc' | 'desc' | null;
|
|
2672
|
+
/** Shrink column to content width */
|
|
2673
|
+
shrink?: boolean;
|
|
2674
|
+
/** Expand column to fill space */
|
|
2675
|
+
expand?: boolean;
|
|
2676
|
+
/** Checkbox column */
|
|
2677
|
+
checkbox?: boolean;
|
|
2678
|
+
/** Actions column */
|
|
2679
|
+
actions?: boolean;
|
|
2680
|
+
/** Pin column to left */
|
|
2681
|
+
pinnedLeft?: boolean;
|
|
2682
|
+
/** Pin column to right */
|
|
2683
|
+
pinnedRight?: boolean;
|
|
2684
|
+
}
|
|
2685
|
+
|
|
2686
|
+
export const TableHeaderCell = forwardRef<
|
|
2687
|
+
HTMLTableCellElement,
|
|
2688
|
+
TableHeaderCellProps
|
|
2689
|
+
>(
|
|
2690
|
+
(
|
|
2691
|
+
{
|
|
2692
|
+
className,
|
|
2693
|
+
children,
|
|
2694
|
+
align = 'left',
|
|
2695
|
+
sortable = false,
|
|
2696
|
+
sortDirection = null,
|
|
2697
|
+
shrink = false,
|
|
2698
|
+
expand = false,
|
|
2699
|
+
checkbox = false,
|
|
2700
|
+
actions = false,
|
|
2701
|
+
pinnedLeft = false,
|
|
2702
|
+
pinnedRight = false,
|
|
2703
|
+
onClick,
|
|
2704
|
+
...props
|
|
2705
|
+
},
|
|
2706
|
+
ref
|
|
2707
|
+
) => {
|
|
2708
|
+
const isSorted = sortDirection !== null;
|
|
2709
|
+
|
|
2710
|
+
return (
|
|
2711
|
+
<th
|
|
2712
|
+
ref={ref}
|
|
2713
|
+
className={clsx(
|
|
2714
|
+
'bh-th',
|
|
2715
|
+
`bh-th--${align}`,
|
|
2716
|
+
sortable && 'bh-th--sortable',
|
|
2717
|
+
isSorted && 'bh-th--sorted',
|
|
2718
|
+
shrink && 'bh-th--shrink',
|
|
2719
|
+
expand && 'bh-th--expand',
|
|
2720
|
+
checkbox && 'bh-th--checkbox',
|
|
2721
|
+
actions && 'bh-th--actions',
|
|
2722
|
+
pinnedLeft && 'bh-th--pinned-left',
|
|
2723
|
+
pinnedRight && 'bh-th--pinned-right',
|
|
2724
|
+
className
|
|
2725
|
+
)}
|
|
2726
|
+
onClick={sortable ? onClick : undefined}
|
|
2727
|
+
aria-sort={
|
|
2728
|
+
sortDirection === 'asc'
|
|
2729
|
+
? 'ascending'
|
|
2730
|
+
: sortDirection === 'desc'
|
|
2731
|
+
? 'descending'
|
|
2732
|
+
: undefined
|
|
2733
|
+
}
|
|
2734
|
+
{...props}
|
|
2735
|
+
>
|
|
2736
|
+
<span className="bh-th__content">
|
|
2737
|
+
{children}
|
|
2738
|
+
{sortable && isSorted && (
|
|
2739
|
+
<span className="bh-th__sort-icon material-symbols-outlined">
|
|
2740
|
+
{sortDirection === 'asc' ? 'arrow_upward' : 'arrow_downward'}
|
|
2741
|
+
</span>
|
|
2742
|
+
)}
|
|
2743
|
+
</span>
|
|
2744
|
+
</th>
|
|
2745
|
+
);
|
|
2746
|
+
}
|
|
2747
|
+
);
|
|
2748
|
+
|
|
2749
|
+
TableHeaderCell.displayName = 'TableHeaderCell';
|
|
2750
|
+
|
|
2751
|
+
// =============================================================================
|
|
2752
|
+
// TableCell (td)
|
|
2753
|
+
// =============================================================================
|
|
2754
|
+
|
|
2755
|
+
export interface TableCellProps
|
|
2756
|
+
extends React.TdHTMLAttributes<HTMLTableCellElement> {
|
|
2757
|
+
/** Text alignment */
|
|
2758
|
+
align?: CellAlign;
|
|
2759
|
+
/** Cell contains numeric data */
|
|
2760
|
+
numeric?: boolean;
|
|
2761
|
+
/** Truncate long text */
|
|
2762
|
+
truncate?: boolean;
|
|
2763
|
+
/** Allow text to wrap */
|
|
2764
|
+
wrap?: boolean;
|
|
2765
|
+
/** Shrink cell to content width */
|
|
2766
|
+
shrink?: boolean;
|
|
2767
|
+
/** Expand cell to fill space */
|
|
2768
|
+
expand?: boolean;
|
|
2769
|
+
/** Checkbox cell */
|
|
2770
|
+
checkbox?: boolean;
|
|
2771
|
+
/** Actions cell */
|
|
2772
|
+
actions?: boolean;
|
|
2773
|
+
/** Expand trigger cell */
|
|
2774
|
+
expandTrigger?: boolean;
|
|
2775
|
+
/** Filter cell */
|
|
2776
|
+
filter?: boolean;
|
|
2777
|
+
/** Expansion content cell */
|
|
2778
|
+
expansion?: boolean;
|
|
2779
|
+
/** Pin cell to left */
|
|
2780
|
+
pinnedLeft?: boolean;
|
|
2781
|
+
/** Pin cell to right */
|
|
2782
|
+
pinnedRight?: boolean;
|
|
2783
|
+
/** Data label for responsive mode */
|
|
2784
|
+
dataLabel?: string;
|
|
2785
|
+
}
|
|
2786
|
+
|
|
2787
|
+
export const TableCell = forwardRef<HTMLTableCellElement, TableCellProps>(
|
|
2788
|
+
(
|
|
2789
|
+
{
|
|
2790
|
+
className,
|
|
2791
|
+
children,
|
|
2792
|
+
align = 'left',
|
|
2793
|
+
numeric = false,
|
|
2794
|
+
truncate = false,
|
|
2795
|
+
wrap = false,
|
|
2796
|
+
shrink = false,
|
|
2797
|
+
expand = false,
|
|
2798
|
+
checkbox = false,
|
|
2799
|
+
actions = false,
|
|
2800
|
+
expandTrigger = false,
|
|
2801
|
+
filter = false,
|
|
2802
|
+
expansion = false,
|
|
2803
|
+
pinnedLeft = false,
|
|
2804
|
+
pinnedRight = false,
|
|
2805
|
+
dataLabel,
|
|
2806
|
+
...props
|
|
2807
|
+
},
|
|
2808
|
+
ref
|
|
2809
|
+
) => {
|
|
2810
|
+
return (
|
|
2811
|
+
<td
|
|
2812
|
+
ref={ref}
|
|
2813
|
+
className={clsx(
|
|
2814
|
+
'bh-td',
|
|
2815
|
+
`bh-td--${align}`,
|
|
2816
|
+
numeric && 'bh-td--numeric',
|
|
2817
|
+
truncate && 'bh-td--truncate',
|
|
2818
|
+
wrap && 'bh-td--wrap',
|
|
2819
|
+
shrink && 'bh-td--shrink',
|
|
2820
|
+
expand && 'bh-td--expand',
|
|
2821
|
+
checkbox && 'bh-td--checkbox',
|
|
2822
|
+
actions && 'bh-td--actions',
|
|
2823
|
+
expandTrigger && 'bh-td--expand-trigger',
|
|
2824
|
+
filter && 'bh-td--filter',
|
|
2825
|
+
expansion && 'bh-td--expansion',
|
|
2826
|
+
pinnedLeft && 'bh-td--pinned-left',
|
|
2827
|
+
pinnedRight && 'bh-td--pinned-right',
|
|
2828
|
+
className
|
|
2829
|
+
)}
|
|
2830
|
+
data-label={dataLabel}
|
|
2831
|
+
{...props}
|
|
2832
|
+
>
|
|
2833
|
+
{children}
|
|
2834
|
+
</td>
|
|
2835
|
+
);
|
|
2836
|
+
}
|
|
2837
|
+
);
|
|
2838
|
+
|
|
2839
|
+
TableCell.displayName = 'TableCell';
|
|
2840
|
+
|
|
2841
|
+
// =============================================================================
|
|
2842
|
+
// TableEmpty
|
|
2843
|
+
// =============================================================================
|
|
2844
|
+
|
|
2845
|
+
export interface TableEmptyProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
2846
|
+
/** Icon to display */
|
|
2847
|
+
icon?: React.ReactNode;
|
|
2848
|
+
/** Title text */
|
|
2849
|
+
title?: string;
|
|
2850
|
+
/** Description text */
|
|
2851
|
+
description?: string;
|
|
2852
|
+
/** Number of columns to span */
|
|
2853
|
+
colSpan?: number;
|
|
2854
|
+
}
|
|
2855
|
+
|
|
2856
|
+
export const TableEmpty = forwardRef<HTMLTableRowElement, TableEmptyProps>(
|
|
2857
|
+
(
|
|
2858
|
+
{ className, children, icon, title, description, colSpan = 1, ...props },
|
|
2859
|
+
ref
|
|
2860
|
+
) => {
|
|
2861
|
+
return (
|
|
2862
|
+
<tr ref={ref}>
|
|
2863
|
+
<td colSpan={colSpan}>
|
|
2864
|
+
<div className={clsx('bh-table-empty', className)} {...props}>
|
|
2865
|
+
{icon && <div className="bh-table-empty__icon">{icon}</div>}
|
|
2866
|
+
{title && <div className="bh-table-empty__title">{title}</div>}
|
|
2867
|
+
{description && (
|
|
2868
|
+
<div className="bh-table-empty__description">{description}</div>
|
|
2869
|
+
)}
|
|
2870
|
+
{children}
|
|
2871
|
+
</div>
|
|
2872
|
+
</td>
|
|
2873
|
+
</tr>
|
|
2874
|
+
);
|
|
2875
|
+
}
|
|
2876
|
+
);
|
|
2877
|
+
|
|
2878
|
+
TableEmpty.displayName = 'TableEmpty';
|
|
2879
|
+
|
|
2880
|
+
// =============================================================================
|
|
2881
|
+
// TableActionBar
|
|
2882
|
+
// =============================================================================
|
|
2883
|
+
|
|
2884
|
+
export interface TableActionBarProps
|
|
2885
|
+
extends React.HTMLAttributes<HTMLDivElement> {
|
|
2886
|
+
/** Selection count to display */
|
|
2887
|
+
selectionCount?: number;
|
|
2888
|
+
/** Left side content */
|
|
2889
|
+
left?: React.ReactNode;
|
|
2890
|
+
/** Right side content */
|
|
2891
|
+
right?: React.ReactNode;
|
|
2892
|
+
}
|
|
2893
|
+
|
|
2894
|
+
export const TableActionBar = forwardRef<HTMLDivElement, TableActionBarProps>(
|
|
2895
|
+
({ className, children, selectionCount, left, right, ...props }, ref) => {
|
|
2896
|
+
const hasSelection = selectionCount !== undefined && selectionCount > 0;
|
|
2897
|
+
|
|
2898
|
+
return (
|
|
2899
|
+
<div
|
|
2900
|
+
ref={ref}
|
|
2901
|
+
className={clsx(
|
|
2902
|
+
'bh-table-action-bar',
|
|
2903
|
+
hasSelection && 'bh-table-action-bar--selected',
|
|
2904
|
+
className
|
|
2905
|
+
)}
|
|
2906
|
+
{...props}
|
|
2907
|
+
>
|
|
2908
|
+
<div className="bh-table-action-bar__left">
|
|
2909
|
+
{hasSelection && (
|
|
2910
|
+
<span className="bh-table-action-bar__selection-count">
|
|
2911
|
+
{selectionCount} selected
|
|
2912
|
+
</span>
|
|
2913
|
+
)}
|
|
2914
|
+
{left}
|
|
2915
|
+
</div>
|
|
2916
|
+
<div className="bh-table-action-bar__right">{right}</div>
|
|
2917
|
+
{children}
|
|
2918
|
+
</div>
|
|
2919
|
+
);
|
|
2920
|
+
}
|
|
2921
|
+
);
|
|
2922
|
+
|
|
2923
|
+
TableActionBar.displayName = 'TableActionBar';
|
|
2924
|
+
|
|
2925
|
+
// =============================================================================
|
|
2926
|
+
// TablePagination
|
|
2927
|
+
// =============================================================================
|
|
2928
|
+
|
|
2929
|
+
export interface TablePaginationProps
|
|
2930
|
+
extends React.HTMLAttributes<HTMLDivElement> {
|
|
2931
|
+
/** Current page (1-indexed) */
|
|
2932
|
+
page: number;
|
|
2933
|
+
/** Total number of pages */
|
|
2934
|
+
totalPages: number;
|
|
2935
|
+
/** Total number of items */
|
|
2936
|
+
totalItems?: number;
|
|
2937
|
+
/** Items per page */
|
|
2938
|
+
pageSize: number;
|
|
2939
|
+
/** Available page sizes */
|
|
2940
|
+
pageSizeOptions?: number[];
|
|
2941
|
+
/** Callback when page changes */
|
|
2942
|
+
onPageChange: (page: number) => void;
|
|
2943
|
+
/** Callback when page size changes */
|
|
2944
|
+
onPageSizeChange?: (pageSize: number) => void;
|
|
2945
|
+
}
|
|
2946
|
+
|
|
2947
|
+
export const TablePagination = forwardRef<HTMLDivElement, TablePaginationProps>(
|
|
2948
|
+
(
|
|
2949
|
+
{
|
|
2950
|
+
className,
|
|
2951
|
+
page,
|
|
2952
|
+
totalPages,
|
|
2953
|
+
totalItems,
|
|
2954
|
+
pageSize,
|
|
2955
|
+
pageSizeOptions = [10, 25, 50, 100],
|
|
2956
|
+
onPageChange,
|
|
2957
|
+
onPageSizeChange,
|
|
2958
|
+
...props
|
|
2959
|
+
},
|
|
2960
|
+
ref
|
|
2961
|
+
) => {
|
|
2962
|
+
const startItem = (page - 1) * pageSize + 1;
|
|
2963
|
+
const endItem = Math.min(page * pageSize, totalItems || page * pageSize);
|
|
2964
|
+
|
|
2965
|
+
return (
|
|
2966
|
+
<div
|
|
2967
|
+
ref={ref}
|
|
2968
|
+
className={clsx('bh-table-pagination', className)}
|
|
2969
|
+
{...props}
|
|
2970
|
+
>
|
|
2971
|
+
<div className="bh-table-pagination__info">
|
|
2972
|
+
{totalItems !== undefined ? (
|
|
2973
|
+
<>
|
|
2974
|
+
Showing {startItem} to {endItem} of {totalItems} results
|
|
2975
|
+
</>
|
|
2976
|
+
) : (
|
|
2977
|
+
<>
|
|
2978
|
+
Page {page} of {totalPages}
|
|
2979
|
+
</>
|
|
2980
|
+
)}
|
|
2981
|
+
</div>
|
|
2982
|
+
<div className="bh-table-pagination__controls">
|
|
2983
|
+
{onPageSizeChange && (
|
|
2984
|
+
<div className="bh-table-pagination__page-size">
|
|
2985
|
+
<span>Rows per page:</span>
|
|
2986
|
+
<select
|
|
2987
|
+
value={pageSize}
|
|
2988
|
+
onChange={(e) => onPageSizeChange(Number(e.target.value))}
|
|
2989
|
+
className="bh-table-pagination__select"
|
|
2990
|
+
>
|
|
2991
|
+
{pageSizeOptions.map((size) => (
|
|
2992
|
+
<option key={size} value={size}>
|
|
2993
|
+
{size}
|
|
2994
|
+
</option>
|
|
2995
|
+
))}
|
|
2996
|
+
</select>
|
|
2997
|
+
</div>
|
|
2998
|
+
)}
|
|
2999
|
+
<BhButtonIcon
|
|
3000
|
+
iconName="first_page"
|
|
3001
|
+
size="sm"
|
|
3002
|
+
hierarchy="quaternary"
|
|
3003
|
+
disabled={page <= 1}
|
|
3004
|
+
onBhClick={() => onPageChange(1)}
|
|
3005
|
+
aria-label="First page"
|
|
3006
|
+
/>
|
|
3007
|
+
<BhButtonIcon
|
|
3008
|
+
iconName="chevron_left"
|
|
3009
|
+
size="sm"
|
|
3010
|
+
hierarchy="quaternary"
|
|
3011
|
+
disabled={page <= 1}
|
|
3012
|
+
onBhClick={() => onPageChange(page - 1)}
|
|
3013
|
+
aria-label="Previous page"
|
|
3014
|
+
/>
|
|
3015
|
+
<BhButtonIcon
|
|
3016
|
+
iconName="chevron_right"
|
|
3017
|
+
size="sm"
|
|
3018
|
+
hierarchy="quaternary"
|
|
3019
|
+
disabled={page >= totalPages}
|
|
3020
|
+
onBhClick={() => onPageChange(page + 1)}
|
|
3021
|
+
aria-label="Next page"
|
|
3022
|
+
/>
|
|
3023
|
+
<BhButtonIcon
|
|
3024
|
+
iconName="last_page"
|
|
3025
|
+
size="sm"
|
|
3026
|
+
hierarchy="quaternary"
|
|
3027
|
+
disabled={page >= totalPages}
|
|
3028
|
+
onBhClick={() => onPageChange(totalPages)}
|
|
3029
|
+
aria-label="Last page"
|
|
3030
|
+
/>
|
|
3031
|
+
</div>
|
|
3032
|
+
</div>
|
|
3033
|
+
);
|
|
3034
|
+
}
|
|
3035
|
+
);
|
|
3036
|
+
|
|
3037
|
+
TablePagination.displayName = 'TablePagination';
|
|
3038
|
+
|
|
3039
|
+
// =============================================================================
|
|
3040
|
+
// ExpandIcon
|
|
3041
|
+
// =============================================================================
|
|
3042
|
+
|
|
3043
|
+
export interface ExpandIconProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
3044
|
+
expanded?: boolean;
|
|
3045
|
+
}
|
|
3046
|
+
|
|
3047
|
+
export const ExpandIcon = forwardRef<HTMLSpanElement, ExpandIconProps>(
|
|
3048
|
+
({ className, expanded = false, ...props }, ref) => {
|
|
3049
|
+
return (
|
|
3050
|
+
<span ref={ref} className={clsx('bh-expand-icon', className)} {...props}>
|
|
3051
|
+
<span className="material-symbols-outlined">chevron_right</span>
|
|
3052
|
+
</span>
|
|
3053
|
+
);
|
|
3054
|
+
}
|
|
3055
|
+
);
|
|
3056
|
+
|
|
3057
|
+
ExpandIcon.displayName = 'ExpandIcon';
|
|
3058
|
+
|
|
3059
|
+
// =============================================================================
|
|
3060
|
+
// Exports
|
|
3061
|
+
// =============================================================================
|
|
3062
|
+
|
|
3063
|
+
export {
|
|
3064
|
+
Table as BhTable,
|
|
3065
|
+
TableWrapper as BhTableWrapper,
|
|
3066
|
+
TableCaption as BhTableCaption,
|
|
3067
|
+
TableHead as BhThead,
|
|
3068
|
+
TableBody as BhTbody,
|
|
3069
|
+
TableFooter as BhTfoot,
|
|
3070
|
+
TableRow as BhTr,
|
|
3071
|
+
TableHeaderCell as BhTh,
|
|
3072
|
+
TableCell as BhTd,
|
|
3073
|
+
TableEmpty as BhTableEmpty,
|
|
3074
|
+
TableActionBar as BhTableActionBar,
|
|
3075
|
+
TablePagination as BhTablePagination,
|
|
3076
|
+
ExpandIcon as BhExpandIcon,
|
|
3077
|
+
};
|
|
3078
|
+
|
|
3079
|
+
================
|
|
3080
|
+
File: src/index.ts
|
|
3081
|
+
================
|
|
3082
|
+
/**
|
|
3083
|
+
* Bellhop React Components
|
|
3084
|
+
*
|
|
3085
|
+
* This package provides:
|
|
3086
|
+
* 1. React wrapper components for BellhopOS Stencil web components (auto-generated)
|
|
3087
|
+
* 2. Native React table primitives with TanStack Table integration
|
|
3088
|
+
*
|
|
3089
|
+
* NOTE: For feature-rich data grids, use <BhDataGrid> from the Stencil components.
|
|
3090
|
+
* The table primitives below are for building custom table layouts.
|
|
3091
|
+
*/
|
|
3092
|
+
|
|
3093
|
+
// Re-export all generated Stencil React components
|
|
3094
|
+
export * from './components/stencil-generated';
|
|
3095
|
+
|
|
3096
|
+
// Re-export types from the core Stencil package
|
|
3097
|
+
export type {
|
|
3098
|
+
ButtonHierarchy,
|
|
3099
|
+
ButtonIconPosition,
|
|
3100
|
+
ButtonSize,
|
|
3101
|
+
} from '@actabldesign/bellhop-core';
|
|
3102
|
+
|
|
3103
|
+
// =============================================================================
|
|
3104
|
+
// Table Primitives (for composable tables)
|
|
3105
|
+
// =============================================================================
|
|
3106
|
+
|
|
3107
|
+
export {
|
|
3108
|
+
// Table primitives
|
|
3109
|
+
Table,
|
|
3110
|
+
TableWrapper,
|
|
3111
|
+
TableCaption,
|
|
3112
|
+
TableHead,
|
|
3113
|
+
TableBody,
|
|
3114
|
+
TableFooter,
|
|
3115
|
+
TableRow,
|
|
3116
|
+
TableHeaderCell,
|
|
3117
|
+
TableCell,
|
|
3118
|
+
TableEmpty,
|
|
3119
|
+
TableActionBar,
|
|
3120
|
+
TablePagination,
|
|
3121
|
+
ExpandIcon,
|
|
3122
|
+
// Aliased exports (Bh prefix)
|
|
3123
|
+
BhTable,
|
|
3124
|
+
BhTableWrapper,
|
|
3125
|
+
BhTableCaption,
|
|
3126
|
+
BhThead,
|
|
3127
|
+
BhTbody,
|
|
3128
|
+
BhTfoot,
|
|
3129
|
+
BhTr,
|
|
3130
|
+
BhTh,
|
|
3131
|
+
BhTd,
|
|
3132
|
+
BhTableEmpty,
|
|
3133
|
+
BhTableActionBar,
|
|
3134
|
+
BhTablePagination,
|
|
3135
|
+
BhExpandIcon,
|
|
3136
|
+
} from './components/table';
|
|
3137
|
+
|
|
3138
|
+
export type {
|
|
3139
|
+
TableProps,
|
|
3140
|
+
TableWrapperProps,
|
|
3141
|
+
TableCaptionProps,
|
|
3142
|
+
TableHeadProps,
|
|
3143
|
+
TableBodyProps,
|
|
3144
|
+
TableFooterProps,
|
|
3145
|
+
TableRowProps,
|
|
3146
|
+
TableHeaderCellProps,
|
|
3147
|
+
TableCellProps,
|
|
3148
|
+
TableEmptyProps,
|
|
3149
|
+
TableActionBarProps,
|
|
3150
|
+
TablePaginationProps,
|
|
3151
|
+
ExpandIconProps,
|
|
3152
|
+
TableSize,
|
|
3153
|
+
TableVariant,
|
|
3154
|
+
CellAlign,
|
|
3155
|
+
} from './components/table';
|
|
3156
|
+
|
|
3157
|
+
// =============================================================================
|
|
3158
|
+
// DataTable (TanStack Table integration)
|
|
3159
|
+
// =============================================================================
|
|
3160
|
+
|
|
3161
|
+
export {
|
|
3162
|
+
DataTable,
|
|
3163
|
+
BhDataTable,
|
|
3164
|
+
useDataTable,
|
|
3165
|
+
createSelectColumn,
|
|
3166
|
+
createExpandColumn,
|
|
3167
|
+
createEditActionsColumn,
|
|
3168
|
+
} from './components/table/DataTable';
|
|
3169
|
+
|
|
3170
|
+
export type {
|
|
3171
|
+
DataTableProps,
|
|
3172
|
+
UseDataTableOptions,
|
|
3173
|
+
ColumnDef,
|
|
3174
|
+
SortingState,
|
|
3175
|
+
ColumnFiltersState,
|
|
3176
|
+
RowSelectionState,
|
|
3177
|
+
EditMode,
|
|
3178
|
+
EditState,
|
|
3179
|
+
EditingValues,
|
|
3180
|
+
RowChanges,
|
|
3181
|
+
DataTableColumnMeta,
|
|
3182
|
+
} from './components/table/DataTable';
|
|
3183
|
+
|
|
3184
|
+
================
|
|
3185
|
+
File: package.json
|
|
3186
|
+
================
|
|
3187
|
+
{
|
|
3188
|
+
"name": "@actabldesign/bellhop-react",
|
|
3189
|
+
"version": "0.0.4",
|
|
3190
|
+
"description": "React components for Bellhop - Stencil wrappers and native React table primitives",
|
|
3191
|
+
"main": "dist/index.js",
|
|
3192
|
+
"module": "dist/index.js",
|
|
3193
|
+
"types": "dist/index.d.ts",
|
|
3194
|
+
"repository": {
|
|
3195
|
+
"type": "git",
|
|
3196
|
+
"url": "git+https://github.com/actabldesign/bellhop.git",
|
|
3197
|
+
"directory": "packages/bellhop-react"
|
|
3198
|
+
},
|
|
3199
|
+
"files": [
|
|
3200
|
+
"dist/"
|
|
3201
|
+
],
|
|
3202
|
+
"scripts": {
|
|
3203
|
+
"build": "tsc",
|
|
3204
|
+
"build:watch": "tsc --watch"
|
|
3205
|
+
},
|
|
3206
|
+
"dependencies": {
|
|
3207
|
+
"@actabldesign/bellhop-core": "file:../bellhop-core",
|
|
3208
|
+
"@stencil/react-output-target": "^0.7.1"
|
|
3209
|
+
},
|
|
3210
|
+
"peerDependencies": {
|
|
3211
|
+
"react": ">=17.0.0",
|
|
3212
|
+
"react-dom": ">=17.0.0"
|
|
3213
|
+
},
|
|
3214
|
+
"devDependencies": {
|
|
3215
|
+
"@types/react": "^18.0.0",
|
|
3216
|
+
"@types/react-dom": "^18.0.0",
|
|
3217
|
+
"typescript": "^5.0.0"
|
|
3218
|
+
},
|
|
3219
|
+
"license": "MIT",
|
|
3220
|
+
"publishConfig": {
|
|
3221
|
+
"registry": "https://registry.npmjs.org/",
|
|
3222
|
+
"access": "public"
|
|
3223
|
+
}
|
|
3224
|
+
}
|
|
3225
|
+
|
|
3226
|
+
================
|
|
3227
|
+
File: project.json
|
|
3228
|
+
================
|
|
3229
|
+
{
|
|
3230
|
+
"name": "bellhop-react",
|
|
3231
|
+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
3232
|
+
"sourceRoot": "packages/bellhop-react/src",
|
|
3233
|
+
"projectType": "library",
|
|
3234
|
+
"tags": ["scope:react", "type:lib"],
|
|
3235
|
+
"targets": {
|
|
3236
|
+
"build": {
|
|
3237
|
+
"executor": "nx:run-commands",
|
|
3238
|
+
"dependsOn": ["^build"],
|
|
3239
|
+
"options": {
|
|
3240
|
+
"command": "npx tsc",
|
|
3241
|
+
"cwd": "packages/bellhop-react"
|
|
3242
|
+
},
|
|
3243
|
+
"outputs": ["{projectRoot}/dist"]
|
|
3244
|
+
}
|
|
3245
|
+
},
|
|
3246
|
+
"implicitDependencies": ["bellhop-core"]
|
|
3247
|
+
}
|
|
3248
|
+
|
|
3249
|
+
================
|
|
3250
|
+
File: README.md
|
|
3251
|
+
================
|
|
3252
|
+
# @actabldesign/bellhop-react
|
|
3253
|
+
|
|
3254
|
+
React component library for the Bellhop design system. Provides React wrappers for Stencil web components and native React table primitives with TanStack Table integration.
|
|
3255
|
+
|
|
3256
|
+
## Installation
|
|
3257
|
+
|
|
3258
|
+
```bash
|
|
3259
|
+
npm install @actabldesign/bellhop-react
|
|
3260
|
+
```
|
|
3261
|
+
|
|
3262
|
+
### Peer Dependencies
|
|
3263
|
+
|
|
3264
|
+
```bash
|
|
3265
|
+
npm install react react-dom
|
|
3266
|
+
```
|
|
3267
|
+
|
|
3268
|
+
For table components with TanStack Table features:
|
|
3269
|
+
|
|
3270
|
+
```bash
|
|
3271
|
+
npm install @tanstack/react-table
|
|
3272
|
+
```
|
|
3273
|
+
|
|
3274
|
+
## Usage
|
|
3275
|
+
|
|
3276
|
+
### Stencil Component Wrappers
|
|
3277
|
+
|
|
3278
|
+
All Bellhop web components are available as React components with full TypeScript support and proper event handling.
|
|
3279
|
+
|
|
3280
|
+
```tsx
|
|
3281
|
+
import { BhButton, BhInputText, BhCard } from '@actabldesign/bellhop-react';
|
|
3282
|
+
|
|
3283
|
+
function MyComponent() {
|
|
3284
|
+
return (
|
|
3285
|
+
<BhCard>
|
|
3286
|
+
<BhInputText
|
|
3287
|
+
label="Email"
|
|
3288
|
+
placeholder="Enter your email"
|
|
3289
|
+
onBhInput={(e) => console.log(e.detail)}
|
|
3290
|
+
/>
|
|
3291
|
+
<BhButton hierarchy="primary" onBhClick={() => console.log('Clicked!')}>
|
|
3292
|
+
Submit
|
|
3293
|
+
</BhButton>
|
|
3294
|
+
</BhCard>
|
|
3295
|
+
);
|
|
3296
|
+
}
|
|
3297
|
+
```
|
|
3298
|
+
|
|
3299
|
+
### Available Stencil Components
|
|
3300
|
+
|
|
3301
|
+
- **Layout**: `BhCard`, `BhContainer`, `BhModal`, `BhSidebar`, `BhAppbar`
|
|
3302
|
+
- **Forms**: `BhInputText`, `BhInputPassword`, `BhInputNumber`, `BhTextarea`, `BhCheckbox`, `BhRadioButton`, `BhToggle`, `BhDropdown`
|
|
3303
|
+
- **Buttons**: `BhButton`, `BhButtonIcon`
|
|
3304
|
+
- **Data Display**: `BhDataGrid`, `BhBadge`, `BhTag`, `BhAvatar`, `BhTooltip`
|
|
3305
|
+
- **Navigation**: `BhTabs`, `BhBreadcrumbs`, `BhPagination`, `BhPageNavigation`
|
|
3306
|
+
- **Feedback**: `BhNotification`, `BhLoaderSpinner`, `BhEmptyState`, `BhSkeletonLoader`
|
|
3307
|
+
- **Date/Time**: `BhDatePicker`, `BhDateRangePicker`, `BhMonthPicker`
|
|
3308
|
+
- **Charts**: `BhBarChart`, `BhPieChart`, `BhTrendChart`
|
|
3309
|
+
|
|
3310
|
+
## Table Components
|
|
3311
|
+
|
|
3312
|
+
### Table Primitives
|
|
3313
|
+
|
|
3314
|
+
Composable table components for building static and dynamic tables.
|
|
3315
|
+
|
|
3316
|
+
```tsx
|
|
3317
|
+
import {
|
|
3318
|
+
Table,
|
|
3319
|
+
TableWrapper,
|
|
3320
|
+
TableHead,
|
|
3321
|
+
TableBody,
|
|
3322
|
+
TableRow,
|
|
3323
|
+
TableHeaderCell,
|
|
3324
|
+
TableCell,
|
|
3325
|
+
TablePagination,
|
|
3326
|
+
} from '@actabldesign/bellhop-react';
|
|
3327
|
+
|
|
3328
|
+
function BasicTable() {
|
|
3329
|
+
return (
|
|
3330
|
+
<TableWrapper>
|
|
3331
|
+
<Table size="default" variant="default" hoverable>
|
|
3332
|
+
<TableHead>
|
|
3333
|
+
<TableRow>
|
|
3334
|
+
<TableHeaderCell>Name</TableHeaderCell>
|
|
3335
|
+
<TableHeaderCell>Email</TableHeaderCell>
|
|
3336
|
+
<TableHeaderCell align="right">Actions</TableHeaderCell>
|
|
3337
|
+
</TableRow>
|
|
3338
|
+
</TableHead>
|
|
3339
|
+
<TableBody>
|
|
3340
|
+
<TableRow>
|
|
3341
|
+
<TableCell>John Doe</TableCell>
|
|
3342
|
+
<TableCell>john@example.com</TableCell>
|
|
3343
|
+
<TableCell align="right">Edit</TableCell>
|
|
3344
|
+
</TableRow>
|
|
3345
|
+
</TableBody>
|
|
3346
|
+
</Table>
|
|
3347
|
+
</TableWrapper>
|
|
3348
|
+
);
|
|
3349
|
+
}
|
|
3350
|
+
```
|
|
3351
|
+
|
|
3352
|
+
#### Table Primitive Components
|
|
3353
|
+
|
|
3354
|
+
| Component | Description |
|
|
3355
|
+
|-----------|-------------|
|
|
3356
|
+
| `Table` | Main table element with size, variant, and styling options |
|
|
3357
|
+
| `TableWrapper` | Scrollable container for tables |
|
|
3358
|
+
| `TableCaption` | Accessible table caption |
|
|
3359
|
+
| `TableHead` | Table header section (`<thead>`) |
|
|
3360
|
+
| `TableBody` | Table body section (`<tbody>`) |
|
|
3361
|
+
| `TableFooter` | Table footer section (`<tfoot>`) |
|
|
3362
|
+
| `TableRow` | Table row with selection and expansion states |
|
|
3363
|
+
| `TableHeaderCell` | Header cell with sorting support |
|
|
3364
|
+
| `TableCell` | Data cell with alignment and truncation options |
|
|
3365
|
+
| `TableEmpty` | Empty state display for tables |
|
|
3366
|
+
| `TableActionBar` | Toolbar for bulk actions and filters |
|
|
3367
|
+
| `TablePagination` | Pagination controls |
|
|
3368
|
+
|
|
3369
|
+
### DataTable (TanStack Table Integration)
|
|
3370
|
+
|
|
3371
|
+
A feature-rich data table component with built-in sorting, filtering, pagination, selection, expansion, grouping, and inline editing.
|
|
3372
|
+
|
|
3373
|
+
```tsx
|
|
3374
|
+
import { DataTable, ColumnDef } from '@actabldesign/bellhop-react';
|
|
3375
|
+
|
|
3376
|
+
interface User {
|
|
3377
|
+
id: string;
|
|
3378
|
+
name: string;
|
|
3379
|
+
email: string;
|
|
3380
|
+
role: string;
|
|
3381
|
+
}
|
|
3382
|
+
|
|
3383
|
+
const columns: ColumnDef<User>[] = [
|
|
3384
|
+
{ accessorKey: 'name', header: 'Name' },
|
|
3385
|
+
{ accessorKey: 'email', header: 'Email' },
|
|
3386
|
+
{ accessorKey: 'role', header: 'Role' },
|
|
3387
|
+
];
|
|
3388
|
+
|
|
3389
|
+
function UsersTable({ users }: { users: User[] }) {
|
|
3390
|
+
return (
|
|
3391
|
+
<DataTable
|
|
3392
|
+
data={users}
|
|
3393
|
+
columns={columns}
|
|
3394
|
+
enableSorting
|
|
3395
|
+
enablePagination
|
|
3396
|
+
enableRowSelection
|
|
3397
|
+
pageSize={10}
|
|
3398
|
+
onSelectionChange={(selected) => console.log(selected)}
|
|
3399
|
+
/>
|
|
3400
|
+
);
|
|
3401
|
+
}
|
|
3402
|
+
```
|
|
3403
|
+
|
|
3404
|
+
#### DataTable Props
|
|
3405
|
+
|
|
3406
|
+
| Prop | Type | Default | Description |
|
|
3407
|
+
|------|------|---------|-------------|
|
|
3408
|
+
| `data` | `TData[]` | required | Table data array |
|
|
3409
|
+
| `columns` | `ColumnDef<TData>[]` | required | Column definitions |
|
|
3410
|
+
| `size` | `'compact' \| 'default' \| 'relaxed'` | `'default'` | Row height |
|
|
3411
|
+
| `variant` | `'default' \| 'bordered' \| 'striped'` | `'default'` | Visual style |
|
|
3412
|
+
| `enableSorting` | `boolean` | `true` | Enable column sorting |
|
|
3413
|
+
| `enableFiltering` | `boolean` | `false` | Enable column filters |
|
|
3414
|
+
| `enablePagination` | `boolean` | `true` | Enable pagination |
|
|
3415
|
+
| `enableRowSelection` | `boolean` | `false` | Enable row selection |
|
|
3416
|
+
| `enableExpanding` | `boolean` | `false` | Enable row expansion |
|
|
3417
|
+
| `enableGrouping` | `boolean` | `false` | Enable row grouping |
|
|
3418
|
+
| `enableEditing` | `boolean` | `false` | Enable inline editing |
|
|
3419
|
+
| `editMode` | `'cell' \| 'row'` | `'cell'` | Editing mode |
|
|
3420
|
+
| `pageSize` | `number` | `10` | Initial page size |
|
|
3421
|
+
| `stickyHeader` | `boolean` | `false` | Sticky table header |
|
|
3422
|
+
| `hoverable` | `boolean` | `true` | Row hover effect |
|
|
3423
|
+
| `loading` | `boolean` | `false` | Loading state |
|
|
3424
|
+
| `getRowId` | `(row, index) => string` | - | Custom row ID accessor |
|
|
3425
|
+
| `onSelectionChange` | `(rows) => void` | - | Selection change callback |
|
|
3426
|
+
| `onSortingChange` | `(sorting) => void` | - | Sort change callback |
|
|
3427
|
+
| `onRowClick` | `(row) => void` | - | Row click callback |
|
|
3428
|
+
| `onEditSave` | `(changes) => void` | - | Edit save callback |
|
|
3429
|
+
|
|
3430
|
+
#### Column Helpers
|
|
3431
|
+
|
|
3432
|
+
```tsx
|
|
3433
|
+
import {
|
|
3434
|
+
createSelectColumn,
|
|
3435
|
+
createExpandColumn,
|
|
3436
|
+
createEditActionsColumn,
|
|
3437
|
+
} from '@actabldesign/bellhop-react';
|
|
3438
|
+
|
|
3439
|
+
// Add selection checkbox column
|
|
3440
|
+
const selectColumn = createSelectColumn<User>();
|
|
3441
|
+
|
|
3442
|
+
// Add expand/collapse column
|
|
3443
|
+
const expandColumn = createExpandColumn<User>();
|
|
3444
|
+
```
|
|
3445
|
+
|
|
3446
|
+
### useDataTable Hook
|
|
3447
|
+
|
|
3448
|
+
For more control over the table instance:
|
|
3449
|
+
|
|
3450
|
+
```tsx
|
|
3451
|
+
import { useDataTable } from '@actabldesign/bellhop-react';
|
|
3452
|
+
|
|
3453
|
+
function CustomTable({ data, columns }) {
|
|
3454
|
+
const table = useDataTable({
|
|
3455
|
+
data,
|
|
3456
|
+
columns,
|
|
3457
|
+
enableSorting: true,
|
|
3458
|
+
enablePagination: true,
|
|
3459
|
+
pageSize: 25,
|
|
3460
|
+
});
|
|
3461
|
+
|
|
3462
|
+
// Access table state and methods
|
|
3463
|
+
const { getRowModel, getHeaderGroups } = table;
|
|
3464
|
+
|
|
3465
|
+
// Build custom UI with table instance
|
|
3466
|
+
}
|
|
3467
|
+
```
|
|
3468
|
+
|
|
3469
|
+
## Type Exports
|
|
3470
|
+
|
|
3471
|
+
```tsx
|
|
3472
|
+
import type {
|
|
3473
|
+
// Button types
|
|
3474
|
+
ButtonHierarchy,
|
|
3475
|
+
ButtonIconPosition,
|
|
3476
|
+
ButtonSize,
|
|
3477
|
+
// Table types
|
|
3478
|
+
TableProps,
|
|
3479
|
+
TableSize,
|
|
3480
|
+
TableVariant,
|
|
3481
|
+
CellAlign,
|
|
3482
|
+
// DataTable types
|
|
3483
|
+
DataTableProps,
|
|
3484
|
+
ColumnDef,
|
|
3485
|
+
SortingState,
|
|
3486
|
+
ColumnFiltersState,
|
|
3487
|
+
RowSelectionState,
|
|
3488
|
+
EditMode,
|
|
3489
|
+
EditState,
|
|
3490
|
+
RowChanges,
|
|
3491
|
+
} from '@actabldesign/bellhop-react';
|
|
3492
|
+
```
|
|
3493
|
+
|
|
3494
|
+
## Styling
|
|
3495
|
+
|
|
3496
|
+
Components use CSS classes from `@actabldesign/bellhop-styles`. Import the styles in your application:
|
|
3497
|
+
|
|
3498
|
+
```tsx
|
|
3499
|
+
import '@actabldesign/bellhop-styles/dist/bellhop.css';
|
|
3500
|
+
```
|
|
3501
|
+
|
|
3502
|
+
## Related Packages
|
|
3503
|
+
|
|
3504
|
+
- `@actabldesign/bellhop-core` - Web Components (StencilJS)
|
|
3505
|
+
- `@actabldesign/bellhop-styles` - CSS styles and design tokens
|
|
3506
|
+
- `@actabldesign/bellhop-assets` - SVG icons, illustrations, logos
|
|
3507
|
+
|
|
3508
|
+
## License
|
|
3509
|
+
|
|
3510
|
+
MIT
|
|
3511
|
+
|
|
3512
|
+
================
|
|
3513
|
+
File: tsconfig.json
|
|
3514
|
+
================
|
|
3515
|
+
{
|
|
3516
|
+
"compilerOptions": {
|
|
3517
|
+
"target": "ES2020",
|
|
3518
|
+
"module": "ESNext",
|
|
3519
|
+
"moduleResolution": "bundler",
|
|
3520
|
+
"lib": ["DOM", "ES2020"],
|
|
3521
|
+
"jsx": "react-jsx",
|
|
3522
|
+
"declaration": true,
|
|
3523
|
+
"declarationMap": true,
|
|
3524
|
+
"strict": true,
|
|
3525
|
+
"noImplicitAny": true,
|
|
3526
|
+
"strictNullChecks": true,
|
|
3527
|
+
"noUnusedLocals": true,
|
|
3528
|
+
"noUnusedParameters": true,
|
|
3529
|
+
"esModuleInterop": true,
|
|
3530
|
+
"skipLibCheck": true,
|
|
3531
|
+
"forceConsistentCasingInFileNames": true,
|
|
3532
|
+
"outDir": "dist",
|
|
3533
|
+
"rootDir": "src",
|
|
3534
|
+
"paths": {
|
|
3535
|
+
"@actabldesign/bellhop-core": ["../bellhop-core/dist/types/components.d.ts"],
|
|
3536
|
+
"@actabldesign/bellhop-core/*": ["../bellhop-core/*"]
|
|
3537
|
+
},
|
|
3538
|
+
"baseUrl": ".",
|
|
3539
|
+
"typeRoots": ["./node_modules/@types", "../../node_modules/@types"]
|
|
3540
|
+
},
|
|
3541
|
+
"include": ["src"],
|
|
3542
|
+
"exclude": ["node_modules", "dist"]
|
|
3543
|
+
}
|
|
3544
|
+
|
|
3545
|
+
|
|
3546
|
+
|
|
3547
|
+
|
|
3548
|
+
|
|
3549
|
+
================================================================
|
|
3550
|
+
End of Codebase
|
|
3551
|
+
================================================================
|