@grantcodes/ui 2.0.0-beta.3 → 2.0.0-beta.6
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/CHANGELOG.md +98 -0
- package/dist/components/code-preview/code-preview.component.js +3 -1
- package/dist/components/code-preview/code-preview.scss.js +1 -1
- package/dist/components/icon/icon.component.js +1 -1
- package/dist/components/notice/notice.component.js +14 -15
- package/dist/components/notice/notice.scss.js +1 -1
- package/dist/components/tabs/internal/tabs-button.component.js +13 -0
- package/dist/components/tabs/internal/tabs-button.js +1 -0
- package/dist/components/tabs/internal/tabs-item.component.js +1 -0
- package/dist/components/tabs/tab.component.js +10 -1
- package/dist/components/tabs/tabs.component.js +21 -27
- package/package.json +7 -2
- package/dist/components/tabs/tabs-item.component.js +0 -1
- package/dist/components/tabs/tabs-panel.component.js +0 -10
- package/dist/components/tabs/tabs-panel.js +0 -1
- package/dist/components/tabs/tabs-tab.component.js +0 -12
- package/dist/components/tabs/tabs-tab.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,103 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.0.0-beta.6](https://github.com/grantcodes/ui/compare/v2.0.1-beta.5...v2.0.0-beta.6) (2024-10-30)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **avatar:** add initial Avatar component ([0f0f6eb](https://github.com/grantcodes/ui/commit/0f0f6eb7d956aa3fa479baeb641bbd60e98904f2))
|
|
9
|
+
* **container:** update Container full variation and add viewport variation ([74a02e1](https://github.com/grantcodes/ui/commit/74a02e1f67b95a02dbe3efba9d97282749009f6f))
|
|
10
|
+
* **dialog:** add initial Dialog component ([6d50f52](https://github.com/grantcodes/ui/commit/6d50f52031cd4ae23183dac2152be29579bc3de9))
|
|
11
|
+
* **form-field:** add initial form-field component ([1ea4589](https://github.com/grantcodes/ui/commit/1ea458963e5039d6cfda9ca054a9527ad4540304))
|
|
12
|
+
* **gallery:** add gallery component ([4f8d6e1](https://github.com/grantcodes/ui/commit/4f8d6e11d5ea5c4ec7a0288ce61b65bb77e9be1b))
|
|
13
|
+
* improve focus styles ([8137403](https://github.com/grantcodes/ui/commit/8137403fd19f36cd034c9909dbd8088782905c53))
|
|
14
|
+
* **tabs:** add Tabs component ([e8d8452](https://github.com/grantcodes/ui/commit/e8d8452d7c8ce223fdcc5ac28371bb52859955f3))
|
|
15
|
+
* **tooltip:** add initial Tooltip component ([4991c56](https://github.com/grantcodes/ui/commit/4991c5631da7fd993c33f767252836730d5aae01))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **avatar:** export the Avatar component from the main exports ([2f4119b](https://github.com/grantcodes/ui/commit/2f4119b9216fe344712f3a9bf4abda9eb1245fb4))
|
|
21
|
+
* **code-preview:** fix code preview SSR ([3d327f7](https://github.com/grantcodes/ui/commit/3d327f741430e2421ee1812b5170339a5f4af110))
|
|
22
|
+
* **codepreview:** fix syntax highlighting ([5010a1f](https://github.com/grantcodes/ui/commit/5010a1f31c789d028154b036f29c67f3539f38b2))
|
|
23
|
+
* **icon:** fix icon ssr ([c953502](https://github.com/grantcodes/ui/commit/c95350285a53bb7d5b6527bf640655c7125066a5))
|
|
24
|
+
* **input:** improve select styles ([3d17cc4](https://github.com/grantcodes/ui/commit/3d17cc45da034995ee5ca4b85148f0c0e0f2f080))
|
|
25
|
+
* **notice:** fix notice dismiss button ([254e20a](https://github.com/grantcodes/ui/commit/254e20ae232f33ebefbe2b69aaf6e16554fa1d91))
|
|
26
|
+
* **plop:** fix plopfile ([dfc0879](https://github.com/grantcodes/ui/commit/dfc087927397bbc8a49666631b19b075dcaf4b9a))
|
|
27
|
+
* **tabs:** add missing tabs/internal folder ([545a372](https://github.com/grantcodes/ui/commit/545a372a30bd3acae40ce2392064f3d2190702c4))
|
|
28
|
+
* **tabs:** simplify and improve tabs ([c4badfb](https://github.com/grantcodes/ui/commit/c4badfb69fae21c29774032d24e45bfa89796ce4))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Miscellaneous Chores
|
|
32
|
+
|
|
33
|
+
* release 2.0.0-beta.5 ([04f38a1](https://github.com/grantcodes/ui/commit/04f38a1a79840ee15a1bc44c3e55ada780f1c2c4))
|
|
34
|
+
* release 2.0.0-beta.6 ([de561ab](https://github.com/grantcodes/ui/commit/de561ab4fe2cddb2a656a9cf2fc37457f909c9b7))
|
|
35
|
+
* release 2.0.0-beta4 ([5087ac5](https://github.com/grantcodes/ui/commit/5087ac51b8bf4bc31ce9bd312fa32114d2b9f78e))
|
|
36
|
+
|
|
37
|
+
## [2.0.0-beta.5](https://github.com/grantcodes/ui/compare/v2.0.2-beta...v2.0.0-beta.5) (2024-10-29)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### Features
|
|
41
|
+
|
|
42
|
+
* **avatar:** add initial Avatar component ([0f0f6eb](https://github.com/grantcodes/ui/commit/0f0f6eb7d956aa3fa479baeb641bbd60e98904f2))
|
|
43
|
+
* **container:** update Container full variation and add viewport variation ([74a02e1](https://github.com/grantcodes/ui/commit/74a02e1f67b95a02dbe3efba9d97282749009f6f))
|
|
44
|
+
* **dialog:** add initial Dialog component ([6d50f52](https://github.com/grantcodes/ui/commit/6d50f52031cd4ae23183dac2152be29579bc3de9))
|
|
45
|
+
* **form-field:** add initial form-field component ([1ea4589](https://github.com/grantcodes/ui/commit/1ea458963e5039d6cfda9ca054a9527ad4540304))
|
|
46
|
+
* **gallery:** add gallery component ([4f8d6e1](https://github.com/grantcodes/ui/commit/4f8d6e11d5ea5c4ec7a0288ce61b65bb77e9be1b))
|
|
47
|
+
* improve focus styles ([8137403](https://github.com/grantcodes/ui/commit/8137403fd19f36cd034c9909dbd8088782905c53))
|
|
48
|
+
* **tabs:** add Tabs component ([e8d8452](https://github.com/grantcodes/ui/commit/e8d8452d7c8ce223fdcc5ac28371bb52859955f3))
|
|
49
|
+
* **tooltip:** add initial Tooltip component ([4991c56](https://github.com/grantcodes/ui/commit/4991c5631da7fd993c33f767252836730d5aae01))
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
### Bug Fixes
|
|
53
|
+
|
|
54
|
+
* **avatar:** export the Avatar component from the main exports ([2f4119b](https://github.com/grantcodes/ui/commit/2f4119b9216fe344712f3a9bf4abda9eb1245fb4))
|
|
55
|
+
* **codepreview:** fix syntax highlighting ([5010a1f](https://github.com/grantcodes/ui/commit/5010a1f31c789d028154b036f29c67f3539f38b2))
|
|
56
|
+
* **input:** improve select styles ([3d17cc4](https://github.com/grantcodes/ui/commit/3d17cc45da034995ee5ca4b85148f0c0e0f2f080))
|
|
57
|
+
* **notice:** fix notice dismiss button ([254e20a](https://github.com/grantcodes/ui/commit/254e20ae232f33ebefbe2b69aaf6e16554fa1d91))
|
|
58
|
+
* **plop:** fix plopfile ([dfc0879](https://github.com/grantcodes/ui/commit/dfc087927397bbc8a49666631b19b075dcaf4b9a))
|
|
59
|
+
* **tabs:** simplify and improve tabs ([c4badfb](https://github.com/grantcodes/ui/commit/c4badfb69fae21c29774032d24e45bfa89796ce4))
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### Miscellaneous Chores
|
|
63
|
+
|
|
64
|
+
* release 2.0.0-beta.5 ([04f38a1](https://github.com/grantcodes/ui/commit/04f38a1a79840ee15a1bc44c3e55ada780f1c2c4))
|
|
65
|
+
* release 2.0.0-beta4 ([5087ac5](https://github.com/grantcodes/ui/commit/5087ac51b8bf4bc31ce9bd312fa32114d2b9f78e))
|
|
66
|
+
|
|
67
|
+
## [2.0.1-beta4](https://github.com/grantcodes/ui/compare/v2.0.0-beta4...v2.0.1-beta4) (2024-10-26)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
### Bug Fixes
|
|
71
|
+
|
|
72
|
+
* **notice:** fix notice dismiss button ([254e20a](https://github.com/grantcodes/ui/commit/254e20ae232f33ebefbe2b69aaf6e16554fa1d91))
|
|
73
|
+
|
|
74
|
+
## [2.0.0-beta4](https://github.com/grantcodes/ui/compare/v1.3.0...v2.0.0-beta4) (2024-10-25)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
### Features
|
|
78
|
+
|
|
79
|
+
* **avatar:** add initial Avatar component ([0f0f6eb](https://github.com/grantcodes/ui/commit/0f0f6eb7d956aa3fa479baeb641bbd60e98904f2))
|
|
80
|
+
* **container:** update Container full variation and add viewport variation ([74a02e1](https://github.com/grantcodes/ui/commit/74a02e1f67b95a02dbe3efba9d97282749009f6f))
|
|
81
|
+
* **dialog:** add initial Dialog component ([6d50f52](https://github.com/grantcodes/ui/commit/6d50f52031cd4ae23183dac2152be29579bc3de9))
|
|
82
|
+
* **form-field:** add initial form-field component ([1ea4589](https://github.com/grantcodes/ui/commit/1ea458963e5039d6cfda9ca054a9527ad4540304))
|
|
83
|
+
* **gallery:** add gallery component ([4f8d6e1](https://github.com/grantcodes/ui/commit/4f8d6e11d5ea5c4ec7a0288ce61b65bb77e9be1b))
|
|
84
|
+
* improve focus styles ([8137403](https://github.com/grantcodes/ui/commit/8137403fd19f36cd034c9909dbd8088782905c53))
|
|
85
|
+
* **tabs:** add Tabs component ([e8d8452](https://github.com/grantcodes/ui/commit/e8d8452d7c8ce223fdcc5ac28371bb52859955f3))
|
|
86
|
+
* **tooltip:** add initial Tooltip component ([4991c56](https://github.com/grantcodes/ui/commit/4991c5631da7fd993c33f767252836730d5aae01))
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
### Bug Fixes
|
|
90
|
+
|
|
91
|
+
* **avatar:** export the Avatar component from the main exports ([2f4119b](https://github.com/grantcodes/ui/commit/2f4119b9216fe344712f3a9bf4abda9eb1245fb4))
|
|
92
|
+
* **codepreview:** fix syntax highlighting ([5010a1f](https://github.com/grantcodes/ui/commit/5010a1f31c789d028154b036f29c67f3539f38b2))
|
|
93
|
+
* **input:** improve select styles ([3d17cc4](https://github.com/grantcodes/ui/commit/3d17cc45da034995ee5ca4b85148f0c0e0f2f080))
|
|
94
|
+
* **plop:** fix plopfile ([dfc0879](https://github.com/grantcodes/ui/commit/dfc087927397bbc8a49666631b19b075dcaf4b9a))
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
### Miscellaneous Chores
|
|
98
|
+
|
|
99
|
+
* release 2.0.0-beta4 ([5087ac5](https://github.com/grantcodes/ui/commit/5087ac51b8bf4bc31ce9bd312fa32114d2b9f78e))
|
|
100
|
+
|
|
3
101
|
## [1.2.0](https://github.com/grantcodes/ui/compare/v1.1.0...v1.2.0) (2023-06-29)
|
|
4
102
|
|
|
5
103
|
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
import{LitElement as
|
|
1
|
+
import{LitElement as h,html as m,unsafeCSS as d}from"/home/grantcodes/projects/@grantcodes/ui/node_modules/lit/index.js";import{property as a,query as c,customElement as g}from"/home/grantcodes/projects/@grantcodes/ui/node_modules/lit/decorators.js";import{codeToHtml as v}from"/home/grantcodes/projects/@grantcodes/ui/node_modules/shiki/dist/bundle-web.mjs";import u from"./code-preview.scss.js";var f=Object.defineProperty,w=Object.getOwnPropertyDescriptor,s=(o,t,p,i)=>{for(var e=i>1?void 0:i?w(t,p):t,n=o.length-1,l;n>=0;n--)(l=o[n])&&(e=(i?l(t,p,e):l(e))||e);return i&&e&&f(t,p,e),e};let r=class extends h{constructor(){super(...arguments),this.language="html",this.theme="aurora-x"}async doHighlight(){const o=this.textContent??"",t=await v(o.trim(),{lang:this.language,theme:this.theme});this.codePreview.innerHTML=t}firstUpdated(){this.doHighlight()}render(){return m`<div class="code-preview">
|
|
2
|
+
<pre><slot></slot></pre>
|
|
3
|
+
</div> `}};r.styles=[d(u)];s([a({type:String})],r.prototype,"language",2);s([a({type:String})],r.prototype,"theme",2);s([c(".code-preview")],r.prototype,"codePreview",2);r=s([g("grantcodes-code-preview")],r);export{r as GrantCodesCodePreview};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e="*,*:before,*:after{box-sizing:border-box}:host{display:block}.code-preview>pre{display:block;font-family:var(--font-family-
|
|
1
|
+
const e="*,*:before,*:after{box-sizing:border-box}:host{display:block}.code-preview>pre{display:block;font-family:var(--font-family-mono);line-height:1.2;width:100%;overflow:auto;border-radius:var(--component-card-border-radius);box-shadow:.1rem .2rem .4rem #0000001a;font-size:var(--font-size-small);font-weight:400;padding:var(--size-space-unit, 1rem)}";export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{LitElement as
|
|
1
|
+
import{LitElement as m,html as f,unsafeCSS as l}from"/home/grantcodes/projects/@grantcodes/ui/node_modules/lit/index.js";import{property as a,customElement as u}from"/home/grantcodes/projects/@grantcodes/ui/node_modules/lit/decorators.js";import{unsafeHTML as v}from"/home/grantcodes/projects/@grantcodes/ui/node_modules/lit/directives/unsafe-html.js";import _ from"./icon.scss.js";var y=Object.defineProperty,h=Object.getOwnPropertyDescriptor,i=(c,e,s,t)=>{for(var r=t>1?void 0:t?h(e,s):e,n=c.length-1,p;n>=0;n--)(p=c[n])&&(r=(t?p(e,s,r):p(r))||r);return t&&r&&y(e,s,r),r};let o=class extends m{constructor(){super(...arguments),this.icon=""}render(){return f`<span class="icon">${v(this.icon)}</span>`}};o.styles=[l(_)];i([a({type:String})],o.prototype,"icon",2);o=i([u("grantcodes-icon")],o);export{o as GrantCodesIcon};
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import{LitElement as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import{LitElement as p,html as r,unsafeCSS as d}from"/home/grantcodes/projects/@grantcodes/ui/node_modules/lit/index.js";import{property as m,customElement as f}from"/home/grantcodes/projects/@grantcodes/ui/node_modules/lit/decorators.js";import h from"/home/grantcodes/projects/@grantcodes/ui/node_modules/classnames/index.js";import u from"./notice.scss.js";import{GrantCodesIcon as v}from"../icon/icon.component.js";import"../../icons.js";import{Info as _,CheckCircle2 as C,AlertCircle as g,XCircle as $,X as b}from"/home/grantcodes/projects/@grantcodes/ui/node_modules/lucide-static/dist/esm/lucide-static.js";var y=Object.defineProperty,D=Object.getOwnPropertyDescriptor,n=(s,i,c,o)=>{for(var t=o>1?void 0:o?D(i,c):i,a=s.length-1,l;a>=0;a--)(l=s[a])&&(t=(o?l(i,c,t):l(t))||t);return o&&t&&y(i,c,t),t};const w={info:_,success:C,warning:g,error:$};let e=class extends p{constructor(){super(...arguments),this.variant="info",this.title="",this.dismissable=!1}onDismiss(s){document.startViewTransition?document.startViewTransition(()=>{this.remove()}):this.remove()}renderDismiss(){return this.dismissable?r`
|
|
2
|
+
<button class="notice__close" @click=${this.onDismiss}>
|
|
3
|
+
<grantcodes-icon icon="${b}" title="Close Notice"></grantcodes-icon>
|
|
4
|
+
</button>
|
|
5
|
+
`:r``}render(){const s=w[this.variant];return r`
|
|
6
|
+
<aside class="${h("notice",`notice--${this.variant}`)}">
|
|
7
|
+
<grantcodes-icon icon="${s}" class="notice__icon"></grantcodes-icon>
|
|
5
8
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
<div class="notice__content">
|
|
10
|
+
${this.title&&r`<h2 class="notice__title">${this.title}</h2>`}
|
|
11
|
+
<p><slot></slot></p>
|
|
12
|
+
</div>
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
</button>
|
|
15
|
-
`}
|
|
16
|
-
</aside>
|
|
17
|
-
`}};o.dependencies={"grancodes-icon":u};o.styles=[_(h)];s([p()],o.prototype,"variant",2);s([p()],o.prototype,"title",2);s([p()],o.prototype,"onDismiss",2);o=s([f("grantcodes-notice")],o);export{o as GrantCodesNotice};
|
|
14
|
+
${this.renderDismiss()}
|
|
15
|
+
</aside>
|
|
16
|
+
`}};e.dependencies={"grancodes-icon":v};e.styles=[d(u)];n([m()],e.prototype,"variant",2);n([m()],e.prototype,"title",2);n([m({type:Boolean})],e.prototype,"dismissable",2);e=n([f("grantcodes-notice")],e);export{e as GrantCodesNotice};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const o="*,*:before,*:after{box-sizing:border-box}:host{display:block}.notice{display:flex;flex-direction:row;align-items:flex-start;gap:1rem;padding:1rem;border-radius:.25rem}.notice--info{color:var(--color-base-info-900);background-color:var(--color-base-info-100)}.notice--success{color:var(--color-base-success-900);background-color:var(--color-base-success-100)}.notice--warning{color:var(--color-base-warning-900);background-color:var(--color-base-warning-100)}.notice--error{color:var(--color-base-error-900);background-color:var(--color-base-error-100)}.notice__title{font-size:1rem;margin:0}.notice__icon{font-size:calc(var(--font-line-height-body) * 1em)}.notice__content{flex-grow:1}.notice__close{background:none;color:inherit;opacity:.5;transition:.2s;font-size:calc(var(--font-line-height-body) * 1em);line-height:1;padding:.5rem;margin:-.5rem -.5rem 0 0;border:0}.notice__close:hover,.notice__close:focus-visible{background:none;color:inherit;opacity:1}.notice p{margin:0}";export{o as default};
|
|
1
|
+
const o="*,*:before,*:after{box-sizing:border-box}:host{display:block}.notice{display:flex;flex-direction:row;align-items:flex-start;gap:1rem;padding:1rem;border-radius:.25rem;view-transition-name:notice;transition:opacity .5s}.notice--info{color:var(--color-base-info-900);background-color:var(--color-base-info-100)}.notice--success{color:var(--color-base-success-900);background-color:var(--color-base-success-100)}.notice--warning{color:var(--color-base-warning-900);background-color:var(--color-base-warning-100)}.notice--error{color:var(--color-base-error-900);background-color:var(--color-base-error-100)}.notice__title{font-size:1rem;margin:0}.notice__icon{font-size:calc(var(--font-line-height-body) * 1em)}.notice__content{flex-grow:1}.notice__close{background:none;color:inherit;opacity:.5;transition:.2s;font-size:calc(var(--font-line-height-body) * 1em);line-height:1;padding:.5rem;margin:-.5rem -.5rem 0 0;border:0}.notice__close:hover,.notice__close:focus-visible{background:none;color:inherit;opacity:1}.notice p{margin:0}";export{o as default};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{GrantCodesTabsItem as l}from"./tabs-item.component.js";import{html as p,LitElement as b,unsafeCSS as m}from"/home/grantcodes/projects/@grantcodes/ui/node_modules/lit/index.js";import{customElement as c}from"/home/grantcodes/projects/@grantcodes/ui/node_modules/lit/decorators.js";import{ifDefined as d}from"/home/grantcodes/projects/@grantcodes/ui/node_modules/lit/directives/if-defined.js";import f from"../tabs.scss.js";var u=Object.defineProperty,v=Object.getOwnPropertyDescriptor,h=(n,e,r,s)=>{for(var t=s>1?void 0:s?v(e,r):e,a=n.length-1,i;a>=0;a--)(i=n[a])&&(t=(s?i(e,r,t):i(t))||t);return s&&t&&u(e,r,t),t};let o=class extends l{render(){return p`
|
|
2
|
+
<button
|
|
3
|
+
id="${this.buttonId}"
|
|
4
|
+
type="button"
|
|
5
|
+
role="tab"
|
|
6
|
+
?aria-selected=${this.active}
|
|
7
|
+
aria-controls="${this.panelId}"
|
|
8
|
+
tabindex=${d(this.active?void 0:"-1")}
|
|
9
|
+
class="tabs__tab ${this.active?"is-active":""}"
|
|
10
|
+
>
|
|
11
|
+
<span>${this.label}</span>
|
|
12
|
+
</button>
|
|
13
|
+
`}};o.shadowRootOptions={...b.shadowRootOptions,delegatesFocus:!0};o.styles=[m(f)];o=h([c("grantcodes-tabs-button")],o);export{o as GrantCodesTabsButton};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{GrantCodesTabsButton as t}from"./tabs-button.component.js";const o=t;export{t as GrantCodesTabsButton,o as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{LitElement as y,html as c}from"/home/grantcodes/projects/@grantcodes/ui/node_modules/lit/index.js";import{property as e}from"/home/grantcodes/projects/@grantcodes/ui/node_modules/lit/decorators.js";var u=Object.defineProperty,d=Object.getOwnPropertyDescriptor,r=(i,o,s,p)=>{for(var t=p>1?void 0:p?d(o,s):o,a=i.length-1,l;a>=0;a--)(l=i[a])&&(t=(p?l(o,s,t):l(t))||t);return p&&t&&u(o,s,t),t};class n extends y{constructor(){super(...arguments),this.active=!1,this.label="",this.index=-1,this.containerId=""}get buttonId(){return`${this.containerId}-button-${this.index.toString()}`}get panelId(){return`${this.containerId}-panel-${this.index.toString()}`}get content(){return this.label}render(){return c``}}r([e({type:Boolean})],n.prototype,"active",2);r([e({type:String})],n.prototype,"label",2);r([e({type:Number})],n.prototype,"index",2);r([e({type:String})],n.prototype,"containerId",2);r([e({type:String,reflect:!0})],n.prototype,"buttonId",1);r([e({type:String})],n.prototype,"panelId",1);r([e({type:String})],n.prototype,"content",1);export{n as GrantCodesTabsItem};
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
import{GrantCodesTabsItem as
|
|
1
|
+
import{GrantCodesTabsItem as n}from"./internal/tabs-item.component.js";import{html as p,unsafeCSS as m}from"/home/grantcodes/projects/@grantcodes/ui/node_modules/lit/index.js";import{customElement as b}from"/home/grantcodes/projects/@grantcodes/ui/node_modules/lit/decorators.js";import f from"./tabs.scss.js";var v=Object.defineProperty,d=Object.getOwnPropertyDescriptor,c=(i,t,s,r)=>{for(var e=r>1?void 0:r?d(t,s):t,a=i.length-1,l;a>=0;a--)(l=i[a])&&(e=(r?l(t,s,e):l(e))||e);return r&&e&&v(t,s,e),e};let o=class extends n{render(){return p`
|
|
2
|
+
<div
|
|
3
|
+
id="${this.panelId}"
|
|
4
|
+
role="tabpanel"
|
|
5
|
+
aria-labelledby="${this.buttonId}"
|
|
6
|
+
class="tabs__panel ${this.active?"is-active":""}"
|
|
7
|
+
>
|
|
8
|
+
<slot></slot>
|
|
9
|
+
</div>
|
|
10
|
+
`}};o.styles=[m(f)];o=c([b("grantcodes-tab")],o);export{o as GrantCodesTab};
|
|
@@ -1,28 +1,22 @@
|
|
|
1
|
-
import{LitElement as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import{LitElement as l,html as d,unsafeCSS as c}from"/home/grantcodes/projects/@grantcodes/ui/node_modules/lit/index.js";import{property as h,queryAssignedElements as f,queryAll as u,state as p,customElement as v}from"/home/grantcodes/projects/@grantcodes/ui/node_modules/lit/decorators.js";import{ifDefined as T}from"/home/grantcodes/projects/@grantcodes/ui/node_modules/lit/directives/if-defined.js";import m from"./tabs.scss.js";import"./internal/tabs-button.js";import{generateId as y}from"../../lib/generate-id.js";var _=Object.defineProperty,x=Object.getOwnPropertyDescriptor,n=(t,e,s,i)=>{for(var a=i>1?void 0:i?x(e,s):e,o=t.length-1,b;o>=0;o--)(b=t[o])&&(a=(i?b(e,s,a):b(a))||a);return i&&a&&_(e,s,a),a};let r=class extends l{constructor(){super(),this.focusedTabIndex=-1,this.id||(this.id=y("tabs"))}get activeTab(){return this.tabs.find(t=>t.active)??null}set activeTab(t){this.tabs.forEach((e,s)=>{e===t?(e.active=!0,this.focusedTabIndex=s):e.active=!1}),this.requestUpdate()}initializeTabs(){this.tabs.forEach((t,e)=>{t.index=e,t.containerId=this.id}),this.activeTab==null&&(this.focusedTabIndex=0,this.activeTab=this.tabs[0])}firstUpdated(){this.initializeTabs()}handleTabKeyDown(t){if(t.key==="ArrowRight"||t.key==="ArrowLeft"){t.preventDefault();const e=this.tabs,s=t.key==="ArrowRight"?(this.focusedTabIndex+1)%e.length:this.focusedTabIndex-1,i=this.tabButtons[s];i&&(i.focus(),this.focusedTabIndex=s)}}renderTabButtons(){return this.tabs.map((t,e)=>d`
|
|
2
|
+
<grantcodes-tabs-button
|
|
3
|
+
index=${e+1}
|
|
4
|
+
label="${t.label}"
|
|
5
|
+
containerId="${this.id}"
|
|
6
|
+
?active=${t.active}
|
|
7
|
+
@click=${()=>{this.activeTab=t}}
|
|
8
|
+
@keydown=${this.handleTabKeyDown}
|
|
9
|
+
></grantcodes-tabs-button>
|
|
10
|
+
`)}render(){return d`
|
|
11
|
+
<div class="tabs" id="${this.id}">
|
|
12
|
+
<div role="tablist" class="tabs__tablist" aria-label=${T(this.label)}>
|
|
13
|
+
<div class="tabs__tablist__inner">
|
|
14
|
+
${this.renderTabButtons()}
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
?active=${t.active}
|
|
22
|
-
>${t.content}</grantcodes-tabs-panel
|
|
23
|
-
>`)}
|
|
24
|
-
</div>
|
|
25
|
-
|
|
26
|
-
<slot></slot>
|
|
27
|
-
</div>
|
|
28
|
-
`}};r.styles=[c(m)];n([p({type:String})],r.prototype,"label",2);n([h({selector:"grantcodes-tab"})],r.prototype,"tabs",2);n([v("grantcodes-tabs-tab")],r.prototype,"tabsListTabs",2);n([f()],r.prototype,"focusedTabIndex",2);r=n([u("grantcodes-tabs")],r);export{r as GrantCodesTabs};
|
|
18
|
+
<div class="tabs__panels">
|
|
19
|
+
<slot></slot>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
`}};r.styles=[c(m)];n([h({type:String})],r.prototype,"label",2);n([f({selector:"grantcodes-tab"})],r.prototype,"tabs",2);n([u("grantcodes-tabs-button")],r.prototype,"tabButtons",2);n([p()],r.prototype,"focusedTabIndex",2);r=n([v("grantcodes-tabs")],r);export{r as GrantCodesTabs};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grantcodes/ui",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/main.cjs",
|
|
@@ -73,7 +73,12 @@
|
|
|
73
73
|
"vite": "^5.4.9"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {},
|
|
76
|
-
"files": [
|
|
76
|
+
"files": [
|
|
77
|
+
"dist/**/*",
|
|
78
|
+
"CHANGELOG.md",
|
|
79
|
+
"README.md",
|
|
80
|
+
"LICENCE"
|
|
81
|
+
],
|
|
77
82
|
"ava": {
|
|
78
83
|
"typescript": {
|
|
79
84
|
"compile": false,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{LitElement as y,html as c}from"/home/grantcodes/projects/@grantcodes/ui/node_modules/lit/index.js";import{property as e}from"/home/grantcodes/projects/@grantcodes/ui/node_modules/lit/decorators.js";var d=Object.defineProperty,g=Object.getOwnPropertyDescriptor,r=(i,o,a,p)=>{for(var t=p>1?void 0:p?g(o,a):o,s=i.length-1,l;s>=0;s--)(l=i[s])&&(t=(p?l(o,a,t):l(t))||t);return p&&t&&d(o,a,t),t};class n extends y{constructor(){super(...arguments),this.active=!1,this.label="",this.index=-1,this.containerId=""}get tabId(){return`${this.containerId}-tab-${this.index.toString()}`}get panelId(){return`${this.containerId}-panel-${this.index.toString()}`}get content(){return this.label}render(){return c``}}r([e({type:Boolean})],n.prototype,"active",2);r([e({type:String})],n.prototype,"label",2);r([e({type:Number})],n.prototype,"index",2);r([e({type:String})],n.prototype,"containerId",2);r([e({type:String,reflect:!0})],n.prototype,"tabId",1);r([e({type:String})],n.prototype,"panelId",1);r([e({type:String})],n.prototype,"content",1);export{n as GrantCodesTabsItem};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import{GrantCodesTabsItem as i}from"./tabs-item.component.js";import{html as p,unsafeCSS as m}from"/home/grantcodes/projects/@grantcodes/ui/node_modules/lit/index.js";import{customElement as b}from"/home/grantcodes/projects/@grantcodes/ui/node_modules/lit/decorators.js";import f from"./tabs.scss.js";var v=Object.defineProperty,d=Object.getOwnPropertyDescriptor,c=(n,t,r,s)=>{for(var e=s>1?void 0:s?d(t,r):t,a=n.length-1,l;a>=0;a--)(l=n[a])&&(e=(s?l(t,r,e):l(e))||e);return s&&e&&v(t,r,e),e};let o=class extends i{render(){return p`
|
|
2
|
-
<div
|
|
3
|
-
id="${this.panelId}"
|
|
4
|
-
role="tabpanel"
|
|
5
|
-
aria-labelledby="${this.tabId}"
|
|
6
|
-
class="tabs__panel ${this.active?"is-active":""}"
|
|
7
|
-
>
|
|
8
|
-
<slot></slot>
|
|
9
|
-
</div>
|
|
10
|
-
`}};o.styles=[m(f)];o=c([b("grantcodes-tabs-panel")],o);export{o as GrantCodesTabsPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{GrantCodesTabsPanel as a}from"./tabs-panel.component.js";const e=a;export{a as GrantCodesTabsPanel,e as default};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import{GrantCodesTabsItem as l}from"./tabs-item.component.js";import{html as b,LitElement as p,unsafeCSS as m}from"/home/grantcodes/projects/@grantcodes/ui/node_modules/lit/index.js";import{customElement as c}from"/home/grantcodes/projects/@grantcodes/ui/node_modules/lit/decorators.js";import d from"./tabs.scss.js";var f=Object.defineProperty,u=Object.getOwnPropertyDescriptor,h=(i,e,o,s)=>{for(var t=s>1?void 0:s?u(e,o):e,r=i.length-1,n;r>=0;r--)(n=i[r])&&(t=(s?n(e,o,t):n(t))||t);return s&&t&&f(e,o,t),t};let a=class extends l{render(){return b`
|
|
2
|
-
<button
|
|
3
|
-
id="${this.tabId}"
|
|
4
|
-
type="button"
|
|
5
|
-
role="tab"
|
|
6
|
-
?aria-selected=${this.active}
|
|
7
|
-
aria-controls="${this.panelId}"
|
|
8
|
-
class="tabs__tab ${this.active?"is-active":""}"
|
|
9
|
-
>
|
|
10
|
-
<span>${this.label}</span>
|
|
11
|
-
</button>
|
|
12
|
-
`}};a.shadowRootOptions={...p.shadowRootOptions,delegatesFocus:!0};a.styles=[m(d)];a=h([c("grantcodes-tabs-tab")],a);export{a as GrantCodesTabsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{GrantCodesTabsTab as a}from"./tabs-tab.component.js";const b=a;export{a as GrantCodesTabsTab,b as default};
|