spaper 1.2.0 → 1.3.0

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.
@@ -5,6 +5,7 @@
5
5
  on:keydown
6
6
  on:mouseover
7
7
  on:mouseenter
8
- on:mouseleave>
8
+ on:mouseleave
9
+ on:focus>
9
10
  <slot />
10
11
  </form>
@@ -10,6 +10,7 @@ declare const __propDef: {
10
10
  mouseover: MouseEvent;
11
11
  mouseenter: MouseEvent;
12
12
  mouseleave: MouseEvent;
13
+ focus: FocusEvent;
13
14
  } & {
14
15
  [evt: string]: CustomEvent<any>;
15
16
  };
@@ -35,14 +35,18 @@ import { computeClasses, getDomAttributes } from '../../utils';
35
35
  ;
36
36
  ;
37
37
  export let label = '';
38
- export let value = '';
38
+ export let value = null;
39
39
  export let block = false;
40
40
  export let type = 'text';
41
41
  export let valid = null;
42
42
  export let noResize = false;
43
43
  const dispatch = createEventDispatcher();
44
+ // let value_ = value
44
45
  function onInput({ target }) {
45
46
  dispatch('input', target.value);
47
+ // console.log(type)
48
+ // const valueToDispatch = type === 'number' ? parseFloat(target.value) : target.value;
49
+ // dispatch('input', valueToDispatch);
46
50
  }
47
51
  let isValid = true;
