@spectric/ui 0.0.6 → 0.0.7

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.
Files changed (85) hide show
  1. package/dist/components/input.d.ts +3 -1
  2. package/dist/components/query_bar/QueryBar.d.ts +2 -3
  3. package/dist/custom-elements.json +2 -2
  4. package/dist/index.es.js +15 -14
  5. package/dist/index.es.js.map +1 -1
  6. package/dist/index.umd.js +16 -16
  7. package/dist/index.umd.js.map +1 -1
  8. package/package.json +2 -2
  9. package/src/components/input.ts +19 -2
  10. package/src/components/query_bar/QueryBar.ts +7 -21
  11. package/src/stories/QueryBar.stories.ts +7 -0
  12. package/src/stories/fixtures/data.ts +3 -0
  13. package/dist/assets/Banner-CZ3qKIQC.js +0 -172
  14. package/dist/assets/Banner.stories-BMf4MBpI.js +0 -19
  15. package/dist/assets/BitDisplay.stories-wztXxpxe.js +0 -18
  16. package/dist/assets/Bits-C_TSTjST.js +0 -1
  17. package/dist/assets/Button.stories-gHxjWwVf.js +0 -142
  18. package/dist/assets/Color-F6OSRLHC-AjFOL-zN.js +0 -1
  19. package/dist/assets/DocsRenderer-CFRXHY34-CvW79YxE.js +0 -761
  20. package/dist/assets/Header.stories-Bc09U6g1.js +0 -25
  21. package/dist/assets/Page.stories-DNJKhAFs.js +0 -114
  22. package/dist/assets/QueryBar.stories-Da5C-SV4.js +0 -17
  23. package/dist/assets/_commonjsHelpers-Cpj98o6Y.js +0 -1
  24. package/dist/assets/chunk-L4EGOTBX-AI5g0G5Z.js +0 -2
  25. package/dist/assets/data-CwENMT7L.js +0 -3
  26. package/dist/assets/dialog-CFHXbUTQ.js +0 -611
  27. package/dist/assets/directive-helpers-IbK5tOA8.js +0 -5
  28. package/dist/assets/entry-preview-Di-j0SPB.js +0 -4
  29. package/dist/assets/entry-preview-docs-CUBRpM7y.js +0 -1
  30. package/dist/assets/iframe-BQFuVTVZ.js +0 -2
  31. package/dist/assets/index-BCiKWbv6.js +0 -1
  32. package/dist/assets/index-BHYIh-Xd.js +0 -8
  33. package/dist/assets/index-DBGhiA-l.js +0 -1
  34. package/dist/assets/index-DrFu-skq.js +0 -6
  35. package/dist/assets/index-oFsFREWh.js +0 -9
  36. package/dist/assets/input.stories-Cgdv-5bN.js +0 -58
  37. package/dist/assets/lit-element-UdLzEcH-.js +0 -19
  38. package/dist/assets/preview-BWzBA1C2.js +0 -396
  39. package/dist/assets/preview-CGiTbRot.js +0 -2
  40. package/dist/assets/preview-D77C14du.js +0 -34
  41. package/dist/assets/preview-DEMzn_yN.js +0 -1
  42. package/dist/assets/preview-DFmD0pui.js +0 -1
  43. package/dist/assets/preview-DGUiP6tS.js +0 -7
  44. package/dist/assets/preview-DQVTHjv1.js +0 -182
  45. package/dist/assets/preview-aVwhiz9X.js +0 -1
  46. package/dist/assets/tiny-invariant-CopsF_GD.js +0 -1
  47. package/dist/components/input.css.d.ts +0 -2
  48. package/dist/favicon.svg +0 -1
  49. package/dist/iframe.html +0 -639
  50. package/dist/index.html +0 -190
  51. package/dist/index.json +0 -1
  52. package/dist/nunito-sans-bold-italic.woff2 +0 -0
  53. package/dist/nunito-sans-bold.woff2 +0 -0
  54. package/dist/nunito-sans-italic.woff2 +0 -0
  55. package/dist/nunito-sans-regular.woff2 +0 -0
  56. package/dist/project.json +0 -1
  57. package/dist/sb-addons/chromatic-com-storybook-8/manager-bundle.js +0 -333
  58. package/dist/sb-addons/chromatic-com-storybook-8/manager-bundle.js.LEGAL.txt +0 -40
  59. package/dist/sb-addons/essentials-actions-2/manager-bundle.js +0 -3
  60. package/dist/sb-addons/essentials-actions-2/manager-bundle.js.LEGAL.txt +0 -0
  61. package/dist/sb-addons/essentials-backgrounds-3/manager-bundle.js +0 -12
  62. package/dist/sb-addons/essentials-backgrounds-3/manager-bundle.js.LEGAL.txt +0 -0
  63. package/dist/sb-addons/essentials-controls-1/manager-bundle.js +0 -391
  64. package/dist/sb-addons/essentials-controls-1/manager-bundle.js.LEGAL.txt +0 -0
  65. package/dist/sb-addons/essentials-measure-6/manager-bundle.js +0 -3
  66. package/dist/sb-addons/essentials-measure-6/manager-bundle.js.LEGAL.txt +0 -0
  67. package/dist/sb-addons/essentials-outline-7/manager-bundle.js +0 -3
  68. package/dist/sb-addons/essentials-outline-7/manager-bundle.js.LEGAL.txt +0 -0
  69. package/dist/sb-addons/essentials-toolbars-5/manager-bundle.js +0 -3
  70. package/dist/sb-addons/essentials-toolbars-5/manager-bundle.js.LEGAL.txt +0 -0
  71. package/dist/sb-addons/essentials-viewport-4/manager-bundle.js +0 -3
  72. package/dist/sb-addons/essentials-viewport-4/manager-bundle.js.LEGAL.txt +0 -0
  73. package/dist/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js +0 -3
  74. package/dist/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js.LEGAL.txt +0 -0
  75. package/dist/sb-common-assets/favicon.svg +0 -1
  76. package/dist/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
  77. package/dist/sb-common-assets/nunito-sans-bold.woff2 +0 -0
  78. package/dist/sb-common-assets/nunito-sans-italic.woff2 +0 -0
  79. package/dist/sb-common-assets/nunito-sans-regular.woff2 +0 -0
  80. package/dist/sb-manager/globals-module-info.js +0 -1028
  81. package/dist/sb-manager/globals-runtime.js +0 -40861
  82. package/dist/sb-manager/globals.js +0 -48
  83. package/dist/sb-manager/runtime.js +0 -13338
  84. package/dist/sb-preview/globals.js +0 -33
  85. package/dist/sb-preview/runtime.js +0 -7174
