flowbite-svelte 0.21.17 → 0.22.2

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/CHANGELOG.md CHANGED
@@ -2,6 +2,38 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.22.2](https://github.com/themesberg/flowbite-svelte/compare/v0.22.1...v0.22.2) (2022-07-21)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * update for [#165](https://github.com/themesberg/flowbite-svelte/issues/165) and [#170](https://github.com/themesberg/flowbite-svelte/issues/170) ([ff43f26](https://github.com/themesberg/flowbite-svelte/commit/ff43f265b163d2c3ac7a145772e18a95326c0651))
11
+
12
+ ### [0.22.1](https://github.com/themesberg/flowbite-svelte/compare/v0.22.0...v0.22.1) (2022-07-20)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * buttons redesign ([c0316ff](https://github.com/themesberg/flowbite-svelte/commit/c0316ff61fde6bf52166e3f0c0b30dacad4941c0))
18
+ * typo ([4479464](https://github.com/themesberg/flowbite-svelte/commit/4479464736800552c1c05ce6b793459e8df6ef7f))
19
+
20
+ ## [0.22.0](https://github.com/themesberg/flowbite-svelte/compare/v0.21.17...v0.22.0) (2022-07-20)
21
+
22
+
23
+ ### ⚠ BREAKING CHANGES
24
+
25
+ * update dependencies and vite. script dev, build preview and test work
26
+
27
+ ### Features
28
+
29
+ * update dependencies and vite. script dev, build preview and test work ([bf1b837](https://github.com/themesberg/flowbite-svelte/commit/bf1b83788d7f3ec53c2d5e5c85a825606cbce38f))
30
+
31
+
32
+ ### Bug Fixes
33
+
34
+ * update all dependencies ([d7ae979](https://github.com/themesberg/flowbite-svelte/commit/d7ae979973ba092f36236fe877b98314a0328a42))
35
+ * update package.json ([a77e3e5](https://github.com/themesberg/flowbite-svelte/commit/a77e3e57f58ac95dda547cc9a410a2aaa4559fe8))
36
+
5
37
  ### [0.21.17](https://github.com/themesberg/flowbite-svelte/compare/v0.21.16...v0.21.17) (2022-07-20)
6
38
 
7
39
 
@@ -1,4 +1,10 @@
1
- <script>import Radio from './Radio.svelte';
1
+ <script>import Radio, { labelClass, inputClass } from './Radio.svelte';
2
+ import Label from './Label.svelte';
3
+ // properties forwarding
4
+ export let color = 'blue';
5
+ export let custom = false;
6
+ export let inline = false;
7
+ export let tinted = false;
2
8
  export let group = [];
3
9
  export let value = '';
4
10
  export let checked = undefined;
@@ -22,23 +28,15 @@ $: {
22
28
  }
23
29
  }
24
30
  }
25
- let inputClass; // get the value from the underlying Radio
26
- // properties forwarding
27
- export let custom = false;
28
- export let color = 'blue';
29
- export let inline = false;
30
- export let tinted = false;
31
31
  </script>
32
32
 
33
- <Radio class={$$restProps.class} bind:inputClass {color} {custom} {inline} {tinted}>
33
+ <Label class={labelClass(inline, $$restProps.class)} show={!!$$slots.default}>
34
34
  <input
35
- on:click
36
- slot="input"
37
35
  type="checkbox"
38
36
  bind:checked
37
+ on:click
39
38
  {value}
40
39
  {...$$restProps}
41
- class="rounded {inputClass}"
42
- />
43
- <slot />
44
- </Radio>
40
+ class={inputClass(custom, color, true, tinted, $$slots.default || $$restProps.class)}
41
+ /><slot />
42
+ </Label>
@@ -3,13 +3,13 @@ import type { FormColorType } from '../types';
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  [x: string]: any;
6
- group?: string[];
7
- value?: string;
8
- checked?: boolean;
9
- custom?: boolean;
10
6
  color?: FormColorType;
7
+ custom?: boolean;
11
8
  inline?: boolean;
12
9
  tinted?: boolean;
10
+ group?: string[];
11
+ value?: string;
12
+ checked?: boolean;
13
13
  };
14
14
  events: {
15
15
  click: MouseEvent;
@@ -72,6 +72,8 @@ function setType(node) {
72
72
  {id}
73
73
  {...$$restProps}
74
74
  bind:value
75
+ on:change
76
+ on:blur
75
77
  bind:this={ref}
76
78
  use:setType
77
79
  placeholder=" "
@@ -13,6 +13,9 @@ declare const __propDef: {
13
13
  ref?: HTMLElement;
14
14
  };
15
15
  events: {
16
+ change: Event;
17
+ blur: FocusEvent;
18
+ } & {
16
19
  [evt: string]: CustomEvent<any>;
17
20
  };
18
21
  slots: {};
@@ -1,15 +1,26 @@
1
1
  <script>import classNames from 'classnames';
2
2
  export let color = 'gray';
3
- export let labelClass = 'text-sm font-medium';
3
+ export let defaultClass = 'text-sm font-medium';
4
+ export let show = true; // helper for inheritance
5
+ let node;
4
6
  const colorClasses = {
5
7
  gray: 'text-gray-900 dark:text-gray-300',
6
8
  green: 'text-green-700 dark:text-green-500',
7
9
  red: 'text-red-700 dark:text-red-500',
8
10
  disabled: 'text-gray-400 dark:text-gray-500'
9
11
  };
12
+ // function checkDisabled(node: HTMLLabelElement) {
13
+ $: {
14
+ const control = node?.control;
15
+ color = control?.disabled ? 'disabled' : color;
16
+ }
17
+ let labelClass;
18
+ $: labelClass = classNames(defaultClass, colorClasses[color], $$props.class);
10
19
  </script>
11
20
 
12
- <!-- svelte-ignore a11y-label-has-associated-control -->
13
- <label {...$$restProps} class={classNames(labelClass, colorClasses[color], $$props.class)}>
21
+ {#if show}
22
+ <!-- svelte-ignore a11y-label-has-associated-control -->
23
+ <label bind:this={node} {...$$restProps} class={labelClass}><slot /></label>
24
+ {:else}
14
25
  <slot />
15
- </label>
26
+ {/if}
@@ -3,7 +3,8 @@ declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
5
  color?: 'gray' | 'green' | 'red' | 'disabled';
6
- labelClass?: string;
6
+ defaultClass?: string;
7
+ show?: boolean;
7
8
  };
8
9
  events: {
9
10
  [evt: string]: CustomEvent<any>;
@@ -1,50 +1,47 @@
1
- <script>/* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Label
1
+ <script context="module">
2
+ // this part is shared between Radio and Checkbox
3
+ import classNames from 'classnames';
2
4
 
3
- To associate the <label> with an <input> element, you need to give the <input> an id attribute.
4
- The <label> then needs a for attribute whose value is the same as the input's id.
5
+ const colorClasses = {
6
+ red: 'text-red-600 focus:ring-red-500 dark:focus:ring-red-600',
7
+ green: 'text-green-600 focus:ring-green-500 dark:focus:ring-green-600',
8
+ purple: 'text-purple-600 focus:ring-purple-500 dark:focus:ring-purple-600',
9
+ teal: 'text-teal-600 focus:ring-teal-500 dark:focus:ring-teal-600',
10
+ yellow: 'text-yellow-400 focus:ring-yellow-500 dark:focus:ring-yellow-600',
11
+ orange: 'text-orange-500 focus:ring-orange-500 dark:focus:ring-orange-600',
12
+ blue: 'text-blue-600 focus:ring-blue-500 dark:focus:ring-blue-600'
13
+ };
5
14
 
6
- Alternatively, you can nest the <input> directly inside the <label>, in which case the for and
7
- id attributes are not needed because the association is implicit:
15
+ export const labelClass = (inline, extraClass) =>
16
+ classNames(inline ? 'inline-flex' : 'flex', 'items-center', extraClass);
8
17
 
9
- <label>Do you like peas?
10
- <input type="checkbox" name="peas">
11
- </label>
18
+ export const inputClass = (custom, color, rounded, tinted, extraClass) =>
19
+ classNames(
20
+ 'w-4 h-4 bg-gray-100 border-gray-300 dark:ring-offset-gray-800 focus:ring-2 mr-2',
21
+ tinted ? 'dark:bg-gray-600 dark:border-gray-500' : 'dark:bg-gray-700 dark:border-gray-600',
22
+ custom && 'sr-only peer',
23
+ rounded && 'rounded',
24
+ colorClasses[color],
25
+ extraClass
26
+ );
27
+ </script>
12
28
 
13
- */
14
- import classNames from 'classnames';
29
+ <script>import Label from './Label.svelte';
15
30
  export let color = 'blue';
16
31
  export let custom = false;
17
32
  export let inline = false;
18
33
  export let tinted = false;
19
34
  export let group = '';
20
35
  export let value = '';
21
- export let inputClass;
22
- $: inputClass = classNames('w-4 h-4 bg-gray-100 border-gray-300 dark:ring-offset-gray-800 focus:ring-2 mr-2', tinted ? 'dark:bg-gray-600 dark:border-gray-500' : 'dark:bg-gray-700 dark:border-gray-600', custom && 'sr-only peer', colorClasses[color]);
23
- let colorLabel = 'gray';
24
- $: colorLabel = $$restProps.disabled ? 'disabled' : colorLabel;
25
- let labelClass;
26
- $: labelClass = classNames(inline ? 'inline-flex' : 'flex', 'items-center text-sm font-medium', colorClassesLabel[colorLabel], $$restProps.class);
27
- const colorClassesLabel = {
28
- gray: 'text-gray-900 dark:text-gray-300',
29
- green: 'text-green-700 dark:text-green-500',
30
- red: 'text-red-700 dark:text-red-500',
31
- disabled: 'text-gray-400 dark:text-gray-500'
32
- };
33
- const colorClasses = {
34
- red: 'text-red-600 focus:ring-red-500 dark:focus:ring-red-600',
35
- green: 'text-green-600 focus:ring-green-500 dark:focus:ring-green-600',
36
- purple: 'text-purple-600 focus:ring-purple-500 dark:focus:ring-purple-600',
37
- teal: 'text-teal-600 focus:ring-teal-500 dark:focus:ring-teal-600',
38
- yellow: 'text-yellow-400 focus:ring-yellow-500 dark:focus:ring-yellow-600',
39
- orange: 'text-orange-500 focus:ring-orange-500 dark:focus:ring-orange-600',
40
- blue: 'text-blue-600 focus:ring-blue-500 dark:focus:ring-blue-600'
41
- };
42
36
  </script>
43
37
 
44
- <!-- svelte-ignore a11y-label-has-associated-control -->
45
- <label class={labelClass}>
46
- <slot name="input">
47
- <input on:click type="radio" bind:group {value} {...$$restProps} class={inputClass} />
48
- </slot>
49
- <slot />
50
- </label>
38
+ <Label class={labelClass(inline, $$restProps.class)} show={!!$$slots.default}>
39
+ <input
40
+ type="radio"
41
+ bind:group
42
+ on:click
43
+ {value}
44
+ {...$$restProps}
45
+ class={inputClass(custom, color, false, tinted, $$slots.default || $$restProps.class)}
46
+ /><slot />
47
+ </Label>
@@ -1,4 +1,6 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
+ export declare const labelClass: (inline: any, extraClass: any) => string;
3
+ export declare const inputClass: (custom: any, color: any, rounded: any, tinted: any, extraClass: any) => string;
2
4
  import type { FormColorType } from '../types';
3
5
  declare const __propDef: {
4
6
  props: {
@@ -9,7 +11,6 @@ declare const __propDef: {
9
11
  tinted?: boolean;
10
12
  group?: number | string;
11
13
  value?: string;
12
- inputClass: string;
13
14
  };
14
15
  events: {
15
16
  click: MouseEvent;
@@ -17,7 +18,6 @@ declare const __propDef: {
17
18
  [evt: string]: CustomEvent<any>;
18
19
  };
19
20
  slots: {
20
- input: {};
21
21
  default: {};
22
22
  };
23
23
  };
@@ -1,6 +1,7 @@
1
1
  <script>import classNames from 'classnames';
2
2
  import Checkbox from './Checkbox.svelte';
3
3
  export let size = 'default';
4
+ export let value = '';
4
5
  const common = "mr-3 bg-gray-200 rounded-full peer-focus:ring-4 dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:bg-white after:border-gray-300 after:border after:rounded-full after:transition-all dark:border-gray-600";
5
6
  const colors = {
6
7
  red: 'peer-focus:ring-red-300 dark:peer-focus:ring-red-800 peer-checked:bg-red-600',
@@ -18,7 +19,7 @@ const sizes = {
18
19
  };
19
20
  </script>
20
21
 
21
- <Checkbox on:click custom class="relative {$$restProps.class}" {...$$restProps}>
22
+ <Checkbox custom class="relative {$$props.class}" {value} {...$$restProps} on:click>
22
23
  <div class={classNames(common, colors[$$restProps.color ?? 'blue'], sizes[size])} />
23
24
  <slot />
24
25
  </Checkbox>
@@ -3,6 +3,7 @@ declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
5
  size?: 'small' | 'default' | 'large';
6
+ value?: string | number;
6
7
  };
7
8
  events: {
8
9
  click: MouseEvent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowbite-svelte",
3
- "version": "0.21.17",
3
+ "version": "0.22.2",
4
4
  "description": "Flowbite components for Svelte",
5
5
  "main": "index.js",
6
6
  "author": {
@@ -12,30 +12,31 @@
12
12
  "homepage": "https://flowbite-svelte.com/",
13
13
  "license": "MIT",
14
14
  "devDependencies": {
15
- "@playwright/test": "^1.21.0",
15
+ "@playwright/test": "^1.23.4",
16
16
  "@sveltejs/adapter-auto": "next",
17
17
  "@sveltejs/kit": "next",
18
- "@typescript-eslint/eslint-plugin": "^5.10.1",
19
- "@typescript-eslint/parser": "^5.10.1",
18
+ "@typescript-eslint/eslint-plugin": "^5.30.7",
19
+ "@typescript-eslint/parser": "^5.30.7",
20
20
  "autoprefixer": "^10.4.4",
21
21
  "createprops": "^0.4.4",
22
- "eslint": "^7.32.0",
23
- "eslint-config-prettier": "^8.3.0",
24
- "eslint-plugin-svelte3": "^3.2.1",
25
- "mdsvex": "^0.10.5",
26
- "postcss": "^8.4.12",
27
- "postcss-load-config": "^3.1.4",
28
- "prettier": "^2.5.1",
29
- "prettier-plugin-svelte": "^2.5.0",
22
+ "eslint": "^8.20.0",
23
+ "eslint-config-prettier": "^8.5.0",
24
+ "eslint-plugin-svelte3": "^4.0.0",
25
+ "mdsvex": "^0.10.6",
26
+ "postcss": "^8.4.14",
27
+ "postcss-load-config": "3.1.4",
28
+ "prettier": "^2.7.1",
29
+ "prettier-plugin-svelte": "^2.7.0",
30
30
  "prism-themes": "^1.9.0",
31
31
  "svelte": "^3.47.0",
32
- "svelte-check": "^2.2.6",
33
- "svelte-preprocess": "^4.10.5",
32
+ "svelte-check": "^2.8.0",
33
+ "svelte-preprocess": "^4.10.7",
34
34
  "svelte-sidebar-menu": "^0.8.4",
35
- "svelte2tsx": "^0.5.9",
36
- "tailwindcss": "^3.0.23",
35
+ "svelte2tsx": "^0.5.11",
36
+ "tailwindcss": "^3.1.6",
37
37
  "tslib": "^2.3.1",
38
- "typescript": "~4.6.2"
38
+ "typescript": "~4.7.4",
39
+ "vite": "^3.0.2"
39
40
  },
40
41
  "type": "module",
41
42
  "keywords": [