lithesome 0.2.1 → 0.2.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.
@@ -11,7 +11,7 @@ let {
11
11
  use = [],
12
12
  class: klass,
13
13
  self,
14
- value,
14
+ value = [],
15
15
  disabled = false,
16
16
  type = "text",
17
17
  placeholder = "\u25CB",
@@ -18,7 +18,7 @@ declare const __propDef: {
18
18
  props: BaseProps<HTMLDivElement, {
19
19
  filled: boolean;
20
20
  }> & {
21
- value: string[];
21
+ value?: string[] | undefined;
22
22
  disabled?: boolean | undefined;
23
23
  type?: "text" | "password" | undefined;
24
24
  placeholder?: string | undefined;
@@ -6,7 +6,7 @@ import {
6
6
  KEYS
7
7
  } from "../../internal/index.js";
8
8
  import { onMount, tick } from "svelte";
9
- let { class: klass, use = [], self, name, onKeydown, onInput, onFocus, onBlur, ...props } = $props();
9
+ let { class: klass, use = [], self, onKeydown, onInput, onFocus, onBlur, ...props } = $props();
10
10
  let value = $state("");
11
11
  const API = context();
12
12
  const { uid } = createUID("input");
@@ -100,7 +100,6 @@ const moveFocus = (direction) => {
100
100
  bind:value
101
101
  id={uid()}
102
102
  class={classProp}
103
- {name}
104
103
  disabled={API.disabled}
105
104
  placeholder={focused ? '' : API.placeholder}
106
105
  data-pininput=""
@@ -5,8 +5,6 @@ declare const __propDef: {
5
5
  filled: boolean;
6
6
  disabled: boolean;
7
7
  }>, "children"> & {
8
- /** The HTML Input element name attribute. */
9
- name?: string | undefined;
10
8
  onKeydown?: Handler<KeyboardEvent, HTMLInputElement> | undefined;
11
9
  onInput?: Handler<Event, HTMLInputElement> | undefined;
12
10
  onFocus?: Handler<FocusEvent, HTMLInputElement> | undefined;
@@ -13,7 +13,7 @@ const API = createContext(uid, visible, {
13
13
  visible = val;
14
14
  }
15
15
  });
16
- const classProp = $derived(typeof klass === "function" ? klass({}) : klass);
16
+ const classProp = $derived(typeof klass === "function" ? klass({ visible: API.visible }) : klass);
17
17
  setContext(contextName, API);
18
18
  const handleKeys = (e) => {
19
19
  const { key } = e;
@@ -32,6 +32,14 @@ $effect(() => {
32
32
  });
33
33
  </script>
34
34
 
35
- <div bind:this={self} use:useActions={use} id={uid()} class={classProp} data-popover="" {...props}>
36
- {@render children({})}
35
+ <div
36
+ bind:this={self}
37
+ use:useActions={use}
38
+ id={uid()}
39
+ class={classProp}
40
+ data-popover=""
41
+ data-state={API.visible ? 'opened' : 'closed'}
42
+ {...props}
43
+ >
44
+ {@render children({ visible: API.visible })}
37
45
  </div>
@@ -12,7 +12,9 @@ export declare const context: () => {
12
12
  };
13
13
  import { type BaseProps } from '../../internal/index.js';
14
14
  declare const __propDef: {
15
- props: BaseProps<HTMLDivElement, any> & {
15
+ props: BaseProps<HTMLDivElement, {
16
+ visible: boolean;
17
+ }> & {
16
18
  visible?: boolean | undefined;
17
19
  };
18
20
  events: {
@@ -12,6 +12,7 @@ export const createContext = (uid, value, hooks) => {
12
12
  },
13
13
  navigateItems(action) {
14
14
  selectedIndex = calculateIndex(action, items, selectedIndex);
15
+ document.querySelector(`[data-radiogroupitem][data-value="${selectedItem.value}"]`)?.focus();
15
16
  },
16
17
  setSelected(item) {
17
18
  selectedIndex = items.findIndex((el) => el.value === item.value);
@@ -1,6 +1,6 @@
1
1
  <script>import { context } from "./Select.svelte";
2
2
  import { useActions } from "../../internal/index.js";
3
- let { class: klass, use = [], self, placeholder, ...props } = $props();
3
+ let { class: klass, use = [], self, placeholder = "Select an option...", ...props } = $props();
4
4
  const API = context();
5
5
  const placeholderVisible = $derived(API.selectedOptions.length === 0);
6
6
  const classProp = $derived(typeof klass === "function" ? klass({ placeholderVisible }) : klass);
@@ -12,7 +12,7 @@ const API = createContext(uid, {
12
12
  orientation,
13
13
  value
14
14
  });
15
- const classProp = $derived(typeof klass === "function" ? klass({}) : klass);
15
+ const classProp = $derived(typeof klass === "function" ? klass({ active: API.activeTab }) : klass);
16
16
  setContext(contextName, API);
17
17
  $effect(() => {
18
18
  API.setOrientation(orientation);
@@ -26,7 +26,8 @@ $effect(() => {
26
26
  class={classProp}
27
27
  data-tabs=""
28
28
  data-orientation={orientation}
29
+ data-active={API.activeTab}
29
30
  {...props}
30
31
  >
31
- {@render children({})}
32
+ {@render children({ active: API.activeTab })}
32
33
  </div>
@@ -11,7 +11,9 @@ export declare const context: () => {
11
11
  };
12
12
  import { type BaseProps } from '../../internal/index.js';
13
13
  declare const __propDef: {
14
- props: BaseProps<HTMLDivElement, any> & {
14
+ props: BaseProps<HTMLDivElement, {
15
+ active: string;
16
+ }> & {
15
17
  orientation?: "horizontal" | "vertical" | undefined;
16
18
  value?: string | undefined;
17
19
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lithesome",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/Gibbu/lithesome.git"