@stella-source/stellasource-dsl 1.5.3 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/cjs/index.js +228 -37
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/styles.css +2 -0
  4. package/dist/cjs/types/components/Table/Table.d.ts +1 -1
  5. package/dist/cjs/types/components/Table/styles.d.ts +4 -1
  6. package/dist/cjs/types/components/Table/types.d.ts +9 -1
  7. package/dist/cjs/types/components/Tabs/Styles.d.ts +8 -2
  8. package/dist/cjs/types/components/Tabs/Tab.d.ts +5 -2
  9. package/dist/cjs/types/components/Tabs/Tabs.d.ts +1 -1
  10. package/dist/cjs/types/components/Tabs/Tabs.stories.d.ts +10 -3
  11. package/dist/cjs/types/components/Tabs/types.d.ts +18 -1
  12. package/dist/cjs/types/shared/tokens/index.d.ts +2 -0
  13. package/dist/cjs/types/shared/tokens/storybook/color.d.ts +4 -0
  14. package/dist/cjs/types/shared/utils/useDebounceCallback.d.ts +10 -0
  15. package/dist/esm/index.esm.js +229 -38
  16. package/dist/esm/index.esm.js.map +1 -1
  17. package/dist/esm/styles.css +2 -0
  18. package/dist/esm/types/components/Table/Table.d.ts +1 -1
  19. package/dist/esm/types/components/Table/styles.d.ts +4 -1
  20. package/dist/esm/types/components/Table/types.d.ts +9 -1
  21. package/dist/esm/types/components/Tabs/Styles.d.ts +8 -2
  22. package/dist/esm/types/components/Tabs/Tab.d.ts +5 -2
  23. package/dist/esm/types/components/Tabs/Tabs.d.ts +1 -1
  24. package/dist/esm/types/components/Tabs/Tabs.stories.d.ts +10 -3
  25. package/dist/esm/types/components/Tabs/types.d.ts +18 -1
  26. package/dist/esm/types/shared/tokens/index.d.ts +2 -0
  27. package/dist/esm/types/shared/tokens/storybook/color.d.ts +4 -0
  28. package/dist/esm/types/shared/utils/useDebounceCallback.d.ts +10 -0
  29. package/dist/index.d.ts +29 -3
  30. package/package.json +1 -1
package/dist/cjs/index.js CHANGED
@@ -58,8 +58,12 @@ const colorTokens = {
58
58
  50: "var(--grey50)",
59
59
  /** #d5dbe5 */
60
60
  100: "var(--grey100)",
61
+ /** #BCC2CE */
62
+ 200: "var(--grey200)",
61
63
  /** #687182 */
62
64
  500: "var(--grey500)",
65
+ /** #464F60 */
66
+ 700: "var(--grey700)",
63
67
  },
