fancy-ui-ts 1.1.1 → 1.2.0

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/index.css CHANGED
@@ -129,6 +129,9 @@
129
129
  --fc-error-fg: var(--fc-danger-300);
130
130
  --fc-error-max-width: fit-content;
131
131
  --fc-error-font-size: var(--fc-font-size-sm);
132
+ --fc-label-font-size: var(--fc-font-size-md);
133
+ --fc-label-font-weight: var(--fc-font-weight-bold);
134
+ --fc-label-fg: var(--fc-gray-900);
132
135
  }
133
136
 
134
137
  /* src/styles/themes/fc-theme-light.css */
@@ -180,6 +183,9 @@
180
183
  --fc-input-radius: var(--fc-radius-md);
181
184
  --fc-input-shadow: var(--fc-shadow-none);
182
185
  --fc-error-fg: var(--fc-danger-300);
186
+ --fc-label-font-size: var(--fc-font-size-md);
187
+ --fc-label-font-weight: var(--fc-font-weight-bold);
188
+ --fc-label-fg: var(--fc-gray-900);
183
189
  }
184
190
 
185
191
  /* src/styles/themes/fc-theme-dark.css */
@@ -231,4 +237,7 @@
231
237
  --fc-input-radius: var(--fc-radius-md);
232
238
  --fc-input-shadow: var(--fc-shadow-none);
233
239
  --fc-error-fg: var(--fc-danger-700);
240
+ --fc-label-font-size: var(--fc-font-size-md);
241
+ --fc-label-font-weight: var(--fc-font-weight-bold);
242
+ --fc-label-fg: var(--fc-gray-200);
234
243
  }
package/dist/index.d.ts CHANGED
@@ -168,6 +168,20 @@ declare class FcError extends HTMLElement {
168
168
 
169
169
  declare const defineError: () => typeof FcError;
170
170
 
171
+ declare class FcLabel extends HTMLElement {
172
+ static get observedAttributes(): string[];
173
+ constructor();
174
+ connectedCallback(): void;
175
+ disconnectedCallback(): void;
176
+ attributeChangedCallback(name: string, _oldVal: string, newVal: string): void;
177
+ get htmlFor(): string;
178
+ set htmlFor(val: string);
179
+ private onClick;
180
+ setProps(props: Record<string, any>): void;
181
+ }
182
+
183
+ declare const defineLabel: () => typeof FcLabel;
184
+
171
185
  declare const defineAll: () => void;
172
186
 
173
- export { FcCombobox, FcError, FcInput, FcOption, defineAll, defineCombobox, defineError, defineInput, defineOption };
187
+ export { FcCombobox, FcError, FcInput, FcLabel, FcOption, defineAll, defineCombobox, defineError, defineInput, defineLabel, defineOption };
package/dist/index.js CHANGED
@@ -410,7 +410,8 @@ var FcCombobox = class extends HTMLElement {
410
410
  if (!foundMatch && this.inputEl.value === "") {
411
411
  this.inputEl.value = this._value;
412
412
  options.forEach(option => {
413
- const match = option.label.includes(this._value);
413
+ console.log(option.value);
414
+ const match = option.label.toLowerCase().includes(this._value.toLowerCase());
414
415
  option.hidden = !match;
415
416
  });
416
417
  }
@@ -1252,11 +1253,77 @@ var defineError = () => {
1252
1253
  return FcError;
1253
1254
  };
1254
1255
 
1256
+ var styles5 = `\n :host {\n display: block;\n width: 100%;\n box-sizing: border-box;\n font-family: var(--fc-font-family, inherit);\n font-size: var(--fc-label-font-size);\n font-weight: var(--fc-label-font-weight);\n color: var(--fc-label-fg);\n cursor: pointer;\n line-height: 1.5;\n }\n\n :host([hidden]) {\n display: none !important;\n }\n\n .fc-label-text {\n display: flex;\n align-items: center;\n }\n`;
1257
+
1258
+ var template5 = document.createElement("template");
1259
+
1260
+ template5.innerHTML = `\n <style>${styles5}</style>\n <div class="fc-label-text" part="text">\n <slot></slot>\n </div>\n`;
1261
+
1262
+ var FcLabel = class extends HTMLElement {
1263
+ static get observedAttributes() {
1264
+ return [ "for" ];
1265
+ }
1266
+ constructor() {
1267
+ super();
1268
+ const shadow = this.attachShadow({
1269
+ mode: "open"
1270
+ });
1271
+ shadow.appendChild(template5.content.cloneNode(true));
1272
+ this.onClick = this.onClick.bind(this);
1273
+ }
1274
+ connectedCallback() {
1275
+ this.addEventListener("click", this.onClick);
1276
+ }
1277
+ disconnectedCallback() {
1278
+ this.removeEventListener("click", this.onClick);
1279
+ }
1280
+ attributeChangedCallback(name, _oldVal, newVal) {}
1281
+ get htmlFor() {
1282
+ var _a;
1283
+ return (_a = this.getAttribute("for")) != null ? _a : "";
1284
+ }
1285
+ set htmlFor(val) {
1286
+ this.setAttribute("for", val);
1287
+ }
1288
+ onClick(e) {
1289
+ e.preventDefault();
1290
+ const targetId = this.getAttribute("for");
1291
+ if (!targetId) {
1292
+ return;
1293
+ }
1294
+ const targetEl = document.getElementById(targetId);
1295
+ if (targetEl) {
1296
+ targetEl.focus();
1297
+ targetEl.click();
1298
+ }
1299
+ }
1300
+ setProps(props) {
1301
+ for (const property in props) {
1302
+ const value = props[property];
1303
+ if (property in this) {
1304
+ this[property] = value;
1305
+ continue;
1306
+ }
1307
+ if ([ "string", "number", "boolean" ].includes(typeof value)) {
1308
+ this.setAttribute(property, String(value));
1309
+ }
1310
+ }
1311
+ }
1312
+ };
1313
+
1314
+ var defineLabel = () => {
1315
+ if (!customElements.get("fc-label")) {
1316
+ customElements.define("fc-label", FcLabel);
1317
+ }
1318
+ return FcLabel;
1319
+ };
1320
+
1255
1321
  var defineAll = () => {
1256
1322
  defineCombobox();
1257
1323
  defineOption();
1258
1324
  defineInput();
1259
1325
  defineError();
1326
+ defineLabel();
1260
1327
  };
1261
1328
 
1262
- export { FcCombobox, FcError, FcInput, FcOption, defineAll, defineCombobox, defineError, defineInput, defineOption };
1329
+ export { FcCombobox, FcError, FcInput, FcLabel, FcOption, defineAll, defineCombobox, defineError, defineInput, defineLabel, defineOption };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fancy-ui-ts",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "type": "module",
5
5
  "description": "A library to easily create cool and customizable webcomponents.",
6
6
  "main": "dist/index.js",
@@ -26,6 +26,20 @@
26
26
  "build": "tsup",
27
27
  "build:watch": "tsup --watch"
28
28
  },
29
+ "keywords": [
30
+ "web-components",
31
+ "components",
32
+ "custom-elements",
33
+ "typescript",
34
+ "ui-library",
35
+ "design-system",
36
+ "combobox",
37
+ "input",
38
+ "label",
39
+ "html",
40
+ "react",
41
+ "vue"
42
+ ],
29
43
  "author": "Luan Peixoto",
30
44
  "license": "MIT",
31
45
  "devDependencies": {