@stokr/components-library 2.3.65-beta.10 → 2.3.65-beta.11
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/Chips/Chip.styles.js +3 -2
- package/package.json +3 -2
- package/dist/components/2FA/EnterCode.stories.js +0 -35
- package/dist/components/2FA/disable-2fa-flow.stories.js +0 -31
- package/dist/components/2FA/enable-2fa-flow.stories.js +0 -31
- package/dist/components/2FA/login-with-otp-flow.stories.js +0 -31
- package/dist/components/2FA/main-flow.stories.js +0 -162
- package/dist/components/AccountBalance/AccountBalance.stories.js +0 -83
- package/dist/components/AdminDashboard/Table/ReactTable.stories.js +0 -913
- package/dist/components/AgreementItem/AgreementItem.stories.js +0 -105
- package/dist/components/AnalyticGraphs/Analytic.js +0 -541
- package/dist/components/AnalyticGraphs/Analytic.styles.js +0 -25
- package/dist/components/BackButton/BackButton.stories.js +0 -32
- package/dist/components/Background/Background.stories.js +0 -75
- package/dist/components/BarChart/BarChart.js +0 -263
- package/dist/components/BarChart/BarChart.stories.js +0 -66
- package/dist/components/BarChart/BarChart.styles.js +0 -26
- package/dist/components/BarChartLegend/BarChartLegend.js +0 -79
- package/dist/components/BarChartLegend/BarChartLegend.styles.js +0 -21
- package/dist/components/BasicTable/BasicTable.stories.js +0 -59
- package/dist/components/BlogPost/BlogPost.stories.js +0 -160
- package/dist/components/Button/Button.stories.js +0 -146
- package/dist/components/Button/GlareButton.stories.js +0 -132
- package/dist/components/CapitalRaisedSummary/CapitalRaisedSummery.stories.js +0 -42
- package/dist/components/ChartBox/ChartBox.js +0 -41
- package/dist/components/ChartBox/ChartBox.stories.js +0 -17
- package/dist/components/ChartBox/ChartBox.styles.js +0 -27
- package/dist/components/ChartBox/ChartBoxDistribution.js +0 -27
- package/dist/components/ChartBox/ChartBoxDistribution.stories.js +0 -18
- package/dist/components/ChartLegend/ChartLegend.stories.js +0 -90
- package/dist/components/Checkbox/Checkbox.stories.js +0 -88
- package/dist/components/Checklist/ChecklistCard.stories.js +0 -102
- package/dist/components/Checklist/UserChecklist.js +0 -184
- package/dist/components/Checklist/UserChecklist.stories.js +0 -317
- package/dist/components/Chips/Chip.stories.js +0 -36
- package/dist/components/Chips/ChipsWrapper.stories.js +0 -47
- package/dist/components/ComponentScroll/ComponentScroll.stories.js +0 -111
- package/dist/components/CryptoAddress/CryptoAddress.stories.js +0 -205
- package/dist/components/CryptoAddressDetails/CryptoAddressDetails.stories.js +0 -70
- package/dist/components/DonutChart/DonutChart.stories.js +0 -54
- package/dist/components/FAQ/FAQ.stories.js +0 -76
- package/dist/components/Footer/Footer.stories.js +0 -49
- package/dist/components/Footer/FooterLayout.stories.js +0 -26
- package/dist/components/Footer/FooterMenu.stories.js +0 -113
- package/dist/components/Footer/mangopay.png +0 -0
- package/dist/components/Footer/mangopay.svg +0 -20
- package/dist/components/ForgotPasswordModal/ForgotPasswordModal.stories.js +0 -69
- package/dist/components/Form/Form.stories.js +0 -32
- package/dist/components/FullscreenCard/FullscreenCard.styles.js +0 -27
- package/dist/components/Header/Header.stories.js +0 -192
- package/dist/components/Icon/Icon.stories.js +0 -108
- package/dist/components/InfoIcon/InfoIcon.stories.js +0 -299
- package/dist/components/InfoPanel/InfoPanel.js +0 -124
- package/dist/components/Input/DatePickerInput.stories.js +0 -87
- package/dist/components/Input/Input.stories.js +0 -217
- package/dist/components/Input/InputPassword.stories.js +0 -80
- package/dist/components/Input/InputWithButton.stories.js +0 -75
- package/dist/components/Input/MultiSelect.stories.js +0 -264
- package/dist/components/Input/OtpInput.stories.js +0 -57
- package/dist/components/Input/RangeInput.stories.js +0 -58
- package/dist/components/Input/SearchInput.stories.js +0 -366
- package/dist/components/Input/Select.stories.js +0 -478
- package/dist/components/InvestCalculator/InvestCalculator.stories.js +0 -135
- package/dist/components/InvestmentStat/InvestmentStat.stories.js +0 -52
- package/dist/components/KYCFlow/BasicInfo.js +0 -448
- package/dist/components/KYCFlow/Confirmation.js +0 -46
- package/dist/components/KYCFlow/DocumentFileUpload.js +0 -263
- package/dist/components/KYCFlow/DocumentScan.js +0 -75
- package/dist/components/KYCFlow/DocumentScanUpload.js +0 -251
- package/dist/components/KYCFlow/DocumentSelect.js +0 -118
- package/dist/components/KYCFlow/DocumentSuccess.js +0 -63
- package/dist/components/KYCFlow/DocumentUpload.js +0 -53
- package/dist/components/KYCFlow/DocumentVerificationType.js +0 -131
- package/dist/components/KYCFlow/FaceScan.js +0 -54
- package/dist/components/KYCFlow/FaceScanRecognition.js +0 -61
- package/dist/components/KYCFlow/FaceScanSuccess.js +0 -56
- package/dist/components/KYCFlow/Terms.js +0 -119
- package/dist/components/KYCFlow/_styles.js +0 -111
- package/dist/components/KYCFlow/index.js +0 -97
- package/dist/components/KYCSelectBox/KYCSelectBox.styles.js +0 -29
- package/dist/components/LatestUpdate/LatestUpdate.stories.js +0 -58
- package/dist/components/Layout/Layout.stories.js +0 -60
- package/dist/components/LearnMoreCarousel/LearnMoreCarousel.stories.js +0 -66
- package/dist/components/LearnMorePage/LearnMore.stories.js +0 -48
- package/dist/components/LearnMorePage/LearnMoreItem.stories.js +0 -62
- package/dist/components/LearnMoreSection/LearnMore.stories.js +0 -30
- package/dist/components/LearnMoreSection/LearnMoreItem.stories.js +0 -59
- package/dist/components/LoginModal/LoginModal.stories.js +0 -74
- package/dist/components/MatomoConnect/Matomo.js +0 -228
- package/dist/components/MatomoConnect/Matomo_fuckup.js +0 -387
- package/dist/components/Modal/Modal.stories.js +0 -75
- package/dist/components/Modal/NewVentureModal/NewVentureModal.stories.js +0 -150
- package/dist/components/Modal/PaymentModal.stories.js +0 -57
- package/dist/components/Modal/SideModal.stories.js +0 -342
- package/dist/components/MultiProgressBar/MultiProgressBar.stories.js +0 -67
- package/dist/components/Newsletter/Newsletter.stories.js +0 -16
- package/dist/components/NotificationContext/NotificationContext.js +0 -141
- package/dist/components/Number/Number.stories.js +0 -92
- package/dist/components/Pagination/Pagination.stories.js +0 -83
- package/dist/components/Pagination/PaginationControls.stories.js +0 -112
- package/dist/components/Payment/PaymentDetailsCard.stories.js +0 -198
- package/dist/components/Payment/PaymentDisplay.stories.js +0 -302
- package/dist/components/Payment/TimerComponent.stories.js +0 -236
- package/dist/components/Process/Process.stories.js +0 -42
- package/dist/components/ProfileBadge/ProfileBadge.stories.js +0 -45
- package/dist/components/ProfileBox/ProfileBox.stories.js +0 -35
- package/dist/components/ProfileHeader/ProfileHeader.js +0 -252
- package/dist/components/ProfileHeader/ProfileHeader.styles.js +0 -65
- package/dist/components/ProfileStat/ProfileStat.stories.js +0 -66
- package/dist/components/ProofOfAddress/ProofOfAddress.styles.js +0 -53
- package/dist/components/QRCode/QRCode.stories.js +0 -104
- package/dist/components/Radio/Radio.stories.js +0 -73
- package/dist/components/RefreshButton/RefreshButton.stories.js +0 -38
- package/dist/components/RegisterAlgorand/AlgoAddressName.js +0 -138
- package/dist/components/RegisterAlgorand/AlgoAdressSelect.js +0 -443
- package/dist/components/RegisterAlgorand/AlgoConnectWallet.js +0 -47
- package/dist/components/RegisterAlgorand/AlgoSuccess.js +0 -38
- package/dist/components/RegisterAlgorand/Algorand.stories.js +0 -80
- package/dist/components/RegisterAlgorand/ChooseWallet.js +0 -97
- package/dist/components/RegisterAlgorand/SelectProject.js +0 -89
- package/dist/components/RegisterAlgorand/_styles.js +0 -28
- package/dist/components/RegisterAlgorand/flow.js +0 -409
- package/dist/components/RegisterAlgorand/flowWithMemo.js +0 -410
- package/dist/components/RegisterAlgorand/index.js +0 -48
- package/dist/components/RegisterConfirmModal/RegisterConfirmModal.stories.js +0 -41
- package/dist/components/RegisterEthereum/EthAddressLedger.js +0 -226
- package/dist/components/RegisterEthereum/EthAddressMetamask.js +0 -204
- package/dist/components/RegisterEthereum/EthAddressName.js +0 -135
- package/dist/components/RegisterEthereum/EthConnectLedger.js +0 -194
- package/dist/components/RegisterEthereum/EthConnectMetamask.js +0 -35
- package/dist/components/RegisterEthereum/EthFinish.js +0 -41
- package/dist/components/RegisterEthereum/EthIntro.js +0 -95
- package/dist/components/RegisterEthereum/_styles.js +0 -28
- package/dist/components/RegisterEthereum/index.js +0 -68
- package/dist/components/RegisterModal/RegisterModal.stories.js +0 -49
- package/dist/components/RequestDataBox/RequestDataBox.stories.js +0 -37
- package/dist/components/RiskQuestionnaire/RiskQuestionnaireContext.js +0 -185
- package/dist/components/RiskQuestionnaire/_styles.js +0 -15
- package/dist/components/SEO/SEO.stories.js +0 -60
- package/dist/components/SideLine/SideLine.stories.js +0 -28
- package/dist/components/SigningSubflow/SignSubAddressMetamask.js +0 -137
- package/dist/components/SigningSubflow/SignSubConnectLedger.js +0 -150
- package/dist/components/SigningSubflow/SignSubConnectMetamask.js +0 -137
- package/dist/components/SigningSubflow/SignSubIntro.js +0 -55
- package/dist/components/SigningSubflow/SignSubSendLedger.js +0 -150
- package/dist/components/SigningSubflow/SignSubSendMetamask.js +0 -62
- package/dist/components/SigningSubflow/SignSubTransactionLedger.js +0 -161
- package/dist/components/SigningSubflow/SignSubTransactionMetamask.js +0 -166
- package/dist/components/SigningSubflow/_styles.js +0 -34
- package/dist/components/SigningSubflow/index.js +0 -32
- package/dist/components/Slider/Slider.stories.js +0 -68
- package/dist/components/Snackbar/Snackbar.stories.js +0 -292
- package/dist/components/StatusTag/StatusTag.stories.js +0 -262
- package/dist/components/StepController/StepController.stories.js +0 -60
- package/dist/components/StepController/StepControllerProgress.stories.js +0 -49
- package/dist/components/StepsProgress/StepIndicator.stories.js +0 -153
- package/dist/components/StepsProgress/StepsProgress.stories.js +0 -49
- package/dist/components/Switch/Switch.stories.js +0 -81
- package/dist/components/Tabs/Tabs.stories.js +0 -36
- package/dist/components/TabsNav/TabNav.stories.js +0 -40
- package/dist/components/TabsNav/TabsNav.stories.js +0 -37
- package/dist/components/TeamOverview/TeamOverview.stories.js +0 -76
- package/dist/components/TermsModal/TermsModal.stories.js +0 -31
- package/dist/components/Text/Headline.stories.js +0 -48
- package/dist/components/Text/Text.stories.js +0 -70
- package/dist/components/TextLink/TextLink.stories.js +0 -35
- package/dist/components/Timeline/Timeline.stories.js +0 -393
- package/dist/components/ToDoList/ToDoList.stories.js +0 -133
- package/dist/components/ToDoList/ToDoListTask.stories.js +0 -70
- package/dist/components/TransactionDetails/TransactionDetails.stories.js +0 -55
- package/dist/components/TransactionDetails/TransactionDetailsTable.stories.js +0 -305
- package/dist/components/TransactionInfo/TransactionInfo.stories.js +0 -61
- package/dist/components/TwoFactorModal/TwoFactorModal.js +0 -100
- package/dist/components/VerifyEmailModal/VerifyEmailModal.stories.js +0 -59
- package/dist/components/headerHo/HeaderHo.stories.js +0 -35
- package/dist/components/icons/Arrow.stories.js +0 -42
- package/dist/components/icons/ArrowSimple.stories.js +0 -48
- package/dist/components/icons/Check.stories.js +0 -22
- package/dist/components/icons/Facebook.stories.js +0 -21
- package/dist/components/icons/Facebook_Logo.png +0 -0
- package/dist/components/icons/Info.stories.js +0 -16
- package/dist/components/icons/Instagram.stories.js +0 -21
- package/dist/components/icons/LI-In-Bug.png +0 -0
- package/dist/components/icons/LinkIcon.stories.js +0 -21
- package/dist/components/icons/LinkedIn.stories.js +0 -16
- package/dist/components/icons/Medium.stories.js +0 -16
- package/dist/components/icons/Reddit.stories.js +0 -21
- package/dist/components/icons/Share.stories.js +0 -16
- package/dist/components/icons/Telegram-Logo.png +0 -0
- package/dist/components/icons/Telegram.stories.js +0 -16
- package/dist/components/icons/Twitter.stories.js +0 -21
- package/dist/components/icons/X-logo-black.png +0 -0
- package/dist/components/icons/X.stories.js +0 -16
- package/dist/components/icons/Youtube.stories.js +0 -21
- package/dist/components/icons/youtube_social_circle_red.png +0 -0
- package/dist/components/logo/Logo.stories.js +0 -260
- package/dist/components/taxId/TaxId.stories.js +0 -50
- package/dist/components/video/Video.stories.js +0 -52
|
@@ -1,913 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.WrapperWithSubTable = exports.WithoutPagination = exports.WithSubTable = exports.WithStatusBasedHover = exports.WithRowSpecificHover = exports.WithRowHover = exports.WithRowClick = exports.WithHoverStylesAndContent = exports.WithHoverContent = exports.WithFixedColumnWidths = exports.WithCustomStyling = exports.SortableHeaders = exports.RowClickWithExpandedContent = exports.RowClickWithButtons = exports.PerColumnHeaderClick = exports.HeaderClick = exports.FilterableHeaders = exports.ExpandedWithRichContent = exports.DefaultWrapper = exports.Default = exports.CustomStyledTable = exports.CustomExpandedContent = exports.BoxStyleTable = exports.BlueWrapper = exports.BlueTable = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _ReactTable = require("./ReactTable");
|
|
9
|
-
var _ReactTableWrapper = require("./ReactTableWrapper");
|
|
10
|
-
var _global = _interopRequireDefault(require("../../../styles/global"));
|
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
15
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
16
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
|
-
var _default = exports.default = {
|
|
18
|
-
title: 'Components Library/React table',
|
|
19
|
-
component: _ReactTable.ReactTable,
|
|
20
|
-
parameters: {
|
|
21
|
-
docs: {
|
|
22
|
-
description: {
|
|
23
|
-
component: 'A flexible and customizable data table component with sorting, pagination, and custom styling options.'
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
argTypes: {
|
|
28
|
-
data: {
|
|
29
|
-
control: 'object'
|
|
30
|
-
},
|
|
31
|
-
columns: {
|
|
32
|
-
control: 'object'
|
|
33
|
-
},
|
|
34
|
-
noPagination: {
|
|
35
|
-
control: 'boolean'
|
|
36
|
-
},
|
|
37
|
-
blue: {
|
|
38
|
-
control: 'boolean'
|
|
39
|
-
},
|
|
40
|
-
withSubTable: {
|
|
41
|
-
control: 'boolean'
|
|
42
|
-
},
|
|
43
|
-
customTdStyles: {
|
|
44
|
-
control: 'function'
|
|
45
|
-
},
|
|
46
|
-
customThStyles: {
|
|
47
|
-
control: 'function'
|
|
48
|
-
},
|
|
49
|
-
customRowHoverStyles: {
|
|
50
|
-
control: 'function'
|
|
51
|
-
},
|
|
52
|
-
customRowHoverContent: {
|
|
53
|
-
control: 'function'
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}; // Sample columns and data for demonstration
|
|
57
|
-
const columns = [{
|
|
58
|
-
Header: 'ID',
|
|
59
|
-
accessor: 'id',
|
|
60
|
-
width: '10%',
|
|
61
|
-
minWidth: '80px'
|
|
62
|
-
}, {
|
|
63
|
-
Header: 'Name',
|
|
64
|
-
accessor: 'name',
|
|
65
|
-
width: '30%',
|
|
66
|
-
minWidth: '150px'
|
|
67
|
-
}, {
|
|
68
|
-
Header: 'Status',
|
|
69
|
-
accessor: 'status',
|
|
70
|
-
width: '20%',
|
|
71
|
-
minWidth: '100px'
|
|
72
|
-
}, {
|
|
73
|
-
Header: '',
|
|
74
|
-
accessor: 'dropdown',
|
|
75
|
-
width: '40%',
|
|
76
|
-
minWidth: '120px'
|
|
77
|
-
}];
|
|
78
|
-
const columnsWrapper = [{
|
|
79
|
-
label: 'ID',
|
|
80
|
-
key: 'id',
|
|
81
|
-
width: '10%',
|
|
82
|
-
minWidth: '80px'
|
|
83
|
-
}, {
|
|
84
|
-
label: 'Name',
|
|
85
|
-
key: 'name',
|
|
86
|
-
width: '30%',
|
|
87
|
-
minWidth: '150px'
|
|
88
|
-
}, {
|
|
89
|
-
label: 'Status',
|
|
90
|
-
key: 'status',
|
|
91
|
-
width: '20%',
|
|
92
|
-
minWidth: '100px'
|
|
93
|
-
}, {
|
|
94
|
-
label: '',
|
|
95
|
-
key: 'dropdown',
|
|
96
|
-
width: '40%',
|
|
97
|
-
minWidth: '120px'
|
|
98
|
-
}];
|
|
99
|
-
const subColumns = [{
|
|
100
|
-
Header: 'Detail ID',
|
|
101
|
-
accessor: 'detailId'
|
|
102
|
-
}, {
|
|
103
|
-
Header: 'Detail Name',
|
|
104
|
-
accessor: 'detailName'
|
|
105
|
-
}];
|
|
106
|
-
const subColumnsWrapper = [{
|
|
107
|
-
label: 'Detail ID',
|
|
108
|
-
key: 'detailId'
|
|
109
|
-
}, {
|
|
110
|
-
label: 'Detail Name',
|
|
111
|
-
key: 'detailName'
|
|
112
|
-
}];
|
|
113
|
-
const data = [{
|
|
114
|
-
id: 1,
|
|
115
|
-
name: 'Alice',
|
|
116
|
-
status: 'Active',
|
|
117
|
-
subData: [{
|
|
118
|
-
detailId: 101,
|
|
119
|
-
detailName: 'Detail A1'
|
|
120
|
-
}, {
|
|
121
|
-
detailId: 102,
|
|
122
|
-
detailName: 'Detail A2'
|
|
123
|
-
}]
|
|
124
|
-
}, {
|
|
125
|
-
id: 2,
|
|
126
|
-
name: 'Bob',
|
|
127
|
-
status: 'Inactive',
|
|
128
|
-
subData: [{
|
|
129
|
-
detailId: 201,
|
|
130
|
-
detailName: 'Detail B1'
|
|
131
|
-
}, {
|
|
132
|
-
detailId: 202,
|
|
133
|
-
detailName: 'Detail B2'
|
|
134
|
-
}]
|
|
135
|
-
}, {
|
|
136
|
-
id: 3,
|
|
137
|
-
name: 'Carol',
|
|
138
|
-
status: 'Active',
|
|
139
|
-
subData: []
|
|
140
|
-
}, {
|
|
141
|
-
id: 4,
|
|
142
|
-
name: 'Dave',
|
|
143
|
-
status: 'Pending',
|
|
144
|
-
subData: []
|
|
145
|
-
}];
|
|
146
|
-
|
|
147
|
-
// Custom styling functions
|
|
148
|
-
const customTdStyles = (index, row, column) => {
|
|
149
|
-
if (index === 0) {
|
|
150
|
-
return {
|
|
151
|
-
backgroundColor: 'lightblue',
|
|
152
|
-
fontWeight: 'bold',
|
|
153
|
-
paddingBottom: 0
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
if (row.status === 'Inactive') {
|
|
157
|
-
return {
|
|
158
|
-
backgroundColor: 'lightgray'
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
if (row.status === 'Pending') {
|
|
162
|
-
return {
|
|
163
|
-
backgroundColor: 'lightyellow'
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
return {}; // default style
|
|
167
|
-
};
|
|
168
|
-
const customThStyles = column => {
|
|
169
|
-
return {
|
|
170
|
-
backgroundColor: 'lightblue'
|
|
171
|
-
};
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
// Custom row hover styles function
|
|
175
|
-
const customRowHoverStyles = (rowIndex, rowData) => {
|
|
176
|
-
return "\n background-color: #f0f8ff !important;\n transform: scale(1.01);\n transition: all 0.2s ease-in-out;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);\n \n td {\n background-color: #f0f8ff !important;\n border-bottom-color: #0050ca !important;\n }\n ";
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
// Custom row hover content function
|
|
180
|
-
const customRowHoverContent = (columnId, rowIndex, rowData) => {
|
|
181
|
-
switch (columnId) {
|
|
182
|
-
case 'name':
|
|
183
|
-
// Show underlined link on hover
|
|
184
|
-
return /*#__PURE__*/_react.default.createElement("a", {
|
|
185
|
-
href: "/user/".concat(rowData.id),
|
|
186
|
-
style: {
|
|
187
|
-
textDecoration: 'underline',
|
|
188
|
-
color: '#0050ca',
|
|
189
|
-
fontWeight: 'bold'
|
|
190
|
-
}
|
|
191
|
-
}, rowData.name);
|
|
192
|
-
case 'dropdown':
|
|
193
|
-
// Show action buttons on hover
|
|
194
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
195
|
-
style: {
|
|
196
|
-
display: 'flex',
|
|
197
|
-
gap: '8px'
|
|
198
|
-
}
|
|
199
|
-
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
200
|
-
style: {
|
|
201
|
-
padding: '4px 8px',
|
|
202
|
-
fontSize: '12px',
|
|
203
|
-
backgroundColor: '#0050ca',
|
|
204
|
-
color: 'white',
|
|
205
|
-
border: 'none',
|
|
206
|
-
borderRadius: '4px',
|
|
207
|
-
cursor: 'pointer'
|
|
208
|
-
},
|
|
209
|
-
onClick: () => alert("Edit ".concat(rowData.name))
|
|
210
|
-
}, "Edit"), /*#__PURE__*/_react.default.createElement("button", {
|
|
211
|
-
style: {
|
|
212
|
-
padding: '4px 8px',
|
|
213
|
-
fontSize: '12px',
|
|
214
|
-
backgroundColor: '#dc3545',
|
|
215
|
-
color: 'white',
|
|
216
|
-
border: 'none',
|
|
217
|
-
borderRadius: '4px',
|
|
218
|
-
cursor: 'pointer'
|
|
219
|
-
},
|
|
220
|
-
onClick: () => alert("Delete ".concat(rowData.name))
|
|
221
|
-
}, "Delete"));
|
|
222
|
-
case 'status':
|
|
223
|
-
// Show status with icon on hover
|
|
224
|
-
const statusColors = {
|
|
225
|
-
Active: '#28a745',
|
|
226
|
-
Inactive: '#dc3545',
|
|
227
|
-
Pending: '#ffc107'
|
|
228
|
-
};
|
|
229
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
230
|
-
style: {
|
|
231
|
-
display: 'flex',
|
|
232
|
-
alignItems: 'center',
|
|
233
|
-
gap: '4px'
|
|
234
|
-
}
|
|
235
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
236
|
-
style: {
|
|
237
|
-
width: '8px',
|
|
238
|
-
height: '8px',
|
|
239
|
-
borderRadius: '50%',
|
|
240
|
-
backgroundColor: statusColors[rowData.status] || '#6c757d'
|
|
241
|
-
}
|
|
242
|
-
}), rowData.status);
|
|
243
|
-
default:
|
|
244
|
-
return undefined;
|
|
245
|
-
// Return undefined to use default content
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
// Status-based hover styles
|
|
250
|
-
const statusBasedHoverStyles = (rowIndex, rowData) => {
|
|
251
|
-
switch (rowData.status) {
|
|
252
|
-
case 'Active':
|
|
253
|
-
return "\n background-color: #e8f5e8 !important;\n td {\n background-color: #e8f5e8 !important;\n border-bottom-color: #28a745 !important;\n }\n ";
|
|
254
|
-
case 'Inactive':
|
|
255
|
-
return "\n background-color: #ffe8e8 !important;\n td {\n background-color: #ffe8e8 !important;\n border-bottom-color: #dc3545 !important;\n }\n ";
|
|
256
|
-
case 'Pending':
|
|
257
|
-
return "\n background-color: #fff3cd !important;\n td {\n background-color: #fff3cd !important;\n border-bottom-color: #ffc107 !important;\n }\n ";
|
|
258
|
-
default:
|
|
259
|
-
return "\n background-color: #f8f9fa !important;\n td {\n background-color: #f8f9fa !important;\n }\n ";
|
|
260
|
-
}
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
// Row-specific hover styles (example: different styles for first and last rows)
|
|
264
|
-
const rowSpecificHoverStyles = (rowIndex, rowData) => {
|
|
265
|
-
// Special styling for first row
|
|
266
|
-
if (rowIndex === 0) {
|
|
267
|
-
return "\n background-color: #e3f2fd !important;\n transform: scale(1.02);\n box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);\n td {\n background-color: #e3f2fd !important;\n border-bottom-color: #2196f3 !important;\n font-weight: bold;\n }\n ";
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
// Special styling for last row
|
|
271
|
-
if (rowIndex === data.length - 1) {
|
|
272
|
-
return "\n background-color: #f3e5f5 !important;\n transform: scale(1.02);\n box-shadow: 0 4px 12px rgba(156, 39, 176, 0.3);\n td {\n background-color: #f3e5f5 !important;\n border-bottom-color: #9c27b0 !important;\n font-weight: bold;\n }\n ";
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
// Default styling for other rows
|
|
276
|
-
return "\n background-color: #f0f8ff !important;\n transform: scale(1.01);\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);\n td {\n background-color: #f0f8ff !important;\n border-bottom-color: #0050ca !important;\n }\n ";
|
|
277
|
-
};
|
|
278
|
-
|
|
279
|
-
// Function to calculate sub data
|
|
280
|
-
const calculateSubData = row => {
|
|
281
|
-
return row.original.subData || [];
|
|
282
|
-
};
|
|
283
|
-
const Template = args => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_global.default, null), /*#__PURE__*/_react.default.createElement(_ReactTable.ReactTable, args));
|
|
284
|
-
const TemplateWrapper = args => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_global.default, null), /*#__PURE__*/_react.default.createElement(_ReactTableWrapper.ReactTableWrapper, args));
|
|
285
|
-
const Default = exports.Default = Template.bind({});
|
|
286
|
-
Default.args = {
|
|
287
|
-
columns: columns,
|
|
288
|
-
data: data,
|
|
289
|
-
noPagination: false
|
|
290
|
-
};
|
|
291
|
-
const WithoutPagination = exports.WithoutPagination = Template.bind({});
|
|
292
|
-
WithoutPagination.args = _objectSpread(_objectSpread({}, Default.args), {}, {
|
|
293
|
-
noPagination: true
|
|
294
|
-
});
|
|
295
|
-
const WithCustomStyling = exports.WithCustomStyling = Template.bind({});
|
|
296
|
-
WithCustomStyling.args = _objectSpread(_objectSpread({}, Default.args), {}, {
|
|
297
|
-
customTdStyles: customTdStyles,
|
|
298
|
-
customThStyles: customThStyles
|
|
299
|
-
});
|
|
300
|
-
const WithRowHover = exports.WithRowHover = Template.bind({});
|
|
301
|
-
WithRowHover.args = _objectSpread(_objectSpread({}, Default.args), {}, {
|
|
302
|
-
customRowHoverStyles: customRowHoverStyles
|
|
303
|
-
});
|
|
304
|
-
const WithHoverContent = exports.WithHoverContent = Template.bind({});
|
|
305
|
-
WithHoverContent.args = _objectSpread(_objectSpread({}, Default.args), {}, {
|
|
306
|
-
customRowHoverContent: customRowHoverContent
|
|
307
|
-
});
|
|
308
|
-
const WithHoverStylesAndContent = exports.WithHoverStylesAndContent = Template.bind({});
|
|
309
|
-
WithHoverStylesAndContent.args = _objectSpread(_objectSpread({}, Default.args), {}, {
|
|
310
|
-
customRowHoverStyles: customRowHoverStyles,
|
|
311
|
-
customRowHoverContent: customRowHoverContent
|
|
312
|
-
});
|
|
313
|
-
const WithStatusBasedHover = exports.WithStatusBasedHover = Template.bind({});
|
|
314
|
-
WithStatusBasedHover.args = _objectSpread(_objectSpread({}, Default.args), {}, {
|
|
315
|
-
customRowHoverStyles: statusBasedHoverStyles
|
|
316
|
-
});
|
|
317
|
-
const WithRowSpecificHover = exports.WithRowSpecificHover = Template.bind({});
|
|
318
|
-
WithRowSpecificHover.args = _objectSpread(_objectSpread({}, Default.args), {}, {
|
|
319
|
-
customRowHoverStyles: rowSpecificHoverStyles
|
|
320
|
-
});
|
|
321
|
-
const WithFixedColumnWidths = exports.WithFixedColumnWidths = Template.bind({});
|
|
322
|
-
WithFixedColumnWidths.args = _objectSpread(_objectSpread({}, Default.args), {}, {
|
|
323
|
-
customRowHoverContent: customRowHoverContent,
|
|
324
|
-
customRowHoverStyles: customRowHoverStyles
|
|
325
|
-
});
|
|
326
|
-
const WithSubTable = exports.WithSubTable = Template.bind({});
|
|
327
|
-
WithSubTable.args = _objectSpread(_objectSpread({}, Default.args), {}, {
|
|
328
|
-
withSubTable: true,
|
|
329
|
-
subColumns: subColumns,
|
|
330
|
-
calculateSubData: calculateSubData
|
|
331
|
-
});
|
|
332
|
-
const BlueTable = exports.BlueTable = Template.bind({});
|
|
333
|
-
BlueTable.args = _objectSpread(_objectSpread({}, Default.args), {}, {
|
|
334
|
-
blue: true
|
|
335
|
-
});
|
|
336
|
-
|
|
337
|
-
// Wrapper examples
|
|
338
|
-
const DefaultWrapper = exports.DefaultWrapper = TemplateWrapper.bind({});
|
|
339
|
-
DefaultWrapper.args = {
|
|
340
|
-
columns: columnsWrapper,
|
|
341
|
-
data: data,
|
|
342
|
-
noPagination: false
|
|
343
|
-
};
|
|
344
|
-
const WrapperWithSubTable = exports.WrapperWithSubTable = TemplateWrapper.bind({});
|
|
345
|
-
WrapperWithSubTable.args = {
|
|
346
|
-
columns: columnsWrapper,
|
|
347
|
-
data: data,
|
|
348
|
-
withSubTable: true,
|
|
349
|
-
subColumns: subColumnsWrapper,
|
|
350
|
-
calculateSubData: calculateSubData
|
|
351
|
-
};
|
|
352
|
-
const BlueWrapper = exports.BlueWrapper = TemplateWrapper.bind({});
|
|
353
|
-
BlueWrapper.args = {
|
|
354
|
-
columns: columnsWrapper,
|
|
355
|
-
data: data,
|
|
356
|
-
blue: true
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
// Box-style table example
|
|
360
|
-
const BoxStyleTable = exports.BoxStyleTable = Template.bind({});
|
|
361
|
-
BoxStyleTable.args = _objectSpread(_objectSpread({}, Default.args), {}, {
|
|
362
|
-
customRowStyles: (rowIndex, rowData) => {
|
|
363
|
-
// return {
|
|
364
|
-
// border: '1px solid #e1e1e1',
|
|
365
|
-
// borderRadius: '8px',
|
|
366
|
-
// marginBottom: '12px',
|
|
367
|
-
// borderRight: '1px solid red !important',
|
|
368
|
-
|
|
369
|
-
// backgroundColor: '#ffffff',
|
|
370
|
-
// }
|
|
371
|
-
return "\n border: 1px solid #e1e1e1;\n border-radius: 8px;\n margin-bottom: 12px;\n background-color: #ffffff;\n\n td{\n border:inherit;\n border-right:none;\n border-left:none;\n \n &:first-child {\n border-left:inherit;\n border-top-left-radius:4px;\n border-bottom-left-radius:4px;\n }\n &:last-child {\n border-right:inherit;\n border-top-right-radius:4px;\n border-bottom-right-radius:4px;\n }\n }\n ";
|
|
372
|
-
},
|
|
373
|
-
customRowHoverStyles: (rowIndex, rowData) => ({
|
|
374
|
-
backgroundColor: '#e1e1e1'
|
|
375
|
-
}),
|
|
376
|
-
customTableStyles: () => ({
|
|
377
|
-
borderSpacing: '0 20px'
|
|
378
|
-
})
|
|
379
|
-
});
|
|
380
|
-
|
|
381
|
-
// Table with custom styling
|
|
382
|
-
const CustomStyledTable = exports.CustomStyledTable = Template.bind({});
|
|
383
|
-
CustomStyledTable.args = _objectSpread(_objectSpread({}, Default.args), {}, {
|
|
384
|
-
customTableStyles: () => ({
|
|
385
|
-
border: '2px solid #4caf50',
|
|
386
|
-
borderRadius: '12px',
|
|
387
|
-
overflow: 'hidden',
|
|
388
|
-
boxShadow: '0 8px 16px rgba(76, 175, 80, 0.2)',
|
|
389
|
-
backgroundColor: '#f8fff8'
|
|
390
|
-
}),
|
|
391
|
-
customRowStyles: (rowIndex, rowData) => ({
|
|
392
|
-
backgroundColor: rowIndex % 2 === 0 ? '#ffffff' : '#f0f8f0',
|
|
393
|
-
borderBottom: '1px solid #e8f5e8'
|
|
394
|
-
}),
|
|
395
|
-
customRowHoverStyles: (rowIndex, rowData) => ({
|
|
396
|
-
backgroundColor: '#e8f5e8',
|
|
397
|
-
transform: 'scale(1.01)'
|
|
398
|
-
}),
|
|
399
|
-
customThStyles: column => ({
|
|
400
|
-
backgroundColor: '#4caf50',
|
|
401
|
-
color: '#ffffff',
|
|
402
|
-
fontWeight: 'bold',
|
|
403
|
-
textTransform: 'uppercase',
|
|
404
|
-
letterSpacing: '0.5px'
|
|
405
|
-
})
|
|
406
|
-
});
|
|
407
|
-
|
|
408
|
-
// ============================================
|
|
409
|
-
// NEW FEATURE STORIES: onRowClick & renderExpandedContent
|
|
410
|
-
// ============================================
|
|
411
|
-
|
|
412
|
-
// Row Click Handler - Basic
|
|
413
|
-
const WithRowClick = exports.WithRowClick = Template.bind({});
|
|
414
|
-
WithRowClick.args = _objectSpread(_objectSpread({}, Default.args), {}, {
|
|
415
|
-
onRowClick: (rowData, rowIndex, event) => {
|
|
416
|
-
alert("Clicked row ".concat(rowIndex + 1, ": ").concat(rowData.name, " (").concat(rowData.status, ")"));
|
|
417
|
-
}
|
|
418
|
-
});
|
|
419
|
-
WithRowClick.parameters = {
|
|
420
|
-
docs: {
|
|
421
|
-
description: {
|
|
422
|
-
story: 'Click anywhere on a row to trigger an action. Buttons and links inside cells will NOT trigger the row click.'
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
};
|
|
426
|
-
|
|
427
|
-
// Row Click with Buttons Inside - Demonstrates click isolation
|
|
428
|
-
const columnsWithActions = [...columns.slice(0, 3), {
|
|
429
|
-
Header: 'Actions',
|
|
430
|
-
accessor: 'actions',
|
|
431
|
-
width: '40%',
|
|
432
|
-
Cell: _ref => {
|
|
433
|
-
let {
|
|
434
|
-
row
|
|
435
|
-
} = _ref;
|
|
436
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
437
|
-
style: {
|
|
438
|
-
display: 'flex',
|
|
439
|
-
gap: '8px'
|
|
440
|
-
}
|
|
441
|
-
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
442
|
-
style: {
|
|
443
|
-
padding: '6px 12px',
|
|
444
|
-
backgroundColor: '#0050ca',
|
|
445
|
-
color: 'white',
|
|
446
|
-
border: 'none',
|
|
447
|
-
borderRadius: '4px',
|
|
448
|
-
cursor: 'pointer'
|
|
449
|
-
},
|
|
450
|
-
onClick: () => alert("Edit button clicked for ".concat(row.original.name))
|
|
451
|
-
}, "Edit"), /*#__PURE__*/_react.default.createElement("button", {
|
|
452
|
-
style: {
|
|
453
|
-
padding: '6px 12px',
|
|
454
|
-
backgroundColor: '#dc3545',
|
|
455
|
-
color: 'white',
|
|
456
|
-
border: 'none',
|
|
457
|
-
borderRadius: '4px',
|
|
458
|
-
cursor: 'pointer'
|
|
459
|
-
},
|
|
460
|
-
onClick: () => alert("Delete button clicked for ".concat(row.original.name))
|
|
461
|
-
}, "Delete"));
|
|
462
|
-
}
|
|
463
|
-
}];
|
|
464
|
-
const RowClickWithButtons = exports.RowClickWithButtons = Template.bind({});
|
|
465
|
-
RowClickWithButtons.args = {
|
|
466
|
-
columns: columnsWithActions,
|
|
467
|
-
data: data,
|
|
468
|
-
noPagination: false,
|
|
469
|
-
onRowClick: (rowData, rowIndex) => {
|
|
470
|
-
alert("Row clicked: ".concat(rowData.name));
|
|
471
|
-
}
|
|
472
|
-
};
|
|
473
|
-
RowClickWithButtons.parameters = {
|
|
474
|
-
docs: {
|
|
475
|
-
description: {
|
|
476
|
-
story: 'Demonstrates that clicking buttons inside cells does NOT trigger onRowClick. Only clicking on non-interactive areas triggers the row click.'
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
};
|
|
480
|
-
|
|
481
|
-
// Custom Expanded Content - Simple
|
|
482
|
-
const CustomExpandedContent = exports.CustomExpandedContent = Template.bind({});
|
|
483
|
-
CustomExpandedContent.args = _objectSpread(_objectSpread({}, Default.args), {}, {
|
|
484
|
-
renderExpandedContent: (row, toggleExpanded) => {
|
|
485
|
-
var _row$original$subData;
|
|
486
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
487
|
-
style: {
|
|
488
|
-
padding: '20px',
|
|
489
|
-
backgroundColor: '#f8f9fa',
|
|
490
|
-
borderRadius: '8px'
|
|
491
|
-
}
|
|
492
|
-
}, /*#__PURE__*/_react.default.createElement("h4", {
|
|
493
|
-
style: {
|
|
494
|
-
margin: '0 0 12px 0'
|
|
495
|
-
}
|
|
496
|
-
}, "Details for ", row.original.name), /*#__PURE__*/_react.default.createElement("p", {
|
|
497
|
-
style: {
|
|
498
|
-
margin: '0 0 8px 0'
|
|
499
|
-
}
|
|
500
|
-
}, /*#__PURE__*/_react.default.createElement("strong", null, "ID:"), " ", row.original.id), /*#__PURE__*/_react.default.createElement("p", {
|
|
501
|
-
style: {
|
|
502
|
-
margin: '0 0 8px 0'
|
|
503
|
-
}
|
|
504
|
-
}, /*#__PURE__*/_react.default.createElement("strong", null, "Status:"), " ", row.original.status), /*#__PURE__*/_react.default.createElement("p", {
|
|
505
|
-
style: {
|
|
506
|
-
margin: '0 0 16px 0'
|
|
507
|
-
}
|
|
508
|
-
}, /*#__PURE__*/_react.default.createElement("strong", null, "Sub-items:"), " ", ((_row$original$subData = row.original.subData) === null || _row$original$subData === void 0 ? void 0 : _row$original$subData.length) || 0), /*#__PURE__*/_react.default.createElement("button", {
|
|
509
|
-
style: {
|
|
510
|
-
padding: '8px 16px',
|
|
511
|
-
backgroundColor: '#6c757d',
|
|
512
|
-
color: 'white',
|
|
513
|
-
border: 'none',
|
|
514
|
-
borderRadius: '4px',
|
|
515
|
-
cursor: 'pointer'
|
|
516
|
-
},
|
|
517
|
-
onClick: () => toggleExpanded()
|
|
518
|
-
}, "Collapse"));
|
|
519
|
-
}
|
|
520
|
-
});
|
|
521
|
-
CustomExpandedContent.parameters = {
|
|
522
|
-
docs: {
|
|
523
|
-
description: {
|
|
524
|
-
story: 'Click on a row to expand and show custom content instead of a sub-table. The toggleExpanded function allows you to collapse the row programmatically.'
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
};
|
|
528
|
-
|
|
529
|
-
// Custom Expanded Content - Rich Component
|
|
530
|
-
const ExpandedWithRichContent = exports.ExpandedWithRichContent = Template.bind({});
|
|
531
|
-
ExpandedWithRichContent.args = _objectSpread(_objectSpread({}, Default.args), {}, {
|
|
532
|
-
renderExpandedContent: row => {
|
|
533
|
-
var _row$original$subData2;
|
|
534
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
535
|
-
style: {
|
|
536
|
-
padding: '24px'
|
|
537
|
-
}
|
|
538
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
539
|
-
style: {
|
|
540
|
-
display: 'grid',
|
|
541
|
-
gridTemplateColumns: '1fr 1fr',
|
|
542
|
-
gap: '24px'
|
|
543
|
-
}
|
|
544
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
545
|
-
style: {
|
|
546
|
-
padding: '16px',
|
|
547
|
-
backgroundColor: '#fff',
|
|
548
|
-
border: '1px solid #e1e1e1',
|
|
549
|
-
borderRadius: '8px'
|
|
550
|
-
}
|
|
551
|
-
}, /*#__PURE__*/_react.default.createElement("h4", {
|
|
552
|
-
style: {
|
|
553
|
-
margin: '0 0 16px 0',
|
|
554
|
-
color: '#0050ca'
|
|
555
|
-
}
|
|
556
|
-
}, "User Information"), /*#__PURE__*/_react.default.createElement("div", {
|
|
557
|
-
style: {
|
|
558
|
-
display: 'flex',
|
|
559
|
-
flexDirection: 'column',
|
|
560
|
-
gap: '8px'
|
|
561
|
-
}
|
|
562
|
-
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("strong", null, "Name:"), " ", row.original.name), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("strong", null, "ID:"), " #", row.original.id), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("strong", null, "Status:"), ' ', /*#__PURE__*/_react.default.createElement("span", {
|
|
563
|
-
style: {
|
|
564
|
-
padding: '2px 8px',
|
|
565
|
-
borderRadius: '12px',
|
|
566
|
-
backgroundColor: row.original.status === 'Active' ? '#d4edda' : row.original.status === 'Inactive' ? '#f8d7da' : '#fff3cd',
|
|
567
|
-
color: row.original.status === 'Active' ? '#155724' : row.original.status === 'Inactive' ? '#721c24' : '#856404',
|
|
568
|
-
fontSize: '12px'
|
|
569
|
-
}
|
|
570
|
-
}, row.original.status)))), /*#__PURE__*/_react.default.createElement("div", {
|
|
571
|
-
style: {
|
|
572
|
-
padding: '16px',
|
|
573
|
-
backgroundColor: '#fff',
|
|
574
|
-
border: '1px solid #e1e1e1',
|
|
575
|
-
borderRadius: '8px'
|
|
576
|
-
}
|
|
577
|
-
}, /*#__PURE__*/_react.default.createElement("h4", {
|
|
578
|
-
style: {
|
|
579
|
-
margin: '0 0 16px 0',
|
|
580
|
-
color: '#0050ca'
|
|
581
|
-
}
|
|
582
|
-
}, "Sub Items"), ((_row$original$subData2 = row.original.subData) === null || _row$original$subData2 === void 0 ? void 0 : _row$original$subData2.length) > 0 ? /*#__PURE__*/_react.default.createElement("ul", {
|
|
583
|
-
style: {
|
|
584
|
-
margin: 0,
|
|
585
|
-
paddingLeft: '20px'
|
|
586
|
-
}
|
|
587
|
-
}, row.original.subData.map(item => /*#__PURE__*/_react.default.createElement("li", {
|
|
588
|
-
key: item.detailId,
|
|
589
|
-
style: {
|
|
590
|
-
marginBottom: '8px'
|
|
591
|
-
}
|
|
592
|
-
}, item.detailName, " (ID: ", item.detailId, ")"))) : /*#__PURE__*/_react.default.createElement("p", {
|
|
593
|
-
style: {
|
|
594
|
-
margin: 0,
|
|
595
|
-
color: '#6c757d',
|
|
596
|
-
fontStyle: 'italic'
|
|
597
|
-
}
|
|
598
|
-
}, "No sub-items"))), /*#__PURE__*/_react.default.createElement("div", {
|
|
599
|
-
style: {
|
|
600
|
-
marginTop: '16px',
|
|
601
|
-
display: 'flex',
|
|
602
|
-
gap: '8px',
|
|
603
|
-
justifyContent: 'flex-end'
|
|
604
|
-
}
|
|
605
|
-
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
606
|
-
style: {
|
|
607
|
-
padding: '8px 16px',
|
|
608
|
-
backgroundColor: '#0050ca',
|
|
609
|
-
color: 'white',
|
|
610
|
-
border: 'none',
|
|
611
|
-
borderRadius: '4px',
|
|
612
|
-
cursor: 'pointer'
|
|
613
|
-
},
|
|
614
|
-
onClick: () => alert("Edit ".concat(row.original.name))
|
|
615
|
-
}, "Edit User"), /*#__PURE__*/_react.default.createElement("button", {
|
|
616
|
-
style: {
|
|
617
|
-
padding: '8px 16px',
|
|
618
|
-
backgroundColor: 'transparent',
|
|
619
|
-
color: '#0050ca',
|
|
620
|
-
border: '1px solid #0050ca',
|
|
621
|
-
borderRadius: '4px',
|
|
622
|
-
cursor: 'pointer'
|
|
623
|
-
},
|
|
624
|
-
onClick: () => alert("View full profile for ".concat(row.original.name))
|
|
625
|
-
}, "View Profile")));
|
|
626
|
-
}
|
|
627
|
-
});
|
|
628
|
-
ExpandedWithRichContent.parameters = {
|
|
629
|
-
docs: {
|
|
630
|
-
description: {
|
|
631
|
-
story: 'A more complex example showing a rich expanded content with multiple panels, styled badges, and action buttons.'
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
};
|
|
635
|
-
|
|
636
|
-
// Combined: Row Click + Custom Expanded Content
|
|
637
|
-
const RowClickWithExpandedContent = exports.RowClickWithExpandedContent = Template.bind({});
|
|
638
|
-
RowClickWithExpandedContent.args = {
|
|
639
|
-
columns: columnsWithActions,
|
|
640
|
-
data: data,
|
|
641
|
-
noPagination: false,
|
|
642
|
-
onRowClick: (rowData, rowIndex) => {
|
|
643
|
-
console.log('Row clicked (but not triggering anything in this demo)');
|
|
644
|
-
},
|
|
645
|
-
renderExpandedContent: (row, toggleExpanded) => /*#__PURE__*/_react.default.createElement("div", {
|
|
646
|
-
style: {
|
|
647
|
-
padding: '20px',
|
|
648
|
-
backgroundColor: '#e3f2fd',
|
|
649
|
-
borderLeft: '4px solid #0050ca'
|
|
650
|
-
}
|
|
651
|
-
}, /*#__PURE__*/_react.default.createElement("p", {
|
|
652
|
-
style: {
|
|
653
|
-
margin: '0 0 12px 0'
|
|
654
|
-
}
|
|
655
|
-
}, /*#__PURE__*/_react.default.createElement("strong", null, "Expanded details for:"), " ", row.original.name), /*#__PURE__*/_react.default.createElement("p", {
|
|
656
|
-
style: {
|
|
657
|
-
margin: 0,
|
|
658
|
-
color: '#666'
|
|
659
|
-
}
|
|
660
|
-
}, "Click anywhere on the row to expand/collapse. Buttons work independently."))
|
|
661
|
-
};
|
|
662
|
-
RowClickWithExpandedContent.parameters = {
|
|
663
|
-
docs: {
|
|
664
|
-
description: {
|
|
665
|
-
story: 'Combined example: rows are clickable AND expandable. The onRowClick and renderExpandedContent work together. Buttons inside cells remain independent.'
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
};
|
|
669
|
-
|
|
670
|
-
// ============================================
|
|
671
|
-
// HEADER CLICK STORIES: onHeaderClick & renderHeaderContent
|
|
672
|
-
// ============================================
|
|
673
|
-
|
|
674
|
-
// Basic Header Click - shows alert
|
|
675
|
-
const HeaderClick = exports.HeaderClick = Template.bind({});
|
|
676
|
-
HeaderClick.args = _objectSpread(_objectSpread({}, Default.args), {}, {
|
|
677
|
-
onHeaderClick: (column, event) => {
|
|
678
|
-
alert("Header clicked: ".concat(column.id || column.Header));
|
|
679
|
-
}
|
|
680
|
-
});
|
|
681
|
-
HeaderClick.parameters = {
|
|
682
|
-
docs: {
|
|
683
|
-
description: {
|
|
684
|
-
story: 'Click on any column header to trigger an action. Useful for implementing custom sorting or filtering.'
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
};
|
|
688
|
-
|
|
689
|
-
// Header Click with Sort State (External Control)
|
|
690
|
-
const SortableTableDemo = () => {
|
|
691
|
-
const [sortConfig, setSortConfig] = _react.default.useState({
|
|
692
|
-
key: null,
|
|
693
|
-
direction: 'asc'
|
|
694
|
-
});
|
|
695
|
-
const [tableData, setTableData] = _react.default.useState(data);
|
|
696
|
-
const handleHeaderClick = column => {
|
|
697
|
-
// Skip non-sortable columns (like actions)
|
|
698
|
-
if (column.id === 'dropdown' || column.id === 'actions') return;
|
|
699
|
-
let direction = 'asc';
|
|
700
|
-
if (sortConfig.key === column.id && sortConfig.direction === 'asc') {
|
|
701
|
-
direction = 'desc';
|
|
702
|
-
}
|
|
703
|
-
setSortConfig({
|
|
704
|
-
key: column.id,
|
|
705
|
-
direction
|
|
706
|
-
});
|
|
707
|
-
|
|
708
|
-
// Sort the data
|
|
709
|
-
const sorted = [...data].sort((a, b) => {
|
|
710
|
-
const aVal = a[column.id];
|
|
711
|
-
const bVal = b[column.id];
|
|
712
|
-
if (aVal < bVal) return direction === 'asc' ? -1 : 1;
|
|
713
|
-
if (aVal > bVal) return direction === 'asc' ? 1 : -1;
|
|
714
|
-
return 0;
|
|
715
|
-
});
|
|
716
|
-
setTableData(sorted);
|
|
717
|
-
};
|
|
718
|
-
|
|
719
|
-
// Add sort indicators to headers
|
|
720
|
-
const renderHeaderContent = (column, defaultContent) => {
|
|
721
|
-
// Skip non-sortable columns
|
|
722
|
-
if (column.id === 'dropdown' || column.id === 'actions') {
|
|
723
|
-
return defaultContent;
|
|
724
|
-
}
|
|
725
|
-
const isSorted = sortConfig.key === column.id;
|
|
726
|
-
const arrow = isSorted ? sortConfig.direction === 'asc' ? ' ↑' : ' ↓' : '';
|
|
727
|
-
return /*#__PURE__*/_react.default.createElement("span", {
|
|
728
|
-
style: {
|
|
729
|
-
display: 'flex',
|
|
730
|
-
alignItems: 'center',
|
|
731
|
-
gap: '4px'
|
|
732
|
-
}
|
|
733
|
-
}, defaultContent, /*#__PURE__*/_react.default.createElement("span", {
|
|
734
|
-
style: {
|
|
735
|
-
opacity: isSorted ? 1 : 0.3
|
|
736
|
-
}
|
|
737
|
-
}, isSorted ? arrow : ' ↕'));
|
|
738
|
-
};
|
|
739
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_global.default, null), /*#__PURE__*/_react.default.createElement("div", {
|
|
740
|
-
style: {
|
|
741
|
-
marginBottom: '16px'
|
|
742
|
-
}
|
|
743
|
-
}, /*#__PURE__*/_react.default.createElement("strong", null, "Current sort:"), ' ', sortConfig.key ? "".concat(sortConfig.key, " (").concat(sortConfig.direction, ")") : 'None'), /*#__PURE__*/_react.default.createElement(_ReactTable.ReactTable, {
|
|
744
|
-
columns: columns,
|
|
745
|
-
data: tableData,
|
|
746
|
-
noPagination: false,
|
|
747
|
-
onHeaderClick: handleHeaderClick,
|
|
748
|
-
renderHeaderContent: renderHeaderContent
|
|
749
|
-
}));
|
|
750
|
-
};
|
|
751
|
-
const SortableHeaders = exports.SortableHeaders = {
|
|
752
|
-
render: () => /*#__PURE__*/_react.default.createElement(SortableTableDemo, null),
|
|
753
|
-
parameters: {
|
|
754
|
-
docs: {
|
|
755
|
-
description: {
|
|
756
|
-
story: 'External sorting controlled by parent component. Click headers to sort. Uses onHeaderClick for the action and renderHeaderContent for the sort indicators.'
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
};
|
|
761
|
-
|
|
762
|
-
// Header with Custom Dropdown Filter
|
|
763
|
-
const FilterableTableDemo = () => {
|
|
764
|
-
const [filters, setFilters] = _react.default.useState({});
|
|
765
|
-
const [activeDropdown, setActiveDropdown] = _react.default.useState(null);
|
|
766
|
-
const [tableData, setTableData] = _react.default.useState(data);
|
|
767
|
-
|
|
768
|
-
// Get unique values for a column
|
|
769
|
-
const getUniqueValues = columnId => {
|
|
770
|
-
return [...new Set(data.map(row => row[columnId]))];
|
|
771
|
-
};
|
|
772
|
-
const handleFilter = (columnId, value) => {
|
|
773
|
-
const newFilters = _objectSpread({}, filters);
|
|
774
|
-
if (value === 'all') {
|
|
775
|
-
delete newFilters[columnId];
|
|
776
|
-
} else {
|
|
777
|
-
newFilters[columnId] = value;
|
|
778
|
-
}
|
|
779
|
-
setFilters(newFilters);
|
|
780
|
-
setActiveDropdown(null);
|
|
781
|
-
|
|
782
|
-
// Apply filters
|
|
783
|
-
let filtered = [...data];
|
|
784
|
-
Object.keys(newFilters).forEach(key => {
|
|
785
|
-
filtered = filtered.filter(row => row[key] === newFilters[key]);
|
|
786
|
-
});
|
|
787
|
-
setTableData(filtered);
|
|
788
|
-
};
|
|
789
|
-
|
|
790
|
-
// Custom header with filter dropdown
|
|
791
|
-
const renderHeaderContent = (column, defaultContent) => {
|
|
792
|
-
// Only add filter to specific columns
|
|
793
|
-
if (!['status'].includes(column.id)) {
|
|
794
|
-
return defaultContent;
|
|
795
|
-
}
|
|
796
|
-
const isActive = activeDropdown === column.id;
|
|
797
|
-
const hasFilter = filters[column.id];
|
|
798
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
799
|
-
style: {
|
|
800
|
-
position: 'relative'
|
|
801
|
-
}
|
|
802
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
803
|
-
style: {
|
|
804
|
-
display: 'flex',
|
|
805
|
-
alignItems: 'center',
|
|
806
|
-
gap: '8px'
|
|
807
|
-
},
|
|
808
|
-
"data-clickable": "true",
|
|
809
|
-
onClick: e => {
|
|
810
|
-
e.stopPropagation();
|
|
811
|
-
setActiveDropdown(isActive ? null : column.id);
|
|
812
|
-
}
|
|
813
|
-
}, defaultContent, /*#__PURE__*/_react.default.createElement("span", {
|
|
814
|
-
style: {
|
|
815
|
-
fontSize: '10px',
|
|
816
|
-
padding: '2px 6px',
|
|
817
|
-
borderRadius: '4px',
|
|
818
|
-
backgroundColor: hasFilter ? '#0050ca' : '#e1e1e1',
|
|
819
|
-
color: hasFilter ? 'white' : '#666'
|
|
820
|
-
}
|
|
821
|
-
}, hasFilter ? '✓' : '▼')), isActive && /*#__PURE__*/_react.default.createElement("div", {
|
|
822
|
-
style: {
|
|
823
|
-
position: 'absolute',
|
|
824
|
-
top: '100%',
|
|
825
|
-
left: 0,
|
|
826
|
-
marginTop: '4px',
|
|
827
|
-
backgroundColor: 'white',
|
|
828
|
-
border: '1px solid #e1e1e1',
|
|
829
|
-
borderRadius: '4px',
|
|
830
|
-
boxShadow: '0 4px 12px rgba(0,0,0,0.15)',
|
|
831
|
-
zIndex: 100,
|
|
832
|
-
minWidth: '120px'
|
|
833
|
-
}
|
|
834
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
835
|
-
style: {
|
|
836
|
-
padding: '8px 12px',
|
|
837
|
-
cursor: 'pointer',
|
|
838
|
-
borderBottom: '1px solid #e1e1e1'
|
|
839
|
-
},
|
|
840
|
-
onClick: () => handleFilter(column.id, 'all')
|
|
841
|
-
}, "All"), getUniqueValues(column.id).map(value => /*#__PURE__*/_react.default.createElement("div", {
|
|
842
|
-
key: value,
|
|
843
|
-
style: {
|
|
844
|
-
padding: '8px 12px',
|
|
845
|
-
cursor: 'pointer',
|
|
846
|
-
backgroundColor: filters[column.id] === value ? '#f0f8ff' : 'transparent'
|
|
847
|
-
},
|
|
848
|
-
onClick: () => handleFilter(column.id, value)
|
|
849
|
-
}, value))));
|
|
850
|
-
};
|
|
851
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_global.default, null), /*#__PURE__*/_react.default.createElement("div", {
|
|
852
|
-
style: {
|
|
853
|
-
marginBottom: '16px'
|
|
854
|
-
}
|
|
855
|
-
}, /*#__PURE__*/_react.default.createElement("strong", null, "Active filters:"), ' ', Object.keys(filters).length > 0 ? Object.entries(filters).map(_ref2 => {
|
|
856
|
-
let [k, v] = _ref2;
|
|
857
|
-
return "".concat(k, ": ").concat(v);
|
|
858
|
-
}).join(', ') : 'None'), /*#__PURE__*/_react.default.createElement(_ReactTable.ReactTable, {
|
|
859
|
-
columns: columns,
|
|
860
|
-
data: tableData,
|
|
861
|
-
noPagination: false,
|
|
862
|
-
renderHeaderContent: renderHeaderContent
|
|
863
|
-
}));
|
|
864
|
-
};
|
|
865
|
-
const FilterableHeaders = exports.FilterableHeaders = {
|
|
866
|
-
render: () => /*#__PURE__*/_react.default.createElement(FilterableTableDemo, null),
|
|
867
|
-
parameters: {
|
|
868
|
-
docs: {
|
|
869
|
-
description: {
|
|
870
|
-
story: 'Custom filter dropdown in the "Status" header. Click the dropdown icon to filter. Uses renderHeaderContent to add the dropdown UI.'
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
};
|
|
875
|
-
|
|
876
|
-
// Per-Column Header Click Handler
|
|
877
|
-
const columnsWithColumnClick = [{
|
|
878
|
-
Header: 'ID (Click me!)',
|
|
879
|
-
accessor: 'id',
|
|
880
|
-
width: '15%',
|
|
881
|
-
onHeaderClick: column => {
|
|
882
|
-
alert('ID column has its own click handler!');
|
|
883
|
-
}
|
|
884
|
-
}, {
|
|
885
|
-
Header: 'Name',
|
|
886
|
-
accessor: 'name',
|
|
887
|
-
width: '30%'
|
|
888
|
-
}, {
|
|
889
|
-
Header: 'Status',
|
|
890
|
-
accessor: 'status',
|
|
891
|
-
width: '20%'
|
|
892
|
-
}, {
|
|
893
|
-
Header: 'Actions (No click)',
|
|
894
|
-
accessor: 'dropdown',
|
|
895
|
-
width: '35%'
|
|
896
|
-
// No onHeaderClick - won't trigger global onHeaderClick either
|
|
897
|
-
}];
|
|
898
|
-
const PerColumnHeaderClick = exports.PerColumnHeaderClick = Template.bind({});
|
|
899
|
-
PerColumnHeaderClick.args = {
|
|
900
|
-
columns: columnsWithColumnClick,
|
|
901
|
-
data: data,
|
|
902
|
-
noPagination: false,
|
|
903
|
-
onHeaderClick: column => {
|
|
904
|
-
alert("Global header click: ".concat(column.id));
|
|
905
|
-
}
|
|
906
|
-
};
|
|
907
|
-
PerColumnHeaderClick.parameters = {
|
|
908
|
-
docs: {
|
|
909
|
-
description: {
|
|
910
|
-
story: 'Columns can have their own onHeaderClick handlers. The "ID" column has a custom handler. Other columns use the global onHeaderClick. The "Actions" column has neither.'
|
|
911
|
-
}
|
|
912
|
-
}
|
|
913
|
-
};
|