64
68
  blue: {
65
69
  /** #1f4168 */
@@ -21021,17 +21025,14 @@ const StyledTable = styled.table `
21021
21025
  border-collapse: collapse;
21022
21026
  `;
21023
21027
  const CustomIconButton$1 = styled(IconButton) `
21024
- opacity: ${({ $active }) => ($active ? 1 : 0)};
21025
- transition: opacity 0.2s ease;
21026
21028
  padding: 0px;
21027
21029
  & > svg {
21028
- max-width: ${({ $active }) => !$active && "0px"};
21029
- fill: ${({ $active }) => $active ? Styles.color.grey.charcoal : Styles.color.grey.smoke};
21030
+ fill: ${({ $active }) => $active ? Styles.color.grey.charcoal : Styles.color.grey.medium};
21030
21031
  }
21031
21032
  &:hover:not(:disabled) {
21032
21033
  background-color: transparent;
21033
21034
  & > svg {
21034
- fill: ${Styles.color.grey.charcoal};
21035
+ fill: ${Styles.color.grey.smoke};
21035
21036
  }
21036
21037
  }
21037
21038
  `;
@@ -21076,9 +21077,20 @@ const Checkbox = styled.input.attrs({ type: "checkbox" }) `
21076
21077
  cursor: pointer;
21077
21078
  `;
21078
21079
  const MenuItemGroup = styled.div `
21079
- max-height: 150px;
21080
+ --menu-options-max-height: 136px;
21081
+ max-height: var(--menu-options-max-height);
21080
21082
  overflow-y: auto;
21081
21083
  overflow-x: hidden;
21084
+ &::after {
21085
+ content: "";
21086
+ position: absolute;
21087
+ top: 0;
21088
+ left: 0;
21089
+ width: 100%;
21090
+ height: calc(var(--menu-options-max-height) + 6px);
21091
+ pointer-events: none;
21092
+ background: linear-gradient(to bottom, transparent 94%, white);
21093
+ }
21082
21094
  `;
21083
21095
  const BodyCell = styled.td `
21084
21096
  box-shadow: ${({ $isPinnedLeft, $columnInfo, $isPinnedRight }) => $isPinnedLeft && $columnInfo.getIsLastColumn("left")
@@ -21102,7 +21114,7 @@ const BodyCell = styled.td `
21102
21114
  padding: 0px 12px;
21103
21115
  font-size: 12px;
21104
21116
  color: ${Styles.color.grey.charcoal};
21105
- border-bottom: ${({ $isLastRow }) => $isLastRow ? "none" : `1px solid ${Styles.color.grey.light}`};
21117
+ border-bottom: 1px solid ${Styles.color.grey.light};
21106
21118
  transition: box-shadow 0.3s ease-out;
21107
21119
  `;
21108
21120
  const MenuButton = styled.button `
@@ -21188,7 +21200,7 @@ const MenuItemOption = styled.button `
21188
21200
  background: #f5f5f5;
21189
21201
  }
21190
21202
 
21191
- background-color: ${({ $applied }) => $applied ? Styles.color.blue.light : "none"};
21203
+ background-color: ${({ $applied }) => $applied ? Styles.color.blue.light : "transparent"};
21192
21204
  `;
21193
21205
  const FilterLabelTransparent = styled.div `
21194
21206
  font-size: 12px;
@@ -21250,7 +21262,7 @@ const LoadingShimmer = styled.div `
21250
21262
  }
21251
21263
  `;
21252
21264
  const CustomPagination = styled(Pagination) `
21253
- border-top: 1px solid ${Styles.color.grey.light};
21265
+ border-top: ${({ $hasData }) => $hasData ? "0px" : `1px solid ${Styles.color.grey.light}`};
21254
21266
  `;
21255
21267
  const KebabAlign = styled.div `
21256
21268
  display: flex;
@@ -21311,6 +21323,38 @@ const IndeterminateCheckbox = ({ isIndeterminate, isChecked, onChange, }) => {
21311
21323
  return (a$l.createElement(Checkbox, { ref: ref, checked: isChecked, onChange: (e) => onChange?.(e) }));
21312
21324
  };
21313
21325
 