48
52
  $: if (valid) {
@@ -58,6 +62,9 @@ $: {
58
62
  }
59
63
  let classes;
60
64
  $: classes = `${(_a = $$restProps.class) !== null && _a !== void 0 ? _a : ''} ${computeClasses('input', { block })}`;
65
+ // $: console.log('value in input', value, value === null)
66
+ // FIXME: change value twice... use other var? value_?
67
+ // $: if (type === 'number' && value !== null) value = Number(value)
61
68
  </script>
62
69
 
63
70
  <style>
@@ -4,10 +4,10 @@ declare const __propDef: {
4
4
  props: {
5
5
  [x: string]: any;
6
6
  label?: string;
7
- value?: string;
7
+ value?: string | number | null;
8
8
  block?: boolean;
9
9
  type?: InputType;
10
- valid?: (val: string) => boolean;
10
+ valid?: (val: string | number) => boolean;
11
11
  noResize?: boolean;
12
12
  };
13
13
  events: {
@@ -1,14 +1,18 @@
1
- <div {...$$restProps}
2
- class={classes}
3
- class:col-fill={fill}
4
- class:align-top={top}
5
- class:align-middle={middle}
6
- class:align-bottom={bottom}>
1
+ <svelte:element
2
+ this={as}
3
+ {...$$restProps}
4
+ class={classes}
5
+ class:col-fill={fill}
6
+ class:align-top={top}
7
+ class:align-middle={middle}
8
+ class:align-bottom={bottom}
9
+ >
7
10
  <slot />
8
- </div>
11
+ </svelte:element>
9
12
 
10
13
  <script >var _a;
11
14
  import { computeClasses } from '../../utils';
15
+ export let as = 'div';
12
16
  export let col = null;
13
17
  export let sm = null;
14
18
  export let md = null;
@@ -2,6 +2,7 @@ import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
+ as?: keyof HTMLElementTagNameMap | keyof SVGElementTagNameMap;
5
6
  col?: string | number;
6
7
  sm?: string | number;
7
8
  md?: string | number;
@@ -1,16 +1,20 @@
1
- <div {...$$restProps}
2
- class="{$$restProps.class ?? ''} row"
3
- class:flex-right={right}
4
- class:flex-center={center}
5
- class:flex-edges={edges}
6
- class:flex-spaces={spaces}
7
- class:flex-top={top}
8
- class:flex-middle={middle}
9
- class:flex-bottom={bottom}>
1
+ <svelte:element
2
+ this={as}
3
+ {...$$restProps}
4
+ class="{$$restProps.class ?? ''} row"
5
+ class:flex-right={right}
6
+ class:flex-center={center}
7
+ class:flex-edges={edges}
8
+ class:flex-spaces={spaces}
9
+ class:flex-top={top}
10
+ class:flex-middle={middle}
11
+ class:flex-bottom={bottom}
12
+ >
10
13
  <slot />
11
- </div>
14
+ </svelte:element>
12
15
 
13
- <script >export let right = false;
16
+ <script >export let as = 'div';
17
+ export let right = false;
14
18
  export let center = false;
15
19
  export let edges = false;
16
20
  export let spaces = false;
@@ -2,6 +2,7 @@ import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
+ as?: keyof HTMLElementTagNameMap;
5
6
  right?: boolean;
6
7
  center?: boolean;
7
8
  edges?: boolean;
@@ -6,7 +6,7 @@
6
6
  aria-valuetext={ariaValueText}
7
7
  tabindex="-1"
8
8
  role="progressbar"
9
- class="border border-{borderType} margin-small"
9
+ class="{$$restProps.class ?? ''} border border-{borderType} margin-small"
10
10
  class:animated
11
11
  class:circle
12
12
  class:inline>
@@ -10,7 +10,8 @@
10
10
  aria-controls={getId(label, 'content')}
11
11
  role="tab"
12
12
  tabindex={selected ? 0 : -1}
13
- on:click={showContent.bind(null, index)}>
13
+ on:click={showContent.bind(null, index)}
14
+ on:keypress>
14
15
  {#if header}
15
16
  {@html header.innerHTML}
16
17
  {:else}
@@ -8,6 +8,7 @@ declare const __propDef: {
8
8
  contentAlign?: string;
9
9
  };
10
10
  events: {
11
+ keypress: KeyboardEvent;
11
12
  change: CustomEvent<any>;
12
13
  } & {
13
14
  [evt: string]: CustomEvent<any>;
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "papercss",
9
9
  "components"
10
10
  ],
11
- "version": "1.2.0",
11
+ "version": "1.3.0",
12
12
  "repository": {
13
13
  "type": "git",
14
14
  "url": "git+https://github.com/Oli8/spaper.git"
@@ -70,6 +70,7 @@
70
70
  "./components/Toast": "./components/Toast/index.js",
71
71
  "./components/style.scss": "./components/style.scss",
72
72
  ".": "./index.js",
73
+ "./types": "./types.js",
73
74
  "./utils": "./utils.js"
74
75
  },
75
76
  "svelte": "./index.js"
package/types.d.ts CHANGED
@@ -1,26 +1,16 @@
1
- export type PaperSize = 'small' | 'default' | 'large';
2
-
3
- export type PaperType = 'primary' | 'secondary' | 'success' | 'warning' | 'danger';
4
-
5
- export type PaperFlexPlacement = 'spaces' | 'edges' | 'right' | 'center' | 'left';
6
-
7
- export type PaperAlign = 'left' | 'center' | 'right';
8
-
9
- export type Attributes = Record<string, string|boolean>;
10
-
11
- export type PositionY = 'top' | 'bottom';
12
- export type PositionX = 'left' | 'right';
13
- export type Position = PositionX | PositionY;
14
-
1
+ export declare type PaperSize = 'small' | 'default' | 'large';
2
+ export declare type PaperType = 'primary' | 'secondary' | 'success' | 'warning' | 'danger';
3
+ export declare type PaperFlexPlacement = 'spaces' | 'edges' | 'right' | 'center' | 'left';
4
+ export declare type PaperAlign = 'left' | 'center' | 'right';
5
+ export declare type Attributes = Record<string, string | boolean>;
6
+ export declare type PositionY = 'top' | 'bottom';
7
+ export declare type PositionX = 'left' | 'right';
8
+ export declare type Position = PositionX | PositionY;
15
9
  export interface TableColumnObj {
16
- field: string;
17
- label?: string;
18
- content?: (text?: string) => string;
19
- html?: boolean;
10
+ field: string;
11
+ label?: string;
12
+ content?: (val?: any) => string;
13
+ html?: boolean;
20
14
  }
21
-
22
- export type TableColumn = TableColumnObj | string;
23
-
24
- export type Transition = 'blur'
25
- | 'fade' | 'fly' | 'slide'
26
- | 'scale' | 'draw' | 'crossfade';
15
+ export declare type TableColumn = TableColumnObj | string;
16
+ export declare type Transition = 'blur' | 'fade' | 'fly' | 'slide' | 'scale' | 'draw' | 'crossfade';
package/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};