@likable-hair/svelte 0.0.55 → 0.0.58

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.
@@ -4,79 +4,70 @@
4
4
  export let headers = undefined, items = undefined, backgroundColor = "rgba(255,255,255,0)", headerColor = "rgba(0,0,0,0.05)", rowSeparatorColor = headerColor, headerHeight = "30px", rowHeight = "70px", minWidth = undefined, height = "100%", width = "100%";
5
5
  </script>
6
6
 
7
- {#if !!items && Array.isArray(items) }
7
+ {#if !!items && Array.isArray(items)}
8
8
  <div class="container" style:height style:width>
9
- <table
10
- style:background-color={backgroundColor}
11
- style:width="100%"
12
- style:min-width={minWidth}
13
- >
14
- <thead
15
- style:background-color={headerColor}
16
- style:height={headerHeight}
17
- >
18
- {#each headers as head}
19
- <th
20
- style:width={head.width}
21
- style:min-width={head.minWidth}
22
- >
23
- {head.label}
24
- </th>
25
- {/each}
26
- {#if $$slots.appendLastColumn}
27
- <th></th>
28
- {/if}
29
- </thead>
30
- <tbody>
31
- {#each items as item, i}
32
- <tr
33
- style:border-color={rowSeparatorColor}
34
- style:height={rowHeight}
35
- >
36
- {#each headers as header , j}
37
- <td>
38
- {#if header.type=='custom'}
39
- <slot
40
- name="customColumn"
41
- index={i}
42
- columnIndex={j}
43
- header={header}
44
- item={item}
45
- ></slot>
46
- {:else if header.type=='date'}
47
- {dateToString(item[header.value], 'dayAndHours', 'it')}
48
- {:else}
49
- {item[header.value]}
50
- {/if}
51
- </td>
52
- {/each}
53
- {#if $$slots.appendLastColumn}
54
- <td>
55
- <slot name="appendLastColumn" index={i} item={item}></slot>
56
- </td>
57
- {/if}
58
- </tr>
59
- {/each}
60
- </tbody>
61
- </table>
9
+ <table
10
+ style:background-color={backgroundColor}
11
+ style:width="100%"
12
+ style:min-width={minWidth}
13
+ >
14
+ <thead style:background-color={headerColor} style:height={headerHeight}>
15
+ {#each headers as head}
16
+ <th style:width={head.width} style:min-width={head.minWidth}>
17
+ {head.label}
18
+ </th>
19
+ {/each}
20
+ {#if $$slots.appendLastColumn}
21
+ <th />
22
+ {/if}
23
+ </thead>
24
+ <tbody>
25
+ {#each items as item, i}
26
+ <tr style:border-color={rowSeparatorColor} style:height={rowHeight}>
27
+ {#each headers as header, j}
28
+ <td>
29
+ {#if header.type == "custom"}
30
+ <slot
31
+ name="customColumn"
32
+ index={i}
33
+ columnIndex={j}
34
+ {header}
35
+ {item}
36
+ />
37
+ {:else if header.type == "date"}
38
+ {dateToString(item[header.value], "dayAndHours", "it")}
39
+ {:else}
40
+ {item[header.value]}
41
+ {/if}
42
+ </td>
43
+ {/each}
44
+ {#if $$slots.appendLastColumn}
45
+ <td>
46
+ <slot name="appendLastColumn" index={i} {item} />
47
+ </td>
48
+ {/if}
49
+ </tr>
50
+ {/each}
51
+ </tbody>
52
+ </table>
62
53
  </div>
63
54
  {/if}
64
55
 
65
56
  <style>
66
- table {
67
- border-collapse: collapse;
68
- width: 100%;
69
- }
70
- th {
71
- text-align: start;
72
- padding-left: 10px;
73
- min-width: 100px;
74
- }
75
- td {
76
- padding-left: 10px;
77
- }
78
- tr:not(:first-child) {
79
- border: solid;
80
- border-width: 2px 0;
81
- }
57
+ table {
58
+ border-collapse: collapse;
59
+ width: 100%;
60
+ }
61
+ th {
62
+ text-align: start;
63
+ padding-left: 10px;
64
+ min-width: 100px;
65
+ }
66
+ td {
67
+ padding-left: 10px;
68
+ }
69
+ tr:not(:first-child) {
70
+ border: solid;
71
+ border-width: 2px 0;
72
+ }
82
73
  </style>
@@ -2,7 +2,7 @@ import { SvelteComponentTyped } from "svelte";
2
2
  export declare type Header = {
3
3
  value: string;
4
4
  label: string;
5
- type: 'boolean' | 'string' | 'number' | 'date' | 'custom';
5
+ type: "boolean" | "string" | "number" | "date" | "custom";
6
6
  width?: string;
7
7
  minWidth?: string;
8
8
  data?: {
@@ -1,7 +1,7 @@
1
1
  <script >import { onMount } from 'svelte';
2
2
  import { fly } from 'svelte/transition';
3
3
  import { getDateRowsStats, getDaysNames } from './utils';
4
- export let selectedDate = undefined, visibleMonth = new Date().getMonth(), visibleYear = new Date().getFullYear(), locale = 'it', showExtraMonthDays = true, showHeader = true, height = "100%", width = "100%", dayWidth = '30px', dayHeight = '30px', dayHoverColor = '#c9c8c873', daySelectedColor = '#adadad', selectedTextColor = "black", dayBackgroundColor = undefined, animationDuration = 200;
4
+ export let selectedDate = undefined, visibleMonth = new Date().getMonth(), visibleYear = new Date().getFullYear(), locale = 'it', showExtraMonthDays = true, showHeader = true, height = "100%", width = "100%", dayWidth = '30px', dayHeight = '30px', dayHoverColor = '#c9c8c873', daySelectedColor = '#adadad', selectedTextColor = "black", gridGap = "1px", dayBackgroundColor = undefined, animationDuration = 200;
5
5
  onMount(() => {
6
6
  });
7
7
  import { createEventDispatcher } from 'svelte';
@@ -26,6 +26,7 @@ function handleDayClick(dateStat, extraMonth) {
26
26
  <div
27
27
  in:fly="{{delay: animationDuration, duration: animationDuration, y: 30}}"
28
28
  out:fly|local="{{duration: animationDuration, y: -30}}"
29
+ style:gap={gridGap}
29
30
  class="grid-layout"
30
31
  >
31
32
  {#if showHeader}
@@ -80,7 +81,7 @@ function handleDayClick(dateStat, extraMonth) {
80
81
  .grid-layout {
81
82
  display: grid;
82
83
  grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
83
- gap: 1px;
84
+ height: 100%;
84
85
  }
85
86
 
86
87
  .day-slot {
@@ -15,6 +15,7 @@ declare const __propDef: {
15
15
  dayHoverColor?: string;
16
16
  daySelectedColor?: string;
17
17
  selectedTextColor?: string;
18
+ gridGap?: string;
18
19
  dayBackgroundColor?: string;
19
20
  animationDuration?: number;
20
21
  };
package/dates/utils.js CHANGED
@@ -90,7 +90,6 @@ export const getDateRows = (monthIndex, year, locale = 'it') => {
90
90
  else
91
91
  startIndex -= 1;
92
92
  }
93
- console.log(startIndex);
94
93
  let lastIndex = new Date(year, monthIndex + 1, 0).getDay();
95
94
  if (locale == 'it') {
96
95
  if (lastIndex === 0)
@@ -1,4 +1,5 @@
1
- <script >import { beforeUpdate } from "svelte";
1
+ <script >import { browser } from "$app/env";
2
+ import { beforeUpdate } from "svelte";
2
3
  export let open = false, overlayOpacity = "30%", overlayColor = "#282828";
3
4
  let zIndex = 50, localOpen = open;
4
5
  beforeUpdate(() => {
@@ -12,6 +13,15 @@ beforeUpdate(() => {
12
13
  });
13
14
  zIndex = maxZIndex + 2;
14
15
  }
16
+ document.body.style.overflow = 'hidden';
17
+ }
18
+ else if (!open) {
19
+ if (browser) {
20
+ let otherDialogs = document.querySelectorAll("[data-dialog=true]");
21
+ if (otherDialogs.length <= 1) {
22
+ document.body.style.overflow = 'auto';
23
+ }
24
+ }
15
25
  }
16
26
  localOpen = open;
17
27
  });
@@ -33,14 +43,14 @@ function handleOverlayClick() {
33
43
  style:justify-content="space-between"
34
44
  class="overlay-container"
35
45
  class:overlay-container-active={localOpen}
36
- on:touchmove|preventDefault={() => {}}
37
- on:wheel|preventDefault={() => {}}
38
46
  >
39
47
  <div
40
48
  style:background-color={overlayColor}
41
49
  class="overlay"
42
50
  class:overlay-active={localOpen}
43
51
  on:click={handleOverlayClick}
52
+ on:touchmove|preventDefault={() => {}}
53
+ on:wheel|preventDefault={() => {}}
44
54
  ></div>
45
55
  {#if localOpen }
46
56
  <div
@@ -1,6 +1,6 @@
1
1
  <script context="module" ></script>
2
2
 
3
- <script >export let values = [], items, searchFunction = undefined, multiple = false, disabled = false, width = "auto", maxWidth = undefined,
3
+ <script >export let values = [], items, searchFunction = undefined, multiple = false, disabled = false, width = "auto", height = "auto", maxWidth = undefined,
4
4
  // textfield
5
5
  textFieldLabel = "", textFieldPlaceholder = "", textFieldColor = null, textFieldVariant = 'boxed', textFieldMaxWidth = "min(100px, 90%)", textFieldMinWidth = undefined, textFieldHeight = "auto", textFieldTextColor = "black", textFieldBorderWeight = "2px", textFieldBorderRadius = "5px", textFieldBorderColor = null, textFieldFocusBorderColor = null, textFieldFocusedBoxShadow = undefined, textFieldBackgroundColor = null, textFieldPadding = undefined, textFieldPaddingLeft = undefined, textFieldPaddingRight = undefined, textFieldPaddingBottom = undefined, textFieldPaddingTop = undefined, textFieldFontSize = undefined,
6
6
  // menu
@@ -21,7 +21,6 @@ function unselect(item) {
21
21
  }
22
22
  function toggle(item) {
23
23
  const alreadyPresent = values.findIndex((i) => i.value === item.value) != -1;
24
- console.log(item, alreadyPresent);
25
24
  if (alreadyPresent)
26
25
  unselect(item);
27
26
  else
@@ -94,6 +93,7 @@ import Menu from '../common/Menu.svelte';
94
93
  bind:this={activator}
95
94
  style:width={width}
96
95
  style:max-width={maxWidth}
96
+ style:height={height}
97
97
  style:opacity={disabled ? '50%' : '100%'}
98
98
  on:click={handleContainerClick}
99
99
  >
@@ -13,6 +13,7 @@ declare const __propDef: {
13
13
  multiple?: boolean;
14
14
  disabled?: boolean;
15
15
  width?: string;
16
+ height?: string;
16
17
  maxWidth?: string;
17
18
  textFieldLabel?: string;
18
19
  textFieldPlaceholder?: string;
@@ -43,18 +43,20 @@ import Avatar from "./Avatar.svelte";
43
43
  class="descriptive-avatar-container"
44
44
  >
45
45
  <div class="avatar-container">
46
- <Avatar
47
- src={src}
48
- width={width}
49
- maxWidth={maxWidth}
50
- minWidth={minWidth}
51
- height={height}
52
- maxHeight={maxHeight}
53
- minHeight={minHeight}
54
- borderRadius={borderRadius}
55
- lazyLoaded={lazyLoaded}
56
- referrerpolicy={referrerpolicy}
57
- ></Avatar>
46
+ <slot name="avatar">
47
+ <Avatar
48
+ src={src}
49
+ width={width}
50
+ maxWidth={maxWidth}
51
+ minWidth={minWidth}
52
+ height={height}
53
+ maxHeight={maxHeight}
54
+ minHeight={minHeight}
55
+ borderRadius={borderRadius}
56
+ lazyLoaded={lazyLoaded}
57
+ referrerpolicy={referrerpolicy}
58
+ ></Avatar>
59
+ </slot>
58
60
  </div>
59
61
  <div
60
62
  style:margin-left={!reverse && direction === 'row' ? avatarSpacing : undefined}
@@ -20,7 +20,9 @@ declare const __propDef: {
20
20
  events: {
21
21
  [evt: string]: CustomEvent<any>;
22
22
  };
23
- slots: {};
23
+ slots: {
24
+ avatar: {};
25
+ };
24
26
  };
25
27
  export declare type DescriptiveAvatarProps = typeof __propDef.props;
26
28
  export declare type DescriptiveAvatarEvents = typeof __propDef.events;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@likable-hair/svelte",
3
3
  "description": "A Svelte component for likablehair",
4
- "version": "0.0.55",
4
+ "version": "0.0.58",
5
5
  "devDependencies": {
6
6
  "@sveltejs/adapter-auto": "next",
7
7
  "@sveltejs/kit": "next",