hamzus-ui 0.0.42 → 0.0.44

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/index.d.ts CHANGED
@@ -22,6 +22,9 @@ export { default as TextArea } from "./src/components/hamzus-ui/TextArea/TextAre
22
22
  export { default as Checkbox } from "./src/components/hamzus-ui/Checkboxes/Checkbox/Checkbox.svelte"
23
23
  export { default as Switch } from "./src/components/hamzus-ui/Switch/Switch.svelte"
24
24
 
25
+ // navigation
26
+ export * as Tabs from "./src/components/hamzus-ui/Tabs"
27
+
25
28
  // data
26
29
  export * as Table from "./src/components/hamzus-ui/Table"
27
30
  export { default as ProgressCircle } from "./src/components/hamzus-ui/ProgressCircle/ProgressCircle.svelte"
@@ -32,6 +35,7 @@ export * as Popover from "./src/components/hamzus-ui/Popover";
32
35
  export * as Tooltip from "./src/components/hamzus-ui/AdvancedTooltip";
33
36
 
34
37
  // layout
38
+ export { default as ScrollArea } from "./src/components/hamzus-ui/ScrollArea/ScrollArea.svelte"
35
39
  export * as Sidebar from "./src/layout/Sidebar"
36
40
 
37
41
  // utils
package/index.js CHANGED
@@ -17,6 +17,10 @@ export { default as DatePicker } from "./src/components/hamzus-ui/DatePicker/Dat
17
17
  export { default as TextArea } from "./src/components/hamzus-ui/TextArea/TextArea.svelte"
18
18
  export { default as Checkbox } from "./src/components/hamzus-ui/Checkboxes/Checkbox/Checkbox.svelte"
19
19
  export { default as Switch } from "./src/components/hamzus-ui/Switch/Switch.svelte"
20
+
21
+ // navigation
22
+ export * as Tabs from "./src/components/hamzus-ui/Tabs"
23
+
20
24
  // data
21
25
  export * as Table from "./src/components/hamzus-ui/Table"
22
26
  export { default as ProgressCircle } from "./src/components/hamzus-ui/ProgressCircle/ProgressCircle.svelte"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hamzus-ui",
3
- "version": "0.0.42",
3
+ "version": "0.0.44",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "svelte": "index.js",
@@ -13,7 +13,7 @@
13
13
  flex-direction: column;
14
14
  row-gap: var(--pad-m);
15
15
  padding: var(--pad-m) var(--pad-l);
16
- background-color: var(--bg-2);
16
+ background-color: var(--bg-1);
17
17
  border-radius: var(--radius-l);
18
18
  border: 1px solid var(--bg-3);
19
19
  width: min(100vw, var(--width));
