@likable-hair/svelte 4.0.6 → 4.0.8

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.
@@ -2,6 +2,8 @@
2
2
  --quick-actions-default-background-color: rgb(var(--global-color-background-200));
3
3
  --quick-actions-default-selected-items-button-background-color: rgb(var(--global-color-background-500));
4
4
  --quick-actions-default-selected-items-button-background-color-hover: rgb(var(--global-color-background-300));
5
+ --quick-actions-default-selected-items-button-background-color-disabled: rgb(var(--global-color-background-300), .5);
6
+ --quick-actions-default-selected-items-button-color-disabled: rgb(var(--global-color-contrast-900), .5);
5
7
  --quick-actions-default-z-index: 48;
6
8
 
7
9
  --quick-actions-default-buttons-background-color: var(--quick-actions-background-color, var(--quick-actions-default-background-color));
@@ -2,13 +2,12 @@
2
2
  </script>
3
3
 
4
4
  <script lang="ts">import { Button, Icon, mediaQuery, ToolTip } from "../../..";
5
- import DynamicTable from "../list/DynamicTable.svelte";
6
5
  import { fly } from "svelte/transition";
7
6
  import { cubicIn } from "svelte/easing";
8
7
  import MenuOrDrawer from "./MenuOrDrawer.svelte";
9
8
  import './QuickActions.css';
10
- let { selectedItems, showSelectContainer, isSelectedAll, totalRows, slotSelectActionsContainer = $bindable(), disabled, loading, actionsForSelectedItems, position = 'top', lang = 'en' } = $props();
11
- let actions = $state([]), extraActions = $state([]), moreActionsActivator = $state(), openMoreActions = $state(false), infoActivators = $state({}), disabledInfoActivators = $state({});
9
+ let { selectedItems, disabled, actionsForSelectedItems, position = 'top', lang = 'en', onClose, } = $props();
10
+ let actions = $state([]), extraActions = $state([]), slotSelectActionsContainer = $state(), moreActionsActivator = $state(), openMoreActions = $state(false), infoActivators = $state({}), disabledInfoActivators = $state({});
12
11
  $effect(() => {
13
12
  if (!!slotSelectActionsContainer) {
14
13
  let numberOfSplit = $mediaQuery.xl ? 5 :
@@ -28,7 +27,7 @@ $effect(() => {
28
27
  });
29
28
  </script>
30
29
 
31
- {#if selectedItems && selectedItems.length > 0 && showSelectContainer}
30
+ {#if selectedItems > 0}
32
31
  <div
33
32
  class="container-{position}"
34
33
  transition:fly={{ delay: 150, duration: 150, y: -10, easing: cubicIn }}
@@ -37,8 +36,13 @@ $effect(() => {
37
36
  class="select-container"
38
37
  >
39
38
  <div>
40
- <button class="select-info" onclick={() => (selectedItems = [], infoActivators = {}, disabledInfoActivators = {})}>
41
- {!!isSelectedAll ? totalRows : selectedItems.length} {lang == 'en' ? 'items selected' : 'righe selezionate'}
39
+ <button class="select-info" {disabled} onclick={() => {
40
+ infoActivators = {}
41
+ disabledInfoActivators = {}
42
+ if(onClose) onClose()
43
+ }}
44
+ >
45
+ {selectedItems} {lang == 'en' ? 'items selected' : 'righe selezionate'}
42
46
  <Icon name="mdi-close" />
43
47
  </button>
44
48
  </div>
@@ -59,7 +63,9 @@ $effect(() => {
59
63
  --button-box-shadow: none;
60
64
  '
61
65
  --button-height="20px"
62
- disabled={action.disabled}
66
+ --circular-loader-height="17px"
67
+ disabled={action.disabled || action.loading || disabled}
68
+ loading={action.loading}
63
69
  onclick={action.onClick}
64
70
  >
65
71
  <div class="action" bind:this={disabledInfoActivators[action.label]}>
@@ -74,7 +80,7 @@ $effect(() => {
74
80
  />
75
81
  </div>
76
82
  <ToolTip
77
- appearTimeout={1000}
83
+ appearTimeout={500}
78
84
  activator={infoActivators[action.label]}
79
85
  >
80
86
  <div
@@ -90,7 +96,7 @@ $effect(() => {
90
96
  {action.label}
91
97
  {#if !!action.disabledInfo && action.disabled}
92
98
  <ToolTip
93
- appearTimeout={1000}
99
+ appearTimeout={300}
94
100
  activator={disabledInfoActivators[action.label]}
95
101
  >
96
102
  <div
@@ -124,7 +130,6 @@ $effect(() => {
124
130
  margin-left: 8px;
125
131
  '
126
132
  --button-height="20px"
127
- disabled={disabled || loading}
128
133
  onclick={(e) => {
129
134
  openMoreActions = !openMoreActions;
130
135
  }}
@@ -172,8 +177,10 @@ $effect(() => {
172
177
  --button-disabled-color: var(--quick-actions-buttons-color-disabled, var(--quick-actions-default-buttons-color-disabled));
173
178
  --button-box-shadow: none;
174
179
  '
175
- --button-height="35px"
176
- disabled={action.disabled}
180
+ --button-height="30px"
181
+ --circular-loader-height="25px"
182
+ disabled={action.disabled || action.loading || disabled}
183
+ loading={action.loading}
177
184
  onclick={action.onClick}
178
185
  >
179
186
  <div class="action" bind:this={disabledInfoActivators[action.label]}>
@@ -188,7 +195,7 @@ $effect(() => {
188
195
  />
189
196
  </div>
190
197
  <ToolTip
191
- appearTimeout={1000}
198
+ appearTimeout={500}
192
199
  activator={infoActivators[action.label]}
193
200
  >
194
201
  <div
@@ -204,7 +211,7 @@ $effect(() => {
204
211
  {action.label}
205
212
  {#if !!action.disabledInfo && action.disabled}
206
213
  <ToolTip
207
- appearTimeout={1000}
214
+ appearTimeout={300}
208
215
  activator={disabledInfoActivators[action.label]}
209
216
  >
210
217
  <div
@@ -292,6 +299,19 @@ $effect(() => {
292
299
  --quick-actions-selected-items-button-background-color-hover,
293
300
  var(--quick-actions-default-selected-items-button-background-color-hover)
294
301
  );
302
+ cursor: pointer;
303
+ }
304
+
305
+ .select-info:disabled {
306
+ background-color: var(
307
+ --quick-actions-selected-items-button-background-color-disabled,
308
+ var(--quick-actions-default-selected-items-button-background-color-disabled)
309
+ );
310
+ color: var(
311
+ --quick-actions-selected-items-button-color-disabled,
312
+ var(--quick-actions-default-selected-items-button-color-disabled)
313
+ );
314
+ cursor: not-allowed;
295
315
  }
296
316
 
297
317
  .select-actions-container {
@@ -2,26 +2,22 @@ export type Action = {
2
2
  label: string;
3
3
  icon?: string;
4
4
  disabled?: boolean;
5
+ loading?: boolean;
5
6
  info?: string;
6
7
  disabledInfo?: string;
7
8
  onClick: NonNullable<ComponentProps<typeof Button>['onclick']>;
8
9
  };
9
10
  import { Button } from "../../..";
10
11
  import type { ComponentProps } from "svelte";
11
- import DynamicTable from "../list/DynamicTable.svelte";
12
12
  import './QuickActions.css';
13
13
  interface Props {
14
- selectedItems: ComponentProps<typeof DynamicTable>["selectedItems"];
15
- showSelectContainer: boolean;
16
- isSelectedAll: boolean;
17
- totalRows: number;
18
- slotSelectActionsContainer?: HTMLElement;
14
+ selectedItems: number;
19
15
  disabled: boolean;
20
- loading: boolean;
21
16
  actionsForSelectedItems: Action[];
22
17
  position?: 'top' | 'bottom';
23
18
  lang?: 'it' | 'en';
19
+ onClose?: () => void;
24
20
  }
25
- declare const QuickActions: import("svelte").Component<Props, {}, "slotSelectActionsContainer">;
21
+ declare const QuickActions: import("svelte").Component<Props, {}, "">;
26
22
  type QuickActions = ReturnType<typeof QuickActions>;
27
23
  export default QuickActions;