@waggylabs/yumekit 0.3.0 → 0.3.1

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.
@@ -7,10 +7,19 @@ export class YumeSelect extends HTMLElement {
7
7
  connectedCallback(): void;
8
8
  disconnectedCallback(): void;
9
9
  attributeChangedCallback(name: any, oldValue: any, newValue: any): void;
10
+ _value: any;
10
11
  set value(val: string);
11
12
  /** @type {string} The current selected value, or comma-separated values when multiple. */
12
13
  get value(): string;
13
- _value: string;
14
+ set options(val: Array<{
15
+ value: string;
16
+ label: string;
17
+ }>);
18
+ /** @type {Array<{value: string, label: string}>} The options array for the select. */
19
+ get options(): Array<{
20
+ value: string;
21
+ label: string;
22
+ }>;
14
23
  /**
15
24
  * Returns the parsed options array from the "options" attribute.
16
25
  * @returns {Array<{value: string, label: string}>}
@@ -65,6 +65,13 @@ class YumeSelect extends HTMLElement {
65
65
  if (oldValue === newValue) return;
66
66
 
67
67
  if (name === "value") {
68
+ if (this.hasAttribute("multiple")) {
69
+ this.selectedValues = new Set(
70
+ (newValue || "").split(",").map((v) => v.trim()).filter(Boolean),
71
+ );
72
+ } else {
73
+ this._value = newValue || "";
74
+ }
68
75
  this.updateDisplay();
69
76
  this._internals.setFormValue(newValue, this.getAttribute("name"));
70
77
  this.updateSelectedStyles();
@@ -116,11 +123,8 @@ class YumeSelect extends HTMLElement {
116
123
  this.updateSelectedStyles();
117
124
  }
118
125
 
119
- /**
120
- * Returns the parsed options array from the "options" attribute.
121
- * @returns {Array<{value: string, label: string}>}
122
- */
123
- getOptions() {
126
+ /** @type {Array<{value: string, label: string}>} The options array for the select. */
127
+ get options() {
124
128
  try {
125
129
  return JSON.parse(this.getAttribute("options") || "[]");
126
130
  } catch (e) {
@@ -128,6 +132,18 @@ class YumeSelect extends HTMLElement {
128
132
  }
129
133
  }
130
134
 
135
+ set options(val) {
136
+ this.setAttribute("options", JSON.stringify(val));
137
+ }
138
+
139
+ /**
140
+ * Returns the parsed options array from the "options" attribute.
141
+ * @returns {Array<{value: string, label: string}>}
142
+ */
143
+ getOptions() {
144
+ return this.options;
145
+ }
146
+
131
147
  /**
132
148
  * Returns the display text for the current selection.
133
149
  * @returns {string}
package/dist/index.js CHANGED
@@ -5007,6 +5007,13 @@ class YumeSelect extends HTMLElement {
5007
5007
  if (oldValue === newValue) return;
5008
5008
 
5009
5009
  if (name === "value") {
5010
+ if (this.hasAttribute("multiple")) {
5011
+ this.selectedValues = new Set(
5012
+ (newValue || "").split(",").map((v) => v.trim()).filter(Boolean),
5013
+ );
5014
+ } else {
5015
+ this._value = newValue || "";
5016
+ }
5010
5017
  this.updateDisplay();
5011
5018
  this._internals.setFormValue(newValue, this.getAttribute("name"));
5012
5019
  this.updateSelectedStyles();
@@ -5058,11 +5065,8 @@ class YumeSelect extends HTMLElement {
5058
5065
  this.updateSelectedStyles();
5059
5066
  }
5060
5067
 
5061
- /**
5062
- * Returns the parsed options array from the "options" attribute.
5063
- * @returns {Array<{value: string, label: string}>}
5064
- */
5065
- getOptions() {
5068
+ /** @type {Array<{value: string, label: string}>} The options array for the select. */
5069
+ get options() {
5066
5070
  try {
5067
5071
  return JSON.parse(this.getAttribute("options") || "[]");
5068
5072
  } catch (e) {
@@ -5070,6 +5074,18 @@ class YumeSelect extends HTMLElement {
5070
5074
  }
5071
5075
  }
5072
5076
 
5077
+ set options(val) {
5078
+ this.setAttribute("options", JSON.stringify(val));
5079
+ }
5080
+
5081
+ /**
5082
+ * Returns the parsed options array from the "options" attribute.
5083
+ * @returns {Array<{value: string, label: string}>}
5084
+ */
5085
+ getOptions() {
5086
+ return this.options;
5087
+ }
5088
+
5073
5089
  /**
5074
5090
  * Returns the display text for the current selection.
5075
5091
  * @returns {string}
package/dist/react.d.ts CHANGED
@@ -16,12 +16,14 @@ declare module "react" {
16
16
  size?: "small" | "medium" | "large";
17
17
  "menu-direction"?: "right" | "down" | "";
18
18
  sticky?: "start" | "end";
19
+ "mobile-breakpoint"?: string | number;
19
20
  }>;
20
21
  "y-avatar": El<{
21
22
  src?: string;
22
23
  alt?: string;
23
24
  size?: "small" | "medium" | "large";
24
25
  shape?: string;
26
+ color?: string;
25
27
  }>;
26
28
  "y-badge": El<{
27
29
  value?: string;
@@ -62,13 +64,23 @@ declare module "react" {
62
64
  disabled?: boolean | string;
63
65
  indeterminate?: boolean | string;
64
66
  "label-position"?: "top" | "bottom" | "left" | "right";
65
- color?: string;
66
- size?: string;
67
67
  }>;
68
68
  "y-dialog": El<{
69
69
  visible?: boolean | string;
70
70
  anchor?: string;
71
71
  closable?: boolean | string;
72
+ "show-backdrop"?: boolean | string;
73
+ animate?: boolean | string;
74
+ position?:
75
+ | "center"
76
+ | "top-left"
77
+ | "top-center"
78
+ | "top-right"
79
+ | "left"
80
+ | "right"
81
+ | "bottom-left"
82
+ | "bottom-center"
83
+ | "bottom-right";
72
84
  }>;
73
85
  "y-drawer": El<{
74
86
  visible?: boolean | string;
@@ -87,14 +99,10 @@ declare module "react" {
87
99
  type?: string;
88
100
  name?: string;
89
101
  value?: string;
90
- placeholder?: string;
91
102
  disabled?: boolean | string;
92
103
  invalid?: boolean | string;
93
- required?: boolean | string;
94
- color?: string;
95
104
  size?: "small" | "medium" | "large";
96
- label?: string;
97
- "label-position"?: string;
105
+ "label-position"?: "top" | "bottom";
98
106
  }>;
99
107
  "y-menu": El<{
100
108
  items?: string;
@@ -129,22 +137,19 @@ declare module "react" {
129
137
  value?: string;
130
138
  options?: string;
131
139
  disabled?: boolean | string;
132
- color?: string;
133
- size?: string;
134
140
  }>;
135
141
  "y-select": El<{
136
142
  name?: string;
137
143
  value?: string;
138
144
  disabled?: boolean | string;
139
145
  multiple?: boolean | string;
140
- color?: string;
141
- size?: string;
146
+ size?: "small" | "medium" | "large";
142
147
  placeholder?: string;
143
148
  options?: string;
144
149
  invalid?: boolean | string;
145
150
  required?: boolean | string;
146
- "label-position"?: string;
147
- "display-mode"?: string;
151
+ "label-position"?: "top" | "bottom";
152
+ "display-mode"?: "tag";
148
153
  "close-on-click-outside"?: string;
149
154
  }>;
150
155
  "y-slider": El<{
@@ -163,7 +168,7 @@ declare module "react" {
163
168
  value?: string;
164
169
  checked?: boolean | string;
165
170
  disabled?: boolean | string;
166
- animate?: string;
171
+ animate?: boolean | string;
167
172
  "toggle-label"?: boolean | string;
168
173
  "label-position"?: "top" | "bottom" | "left" | "right";
169
174
  color?: string;
@@ -189,8 +194,7 @@ declare module "react" {
189
194
  }>;
190
195
  "y-theme": El<{
191
196
  theme?: string;
192
- mode?: "light" | "dark";
193
- "theme-path"?: string;
197
+ "cross-origin"?: boolean | string;
194
198
  }>;
195
199
  "y-toast": El<{
196
200
  position?: