spaper 1.1.1 → 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.
package/README.md CHANGED
@@ -94,6 +94,7 @@ Any donation is greatly appreciated :heart:
94
94
  - Card
95
95
  - Carousel
96
96
  - CloseButton
97
+ - Col
97
98
  - Collapsible
98
99
  - CopyButton
99
100
  - Form
@@ -109,6 +110,7 @@ Any donation is greatly appreciated :heart:
109
110
  - Pagination
110
111
  - Popover
111
112
  - Progress
113
+ - Row
112
114
  - Skeleton
113
115
  - Table
114
116
  - Tabs
@@ -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: {
@@ -0,0 +1,25 @@
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
+ >
10
+ <slot />
11
+ </svelte:element>
12
+
13
+ <script >var _a;
14
+ import { computeClasses } from '../../utils';
15
+ export let as = 'div';
16
+ export let col = null;
17
+ export let sm = null;
18
+ export let md = null;
19
+ export let lg = null;
20
+ export let fill = false;
21
+ export let top = false;
22
+ export let middle = false;
23
+ export let bottom = false;
24
+ $: classes = `col ${(_a = $$restProps.class) !== null && _a !== void 0 ? _a : ''} ${computeClasses('col', { col, sm, md, lg })}`;
25
+ </script>
@@ -0,0 +1,27 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ [x: string]: any;
5
+ as?: keyof HTMLElementTagNameMap | keyof SVGElementTagNameMap;
6
+ col?: string | number;
7
+ sm?: string | number;
8
+ md?: string | number;
9
+ lg?: string | number;
10
+ fill?: boolean;
11
+ top?: boolean;
12
+ middle?: boolean;
13
+ bottom?: boolean;
14
+ };
15
+ events: {
16
+ [evt: string]: CustomEvent<any>;
17
+ };
18
+ slots: {
19
+ default: {};
20
+ };
21
+ };
22
+ export declare type ColProps = typeof __propDef.props;
23
+ export declare type ColEvents = typeof __propDef.events;
24
+ export declare type ColSlots = typeof __propDef.slots;
25
+ export default class Col extends SvelteComponentTyped<ColProps, ColEvents, ColSlots> {
26
+ }
27
+ export {};
@@ -0,0 +1,24 @@
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
+ >
13
+ <slot />
14
+ </svelte:element>
15
+
16
+ <script >export let as = 'div';
17
+ export let right = false;
18
+ export let center = false;
19
+ export let edges = false;
20
+ export let spaces = false;
21
+ export let top = false;
22
+ export let middle = false;
23
+ export let bottom = false;
24
+ </script>
@@ -0,0 +1,26 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ [x: string]: any;
5
+ as?: keyof HTMLElementTagNameMap;
6
+ right?: boolean;
7
+ center?: boolean;
8
+ edges?: boolean;
9
+ spaces?: boolean;
10
+ top?: boolean;
11
+ middle?: boolean;
12
+ bottom?: boolean;
13
+ };
14
+ events: {
15
+ [evt: string]: CustomEvent<any>;
16
+ };
17
+ slots: {
18
+ default: {};
19
+ };
20
+ };
21
+ export declare type RowProps = typeof __propDef.props;
22
+ export declare type RowEvents = typeof __propDef.events;
23
+ export declare type RowSlots = typeof __propDef.slots;
24
+ export default class Row extends SvelteComponentTyped<RowProps, RowEvents, RowSlots> {
25
+ }
26
+ export {};
@@ -0,0 +1,2 @@
1
+ export { default as Col } from './Col.svelte';
2
+ export { default as Row } from './Row.svelte';
@@ -0,0 +1,2 @@
1
+ export { default as Col } from './Col.svelte';
2
+ export { default as Row } from './Row.svelte';
@@ -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/index.d.ts CHANGED
@@ -19,4 +19,5 @@ import CopyButton from './components/CopyButton.svelte';
19
19
  import Skeleton from './components/Skeleton.svelte';
20
20
  import { Carousel, CarouselItem } from './components/Carousel';
21
21
  import Hero from './components/Hero.svelte';
22
- export { Button, Alert, Badge, Breadcrumb, Navbar, Modal, Tabs, Tab, Form, Input, Select, Radio, Checkbox, Switch, Slider, Article, Card, Collapsible, Popover, Progress, Table, Pagination, Toast, CloseButton, CopyButton, Skeleton, Carousel, CarouselItem, Hero, };
22
+ import { Col, Row } from './components/Layout';
23
+ export { Button, Alert, Badge, Breadcrumb, Navbar, Modal, Tabs, Tab, Form, Input, Select, Radio, Checkbox, Switch, Slider, Article, Card, Collapsible, Popover, Progress, Table, Pagination, Toast, CloseButton, CopyButton, Skeleton, Carousel, CarouselItem, Hero, Col, Row, };
package/index.js CHANGED
@@ -19,4 +19,5 @@ import CopyButton from './components/CopyButton.svelte';
19
19
  import Skeleton from './components/Skeleton.svelte';
20
20
  import { Carousel, CarouselItem } from './components/Carousel';
21
21
  import Hero from './components/Hero.svelte';
22
- export { Button, Alert, Badge, Breadcrumb, Navbar, Modal, Tabs, Tab, Form, Input, Select, Radio, Checkbox, Switch, Slider, Article, Card, Collapsible, Popover, Progress, Table, Pagination, Toast, CloseButton, CopyButton, Skeleton, Carousel, CarouselItem, Hero, };
22
+ import { Col, Row } from './components/Layout';
23
+ export { Button, Alert, Badge, Breadcrumb, Navbar, Modal, Tabs, Tab, Form, Input, Select, Radio, Checkbox, Switch, Slider, Article, Card, Collapsible, Popover, Progress, Table, Pagination, Toast, CloseButton, CopyButton, Skeleton, Carousel, CarouselItem, Hero, Col, Row, };
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "papercss",
9
9
  "components"
10
10
  ],
11
- "version": "1.1.1",
11
+ "version": "1.3.0",
12
12
  "repository": {
13
13
  "type": "git",
14
14
  "url": "git+https://github.com/Oli8/spaper.git"
@@ -46,6 +46,9 @@
46
46
  "./components/Form": "./components/Form/index.js",
47
47
  "./components/Form/style.scss": "./components/Form/style.scss",
48
48
  "./components/Hero.svelte": "./components/Hero.svelte",
49
+ "./components/Layout/Col.svelte": "./components/Layout/Col.svelte",
50
+ "./components/Layout/Row.svelte": "./components/Layout/Row.svelte",
51
+ "./components/Layout": "./components/Layout/index.js",
49
52
  "./components/Modal/Modal.svelte": "./components/Modal/Modal.svelte",
50
53
  "./components/Modal": "./components/Modal/index.js",
51
54
  "./components/Navbar.svelte": "./components/Navbar.svelte",
@@ -67,6 +70,7 @@
67
70
  "./components/Toast": "./components/Toast/index.js",
68
71
  "./components/style.scss": "./components/style.scss",
69
72
  ".": "./index.js",
73
+ "./types": "./types.js",
70
74
  "./utils": "./utils.js"
71
75
  },
72
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 {};
package/utils.js CHANGED
@@ -4,6 +4,10 @@ const propToClass = {
4
4
  block: (pf, _val) => `${pf}-block`,
5
5
  type: (pf, val) => `${pf}-${val}`,
6
6
  outline: (pf, val) => `${pf}-${val}-outline`,
7
+ col: (pf, val) => `${pf}-${val}`,
8
+ sm: (_pf, val) => `sm-${val}`,
9
+ md: (_pf, val) => `md-${val}`,
10
+ lg: (_pf, val) => `lg-${val}`,
7
11
  };
8
12
  function omit(obj, properties) {
9
13
  return Object.fromEntries(Object.entries(obj)