21326
+ /**
21327
+ * Returns a debounced version of a callback, along with flush and cancel methods.
21328
+ */
21329
+ function useDebounceCallback(callback, delay) {
21330
+ const timeoutRef = a$l.useRef(null);
21331
+ const lastArgsRef = a$l.useRef(null);
21332
+ const debounced = a$l.useCallback((...args) => {
21333
+ lastArgsRef.current = args;
21334
+ if (timeoutRef.current)
21335
+ clearTimeout(timeoutRef.current);
21336
+ timeoutRef.current = setTimeout(() => {
21337
+ if (lastArgsRef.current)
21338
+ callback(...lastArgsRef.current);
21339
+ timeoutRef.current = null;
21340
+ }, delay);
21341
+ }, [callback, delay]);
21342
+ const flush = a$l.useCallback(() => {
21343
+ if (timeoutRef.current && lastArgsRef.current) {
21344
+ clearTimeout(timeoutRef.current);
21345
+ callback(...lastArgsRef.current);
21346
+ timeoutRef.current = null;
21347
+ }
21348
+ }, [callback]);
21349
+ const cancel = a$l.useCallback(() => {
21350
+ if (timeoutRef.current) {
21351
+ clearTimeout(timeoutRef.current);
21352
+ timeoutRef.current = null;
21353
+ }
21354
+ }, []);
21355
+ return [debounced, { flush, cancel }];
21356
+ }
21357
+
21314
21358
  const TableHeaderCell = ({ header, serverSide, filters, sorting, scrollPosition, onFilterMenuInteraction, onFilterApply, }) => {
21315
21359
  const column = header.column;
21316
21360
  const columnDef = column.columnDef;
@@ -21320,10 +21364,17 @@ const TableHeaderCell = ({ header, serverSide, filters, sorting, scrollPosition,
21320
21364
  const buttonRef = a$l.useRef(null);
21321
21365
  const [showFilter, setShowFilter] = a$l.useState(false);
21322
21366
  const [coords, setCoords] = a$l.useState({ top: 0, left: 0 });
21367
+ const [searchValue, setSearchValue] = a$l.useState();
21323
21368
  const [tempFilters, setTempFilters] = a$l.useState([]);
21324
21369
  const [currentAppliedFilters, setCurrentAppliedFilters] = a$l.useState([]);
21325
21370
  const [filterOptions, setFilterOptions] = a$l.useState([]);
21326
21371
  const [textAlign, setTextAlign] = a$l.useState("left");
21372
+ const [handleSave, { flush }] = useDebounceCallback((value) => {
21373
+ column?.setFilterValue([value]);
21374
+ if (value === "")
21375
+ column?.setFilterValue([]);
21376
+ onFilterApply?.();
21377
+ }, 300);
21327
21378
  a$l.useEffect(() => {
21328
21379
  setFilterOptions(meta?.filterOptions || []);
21329
21380
  }, [meta]);
@@ -21397,7 +21448,13 @@ const TableHeaderCell = ({ header, serverSide, filters, sorting, scrollPosition,
21397
21448
  position: "absolute",
21398
21449
  }, ref: menuRef },
21399
21450
  a$l.createElement(MenuItemGroup, null,
21400
- !meta?.singleSelect && (a$l.createElement(MenuItem, { key: "select-all" },
21451
+ meta?.filterMode === "search" && (a$l.createElement("div", { style: { padding: "4px 10px" } },
21452
+ a$l.createElement(TextInput, { id: `${columnDef.header}-search`, label: `${columnDef.header} search`, placeholder: "Search", hideLabel: true, onChange: (value) => {
21453
+ setSearchValue(value);
21454
+ handleSave(value);
21455
+ }, onBlur: () => flush(), endIcon: "search", value: searchValue }))),
21456
+ (meta?.filterMode === "multiSelect" ||
21457
+ !meta?.filterMode) && (a$l.createElement(MenuItem, { key: "select-all" },
21401
21458
  a$l.createElement(Checkbox, { id: "all-checkbox", name: "all-checkbox", checked: meta?.filterOptions?.every((item) => tempFilters?.includes(item)), onChange: () => {
21402
21459
  setTempFilters((prev) => {
21403
21460
  if (prev?.length === meta?.filterOptions?.length) {
@@ -21412,7 +21469,7 @@ const TableHeaderCell = ({ header, serverSide, filters, sorting, scrollPosition,
21412
21469
  (serverSide
21413
21470
  ? filterOptions
21414
21471
  : Array.from(header.column.getFacetedUniqueValues().keys()))?.map((item) => {
21415
- if (meta?.singleSelect) {
21472
+ if (meta?.filterMode === "singleSelect") {
21416
21473
  return (a$l.createElement(MenuItemOption, { key: item, id: `${item}-button`, onClick: () => {
21417
21474
  setCurrentAppliedFilters([item]);
21418
21475
  column?.setFilterValue([item]);
@@ -21420,21 +21477,25 @@ const TableHeaderCell = ({ header, serverSide, filters, sorting, scrollPosition,
21420
21477
  onFilterApply?.();
21421
21478
  }, "$applied": tempFilters?.includes(item) }, item));
21422
21479
  }
21423
- return (a$l.createElement(MenuItem, { key: item },
21424
- a$l.createElement(Checkbox, { id: `${item}-checkbox`, name: `${item}-checkbox`, checked: tempFilters?.includes(item), onChange: () => {
21425
- setTempFilters((prev) => {
21426
- if (prev?.includes(item)) {
21427
- return prev.filter((i) => i !== item);
21428
- }
21429
- else {
21430
- return [...prev, item];
21431
- }
21432
- });
21433
- } }),
21434
- a$l.createElement(FilterLabelTransparent, null, item),
21435
- a$l.createElement(FilterBoxLabel, { htmlFor: `${item}-checkbox` }, item)));
21480
+ if (meta?.filterMode === "multiSelect" ||
21481
+ !meta?.filterMode) {
21482
+ return (a$l.createElement(MenuItem, { key: item },
21483
+ a$l.createElement(Checkbox, { id: `${item}-checkbox`, name: `${item}-checkbox`, checked: tempFilters?.includes(item), onChange: () => {
21484
+ setTempFilters((prev) => {
21485
+ if (prev?.includes(item)) {
21486
+ return prev.filter((i) => i !== item);
21487
+ }
21488
+ else {
21489
+ return [...prev, item];
21490
+ }
21491
+ });
21492
+ } }),
21493
+ a$l.createElement(FilterLabelTransparent, null, item),
21494
+ a$l.createElement(FilterBoxLabel, { htmlFor: `${item}-checkbox` }, item)));
21495
+ }
21436
21496
  })),
21437
- !meta?.singleSelect && (a$l.createElement(MenuButton, { key: "apply", onClick: () => {
21497
+ (meta?.filterMode === "multiSelect" ||
21498
+ !meta?.filterMode) && (a$l.createElement(MenuButton, { key: "apply", onClick: () => {
21438
21499
  setCurrentAppliedFilters(tempFilters);
21439
21500
  column?.setFilterValue(tempFilters?.length > 0 ? tempFilters : []);
21440
21501
  showFilterMenu(false);
@@ -21445,6 +21506,7 @@ const TableHeaderCell = ({ header, serverSide, filters, sorting, scrollPosition,
21445
21506
  showFilterMenu(false);
21446
21507
  setTempFilters([]);
21447
21508
  setCurrentAppliedFilters([]);
21509
+ setSearchValue("");
21448
21510
  onFilterApply?.();
21449
21511
  } }, "Clear Filter"))), document.body))),
21450
21512
  header.column.getCanSort() && (a$l.createElement(SortButton, { className: "icon", iconName: "sort", ariaLabel: "Sort Button", variant: "tertiary", "$active": sorting.some((s) => s.id === header.column.id), "$sort": column.getIsSorted(), onClick: (e) => header.column.getToggleSortingHandler()?.(e) })),
@@ -21506,7 +21568,7 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
21506
21568
  startingPage: 1,
21507
21569
  rowsPerPage: 10,
21508
21570
  totalRows: data.length,
21509
- }, selectionMenuItems, dataAuto, dataTestId, id, className, htmlProps, resetTrigger, emptyTableState, }) {
21571
+ }, selectionMenuItems, dataAuto, dataTestId, id, className, htmlProps, resetTrigger, emptyTableState, defaultFilters, staticFilters, }) {
21510
21572
  const [rowSelection, setRowSelection] = a$l.useState({});
21511
21573
  const [selectedRows] = a$l.useState({});
21512
21574
  const [pageIndex, setPageIndex] = a$l.useState(paginationDetails?.startingPage);
@@ -21520,7 +21582,26 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
21520
21582
  const [sorting, setSorting] = a$l.useState([]);
21521
21583
  const [filters, setFilters] = a$l.useState({});
21522
21584
  const [rowState, setRowState] = a$l.useState({});
21523
- const [columnFilters, setColumnFilters] = a$l.useState([]);
21585
+ const [columnFilters, setColumnFilters] = a$l.useState(() => {
21586
+ const base = defaultFilters ?? [];
21587
+ if (!staticFilters?.length)
21588
+ return base;
21589
+ const merged = [...base];
21590
+ staticFilters.forEach((sf) => {
21591
+ const existing = merged.find((f) => f.id === sf.id);
21592
+ if (existing) {
21593
+ const staticValues = new Set(sf.value);
21594
+ existing.value = [
21595
+ ...sf.value,
21596
+ ...existing.value.filter((v) => !staticValues.has(v)),
21597
+ ];
21598
+ }
21599
+ else {
21600
+ merged.push(sf);
21601
+ }
21602
+ });
21603
+ return merged;
21604
+ });
21524
21605
  const [columnPinning, setColumnPinning] = a$l.useState({ left: ["select"], right: ["options"] });
21525
21606
  const scrollRef = a$l.useRef(null);
21526
21607
  const [scrollState, setScrollState] = a$l.useState({
@@ -21654,9 +21735,31 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
21654
21735
  },
21655
21736
  onColumnFiltersChange: (updaterOrValue) => {
21656
21737
  // TanStack passes either updater function or new filters array
21657
- const next = typeof updaterOrValue === "function"
21738
+ let next = typeof updaterOrValue === "function"
21658
21739
  ? updaterOrValue(columnFilters)
21659
21740
  : updaterOrValue;
21741
+ // Re-apply static filters so they can never be removed
21742
+ if (staticFilters?.length) {
21743
+ next = next.map((f) => {
21744
+ const staticFilter = staticFilters.find((sf) => sf.id === f.id);
21745
+ if (!staticFilter)
21746
+ return f;
21747
+ const staticValues = new Set(staticFilter.value);
21748
+ const userValues = f.value;
21749
+ // Keep all static values locked in, plus whatever the user freely toggled
21750
+ const merged = [
21751
+ ...staticFilter.value,
21752
+ ...userValues.filter((v) => !staticValues.has(v)),
21753
+ ];
21754
+ return { ...f, value: merged };
21755
+ });
21756
+ // Ensure static filters are always present even if column wasn't touched
21757
+ const nextIds = new Set(next.map((f) => f.id));
21758
+ staticFilters.forEach((sf) => {
21759
+ if (!nextIds.has(sf.id))
21760
+ next = [...next, sf];
21761
+ });
21762
+ }
21660
21763
  setColumnFilters(next);
21661
21764
  // Also keep your simple `filters` map in sync (optional)
21662
21765
  const map = {};
@@ -21669,7 +21772,7 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
21669
21772
  number: (row, columnId, filterValue) => {
21670
21773
  if (!filterValue?.length)
21671
21774
  return true;
21672
- return filterValue.includes(Number(row.getValue(columnId)));
21775
+ return filterValue.some((val) => Number(row.getValue(columnId)).toString().includes(val.toString()));
21673
21776
  },
21674
21777
  },
21675
21778
  });
@@ -21681,11 +21784,16 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
21681
21784
  onRowSelect?.(selectedData);
21682
21785
  }
21683
21786
  }, [rowSelection]);
21787
+ const isMounted = a$l.useRef(false);
21684
21788
  a$l.useEffect(() => {
21789
+ if (!isMounted.current) {
21790
+ isMounted.current = true;
21791
+ return;
21792
+ }
21685
21793
  resetTable();
21686
21794
  }, [resetTrigger]);
21687
21795
  const resetTable = () => {
21688
- setColumnFilters([]);
21796
+ setColumnFilters(staticFilters ?? []);
21689
21797
  setFilters({});
21690
21798
  setSorting([]);
21691
21799
  setPageIndex(1);
@@ -21775,7 +21883,7 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
21775
21883
  pagination.pageSize * pagination.pageIndex ===
21776
21884
  table.getRowModel().rows.length - 1 }, value));
21777
21885
  })))))))),
21778
- showPagination && paginationDetails?.totalRows > 0 && (a$l.createElement(CustomPagination, { totalRows: serverSide ? totalData : table.getFilteredRowModel().rows.length, isLoading: isLoading, rowsPerPage: paginationDetails?.rowsPerPage, startingPage: pageIndex, onPageChange: (page, pageSize) => {
21886
+ showPagination && paginationDetails?.totalRows > 0 && (a$l.createElement(CustomPagination, { "$hasData": table.getRowModel().rows.length > 0, totalRows: serverSide ? totalData : table.getFilteredRowModel().rows.length, isLoading: isLoading, rowsPerPage: paginationDetails?.rowsPerPage, startingPage: pageIndex, onPageChange: (page, pageSize) => {
21779
21887
  table.toggleAllRowsSelected(false);
21780
21888
  setPageIndex(page);
21781
21889
  setPagination((prev) => ({
@@ -21945,17 +22053,100 @@ const PaymentStatus = ({ variant, id, className }) => {
21945
22053
  a$l.createElement(PaymentStatusLabel, null, label)));
21946
22054
  };
21947
22055
 
21948
- const Tab = ({ id, className, onClick, htmlProps, label }) => {
21949
- return (a$l.createElement("button", { id: id, className: className, onClick: () => onClick?.(label), ...htmlProps }, label));
22056
+ const tabButtonVariantSelector = (variant) => {
22057
+ switch (variant) {
22058
+ case "light":
22059
+ return styled.css `
22060
+ border-image: linear-gradient(
22061
+ to bottom,
22062
+ transparent 20%,
22063
+ ${Styles.color.grey[200]} 20% 80%,
22064
+ transparent 80% 100%
22065
+ )
22066
+ 1;
22067
+ border-right: 2px solid;
22068
+ &:has(+ .active) {
22069
+ border-image: none;
22070
+ border-right: 2px solid ${Styles.color.grey.light};
22071
+ }
22072
+ &.active {
22073
+ border: none;
22074
+ margin-right: 2px;
22075
+ box-shadow:
22076
+ 0 0 0 0.5px rgba(0, 0, 0, 0.08),
22077
+ 0 2px 6px 0 rgba(0, 0, 0, 0.25);
22078
+ border-radius: 4px;
22079
+ color: ${Styles.color.core.primary};
22080
+ background-color: ${Styles.color.white};
22081
+ }
22082
+ &:hover:not(.active) {
22083
+ color: ${Styles.color.core.primary};
22084
+ }
22085
+ `;
22086
+ case "dark":
22087
+ return styled.css `
22088
+ &.active {
22089
+ border: none;
22090
+ box-shadow:
22091
+ 0 0 0 0.5px rgba(0, 0, 0, 0.08),
22092
+ 0 2px 6px 0 rgba(0, 0, 0, 0.25);
22093
+ border-radius: 10px;
22094
+ color: ${Styles.color.white};
22095
+ background-color: ${Styles.color.grey[700]};
22096
+ }
22097
+ &:hover:not(.active) {
22098
+ color: ${Styles.color.grey[700]};
22099
+ }
22100
+ `;
22101
+ default:
22102
+ return styled.css ``;
22103
+ }
22104
+ };
22105
+ const tabsVariantSelector = (variant) => {
22106
+ switch (variant) {
22107
+ case "light":
22108
+ return `${Styles.color.grey.light}`;
22109
+ case "dark":
22110
+ return "transparent";
22111
+ default:
22112
+ return `${Styles.color.grey.light}`;
22113
+ }
21950
22114
  };
21951
-
21952
22115
  const TabsBar = styled.nav `
21953
22116
  display: flex;
21954
- gap: 2px;
22117
+ width: fit-content;
22118
+ padding: 2px;
22119
+ background-color: ${({ $variant }) => tabsVariantSelector($variant)};
22120
+ border-radius: ${({ $isPill }) => ($isPill ? "6px" : "6px 6px 0px 0px")};
22121
+ :last-child {
22122
+ border: none;
22123
+ &.active {
22124
+ margin: 0;
22125
+ }
22126
+ }
22127
+ `;
22128
+ const TabButton = styled.button `
22129
+ cursor: pointer;
22130
+ background-color: transparent;
22131
+ border: none;
22132
+ color: ${Styles.color.grey.charcoal};
22133
+ padding: 4px 10px;
22134
+ line-height: 20px;
22135
+ font-size: 14px;
22136
+ ${({ $variant }) => tabButtonVariantSelector($variant)};
21955
22137
  `;
21956
22138
 
21957
- const Tabs = ({ id, className, tabs, activeTab, htmlProps, onTabClick, }) => {
21958
- return (a$l.createElement(TabsBar, { id: id, className: className, ...htmlProps }, tabs.map((tab) => (a$l.createElement(Tab, { key: `${id}-${tab}`, id: `${id}-${tab}`, label: tab, onClick: () => onTabClick(tab) })))));
22139
+ const Tab = ({ id, className, onClick, htmlProps, label, variant = "light", active = false, }) => {
22140
+ return (a$l.createElement(TabButton, { id: id, "$variant": variant, className: `${className} ${active && "active"}`, onClick: () => onClick?.(label), ...htmlProps }, label));
22141
+ };
22142
+
22143
+ const Tabs = ({ id, className, tabs, htmlProps, onTabClick, defaultActiveTab, variant = "light", isPill, }) => {
22144
+ const [activeTab, setActiveTab] = a$l.useState(defaultActiveTab ?? tabs[0]);
22145
+ const handleClick = (tab) => {
22146
+ setActiveTab(tab);
22147
+ onTabClick(tab);
22148
+ };
22149
+ return (a$l.createElement(TabsBar, { "$variant": variant, "$isPill": isPill, id: id, className: className, ...htmlProps }, tabs.map((tab) => (a$l.createElement(Tab, { key: `${id}-${tab}`, id: `${id}-${tab}`, label: tab, active: tab === activeTab, variant: variant, onClick: () => handleClick(tab) })))));
21959
22150
  };
21960
22151
 
21961
22152
  exports.HelperText = HelperText;