flowbite-svelte 0.15.8 → 0.15.9

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,13 @@
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.15.9](https://github.com/themesberg/flowbite-svelte/compare/v0.15.8...v0.15.9) (2022-04-30)
6
+
7
+
8
+ ### Features
9
+
10
+ * add color and size to Toggle component ([6595bb3](https://github.com/themesberg/flowbite-svelte/commit/6595bb38d95ae42862d134fee979ae97b66ab911))
11
+
5
12
  ### [0.15.8](https://github.com/themesberg/flowbite-svelte/compare/v0.15.7...v0.15.8) (2022-04-29)
6
13
 
7
14
 
@@ -1,16 +1,47 @@
1
1
  <script>import generateId from '../utils/generateId.js';
2
2
  export let name = 'toggle-example';
3
+ export let color;
4
+ export let size = 'default';
3
5
  export let id = generateId();
4
6
  export let label = 'Toggle me';
7
+ export let value;
5
8
  export let checked = false;
6
9
  export let disabled = false;
7
- export let labelClass = 'flex relative items-center mb-4 cursor-pointer';
10
+ export let labelClass = 'relative inline-flex items-center cursor-pointer';
8
11
  export let divClass = 'w-11 h-6 bg-gray-200 rounded-full border border-gray-200 toggle-bg dark:bg-gray-700 dark:border-gray-600';
12
+ export let inputClass = 'sr-only';
13
+ if (color || size) {
14
+ inputClass += ' peer';
15
+ }
9
16
  export let spanClass = 'ml-3 text-sm font-medium text-gray-900 dark:text-gray-300';
17
+ if (color === 'red') {
18
+ divClass = "w-11 h-6 bg-gray-200 rounded-full peer peer-focus:ring-4 peer-focus:ring-red-300 dark:peer-focus:ring-red-800 dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-red-600";
19
+ }
20
+ else if (color === 'green') {
21
+ divClass = "w-11 h-6 bg-gray-200 rounded-full peer dark:bg-gray-700 peer-focus:ring-4 peer-focus:ring-green-300 dark:peer-focus:ring-green-800 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-green-600";
22
+ }
23
+ else if (color === 'purple') {
24
+ divClass = "w-11 h-6 bg-gray-200 rounded-full peer dark:bg-gray-700 peer-focus:ring-4 peer-focus:ring-purple-300 dark:peer-focus:ring-purple-800 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-purple-600";
25
+ }
26
+ else if (color === 'yellow') {
27
+ divClass = "w-11 h-6 bg-gray-200 rounded-full peer dark:bg-gray-700 peer-focus:ring-4 peer-focus:ring-yellow-300 dark:peer-focus:ring-yellow-800 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-yellow-400";
28
+ }
29
+ else if (color === 'teal') {
30
+ divClass = "w-11 h-6 bg-gray-200 rounded-full peer dark:bg-gray-700 peer-focus:ring-4 peer-focus:ring-teal-300 dark:peer-focus:ring-teal-800 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-teal-600";
31
+ }
32
+ else if (color === 'orange') {
33
+ divClass = "w-11 h-6 bg-gray-200 rounded-full peer dark:bg-gray-700 peer-focus:ring-4 peer-focus:ring-orange-300 dark:peer-focus:ring-orange-800 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-orange-500";
34
+ }
35
+ else if (size === 'small') {
36
+ divClass = "w-9 h-5 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600";
37
+ }
38
+ else if (size === 'large') {
39
+ divClass = "w-14 h-7 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[4px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-6 after:w-6 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600";
40
+ }
10
41
  </script>
11
42
 
12
43
  <label for={id} class={labelClass}>
13
- <input type="checkbox" {id} class="sr-only" {checked} {name} {disabled} />
14
- <div class={divClass} />
44
+ <input type="checkbox" {id} class={inputClass} {value} {checked} {name} {disabled} />
45
+ <div class="{divClass} {$$props.class}" />
15
46
  <span class={spanClass}>{label}</span>
16
47
  </label>
@@ -1,13 +1,19 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
+ import type { ToggleColorType } from '../types.js';
2
3
  declare const __propDef: {
3
4
  props: {
5
+ [x: string]: any;
4
6
  name?: string;
7
+ color: ToggleColorType;
8
+ size?: 'small' | 'default' | 'large';
5
9
  id?: string;
6
10
  label?: string;
11
+ value: string;
7
12
  checked?: boolean;
8
13
  disabled?: boolean;
9
14
  labelClass?: string;
10
15
  divClass?: string;
16
+ inputClass?: string;
11
17
  spanClass?: string;
12
18
  };
13
19
  events: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowbite-svelte",
3
- "version": "0.15.8",
3
+ "version": "0.15.9",
4
4
  "description": "Flowbite components for Svelte",
5
5
  "main": "./package/index.js",
6
6
  "author": {
package/types.d.ts CHANGED
@@ -196,6 +196,7 @@ export interface TimelineItemHorizontalType {
196
196
  iconClass?: string;
197
197
  text?: HTMLElement | string;
198
198
  }
199
+ export declare type ToggleColorType = 'red' | 'green' | 'purple' | 'yellow' | 'teal' | 'orange';
199
200
  export interface TransitionParamTypes {
200
201
  delay?: number;
201
202
  duration?: number;