@likable-hair/svelte 3.3.16 → 3.3.18

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));
@@ -1,13 +1,14 @@
1
1
  <script context="module"></script>
2
2
 
3
3
  <script>import { Button, Icon, mediaQuery, ToolTip } from "../../..";
4
- import DynamicTable from "../list/DynamicTable.svelte";
5
4
  import { fly } from "svelte/transition";
6
5
  import { cubicIn } from "svelte/easing";
7
6
  import MenuOrDrawer from "./MenuOrDrawer.svelte";
8
7
  import "./QuickActions.css";
9
- export let selectedItems, showSelectContainer, isSelectedAll, totalRows, slotSelectActionsContainer, disabled, loading, actionsForSelectedItems, position = "top", lang = "en";
10
- let actions = [], extraActions = [], moreActionsActivator, openMoreActions = false, infoActivators = {}, disabledInfoActivators = {};
8
+ import { createEventDispatcher } from "svelte";
9
+ export let selectedItems, disabled, actionsForSelectedItems, position = "top", lang = "en";
10
+ let actions = [], extraActions = [], slotSelectActionsContainer, moreActionsActivator, openMoreActions = false, infoActivators = {}, disabledInfoActivators = {};
11
+ const dispatch = createEventDispatcher();
11
12
  $: {
12
13
  if (!!slotSelectActionsContainer) {
13
14
  let numberOfSplit = $mediaQuery.xl ? 5 : $mediaQuery.l ? 4 : $mediaQuery.m ? 2 : $mediaQuery.s ? 0 : $mediaQuery.xs ? 0 : 3;
@@ -22,7 +23,7 @@ $: {
22
23
  }
23
24
  </script>
24
25
 
25
- {#if selectedItems && selectedItems.length > 0 && showSelectContainer}
26
+ {#if selectedItems > 0}
26
27
  <div
27
28
  class="container-{position}"
28
29
  transition:fly={{ delay: 150, duration: 150, y: -10, easing: cubicIn }}
@@ -31,8 +32,8 @@ $: {
31
32
  class="select-container"
32
33
  >
33
34
  <div>
34
- <button class="select-info" on:click={() => (selectedItems = [], infoActivators = {}, disabledInfoActivators = {})}>
35
- {!!isSelectedAll ? totalRows : selectedItems.length} {lang == 'en' ? 'items selected' : 'righe selezionate'}
35
+ <button class="select-info" {disabled} on:click={() => (infoActivators = {}, disabledInfoActivators = {}, dispatch('close', {}))}>
36
+ {selectedItems} {lang == 'en' ? 'items selected' : 'righe selezionate'}
36
37
  <Icon name="mdi-close" />
37
38
  </button>
38
39
  </div>
@@ -53,7 +54,9 @@ $: {
53
54
  --button-box-shadow: none;
54
55
  '
55
56
  --button-height="20px"
56
- disabled={action.disabled}
57
+ --circular-loader-height="17px"
58
+ disabled={action.disabled || action.loading || disabled}
59
+ loading={action.loading}
57
60
  on:click={action.onClick}
58
61
  >
59
62
  <div class="action" bind:this={disabledInfoActivators[action.label]}>
@@ -68,7 +71,7 @@ $: {
68
71
  />
69
72
  </div>
70
73
  <ToolTip
71
- appearTimeout={1000}
74
+ appearTimeout={500}
72
75
  activator={infoActivators[action.label]}
73
76
  >
74
77
  <div
@@ -84,7 +87,7 @@ $: {
84
87
  {action.label}
85
88
  {#if !!action.disabledInfo && action.disabled}
86
89
  <ToolTip
87
- appearTimeout={1000}
90
+ appearTimeout={300}
88
91
  activator={disabledInfoActivators[action.label]}
89
92
  >
90
93
  <div
@@ -118,7 +121,6 @@ $: {
118
121
  margin-left: 8px;
119
122
  '
120
123
  --button-height="20px"
121
- disabled={disabled || loading}
122
124
  on:click={(e) => {
123
125
  openMoreActions = !openMoreActions;
124
126
  }}
@@ -167,8 +169,10 @@ $: {
167
169
  --button-disabled-color: var(--quick-actions-buttons-color-disabled, var(--quick-actions-default-buttons-color-disabled));
168
170
  --button-box-shadow: none;
169
171
  '
170
- --button-height="35px"
171
- disabled={action.disabled}
172
+ --button-height="30px"
173
+ --circular-loader-height="25px"
174
+ disabled={action.disabled || action.loading || disabled}
175
+ loading={action.loading}
172
176
  on:click={action.onClick}
173
177
  >
174
178
  <div class="action" bind:this={disabledInfoActivators[action.label]}>
@@ -183,7 +187,7 @@ $: {
183
187
  />
184
188
  </div>
185
189
  <ToolTip
186
- appearTimeout={1000}
190
+ appearTimeout={500}
187
191
  activator={infoActivators[action.label]}
188
192
  >
189
193
  <div
@@ -199,7 +203,7 @@ $: {
199
203
  {action.label}
200
204
  {#if !!action.disabledInfo && action.disabled}
201
205
  <ToolTip
202
- appearTimeout={1000}
206
+ appearTimeout={300}
203
207
  activator={disabledInfoActivators[action.label]}
204
208
  >
205
209
  <div
@@ -286,6 +290,19 @@ $: {
286
290
  --quick-actions-selected-items-button-background-color-hover,
287
291
  var(--quick-actions-default-selected-items-button-background-color-hover)
288
292
  );
293
+ cursor: pointer;
294
+ }
295
+
296
+ .select-info:disabled {
297
+ background-color: var(
298
+ --quick-actions-selected-items-button-background-color-disabled,
299
+ var(--quick-actions-default-selected-items-button-background-color-disabled)
300
+ );
301
+ color: var(
302
+ --quick-actions-selected-items-button-color-disabled,
303
+ var(--quick-actions-default-selected-items-button-color-disabled)
304
+ );
305
+ cursor: not-allowed;
289
306
  }
290
307
 
291
308
  .select-actions-container {
@@ -3,29 +3,25 @@ export type Action = {
3
3
  label: string;
4
4
  icon?: string;
5
5
  disabled?: boolean;
6
+ loading?: boolean;
6
7
  info?: string;
7
8
  disabledInfo?: string;
8
9
  onClick: (e: CustomEvent<{
9
10
  nativeEvent: MouseEvent;
10
11
  }>) => void;
11
12
  };
12
- import type { ComponentProps } from "svelte";
13
- import DynamicTable from "../list/DynamicTable.svelte";
14
13
  import './QuickActions.css';
15
14
  declare const __propDef: {
16
15
  props: {
17
- selectedItems: ComponentProps<DynamicTable["selectedItems"]>[];
18
- showSelectContainer: boolean;
19
- isSelectedAll: boolean;
20
- totalRows: number;
21
- slotSelectActionsContainer: HTMLElement | undefined;
16
+ selectedItems: number;
22
17
  disabled: boolean;
23
- loading: boolean;
24
18
  actionsForSelectedItems: Action[];
25
19
  position?: "bottom" | "top" | undefined;
26
20
  lang?: "it" | "en" | undefined;
27
21
  };
28
22
  events: {
23
+ close: CustomEvent<{}>;
24
+ } & {
29
25
  [evt: string]: CustomEvent<any>;
30
26
  };
31
27
  slots: {};