@aspect-ops/exon-ui 0.0.2 → 0.0.3
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/ActionSheet/ActionSheet.svelte +270 -0
- package/dist/components/ActionSheet/ActionSheet.svelte.d.ts +12 -0
- package/dist/components/ActionSheet/ActionSheetItem.svelte +151 -0
- package/dist/components/ActionSheet/ActionSheetItem.svelte.d.ts +10 -0
- package/dist/components/ActionSheet/index.d.ts +3 -0
- package/dist/components/ActionSheet/index.js +2 -0
- package/dist/components/Alert/Alert.svelte +165 -0
- package/dist/components/Alert/Alert.svelte.d.ts +11 -0
- package/dist/components/Alert/index.d.ts +1 -0
- package/dist/components/Alert/index.js +1 -0
- package/dist/components/AspectRatio/AspectRatio.svelte +42 -0
- package/dist/components/AspectRatio/AspectRatio.svelte.d.ts +9 -0
- package/dist/components/AspectRatio/index.d.ts +1 -0
- package/dist/components/AspectRatio/index.js +1 -0
- package/dist/components/Avatar/Avatar.svelte +147 -0
- package/dist/components/Avatar/Avatar.svelte.d.ts +12 -0
- package/dist/components/Avatar/AvatarGroup.svelte +153 -0
- package/dist/components/Avatar/AvatarGroup.svelte.d.ts +12 -0
- package/dist/components/Avatar/index.d.ts +2 -0
- package/dist/components/Avatar/index.js +2 -0
- package/dist/components/BottomSheet/BottomSheet.svelte +230 -0
- package/dist/components/BottomSheet/BottomSheet.svelte.d.ts +7 -0
- package/dist/components/BottomSheet/BottomSheetBody.svelte +20 -0
- package/dist/components/BottomSheet/BottomSheetBody.svelte.d.ts +7 -0
- package/dist/components/BottomSheet/BottomSheetHeader.svelte +27 -0
- package/dist/components/BottomSheet/BottomSheetHeader.svelte.d.ts +7 -0
- package/dist/components/BottomSheet/index.d.ts +3 -0
- package/dist/components/BottomSheet/index.js +3 -0
- package/dist/components/Box/Box.svelte +41 -0
- package/dist/components/Box/Box.svelte.d.ts +7 -0
- package/dist/components/Box/index.d.ts +1 -0
- package/dist/components/Box/index.js +1 -0
- package/dist/components/Card/Card.svelte +95 -0
- package/dist/components/Card/Card.svelte.d.ts +10 -0
- package/dist/components/Card/CardBody.svelte +32 -0
- package/dist/components/Card/CardBody.svelte.d.ts +7 -0
- package/dist/components/Card/CardFooter.svelte +34 -0
- package/dist/components/Card/CardFooter.svelte.d.ts +7 -0
- package/dist/components/Card/CardHeader.svelte +67 -0
- package/dist/components/Card/CardHeader.svelte.d.ts +9 -0
- package/dist/components/Card/index.d.ts +4 -0
- package/dist/components/Card/index.js +4 -0
- package/dist/components/Center/Center.svelte +28 -0
- package/dist/components/Center/Center.svelte.d.ts +8 -0
- package/dist/components/Center/index.d.ts +1 -0
- package/dist/components/Center/index.js +1 -0
- package/dist/components/Container/Container.svelte +58 -0
- package/dist/components/Container/Container.svelte.d.ts +10 -0
- package/dist/components/Container/index.d.ts +1 -0
- package/dist/components/Container/index.js +1 -0
- package/dist/components/Divider/Divider.svelte +38 -0
- package/dist/components/Divider/Divider.svelte.d.ts +9 -0
- package/dist/components/Divider/index.d.ts +1 -0
- package/dist/components/Divider/index.js +1 -0
- package/dist/components/EmptyState/EmptyState.svelte +164 -0
- package/dist/components/EmptyState/EmptyState.svelte.d.ts +12 -0
- package/dist/components/EmptyState/index.d.ts +1 -0
- package/dist/components/EmptyState/index.js +1 -0
- package/dist/components/FAB/FAB.svelte +242 -0
- package/dist/components/FAB/FAB.svelte.d.ts +9 -0
- package/dist/components/FAB/FABGroup.svelte +449 -0
- package/dist/components/FAB/FABGroup.svelte.d.ts +9 -0
- package/dist/components/FAB/index.d.ts +3 -0
- package/dist/components/FAB/index.js +2 -0
- package/dist/components/Grid/Grid.svelte +136 -0
- package/dist/components/Grid/Grid.svelte.d.ts +12 -0
- package/dist/components/Grid/GridItem.svelte +21 -0
- package/dist/components/Grid/GridItem.svelte.d.ts +7 -0
- package/dist/components/Grid/index.d.ts +2 -0
- package/dist/components/Grid/index.js +2 -0
- package/dist/components/List/List.svelte +42 -0
- package/dist/components/List/List.svelte.d.ts +18 -0
- package/dist/components/List/ListItem.svelte +139 -0
- package/dist/components/List/ListItem.svelte.d.ts +36 -0
- package/dist/components/List/index.d.ts +2 -0
- package/dist/components/List/index.js +2 -0
- package/dist/components/Modal/Modal.svelte +204 -0
- package/dist/components/Modal/Modal.svelte.d.ts +7 -0
- package/dist/components/Modal/ModalBody.svelte +50 -0
- package/dist/components/Modal/ModalBody.svelte.d.ts +7 -0
- package/dist/components/Modal/ModalFooter.svelte +37 -0
- package/dist/components/Modal/ModalFooter.svelte.d.ts +7 -0
- package/dist/components/Modal/ModalHeader.svelte +73 -0
- package/dist/components/Modal/ModalHeader.svelte.d.ts +7 -0
- package/dist/components/Modal/index.d.ts +4 -0
- package/dist/components/Modal/index.js +4 -0
- package/dist/components/Popover/Popover.svelte +14 -0
- package/dist/components/Popover/Popover.svelte.d.ts +7 -0
- package/dist/components/Popover/PopoverContent.svelte +63 -0
- package/dist/components/Popover/PopoverContent.svelte.d.ts +7 -0
- package/dist/components/Popover/PopoverTrigger.svelte +14 -0
- package/dist/components/Popover/PopoverTrigger.svelte.d.ts +7 -0
- package/dist/components/Popover/index.d.ts +3 -0
- package/dist/components/Popover/index.js +3 -0
- package/dist/components/Progress/ProgressBar.svelte +86 -0
- package/dist/components/Progress/ProgressBar.svelte.d.ts +11 -0
- package/dist/components/Progress/ProgressCircle.svelte +134 -0
- package/dist/components/Progress/ProgressCircle.svelte.d.ts +12 -0
- package/dist/components/Progress/Spinner.svelte +68 -0
- package/dist/components/Progress/Spinner.svelte.d.ts +8 -0
- package/dist/components/Progress/index.d.ts +3 -0
- package/dist/components/Progress/index.js +3 -0
- package/dist/components/PullToRefresh/PullToRefresh.svelte +304 -0
- package/dist/components/PullToRefresh/PullToRefresh.svelte.d.ts +20 -0
- package/dist/components/PullToRefresh/index.d.ts +1 -0
- package/dist/components/PullToRefresh/index.js +1 -0
- package/dist/components/SafeArea/SafeArea.svelte +33 -0
- package/dist/components/SafeArea/SafeArea.svelte.d.ts +7 -0
- package/dist/components/Select/Select.svelte +55 -12
- package/dist/components/Skeleton/Skeleton.svelte +59 -0
- package/dist/components/Skeleton/Skeleton.svelte.d.ts +10 -0
- package/dist/components/Skeleton/index.d.ts +1 -0
- package/dist/components/Skeleton/index.js +1 -0
- package/dist/components/Spacer/Spacer.svelte +56 -0
- package/dist/components/Spacer/Spacer.svelte.d.ts +6 -0
- package/dist/components/Spacer/index.d.ts +1 -0
- package/dist/components/Spacer/index.js +1 -0
- package/dist/components/Stack/Stack.svelte +117 -0
- package/dist/components/Stack/Stack.svelte.d.ts +13 -0
- package/dist/components/Stack/index.d.ts +1 -0
- package/dist/components/Stack/index.js +1 -0
- package/dist/components/SwipeActions/SwipeAction.svelte +43 -0
- package/dist/components/SwipeActions/SwipeAction.svelte.d.ts +8 -0
- package/dist/components/SwipeActions/SwipeActions.svelte +193 -0
- package/dist/components/SwipeActions/SwipeActions.svelte.d.ts +9 -0
- package/dist/components/SwipeActions/index.d.ts +2 -0
- package/dist/components/SwipeActions/index.js +2 -0
- package/dist/components/Switch/Switch.svelte +29 -9
- package/dist/components/Table/Table.svelte +175 -0
- package/dist/components/Table/Table.svelte.d.ts +38 -0
- package/dist/components/Table/TableBody.svelte +26 -0
- package/dist/components/Table/TableBody.svelte.d.ts +13 -0
- package/dist/components/Table/TableCell.svelte +85 -0
- package/dist/components/Table/TableCell.svelte.d.ts +28 -0
- package/dist/components/Table/TableHead.svelte +36 -0
- package/dist/components/Table/TableHead.svelte.d.ts +13 -0
- package/dist/components/Table/TableHeader.svelte +217 -0
- package/dist/components/Table/TableHeader.svelte.d.ts +32 -0
- package/dist/components/Table/TableRow.svelte +92 -0
- package/dist/components/Table/TableRow.svelte.d.ts +28 -0
- package/dist/components/Table/index.d.ts +6 -0
- package/dist/components/Table/index.js +6 -0
- package/dist/components/Tag/Tag.svelte +189 -0
- package/dist/components/Tag/Tag.svelte.d.ts +13 -0
- package/dist/components/Tag/index.d.ts +1 -0
- package/dist/components/Tag/index.js +1 -0
- package/dist/components/Toast/Toast.svelte +241 -0
- package/dist/components/Toast/Toast.svelte.d.ts +18 -0
- package/dist/components/Toast/ToastContainer.svelte +110 -0
- package/dist/components/Toast/ToastContainer.svelte.d.ts +8 -0
- package/dist/components/Toast/index.d.ts +3 -0
- package/dist/components/Toast/index.js +3 -0
- package/dist/components/Toast/toast.d.ts +13 -0
- package/dist/components/Toast/toast.js +55 -0
- package/dist/components/Tooltip/Tooltip.svelte +71 -0
- package/dist/components/Tooltip/Tooltip.svelte.d.ts +7 -0
- package/dist/components/Tooltip/index.d.ts +2 -0
- package/dist/components/Tooltip/index.js +1 -0
- package/dist/index.d.ts +29 -1
- package/dist/index.js +32 -0
- package/dist/styles/tokens.css +5 -0
- package/dist/types/data-display.d.ts +93 -0
- package/dist/types/data-display.js +1 -0
- package/dist/types/feedback.d.ts +92 -0
- package/dist/types/feedback.js +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/layout.d.ts +57 -0
- package/dist/types/layout.js +1 -0
- package/dist/types/mobile.d.ts +91 -0
- package/dist/types/mobile.js +1 -0
- package/dist/utils/gestures.d.ts +219 -0
- package/dist/utils/gestures.js +492 -0
- package/dist/utils/haptics.d.ts +89 -0
- package/dist/utils/haptics.js +198 -0
- package/dist/utils/platform.d.ts +47 -0
- package/dist/utils/platform.js +156 -0
- package/package.json +1 -1
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { StackDirection, SpacingToken, GridAlign, GridJustify } from '../../types/index.js';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
direction?: StackDirection;
|
|
6
|
+
gap?: SpacingToken;
|
|
7
|
+
align?: GridAlign;
|
|
8
|
+
justify?: GridJustify;
|
|
9
|
+
wrap?: boolean;
|
|
10
|
+
class?: string;
|
|
11
|
+
children?: import('svelte').Snippet;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let {
|
|
15
|
+
direction = 'column',
|
|
16
|
+
gap = 'md',
|
|
17
|
+
align = 'stretch',
|
|
18
|
+
justify = 'start',
|
|
19
|
+
wrap = false,
|
|
20
|
+
class: className = '',
|
|
21
|
+
children
|
|
22
|
+
}: Props = $props();
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<div
|
|
26
|
+
class="stack {className}"
|
|
27
|
+
data-direction={direction}
|
|
28
|
+
data-gap={gap}
|
|
29
|
+
data-align={align}
|
|
30
|
+
data-justify={justify}
|
|
31
|
+
data-wrap={wrap}
|
|
32
|
+
>
|
|
33
|
+
{#if children}
|
|
34
|
+
{@render children()}
|
|
35
|
+
{/if}
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<style>
|
|
39
|
+
.stack {
|
|
40
|
+
display: flex;
|
|
41
|
+
width: 100%;
|
|
42
|
+
font-family: inherit;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* Direction */
|
|
46
|
+
.stack[data-direction='row'] {
|
|
47
|
+
flex-direction: row;
|
|
48
|
+
}
|
|
49
|
+
.stack[data-direction='column'] {
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Gap sizes using CSS custom properties */
|
|
54
|
+
.stack[data-gap='xs'] {
|
|
55
|
+
gap: var(--space-xs, 0.25rem);
|
|
56
|
+
}
|
|
57
|
+
.stack[data-gap='sm'] {
|
|
58
|
+
gap: var(--space-sm, 0.5rem);
|
|
59
|
+
}
|
|
60
|
+
.stack[data-gap='md'] {
|
|
61
|
+
gap: var(--space-md, 1rem);
|
|
62
|
+
}
|
|
63
|
+
.stack[data-gap='lg'] {
|
|
64
|
+
gap: var(--space-lg, 1.5rem);
|
|
65
|
+
}
|
|
66
|
+
.stack[data-gap='xl'] {
|
|
67
|
+
gap: var(--space-xl, 2rem);
|
|
68
|
+
}
|
|
69
|
+
.stack[data-gap='2xl'] {
|
|
70
|
+
gap: var(--space-2xl, 3rem);
|
|
71
|
+
}
|
|
72
|
+
.stack[data-gap='3xl'] {
|
|
73
|
+
gap: var(--space-3xl, 4rem);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/* Align items */
|
|
77
|
+
.stack[data-align='start'] {
|
|
78
|
+
align-items: start;
|
|
79
|
+
}
|
|
80
|
+
.stack[data-align='center'] {
|
|
81
|
+
align-items: center;
|
|
82
|
+
}
|
|
83
|
+
.stack[data-align='end'] {
|
|
84
|
+
align-items: end;
|
|
85
|
+
}
|
|
86
|
+
.stack[data-align='stretch'] {
|
|
87
|
+
align-items: stretch;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* Justify content */
|
|
91
|
+
.stack[data-justify='start'] {
|
|
92
|
+
justify-content: start;
|
|
93
|
+
}
|
|
94
|
+
.stack[data-justify='center'] {
|
|
95
|
+
justify-content: center;
|
|
96
|
+
}
|
|
97
|
+
.stack[data-justify='end'] {
|
|
98
|
+
justify-content: end;
|
|
99
|
+
}
|
|
100
|
+
.stack[data-justify='space-between'] {
|
|
101
|
+
justify-content: space-between;
|
|
102
|
+
}
|
|
103
|
+
.stack[data-justify='space-around'] {
|
|
104
|
+
justify-content: space-around;
|
|
105
|
+
}
|
|
106
|
+
.stack[data-justify='space-evenly'] {
|
|
107
|
+
justify-content: space-evenly;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* Wrap */
|
|
111
|
+
.stack[data-wrap='true'] {
|
|
112
|
+
flex-wrap: wrap;
|
|
113
|
+
}
|
|
114
|
+
.stack[data-wrap='false'] {
|
|
115
|
+
flex-wrap: nowrap;
|
|
116
|
+
}
|
|
117
|
+
</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { StackDirection, SpacingToken, GridAlign, GridJustify } from '../../types/index.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
direction?: StackDirection;
|
|
4
|
+
gap?: SpacingToken;
|
|
5
|
+
align?: GridAlign;
|
|
6
|
+
justify?: GridJustify;
|
|
7
|
+
wrap?: boolean;
|
|
8
|
+
class?: string;
|
|
9
|
+
children?: import('svelte').Snippet;
|
|
10
|
+
}
|
|
11
|
+
declare const Stack: import("svelte").Component<Props, {}, "">;
|
|
12
|
+
type Stack = ReturnType<typeof Stack>;
|
|
13
|
+
export default Stack;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Stack } from './Stack.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Stack } from './Stack.svelte';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { SwipeActionProps } from '../../types/index.js';
|
|
3
|
+
|
|
4
|
+
interface Props extends SwipeActionProps {
|
|
5
|
+
children?: import('svelte').Snippet;
|
|
6
|
+
onclick?: () => void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
color = 'var(--color-primary, #3b82f6)',
|
|
11
|
+
class: className = '',
|
|
12
|
+
onclick,
|
|
13
|
+
children
|
|
14
|
+
}: Props = $props();
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<button class="swipe-action-item {className}" style="background: {color}" {onclick}>
|
|
18
|
+
{@render children?.()}
|
|
19
|
+
</button>
|
|
20
|
+
|
|
21
|
+
<style>
|
|
22
|
+
.swipe-action-item {
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
gap: 0.25rem;
|
|
28
|
+
min-width: 80px;
|
|
29
|
+
height: 100%;
|
|
30
|
+
border: none;
|
|
31
|
+
color: white;
|
|
32
|
+
font-family: inherit;
|
|
33
|
+
font-size: var(--text-xs, 0.75rem);
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
min-height: 44px;
|
|
36
|
+
padding: var(--space-sm, 0.5rem);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.swipe-action-item:focus-visible {
|
|
40
|
+
outline: 2px solid white;
|
|
41
|
+
outline-offset: -2px;
|
|
42
|
+
}
|
|
43
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SwipeActionProps } from '../../types/index.js';
|
|
2
|
+
interface Props extends SwipeActionProps {
|
|
3
|
+
children?: import('svelte').Snippet;
|
|
4
|
+
onclick?: () => void;
|
|
5
|
+
}
|
|
6
|
+
declare const SwipeAction: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type SwipeAction = ReturnType<typeof SwipeAction>;
|
|
8
|
+
export default SwipeAction;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { SwipeActionsProps, SwipeActionData } from '../../types/index.js';
|
|
3
|
+
import { hapticImpact } from '../../utils/haptics.js';
|
|
4
|
+
|
|
5
|
+
interface Props extends SwipeActionsProps {
|
|
6
|
+
children?: import('svelte').Snippet;
|
|
7
|
+
leftActionsSnippet?: import('svelte').Snippet;
|
|
8
|
+
rightActionsSnippet?: import('svelte').Snippet;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let {
|
|
12
|
+
leftActions = [],
|
|
13
|
+
rightActions = [],
|
|
14
|
+
threshold = 60,
|
|
15
|
+
disabled = false,
|
|
16
|
+
class: className = '',
|
|
17
|
+
children,
|
|
18
|
+
leftActionsSnippet,
|
|
19
|
+
rightActionsSnippet
|
|
20
|
+
}: Props = $props();
|
|
21
|
+
|
|
22
|
+
let translateX = $state(0);
|
|
23
|
+
let isDragging = $state(false);
|
|
24
|
+
let startX = 0;
|
|
25
|
+
let containerRef: HTMLDivElement;
|
|
26
|
+
|
|
27
|
+
const leftWidth = $derived(leftActions.length * 80);
|
|
28
|
+
const rightWidth = $derived(rightActions.length * 80);
|
|
29
|
+
|
|
30
|
+
function handleTouchStart(e: TouchEvent) {
|
|
31
|
+
if (disabled) return;
|
|
32
|
+
isDragging = true;
|
|
33
|
+
startX = e.touches[0].clientX - translateX;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function handleTouchMove(e: TouchEvent) {
|
|
37
|
+
if (!isDragging || disabled) return;
|
|
38
|
+
const currentX = e.touches[0].clientX;
|
|
39
|
+
let newTranslateX = currentX - startX;
|
|
40
|
+
|
|
41
|
+
// Limit to action widths with resistance beyond
|
|
42
|
+
if (newTranslateX > leftWidth) {
|
|
43
|
+
newTranslateX = leftWidth + (newTranslateX - leftWidth) * 0.2;
|
|
44
|
+
} else if (newTranslateX < -rightWidth) {
|
|
45
|
+
newTranslateX = -rightWidth + (newTranslateX + rightWidth) * 0.2;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
translateX = newTranslateX;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function handleTouchEnd() {
|
|
52
|
+
if (!isDragging) return;
|
|
53
|
+
isDragging = false;
|
|
54
|
+
|
|
55
|
+
// Snap to revealed or closed state
|
|
56
|
+
if (translateX > threshold && leftActions.length > 0) {
|
|
57
|
+
translateX = leftWidth;
|
|
58
|
+
hapticImpact('light');
|
|
59
|
+
} else if (translateX < -threshold && rightActions.length > 0) {
|
|
60
|
+
translateX = -rightWidth;
|
|
61
|
+
hapticImpact('light');
|
|
62
|
+
} else {
|
|
63
|
+
translateX = 0;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function executeAction(action: SwipeActionData, side: 'left' | 'right') {
|
|
68
|
+
hapticImpact('medium');
|
|
69
|
+
action.onAction?.();
|
|
70
|
+
translateX = 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function close() {
|
|
74
|
+
translateX = 0;
|
|
75
|
+
}
|
|
76
|
+
</script>
|
|
77
|
+
|
|
78
|
+
<div class="swipe-actions {className}" bind:this={containerRef}>
|
|
79
|
+
<!-- Left actions (revealed on swipe right) -->
|
|
80
|
+
{#if leftActions.length > 0}
|
|
81
|
+
<div class="swipe-actions__left" style="width: {leftWidth}px">
|
|
82
|
+
{#if leftActionsSnippet}
|
|
83
|
+
{@render leftActionsSnippet()}
|
|
84
|
+
{:else}
|
|
85
|
+
{#each leftActions as action}
|
|
86
|
+
<button
|
|
87
|
+
class="swipe-action"
|
|
88
|
+
style="background: {action.color || 'var(--color-primary, #3b82f6)'}"
|
|
89
|
+
onclick={() => executeAction(action, 'left')}
|
|
90
|
+
>
|
|
91
|
+
{#if action.icon}
|
|
92
|
+
<span class="swipe-action__icon">{action.icon}</span>
|
|
93
|
+
{/if}
|
|
94
|
+
<span class="swipe-action__label">{action.label}</span>
|
|
95
|
+
</button>
|
|
96
|
+
{/each}
|
|
97
|
+
{/if}
|
|
98
|
+
</div>
|
|
99
|
+
{/if}
|
|
100
|
+
|
|
101
|
+
<!-- Main content -->
|
|
102
|
+
<div
|
|
103
|
+
class="swipe-actions__content"
|
|
104
|
+
style="transform: translateX({translateX}px); transition: {isDragging
|
|
105
|
+
? 'none'
|
|
106
|
+
: 'transform 0.3s cubic-bezier(0.32, 0.72, 0, 1)'};"
|
|
107
|
+
ontouchstart={handleTouchStart}
|
|
108
|
+
ontouchmove={handleTouchMove}
|
|
109
|
+
ontouchend={handleTouchEnd}
|
|
110
|
+
ontouchcancel={handleTouchEnd}
|
|
111
|
+
role="group"
|
|
112
|
+
>
|
|
113
|
+
{@render children?.()}
|
|
114
|
+
</div>
|
|
115
|
+
|
|
116
|
+
<!-- Right actions (revealed on swipe left) -->
|
|
117
|
+
{#if rightActions.length > 0}
|
|
118
|
+
<div class="swipe-actions__right" style="width: {rightWidth}px">
|
|
119
|
+
{#if rightActionsSnippet}
|
|
120
|
+
{@render rightActionsSnippet()}
|
|
121
|
+
{:else}
|
|
122
|
+
{#each rightActions as action}
|
|
123
|
+
<button
|
|
124
|
+
class="swipe-action"
|
|
125
|
+
style="background: {action.color || 'var(--color-destructive, #ef4444)'}"
|
|
126
|
+
onclick={() => executeAction(action, 'right')}
|
|
127
|
+
>
|
|
128
|
+
{#if action.icon}
|
|
129
|
+
<span class="swipe-action__icon">{action.icon}</span>
|
|
130
|
+
{/if}
|
|
131
|
+
<span class="swipe-action__label">{action.label}</span>
|
|
132
|
+
</button>
|
|
133
|
+
{/each}
|
|
134
|
+
{/if}
|
|
135
|
+
</div>
|
|
136
|
+
{/if}
|
|
137
|
+
</div>
|
|
138
|
+
|
|
139
|
+
<style>
|
|
140
|
+
.swipe-actions {
|
|
141
|
+
position: relative;
|
|
142
|
+
overflow: hidden;
|
|
143
|
+
touch-action: pan-y;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.swipe-actions__left,
|
|
147
|
+
.swipe-actions__right {
|
|
148
|
+
position: absolute;
|
|
149
|
+
top: 0;
|
|
150
|
+
bottom: 0;
|
|
151
|
+
display: flex;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.swipe-actions__left {
|
|
155
|
+
left: 0;
|
|
156
|
+
transform: translateX(-100%);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.swipe-actions__right {
|
|
160
|
+
right: 0;
|
|
161
|
+
transform: translateX(100%);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.swipe-actions__content {
|
|
165
|
+
position: relative;
|
|
166
|
+
background: var(--color-bg, #ffffff);
|
|
167
|
+
z-index: 1;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.swipe-action {
|
|
171
|
+
display: flex;
|
|
172
|
+
flex-direction: column;
|
|
173
|
+
align-items: center;
|
|
174
|
+
justify-content: center;
|
|
175
|
+
gap: 0.25rem;
|
|
176
|
+
width: 80px;
|
|
177
|
+
height: 100%;
|
|
178
|
+
border: none;
|
|
179
|
+
color: white;
|
|
180
|
+
font-family: inherit;
|
|
181
|
+
font-size: var(--text-xs, 0.75rem);
|
|
182
|
+
cursor: pointer;
|
|
183
|
+
min-height: 44px;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.swipe-action__icon {
|
|
187
|
+
font-size: 1.25rem;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.swipe-action__label {
|
|
191
|
+
font-weight: 500;
|
|
192
|
+
}
|
|
193
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SwipeActionsProps } from '../../types/index.js';
|
|
2
|
+
interface Props extends SwipeActionsProps {
|
|
3
|
+
children?: import('svelte').Snippet;
|
|
4
|
+
leftActionsSnippet?: import('svelte').Snippet;
|
|
5
|
+
rightActionsSnippet?: import('svelte').Snippet;
|
|
6
|
+
}
|
|
7
|
+
declare const SwipeActions: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type SwipeActions = ReturnType<typeof SwipeActions>;
|
|
9
|
+
export default SwipeActions;
|
|
@@ -66,21 +66,34 @@
|
|
|
66
66
|
min-width: 2.75rem;
|
|
67
67
|
min-height: 1.5rem;
|
|
68
68
|
padding: 2px;
|
|
69
|
-
border:
|
|
69
|
+
border: 2px solid var(--color-border-strong, #9ca3af);
|
|
70
70
|
border-radius: 9999px;
|
|
71
|
-
background: var(--color-bg
|
|
71
|
+
background: var(--color-bg, #ffffff);
|
|
72
72
|
cursor: pointer;
|
|
73
|
-
transition:
|
|
73
|
+
transition:
|
|
74
|
+
background var(--transition-fast, 150ms ease),
|
|
75
|
+
border-color var(--transition-fast, 150ms ease);
|
|
74
76
|
-webkit-tap-highlight-color: transparent;
|
|
75
77
|
}
|
|
76
78
|
|
|
79
|
+
:global(.switch:hover:not(.switch--disabled)) {
|
|
80
|
+
border-color: var(--color-text-muted, #6b7280);
|
|
81
|
+
}
|
|
82
|
+
|
|
77
83
|
:global(.switch:focus-visible) {
|
|
78
84
|
outline: none;
|
|
79
|
-
|
|
85
|
+
border-color: var(--color-primary, #3b82f6);
|
|
86
|
+
box-shadow: 0 0 0 3px var(--color-primary-alpha, rgba(59, 130, 246, 0.2));
|
|
80
87
|
}
|
|
81
88
|
|
|
82
89
|
:global(.switch[data-state='checked']) {
|
|
83
90
|
background: var(--color-primary, #3b82f6);
|
|
91
|
+
border-color: var(--color-primary, #3b82f6);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
:global(.switch[data-state='checked']:hover:not(.switch--disabled)) {
|
|
95
|
+
background: var(--color-primary-hover, #2563eb);
|
|
96
|
+
border-color: var(--color-primary-hover, #2563eb);
|
|
84
97
|
}
|
|
85
98
|
|
|
86
99
|
:global(.switch--disabled) {
|
|
@@ -90,16 +103,23 @@
|
|
|
90
103
|
|
|
91
104
|
:global(.switch__thumb) {
|
|
92
105
|
display: block;
|
|
93
|
-
width:
|
|
94
|
-
height:
|
|
106
|
+
width: 1rem;
|
|
107
|
+
height: 1rem;
|
|
95
108
|
border-radius: 50%;
|
|
96
|
-
background: var(--color-
|
|
97
|
-
box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.
|
|
98
|
-
transition:
|
|
109
|
+
background: var(--color-border-strong, #9ca3af);
|
|
110
|
+
box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.15));
|
|
111
|
+
transition:
|
|
112
|
+
transform var(--transition-fast, 150ms ease),
|
|
113
|
+
background var(--transition-fast, 150ms ease);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
:global(.switch:hover:not(.switch--disabled) .switch__thumb) {
|
|
117
|
+
background: var(--color-text-muted, #6b7280);
|
|
99
118
|
}
|
|
100
119
|
|
|
101
120
|
:global(.switch[data-state='checked'] .switch__thumb) {
|
|
102
121
|
transform: translateX(1.25rem);
|
|
122
|
+
background: var(--color-bg, #ffffff);
|
|
103
123
|
}
|
|
104
124
|
|
|
105
125
|
.switch__label {
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { TableProps } from '../../types/data-display.js';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
/**
|
|
6
|
+
* Enable alternating row background colors
|
|
7
|
+
* @default false
|
|
8
|
+
*/
|
|
9
|
+
striped?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Show borders on table cells
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
bordered?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Enable hover effect on table rows
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
hoverable?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Reduce padding for more compact layout
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
compact?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Make table header sticky on scroll
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
29
|
+
stickyHeader?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Additional CSS classes
|
|
32
|
+
*/
|
|
33
|
+
class?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Table content (thead, tbody, tfoot)
|
|
36
|
+
*/
|
|
37
|
+
children?: import('svelte').Snippet;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
let {
|
|
41
|
+
striped = false,
|
|
42
|
+
bordered = false,
|
|
43
|
+
hoverable = false,
|
|
44
|
+
compact = false,
|
|
45
|
+
stickyHeader = false,
|
|
46
|
+
class: className = '',
|
|
47
|
+
children
|
|
48
|
+
}: Props = $props();
|
|
49
|
+
|
|
50
|
+
// Build modifier classes
|
|
51
|
+
let modifierClasses = $derived(
|
|
52
|
+
[
|
|
53
|
+
striped ? 'table-container--striped' : '',
|
|
54
|
+
bordered ? 'table-container--bordered' : '',
|
|
55
|
+
hoverable ? 'table-container--hoverable' : '',
|
|
56
|
+
compact ? 'table-container--compact' : '',
|
|
57
|
+
stickyHeader ? 'table-container--sticky-header' : ''
|
|
58
|
+
]
|
|
59
|
+
.filter(Boolean)
|
|
60
|
+
.join(' ')
|
|
61
|
+
);
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<div class="table-container {modifierClasses} {className}">
|
|
65
|
+
<table class="table">
|
|
66
|
+
{#if children}
|
|
67
|
+
{@render children()}
|
|
68
|
+
{/if}
|
|
69
|
+
</table>
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
<style>
|
|
73
|
+
.table-container {
|
|
74
|
+
/* Horizontal scroll for responsive tables on mobile */
|
|
75
|
+
overflow-x: auto;
|
|
76
|
+
-webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
|
|
77
|
+
font-family: inherit;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.table {
|
|
81
|
+
width: 100%;
|
|
82
|
+
border-collapse: collapse;
|
|
83
|
+
border-spacing: 0;
|
|
84
|
+
font-family: inherit;
|
|
85
|
+
font-size: 0.875rem; /* 14px */
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* Default cell padding */
|
|
89
|
+
.table :global(th),
|
|
90
|
+
.table :global(td) {
|
|
91
|
+
padding: 0.75rem; /* 12px */
|
|
92
|
+
text-align: left;
|
|
93
|
+
vertical-align: middle;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* Header styles */
|
|
97
|
+
.table :global(thead th) {
|
|
98
|
+
font-weight: 600;
|
|
99
|
+
color: var(--color-text-muted, var(--gray-11, inherit));
|
|
100
|
+
background-color: var(--color-bg-muted, var(--gray-2, #f9fafb));
|
|
101
|
+
border-bottom: 2px solid var(--color-border, var(--gray-6, #e5e7eb));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* Body cell styles */
|
|
105
|
+
.table :global(tbody td) {
|
|
106
|
+
color: var(--color-text, var(--gray-12, inherit));
|
|
107
|
+
border-bottom: 1px solid var(--color-border, var(--gray-6, #e5e7eb));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* Footer styles */
|
|
111
|
+
.table :global(tfoot td),
|
|
112
|
+
.table :global(tfoot th) {
|
|
113
|
+
font-weight: 600;
|
|
114
|
+
color: var(--color-text-muted, var(--gray-11, inherit));
|
|
115
|
+
background-color: var(--color-bg-muted, var(--gray-2, #f9fafb));
|
|
116
|
+
border-top: 2px solid var(--color-border, var(--gray-6, #e5e7eb));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/* Striped modifier - alternating row backgrounds */
|
|
120
|
+
.table-container--striped .table :global(tbody tr:nth-child(even)) {
|
|
121
|
+
background-color: var(--color-bg-muted, var(--gray-2, #f9fafb));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* Bordered modifier - borders on all cells */
|
|
125
|
+
.table-container--bordered .table :global(th),
|
|
126
|
+
.table-container--bordered .table :global(td) {
|
|
127
|
+
border: 1px solid var(--color-border, #e5e7eb);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.table-container--bordered .table :global(thead th) {
|
|
131
|
+
border-bottom-width: 2px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* Hoverable modifier - row hover effects */
|
|
135
|
+
.table-container--hoverable .table :global(tbody tr) {
|
|
136
|
+
transition: background-color 0.15s ease;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.table-container--hoverable .table :global(tbody tr:hover) {
|
|
140
|
+
background-color: var(--color-bg-hover, var(--gray-4, #f3f4f6));
|
|
141
|
+
cursor: pointer;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* Compact modifier - reduced padding */
|
|
145
|
+
.table-container--compact .table :global(th),
|
|
146
|
+
.table-container--compact .table :global(td) {
|
|
147
|
+
padding: 0.5rem; /* 8px */
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/* Sticky header modifier - header stays visible on scroll */
|
|
151
|
+
.table-container--sticky-header .table :global(thead th) {
|
|
152
|
+
position: sticky;
|
|
153
|
+
top: 0;
|
|
154
|
+
z-index: 10;
|
|
155
|
+
box-shadow: 0 1px 0 0 var(--color-border, var(--gray-6, #e5e7eb));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* Ensure sticky header has proper background */
|
|
159
|
+
.table-container--sticky-header .table :global(thead th) {
|
|
160
|
+
background-color: var(--color-bg-muted, var(--gray-2, #f9fafb));
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/* Right-align numeric columns */
|
|
164
|
+
.table :global(td.numeric),
|
|
165
|
+
.table :global(th.numeric) {
|
|
166
|
+
text-align: right;
|
|
167
|
+
font-variant-numeric: tabular-nums;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/* Center-align specific columns */
|
|
171
|
+
.table :global(td.center),
|
|
172
|
+
.table :global(th.center) {
|
|
173
|
+
text-align: center;
|
|
174
|
+
}
|
|
175
|
+
</style>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
/**
|
|
3
|
+
* Enable alternating row background colors
|
|
4
|
+
* @default false
|
|
5
|
+
*/
|
|
6
|
+
striped?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Show borders on table cells
|
|
9
|
+
* @default false
|
|
10
|
+
*/
|
|
11
|
+
bordered?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Enable hover effect on table rows
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
hoverable?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Reduce padding for more compact layout
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
compact?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Make table header sticky on scroll
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
stickyHeader?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Additional CSS classes
|
|
29
|
+
*/
|
|
30
|
+
class?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Table content (thead, tbody, tfoot)
|
|
33
|
+
*/
|
|
34
|
+
children?: import('svelte').Snippet;
|
|
35
|
+
}
|
|
36
|
+
declare const Table: import("svelte").Component<Props, {}, "">;
|
|
37
|
+
type Table = ReturnType<typeof Table>;
|
|
38
|
+
export default Table;
|