@okaapp/oka-ui-sv 0.1.1 → 0.1.3

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.
@@ -10,8 +10,9 @@
10
10
  } = $props();
11
11
 
12
12
  const iconSizes = {
13
- md: 24,
14
- sm: 16,
13
+ lg: 24,
14
+ md: 16,
15
+ sm: 12,
15
16
  };
16
17
  </script>
17
18
 
@@ -15,18 +15,24 @@
15
15
  }
16
16
 
17
17
  /* Sizes */
18
- .badge--md {
18
+ .badge--lg {
19
19
  padding: 8px 12px;
20
20
  border-radius: 12px;
21
21
  font-size: 16px;
22
22
  }
23
23
 
24
- .badge--sm {
24
+ .badge--md {
25
25
  padding: 6px 8px;
26
26
  border-radius: 8px;
27
27
  font-size: 14px;
28
28
  }
29
29
 
30
+ .badge--sm {
31
+ padding: 4px 6px;
32
+ border-radius: 6px;
33
+ font-size: 12px;
34
+ }
35
+
30
36
  /* Colors */
31
37
  .badge--success {
32
38
  color: var(--content-success);
@@ -19,6 +19,8 @@
19
19
 
20
20
  const sizes = {
21
21
  lg: "height: 48px; padding: 12px; font-size: 16px;",
22
+ md: "height: 40px; padding: 8px; font-size: 16px;",
23
+ sm: "height: 36px; padding: 6px; font-size: 14px;",
22
24
  };
23
25
  </script>
24
26
 
@@ -8,12 +8,13 @@
8
8
  import Checkbox from "../checkbox/Checkbox.svelte";
9
9
 
10
10
  let {
11
+ value = $bindable([]),
11
12
  items = [] as SelectItem[],
12
13
  placeholder = "Chọn ở đây",
13
14
  ...props
14
15
  } = $props();
15
16
 
16
- let value = $state<string[]>([]);
17
+ // let value = $state<string[]>([]);
17
18
  const selectedLabel = $derived(
18
19
  value.length > 0 ? `Đã chọn ${value.length}` : placeholder,
19
20
  );
@@ -36,7 +37,7 @@
36
37
  <CaretDown class="select-trigger-icon" />
37
38
  </Select.Trigger>
38
39
  <Select.Portal>
39
- <Select.Content class="select-content" sideOffset={8}>
40
+ <Select.Content class="select-content" sideOffset={12}>
40
41
  <Select.ScrollUpButton class="select-scroll-button">
41
42
  <CaretDoubleUp class="select-scroll-button-icon" />
42
43
  </Select.ScrollUpButton>
@@ -1,8 +1,9 @@
1
1
  import "./select.css";
2
2
  import type { SelectItem } from "./Types.js";
3
3
  declare const MultiSelect: import("svelte").Component<{
4
+ value?: any[];
4
5
  items?: SelectItem[];
5
6
  placeholder?: string;
6
- } & Record<string, any>, {}, "">;
7
+ } & Record<string, any>, {}, "value">;
7
8
  type MultiSelect = ReturnType<typeof MultiSelect>;
8
9
  export default MultiSelect;
@@ -8,12 +8,14 @@
8
8
  import CaretDoubleDown from "phosphor-svelte/lib/CaretDoubleDown";
9
9
 
10
10
  let {
11
+ value = $bindable(),
11
12
  items = [] as SelectItem[],
12
13
  placeholder = "Chọn ở đây",
14
+ class: className,
13
15
  ...props
14
16
  } = $props();
15
17
 
16
- let value = $state<string>("");
18
+ // let value = $state<string>("");
17
19
  const selectedLabel = $derived(
18
20
  value ? items.find((item) => item.value === value)?.label : placeholder,
19
21
  );
@@ -26,14 +28,14 @@
26
28
  {...props}
27
29
  >
28
30
  <Select.Trigger
29
- class="select-trigger focus-override"
31
+ class={`select-trigger focus-override`}
30
32
  aria-label="Chọn ở đây"
31
33
  >
32
34
  <span class="select-trigger-text">{selectedLabel}</span>
33
35
  <CaretDown class="select-trigger-icon" />
34
36
  </Select.Trigger>
35
37
  <Select.Portal>
36
- <Select.Content class="select-content" sideOffset={8}>
38
+ <Select.Content class="select-content" sideOffset={12}>
37
39
  <Select.ScrollUpButton class="select-scroll-button">
38
40
  <CaretDoubleUp class="select-scroll-button-icon" />
39
41
  </Select.ScrollUpButton>
@@ -1,8 +1,10 @@
1
1
  import "./select.css";
2
2
  import type { SelectItem } from "./Types.js";
3
3
  declare const SingleSelect: import("svelte").Component<{
4
+ value?: any;
4
5
  items?: SelectItem[];
5
6
  placeholder?: string;
6
- } & Record<string, any>, {}, "">;
7
+ class: any;
8
+ } & Record<string, any>, {}, "value">;
7
9
  type SingleSelect = ReturnType<typeof SingleSelect>;
8
10
  export default SingleSelect;
@@ -11,17 +11,14 @@
11
11
 
12
12
  let { items, class: className }: Props = $props();
13
13
 
14
- let activeItem = $state(page.url.pathname);
15
- $effect(() => {
16
- activeItem = page.url.pathname;
17
- });
14
+ let currentRoute = $derived(page.url.pathname);
18
15
  </script>
19
16
 
20
17
  <div class={`${className} sidebar`}>
21
18
  {#each items as i}
22
19
  <a
23
20
  href={i.Route}
24
- class={`sidebar-item ${i.Route === activeItem ? "sidebar-item--active" : "sidebar-item--inactive"}`}
21
+ class={`sidebar-item ${currentRoute === i.Route || (currentRoute + "/").startsWith(i.Route + "/") ? "sidebar-item--active" : "sidebar-item--inactive"}`}
25
22
  >
26
23
  {#if i.Icon}
27
24
  <IconContext
@@ -638,7 +638,6 @@ button {
638
638
  cursor: pointer;
639
639
  font: inherit;
640
640
  line-height: inherit;
641
- padding: 0;
642
641
  }
643
642
 
644
643
  button:focus {
@@ -679,7 +678,6 @@ th:not(.table-override) {
679
678
 
680
679
  td:not(.table-override) {
681
680
  height: 64px;
682
- background: var(--surface-primary);
683
681
  color: var(--content-primary);
684
682
  overflow: hidden;
685
683
  padding: 8px 16px 8px 16px;
@@ -29,7 +29,7 @@
29
29
  <span class="theme-switcher__label">Giao diện</span>
30
30
  </Select.Trigger>
31
31
  <Select.Portal>
32
- <Select.Content class="theme-content" sideOffset={8}>
32
+ <Select.Content class="theme-content" sideOffset={12}>
33
33
  <Select.ScrollUpButton class="theme-scroll-button">
34
34
  <CaretDoubleUp class="theme-scroll-button__icon" />
35
35
  </Select.ScrollUpButton>
@@ -76,23 +76,6 @@
76
76
  animation: content-out 300ms ease;
77
77
  }
78
78
 
79
- /* Position adjustments */
80
- .theme-content[data-side="bottom"] {
81
- transform: translateY(4px);
82
- }
83
-
84
- .theme-content[data-side="left"] {
85
- transform: translateX(-4px);
86
- }
87
-
88
- .theme-content[data-side="right"] {
89
- transform: translateX(4px);
90
- }
91
-
92
- .theme-content[data-side="top"] {
93
- transform: translateY(-4px);
94
- }
95
-
96
79
  /* Viewport styles */
97
80
  .theme-viewport {
98
81
  display: flex;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okaapp/oka-ui-sv",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "OKA UI Svelte components library for the Appta software platform",
5
5
  "license": "MIT",
6
6
  "scripts": {