@@ -118,6 +118,8 @@ export declare class SpectricInput extends LitElement implements InputProps {
118
118
  */
119
119
  get value(): string | number | boolean;
120
120
  set value(value: string | number | boolean);
121
+ blur(): void;
122
+ focus(options?: FocusOptions): void;
121
123
  setSelectionRange(start: number, end: number, direction?: "forward" | "backward" | "none"): void;
122
124
  /**
123
125
  * Handles `oninput` event on the `<input>`.
@@ -126,7 +128,7 @@ export declare class SpectricInput extends LitElement implements InputProps {
126
128
  /**
127
129
  * The underlying input element
128
130
  */
129
- protected _input: HTMLInputElement;
131
+ protected _input?: HTMLInputElement;
130
132
  private handleTogglePasswordVisibility;
131
133
  protected render(): unknown;
132
134
  }
@@ -37,7 +37,7 @@ export interface IQueryProps {
37
37
  /**
38
38
  * The output of the query
39
39
  */
40
- value: string;
40
+ value?: string;
41
41
  /**
42
42
  * Fields that are used for the auto complete
43
43
  */
@@ -67,8 +67,7 @@ export declare class SpectricQuery extends LitElement implements IQueryProps {
67
67
  /**
68
68
  * The value of the input.
69
69
  */
70
- get value(): string;
71
- set value(value: string);
70
+ value: string;
72
71
  outputLanguage: SupportedLanguagesTypes;
73
72
  private completions;
74
73
  private completionIndex;
@@ -392,7 +392,7 @@
392
392
  },
393
393
  {
394
394
  "name": "spectric-input",
395
- "description": "Events:\n\n * `change` {`Event`} - \n\nAttributes:\n\n * `hidePasswordLabel` {`string`} - \"Hide password\" tooltip text on password visibility toggle\n\n * `showPasswordLabel` {`string`} - \"Show password\" tooltip text on password visibility toggle\n\n * `value` {`string | number | boolean`} - The value of the input.\n\n * `variant` {`\"number\" | \"text\" | \"text-area\" | \"color\" | \"date\" | \"datetime-local\" | \"email\" | \"file\" | \"hidden\" | \"password\"`} - Input type\n\n * `label` {`string`} - Label to display above the input\n\n * `placeholder` {`string`} - placeholder text to display\n\n * `disabled` {`boolean`} - \n\n * `readonly` {`boolean`} - \n\n * `helperText` {`string`} - The helper text.\n\n * `invalid` {`boolean`} - Specify if the currently value is invalid.\n\n * `invalidText` {`string | TemplateResult<1>`} - Message which is displayed if the value is invalid.\n\n * `maxCount` {`number`} - Max character count allowed for input. This is needed in order for enableCounter to display\n\n * `required` {`boolean`} - Boolean property to set the required status\n\n * `showPasswordVisibilityToggle` {`boolean`} - Boolean property to render password visibility toggle\n\n * `name` {`string`} - Name for the input used for form data events //TODO make sure this works\n\n * `pattern` {`string`} - Pattern to validate the input against for HTML validity checking\n\n * `autocomplete` {`AutoFill`} - The sets the autocomplete for the input.\n\nProperties:\n\n * `hidePasswordLabel` {`string`} - \"Hide password\" tooltip text on password visibility toggle\n\n * `showPasswordLabel` {`string`} - \"Show password\" tooltip text on password visibility toggle\n\n * `_value` {`string | number | boolean`} - The internal value.\n\n * `_showPassword` {`boolean`} - \n\n * `selectionStart` {`number | null`} - \n\n * `value` {`string | number | boolean`} - The value of the input.\n\n * `_handleInput` - Handles `oninput` event on the `<input>`.\n\n * `_input` {`HTMLInputElement`} - The underlying input element\n\n * `handleTogglePasswordVisibility` - \n\n * `variant` {`\"number\" | \"text\" | \"text-area\" | \"color\" | \"date\" | \"datetime-local\" | \"email\" | \"file\" | \"hidden\" | \"password\"`} - Input type\n\n * `label` {`string`} - Label to display above the input\n\n * `placeholder` {`string`} - placeholder text to display\n\n * `disabled` {`boolean`} - \n\n * `readonly` {`boolean`} - \n\n * `helperText` {`string`} - The helper text.\n\n * `invalid` {`boolean`} - Specify if the currently value is invalid.\n\n * `invalidText` {`string | TemplateResult<1>`} - Message which is displayed if the value is invalid.\n\n * `maxCount` {`number`} - Max character count allowed for input. This is needed in order for enableCounter to display\n\n * `required` {`boolean`} - Boolean property to set the required status\n\n * `showPasswordVisibilityToggle` {`boolean`} - Boolean property to render password visibility toggle\n\n * `name` {`string`} - Name for the input used for form data events //TODO make sure this works\n\n * `pattern` {`string`} - Pattern to validate the input against for HTML validity checking\n\n * `autocomplete` {`AutoFill`} - The sets the autocomplete for the input.",
395
+ "description": "Events:\n\n * `change` {`Event`} - \n\nAttributes:\n\n * `hidePasswordLabel` {`string`} - \"Hide password\" tooltip text on password visibility toggle\n\n * `showPasswordLabel` {`string`} - \"Show password\" tooltip text on password visibility toggle\n\n * `value` {`string | number | boolean`} - The value of the input.\n\n * `variant` {`\"number\" | \"text\" | \"text-area\" | \"color\" | \"date\" | \"datetime-local\" | \"email\" | \"file\" | \"hidden\" | \"password\"`} - Input type\n\n * `label` {`string`} - Label to display above the input\n\n * `placeholder` {`string`} - placeholder text to display\n\n * `disabled` {`boolean`} - \n\n * `readonly` {`boolean`} - \n\n * `helperText` {`string`} - The helper text.\n\n * `invalid` {`boolean`} - Specify if the currently value is invalid.\n\n * `invalidText` {`string | TemplateResult<1>`} - Message which is displayed if the value is invalid.\n\n * `maxCount` {`number`} - Max character count allowed for input. This is needed in order for enableCounter to display\n\n * `required` {`boolean`} - Boolean property to set the required status\n\n * `showPasswordVisibilityToggle` {`boolean`} - Boolean property to render password visibility toggle\n\n * `name` {`string`} - Name for the input used for form data events //TODO make sure this works\n\n * `pattern` {`string`} - Pattern to validate the input against for HTML validity checking\n\n * `autocomplete` {`AutoFill`} - The sets the autocomplete for the input.\n\nProperties:\n\n * `hidePasswordLabel` {`string`} - \"Hide password\" tooltip text on password visibility toggle\n\n * `showPasswordLabel` {`string`} - \"Show password\" tooltip text on password visibility toggle\n\n * `_value` {`string | number | boolean`} - The internal value.\n\n * `_showPassword` {`boolean`} - \n\n * `selectionStart` {`number | null`} - \n\n * `value` {`string | number | boolean`} - The value of the input.\n\n * `_handleInput` - Handles `oninput` event on the `<input>`.\n\n * `_input` {`HTMLInputElement | undefined`} - The underlying input element\n\n * `handleTogglePasswordVisibility` - \n\n * `variant` {`\"number\" | \"text\" | \"text-area\" | \"color\" | \"date\" | \"datetime-local\" | \"email\" | \"file\" | \"hidden\" | \"password\"`} - Input type\n\n * `label` {`string`} - Label to display above the input\n\n * `placeholder` {`string`} - placeholder text to display\n\n * `disabled` {`boolean`} - \n\n * `readonly` {`boolean`} - \n\n * `helperText` {`string`} - The helper text.\n\n * `invalid` {`boolean`} - Specify if the currently value is invalid.\n\n * `invalidText` {`string | TemplateResult<1>`} - Message which is displayed if the value is invalid.\n\n * `maxCount` {`number`} - Max character count allowed for input. This is needed in order for enableCounter to display\n\n * `required` {`boolean`} - Boolean property to set the required status\n\n * `showPasswordVisibilityToggle` {`boolean`} - Boolean property to render password visibility toggle\n\n * `name` {`string`} - Name for the input used for form data events //TODO make sure this works\n\n * `pattern` {`string`} - Pattern to validate the input against for HTML validity checking\n\n * `autocomplete` {`AutoFill`} - The sets the autocomplete for the input.",
396
396
  "attributes": [
397
397
  {
398
398
  "name": "hidePasswordLabel",
@@ -1838,7 +1838,7 @@
1838
1838
  },
1839
1839
  {
1840
1840
  "name": "value",
1841
- "description": "`value` {`string`} - The value of the input.\n\nProperty: value"
1841
+ "description": "`value` {`string`} - The value of the input.\n\nProperty: value\n\nDefault: "
1842
1842
  },
1843
1843
  {
1844
1844
  "name": "fields",
package/dist/index.es.js CHANGED
@@ -1885,7 +1885,7 @@ let E = class extends L {
1885
1885
  return this;
1886
1886
  }
1887
1887
  get selectionStart() {
1888
- return this._input.selectionStart;
1888
+ return this._input ? this._input.selectionStart : null;
1889
1889
  }
1890
1890
  get value() {
1891
1891
  return this._input ? this.variant == "number" ? parseFloat(this._input.value) : this._input.value : this._value;
@@ -1894,8 +1894,14 @@ let E = class extends L {
1894
1894
  const r = this._value;
1895
1895
  this._value = s, this.requestUpdate("value", r), this._input && (this._input.value = String(s));
1896
1896
  }
1897
+ blur() {
1898
+ this._input && this._input.blur();
1899
+ }
1900
+ focus(s) {
1901
+ this._input && (this._input.blur(), this._input.focus(s));
1902
+ }
1897
1903
  setSelectionRange(s, r, o = "none") {
1898
- this._input.setSelectionRange(s, r, o);
1904
+ this._input && this._input.setSelectionRange(s, r, o);
1899
1905
  }
1900
1906
  render() {
1901
1907
  switch (this.variant) {
@@ -3529,9 +3535,9 @@ const Ks = {
3529
3535
  ], Ha = Object.fromEntries(Object.entries(Ks).map(([s, r]) => [s, { value: r.value, label: (r.label || "").replace("value", "date-time") }]));
3530
3536
  let Q = class extends L {
3531
3537
  constructor() {
3532
- super(), this.placeholder = "", this._value = "", this.outputLanguage = "AST", this.completions = [], this.completionIndex = 0, this.fields = [], this._parseQuery = (s = void 0) => {
3538
+ super(), this.placeholder = "", this._value = "", this.value = "", this.outputLanguage = "AST", this.completions = [], this.completionIndex = 0, this.fields = [], this._parseQuery = (s = void 0) => {
3533
3539
  let r;
3534
- if (this.value == "")
3540
+ if (s && (s != null && s.currentTarget) && s.currentTarget.value && (this.value = s.currentTarget.value), this.value == "")
3535
3541
  return;
3536
3542
  try {
3537
3543
  s && s.data == "(" && (this.value = this.value + " )", this._input.setSelectionRange(this.value.length - 2, this.value.length - 2));
@@ -3552,7 +3558,9 @@ let Q = class extends L {
3552
3558
  let s = this.completions[this.completionIndex], r = this.value.substring(0, s.start) + s.value, o = r.length, i = this.value.substring(s.end);
3553
3559
  if (s.value.includes(i) ? this.value = r : this.value = r + this.value.substring(s.end), this._input.setSelectionRange(o, o), s.onSelect) {
3554
3560
  let c = await s.onSelect();
3555
- c !== void 0 && (this.value += c);
3561
+ c !== void 0 && (this.value += c, setTimeout(() => {
3562
+ this._input.focus();
3563
+ }));
3556
3564
  }
3557
3565
  this.completionIndex = 0, this.completions = [], this._parseQuery();
3558
3566
  }, this._handleArrows = (s) => {
@@ -3566,13 +3574,6 @@ let Q = class extends L {
3566
3574
  createRenderRoot() {
3567
3575
  return this;
3568
3576
  }
3569
- get value() {
3570
- return this._input ? String(this._input.value) : this._value;
3571
- }
3572
- set value(s) {
3573
- const r = this._value;
3574
- this._value = s, this.requestUpdate("value", r), this._input && (this._input.value = String(s));
3575
- }
3576
3577
  async autoComplete(s) {
3577
3578
  if (this.completions = [], s.type !== "cursor")
3578
3579
  return;
@@ -3636,7 +3637,7 @@ let Q = class extends L {
3636
3637
  }
3637
3638
  render() {
3638
3639
  return A`
3639
- <spectric-input .placeholder=${this.placeholder} style=${`anchor-name:--${this.uuid};`} autocomplete="off" @input=${this._parseQuery} @keydown=${this._handleArrows} @change=${(s) => s.stopPropagation()}></spectric-input>
3640
+ <spectric-input .value=${this.value} .placeholder=${this.placeholder} style=${`anchor-name:--${this.uuid};`} autocomplete="off" @input=${this._parseQuery} @keydown=${this._handleArrows} @change=${(s) => s.stopPropagation()}></spectric-input>
3640
3641
  <div class="autocomplete" popover style=${`position-anchor: --${this.uuid};`}>
3641
3642
  ${this.completions.map(
3642
3643
  (s, r) => A`<div @click=${() => {
@@ -3651,7 +3652,7 @@ X([
3651
3652
  ], Q.prototype, "placeholder", 2);
3652
3653
  X([
3653
3654
  v({ type: String, reflect: !0 })
3654
- ], Q.prototype, "value", 1);
3655
+ ], Q.prototype, "value", 2);
3655
3656
  X([
3656
3657
  v({ type: String, reflect: !0 })
3657
3658
  ], Q.prototype, "outputLanguage", 2);