fluentui-svelte 0.1.2 → 0.2.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 +0 -6
- package/dist/components/auto-suggest-box/auto-suggest-box.svelte +6 -0
- package/dist/components/auto-suggest-box/docs/llms.md +14 -13
- package/dist/components/auto-suggest-box/types.d.ts +5 -0
- package/dist/components/avatar/avatar.svelte +1 -1
- package/dist/components/badge/badge-icon.svelte +5 -8
- package/dist/components/badge/badge.svelte +6 -2
- package/dist/components/button/button.svelte +2 -2
- package/dist/components/button/types.d.ts +5 -1
- package/dist/components/card/card-context.svelte.d.ts +2 -0
- package/dist/components/card/card-context.svelte.js +2 -0
- package/dist/components/card/card-footer.svelte +37 -0
- package/dist/components/card/card-footer.svelte.d.ts +4 -0
- package/dist/components/card/card-header.svelte +81 -0
- package/dist/components/card/card-header.svelte.d.ts +4 -0
- package/dist/components/card/card-preview.svelte +64 -0
- package/dist/components/card/card-preview.svelte.d.ts +4 -0
- package/dist/components/card/card.svelte +242 -0
- package/dist/components/card/card.svelte.d.ts +39 -0
- package/dist/components/card/docs/llms.md +206 -0
- package/dist/components/card/types.d.ts +129 -0
- package/dist/components/card/types.js +1 -0
- package/dist/components/checkbox/checkbox.svelte +5 -3
- package/dist/components/menu/menu-item-checkbox.svelte +1 -1
- package/dist/components/menu/menu-item-radio.svelte +1 -1
- package/dist/components/menu/menu-item-switch.svelte +1 -1
- package/dist/components/menu/menu-item.svelte +1 -1
- package/dist/css/class-darkmode.css +3 -1
- package/dist/css/media-darkmode.css +3 -1
- package/dist/css/theme.css +3 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +6 -0
- package/dist/internal/components/render-soc/render-soc.svelte +17 -23
- package/dist/internal/components/render-soc/render-soc.svelte.d.ts +16 -16
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# Card
|
|
2
|
+
|
|
3
|
+
A card is a container that groups content and actions about a single topic, and can optionally be selected.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```svelte
|
|
8
|
+
<script>
|
|
9
|
+
import { Card, CardPreview, CardHeader, CardFooter, Button } from 'fluentui-svelte';
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
{#snippet footerActions()}
|
|
13
|
+
<Button>Like</Button>
|
|
14
|
+
<Button appearance="standard">Share</Button>
|
|
15
|
+
{/snippet}
|
|
16
|
+
|
|
17
|
+
<Card orientation="vertical">
|
|
18
|
+
<CardPreview logoSrc="/logo.png">
|
|
19
|
+
<img src="/preview.png" alt="Preview" />
|
|
20
|
+
</CardPreview>
|
|
21
|
+
<CardHeader title="FluentUI Svelte" description="5h ago · About us - Overview" />
|
|
22
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
|
|
23
|
+
<CardFooter action={footerActions} />
|
|
24
|
+
</Card>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Component API
|
|
28
|
+
|
|
29
|
+
A card is built out of the following components:
|
|
30
|
+
|
|
31
|
+
- `Card`: the root component. It creates all the state, provides context to its parts and handles the selection.
|
|
32
|
+
- `CardPreview`: the media shown at one edge of the card, with an optional logo overlaid on it.
|
|
33
|
+
- `CardHeader`: the title of the card, with an optional image, description and action.
|
|
34
|
+
- `CardFooter`: the actions shown at the bottom of the card.
|
|
35
|
+
|
|
36
|
+
`CardPreview`, `CardHeader` and `CardFooter` read the card context, so they throw when rendered outside a `Card`.
|
|
37
|
+
They are all optional, and the card renders any other content passed to it as is.
|
|
38
|
+
|
|
39
|
+
The following combinations are rejected at runtime, because they cannot be resolved visually:
|
|
40
|
+
|
|
41
|
+
- `showFloatingAction` without `selectable`.
|
|
42
|
+
- `selected` without `selectable`.
|
|
43
|
+
- `as="a"` together with `selectable`.
|
|
44
|
+
- `action` on `CardHeader` or `CardFooter` inside a selectable card.
|
|
45
|
+
|
|
46
|
+
## Examples
|
|
47
|
+
|
|
48
|
+
### Appearance
|
|
49
|
+
|
|
50
|
+
A card can have its background and borders styled for greater emphasis or to be subtle.
|
|
51
|
+
|
|
52
|
+
```svelte
|
|
53
|
+
<Card appearance="filled">Filled</Card>
|
|
54
|
+
<Card appearance="outlined">Outlined</Card>
|
|
55
|
+
<Card appearance="subtle">Subtle</Card>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Orientation
|
|
59
|
+
|
|
60
|
+
A card lays its parts out horizontally by default. Set `orientation` to `vertical` to stack them instead.
|
|
61
|
+
|
|
62
|
+
```svelte
|
|
63
|
+
<Card orientation="horizontal">
|
|
64
|
+
<CardPreview logoSrc="/logo.png">
|
|
65
|
+
<img src="/preview.png" alt="Preview" />
|
|
66
|
+
</CardPreview>
|
|
67
|
+
<CardHeader title="Horizontal" description="The default orientation" />
|
|
68
|
+
</Card>
|
|
69
|
+
|
|
70
|
+
<Card orientation="vertical">
|
|
71
|
+
<CardPreview logoSrc="/logo.png">
|
|
72
|
+
<img src="/preview.png" alt="Preview" />
|
|
73
|
+
</CardPreview>
|
|
74
|
+
<CardHeader title="Vertical" description="Stacks every part" />
|
|
75
|
+
</Card>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Selection
|
|
79
|
+
|
|
80
|
+
A selectable card toggles its selection when clicked anywhere, and reports it through `onSelectionChange`. Set
|
|
81
|
+
`showFloatingAction` to float a checkbox over the top right corner.
|
|
82
|
+
|
|
83
|
+
```svelte
|
|
84
|
+
<script>
|
|
85
|
+
let selected = $state(false);
|
|
86
|
+
</script>
|
|
87
|
+
|
|
88
|
+
<Card selectable showFloatingAction bind:selected onSelectionChange={(id, selected) => console.log(id, selected)}>
|
|
89
|
+
<CardHeader title="Selectable card" description={selected ? 'Selected' : 'Not selected'} />
|
|
90
|
+
</Card>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Header
|
|
94
|
+
|
|
95
|
+
The header takes a `title`, and optionally an `image`, a `description` and an `action`. A string title renders inside
|
|
96
|
+
a heading; a snippet or a component receives the id the floating checkbox is labelled by.
|
|
97
|
+
|
|
98
|
+
```svelte
|
|
99
|
+
<script>
|
|
100
|
+
import { Card, CardHeader, Button } from 'fluentui-svelte';
|
|
101
|
+
import { MoreHorizontalRegular } from 'fluentui-icons-svelte';
|
|
102
|
+
</script>
|
|
103
|
+
|
|
104
|
+
{#snippet title(attrs)}
|
|
105
|
+
<h4 class="body" {...attrs}><b>FluentUI Svelte</b> mentioned you</h4>
|
|
106
|
+
{/snippet}
|
|
107
|
+
|
|
108
|
+
{#snippet action()}
|
|
109
|
+
<Button appearance="subtle" aria-label="More actions"><MoreHorizontalRegular width="1em" height="1em" /></Button>
|
|
110
|
+
{/snippet}
|
|
111
|
+
|
|
112
|
+
<Card>
|
|
113
|
+
<CardHeader image="/logo.png" {title} description="5h ago · About us - Overview" {action} />
|
|
114
|
+
</Card>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Preview
|
|
118
|
+
|
|
119
|
+
The preview holds the media of the card and rounds the corners it sits against. The `logoSrc` prop overlays a logo on
|
|
120
|
+
the bottom left corner.
|
|
121
|
+
|
|
122
|
+
```svelte
|
|
123
|
+
<Card orientation="vertical">
|
|
124
|
+
<CardPreview logoSrc="/logo.png">
|
|
125
|
+
<img src="/preview.png" alt="Preview" />
|
|
126
|
+
</CardPreview>
|
|
127
|
+
</Card>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Footer
|
|
131
|
+
|
|
132
|
+
The footer renders the actions of the card at the bottom, spread across the available width.
|
|
133
|
+
|
|
134
|
+
```svelte
|
|
135
|
+
<script>
|
|
136
|
+
import { Card, CardHeader, CardFooter, Button } from 'fluentui-svelte';
|
|
137
|
+
</script>
|
|
138
|
+
|
|
139
|
+
{#snippet action()}
|
|
140
|
+
<Button>Like</Button>
|
|
141
|
+
<Button appearance="standard">Share</Button>
|
|
142
|
+
{/snippet}
|
|
143
|
+
|
|
144
|
+
<Card orientation="vertical">
|
|
145
|
+
<CardHeader title="FluentUI Svelte" description="5h ago · About us - Overview" />
|
|
146
|
+
<CardFooter {action} />
|
|
147
|
+
</Card>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Component Props
|
|
151
|
+
|
|
152
|
+
| Name | Type | Description |
|
|
153
|
+
| -------------------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------- |
|
|
154
|
+
| `ref` | `HTMLElement` | The DOM reference of the card element. |
|
|
155
|
+
| `as` | `string` | The DOM element to render. Possible values: 'div', 'article', 'section', 'a'. |
|
|
156
|
+
| `orientation` | `string` | The axis the card lays its parts out on. Possible values: 'horizontal', 'vertical'. |
|
|
157
|
+
| `selectable` | `boolean` | Lets the user select the card by clicking anywhere on it. |
|
|
158
|
+
| `showFloatingAction` | `boolean` | Floats the selection checkbox over the top right corner of the card. Requires `selectable`. |
|
|
159
|
+
| `id` | `string` | The id of the card element. Falls back to a generated one. |
|
|
160
|
+
| `selected` | `boolean` | Whether the card is selected. Requires `selectable`. |
|
|
161
|
+
| `disabled` | `boolean` | Disables user interaction. |
|
|
162
|
+
| `appearance` | `string` | The appearance of the card. Possible values: 'filled', 'outlined', 'subtle'. |
|
|
163
|
+
| `onSelectionChange` | `(id: string, selected: boolean) => void` | Called with the id of the card whenever its selection changes. |
|
|
164
|
+
| Element Attributes | | Based on the chosen component tag, you will get autocomplete for all HTML attributes of that tag. |
|
|
165
|
+
|
|
166
|
+
## CardPreview
|
|
167
|
+
|
|
168
|
+
The media shown at one edge of the card, with an optional logo overlaid on it.
|
|
169
|
+
|
|
170
|
+
### Component Props
|
|
171
|
+
|
|
172
|
+
| Name | Type | Description |
|
|
173
|
+
| ------------------ | ---------------------- | ------------------------------------------------------------------------------ |
|
|
174
|
+
| `ref` | `HTMLDivElement` | The DOM reference of the preview element. |
|
|
175
|
+
| `logoSrc` | `string` | The URL of the logo overlaid on the bottom left corner of the preview. |
|
|
176
|
+
| `logoAlt` | `string` | The alternative text of the logo. Empty by default, so the logo is decorative. |
|
|
177
|
+
| `children` | `Snippet` | The media to preview, usually an image. |
|
|
178
|
+
| Element Attributes | HTMLElement Attributes | All other attributes can be applied to the preview element. |
|
|
179
|
+
|
|
180
|
+
## CardHeader
|
|
181
|
+
|
|
182
|
+
The title of the card, with an optional image, description and action.
|
|
183
|
+
|
|
184
|
+
### Component Props
|
|
185
|
+
|
|
186
|
+
| Name | Type | Description |
|
|
187
|
+
| ------------------ | -------------------------------- | ------------------------------------------------------------------------------------- |
|
|
188
|
+
| `ref` | `HTMLDivElement` | The DOM reference of the header element. |
|
|
189
|
+
| `title` | `Snippet \| Component \| string` | The title of the card. A snippet or a component receives the id of the title. |
|
|
190
|
+
| `image` | `Snippet \| Component \| string` | The image rendered before the title. A string is used as the `src` of an `<img>`. |
|
|
191
|
+
| `imageAlt` | `string` | The alternative text of a string image. Empty by default, so the image is decorative. |
|
|
192
|
+
| `description` | `Snippet \| Component \| string` | A second line of text below the title. |
|
|
193
|
+
| `action` | `Snippet \| Component` | The action rendered at the end of the header. Not available on selectable cards. |
|
|
194
|
+
| Element Attributes | HTMLElement Attributes | All other attributes can be applied to the header element. |
|
|
195
|
+
|
|
196
|
+
## CardFooter
|
|
197
|
+
|
|
198
|
+
The actions shown at the bottom of the card.
|
|
199
|
+
|
|
200
|
+
### Component Props
|
|
201
|
+
|
|
202
|
+
| Name | Type | Description |
|
|
203
|
+
| ------------------ | ---------------------- | -------------------------------------------------------------------------- |
|
|
204
|
+
| `ref` | `HTMLDivElement` | The DOM reference of the footer element. |
|
|
205
|
+
| `action` | `Snippet \| Component` | The actions rendered inside the footer. Not available on selectable cards. |
|
|
206
|
+
| Element Attributes | HTMLElement Attributes | All other attributes can be applied to the footer element. |
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { Horientation, PolymorphicProps } from '../../types/index.js';
|
|
2
|
+
import type { FSContext } from '../../internal/index.js';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
import type { Component, Snippet } from 'svelte';
|
|
5
|
+
export type CardTagTypes = 'div' | 'article' | 'section' | 'a';
|
|
6
|
+
/** @propsmith CardProps */
|
|
7
|
+
export type CardProps<Tag extends CardTagTypes = 'div'> = {
|
|
8
|
+
/** The DOM reference of the card element.
|
|
9
|
+
* @type CardElementDOMType[Tag]
|
|
10
|
+
* @bindable
|
|
11
|
+
*/
|
|
12
|
+
ref?: CardElementDOMType[Tag];
|
|
13
|
+
/** The DOM element to render.
|
|
14
|
+
* @type 'div' | 'article' | 'section' | 'a'
|
|
15
|
+
* @default 'div'
|
|
16
|
+
*/
|
|
17
|
+
as?: Tag;
|
|
18
|
+
/** The axis the card lays its parts out on.
|
|
19
|
+
* @default 'horizontal'
|
|
20
|
+
*/
|
|
21
|
+
orientation?: Horientation;
|
|
22
|
+
/** Lets the user select the card by clicking anywhere on it.
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
selectable?: boolean;
|
|
26
|
+
/** Floats the selection checkbox over the top right corner of the card.
|
|
27
|
+
*
|
|
28
|
+
* Only available on selectable cards, and ignored when the card renders as a link.
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
showFloatingAction?: boolean;
|
|
32
|
+
/** The id of the card element. Falls back to a generated one. */
|
|
33
|
+
id?: string;
|
|
34
|
+
/** Whether the card is selected. Only available on selectable cards.
|
|
35
|
+
* @default false
|
|
36
|
+
* @bindable
|
|
37
|
+
*/
|
|
38
|
+
selected?: boolean;
|
|
39
|
+
/** Disables the user interaction.
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
/** A card can have its background and borders styled for greater emphasis or to be subtle.
|
|
44
|
+
* @default 'filled'
|
|
45
|
+
*/
|
|
46
|
+
appearance?: 'filled' | 'outlined' | 'subtle';
|
|
47
|
+
/** Called with the id of the card whenever its selection changes.
|
|
48
|
+
* @type (id: string, selected: boolean) => void
|
|
49
|
+
*/
|
|
50
|
+
onSelectionChange?: (id: string, selected: boolean) => void;
|
|
51
|
+
} & PolymorphicProps<Tag>;
|
|
52
|
+
export type CardElementDOMType = {
|
|
53
|
+
div: HTMLDivElement;
|
|
54
|
+
article: HTMLElement;
|
|
55
|
+
section: HTMLElement;
|
|
56
|
+
a: HTMLAnchorElement;
|
|
57
|
+
};
|
|
58
|
+
export type CardContext = FSContext<{
|
|
59
|
+
readonly as?: CardTagTypes;
|
|
60
|
+
readonly showFloatingAction?: boolean;
|
|
61
|
+
readonly appearance?: 'filled' | 'outlined' | 'subtle';
|
|
62
|
+
readonly selectable?: boolean;
|
|
63
|
+
/** The id of the card, which every part uses to build its own ids. */
|
|
64
|
+
readonly id?: string;
|
|
65
|
+
}, {
|
|
66
|
+
orientation?: Horientation;
|
|
67
|
+
selected?: boolean;
|
|
68
|
+
disabled?: boolean;
|
|
69
|
+
}, null, {
|
|
70
|
+
/** Toggles the selection and forwards the click to the consumer. */
|
|
71
|
+
handleAction?: (e: MouseEvent) => void;
|
|
72
|
+
}>;
|
|
73
|
+
/** @propsmith CardPreviewProps */
|
|
74
|
+
export type CardPreviewProps = {
|
|
75
|
+
/** The DOM reference of the preview element.
|
|
76
|
+
* @bindable
|
|
77
|
+
*/
|
|
78
|
+
ref?: HTMLDivElement;
|
|
79
|
+
/** The URL of the logo overlaid on the bottom left corner of the preview. */
|
|
80
|
+
logoSrc: string;
|
|
81
|
+
/** The alternative text of the logo. Empty by default, which marks the logo as decorative.
|
|
82
|
+
* @default ''
|
|
83
|
+
*/
|
|
84
|
+
logoAlt?: string;
|
|
85
|
+
/** The media to preview, usually an image. */
|
|
86
|
+
children?: Snippet;
|
|
87
|
+
} & Omit<HTMLAttributes<HTMLDivElement>, 'children'>;
|
|
88
|
+
/** @propsmith CardHeaderProps */
|
|
89
|
+
export type CardHeaderProps = {
|
|
90
|
+
/** The DOM reference of the header element.
|
|
91
|
+
* @bindable
|
|
92
|
+
*/
|
|
93
|
+
ref?: HTMLDivElement;
|
|
94
|
+
/** The title of the card. A snippet or a component receives the id the floating checkbox is labelled by.
|
|
95
|
+
* @type Snippet | Component | string
|
|
96
|
+
*/
|
|
97
|
+
title: Snippet<[attrs: {
|
|
98
|
+
id: string;
|
|
99
|
+
}]> | Component<{
|
|
100
|
+
id: string;
|
|
101
|
+
}> | string;
|
|
102
|
+
/** The image rendered before the title. A string is used as the `src` of an `<img>`.
|
|
103
|
+
* @type Snippet | Component | string
|
|
104
|
+
*/
|
|
105
|
+
image?: Snippet | Component | string;
|
|
106
|
+
/** The alternative text of a string image. Empty by default, which marks the image as decorative.
|
|
107
|
+
* @default ''
|
|
108
|
+
*/
|
|
109
|
+
imageAlt?: string;
|
|
110
|
+
/** A second line of text below the title.
|
|
111
|
+
* @type Snippet | Component | string
|
|
112
|
+
*/
|
|
113
|
+
description?: Snippet | Component | string;
|
|
114
|
+
/** The action rendered at the end of the header. Not available on selectable cards.
|
|
115
|
+
* @type Snippet | Component
|
|
116
|
+
*/
|
|
117
|
+
action?: Snippet | Component;
|
|
118
|
+
} & Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'title'>;
|
|
119
|
+
/** @propsmith CardFooterProps */
|
|
120
|
+
export type CardFooterProps = {
|
|
121
|
+
/** The DOM reference of the footer element.
|
|
122
|
+
* @bindable
|
|
123
|
+
*/
|
|
124
|
+
ref?: HTMLDivElement;
|
|
125
|
+
/** The actions rendered inside the footer. Not available on selectable cards.
|
|
126
|
+
* @type Snippet | Component
|
|
127
|
+
*/
|
|
128
|
+
action?: Snippet | Component;
|
|
129
|
+
} & Omit<HTMLAttributes<HTMLDivElement>, 'children'>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -101,8 +101,8 @@
|
|
|
101
101
|
-moz-appearance: none;
|
|
102
102
|
&:indeterminate + div :global(svg.indeterminate),
|
|
103
103
|
&:checked + div :global(svg.checked) {
|
|
104
|
-
|
|
105
|
-
transition: var(--fs-slower-duration, 1s) cubic-bezier(0.55, 0, 0, 1)
|
|
104
|
+
mask-size: 100% 100%;
|
|
105
|
+
transition: var(--fs-slower-duration, 1s) cubic-bezier(0.55, 0, 0, 1) mask-size;
|
|
106
106
|
}
|
|
107
107
|
&:is(:checked, :indeterminate) {
|
|
108
108
|
& + div {
|
|
@@ -148,7 +148,9 @@
|
|
|
148
148
|
width: 0;
|
|
149
149
|
fill: var(--fs-text-on-accent-primary);
|
|
150
150
|
transform-origin: 80% 20%;
|
|
151
|
-
|
|
151
|
+
mask-image: linear-gradient(black, black);
|
|
152
|
+
mask-repeat: no-repeat;
|
|
153
|
+
mask-size: 0% 100%;
|
|
152
154
|
}
|
|
153
155
|
}
|
|
154
156
|
&:has(input:disabled) {
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
<span class="label" aria-label="{secondaryContent}, Use {secondaryContent}">
|
|
77
77
|
<CheckmarkFilled class="indicator" />
|
|
78
78
|
{#if Icon}
|
|
79
|
-
<RenderSoC SoC={Icon}
|
|
79
|
+
<RenderSoC SoC={Icon} args={{ class: 'menu-item-icon' }} />
|
|
80
80
|
{/if}
|
|
81
81
|
{#if subText}
|
|
82
82
|
<span class="sub-text">
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
<span class="label" aria-label="{secondaryContent}, Use {secondaryContent}">
|
|
81
81
|
<CheckmarkFilled class="indicator" />
|
|
82
82
|
{#if Icon}
|
|
83
|
-
<RenderSoC SoC={Icon}
|
|
83
|
+
<RenderSoC SoC={Icon} args={{ class: 'menu-item-icon' }} />
|
|
84
84
|
{/if}
|
|
85
85
|
{#if subText}
|
|
86
86
|
<span class="sub-text">
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
>
|
|
77
77
|
<span class="label" aria-label="{secondaryContent}, Use {secondaryContent}">
|
|
78
78
|
{#if Icon}
|
|
79
|
-
<RenderSoC SoC={Icon}
|
|
79
|
+
<RenderSoC SoC={Icon} args={{ class: 'menu-item-icon' }} />
|
|
80
80
|
{/if}
|
|
81
81
|
{#if subText}
|
|
82
82
|
<span class="sub-text">
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
>
|
|
67
67
|
<span class="label" aria-label={secondaryContent ? `${secondaryContent}, Use ${secondaryContent}` : undefined}>
|
|
68
68
|
{#if Icon}
|
|
69
|
-
<RenderSoC SoC={Icon} args={
|
|
69
|
+
<RenderSoC SoC={Icon} args={{ class: 'menu-item-icon' }} />
|
|
70
70
|
{/if}
|
|
71
71
|
{#if subText}
|
|
72
72
|
<span class="sub-text">
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
--fs-control-stroke-on-accent-tertiary: #00000037;
|
|
92
92
|
--fs-control-stroke-on-accent-disabled: #00000033;
|
|
93
93
|
--fs-control-stroke-on-image: #0000006b;
|
|
94
|
-
--fs-card-stroke-default: #
|
|
94
|
+
--fs-card-stroke-default: #0000001a;
|
|
95
95
|
--fs-card-stroke-solid: #1c1c1c;
|
|
96
96
|
|
|
97
97
|
/* Control Strong Stroke */
|
|
@@ -112,6 +112,7 @@
|
|
|
112
112
|
/* Card Background */
|
|
113
113
|
--fs-card-background-default: #ffffff0d;
|
|
114
114
|
--fs-card-background-secondary: #ffffff08;
|
|
115
|
+
--fs-card-background-tertiary: #ffffff1c; /* 6.98% opacity */
|
|
115
116
|
|
|
116
117
|
/* Smoke Background */
|
|
117
118
|
/* --fs-smoke-background-default: #0000004d; <- Same on light/dark */
|
|
@@ -159,6 +160,7 @@
|
|
|
159
160
|
|
|
160
161
|
/* Shadows */
|
|
161
162
|
--fs-shadow-card: 0 0.125rem 0.25rem #00000021; /* 13% opacity */
|
|
163
|
+
--fs-shadow-card-hover: 0 0.125rem 0.25rem #00000042; /* 26% opacity */
|
|
162
164
|
--fs-shadow-tooltip: 0 0.25rem 0.5rem #00000042; /* 26% opacity */
|
|
163
165
|
--fs-shadow-flyout: 0 0.5rem 1rem #00000042; /* 26% opacity */
|
|
164
166
|
--fs-shadow-dialog: 0 2rem 4rem #0000005e, 0 1.125rem 1.313rem #0000005e; /* 37% opacity */
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
--fs-control-stroke-on-accent-tertiary: #00000037;
|
|
93
93
|
--fs-control-stroke-on-accent-disabled: #00000033;
|
|
94
94
|
--fs-control-stroke-on-image: #0000006b;
|
|
95
|
-
--fs-card-stroke-default: #
|
|
95
|
+
--fs-card-stroke-default: #0000001a;
|
|
96
96
|
--fs-card-stroke-solid: #1c1c1c;
|
|
97
97
|
|
|
98
98
|
/* Control Strong Stroke */
|
|
@@ -113,6 +113,7 @@
|
|
|
113
113
|
/* Card Background */
|
|
114
114
|
--fs-card-background-default: #ffffff0d;
|
|
115
115
|
--fs-card-background-secondary: #ffffff08;
|
|
116
|
+
--fs-card-background-tertiary: #ffffff1c; /* 6.98% opacity */
|
|
116
117
|
|
|
117
118
|
/* Smoke Background */
|
|
118
119
|
/* --fs-smoke-background-default: #0000004d; <- Same on light/dark */
|
|
@@ -160,6 +161,7 @@
|
|
|
160
161
|
|
|
161
162
|
/* Shadows */
|
|
162
163
|
--fs-shadow-card: 0 0.125rem 0.25rem #00000021; /* 13% opacity */
|
|
164
|
+
--fs-shadow-card-hover: 0 0.125rem 0.25rem #00000042; /* 26% opacity */
|
|
163
165
|
--fs-shadow-tooltip: 0 0.25rem 0.5rem #00000042; /* 26% opacity */
|
|
164
166
|
--fs-shadow-flyout: 0 0.5rem 1rem #00000042; /* 26% opacity */
|
|
165
167
|
--fs-shadow-dialog: 0 2rem 4rem #0000005e, 0 1.125rem 1.313rem #0000005e; /* 37% opacity */
|
package/dist/css/theme.css
CHANGED
|
@@ -129,6 +129,7 @@
|
|
|
129
129
|
/* Card Background */
|
|
130
130
|
--fs-card-background-default: #ffffffb3;
|
|
131
131
|
--fs-card-background-secondary: #f6f6f680;
|
|
132
|
+
--fs-card-background-tertiary: #ffffff;
|
|
132
133
|
|
|
133
134
|
/* Smoke Background */
|
|
134
135
|
--fs-smoke-background-default: #0000004d;
|
|
@@ -179,7 +180,7 @@
|
|
|
179
180
|
/* Border Radius */
|
|
180
181
|
--fs-control-border-radius: 0.25rem;
|
|
181
182
|
--fs-control-inner-border-radius: 0.188rem;
|
|
182
|
-
--fs-control-overlay-border-radius: 0.
|
|
183
|
+
--fs-control-overlay-border-radius: 0.4375rem;
|
|
183
184
|
|
|
184
185
|
/* Durations */
|
|
185
186
|
--fs-fast-duration: 167ms;
|
|
@@ -232,6 +233,7 @@
|
|
|
232
233
|
|
|
233
234
|
/* Shadows */
|
|
234
235
|
--fs-shadow-card: 0 0.125rem 0.25rem #0000000a; /* 4% opacity */
|
|
236
|
+
--fs-shadow-card-hover: 0 0.125rem 0.25rem #0000001a; /* 10% opacity */
|
|
235
237
|
--fs-shadow-tooltip: 0 0.25rem 0.5rem #00000024; /* 14% opacity */
|
|
236
238
|
--fs-shadow-flyout: 0 0.5rem 1rem #00000024; /* 14% opacity */
|
|
237
239
|
--fs-shadow-dialog: 0 2rem 4rem #00000030, 0 1.125rem 1.313rem #00000026; /* 19% and 15% opacity respectively */
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,10 @@ export { default as Badge } from './components/badge/badge.svelte';
|
|
|
5
5
|
export { default as BadgeIcon } from './components/badge/badge-icon.svelte';
|
|
6
6
|
export { default as Button } from './components/button/button.svelte';
|
|
7
7
|
export { default as SplitButton } from './components/button/split-button.svelte';
|
|
8
|
+
export { default as Card } from './components/card/card.svelte';
|
|
9
|
+
export { default as CardHeader } from './components/card/card-header.svelte';
|
|
10
|
+
export { default as CardFooter } from './components/card/card-footer.svelte';
|
|
11
|
+
export { default as CardPreview } from './components/card/card-preview.svelte';
|
|
8
12
|
export { default as CalendarView } from './components/calendar-view/calendar-view.svelte';
|
|
9
13
|
export { default as CalendarViewHeader } from './components/calendar-view/calendar-view-header.svelte';
|
|
10
14
|
export { default as CalendarViewControls } from './components/calendar-view/calendar-view-controls.svelte';
|
package/dist/index.js
CHANGED
|
@@ -13,6 +13,12 @@ export { default as BadgeIcon } from './components/badge/badge-icon.svelte';
|
|
|
13
13
|
export { default as Button } from './components/button/button.svelte';
|
|
14
14
|
export { default as SplitButton } from './components/button/split-button.svelte';
|
|
15
15
|
// End Button Component
|
|
16
|
+
// Start Card Component
|
|
17
|
+
export { default as Card } from './components/card/card.svelte';
|
|
18
|
+
export { default as CardHeader } from './components/card/card-header.svelte';
|
|
19
|
+
export { default as CardFooter } from './components/card/card-footer.svelte';
|
|
20
|
+
export { default as CardPreview } from './components/card/card-preview.svelte';
|
|
21
|
+
// End Card Component
|
|
16
22
|
// Start CalendarView Component
|
|
17
23
|
export { default as CalendarView } from './components/calendar-view/calendar-view.svelte';
|
|
18
24
|
export { default as CalendarViewHeader } from './components/calendar-view/calendar-view-header.svelte';
|
|
@@ -1,29 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
<script lang="ts" generics="T extends Snippet<unknown[]> | Component<any>">
|
|
1
|
+
<script lang="ts" generics="Args extends Record<string, unknown>">
|
|
3
2
|
import type { Component, Snippet } from 'svelte';
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
let {
|
|
5
|
+
SoC,
|
|
6
|
+
args = {} as Args
|
|
7
|
+
}: {
|
|
8
|
+
/** A snippet or a component. Both receive `args`: the snippet as its single
|
|
9
|
+
* argument, the component as its props. */
|
|
10
|
+
SoC: Snippet<[Args]> | Component<Args>;
|
|
11
|
+
args?: Args;
|
|
12
|
+
} = $props();
|
|
7
13
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
type SOCProps<G> =
|
|
12
|
-
G extends Snippet<infer A> ? { SoC: T; args: A } : G extends Component<infer P> ? { SoC: T } & P : never;
|
|
13
|
-
|
|
14
|
-
let { SoC, args, ...props }: SOCProps<T> = $props();
|
|
14
|
+
// Snippets compile to ($$anchor, ...args) so they report length 1, components to
|
|
15
|
+
// ($$anchor, $$props) so they report 2. See https://github.com/sveltejs/svelte/issues/9774
|
|
16
|
+
const isSnippet = (value: Snippet<[Args]> | Component<Args>): value is Snippet<[Args]> => value.length === 1;
|
|
15
17
|
</script>
|
|
16
18
|
|
|
17
|
-
{#if SoC}
|
|
18
|
-
{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
{@render SoC(args)}
|
|
22
|
-
{:else}
|
|
23
|
-
{/* @ts-expect-error - [] is not assignable to never */ null}
|
|
24
|
-
{@render SoC()}
|
|
25
|
-
{/if}
|
|
26
|
-
{:else if isComponent(SoC)}
|
|
27
|
-
<SoC {...props} />
|
|
28
|
-
{/if}
|
|
19
|
+
{#if isSnippet(SoC)}
|
|
20
|
+
{@render SoC(args)}
|
|
21
|
+
{:else}
|
|
22
|
+
<SoC {...args} />
|
|
29
23
|
{/if}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import type { Component, Snippet } from 'svelte';
|
|
2
|
-
declare function $$render<
|
|
3
|
-
props:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
2
|
+
declare function $$render<Args extends Record<string, unknown>>(): {
|
|
3
|
+
props: {
|
|
4
|
+
/** A snippet or a component. Both receive `args`: the snippet as its single
|
|
5
|
+
* argument, the component as its props. */
|
|
6
|
+
SoC: Snippet<[Args]> | Component<Args>;
|
|
7
|
+
args?: Args;
|
|
8
|
+
};
|
|
9
9
|
exports: {};
|
|
10
10
|
bindings: "";
|
|
11
11
|
slots: {};
|
|
12
12
|
events: {};
|
|
13
13
|
};
|
|
14
|
-
declare class __sveltets_Render<
|
|
15
|
-
props(): ReturnType<typeof $$render<
|
|
16
|
-
events(): ReturnType<typeof $$render<
|
|
17
|
-
slots(): ReturnType<typeof $$render<
|
|
14
|
+
declare class __sveltets_Render<Args extends Record<string, unknown>> {
|
|
15
|
+
props(): ReturnType<typeof $$render<Args>>['props'];
|
|
16
|
+
events(): ReturnType<typeof $$render<Args>>['events'];
|
|
17
|
+
slots(): ReturnType<typeof $$render<Args>>['slots'];
|
|
18
18
|
bindings(): "";
|
|
19
19
|
exports(): {};
|
|
20
20
|
}
|
|
21
21
|
interface $$IsomorphicComponent {
|
|
22
|
-
new <
|
|
23
|
-
$$bindings?: ReturnType<__sveltets_Render<
|
|
24
|
-
} & ReturnType<__sveltets_Render<
|
|
25
|
-
<
|
|
22
|
+
new <Args extends Record<string, unknown>>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<Args>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<Args>['props']>, ReturnType<__sveltets_Render<Args>['events']>, ReturnType<__sveltets_Render<Args>['slots']>> & {
|
|
23
|
+
$$bindings?: ReturnType<__sveltets_Render<Args>['bindings']>;
|
|
24
|
+
} & ReturnType<__sveltets_Render<Args>['exports']>;
|
|
25
|
+
<Args extends Record<string, unknown>>(internal: unknown, props: ReturnType<__sveltets_Render<Args>['props']> & {}): ReturnType<__sveltets_Render<Args>['exports']>;
|
|
26
26
|
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
27
27
|
}
|
|
28
28
|
declare const RenderSoc: $$IsomorphicComponent;
|
|
29
|
-
type RenderSoc<
|
|
29
|
+
type RenderSoc<Args extends Record<string, unknown>> = InstanceType<typeof RenderSoc<Args>>;
|
|
30
30
|
export default RenderSoc;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export type BeforeOrAfter = 'before' | 'after';
|
|
|
20
20
|
export type ActiveOrInactive = 'active' | 'inactive';
|
|
21
21
|
export type Statuses = 'available' | 'busy' | 'offline' | 'away' | 'do-not-disturb' | 'out-of-office' | 'unknown' | 'blocked';
|
|
22
22
|
export type ProgressStatus = 'paused' | 'error';
|
|
23
|
+
export type Horientation = 'horizontal' | 'vertical';
|
|
23
24
|
export type YAxis = 'top' | 'bottom';
|
|
24
25
|
export type XAxis = 'left' | 'right';
|
|
25
26
|
export type YDirection = 'up' | 'middle' | 'down';
|