@danielito1996/compose-svelted 0.2.7 → 0.2.8-alpha01

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +196 -113
  2. package/dist/components/AppRoot.svelte +26 -14
  3. package/dist/components/Surface.svelte +29 -19
  4. package/dist/components/Text.svelte +37 -23
  5. package/dist/components/buttons/Button.svelte +66 -34
  6. package/dist/components/buttons/CheckButton.svelte +2 -2
  7. package/dist/components/layouts/Alignment.d.ts +40 -18
  8. package/dist/components/layouts/Alignment.js +40 -18
  9. package/dist/components/layouts/Arrangement.d.ts +27 -11
  10. package/dist/components/layouts/Arrangement.js +34 -41
  11. package/dist/components/layouts/Box.svelte +54 -25
  12. package/dist/components/layouts/Box.svelte.d.ts +8 -1
  13. package/dist/components/layouts/Column.svelte +52 -23
  14. package/dist/components/layouts/Column.svelte.d.ts +10 -2
  15. package/dist/components/layouts/LayoutContext.d.ts +1 -0
  16. package/dist/components/layouts/LayoutContext.js +1 -0
  17. package/dist/components/layouts/LazyColumn.svelte +12 -12
  18. package/dist/components/layouts/LazyRow.svelte +81 -45
  19. package/dist/components/layouts/LazyRow.svelte.d.ts +3 -6
  20. package/dist/components/layouts/Row.svelte +52 -23
  21. package/dist/components/layouts/Row.svelte.d.ts +10 -2
  22. package/dist/components/layouts/Scaffold.svelte +86 -73
  23. package/dist/components/layouts/Scaffold.svelte.d.ts +5 -1
  24. package/dist/components/layouts/resolveAlignment.d.ts +25 -0
  25. package/dist/components/layouts/resolveAlignment.js +48 -0
  26. package/dist/components/layouts/resolveFlexAlignSelf.d.ts +6 -0
  27. package/dist/components/layouts/resolveFlexAlignSelf.js +8 -0
  28. package/dist/components/motion/motion/AnimatedContent.svelte +41 -0
  29. package/dist/components/motion/{AnimatedContent.svelte.d.ts → motion/AnimatedContent.svelte.d.ts} +1 -1
  30. package/dist/components/motion/{AnimatedVisibility.svelte → motion/AnimatedVisibility.svelte} +3 -3
  31. package/dist/components/motion/{AnimatedVisibility.svelte.d.ts → motion/AnimatedVisibility.svelte.d.ts} +1 -1
  32. package/dist/components/motion/motion/AnimationSpec.d.ts +6 -0
  33. package/dist/components/motion/motion/AnimationSpec.js +1 -0
  34. package/dist/components/motion/motion/ContentTransition.d.ts +5 -0
  35. package/dist/components/motion/motion/ContentTransition.js +1 -0
  36. package/dist/components/motion/motion/applyAnimation.d.ts +0 -0
  37. package/dist/components/motion/motion/applyAnimation.js +0 -0
  38. package/dist/components/motion/motion/contentTransitions.d.ts +4 -0
  39. package/dist/components/motion/motion/contentTransitions.js +22 -0
  40. package/dist/components/motion/motion/transitions.d.ts +7 -0
  41. package/dist/components/motion/motion/transitions.js +70 -0
  42. package/dist/components/textFields/BaseTextField.svelte +4 -3
  43. package/dist/components/textFields/BaseTextField.svelte.d.ts +1 -0
  44. package/dist/components/textFields/OutlinedTextField.svelte +8 -7
  45. package/dist/components/textFields/TextField.svelte +8 -8
  46. package/dist/core/modifier/Modifier.d.ts +11 -171
  47. package/dist/core/modifier/Modifier.js +8 -170
  48. package/dist/core/modifier/ModifierImpl.d.ts +29 -17
  49. package/dist/core/modifier/ModifierImpl.js +112 -151
  50. package/dist/core/motion/AnimationSpec.d.ts +1 -6
  51. package/dist/core/motion/ContentTransition.d.ts +1 -5
  52. package/dist/core/motion/applyAnimation.d.ts +2 -0
  53. package/dist/core/motion/applyAnimation.js +3 -0
  54. package/dist/core/motion/contentTransitions.d.ts +1 -4
  55. package/dist/core/motion/contentTransitions.js +1 -22
  56. package/dist/core/motion/transitions.d.ts +1 -7
  57. package/dist/core/motion/transitions.js +1 -70
  58. package/dist/core/navigation/NavHost.svelte +46 -45
  59. package/dist/core/styles/baseline-safe.css +34 -0
  60. package/dist/core/styles/baseline.css +45 -0
  61. package/dist/core/theme/ColorScheme.d.ts +2 -0
  62. package/dist/core/theme/ColorScheme.js +2 -0
  63. package/dist/core/theme/ComposeTheme.svelte +36 -21
  64. package/dist/core/theme/colors.d.ts +2 -0
  65. package/dist/core/theme/defaults/darkColors.js +2 -0
  66. package/dist/core/theme/defaults/lightColors.js +2 -0
  67. package/dist/index.d.ts +48 -129
  68. package/dist/index.js +7 -2
  69. package/package.json +73 -58
  70. package/dist/components/motion/AnimatedContent.svelte +0 -34
