@multiplatform.one/table 7.6.3 → 7.7.1

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 (26) hide show
  1. package/package.json +12 -13
  2. package/src/components/ChildTable/ChildTable.stories.tsx +4 -1
  3. package/src/components/DataTable/DataTable.spec.tsx +13 -7
  4. package/src/components/DataTable/DataTableCardControls.stories.tsx +116 -0
  5. package/src/components/DataTable/DataTableDocumentList.stories.tsx +132 -0
  6. package/src/components/DataTable/DataTableMobileCards.stories.tsx +124 -0
  7. package/src/components/DataTable/DataTableVirtualized.stories.tsx +69 -0
  8. package/src/components/DataTable/chromeInterplay.spec.tsx +4 -1
  9. package/src/components/DataTable/dataTableCardControls.spec.tsx +99 -0
  10. package/src/components/DataTable/dataTableDocumentList.spec.tsx +143 -0
  11. package/src/components/DataTable/dataTableMobileCards.spec.tsx +151 -0
  12. package/src/components/DataTableCell/CellOptionsEditor.stories.tsx +139 -0
  13. package/src/components/DataTableCell/cellOptionsEditor.spec.tsx +127 -0
  14. package/src/components/DataTableExport/DataTableExport.spec.tsx +5 -0
  15. package/src/components/DataTableFilterButton/DataTableFilterButton.spec.tsx +128 -0
  16. package/src/components/DataTableFilterButton/DataTableFilterButton.stories.tsx +99 -0
  17. package/src/components/DataTableFilterChips/DataTableFilterChips.spec.tsx +6 -81
  18. package/src/components/DataTableFilterChips/DataTableFilterChips.stories.tsx +105 -0
  19. package/src/components/DataTableFilterChips/FilterChip.spec.tsx +77 -0
  20. package/src/components/DataTableFilterChips/FilterChip.stories.tsx +111 -0
  21. package/src/components/FilterManager.stories.tsx +75 -0
  22. package/src/components/FilterOperatorValueEditor/FilterOperatorValueEditor.spec.tsx +261 -0
  23. package/src/components/FilterOperatorValueEditor/FilterOperatorValueEditor.stories.tsx +183 -0
  24. package/src/components/KnobDialog.spec.tsx +88 -0
  25. package/src/components/KnobDialog.stories.tsx +66 -0
  26. package/src/components/SavedFilterDropdown.stories.tsx +90 -0
@@ -0,0 +1,90 @@
1
+ /**
2
+ * SavedFilterDropdown — picker over persisted filter records. Uses the
3
+ * forms Select trigger (same FloatingPanel contract as every other Select
4
+ * in the catalog). Renders nothing when the list is empty.
5
+ */
6
+
7
+ import { action } from "@multiplatform.one/storybook";
8
+ import type { Meta } from "@storybook/react-native-web-vite";
9
+ import { useState } from "react";
10
+ import { YStack } from "tamagui";
11
+ import type { ParsedFilter } from "../hooks/useSavedFilters";
12
+ import { SavedFilterDropdown } from "./SavedFilterDropdown";
13
+
14
+ const meta: Meta<typeof SavedFilterDropdown> = {
15
+ title: "Table/SavedFilterDropdown",
16
+ component: SavedFilterDropdown,
17
+ parameters: {
18
+ status: { type: "stable" },
19
+ docs: {
20
+ description: {
21
+ component:
22
+ "Select over saved filter records. Global filters are labelled in the option " +
23
+ "text. The empty list is a silent no-op so toolbars do not grow a dead trigger.",
24
+ },
25
+ },
26
+ },
27
+ };
28
+
29
+ export default meta;
30
+
31
+ const savedFilters: ParsedFilter[] = [
32
+ {
33
+ name: "Engineering Only",
34
+ filter_name: "Engineering Only",
35
+ for_user: "admin",
36
+ filters: [["department", "=", "Engineering"]],
37
+ isGlobal: false,
38
+ },
39
+ {
40
+ name: "High Salary",
41
+ filter_name: "High Salary",
42
+ for_user: "",
43
+ filters: [["salary", ">", 100000]],
44
+ isGlobal: true,
45
+ },
46
+ {
47
+ name: "Recent hires",
48
+ filter_name: "Recent hires",
49
+ for_user: "admin",
50
+ filters: [["joinDate", "after", "2024-01-01"]],
51
+ isGlobal: false,
52
+ },
53
+ ];
54
+
55
+ function DropdownHarness({
56
+ initial,
57
+ disabled = false,
58
+ }: {
59
+ initial?: ParsedFilter | null;
60
+ disabled?: boolean;
61
+ }) {
62
+ const [selected, setSelected] = useState<ParsedFilter | null>(initial ?? null);
63
+ return (
64
+ <YStack padding="$4" alignItems="flex-start" width={280}>
65
+ <SavedFilterDropdown
66
+ filters={savedFilters}
67
+ selectedFilter={selected}
68
+ disabled={disabled}
69
+ onSelectFilter={(next) => {
70
+ setSelected(next);
71
+ action("onSelectFilter")(next);
72
+ }}
73
+ onDeleteFilter={(name) => action("onDeleteFilter")(name)}
74
+ />
75
+ </YStack>
76
+ );
77
+ }
78
+
79
+ export const Default = {
80
+ name: "Main",
81
+ render: () => <DropdownHarness />,
82
+ };
83
+
84
+ export const Selected = {
85
+ render: () => <DropdownHarness initial={savedFilters[0]} />,
86
+ };
87
+
88
+ export const Disabled = {
89
+ render: () => <DropdownHarness initial={savedFilters[0]} disabled />,
90
+ };