@likable-hair/svelte 0.0.63 → 0.0.65

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.
@@ -69,14 +69,23 @@ $: if (closeOnClickOutside && !!menuElement) {
69
69
  window.addEventListener('click', (event) => {
70
70
  open = false;
71
71
  });
72
+ window.addEventListener('touchstart', (event) => {
73
+ open = false;
74
+ });
72
75
  if (!!activator) {
73
76
  activator.addEventListener('click', (event) => {
74
77
  event.stopPropagation();
75
78
  });
79
+ activator.addEventListener('touchstart', (event) => {
80
+ event.stopPropagation();
81
+ });
76
82
  }
77
83
  menuElement.addEventListener('click', (event) => {
78
84
  event.stopPropagation();
79
85
  });
86
+ menuElement.addEventListener('touchstart', (event) => {
87
+ event.stopPropagation();
88
+ });
80
89
  }
81
90
  </script>
82
91
 
@@ -1,7 +1,7 @@
1
1
  <script context="module"></script>
2
2
 
3
3
  <script>import { dateToString } from "../dates/utils";
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%";
4
+ export let headers = undefined, items = undefined, backgroundColor = "rgba(255,255,255,0)", headerColor = "rgba(0,0,0,0.05)", rowSeparatorColor = headerColor, headerHeight = "30px", headerBorderRadius = "5px", rowHeight = "70px", minWidth = undefined, height = "100%", width = "100%";
5
5
  </script>
6
6
 
7
7
  {#if !!items && Array.isArray(items)}
@@ -11,7 +11,11 @@ export let headers = undefined, items = undefined, backgroundColor = "rgba(255,2
11
11
  style:width="100%"
12
12
  style:min-width={minWidth}
13
13
  >
14
- <thead style:background-color={headerColor} style:height={headerHeight}>
14
+ <thead
15
+ style:background-color={headerColor}
16
+ style:height={headerHeight}
17
+ style:border-radius={headerBorderRadius}
18
+ >
15
19
  {#each headers as head}
16
20
  <th style:width={head.width} style:min-width={head.minWidth}>
17
21
  {head.label}
@@ -19,6 +19,7 @@ declare const __propDef: {
19
19
  headerColor?: string;
20
20
  rowSeparatorColor?: string;
21
21
  headerHeight?: string;
22
+ headerBorderRadius?: string;
22
23
  rowHeight?: string;
23
24
  minWidth?: string;
24
25
  height?: string;
@@ -5,6 +5,7 @@
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
7
7
  menuBackgroundColor = "#FFF", menuBoxShadow = "rgba(149, 157, 165, 0.2) 0px 8px 24px", menuBorderRadius = "5px", focusItemBackgroundColor = "#EEEEEE", selectedItemBackgroundColor = "#D0D0D0", border = '1px solid black', borderRadius = '5px', chipColor = "#D0D0D0", chipTextColor = "black", chipHeight = "30px";
8
+ let dispatch = createEventDispatcher();
8
9
  function select(item) {
9
10
  const alreadyPresent = values.findIndex((i) => i.value === item.value) != -1;
10
11
  if (!alreadyPresent) {
@@ -13,11 +14,21 @@ function select(item) {
13
14
  else
14
15
  values = [item];
15
16
  refreshMenuWidth();
17
+ dispatch('change', {
18
+ unselect: undefined,
19
+ select: item,
20
+ selection: values
21
+ });
16
22
  }
17
23
  }
18
24
  function unselect(item) {
19
25
  values = values.filter((i) => i.value != item.value);
20
26
  refreshMenuWidth();
27
+ dispatch('change', {
28
+ unselect: item,
29
+ select: undefined,
30
+ selection: values
31
+ });
21
32
  }
22
33
  function toggle(item) {
23
34
  const alreadyPresent = values.findIndex((i) => i.value === item.value) != -1;
@@ -66,8 +77,13 @@ function handleWindowKeyDown(event) {
66
77
  }
67
78
  let input;
68
79
  function handleContainerClick() {
69
- if (!menuOpened)
80
+ if (!menuOpened) {
70
81
  input.focus();
82
+ // had to timeout because it was catching click outside
83
+ setTimeout(() => {
84
+ openMenu();
85
+ }, 50);
86
+ }
71
87
  }
72
88
  let searchText, filteredItems = items;
73
89
  $: if (!!searchText) {
@@ -85,6 +101,7 @@ else {
85
101
  import Textfield from "./Textfield.svelte";
86
102
  import Chip from '../navigation/Chip.svelte';
87
103
  import Menu from '../common/Menu.svelte';
104
+ import { createEventDispatcher } from 'svelte';
88
105
  </script>
89
106
 
90
107
  <svelte:window></svelte:window>
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.63",
4
+ "version": "0.0.65",
5
5
  "devDependencies": {
6
6
  "@sveltejs/adapter-auto": "next",
7
7
  "@sveltejs/kit": "next",