@@ -1,23 +1,52 @@
1
- <script lang="ts">
2
- import { Modifier } from "../../core/modifier/Modifier";
3
- import { Alignment } from "./Alignment";
4
- import { Arrangement } from "./Arrangement";
5
- import type { ArrangementValue } from "./Arrangement";
6
- import type { VerticalAlignment } from "./Alignment";
7
-
8
- export let modifier: Modifier = Modifier.empty();
9
- export let verticalAlignment: VerticalAlignment = Alignment.Top;
10
- export let horizontalArrangement: ArrangementValue = Arrangement.Start;
11
- </script>
12
-
13
- <div
14
- class="flex flex-row"
15
- style={`
16
- align-items: ${verticalAlignment};
17
- justify-content: ${horizontalArrangement.justifyContent};
18
- ${horizontalArrangement.type === "spaced" ? `gap:${horizontalArrangement.gap}px;` : ""}
19
- ${modifier.toStyle()}
20
- `}
21
- >
22
- <slot />
23
- </div>
1
+ <script lang="ts">
2
+ import { Modifier } from "../../core/modifier/Modifier";
3
+ import { Alignment } from "./Alignment";
4
+ import { Arrangement } from "./Arrangement";
5
+ import type { ArrangementValue } from "./Arrangement";
6
+ import type { VerticalAlignment } from "./Alignment";
7
+
8
+ export let modifier: Modifier = Modifier.empty();
9
+
10
+ /**
11
+ * Alineación en el eje cross (vertical) de todos los hijos.
12
+ * Equivalente a verticalAlignment en Jetpack Compose Row.
13
+ * @default Alignment.Top
14
+ */
15
+ export let verticalAlignment: VerticalAlignment = Alignment.Top;
16
+
17
+ /**
18
+ * Disposición en el eje main (horizontal).
19
+ * Equivalente a horizontalArrangement en Jetpack Compose Row.
20
+ * @default Arrangement.Start
21
+ */
22
+ export let horizontalArrangement: ArrangementValue = Arrangement.Start;
23
+
24
+ $: gapStyle = horizontalArrangement.type === 'spaced'
25
+ ? `gap:${horizontalArrangement.gap}px;`
26
+ : '';
27
+ </script>
28
+
29
+ <!--
30
+ Row — contenedor flex horizontal.
31
+
32
+ • align-items controla la alineación vertical de los hijos (cross-axis)
33
+ • justify-content controla la distribución horizontal (main-axis)
34
+ • Los hijos pueden sobreescribir su alineación individual via
35
+ Modifier.align() que inyecta align-self en su propio estilo
36
+
37
+ No hay wrapper interno: cada hijo gestiona su propio layout.
38
+ El scroll no está habilitado por defecto — usar Modifier.horizontalScroll()
39
+ o LazyRow para contenido que desborda.
40
+ -->
41
+ <div
42
+ style={`
43
+ display: flex;
44
+ flex-direction: row;
45
+ align-items: ${verticalAlignment.cssValue};
46
+ justify-content: ${horizontalArrangement.justifyContent};
47
+ ${gapStyle}
48
+ ${modifier.toStyle()}
49
+ `}
50
+ >
51
+ <slot />
52
+ </div>
@@ -21,8 +21,16 @@ type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
21
21
  } : {});
