@ponti-studios/ui 0.7.1 → 1.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.
- package/README.md +13 -0
- package/package.json +22 -20
- package/src/components/data-display/accordion.tsx +1 -1
- package/src/components/data-display/sort-controls.tsx +3 -3
- package/src/components/feedback/index.ts +0 -2
- package/src/components/forms/date-month-select.tsx +12 -3
- package/src/components/forms/date-picker.tsx +16 -12
- package/src/components/forms/drop-zone.tsx +1 -1
- package/src/components/forms/index.ts +4 -8
- package/src/components/forms/passkey-management.tsx +4 -10
- package/src/components/forms/radio-group.tsx +8 -4
- package/src/components/forms/select.tsx +1 -1
- package/src/components/forms/text-field.tsx +40 -5
- package/src/components/navigation/app-navigation.stories.tsx +111 -21
- package/src/components/navigation/app-navigation.tsx +165 -137
- package/src/components/navigation/index.ts +8 -4
- package/src/components/navigation/pagination-controls.stories.tsx +1 -1
- package/src/components/navigation/pagination-controls.tsx +10 -14
- package/src/components/overlays/dropdown-menu.stories.tsx +2 -2
- package/src/components/primitives/card.tsx +6 -10
- package/src/components/primitives/label.stories.tsx +0 -18
- package/src/components/primitives/label.tsx +12 -12
- package/src/constants/chart-colors.ts +16 -16
- package/src/lib/slot.tsx +29 -0
- package/src/styles/animations.css +0 -22
- package/src/styles/index.css +60 -6
- package/src/styles/tokens/color-systems.stories.tsx +2 -1
- package/src/styles/tokens/generated/light.colors.generated.ts +3 -3
- package/src/styles/tokens/generated/light.css +3 -3
- package/src/styles/tokens/source/light.tokens.json +3 -3
- package/src/styles/tokens/style-dictionary.light-storybook.json +16 -0
- package/src/components/feedback/file-upload-status-badge.stories.tsx +0 -28
- package/src/components/feedback/file-upload-status-badge.tsx +0 -33
- package/src/components/forms/field.stories.tsx +0 -62
- package/src/components/forms/field.tsx +0 -65
- package/src/components/forms/field.types.ts +0 -7
- package/src/components/forms/group-by-select.stories.tsx +0 -26
- package/src/components/forms/group-by-select.tsx +0 -47
- package/src/components/navigation/route-link.stories.tsx +0 -30
- package/src/components/navigation/route-link.tsx +0 -42
- package/src/hooks/use-derived-filter-state.stories.tsx +0 -136
- package/src/hooks/use-filter-state.stories.tsx +0 -102
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import { expect, userEvent, within } from 'storybook/test';
|
|
3
|
-
import { useFilterState } from './use-filter-state';
|
|
4
|
-
|
|
5
|
-
type Filters = Record<string, string>;
|
|
6
|
-
|
|
7
|
-
function Harness({
|
|
8
|
-
initialFilters,
|
|
9
|
-
debounceMs,
|
|
10
|
-
}: {
|
|
11
|
-
initialFilters: Filters;
|
|
12
|
-
debounceMs?: number;
|
|
13
|
-
}) {
|
|
14
|
-
const { filters, updateFilter, setFilters, clearFilters } = useFilterState<Filters>({
|
|
15
|
-
initialFilters,
|
|
16
|
-
debounceMs,
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<div data-testid="harness">
|
|
21
|
-
<span data-testid="filters">{JSON.stringify(filters)}</span>
|
|
22
|
-
<button
|
|
23
|
-
data-testid="update-status"
|
|
24
|
-
onClick={() => updateFilter('status', 'active')}
|
|
25
|
-
>
|
|
26
|
-
Set status to active
|
|
27
|
-
</button>
|
|
28
|
-
<button
|
|
29
|
-
data-testid="update-search"
|
|
30
|
-
onClick={() => updateFilter('search', 'hello')}
|
|
31
|
-
>
|
|
32
|
-
Set search to hello
|
|
33
|
-
</button>
|
|
34
|
-
<button
|
|
35
|
-
data-testid="set-filters"
|
|
36
|
-
onClick={() => setFilters({ status: 'rejected', search: 'test' })}
|
|
37
|
-
>
|
|
38
|
-
Set all filters
|
|
39
|
-
</button>
|
|
40
|
-
<button data-testid="clear" onClick={() => clearFilters()}>
|
|
41
|
-
Clear
|
|
42
|
-
</button>
|
|
43
|
-
</div>
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const meta: Meta<typeof Harness> = {
|
|
48
|
-
title: 'Internal/useFilterState',
|
|
49
|
-
component: Harness,
|
|
50
|
-
tags: ['autodocs'],
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export default meta;
|
|
54
|
-
type Story = StoryObj<typeof meta>;
|
|
55
|
-
|
|
56
|
-
export const InitialState: Story = {
|
|
57
|
-
args: {
|
|
58
|
-
initialFilters: { status: '', search: '' },
|
|
59
|
-
},
|
|
60
|
-
play: async ({ canvasElement }) => {
|
|
61
|
-
const canvas = within(canvasElement);
|
|
62
|
-
const output = canvas.getByTestId('filters');
|
|
63
|
-
await expect(output).toHaveTextContent('{"status":"","search":""}');
|
|
64
|
-
},
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
export const UpdateSingleFilter: Story = {
|
|
68
|
-
args: {
|
|
69
|
-
initialFilters: { status: '', search: '' },
|
|
70
|
-
},
|
|
71
|
-
play: async ({ canvasElement }) => {
|
|
72
|
-
const canvas = within(canvasElement);
|
|
73
|
-
await userEvent.click(canvas.getByTestId('update-status'));
|
|
74
|
-
const output = canvas.getByTestId('filters');
|
|
75
|
-
await expect(output).toHaveTextContent('{"status":"active","search":""}');
|
|
76
|
-
},
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export const SetAllFilters: Story = {
|
|
80
|
-
args: {
|
|
81
|
-
initialFilters: { status: '', search: '' },
|
|
82
|
-
},
|
|
83
|
-
play: async ({ canvasElement }) => {
|
|
84
|
-
const canvas = within(canvasElement);
|
|
85
|
-
await userEvent.click(canvas.getByTestId('set-filters'));
|
|
86
|
-
const output = canvas.getByTestId('filters');
|
|
87
|
-
await expect(output).toHaveTextContent('{"status":"rejected","search":"test"}');
|
|
88
|
-
},
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export const ClearResetsToInitial: Story = {
|
|
92
|
-
args: {
|
|
93
|
-
initialFilters: { status: 'pending', search: 'default' },
|
|
94
|
-
},
|
|
95
|
-
play: async ({ canvasElement }) => {
|
|
96
|
-
const canvas = within(canvasElement);
|
|
97
|
-
await userEvent.click(canvas.getByTestId('update-status'));
|
|
98
|
-
await userEvent.click(canvas.getByTestId('clear'));
|
|
99
|
-
const output = canvas.getByTestId('filters');
|
|
100
|
-
await expect(output).toHaveTextContent('{"status":"pending","search":"default"}');
|
|
101
|
-
},
|
|
102
|
-
};
|