drab 2.8.5 → 2.8.6
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/dist/components/Editor.svelte +2 -2
- package/dist/components/Editor.svelte.d.ts +2 -2
- package/dist/components/Sheet.svelte +1 -1
- package/dist/components/Sheet.svelte.d.ts +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/package.json +1 -2
- package/dist/components/Tabs.svelte +0 -103
- package/dist/components/Tabs.svelte.d.ts +0 -112
@@ -80,10 +80,10 @@ export type EditorSlots = typeof __propDef.slots;
|
|
80
80
|
* icon: "Bullet",
|
81
81
|
* },
|
82
82
|
* {
|
83
|
-
* name: "
|
83
|
+
* name: "Italic",
|
84
84
|
* text: "*",
|
85
85
|
* display: "wrap",
|
86
|
-
* icon: "
|
86
|
+
* icon: "Italic",
|
87
87
|
* key: "i",
|
88
88
|
* class: "italic",
|
89
89
|
* },
|
package/dist/index.d.ts
CHANGED
@@ -9,6 +9,5 @@ import FullscreenButton from "./components/FullscreenButton.svelte";
|
|
9
9
|
import Popover from "./components/Popover.svelte";
|
10
10
|
import ShareButton from "./components/ShareButton.svelte";
|
11
11
|
import Sheet from "./components/Sheet.svelte";
|
12
|
-
import Tabs from "./components/Tabs.svelte";
|
13
12
|
import YouTube from "./components/YouTube.svelte";
|
14
|
-
export { Breakpoint, Chord, ContextMenu, CopyButton, DataTable, Details, Editor, FullscreenButton, Popover, ShareButton, Sheet,
|
13
|
+
export { Breakpoint, Chord, ContextMenu, CopyButton, DataTable, Details, Editor, FullscreenButton, Popover, ShareButton, Sheet, YouTube, };
|
package/dist/index.js
CHANGED
@@ -9,6 +9,5 @@ import FullscreenButton from "./components/FullscreenButton.svelte";
|
|
9
9
|
import Popover from "./components/Popover.svelte";
|
10
10
|
import ShareButton from "./components/ShareButton.svelte";
|
11
11
|
import Sheet from "./components/Sheet.svelte";
|
12
|
-
import Tabs from "./components/Tabs.svelte";
|
13
12
|
import YouTube from "./components/YouTube.svelte";
|
14
|
-
export { Breakpoint, Chord, ContextMenu, CopyButton, DataTable, Details, Editor, FullscreenButton, Popover, ShareButton, Sheet,
|
13
|
+
export { Breakpoint, Chord, ContextMenu, CopyButton, DataTable, Details, Editor, FullscreenButton, Popover, ShareButton, Sheet, YouTube, };
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "drab",
|
3
|
-
"version": "2.8.
|
3
|
+
"version": "2.8.6",
|
4
4
|
"description": "An unstyled Svelte component library",
|
5
5
|
"keywords": [
|
6
6
|
"components",
|
@@ -17,7 +17,6 @@
|
|
17
17
|
"Popover",
|
18
18
|
"Share",
|
19
19
|
"Sheet",
|
20
|
-
"Tabs",
|
21
20
|
"YouTube"
|
22
21
|
],
|
23
22
|
"homepage": "https://drab.robino.dev",
|
@@ -1,103 +0,0 @@
|
|
1
|
-
<!--
|
2
|
-
@component
|
3
|
-
|
4
|
-
### Tabs
|
5
|
-
|
6
|
-
Displays tabs and the selected tab's content.
|
7
|
-
|
8
|
-
@props
|
9
|
-
|
10
|
-
- `classTabList` - class of the `div` that wraps the `button`s
|
11
|
-
- `classTab` - class of all tab `button`s
|
12
|
-
- `class`
|
13
|
-
- `data` - provides the content for each tab
|
14
|
-
- `id`
|
15
|
-
- `indexSelected` - index of selected tab, defaults to `0`
|
16
|
-
|
17
|
-
@slots
|
18
|
-
|
19
|
-
| name | purpose | default value | slot props |
|
20
|
-
| ---------- | -------------------- | --------------- | --------------------------------------- |
|
21
|
-
| `tab` | title of each tab | `item.tab` | `item`, `index`, `selectedIndex`, `tab` |
|
22
|
-
| `tabPanel` | selected tab's panel | `item.tabPanel` | `item`, `index` |
|
23
|
-
|
24
|
-
@example
|
25
|
-
|
26
|
-
```svelte
|
27
|
-
<script lang="ts">
|
28
|
-
import { Tabs, FullscreenButton } from "drab";
|
29
|
-
</script>
|
30
|
-
|
31
|
-
<Tabs
|
32
|
-
data={[
|
33
|
-
{ tab: "Tab", tabPanel: "Content" },
|
34
|
-
{
|
35
|
-
tab: "Another Tab",
|
36
|
-
tabPanel: "Some more content",
|
37
|
-
component: FullscreenButton,
|
38
|
-
},
|
39
|
-
]}
|
40
|
-
classTabList="grid grid-flow-col grid-rows-1 gap-1 rounded-md bg-neutral-200 p-1"
|
41
|
-
>
|
42
|
-
<svelte:fragment slot="tab" let:item let:index let:indexSelected>
|
43
|
-
<div
|
44
|
-
class="btn btn-s {index === indexSelected
|
45
|
-
? 'bg-white text-neutral-950 shadow'
|
46
|
-
: 'bg-neutral-200 text-neutral-600'}"
|
47
|
-
>
|
48
|
-
{item.tab}
|
49
|
-
</div>
|
50
|
-
</svelte:fragment>
|
51
|
-
<svelte:fragment slot="tabPanel" let:item>
|
52
|
-
<div class="py-2">
|
53
|
-
<div>{item.tabPanel}</div>
|
54
|
-
{#if item.component}
|
55
|
-
<svelte:component this={item.component} class="btn mt-2" />
|
56
|
-
{/if}
|
57
|
-
</div>
|
58
|
-
</svelte:fragment>
|
59
|
-
</Tabs>
|
60
|
-
```
|
61
|
-
-->
|
62
|
-
|
63
|
-
<script>import { onMount } from "svelte";
|
64
|
-
let className = "";
|
65
|
-
export { className as class };
|
66
|
-
export let id = "";
|
67
|
-
export let classTabList = "";
|
68
|
-
export let classTab = "";
|
69
|
-
export let data;
|
70
|
-
export let indexSelected = 0;
|
71
|
-
let clientJs = false;
|
72
|
-
const idPanel = "tabPanel-" + Math.random().toString().substring(2, 8);
|
73
|
-
onMount(() => clientJs = true);
|
74
|
-
</script>
|
75
|
-
|
76
|
-
<div class={className} {id}>
|
77
|
-
<div class={classTabList} role="tablist">
|
78
|
-
{#each data as item, index}
|
79
|
-
<button
|
80
|
-
role="tab"
|
81
|
-
tabindex={index === indexSelected ? 0 : -1}
|
82
|
-
aria-selected={index === indexSelected}
|
83
|
-
aria-controls={idPanel}
|
84
|
-
disabled={!clientJs}
|
85
|
-
class={classTab}
|
86
|
-
on:click={() => (indexSelected = index)}
|
87
|
-
>
|
88
|
-
<slot name="tab" {item} {index} {indexSelected} tab={item.tab}>
|
89
|
-
{item.tab}
|
90
|
-
</slot>
|
91
|
-
</button>
|
92
|
-
{/each}
|
93
|
-
</div>
|
94
|
-
{#each data as item, index}
|
95
|
-
{#if index === indexSelected}
|
96
|
-
<div role="tabpanel" id={idPanel}>
|
97
|
-
<slot name="tabPanel" {item} {index}>
|
98
|
-
{item.tabPanel}
|
99
|
-
</slot>
|
100
|
-
</div>
|
101
|
-
{/if}
|
102
|
-
{/each}
|
103
|
-
</div>
|
@@ -1,112 +0,0 @@
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
2
|
-
declare const __propDef: {
|
3
|
-
props: {
|
4
|
-
class?: string | undefined;
|
5
|
-
id?: string | undefined;
|
6
|
-
/** class of the `div` that wraps the `button`s */ classTabList?: string | undefined;
|
7
|
-
/** class of all tab `button`s */ classTab?: string | undefined;
|
8
|
-
/** provides the content for each tab */ data: {
|
9
|
-
[key: string]: any;
|
10
|
-
[key: number]: any;
|
11
|
-
/** tab title, displayed in `button` element */
|
12
|
-
tab?: string | undefined;
|
13
|
-
/** slotted content, displayed once tab is clicked */
|
14
|
-
tabPanel?: string | undefined;
|
15
|
-
}[];
|
16
|
-
/** index of selected tab, defaults to `0` */ indexSelected?: number | undefined;
|
17
|
-
};
|
18
|
-
events: {
|
19
|
-
[evt: string]: CustomEvent<any>;
|
20
|
-
};
|
21
|
-
slots: {
|
22
|
-
tab: {
|
23
|
-
item: {
|
24
|
-
[key: string]: any;
|
25
|
-
[key: number]: any;
|
26
|
-
/** tab title, displayed in `button` element */
|
27
|
-
tab?: string | undefined;
|
28
|
-
/** slotted content, displayed once tab is clicked */
|
29
|
-
tabPanel?: string | undefined;
|
30
|
-
};
|
31
|
-
index: any;
|
32
|
-
indexSelected: number;
|
33
|
-
tab: string | undefined;
|
34
|
-
};
|
35
|
-
tabPanel: {
|
36
|
-
item: {
|
37
|
-
[key: string]: any;
|
38
|
-
[key: number]: any;
|
39
|
-
/** tab title, displayed in `button` element */
|
40
|
-
tab?: string | undefined;
|
41
|
-
/** slotted content, displayed once tab is clicked */
|
42
|
-
tabPanel?: string | undefined;
|
43
|
-
};
|
44
|
-
index: any;
|
45
|
-
};
|
46
|
-
};
|
47
|
-
};
|
48
|
-
export type TabsProps = typeof __propDef.props;
|
49
|
-
export type TabsEvents = typeof __propDef.events;
|
50
|
-
export type TabsSlots = typeof __propDef.slots;
|
51
|
-
/**
|
52
|
-
* ### Tabs
|
53
|
-
*
|
54
|
-
* Displays tabs and the selected tab's content.
|
55
|
-
*
|
56
|
-
* @props
|
57
|
-
*
|
58
|
-
* - `classTabList` - class of the `div` that wraps the `button`s
|
59
|
-
* - `classTab` - class of all tab `button`s
|
60
|
-
* - `class`
|
61
|
-
* - `data` - provides the content for each tab
|
62
|
-
* - `id`
|
63
|
-
* - `indexSelected` - index of selected tab, defaults to `0`
|
64
|
-
*
|
65
|
-
* @slots
|
66
|
-
*
|
67
|
-
* | name | purpose | default value | slot props |
|
68
|
-
* | ---------- | -------------------- | --------------- | --------------------------------------- |
|
69
|
-
* | `tab` | title of each tab | `item.tab` | `item`, `index`, `selectedIndex`, `tab` |
|
70
|
-
* | `tabPanel` | selected tab's panel | `item.tabPanel` | `item`, `index` |
|
71
|
-
*
|
72
|
-
* @example
|
73
|
-
*
|
74
|
-
* ```svelte
|
75
|
-
* <script lang="ts">
|
76
|
-
* import { Tabs, FullscreenButton } from "drab";
|
77
|
-
* </script>
|
78
|
-
*
|
79
|
-
* <Tabs
|
80
|
-
* data={[
|
81
|
-
* { tab: "Tab", tabPanel: "Content" },
|
82
|
-
* {
|
83
|
-
* tab: "Another Tab",
|
84
|
-
* tabPanel: "Some more content",
|
85
|
-
* component: FullscreenButton,
|
86
|
-
* },
|
87
|
-
* ]}
|
88
|
-
* classTabList="grid grid-flow-col grid-rows-1 gap-1 rounded-md bg-neutral-200 p-1"
|
89
|
-
* >
|
90
|
-
* <svelte:fragment slot="tab" let:item let:index let:indexSelected>
|
91
|
-
* <div
|
92
|
-
* class="btn btn-s {index === indexSelected
|
93
|
-
* ? 'bg-white text-neutral-950 shadow'
|
94
|
-
* : 'bg-neutral-200 text-neutral-600'}"
|
95
|
-
* >
|
96
|
-
* {item.tab}
|
97
|
-
* </div>
|
98
|
-
* </svelte:fragment>
|
99
|
-
* <svelte:fragment slot="tabPanel" let:item>
|
100
|
-
* <div class="py-2">
|
101
|
-
* <div>{item.tabPanel}</div>
|
102
|
-
* {#if item.component}
|
103
|
-
* <svelte:component this={item.component} class="btn mt-2" />
|
104
|
-
* {/if}
|
105
|
-
* </div>
|
106
|
-
* </svelte:fragment>
|
107
|
-
* </Tabs>
|
108
|
-
* ```
|
109
|
-
*/
|
110
|
-
export default class Tabs extends SvelteComponent<TabsProps, TabsEvents, TabsSlots> {
|
111
|
-
}
|
112
|
-
export {};
|