@alegendstale/holly-components 0.2.35 → 0.2.37

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.
@@ -1 +1 @@
1
- {"version":3,"file":"color-palette.d.ts","sourceRoot":"","sources":["../../../src/components/color-palette/color-palette.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,cAAc,EAAE,OAAO,EAAO,cAAc,EAAE,MAAM,KAAK,CAAC;AAIrF,OAAO,EAAE,oBAAoB,EAAmB,SAAS,EAAgB,eAAe,EAAe,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAIhJ,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAQ3D,KAAK,QAAQ,GAAG;IACf,OAAO,EAAE,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;IACxC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC;IACvD,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC9B,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;CAC1B,CAAC;AAEF,qBACa,YAAa,SAAQ,UAAU;IAC3C,MAAM,CAAC,MAAM,4BA2FX;IAGF,OAAO,EAAG,cAAc,CAAC;IAEzB,SAAS,EAAE,OAAO,CAAS;IAC3B,IACI,QAAQ,CAAC,GAAG,EAAE,OAAO,EAGxB;IACD,IAAI,QAAQ,IAJM,OAAO,CAMxB;IAGD,MAAM,EAAE,MAAM,EAAE,CAAM;IAItB,MAAM,EAAE,MAAM,CAA0B;IAExC,KAAK,EAAE,MAAM,CAAyB;IAEtC,SAAS,EAAE,SAAS,CAA6B;IAEjD,QAAQ,EAAE,OAAO,CAAS;IAE1B,YAAY,EAAE,OAAO,CAAS;IAE9B,QAAQ,EAAE,OAAO,CAAS;IAE1B,QAAQ,EAAE,OAAO,CAAS;IAE1B,OAAO,EAAE,MAA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G;IACH,kBAAkB;IA8BlB,MAAM;IA2BN;;MAEE;IACK,eAAe;IAOtB,aAAa,QAAO,cAAc,GAAG,OAAO,OAAO,CAcjD;IAEF,YAAY,IAAI,cAAc;IA0E9B,cAAc,IAAI,cAAc;IAsChC;;;OAGG;IACH,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,SAAK;CAyB/C;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,eAAe,EAAE,YAAY,CAAC;KAC9B;CACD"}
@@ -260,6 +260,7 @@ let ColorPalette = class ColorPalette extends LitElement {
260
260
  return html `
261
261
  <tool-tip
262
262
  id="tooltip"
263
+ trigger="hover"
263
264
  ?display=${!this.preventHover}
264
265
  ${ref(tooltipRef)}
265
266
  >
@@ -4,9 +4,11 @@ export type TriggerTypes = 'hover' | 'click' | 'manual';
4
4
  export declare const styles: import("lit").CSSResult;
5
5
  export declare class ToolTip extends LitElement {
6
6
  static styles: import("lit").CSSResult;
7
+ private _trigger;
7
8
  textEl?: HTMLParagraphElement;
8
9
  display: boolean;
9
- trigger: TriggerTypes;
10
+ set trigger(val: TriggerTypes);
11
+ get trigger(): TriggerTypes;
10
12
  text: string;
11
13
  render(): import("lit-html").TemplateResult<1>;
12
14
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"tool-tip.d.ts","sourceRoot":"","sources":["../../../src/components/tool-tip/tool-tip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,KAAK,CAAC;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C,MAAM,MAAM,YAAY,GACtB,OAAO,GACP,OAAO,GACP,QAAQ,CAAA;AAEV,eAAO,MAAM,MAAM,yBAmDlB,CAAA;AAED,qBACa,OAAQ,SAAQ,UAAU;IACtC,MAAM,CAAC,MAAM,0BAAU;IAGvB,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAG9B,OAAO,UAAS;IAGhB,OAAO,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AAE,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM;CAInC;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,UAAU,EAAE,OAAO,CAAC;KACpB;CACD"}
@@ -14,17 +14,22 @@ export const styles = css `
14
14
  --tooltip-x: 0;
15
15
  --tooltip-y: 0;
16
16
  }
17
-
18
- /* Hover determines whether tooltip is displayed */
19
- :host([trigger="hover"]:hover) p {
17
+
18
+ /* Manual or Click appear when display is true */
19
+ :host(:not([trigger="hover"])[display]) p {
20
20
  display: flex;
21
21
  }
22
22
 
23
- /* Display determines whether tooltip is displayed */
24
- :host(:not([trigger="hover"])[display]) p {
23
+ /* Hover appears when display is true and user is hovering */
24
+ :host([trigger="hover"][display]:hover) p {
25
25
  display: flex;
26
26
  }
27
27
 
28
+ /* Display nothing when there is no text */
29
+ :host([text=""]) #tip {
30
+ display: none;
31
+ }
32
+
28
33
  p {
29
34
  display: none;
30
35
  align-items: center;
@@ -62,8 +67,8 @@ export const styles = css `
62
67
  let ToolTip = class ToolTip extends LitElement {
63
68
  constructor() {
64
69
  super(...arguments);
70
+ this._trigger = "manual";
65
71
  this.display = false;
66
- this.trigger = 'manual';
67
72
  this.text = '';
68
73
  /**
69
74
  * Clamps the tooltip position to within the bounds
@@ -93,13 +98,21 @@ let ToolTip = class ToolTip extends LitElement {
93
98
  return { x: leftPosition, y: topPosition };
94
99
  };
95
100
  }
101
+ set trigger(val) {
102
+ this._trigger = val;
103
+ if (val === 'hover')
104
+ this.display = true;
105
+ }
106
+ get trigger() {
107
+ return this._trigger;
108
+ }
96
109
  render() {
97
110
  return html `
98
111
  <slot
99
112
  @click=${() => this.trigger === 'click' ? this.display = !this.display : null}
100
113
  >
101
114
  </slot>
102
- <p>
115
+ <p id="tip">
103
116
  ${this.text}
104
117
  </p>
105
118
  `;
@@ -117,13 +130,13 @@ __decorate([
117
130
  query('p')
118
131
  ], ToolTip.prototype, "textEl", void 0);
119
132
  __decorate([
120
- property({ type: Boolean, reflect: true })
133
+ property({ type: Boolean, reflect: true, useDefault: true })
121
134
  ], ToolTip.prototype, "display", void 0);
122
135
  __decorate([
123
- property({ type: String })
124
- ], ToolTip.prototype, "trigger", void 0);
136
+ property({ type: String, reflect: true })
137
+ ], ToolTip.prototype, "trigger", null);
125
138
  __decorate([
126
- property({ type: String })
139
+ property({ type: String, reflect: true })
127
140
  ], ToolTip.prototype, "text", void 0);
128
141
  ToolTip = __decorate([
129
142
  condCustomElement('tool-tip')
@@ -3,8 +3,9 @@ import { TriggerTypes } from './tool-tip.js';
3
3
  declare const meta: Meta;
4
4
  export default meta;
5
5
  type Props = {
6
- content: string;
6
+ text: string;
7
7
  trigger: TriggerTypes;
8
+ display: boolean;
8
9
  };
9
10
  type Story = StoryObj<Props>;
10
11
  export declare const Hover: Story;
@@ -1 +1 @@
1
- {"version":3,"file":"tool-tip.stories.d.ts","sourceRoot":"","sources":["../../../src/components/tool-tip/tool-tip.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,QAAA,MAAM,IAAI,EAAE,IAIX,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,YAAY,CAAA;CAAE,CAAC;AAExD,KAAK,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;AAY7B,eAAO,MAAM,KAAK,EAAE,KAMnB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAMnB,CAAC"}
1
+ {"version":3,"file":"tool-tip.stories.d.ts","sourceRoot":"","sources":["../../../src/components/tool-tip/tool-tip.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,QAAA,MAAM,IAAI,EAAE,IAIX,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,YAAY,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC;AAEvE,KAAK,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;AAY7B,eAAO,MAAM,KAAK,EAAE,KAOnB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAOnB,CAAC"}
@@ -6,9 +6,9 @@ const meta = {
6
6
  };
7
7
  export default meta;
8
8
  const Template = {
9
- render: ({ content, trigger }) => {
9
+ render: ({ text, trigger, display }) => {
10
10
  return html `
11
- <tool-tip content=${content} trigger=${trigger}>
11
+ <tool-tip text=${text} trigger=${trigger} ?display=${display}>
12
12
  <button>${trigger} me</button>
13
13
  </tool-tip>
14
14
  `;
@@ -17,14 +17,16 @@ const Template = {
17
17
  export const Hover = {
18
18
  ...Template,
19
19
  args: {
20
- content: 'hovered tooltip',
21
- trigger: 'hover'
20
+ text: 'hovered tooltip',
21
+ trigger: 'hover',
22
+ display: true
22
23
  }
23
24
  };
24
25
  export const Click = {
25
26
  ...Template,
26
27
  args: {
27
- content: 'clicked tooltip',
28
- trigger: 'click'
28
+ text: 'clicked tooltip',
29
+ trigger: 'click',
30
+ display: false
29
31
  }
30
32
  };
@@ -1 +1 @@
1
- {"version":3,"file":"condCustomElement.d.ts","sourceRoot":"","sources":["../../src/decorators/condCustomElement.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEtC,KAAK,WAAW,CAAC,CAAC,GAAG,EAAE,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AAErD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,IAChC,CAAC,SAAS,WAAW,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC,OAMjE"}
1
+ {"version":3,"file":"condCustomElement.d.ts","sourceRoot":"","sources":["../../src/decorators/condCustomElement.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEtC,KAAK,WAAW,CAAC,CAAC,GAAG,EAAE,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AAErD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,IAChC,CAAC,SAAS,WAAW,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC,OAIjE"}
@@ -7,8 +7,6 @@ export function condCustomElement(tagName) {
7
7
  return function (constructor) {
8
8
  if (!customElements.get(tagName))
9
9
  litCustomElement(tagName)(constructor);
10
- else
11
- console.warn(`Custom element ${tagName} is already defined.`);
12
10
  return constructor;
13
11
  };
14
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "private": false,
3
- "version": "0.2.35",
3
+ "version": "0.2.37",
4
4
  "name": "@alegendstale/holly-components",
5
5
  "description": "Reusable UI components created using lit",
6
6
  "type": "module",