@intechstudio/grid-uikit 1.20260912.1104 → 1.20260916.1250

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.
@@ -0,0 +1,160 @@
1
+ <script lang="ts">
2
+ import SvgIcon from "./SvgIcon.svelte";
3
+ import { tooltip } from "./tooltip";
4
+ import { createEventDispatcher } from "svelte";
5
+
6
+ const dispatch = createEventDispatcher();
7
+
8
+ export let iconPath: string = "";
9
+ export let iconData: string | undefined = undefined;
10
+ export let disabled: boolean = false;
11
+ export let compact: boolean = false;
12
+ export let tooltipText: string | undefined = undefined;
13
+ export let onClick: (() => void) | undefined = undefined;
14
+ export let onMouseDown: ((e: MouseEvent) => void) | undefined = undefined;
15
+ export let id: string | undefined = undefined;
16
+ export let ariaLabel: string | undefined = undefined;
17
+ export let stopPropagation: boolean = false;
18
+ export let href: string | undefined = undefined;
19
+ export let target: string | undefined = undefined;
20
+ export let rel: string | undefined = undefined;
21
+ export let tooltipDelay: number | undefined = undefined;
22
+ export let tooltipDuration: number | undefined = undefined;
23
+
24
+ // `pressed` shows the squish instantly (no transition) for as long as the
25
+ // button is physically held down. `clicking` takes over on release to ease
26
+ // it back out over the full duration, even if the press was very brief -
27
+ // its 0% keyframe matches `.pressed` exactly so the swap is invisible.
28
+ let pressed = false;
29
+ let clicking = false;
30
+
31
+ function restartClickAnimation() {
32
+ if (clicking) {
33
+ // Already mid-animation (rapid repeated clicks): force a restart by
34
+ // clearing the class and re-adding it next frame.
35
+ clicking = false;
36
+ requestAnimationFrame(() => (clicking = true));
37
+ } else {
38
+ clicking = true;
39
+ }
40
+ }
41
+
42
+ function handleMouseDown(e: MouseEvent) {
43
+ pressed = true;
44
+ clicking = false;
45
+ onMouseDown?.(e);
46
+ }
47
+
48
+ function handleMouseUp() {
49
+ if (pressed) {
50
+ pressed = false;
51
+ restartClickAnimation();
52
+ }
53
+ }
54
+
55
+ function handleMouseLeaveInternal(e: MouseEvent) {
56
+ // Dragging off the button while held cancels the press without playing
57
+ // the release animation.
58
+ pressed = false;
59
+ dispatch("mouseleave", e);
60
+ }
61
+
62
+ function handleClick(e: MouseEvent) {
63
+ if (stopPropagation) e.stopPropagation();
64
+ if (e.detail === 0) {
65
+ // Keyboard/programmatic activation: no mousedown/mouseup pair fired.
66
+ restartClickAnimation();
67
+ }
68
+ dispatch("click");
69
+ onClick?.();
70
+ }
71
+ </script>
72
+
73
+ <svelte:element
74
+ this={href ? "a" : "button"}
75
+ {id}
76
+ {href}
77
+ target={href ? target : undefined}
78
+ rel={href ? rel : undefined}
79
+ aria-label={ariaLabel}
80
+ on:click={handleClick}
81
+ on:mousedown={handleMouseDown}
82
+ on:mouseup={handleMouseUp}
83
+ on:mouseenter
84
+ on:mouseleave={handleMouseLeaveInternal}
85
+ on:animationend={() => (clicking = false)}
86
+ disabled={href ? undefined : disabled}
87
+ use:tooltip={tooltipText
88
+ ? { text: tooltipText, delay: tooltipDelay, duration: tooltipDuration }
89
+ : undefined}
90
+ class="icon-button"
91
+ class:compact
92
+ >
93
+ <div class="icon-button-inner" class:pressed class:clicking>
94
+ <SvgIcon {iconPath} {iconData} fill="var(--foreground)" />
95
+ </div>
96
+ </svelte:element>
97
+
98
+ <style>
99
+ .icon-button {
100
+ display: flex;
101
+ align-items: center;
102
+ justify-content: center;
103
+ border-radius: var(--radius);
104
+ cursor: pointer;
105
+ pointer-events: auto;
106
+ padding: 0.5rem;
107
+ border: none;
108
+ background-color: transparent;
109
+ color: inherit;
110
+ text-decoration: none;
111
+ }
112
+
113
+ .icon-button.compact {
114
+ padding: 0.375rem;
115
+ }
116
+
117
+ .icon-button:hover {
118
+ background-color: var(--background-muted);
119
+ }
120
+
121
+ .icon-button:focus {
122
+ outline: var(--focus-outline);
123
+ outline-offset: var(--focus-offset);
124
+ }
125
+
126
+ .icon-button:disabled {
127
+ opacity: 0.3;
128
+ cursor: default;
129
+ }
130
+
131
+ .icon-button:disabled:hover {
132
+ background-color: transparent;
133
+ }
134
+
135
+ .icon-button-inner {
136
+ display: flex;
137
+ align-items: center;
138
+ justify-content: center;
139
+ }
140
+
141
+ .icon-button-inner.pressed {
142
+ transform: scale(0.8);
143
+ opacity: 0.5;
144
+ }
145
+
146
+ .icon-button-inner.clicking {
147
+ animation: click-squish 250ms ease-out;
148
+ }
149
+
150
+ @keyframes click-squish {
151
+ 0% {
152
+ transform: scale(0.8);
153
+ opacity: 0.5;
154
+ }
155
+ 100% {
156
+ transform: scale(1);
157
+ opacity: 1;
158
+ }
159
+ }
160
+ </style>
@@ -0,0 +1,38 @@
1
+ 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> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: Props & {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const IconButton: $$__sveltets_2_IsomorphicComponent<{
15
+ iconPath?: string;
16
+ iconData?: string | undefined;
17
+ disabled?: boolean;
18
+ compact?: boolean;
19
+ tooltipText?: string | undefined;
20
+ onClick?: (() => void) | undefined;
21
+ onMouseDown?: ((e: MouseEvent) => void) | undefined;
22
+ id?: string | undefined;
23
+ ariaLabel?: string | undefined;
24
+ stopPropagation?: boolean;
25
+ href?: string | undefined;
26
+ target?: string | undefined;
27
+ rel?: string | undefined;
28
+ tooltipDelay?: number | undefined;
29
+ tooltipDuration?: number | undefined;
30
+ }, {
31
+ mouseenter: MouseEvent;
32
+ mouseleave: CustomEvent<any>;
33
+ click: CustomEvent<any>;
34
+ } & {
35
+ [evt: string]: CustomEvent<any>;
36
+ }, {}, {}, string>;
37
+ type IconButton = InstanceType<typeof IconButton>;
38
+ export default IconButton;
@@ -0,0 +1,18 @@
1
+ <svg
2
+ fill="none"
3
+ xmlns="http://www.w3.org/2000/svg"
4
+ viewBox="2 2.5 21.5 19"
5
+ ><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g
6
+ id="SVGRepo_tracerCarrier"
7
+ stroke-linecap="round"
8
+ stroke-linejoin="round"
9
+ ></g><g id="SVGRepo_iconCarrier">
10
+ <path
11
+ d="M11.5 20.5C6.80558 20.5 3 16.6944 3 12C3 7.30558 6.80558 3.5 11.5 3.5C16.1944 3.5 20 7.30558 20 12C20 13.5433 19.5887 14.9905 18.8698 16.238M22.5 15L18.8698 16.238M17.1747 12.3832L18.5289 16.3542L18.8698 16.238"
12
+ stroke="currentColor"
13
+ stroke-width="2"
14
+ stroke-linecap="round"
15
+ stroke-linejoin="round"
16
+ ></path>
17
+ </g></svg
18
+ >
@@ -9,7 +9,7 @@
9
9
  ></g><g id="SVGRepo_iconCarrier">
10
10
  <path
11
11
  d="M11.5 20.5C6.80558 20.5 3 16.6944 3 12C3 7.30558 6.80558 3.5 11.5 3.5C16.1944 3.5 20 7.30558 20 12C20 13.5433 19.5887 14.9905 18.8698 16.238M22.5 15L18.8698 16.238M17.1747 12.3832L18.5289 16.3542L18.8698 16.238"
12
- stroke="#000000"
12
+ stroke="currentColor"
13
13
  stroke-width="2"
14
14
  stroke-linecap="round"
15
15
  stroke-linejoin="round"
package/dist/icons.js CHANGED
@@ -53,6 +53,7 @@ import tick from "./assets/icons/tick.svg?raw";
53
53
  import user_account_02 from "./assets/icons/user_account_02.svg?raw";
54
54
  import rotate from "./assets/icons/rotate.svg?raw";
55
55
  import file from "./assets/icons/file.svg?raw";
56
+ import refresh from "./assets/icons/refresh.svg?raw";
56
57
  const iconMap = {
57
58
  arrow_down,
58
59
  arrow_left,
@@ -109,5 +110,6 @@ const iconMap = {
109
110
  user_account_02,
110
111
  rotate,
111
112
  file,
113
+ refresh,
112
114
  };
113
115
  export default iconMap;
package/dist/index.d.ts CHANGED
@@ -13,6 +13,8 @@ export { default as MoltenPushButton } from "./MoltenPushButton.svelte";
13
13
  export { default as MoltenPushButtonGroup } from "./MoltenPushButtonGroup.svelte";
14
14
  export { contextMenu, contextTarget, type ContextMenuOptions, } from "./context-target";
15
15
  export { default as SvgIcon } from "./SvgIcon.svelte";
16
+ export { default as IconButton } from "./IconButton.svelte";
17
+ export { tooltip } from "./tooltip";
16
18
  export { default as MeltCombo, type MeltComboSuggestion, type MeltComboData, } from "./MeltCombo.svelte";
17
19
  export { default as MarkdownContainer, type MarkdownContainerTypes, } from "./MarkdownContainer.svelte";
18
20
  export { default as Toggle } from "./Toggle.svelte";
package/dist/index.js CHANGED
@@ -13,6 +13,8 @@ export { default as MoltenPushButton } from "./MoltenPushButton.svelte";
13
13
  export { default as MoltenPushButtonGroup } from "./MoltenPushButtonGroup.svelte";
14
14
  export { contextMenu, contextTarget, } from "./context-target";
15
15
  export { default as SvgIcon } from "./SvgIcon.svelte";
16
+ export { default as IconButton } from "./IconButton.svelte";
17
+ export { tooltip } from "./tooltip";
16
18
  export { default as MeltCombo, } from "./MeltCombo.svelte";
17
19
  export { default as MarkdownContainer, } from "./MarkdownContainer.svelte";
18
20
  export { default as Toggle } from "./Toggle.svelte";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intechstudio/grid-uikit",
3
- "version": "1.20260912.1104",
3
+ "version": "1.20260916.1250",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/intechstudio/grid-uikit.git"