22
22
  declare const Row: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
23
23
  modifier?: Modifier;
24
- verticalAlignment?: VerticalAlignment;
25
- horizontalArrangement?: ArrangementValue;
24
+ /**
25
+ * Alineación en el eje cross (vertical) de todos los hijos.
26
+ * Equivalente a verticalAlignment en Jetpack Compose Row.
27
+ * @default Alignment.Top
28
+ */ verticalAlignment?: VerticalAlignment;
29
+ /**
30
+ * Disposición en el eje main (horizontal).
31
+ * Equivalente a horizontalArrangement en Jetpack Compose Row.
32
+ * @default Arrangement.Start
33
+ */ horizontalArrangement?: ArrangementValue;
26
34
  }, {
27
35
  default: {};
28
36
  }>, {
@@ -1,73 +1,86 @@
1
- <script lang="ts">
2
- import { Modifier } from "../../core/modifier/Modifier";
3
-
4
- export let modifier: Modifier = Modifier.empty();
5
-
6
- // Padding interno aplicado al content (como Scaffold paddingValues)
7
- export let contentPadding: number = 16;
8
-
9
- // Control del FAB
10
- export let fabAlignment:
11
- | "bottom-end"
12
- | "bottom-center"
13
- | "bottom-start" = "bottom-end";
14
- </script>
15
-
16
- <div
17
- style={`
18
- display: flex;
19
- flex-direction: column;
20
- height: 100%;
21
- width: 100%;
22
- position: relative;
23
- ${modifier.toStyle()}
24
- `}
25
- >
26
- <!-- Top Bar -->
27
- <div>
28
- <slot name="topBar" />
29
- </div>
30
-
31
- <!-- Content -->
32
- <div
33
- style={`
34
- flex: 1;
35
- position: relative;
36
- padding: ${contentPadding}px;
37
- overflow: auto;
38
- `}
39
- >
40
- <slot />
41
- </div>
42
-
43
- <!-- Bottom Bar -->
44
- <div>
45
- <slot name="bottomBar" />
46
- </div>
47
-
48
- <!-- Floating Action Button -->
49
- <div
50
- style={`
51
- position: absolute;
52
- pointer-events: none;
53
- inset: 0;
54
- `}
55
- >
56
- <div
57
- style={`
58
- position: absolute;
59
- pointer-events: auto;
60
-
61
- ${
62
- fabAlignment === "bottom-end"
63
- ? "right: 16px; bottom: 16px;"
64
- : fabAlignment === "bottom-center"
65
- ? "left: 50%; transform: translateX(-50%); bottom: 16px;"
66
- : "left: 16px; bottom: 16px;"
67
- }
68
- `}
69
- >
70
- <slot name="floatingActionButton" />
71
- </div>
72
- </div>
73
- </div>
1
+ <script lang="ts">
2
+ import { Modifier } from "../../core/modifier/Modifier";
3
+ import { resolveBoxPlaceSelf } from "./resolveAlignment";
4
+ import { Alignment } from "./Alignment";
5
+ import type { BoxAlignment } from "./Alignment";
6
+
7
+ export let modifier: Modifier = Modifier.empty();
8
+ export let contentPadding = 16;
9
+
10
+ /**
11
+ * Posición del FloatingActionButton dentro del Scaffold.
12
+ * @default Alignment.BottomEnd
13
+ */
14
+ export let fabAlignment: BoxAlignment = Alignment.BottomEnd;
15
+
16
+ $: fabPlaceSelf = resolveBoxPlaceSelf(fabAlignment);
17
+ </script>
18
+
19
+ <!--
20
+ Scaffold — estructura base de pantalla.
21
+
22
+ Slots:
23
+ topBar → barra superior (TopAppBar)
24
+ default → contenido principal (ahora es un flex container para permitir fillMaxSize)
25
+ bottomBar → barra inferior (NavigationBar)
26
+ floatingActionButton FAB posicionado por fabAlignment
27
+ -->
28
+ <div
29
+ class="cs-relative"
30
+ style={`
31
+ display: flex;
32
+ flex-direction: column;
33
+ width: 100%;
34
+ height: 100%;
35
+ overflow: hidden;
36
+ ${modifier.toStyle()}
37
+ `}
38
+ >
39
+ <!-- Top bar -->
40
+ <slot name="topBar" />
41
+
42
+ <!-- Content — ocupa el espacio restante -->
43
+ <!--
44
+ Se añade display: flex para que los hijos que usen fillMaxSize()
45
+ puedan expandirse correctamente basándose en el tamaño de este contenedor.
46
+ -->
47
+ <div
48
+ style={`
49
+ flex: 1;
50
+ display: flex;
51
+ flex-direction: column;
52
+ min-height: 0;
53
+ padding: ${contentPadding}px;
54
+ overflow: hidden;
55
+ `}
56
+ >
57
+ <slot />
58
+ </div>
59
+
60
+ <!-- Bottom bar -->
61
+ <slot name="bottomBar" />
62
+
63
+ <!-- FAB overlay -->
64
+ <div
65
+ style="
66
+ position: absolute;
67
+ inset: 0;
68
+ pointer-events: none;
69
+ display: grid;
70
+ grid-template-areas: 'fab';
71
+ "
72
+ >
73
+ <div
74
+ style={`
75
+ grid-area: fab;
76
+ ${fabPlaceSelf}
77
+ pointer-events: auto;
78
+ margin: 16px;
79
+ width: fit-content;
80
+ height: fit-content;
81
+ `}
82
+ >
83
+ <slot name="floatingActionButton" />
84
+ </div>
85
+ </div>
86
+ </div>
@@ -1,4 +1,5 @@
1
1
  import { Modifier } from "../../core/modifier/Modifier";
2
+ import type { BoxAlignment } from "./Alignment";
2
3
  interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
4
  new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
5
  $$bindings?: Bindings;
@@ -20,7 +21,10 @@ type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
20
21
  declare const Scaffold: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
21
22
  modifier?: Modifier;
22
23
  contentPadding?: number;
23
- fabAlignment?: "bottom-end" | "bottom-center" | "bottom-start";
24
+ /**
25
+ * Posición del FloatingActionButton dentro del Scaffold.
26
+ * @default Alignment.BottomEnd
27
+ */ fabAlignment?: BoxAlignment;
24
28
  }, {
25
29
  topBar: {};
26
30
  default: {};
@@ -0,0 +1,25 @@
1
+ /**
2
+ * resolveAlignment.ts
3
+ *
4
+ * Funciones puras que traducen los tokens de Alignment a CSS inline.
5
+ * Trabajan con el nuevo shape de BoxAlignment (objeto con .horizontal / .vertical).
6
+ */
7
+ import type { BoxAlignment, HorizontalAlignment, VerticalAlignment } from './Alignment';
8
+ /**
9
+ * Resuelve el `place-items` de un Box stack container.
10
+ * CSS Grid: "align-items justify-items"
11
+ */
12
+ export declare function resolveBoxPlaceItems(alignment: BoxAlignment): string;
13
+ /**
14
+ * Resuelve el `place-self` de un hijo de Box que sobreescribe su alineación.
15
+ * Usado por Modifier.align() dentro de un Box.
16
+ */
17
+ export declare function resolveBoxPlaceSelf(alignment: BoxAlignment): string;
18
+ /**
19
+ * Resuelve `align-self` para un hijo de Column (eje horizontal).
20
+ */
21
+ export declare function resolveColumnAlignSelf(alignment: HorizontalAlignment): string;
22
+ /**
23
+ * Resuelve `align-self` para un hijo de Row (eje vertical).
24
+ */
25
+ export declare function resolveRowAlignSelf(alignment: VerticalAlignment): string;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * resolveAlignment.ts
3
+ *
4
+ * Funciones puras que traducen los tokens de Alignment a CSS inline.
5
+ * Trabajan con el nuevo shape de BoxAlignment (objeto con .horizontal / .vertical).
6
+ */
7
+ // ─── Box (CSS Grid stacking) ──────────────────────────────────────────────────
8
+ /**
9
+ * Resuelve el `place-items` de un Box stack container.
10
+ * CSS Grid: "align-items justify-items"
11
+ */
12
+ export function resolveBoxPlaceItems(alignment) {
13
+ // grid place-items = "<vertical> <horizontal>"
14
+ var v = resolveCssAlign(alignment.vertical);
15
+ var h = resolveCssAlign(alignment.horizontal);
16
+ return "".concat(v, " ").concat(h);
17
+ }
18
+ /**
19
+ * Resuelve el `place-self` de un hijo de Box que sobreescribe su alineación.
20
+ * Usado por Modifier.align() dentro de un Box.
21
+ */
22
+ export function resolveBoxPlaceSelf(alignment) {
23
+ var v = resolveCssAlign(alignment.vertical);
24
+ var h = resolveCssAlign(alignment.horizontal);
25
+ return "place-self:".concat(v, " ").concat(h, ";");
26
+ }
27
+ // ─── Flex (Column / Row cross-axis align-self) ────────────────────────────────
28
+ /**
29
+ * Resuelve `align-self` para un hijo de Column (eje horizontal).
30
+ */
31
+ export function resolveColumnAlignSelf(alignment) {
32
+ return "align-self:".concat(alignment.cssValue, ";");
33
+ }
34
+ /**
35
+ * Resuelve `align-self` para un hijo de Row (eje vertical).
36
+ */
37
+ export function resolveRowAlignSelf(alignment) {
38
+ return "align-self:".concat(alignment.cssValue, ";");
39
+ }
40
+ // ─── Internos ─────────────────────────────────────────────────────────────────
41
+ /** Normaliza los valores CSS de flex a los equivalentes de grid */
42
+ function resolveCssAlign(value) {
43
+ switch (value) {
44
+ case 'flex-start': return 'start';
45
+ case 'flex-end': return 'end';
46
+ default: return 'center';
47
+ }
48
+ }
@@ -0,0 +1,6 @@
1
+ import type { BoxAlignment } from './Alignment';
2
+ /**
3
+ * @deprecated Usar resolveBoxPlaceSelf desde resolveAlignment.ts
4
+ * Mantenido por compatibilidad interna durante la transición.
5
+ */
6
+ export declare function resolveFlexAlignSelf(alignment: BoxAlignment): string;
@@ -0,0 +1,8 @@
1
+ import { resolveBoxPlaceSelf } from './resolveAlignment';
2
+ /**
3
+ * @deprecated Usar resolveBoxPlaceSelf desde resolveAlignment.ts
4
+ * Mantenido por compatibilidad interna durante la transición.
5
+ */
6
+ export function resolveFlexAlignSelf(alignment) {
7
+ return resolveBoxPlaceSelf(alignment);
8
+ }
@@ -0,0 +1,41 @@
1
+ <script lang="ts">
2
+ import type { ContentTransition } from "../../../core/motion/ContentTransition";
3
+ import { fade } from "../../../core/motion/contentTransitions";
4
+
5
+ export let targetState: any;
6
+ export let transition: ContentTransition = fade();
7
+
8
+ let currentKey = targetState;
9
+ let exiting = false;
10
+ let timeoutId: ReturnType<typeof setTimeout> | null = null;
11
+
12
+ $: if (targetState !== currentKey) {
13
+ exiting = true;
14
+ if (timeoutId) clearTimeout(timeoutId);
15
+ timeoutId = setTimeout(() => {
16
+ currentKey = targetState;
17
+ exiting = false;
18
+ timeoutId = null;
19
+ }, transition.duration);
20
+ }
21
+ </script>
22
+
23
+ <!--
24
+ Contenedor de transición — ocupa todo el espacio del padre.
25
+ Se añade display:flex y flex-direction:column para asegurar que los hijos
26
+ con height:100% o flex:1 se expandan correctamente.
27
+ -->
28
+ <div style="position:relative;width:100%;height:100%;overflow:hidden;display:flex;flex-direction:column;">
29
+ <div
30
+ style={`
31
+ width: 100%;
32
+ height: 100%;
33
+ display: flex;
34
+ flex-direction: column;
35
+ transition: opacity ${transition.duration}ms ease, transform ${transition.duration}ms ease;
36
+ ${exiting ? transition.exit : transition.enter}
37
+ `}
38
+ >
39
+ <slot />
40
+ </div>
41
+ </div>
@@ -1,4 +1,4 @@
1
- import type { ContentTransition } from "../../core/motion/ContentTransition";
1
+ import type { ContentTransition } from "../../../core/motion/ContentTransition";
2
2
  interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
3
  new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
4
  $$bindings?: Bindings;
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
- import type { AnimationSpec } from "../../core/motion/AnimationSpec";
3
- import { fadeIn, fadeOut } from "../../core/motion/transitions";
2
+ import type { AnimationSpec } from "../../../core/motion/AnimationSpec";
3
+ import { fadeIn, fadeOut } from "../../../core/motion/transitions";
4
4
 
5
5
  export let visible: boolean;
6
6
 
@@ -56,4 +56,4 @@
56
56
  <div class={classes}>
57
57
  <slot />
58
58
  </div>
59
- {/if}
59
+ {/if}
@@ -1,4 +1,4 @@
1
- import type { AnimationSpec } from "../../core/motion/AnimationSpec";
1
+ import type { AnimationSpec } from "../../../core/motion/AnimationSpec";
2
2
  interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
3
  new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
4
  $$bindings?: Bindings;
@@ -0,0 +1,6 @@
1
+ export type AnimationSpec = {
2
+ base: string;
3
+ from: string;
4
+ to: string;
5
+ duration: number;
6
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export type ContentTransition = {
2
+ enter: string;
3
+ exit: string;
4
+ duration: number;
5
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { ContentTransition } from "./ContentTransition";
2
+ export declare function slideHorizontal(): ContentTransition;
3
+ export declare function scaleFade(): ContentTransition;
4
+ export declare function fade(duration?: number): ContentTransition;
@@ -0,0 +1,22 @@
1
+ export function slideHorizontal() {
2
+ return {
3
+ enter: "transform: translateX(0); opacity: 1;",
4
+ exit: "transform: translateX(-100%); opacity: 0;",
5
+ duration: 300
6
+ };
7
+ }
8
+ export function scaleFade() {
9
+ return {
10
+ enter: "transform: scale(1); opacity: 1;",
11
+ exit: "transform: scale(0.95); opacity: 0;",
12
+ duration: 220
13
+ };
14
+ }
15
+ export function fade(duration) {
16
+ if (duration === void 0) { duration = 300; }
17
+ return {
18
+ enter: "opacity: 1;",
19
+ exit: "opacity: 0;",
20
+ duration: duration
21
+ };
22
+ }
@@ -0,0 +1,7 @@
1
+ import type { AnimationSpec } from "./AnimationSpec";
2
+ export declare function fadeIn(duration?: number): AnimationSpec;
3
+ export declare function fadeOut(duration?: number): AnimationSpec;
4
+ export declare function scaleIn(duration?: number): AnimationSpec;
5
+ export declare function scaleOut(duration?: number): AnimationSpec;
6
+ export declare function slideIn(duration?: number, direction?: "left" | "right" | "up" | "down"): AnimationSpec;
7
+ export declare function slideOut(duration?: number, direction?: "left" | "right" | "up" | "down"): AnimationSpec;
@@ -0,0 +1,70 @@
1
+ var defaultEnter = 280;
2
+ var defaultExit = 220;
3
+ export function fadeIn(duration) {
4
+ if (duration === void 0) { duration = defaultEnter; }
5
+ return {
6
+ base: "transition-opacity duration-[".concat(duration, "ms] ease-out"),
7
+ from: "opacity-0",
8
+ to: "opacity-100",
9
+ duration: duration
10
+ };
11
+ }
12
+ export function fadeOut(duration) {
13
+ if (duration === void 0) { duration = defaultExit; }
14
+ return {
15
+ base: "transition-opacity duration-[".concat(duration, "ms] ease-in"),
16
+ from: "opacity-100",
17
+ to: "opacity-0",
18
+ duration: duration
19
+ };
20
+ }
21
+ export function scaleIn(duration) {
22
+ if (duration === void 0) { duration = defaultEnter; }
23
+ return {
24
+ base: "transition-all duration-[".concat(duration, "ms] ease-out"),
25
+ from: "opacity-0 scale-95",
26
+ to: "opacity-100 scale-100",
27
+ duration: duration
28
+ };
29
+ }
30
+ export function scaleOut(duration) {
31
+ if (duration === void 0) { duration = defaultExit; }
32
+ return {
33
+ base: "transition-all duration-[".concat(duration, "ms] ease-in"),
34
+ from: "opacity-100 scale-100",
35
+ to: "opacity-0 scale-95",
36
+ duration: duration
37
+ };
38
+ }
39
+ export function slideIn(duration, direction) {
40
+ if (duration === void 0) { duration = defaultEnter; }
41
+ if (direction === void 0) { direction = "right"; }
42
+ var fromMap = {
43
+ left: "-translate-x-4",
44
+ right: "translate-x-4",
45
+ up: "-translate-y-4",
46
+ down: "translate-y-4"
47
+ };
48
+ return {
49
+ base: "transition-all duration-[".concat(duration, "ms] ease-out"),
50
+ from: "opacity-0 ".concat(fromMap[direction]),
51
+ to: "opacity-100 translate-x-0 translate-y-0",
52
+ duration: duration
53
+ };
54
+ }
55
+ export function slideOut(duration, direction) {
56
+ if (duration === void 0) { duration = defaultExit; }
57
+ if (direction === void 0) { direction = "right"; }
58
+ var toMap = {
59
+ left: "-translate-x-4",
60
+ right: "translate-x-4",
61
+ up: "-translate-y-4",
62
+ down: "translate-y-4"
63
+ };
64
+ return {
65
+ base: "transition-all duration-[".concat(duration, "ms] ease-in"),
66
+ from: "opacity-100 translate-x-0 translate-y-0",
67
+ to: "opacity-0 ".concat(toMap[direction]),
68
+ duration: duration
69
+ };
70
+ }
@@ -13,7 +13,8 @@
13
13
  export let onValueChange = (_value: string) => {};
14
14
  export let label = "";
15
15
  export let placeholder = "";
16
- export let supportingText: string | undefined;
16
+ export let supportingText: string | undefined;
17
+ export let floatingLabelScale = 0.72;
17
18
 
18
19
  export let singleLine = true;
19
20
  export let textStyle: TextStyleToken = "bodyLarge";
@@ -111,7 +112,7 @@
111
112
  top:${floating ? "2px" : "50%"};
112
113
  transform:
113
114
  translateY(${floating ? "0" : "-50%"})
114
- scale(${floating ? 0.72 : 1});
115
+ scale(${floating ? floatingLabelScale : 1});
115
116
  color:${labelColor};
116
117
  `}
117
118
  >
@@ -185,4 +186,4 @@
185
186
  {supportingText}
186
187
  </div>
187
188
  {/if}
188
- </div>
189
+ </div>
@@ -22,6 +22,7 @@ declare const BaseTextField: $$__sveltets_2_IsomorphicComponent<{
22
22
  label?: string;
23
23
  placeholder?: string;
24
24
  supportingText: string | undefined;
25
+ floatingLabelScale?: number;
25
26
  singleLine?: boolean;
26
27
  textStyle?: TextStyleToken;
27
28
  modifier?: Modifier;
@@ -40,12 +40,13 @@
40
40
  ${modifier.toStyle()}
41
41
  `}
42
42
  >
43
- <BaseTextField
44
- value={value}
45
- supportingText={supportingText}
46
- density={density}
47
- readOnly={readOnly}
48
- enabled={enabled}
43
+ <BaseTextField
44
+ value={value}
45
+ supportingText={supportingText}
46
+ floatingLabelScale={floatingLabelScale}
47
+ density={density}
48
+ readOnly={readOnly}
49
+ enabled={enabled}
49
50
  isError={isError}
50
51
  onValueChange={onValueChange}
51
52
  label={label}
@@ -61,4 +62,4 @@
61
62
  <slot name="leadingIcon" slot="leadingIcon" />
62
63
  <slot name="trailingIcon" slot="trailingIcon" />
63
64
  </BaseTextField>
64
- </div>
65
+ </div>