contain-css-svelte 1.1.20 → 1.2.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.
- package/dist/Card.svelte +15 -6
- package/dist/Card.svelte.d.ts +4 -5
- package/dist/controls/Button.svelte +19 -5
- package/dist/controls/Button.svelte.d.ts +4 -4
- package/dist/controls/ButtonLink.svelte +17 -14
- package/dist/controls/ButtonLink.svelte.d.ts +4 -4
- package/dist/controls/Checkbox.svelte +15 -8
- package/dist/controls/Checkbox.svelte.d.ts +4 -4
- package/dist/controls/CircleButton.svelte +67 -48
- package/dist/controls/CircleButton.svelte.d.ts +4 -4
- package/dist/controls/Input.svelte +14 -3
- package/dist/controls/Input.svelte.d.ts +4 -3
- package/dist/controls/Option.svelte +4 -3
- package/dist/controls/Option.svelte.d.ts +3 -2
- package/dist/controls/RadioButton.svelte +14 -7
- package/dist/controls/RadioButton.svelte.d.ts +4 -4
- package/dist/controls/Select.svelte +15 -3
- package/dist/controls/Select.svelte.d.ts +4 -3
- package/dist/controls/Slider.svelte +5 -11
- package/dist/controls/Slider.svelte.d.ts +3 -3
- package/dist/controls/TabItem.svelte +24 -5
- package/dist/controls/TabItem.svelte.d.ts +4 -4
- package/dist/controls/Toggle.svelte +21 -5
- package/dist/controls/Toggle.svelte.d.ts +4 -4
- package/dist/cssprops.js +1 -0
- package/dist/dropdowns/DropdownMenu.svelte +18 -6
- package/dist/dropdowns/DropdownMenu.svelte.d.ts +4 -4
- package/dist/layout/Accordion.svelte +17 -2
- package/dist/layout/Accordion.svelte.d.ts +5 -3
- package/dist/layout/Bar.svelte +13 -7
- package/dist/layout/Bar.svelte.d.ts +4 -4
- package/dist/layout/Column.svelte.d.ts +3 -3
- package/dist/layout/ColumnContainer.svelte +12 -9
- package/dist/layout/ColumnContainer.svelte.d.ts +4 -4
- package/dist/layout/Columns.svelte +4 -3
- package/dist/layout/Columns.svelte.d.ts +7 -3
- package/dist/layout/Container.svelte +23 -8
- package/dist/layout/Container.svelte.d.ts +7 -5
- package/dist/layout/DataList.svelte +15 -7
- package/dist/layout/DataList.svelte.d.ts +5 -4
- package/dist/layout/DataListItem.svelte +14 -8
- package/dist/layout/DataListItem.svelte.d.ts +4 -4
- package/dist/layout/Fieldset.svelte +16 -8
- package/dist/layout/Fieldset.svelte.d.ts +6 -3
- package/dist/layout/Form.svelte +17 -8
- package/dist/layout/Form.svelte.d.ts +8 -6
- package/dist/layout/FormItem.svelte +18 -9
- package/dist/layout/FormItem.svelte.d.ts +4 -3
- package/dist/layout/FormProvider.svelte +3 -0
- package/dist/layout/GridLayout.svelte +14 -9
- package/dist/layout/GridLayout.svelte.d.ts +4 -4
- package/dist/layout/GridRow.svelte +6 -10
- package/dist/layout/GridRow.svelte.d.ts +3 -2
- package/dist/layout/Hero.svelte +14 -8
- package/dist/layout/Hero.svelte.d.ts +4 -4
- package/dist/layout/Inline.svelte +16 -15
- package/dist/layout/Inline.svelte.d.ts +4 -4
- package/dist/layout/MenuList.svelte +13 -6
- package/dist/layout/MenuList.svelte.d.ts +4 -4
- package/dist/layout/Page.svelte +14 -8
- package/dist/layout/Page.svelte.d.ts +11 -3
- package/dist/layout/ResponsiveText.svelte +4 -0
- package/dist/layout/Row.svelte.d.ts +3 -3
- package/dist/layout/RowContainer.svelte +12 -9
- package/dist/layout/RowContainer.svelte.d.ts +4 -4
- package/dist/layout/Sidebar.svelte +41 -30
- package/dist/layout/Sidebar.svelte.d.ts +12 -4
- package/dist/layout/SplitPane.svelte +8 -14
- package/dist/layout/SplitPane.svelte.d.ts +16 -2
- package/dist/layout/Stack.svelte +16 -15
- package/dist/layout/Stack.svelte.d.ts +4 -4
- package/dist/layout/TabBar.svelte +12 -2
- package/dist/layout/TabBar.svelte.d.ts +17 -10
- package/dist/layout/Table.svelte +5 -1
- package/dist/layout/Tile.svelte +40 -27
- package/dist/layout/Tile.svelte.d.ts +32 -10
- package/dist/misc/Code.svelte +2 -0
- package/dist/misc/Progress.svelte +25 -8
- package/dist/misc/Progress.svelte.d.ts +15 -8
- package/dist/misc/Tag.svelte +97 -44
- package/dist/misc/Tag.svelte.d.ts +17 -5
- package/dist/overlays/Dialog.svelte +19 -6
- package/dist/overlays/Dialog.svelte.d.ts +5 -3
- package/dist/overlays/Tooltip.svelte +21 -3
- package/dist/overlays/Tooltip.svelte.d.ts +5 -3
- package/dist/styleProps.d.ts +67 -0
- package/dist/styleProps.js +76 -0
- package/dist/types.d.ts +40 -1
- package/dist/types.js +1 -1
- package/dist/typography/Text.svelte +4 -11
- package/dist/typography/TextLayout.svelte +4 -7
- package/dist/typography/TextLayout.svelte.d.ts +4 -3
- package/dist/util.d.ts +60 -3
- package/dist/util.js +101 -11
- package/dist/vars/soft-corners.css +1 -1
- package/dist/vars/themes/bootstrap.css +5 -5
- package/dist/vars/themes/material.css +5 -5
- package/dist/vars/themes/retro.css +5 -5
- package/package.json +1 -1
package/dist/Card.svelte
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
<script lang="ts">import { elementProps } from "./util";
|
|
2
|
+
import { COLOR_VARS, TYPOGRAPHY_CONTAINER_VARS, } from "./styleProps";
|
|
3
|
+
let { header, footer, children, height, fixedHeight, center, class: className, ...restProps } = $props();
|
|
4
|
+
/* `height` is destructured (the $effect below reads it), so it has to be
|
|
5
|
+
handed back explicitly -- rest props no longer carry it. */
|
|
6
|
+
/* The shorthands card's own CSS backs, one group per mixin it
|
|
7
|
+
includes. The Props type is derived from this same array, so what the
|
|
8
|
+
component accepts and what it emits cannot drift apart. */
|
|
9
|
+
const CARD_VARS = [
|
|
10
|
+
...COLOR_VARS,
|
|
11
|
+
...TYPOGRAPHY_CONTAINER_VARS,
|
|
12
|
+
];
|
|
13
|
+
const el = $derived(elementProps({ height, ...restProps }, "card", [
|
|
14
|
+
...CARD_VARS,
|
|
6
15
|
"padding",
|
|
7
16
|
"width",
|
|
8
17
|
"height",
|
|
@@ -19,7 +28,7 @@ let hasHeader = $derived(Boolean(header));
|
|
|
19
28
|
let hasFooter = $derived(Boolean(footer));
|
|
20
29
|
</script>
|
|
21
30
|
|
|
22
|
-
<div class="card" class:center class:fixedHeight
|
|
31
|
+
<div class={["card", className]} class:center class:fixedHeight {...el}>
|
|
23
32
|
<header class:hide={!hasHeader}>
|
|
24
33
|
{#if header}{@render header()}{/if}
|
|
25
34
|
</header>
|
package/dist/Card.svelte.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
2
|
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
-
import type { CardStyleProps } from "./types";
|
|
4
|
-
type
|
|
3
|
+
import type { CardStyleProps, ContainProps } from "./types";
|
|
4
|
+
import { type StyleProps } from "./styleProps";
|
|
5
|
+
declare const Card: import("svelte").Component<ContainProps<HTMLAttributes<HTMLElement>, {
|
|
5
6
|
header?: Snippet;
|
|
6
7
|
footer?: Snippet;
|
|
7
8
|
children?: Snippet;
|
|
8
9
|
center?: boolean;
|
|
9
|
-
height?: string;
|
|
10
10
|
fixedHeight?: boolean;
|
|
11
|
-
}
|
|
12
|
-
declare const Card: import("svelte").Component<Props, {}, "">;
|
|
11
|
+
}, CardStyleProps & StyleProps<readonly ["bg", "fg", "fontFamily", "fontSize", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "textTransform", "textDecoration", "fontVariant", "lineWidth"]>>, {}, "">;
|
|
13
12
|
type Card = ReturnType<typeof Card>;
|
|
14
13
|
export default Card;
|
|
@@ -1,10 +1,24 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
<script lang="ts">import { elementProps } from "../util";
|
|
2
|
+
import { COLOR_VARS, PADDING_VARS, RADIUS_VARS, TYPOGRAPHY_VARS, } from "../styleProps";
|
|
3
|
+
let { primary = false, secondary = false, warning = false, danger = false, success = false, info = false, icon, children, class: className, ...restProps } = $props();
|
|
4
|
+
/* The shorthands button's own CSS backs, one group per mixin it
|
|
5
|
+
includes. The Props type is derived from this same array, so what the
|
|
6
|
+
component accepts and what it emits cannot drift apart. */
|
|
7
|
+
const BUTTON_VARS = [
|
|
8
|
+
...COLOR_VARS,
|
|
9
|
+
...PADDING_VARS,
|
|
10
|
+
...RADIUS_VARS,
|
|
11
|
+
...TYPOGRAPHY_VARS,
|
|
12
|
+
];
|
|
13
|
+
const el = $derived(elementProps(restProps, "button", [
|
|
14
|
+
...BUTTON_VARS,
|
|
15
|
+
"width",
|
|
16
|
+
"height",
|
|
17
|
+
]));
|
|
4
18
|
</script>
|
|
5
19
|
|
|
6
20
|
<button
|
|
7
|
-
{
|
|
21
|
+
class={className}
|
|
8
22
|
class:primary
|
|
9
23
|
class:secondary
|
|
10
24
|
class:warning
|
|
@@ -12,7 +26,7 @@ const style = $derived(injectVars(restProps, "button", ["bg", "fg", "padding", "
|
|
|
12
26
|
class:success
|
|
13
27
|
class:info
|
|
14
28
|
class:has-icon={icon}
|
|
15
|
-
{...
|
|
29
|
+
{...el}
|
|
16
30
|
>
|
|
17
31
|
<span class="content">{@render children?.()}</span>
|
|
18
32
|
{#if icon}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
2
|
import type { HTMLButtonAttributes } from "svelte/elements";
|
|
3
|
-
import type { BaseStyleProps } from "../types";
|
|
4
|
-
type
|
|
3
|
+
import type { BaseStyleProps, ContainProps } from "../types";
|
|
4
|
+
import { type StyleProps } from "../styleProps";
|
|
5
|
+
declare const Button: import("svelte").Component<ContainProps<HTMLButtonAttributes, {
|
|
5
6
|
primary?: boolean;
|
|
6
7
|
secondary?: boolean;
|
|
7
8
|
warning?: boolean;
|
|
@@ -10,7 +11,6 @@ type Props = {
|
|
|
10
11
|
info?: boolean;
|
|
11
12
|
icon?: Snippet;
|
|
12
13
|
children?: Snippet;
|
|
13
|
-
}
|
|
14
|
-
declare const Button: import("svelte").Component<Props, {}, "">;
|
|
14
|
+
}, BaseStyleProps & StyleProps<readonly ["bg", "fg", "padding", "borderRadius", "fontFamily", "fontSize", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "textTransform", "textDecoration", "fontVariant"]>>, {}, "">;
|
|
15
15
|
type Button = ReturnType<typeof Button>;
|
|
16
16
|
export default Button;
|
|
@@ -1,25 +1,28 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
<script lang="ts">import { elementProps } from "../util";
|
|
2
|
+
import { COLOR_VARS, PADDING_VARS, RADIUS_VARS, TYPOGRAPHY_VARS, } from "../styleProps";
|
|
3
|
+
let { primary = false, secondary = false, warning = false, danger = false, success = false, info = false, href = "#", id = null, icon, children, class: className, ...restProps } = $props();
|
|
4
|
+
/* The shorthands button's own CSS backs, one group per mixin it
|
|
5
|
+
includes. The Props type is derived from this same array, so what the
|
|
6
|
+
component accepts and what it emits cannot drift apart. */
|
|
7
|
+
const BUTTON_LINK_VARS = [
|
|
8
|
+
...COLOR_VARS,
|
|
9
|
+
...PADDING_VARS,
|
|
10
|
+
...RADIUS_VARS,
|
|
11
|
+
...TYPOGRAPHY_VARS,
|
|
12
|
+
];
|
|
13
|
+
const el = $derived(elementProps(restProps, "button", [
|
|
14
|
+
...BUTTON_LINK_VARS,
|
|
12
15
|
"width",
|
|
13
16
|
"height",
|
|
14
|
-
])
|
|
17
|
+
]));
|
|
15
18
|
const iconSlotted = $derived(Boolean(icon));
|
|
16
19
|
</script>
|
|
17
20
|
|
|
18
21
|
<a
|
|
19
22
|
role="button"
|
|
20
|
-
{style}
|
|
21
23
|
{href}
|
|
22
24
|
id={id ?? undefined}
|
|
25
|
+
class={className}
|
|
23
26
|
class:primary
|
|
24
27
|
class:secondary
|
|
25
28
|
class:warning
|
|
@@ -27,7 +30,7 @@ const iconSlotted = $derived(Boolean(icon));
|
|
|
27
30
|
class:success
|
|
28
31
|
class:info
|
|
29
32
|
class:has-icon={iconSlotted}
|
|
30
|
-
{...
|
|
33
|
+
{...el}
|
|
31
34
|
>
|
|
32
35
|
<span class="content">{@render children?.()}</span>
|
|
33
36
|
<span class:hidden={!iconSlotted} class="icon">
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
2
|
import type { HTMLAnchorAttributes } from "svelte/elements";
|
|
3
|
-
import type { BaseStyleProps } from "../types";
|
|
4
|
-
type
|
|
3
|
+
import type { BaseStyleProps, ContainProps } from "../types";
|
|
4
|
+
import { type StyleProps } from "../styleProps";
|
|
5
|
+
declare const ButtonLink: import("svelte").Component<ContainProps<HTMLAnchorAttributes, {
|
|
5
6
|
primary?: boolean;
|
|
6
7
|
secondary?: boolean;
|
|
7
8
|
warning?: boolean;
|
|
@@ -12,7 +13,6 @@ type Props = {
|
|
|
12
13
|
id?: string | null;
|
|
13
14
|
icon?: Snippet;
|
|
14
15
|
children?: Snippet;
|
|
15
|
-
}
|
|
16
|
-
declare const ButtonLink: import("svelte").Component<Props, {}, "">;
|
|
16
|
+
}, BaseStyleProps & StyleProps<readonly ["bg", "fg", "padding", "borderRadius", "fontFamily", "fontSize", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "textTransform", "textDecoration", "fontVariant"]>>, {}, "">;
|
|
17
17
|
type ButtonLink = ReturnType<typeof ButtonLink>;
|
|
18
18
|
export default ButtonLink;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
<script lang="ts">import { splitProps } from "../util";
|
|
2
|
+
import { COLOR_VARS, TYPOGRAPHY_VARS, } from "../styleProps";
|
|
3
|
+
let { checked = $bindable(undefined), name = "", value = undefined, group = $bindable(undefined), children, class: className, ...restProps } = $props();
|
|
4
|
+
/* The shorthands checkbox's own CSS backs, one group per mixin it
|
|
5
|
+
includes. The Props type is derived from this same array, so what the
|
|
6
|
+
component accepts and what it emits cannot drift apart. */
|
|
7
|
+
const CHECKBOX_VARS = [
|
|
8
|
+
...COLOR_VARS,
|
|
9
|
+
...TYPOGRAPHY_VARS,
|
|
10
|
+
];
|
|
11
|
+
const el = $derived(splitProps(restProps, "checkbox", [
|
|
12
|
+
...CHECKBOX_VARS,
|
|
6
13
|
"padding",
|
|
7
14
|
"width",
|
|
8
15
|
"height",
|
|
@@ -29,7 +36,7 @@ function handleGroupChange(event) {
|
|
|
29
36
|
let ref = $state(null);
|
|
30
37
|
</script>
|
|
31
38
|
|
|
32
|
-
<div class="label-sizing-box" {style}>
|
|
39
|
+
<div class={["label-sizing-box", className]} style={el.style}>
|
|
33
40
|
<label class="checkbox-item">
|
|
34
41
|
{#if useGroup}
|
|
35
42
|
<input
|
|
@@ -38,14 +45,14 @@ let ref = $state(null);
|
|
|
38
45
|
{value}
|
|
39
46
|
checked={isChecked}
|
|
40
47
|
onchange={handleGroupChange}
|
|
41
|
-
{...
|
|
48
|
+
{...el.attrs}
|
|
42
49
|
/>
|
|
43
50
|
{:else}
|
|
44
51
|
<input
|
|
45
52
|
name={name || (ref && ref.textContent) || undefined}
|
|
46
53
|
type="checkbox"
|
|
47
54
|
bind:checked
|
|
48
|
-
{...
|
|
55
|
+
{...el.attrs}
|
|
49
56
|
/>
|
|
50
57
|
{/if}
|
|
51
58
|
<span bind:this={ref}>{@render children?.()}</span>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
2
|
import type { HTMLInputAttributes } from "svelte/elements";
|
|
3
|
-
import type { BaseStyleProps } from "../types";
|
|
4
|
-
type
|
|
3
|
+
import type { BaseStyleProps, ContainProps } from "../types";
|
|
4
|
+
import { type StyleProps } from "../styleProps";
|
|
5
|
+
declare const Checkbox: import("svelte").Component<ContainProps<HTMLInputAttributes, {
|
|
5
6
|
checked?: boolean | undefined;
|
|
6
7
|
name?: string;
|
|
7
8
|
value?: any;
|
|
8
9
|
group?: any[];
|
|
9
10
|
children?: Snippet;
|
|
10
|
-
}
|
|
11
|
-
declare const Checkbox: import("svelte").Component<Props, {}, "group" | "checked">;
|
|
11
|
+
}, BaseStyleProps & StyleProps<readonly ["bg", "fg", "fontFamily", "fontSize", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "textTransform", "textDecoration", "fontVariant"]>, "type" | "value">, {}, "checked" | "group">;
|
|
12
12
|
type Checkbox = ReturnType<typeof Checkbox>;
|
|
13
13
|
export default Checkbox;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
<script lang="ts">import { elementProps } from "../util";
|
|
2
|
+
import { COLOR_VARS, TYPOGRAPHY_VARS, } from "../styleProps";
|
|
3
|
+
let { primary = false, warning = false, danger = false, success = false, info = false, type = "button", children, class: className, ...restProps } = $props();
|
|
4
|
+
/* The shorthands circle-button's own CSS backs, one group per mixin it
|
|
5
|
+
includes. The Props type is derived from this same array, so what the
|
|
6
|
+
component accepts and what it emits cannot drift apart. */
|
|
7
|
+
const CIRCLE_BUTTON_VARS = [
|
|
8
|
+
...COLOR_VARS,
|
|
9
|
+
...TYPOGRAPHY_VARS,
|
|
10
|
+
];
|
|
11
|
+
const el = $derived(elementProps(restProps, "circle-button", [
|
|
12
|
+
...CIRCLE_BUTTON_VARS,
|
|
6
13
|
"padding",
|
|
7
14
|
"width",
|
|
8
15
|
"height",
|
|
@@ -10,14 +17,14 @@ const style = $derived(injectVars(restProps, "mini-button", [
|
|
|
10
17
|
</script>
|
|
11
18
|
|
|
12
19
|
<button
|
|
13
|
-
{style}
|
|
14
20
|
{type}
|
|
21
|
+
class={className}
|
|
15
22
|
class:primary
|
|
16
23
|
class:warning
|
|
17
24
|
class:danger
|
|
18
25
|
class:success
|
|
19
26
|
class:info
|
|
20
|
-
{...
|
|
27
|
+
{...el}
|
|
21
28
|
>
|
|
22
29
|
{@render children?.()}
|
|
23
30
|
</button>
|
|
@@ -125,31 +132,37 @@ button.primary {
|
|
|
125
132
|
}
|
|
126
133
|
|
|
127
134
|
button {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
135
|
+
/* `circle-button` first, `mini-button` behind it. This component was
|
|
136
|
+
called MiniButton until it was renamed to stop people putting text in a
|
|
137
|
+
circle; its variables kept the old prefix. Every include and every
|
|
138
|
+
var() below names both, so `--circle-button-bg` is the name to reach
|
|
139
|
+
for while an existing `--mini-button-bg` -- in a theme, or in an app
|
|
140
|
+
that set one years ago -- keeps working untouched. */
|
|
141
|
+
font-family: var(--circle-button-font-family, var(--mini-button-font-family, var(--button-font-family, var(--ui-font-family, var(--control-font-family, var(--font-family, unset))))));
|
|
142
|
+
text-transform: var(--circle-button-text-transform, var(--mini-button-text-transform, var(--button-text-transform, var(--ui-text-transform, var(--control-text-transform, var(--text-transform, unset))))));
|
|
143
|
+
text-decoration: var(--circle-button-text-decoration, var(--mini-button-text-decoration, var(--button-text-decoration, var(--ui-text-decoration, var(--control-text-decoration, var(--text-decoration, unset))))));
|
|
144
|
+
--_font-size: var(--circle-button-font-size, var(--mini-button-font-size, var(--button-font-size, var(--ui-font-size, var(--control-font-size, var(--font-size, unset))))));
|
|
132
145
|
font-size: var(--_font-size);
|
|
133
|
-
font-weight: var(--mini-button-font-weight, var(--button-font-weight, var(--ui-font-weight, var(--control-font-weight, var(--font-weight, unset)))));
|
|
134
|
-
line-height: var(--mini-button-line-height, var(--button-line-height, var(--ui-line-height, var(--control-line-height, var(--line-height, unset)))));
|
|
135
|
-
letter-spacing: var(--mini-button-letter-spacing, var(--button-letter-spacing, var(--ui-letter-spacing, var(--control-letter-spacing, var(--letter-spacing, unset)))));
|
|
136
|
-
--_margin-top: var(--mini-button-margin, var(--button-margin, var(--ui-margin, var(--control-margin, var(--margin, unset)))));
|
|
137
|
-
--_margin-top: var(--mini-button-margin-top, var(--button-margin-top, var(--ui-margin-top, var(--control-margin-top, var(--margin-top, unset)))));
|
|
146
|
+
font-weight: var(--circle-button-font-weight, var(--mini-button-font-weight, var(--button-font-weight, var(--ui-font-weight, var(--control-font-weight, var(--font-weight, unset))))));
|
|
147
|
+
line-height: var(--circle-button-line-height, var(--mini-button-line-height, var(--button-line-height, var(--ui-line-height, var(--control-line-height, var(--line-height, unset))))));
|
|
148
|
+
letter-spacing: var(--circle-button-letter-spacing, var(--mini-button-letter-spacing, var(--button-letter-spacing, var(--ui-letter-spacing, var(--control-letter-spacing, var(--letter-spacing, unset))))));
|
|
149
|
+
--_margin-top: var(--circle-button-margin, var(--mini-button-margin, var(--button-margin, var(--ui-margin, var(--control-margin, var(--margin, unset))))));
|
|
150
|
+
--_margin-top: var(--circle-button-margin-top, var(--mini-button-margin-top, var(--button-margin-top, var(--ui-margin-top, var(--control-margin-top, var(--margin-top, unset))))));
|
|
138
151
|
margin-top: var(--_margin-top);
|
|
139
|
-
--_margin-bottom: var(--mini-button-margin, var(--button-margin, var(--ui-margin, var(--control-margin, var(--margin, unset)))));
|
|
140
|
-
--_margin-bottom: var(--mini-button-margin-bottom, var(--button-margin-bottom, var(--ui-margin-bottom, var(--control-margin-bottom, var(--margin-bottom, unset)))));
|
|
152
|
+
--_margin-bottom: var(--circle-button-margin, var(--mini-button-margin, var(--button-margin, var(--ui-margin, var(--control-margin, var(--margin, unset))))));
|
|
153
|
+
--_margin-bottom: var(--circle-button-margin-bottom, var(--mini-button-margin-bottom, var(--button-margin-bottom, var(--ui-margin-bottom, var(--control-margin-bottom, var(--margin-bottom, unset))))));
|
|
141
154
|
margin-bottom: var(--_margin-bottom);
|
|
142
|
-
text-indent: var(--mini-button-indent, var(--button-indent, var(--ui-indent, var(--control-indent, var(--indent, unset)))));
|
|
143
|
-
font-variant: var(--mini-button-font-variant, var(--button-font-variant, var(--ui-font-variant, var(--control-font-variant, var(--font-variant, unset)))));
|
|
144
|
-
text-align: var(--mini-button-text-align, var(--button-text-align, var(--ui-text-align, var(--control-text-align, var(--text-align, unset)))));
|
|
145
|
-
--link-bg: var(--mini-button-link-bg, var(--button-link-bg, var(--control-link-bg, var(--secondary-link-bg, inherit))));
|
|
146
|
-
--link-fg: var(--mini-button-link-fg, var(--button-link-fg, var(--control-link-fg, var(--secondary-link-fg, inherit))));
|
|
147
|
-
--_bg-mix-color: var(--mini-button-bg-mix-color, var(--button-bg-mix-color, var(--control-bg-mix-color, var(--secondary-bg-mix-color, var(--bg-mix-color, transparent)))));
|
|
148
|
-
--_bg-mix-amount: var(--mini-button-bg-mix-amount, var(--button-bg-mix-amount, var(--control-bg-mix-amount, var(--secondary-bg-mix-amount, var(--bg-mix-amount, 0%)))));
|
|
149
|
-
--_fg-mix-color: var(--mini-button-fg-mix-color, var(--button-fg-mix-color, var(--control-fg-mix-color, var(--secondary-fg-mix-color, var(--fg-mix-color, transparent)))));
|
|
150
|
-
--_fg-mix-amount: var(--mini-button-fg-mix-amount, var(--button-fg-mix-amount, var(--control-fg-mix-amount, var(--secondary-fg-mix-amount, var(--fg-mix-amount, 0%)))));
|
|
151
|
-
--_bg-base: var(--mini-button-bg, var(--button-bg, var(--control-bg, var(--secondary-bg, var(--bg, unset)))));
|
|
152
|
-
--_fg-base: var(--mini-button-fg, var(--button-fg, var(--control-fg, var(--secondary-fg, var(--fg, unset)))));
|
|
155
|
+
text-indent: var(--circle-button-indent, var(--mini-button-indent, var(--button-indent, var(--ui-indent, var(--control-indent, var(--indent, unset))))));
|
|
156
|
+
font-variant: var(--circle-button-font-variant, var(--mini-button-font-variant, var(--button-font-variant, var(--ui-font-variant, var(--control-font-variant, var(--font-variant, unset))))));
|
|
157
|
+
text-align: var(--circle-button-text-align, var(--mini-button-text-align, var(--button-text-align, var(--ui-text-align, var(--control-text-align, var(--text-align, unset))))));
|
|
158
|
+
--link-bg: var(--circle-button-link-bg, var(--mini-button-link-bg, var(--button-link-bg, var(--control-link-bg, var(--secondary-link-bg, inherit)))));
|
|
159
|
+
--link-fg: var(--circle-button-link-fg, var(--mini-button-link-fg, var(--button-link-fg, var(--control-link-fg, var(--secondary-link-fg, inherit)))));
|
|
160
|
+
--_bg-mix-color: var(--circle-button-bg-mix-color, var(--mini-button-bg-mix-color, var(--button-bg-mix-color, var(--control-bg-mix-color, var(--secondary-bg-mix-color, var(--bg-mix-color, transparent))))));
|
|
161
|
+
--_bg-mix-amount: var(--circle-button-bg-mix-amount, var(--mini-button-bg-mix-amount, var(--button-bg-mix-amount, var(--control-bg-mix-amount, var(--secondary-bg-mix-amount, var(--bg-mix-amount, 0%))))));
|
|
162
|
+
--_fg-mix-color: var(--circle-button-fg-mix-color, var(--mini-button-fg-mix-color, var(--button-fg-mix-color, var(--control-fg-mix-color, var(--secondary-fg-mix-color, var(--fg-mix-color, transparent))))));
|
|
163
|
+
--_fg-mix-amount: var(--circle-button-fg-mix-amount, var(--mini-button-fg-mix-amount, var(--button-fg-mix-amount, var(--control-fg-mix-amount, var(--secondary-fg-mix-amount, var(--fg-mix-amount, 0%))))));
|
|
164
|
+
--_bg-base: var(--circle-button-bg, var(--mini-button-bg, var(--button-bg, var(--control-bg, var(--secondary-bg, var(--bg, unset))))));
|
|
165
|
+
--_fg-base: var(--circle-button-fg, var(--mini-button-fg, var(--button-fg, var(--control-fg, var(--secondary-fg, var(--fg, unset))))));
|
|
153
166
|
--_background-color: color-mix(
|
|
154
167
|
in srgb,
|
|
155
168
|
var(--_bg-base),
|
|
@@ -226,35 +239,35 @@ button {
|
|
|
226
239
|
);
|
|
227
240
|
background-color: var(--_background-color);
|
|
228
241
|
color: var(--_color);
|
|
229
|
-
cursor: var(--mini-button-cursor, var(--button-cursor, var(--clickable-cursor, var(--cursor, pointer))));
|
|
230
|
-
transition: filter var(--mini-button-transition, var(--button-transition, var(--clickable-transition, var(--transition, 300ms)))), background-color var(--mini-button-transition, var(--button-transition, var(--clickable-transition, var(--transition, 300ms)))), border-color var(--mini-button-transition, var(--button-transition, var(--clickable-transition, var(--transition, 300ms)))), box-shadow var(--mini-button-transition, var(--button-transition, var(--clickable-transition, var(--transition, 300ms)))), transform var(--mini-button-transition, var(--button-transition, var(--clickable-transition, var(--transition, 300ms))));
|
|
242
|
+
cursor: var(--circle-button-cursor, var(--mini-button-cursor, var(--button-cursor, var(--clickable-cursor, var(--cursor, pointer)))));
|
|
243
|
+
transition: filter var(--circle-button-transition, var(--mini-button-transition, var(--button-transition, var(--clickable-transition, var(--transition, 300ms))))), background-color var(--circle-button-transition, var(--mini-button-transition, var(--button-transition, var(--clickable-transition, var(--transition, 300ms))))), border-color var(--circle-button-transition, var(--mini-button-transition, var(--button-transition, var(--clickable-transition, var(--transition, 300ms))))), box-shadow var(--circle-button-transition, var(--mini-button-transition, var(--button-transition, var(--clickable-transition, var(--transition, 300ms))))), transform var(--circle-button-transition, var(--mini-button-transition, var(--button-transition, var(--clickable-transition, var(--transition, 300ms)))));
|
|
231
244
|
}
|
|
232
245
|
|
|
233
246
|
button:hover {
|
|
234
|
-
filter: var(--mini-button-hover-filter, var(--button-hover-filter, var(--clickable-hover-filter, var(--hover-filter, brightness(1.05)))));
|
|
235
|
-
transform: var(--mini-button-hover-transform, var(--button-hover-transform, var(--clickable-hover-transform, var(--hover-transform, none))));
|
|
247
|
+
filter: var(--circle-button-hover-filter, var(--mini-button-hover-filter, var(--button-hover-filter, var(--clickable-hover-filter, var(--hover-filter, brightness(1.05))))));
|
|
248
|
+
transform: var(--circle-button-hover-transform, var(--mini-button-hover-transform, var(--button-hover-transform, var(--clickable-hover-transform, var(--hover-transform, none)))));
|
|
236
249
|
background-color: color-mix(in oklch, var(--_background-color) var(--hover-base-color-percentage, 90%), var(--hover-color-mix, white) calc(100% - var(--hover-base-color-percentage, 90%)));
|
|
237
|
-
box-shadow: var(--mini-button-hover-box-shadow, var(--button-hover-box-shadow, var(--clickable-hover-box-shadow, var(--hover-box-shadow, var(--_box-shadow, none)))));
|
|
250
|
+
box-shadow: var(--circle-button-hover-box-shadow, var(--mini-button-hover-box-shadow, var(--button-hover-box-shadow, var(--clickable-hover-box-shadow, var(--hover-box-shadow, var(--_box-shadow, none))))));
|
|
238
251
|
}
|
|
239
252
|
|
|
240
253
|
button:active {
|
|
241
|
-
filter: var(--mini-button-active-filter, var(--button-active-filter, var(--clickable-active-filter, var(--active-filter, brightness(0.9)))));
|
|
242
|
-
transform: var(--mini-button-active-transform, var(--button-active-transform, var(--clickable-active-transform, var(--active-transform, none))));
|
|
254
|
+
filter: var(--circle-button-active-filter, var(--mini-button-active-filter, var(--button-active-filter, var(--clickable-active-filter, var(--active-filter, brightness(0.9))))));
|
|
255
|
+
transform: var(--circle-button-active-transform, var(--mini-button-active-transform, var(--button-active-transform, var(--clickable-active-transform, var(--active-transform, none)))));
|
|
243
256
|
background-color: color-mix(in oklch, var(--_background-color) var(--active-base-color-percentage, 90%), var(--active-color-mix, black) calc(100% - var(--active-base-color-percentage, 90%)));
|
|
244
|
-
box-shadow: var(--mini-button-active-box-shadow, var(--button-active-box-shadow, var(--clickable-active-box-shadow, var(--active-box-shadow, var(--_box-shadow, none)))));
|
|
257
|
+
box-shadow: var(--circle-button-active-box-shadow, var(--mini-button-active-box-shadow, var(--button-active-box-shadow, var(--clickable-active-box-shadow, var(--active-box-shadow, var(--_box-shadow, none))))));
|
|
245
258
|
}
|
|
246
259
|
|
|
247
260
|
button:disabled {
|
|
248
|
-
cursor: var(--mini-button-disabled-cursor, var(--button-disabled-cursor, var(--clickable-disabled-cursor, var(--disabled-cursor, not-allowed))));
|
|
249
|
-
transform: var(--mini-button-disabled-transform, var(--button-disabled-transform, var(--clickable-disabled-transform, var(--disabled-transform, none))));
|
|
250
|
-
filter: var(--mini-button-disabled-filter, var(--button-disabled-filter, var(--clickable-disabled-filter, var(--disabled-filter, grayscale(0.5)))));
|
|
261
|
+
cursor: var(--circle-button-disabled-cursor, var(--mini-button-disabled-cursor, var(--button-disabled-cursor, var(--clickable-disabled-cursor, var(--disabled-cursor, not-allowed)))));
|
|
262
|
+
transform: var(--circle-button-disabled-transform, var(--mini-button-disabled-transform, var(--button-disabled-transform, var(--clickable-disabled-transform, var(--disabled-transform, none)))));
|
|
263
|
+
filter: var(--circle-button-disabled-filter, var(--mini-button-disabled-filter, var(--button-disabled-filter, var(--clickable-disabled-filter, var(--disabled-filter, grayscale(0.5))))));
|
|
251
264
|
background-color: color-mix(in oklch, var(--_background-color) var(--disabled-base-color-percentage, 50%), var(--disabled-color-mix, gray) calc(100% - var(--disabled-base-color-percentage, 50%)));
|
|
252
|
-
box-shadow: var(--mini-button-disabled-box-shadow, var(--button-disabled-box-shadow, var(--clickable-disabled-box-shadow, var(--disabled-box-shadow, var(--_box-shadow, none)))));
|
|
265
|
+
box-shadow: var(--circle-button-disabled-box-shadow, var(--mini-button-disabled-box-shadow, var(--button-disabled-box-shadow, var(--clickable-disabled-box-shadow, var(--disabled-box-shadow, var(--_box-shadow, none))))));
|
|
253
266
|
}
|
|
254
267
|
|
|
255
268
|
button {
|
|
256
269
|
--_box-shadow:
|
|
257
|
-
var(--mini-button-shadow-distance, var(--button-shadow-distance, var(--control-shadow-distance, var(--shadow-distance, var(--space))))) var(--mini-button-shadow-distance, var(--button-shadow-distance, var(--control-shadow-distance, var(--shadow-distance, var(--space))))) var(--mini-button-shadow-blur, var(--button-shadow-blur, var(--control-shadow-blur, var(--shadow-blur, var(--space))))) var(--mini-button-shadow-color, var(--button-shadow-color, var(--control-shadow-color, var(--shadow-color, rgba(127, 127, 127, 0.4)))));
|
|
270
|
+
var(--circle-button-shadow-distance, var(--mini-button-shadow-distance, var(--button-shadow-distance, var(--control-shadow-distance, var(--shadow-distance, var(--space)))))) var(--circle-button-shadow-distance, var(--mini-button-shadow-distance, var(--button-shadow-distance, var(--control-shadow-distance, var(--shadow-distance, var(--space)))))) var(--circle-button-shadow-blur, var(--mini-button-shadow-blur, var(--button-shadow-blur, var(--control-shadow-blur, var(--shadow-blur, var(--space)))))) var(--circle-button-shadow-color, var(--mini-button-shadow-color, var(--button-shadow-color, var(--control-shadow-color, var(--shadow-color, rgba(127, 127, 127, 0.4))))));
|
|
258
271
|
box-shadow: var(--_box-shadow);
|
|
259
272
|
}
|
|
260
273
|
|
|
@@ -266,13 +279,19 @@ button:focus-visible {
|
|
|
266
279
|
|
|
267
280
|
button {
|
|
268
281
|
margin: var(--button-margin, var(--control-margin, var(--margin, var(--space))));
|
|
269
|
-
width: var(--mini-button-size, var(--icon-size, 1em));
|
|
270
|
-
height: var(--mini-button-size, var(--icon-size, 1em));
|
|
282
|
+
width: var(--circle-button-size, var(--mini-button-size, var(--icon-size, 1em)));
|
|
283
|
+
height: var(--circle-button-size, var(--mini-button-size, var(--icon-size, 1em)));
|
|
271
284
|
/* Make sure we don't shrink in a flex container */
|
|
272
|
-
min-width: var(--mini-button-size, var(--icon-size, 1em));
|
|
273
|
-
min-height: var(--mini-button-size, var(--icon-size, 1em));
|
|
274
|
-
border-radius: var(--mini-button-radius, 50%);
|
|
275
|
-
|
|
285
|
+
min-width: var(--circle-button-size, var(--mini-button-size, var(--icon-size, 1em)));
|
|
286
|
+
min-height: var(--circle-button-size, var(--mini-button-size, var(--icon-size, 1em)));
|
|
287
|
+
border-radius: var(--circle-button-radius, var(--mini-button-radius, 50%));
|
|
288
|
+
/* var-with-fallbacks, not var: this was
|
|
289
|
+
`var(--mini-button-border, button-border, none)`, which reads as
|
|
290
|
+
`--mini-button-border` with the fallback "button-border, none". That is
|
|
291
|
+
not a valid border, so `--button-border` was never consulted and an
|
|
292
|
+
unset chain produced `none` only by accident (invalid at
|
|
293
|
+
computed-value time -> the initial `medium none`). */
|
|
294
|
+
border: var(--circle-button-border, var(--mini-button-border, var(--button-border, var(--border, none))));
|
|
276
295
|
display: inline-grid;
|
|
277
296
|
place-content: center;
|
|
278
297
|
line-height: 1;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { HTMLButtonAttributes } from "svelte/elements";
|
|
2
|
-
import type { BaseStyleProps } from "../types";
|
|
3
|
-
type
|
|
2
|
+
import type { BaseStyleProps, ContainProps } from "../types";
|
|
3
|
+
import { type StyleProps } from "../styleProps";
|
|
4
|
+
declare const CircleButton: import("svelte").Component<ContainProps<HTMLButtonAttributes, {
|
|
4
5
|
primary?: boolean;
|
|
5
6
|
warning?: boolean;
|
|
6
7
|
danger?: boolean;
|
|
@@ -8,7 +9,6 @@ type Props = {
|
|
|
8
9
|
info?: boolean;
|
|
9
10
|
type?: "button" | "submit" | "reset";
|
|
10
11
|
children?: import("svelte").Snippet;
|
|
11
|
-
}
|
|
12
|
-
declare const CircleButton: import("svelte").Component<Props, {}, "">;
|
|
12
|
+
}, BaseStyleProps & StyleProps<readonly ["bg", "fg", "fontFamily", "fontSize", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "textTransform", "textDecoration", "fontVariant"]>>, {}, "">;
|
|
13
13
|
type CircleButton = ReturnType<typeof CircleButton>;
|
|
14
14
|
export default CircleButton;
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
1
|
+
<script lang="ts">import { elementProps } from "../util";
|
|
2
|
+
import { COLOR_VARS, PADDING_VARS, RADIUS_VARS, TYPOGRAPHY_VARS, } from "../styleProps";
|
|
3
|
+
let { value = $bindable(""), placeholder = "", class: className, ...restProps } = $props();
|
|
4
|
+
/* The shorthands this component's own CSS backs, one group per mixin
|
|
5
|
+
it includes. The Props type is derived from this same array, so what
|
|
6
|
+
the component accepts and what it emits cannot drift apart. */
|
|
7
|
+
const INPUT_VARS = [
|
|
8
|
+
...COLOR_VARS,
|
|
9
|
+
...PADDING_VARS,
|
|
10
|
+
...RADIUS_VARS,
|
|
11
|
+
...TYPOGRAPHY_VARS,
|
|
12
|
+
];
|
|
13
|
+
const el = $derived(elementProps(restProps, "input", INPUT_VARS));
|
|
3
14
|
</script>
|
|
4
15
|
|
|
5
|
-
<input bind:value {placeholder} {...
|
|
16
|
+
<input bind:value {placeholder} class={className} {...el} />
|
|
6
17
|
|
|
7
18
|
<style>/* Logical, not top/bottom/left/right: margin-block/margin-inline already take
|
|
8
19
|
one value (both sides equal) or two (start end), so there is no separate
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { HTMLInputAttributes } from "svelte/elements";
|
|
2
|
-
type
|
|
2
|
+
import type { ContainProps } from "../types";
|
|
3
|
+
import { type StyleProps } from "../styleProps";
|
|
4
|
+
declare const Input: import("svelte").Component<ContainProps<HTMLInputAttributes, {
|
|
3
5
|
value?: string | number;
|
|
4
6
|
placeholder?: string;
|
|
5
|
-
}
|
|
6
|
-
declare const Input: import("svelte").Component<Props, {}, "value">;
|
|
7
|
+
}, StyleProps<readonly ["bg", "fg", "padding", "borderRadius", "fontFamily", "fontSize", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "textTransform", "textDecoration", "fontVariant"]>>, {}, "value">;
|
|
7
8
|
type Input = ReturnType<typeof Input>;
|
|
8
9
|
export default Input;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
<script lang="ts">
|
|
1
|
+
<script lang="ts">import { elementProps } from "../util";
|
|
2
|
+
let { children, value, class: className, ...restProps } = $props();
|
|
3
|
+
const el = $derived(elementProps(restProps, "option"));
|
|
2
4
|
let template = $state();
|
|
3
5
|
// Extracted from the rendered children, in the DOM.
|
|
4
6
|
let textContent = $state("");
|
|
@@ -31,10 +33,9 @@ $effect(() => {
|
|
|
31
33
|
});
|
|
32
34
|
return () => observer.disconnect();
|
|
33
35
|
});
|
|
34
|
-
export {};
|
|
35
36
|
</script>
|
|
36
37
|
|
|
37
|
-
<option data-html={htmlContent} {value} {...
|
|
38
|
+
<option data-html={htmlContent} {value} class={className} {...el}>
|
|
38
39
|
{@html textContent}
|
|
39
40
|
</option>
|
|
40
41
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { HTMLOptionAttributes } from "svelte/elements";
|
|
2
|
-
type
|
|
2
|
+
import type { ContainProps } from "../types";
|
|
3
|
+
type Props = ContainProps<HTMLOptionAttributes, {
|
|
3
4
|
children?: import("svelte").Snippet;
|
|
4
5
|
value?: any;
|
|
5
|
-
}
|
|
6
|
+
}, {}, "value">;
|
|
6
7
|
declare const Option: import("svelte").Component<Props, {}, "">;
|
|
7
8
|
type Option = ReturnType<typeof Option>;
|
|
8
9
|
export default Option;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
2
|
-
|
|
3
|
-
let
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
<script lang="ts">import { splitProps } from "../util";
|
|
2
|
+
import { COLOR_VARS, TYPOGRAPHY_VARS, } from "../styleProps";
|
|
3
|
+
let { group = $bindable(undefined), value = undefined, children, class: className, ...restProps } = $props();
|
|
4
|
+
/* The shorthands radio-button's own CSS backs, one group per mixin it
|
|
5
|
+
includes. The Props type is derived from this same array, so what the
|
|
6
|
+
component accepts and what it emits cannot drift apart. */
|
|
7
|
+
const RADIO_BUTTON_VARS = [
|
|
8
|
+
...COLOR_VARS,
|
|
9
|
+
...TYPOGRAPHY_VARS,
|
|
10
|
+
];
|
|
11
|
+
const el = $derived(splitProps(restProps, "radio-button", [
|
|
12
|
+
...RADIO_BUTTON_VARS,
|
|
6
13
|
"padding",
|
|
7
14
|
"width",
|
|
8
15
|
"height",
|
|
@@ -15,14 +22,14 @@ function handleChange() {
|
|
|
15
22
|
}
|
|
16
23
|
</script>
|
|
17
24
|
|
|
18
|
-
<div class="label-sizing-box" {style}>
|
|
25
|
+
<div class={["label-sizing-box", className]} style={el.style}>
|
|
19
26
|
<label class="radio-item">
|
|
20
27
|
<input
|
|
21
28
|
{value}
|
|
22
29
|
type="radio"
|
|
23
30
|
checked={isChecked}
|
|
24
31
|
onchange={handleChange}
|
|
25
|
-
{...
|
|
32
|
+
{...el.attrs}
|
|
26
33
|
/>
|
|
27
34
|
<span>{@render children?.()}</span>
|
|
28
35
|
</label>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
2
|
import type { HTMLInputAttributes } from "svelte/elements";
|
|
3
|
-
import type { BaseStyleProps } from "../types";
|
|
4
|
-
type
|
|
3
|
+
import type { BaseStyleProps, ContainProps } from "../types";
|
|
4
|
+
import { type StyleProps } from "../styleProps";
|
|
5
|
+
declare const RadioButton: import("svelte").Component<ContainProps<HTMLInputAttributes, {
|
|
5
6
|
group?: any;
|
|
6
7
|
value?: any;
|
|
7
8
|
children?: Snippet;
|
|
8
|
-
}
|
|
9
|
-
declare const RadioButton: import("svelte").Component<Props, {}, "group">;
|
|
9
|
+
}, BaseStyleProps & StyleProps<readonly ["bg", "fg", "fontFamily", "fontSize", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "textTransform", "textDecoration", "fontVariant"]>, "type" | "value">, {}, "group">;
|
|
10
10
|
type RadioButton = ReturnType<typeof RadioButton>;
|
|
11
11
|
export default RadioButton;
|
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
<script lang="ts">import
|
|
1
|
+
<script lang="ts">import { elementProps } from "../util";
|
|
2
|
+
import { COLOR_VARS, PADDING_VARS, RADIUS_VARS, TYPOGRAPHY_VARS, } from "../styleProps";
|
|
3
|
+
import DropdownMenu from "../dropdowns/DropdownMenu.svelte";
|
|
2
4
|
import { onMount, tick } from "svelte";
|
|
3
|
-
let { value = $bindable(), children, "data-audit-action": dropdownAuditAction = null, matchMode = "prefix", typeaheadMode = "focus", ...restProps } = $props();
|
|
5
|
+
let { value = $bindable(), children, "data-audit-action": dropdownAuditAction = null, matchMode = "prefix", typeaheadMode = "focus", class: className, ...restProps } = $props();
|
|
6
|
+
/* The shorthands this component's own CSS backs, one group per mixin
|
|
7
|
+
it includes. The Props type is derived from this same array, so what
|
|
8
|
+
the component accepts and what it emits cannot drift apart. */
|
|
9
|
+
const SELECT_VARS = [
|
|
10
|
+
...COLOR_VARS,
|
|
11
|
+
...PADDING_VARS,
|
|
12
|
+
...RADIUS_VARS,
|
|
13
|
+
...TYPOGRAPHY_VARS,
|
|
14
|
+
];
|
|
15
|
+
const el = $derived(elementProps(restProps, "select", SELECT_VARS));
|
|
4
16
|
let selectElement = $state();
|
|
5
17
|
let observer;
|
|
6
18
|
let resizeObserver;
|
|
@@ -91,7 +103,7 @@ $effect(() => {
|
|
|
91
103
|
});
|
|
92
104
|
</script>
|
|
93
105
|
|
|
94
|
-
<select bind:value bind:this={selectElement} {...
|
|
106
|
+
<select bind:value bind:this={selectElement} class={className} {...el}>
|
|
95
107
|
{@render children?.()}
|
|
96
108
|
</select>
|
|
97
109
|
<div class="dropdown-wrapper" style:--target-width={targetWidth}>
|