@@ -0,0 +1,11 @@
1
+ <script>
2
+ import {activeTab} from "."
3
+
4
+ export let value = ""
5
+
6
+
7
+ </script>
8
+
9
+ {#if $activeTab === value}
10
+ <slot/>
11
+ {/if}
@@ -0,0 +1 @@
1
+ <slot/>
@@ -1,25 +1,31 @@
1
1
  <script>
2
- export let links = [];
3
-
4
- let activeStyle = 'color:var(--font-1);background-color:var(--bg-2);';
5
-
6
2
  import TinyScrollArea from '../TinyScrollArea/TinyScrollArea.svelte';
7
3
  import Button from '../Button/Button.svelte';
8
4
 
9
5
  import { page } from '$app/stores';
10
- import TabButton from './TabButton.svelte';
6
+ import { activeTrigger, activeTab } from '.';
7
+ import { onMount } from 'svelte';
8
+
9
+ export let links = [];
10
+ export let value = '';
11
11
 
12
12
  let activeButton = null;
13
13
 
14
14
  let left = 0;
15
15
  let width = 0;
16
16
 
17
- $: if (activeButton) {
17
+ $: if ($activeTrigger) {
18
+ console.log($activeTrigger);
19
+
18
20
  // return
19
- left = activeButton.offsetLeft;
20
- width = activeButton.offsetWidth;
21
+ left = $activeTrigger.offsetLeft;
22
+ width = $activeTrigger.offsetWidth;
21
23
  }
22
24
 
25
+ onMount(() => {
26
+ activeTab.set(value);
27
+ });
28
+
23
29
  function handleClick(link) {
24
30
  if (link.onClick != undefined) {
25
31
  link.onClick(link);
@@ -29,44 +35,11 @@
29
35
 
30
36
  <TinyScrollArea style="display: flex;" proximity={0}>
31
37
  <div class="tabs" style="--left:{left}px;--width:{width}px;">
32
- {#each links as link}
33
- {#if link.label}
34
- <!-- {#if link.active}
35
- <div bind:this={activeButton} class="active">
36
- <Button
37
- variant="ghost"
38
- style="flex-shrink:0;{link.active ? activeStyle : ''}"
39
- label={link.label}
40
- onClick={() => {
41
- handleClick(link);
42
- }}
43
- ></Button>
44
- </div>
45
- {:else}
46
- <Button
47
- variant="ghost"
48
- style="flex-shrink:0;{link.active ? activeStyle : ''}"
49
- label={link.label}
50
- onClick={() => {
51
- handleClick(link);
52
- }}
53
- ></Button>
54
- {/if} -->
55
- <TabButton
56
- bind:activeButton
57
- link={link}
58
- variant="ghost"
59
- style="flex-shrink:0;{link.active ? activeStyle : ''}"
60
- label={link.label}
61
- onClick={() => {
62
- handleClick(link);
63
- }}
64
- ></TabButton>
65
- <span class="active-line"></span>
66
- {/if}
67
- {/each}
38
+ <slot name="list"/>
39
+ <span class="active-line"></span>
68
40
  </div>
69
41
  </TinyScrollArea>
42
+ <slot/>
70
43
 
71
44
  <style>
72
45
  .tabs {
@@ -0,0 +1,36 @@
1
+ <script>
2
+ import Button from '../Button/Button.svelte';
3
+ import { onMount } from 'svelte';
4
+ import {activeTrigger, activeTab} from "."
5
+
6
+ export let value = "";
7
+ export let variant = 'ghost';
8
+ export let label = '';
9
+
10
+ let activeStyle = 'color:var(--font-1);background-color:var(--bg-2);';
11
+ let el;
12
+
13
+
14
+
15
+ $: if ($activeTab === value) {
16
+ activeTrigger.set(el)
17
+
18
+ }
19
+
20
+ function handleClick() {
21
+ activeTab.set(value)
22
+ }
23
+ </script>
24
+
25
+ <div bind:this={el} class="active">
26
+ <Button {variant} style={`flex-shrink:0;${$activeTab === value ? activeStyle : ''}`} {label} onClick={handleClick} {...$$restProps}>
27
+ <slot/>
28
+ </Button>
29
+ </div>
30
+
31
+ <style>
32
+ .active {
33
+ all: unset;
34
+ min-width: max-content;
35
+ }
36
+ </style>
@@ -0,0 +1,9 @@
1
+ import { writable } from 'svelte/store';
2
+
3
+ export { default as Root } from './Root.svelte';
4
+ export { default as List } from './List.svelte';
5
+ export { default as Trigger } from './Trigger.svelte';
6
+ export { default as Content } from './Content.svelte';
7
+
8
+ export const activeTab = writable(null)
9
+ export const activeTrigger = writable(null)
@@ -1,34 +0,0 @@
1
- <script>
2
- import Button from '../Button/Button.svelte';
3
- import { onMount } from 'svelte';
4
- export let activeButton = null;
5
- export let link = null;
6
- export let variant = 'ghost';
7
- export let style = "flex-shrink:0;{link.active ? activeStyle : ''}";
8
- export let label = 'exemple';
9
- export let onClick = (link) => {};
10
-
11
- let el;
12
-
13
- onMount(() => {
14
- if (link.active) {
15
- activeButton = el;
16
- }
17
- });
18
-
19
- function handleClick() {
20
- activeButton = el;
21
- onClick(link);
22
- }
23
- </script>
24
-
25
- <div bind:this={el} class="active">
26
- <Button {variant} {style} {label} onClick={handleClick} />
27
- </div>
28
-
29
- <style>
30
- .active {
31
- all: unset;
32
- min-width: max-content;
33
- }
34
- </style>