@oslokommune/punkt-vue 9.6.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/CHANGELOG.md +1317 -0
- package/CONTRIBUTING.md +130 -0
- package/LICENSE +21 -0
- package/README.md +65 -0
- package/dist/Alert-CShkNLKz.cjs +1 -0
- package/dist/Alert-eoZOqLMh.js +108 -0
- package/dist/Button-h1iXT3rO.cjs +1 -0
- package/dist/Button-oFCw2kbo.js +116 -0
- package/dist/Icon-Q_SkpRJa.cjs +1 -0
- package/dist/Icon-s3ZNrtl-.js +51 -0
- package/dist/InputWrapper--d9sdKAg.js +212 -0
- package/dist/InputWrapper-Av69cWnN.cjs +1 -0
- package/dist/plugins-AiK__HqQ.cjs +1 -0
- package/dist/plugins-IeJb3XDX.js +18 -0
- package/dist/punkt-vue-alert.cjs +1 -0
- package/dist/punkt-vue-alert.js +14 -0
- package/dist/punkt-vue-backlink.cjs +1 -0
- package/dist/punkt-vue-backlink.js +72 -0
- package/dist/punkt-vue-breadcrumbs.cjs +1 -0
- package/dist/punkt-vue-breadcrumbs.js +95 -0
- package/dist/punkt-vue-button.cjs +1 -0
- package/dist/punkt-vue-button.js +14 -0
- package/dist/punkt-vue-checkbox.cjs +1 -0
- package/dist/punkt-vue-checkbox.js +96 -0
- package/dist/punkt-vue-footer.cjs +1 -0
- package/dist/punkt-vue-footer.js +178 -0
- package/dist/punkt-vue-footersimple.cjs +1 -0
- package/dist/punkt-vue-footersimple.js +89 -0
- package/dist/punkt-vue-header.cjs +1 -0
- package/dist/punkt-vue-header.js +372 -0
- package/dist/punkt-vue-icon.cjs +1 -0
- package/dist/punkt-vue-icon.js +13 -0
- package/dist/punkt-vue-index.cjs +1 -0
- package/dist/punkt-vue-index.js +99 -0
- package/dist/punkt-vue-inputwrapper.cjs +1 -0
- package/dist/punkt-vue-inputwrapper.js +16 -0
- package/dist/punkt-vue-linkcard.cjs +1 -0
- package/dist/punkt-vue-linkcard.js +71 -0
- package/dist/punkt-vue-messagebox.cjs +1 -0
- package/dist/punkt-vue-messagebox.js +43 -0
- package/dist/punkt-vue-radiobutton.cjs +1 -0
- package/dist/punkt-vue-radiobutton.js +88 -0
- package/dist/punkt-vue-searchinput.cjs +1 -0
- package/dist/punkt-vue-searchinput.js +173 -0
- package/dist/punkt-vue-select.cjs +1 -0
- package/dist/punkt-vue-select.js +151 -0
- package/dist/punkt-vue-tag.cjs +1 -0
- package/dist/punkt-vue-tag.js +146 -0
- package/dist/punkt-vue-textarea.cjs +1 -0
- package/dist/punkt-vue-textarea.js +182 -0
- package/dist/punkt-vue-textinput.cjs +1 -0
- package/dist/punkt-vue-textinput.js +216 -0
- package/package.json +69 -0
- package/src/components/alert/Alert.vue +89 -0
- package/src/components/backlink/BackLink.vue +40 -0
- package/src/components/breadcrumbs/Breadcrumbs.vue +79 -0
- package/src/components/button/Button.vue +104 -0
- package/src/components/checkbox/Checkbox.vue +83 -0
- package/src/components/footer/Footer.vue +153 -0
- package/src/components/footersimple/FooterSimple.vue +60 -0
- package/src/components/header/Header.vue +301 -0
- package/src/components/icon/Icon.vue +70 -0
- package/src/components/inputwrapper/InputWrapper.vue +190 -0
- package/src/components/linkcard/Linkcard.vue +59 -0
- package/src/components/messagebox/Messagebox.vue +34 -0
- package/src/components/radiobutton/Radiobutton.vue +75 -0
- package/src/components/searchinput/SearchInput.vue +141 -0
- package/src/components/select/Select.vue +140 -0
- package/src/components/tag/Tag.vue +129 -0
- package/src/components/textarea/Textarea.vue +160 -0
- package/src/components/textinput/Textinput.vue +185 -0
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
## Hvordan bidra - Vue ⭐
|
|
2
|
+
|
|
3
|
+
Vi er veldig happy med at du vurderer å bidra! Om du er usikker på noe som helst,
|
|
4
|
+
ta kontakt. Eller bare send inn den buggen eller PRen uansett. Verste som skjer
|
|
5
|
+
er at vi høflig ber deg endre på noe. **Vi setter pris på alle hyggelige bidrag!**
|
|
6
|
+
|
|
7
|
+
## 📝 Forutsetninger
|
|
8
|
+
|
|
9
|
+
- nodejs 16.15
|
|
10
|
+
- Kunnskap om [Sass (SCSS)](https://sass-lang.com/) og [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS).
|
|
11
|
+
- Forståelse av [BEM-navnekonvensjoner](http://getbem.com/) som designsystemet følger.
|
|
12
|
+
- Noen skal ha designet komponenten i [Figma](https://www.figma.com/file/Eej5jm3jIUjeMfzLE0aOTB/Punkt---Origo-designsystem?node-id=0%3A1&t=VDbEaltk80wYiYn3-0) (Krever innlogging og tilgang).
|
|
13
|
+
|
|
14
|
+
Aller først må du konfigurere git-hooks slik at scripts kjøres ved commits, som for eksempel et script som kopierer innhold fra readme og contributing til dokumentasjonsnettsiden.
|
|
15
|
+
|
|
16
|
+
Sett opp git hooks:
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
git config core.hooksPath scripts/git-hooks
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Lerna
|
|
23
|
+
|
|
24
|
+
Punkt er et monorepo og bruker `lerna`. Det betyr at alle kommandoer kjører
|
|
25
|
+
fra repoets rot, og ikke i subrepoene.
|
|
26
|
+
|
|
27
|
+
Et utdrag fra rot-package.json viser noen scripts som er satt opp for å forenkle
|
|
28
|
+
utvikling i dette subrepoet:
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build-vue": "npx lerna run build --scope=@oslokommune/punkt-vue",
|
|
33
|
+
"build-vue-app": "npx lerna run build-app --scope=@oslokommune/punkt-vue",
|
|
34
|
+
"dev-vue": "npx lerna run dev --scope=@oslokommune/punkt-vue",
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Figma
|
|
39
|
+
|
|
40
|
+
Sørg for at noen har designet komponenten i [Figma](https://www.figma.com/file/Eej5jm3jIUjeMfzLE0aOTB/Punkt---Origo-designsystem?node-id=0%3A1&t=VDbEaltk80wYiYn3-0)
|
|
41
|
+
(Krever innlogging og tilgang).
|
|
42
|
+
|
|
43
|
+
## 🛠️ Gjør arbeidet
|
|
44
|
+
|
|
45
|
+
### Filstruktur
|
|
46
|
+
|
|
47
|
+
Under components lag en folder med komponentnavnet. Lag to filer, en for
|
|
48
|
+
vue-komponenten og en for eksport av komponenten. Prefixen `Pkt` skal ikke
|
|
49
|
+
være med på navngivingen, men skal navngis i komponenten og eksporteres
|
|
50
|
+
med det.
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
vue/
|
|
54
|
+
└── src/
|
|
55
|
+
└── components/
|
|
56
|
+
└── alert/
|
|
57
|
+
├── index.js
|
|
58
|
+
└── Alert.vue
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Husk å legge til komponenten i index.js som ligger i components-mappen.
|
|
62
|
+
|
|
63
|
+
```js
|
|
64
|
+
// components/index.js
|
|
65
|
+
|
|
66
|
+
import Alert from './Alert.vue'
|
|
67
|
+
import { use, registerComponent } from '../../utils/plugins'
|
|
68
|
+
|
|
69
|
+
const Plugin = {
|
|
70
|
+
install(Vue) {
|
|
71
|
+
registerComponent(Vue, Alert)
|
|
72
|
+
},
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
use(Plugin)
|
|
76
|
+
|
|
77
|
+
export default Plugin
|
|
78
|
+
|
|
79
|
+
export { Alert as PktAlert }
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Lokal utviklingsserver
|
|
83
|
+
|
|
84
|
+
For å teste komponenten din kan du legge den til i `views` og `router`, kjør følgende (fra root):
|
|
85
|
+
|
|
86
|
+
```sh
|
|
87
|
+
$ npm run dev-vue
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### SCSS
|
|
91
|
+
|
|
92
|
+
Det enkleste er å starte og utvikle komponenten som en normal vue-komponent,
|
|
93
|
+
med SCSS i `<style>`. Når du er fornøyd flytt SCSS til `punkt-css`:
|
|
94
|
+
|
|
95
|
+
```sh
|
|
96
|
+
css/
|
|
97
|
+
└── src/
|
|
98
|
+
└── scss/
|
|
99
|
+
└── components/
|
|
100
|
+
└── _alert.scss
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Fra mappen `css` kjør:
|
|
104
|
+
|
|
105
|
+
```sh
|
|
106
|
+
$ npm run build-package
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Da skal CSS'en være tilgjengelig for deg i `vue`
|
|
110
|
+
|
|
111
|
+
## 🤝 Lag PR
|
|
112
|
+
|
|
113
|
+
Når du er klar for en PR skriv din GitHub-message som sier hva som er gjort, og evt issue nummer.
|
|
114
|
+
|
|
115
|
+
Vi bruker [Conventional Commits](https://www.conventionalcommits.org/) for å beskrive commits gjennom
|
|
116
|
+
noen regler. Ingen fare om du ikke følger den, vi tar en gjennomgang og evt justerer 😎.
|
|
117
|
+
|
|
118
|
+
```sh
|
|
119
|
+
fix(vue): #NR Rett feil på alert-komponenten # med issuenummer
|
|
120
|
+
fix(vue): Rett feil på alert-komponenten # patcher en bug i koden (patch i Semantic Versioning)
|
|
121
|
+
feat(vue): Legg til funksjonalitet # ny funksjonalitet i koden (minor i Semantic Versioning)
|
|
122
|
+
feat(vue)!: Legg til funksjonalitet og endre eksisterende # breaking change i koden (major i Semantic Versioning)
|
|
123
|
+
docs: Endre dokumentasjon # Endring i dokumentasjon
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## 🔢 Publisering og versjonering
|
|
127
|
+
|
|
128
|
+
Vi tar oss av publisering av pakken og versjonering.
|
|
129
|
+
|
|
130
|
+
Punkt bruker [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html) for versjonering av pakkene.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023-present Oslo kommune, Oslo Origo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
## Bruk av punkt-vue
|
|
2
|
+
|
|
3
|
+
<a href="https://www.npmjs.com/package/@oslokommune/punkt-vue" target="_blank"><img src="https://img.shields.io/npm/v/@oslokommune/punkt-vue?logo=vue.js&label=vue&style=for-the-badge&color=42b883" alt="Vue komponenter" /></a>
|
|
4
|
+
|
|
5
|
+
Dette repoet inneholder Punkt sine UI-komponenter for Vue 3. Komponentene er laget for å fungere sammen med `@oslokommune/punkt-assets` og `@oslokommune/punkt-css`.
|
|
6
|
+
|
|
7
|
+
## 📝 Forutsetninger
|
|
8
|
+
|
|
9
|
+
Peer dependencies:
|
|
10
|
+
|
|
11
|
+
- nodejs `16.15`
|
|
12
|
+
- vue `>= 2.6.12 < 3.0.0`
|
|
13
|
+
- @oslokommune/punkt-assets `>= 1.0`
|
|
14
|
+
- @oslokommune/punkt-css `>= 1.0`
|
|
15
|
+
|
|
16
|
+
## 🚀 Kom i gang - npm
|
|
17
|
+
|
|
18
|
+
### 1. Installer komponentbiblioteket
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
npm add @oslokommune/punkt-vue
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### 2. Importer komponentene
|
|
25
|
+
|
|
26
|
+
```js
|
|
27
|
+
/* src/main.js
|
|
28
|
+
|
|
29
|
+
Velg å installere hele bundlen */
|
|
30
|
+
import Vue from 'vue'
|
|
31
|
+
import PktVue from '@oslokommune/punkt-vue'
|
|
32
|
+
|
|
33
|
+
Vue.use(PktVue)
|
|
34
|
+
|
|
35
|
+
/* eller kun individuelle komponenter (med ikoner)*/
|
|
36
|
+
import Vue from 'vue'
|
|
37
|
+
import { PktHeader, PktFooter, PktIcon } from '@oslokommune/punkt-vue'
|
|
38
|
+
|
|
39
|
+
Vue.component('pkt-header', PktHeader)
|
|
40
|
+
Vue.component('pkt-footer', PktFooter)
|
|
41
|
+
Vue.component('pkt-icon', PktIcon)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## 🟪 Ikoner
|
|
45
|
+
|
|
46
|
+
Alle våre komponenter bruker PktIcon-komponenten for å importere
|
|
47
|
+
ikonene via vår [CDN](https://punkt-cdn.oslo.kommune.no/).
|
|
48
|
+
|
|
49
|
+
Om du har en content security policy(CSP) satt opp må du åpne for https://punkt-cdn.oslo.kommune.no/ i din CSP.
|
|
50
|
+
|
|
51
|
+
Les mer om ikoner [her.](/ressurser/ikoner/kode)
|
|
52
|
+
|
|
53
|
+
## 🧩 Komponentbiblioteket
|
|
54
|
+
|
|
55
|
+
For beskrivelse av hvordan ta i bruk hver enkelt komponent se [om komponenter](/komponenter/om-komponenter).
|
|
56
|
+
|
|
57
|
+
## 🔢 Versjonering
|
|
58
|
+
|
|
59
|
+
Punkt bruker [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html) for versjonering av pakkene.
|
|
60
|
+
|
|
61
|
+
## 👮 Lisens
|
|
62
|
+
|
|
63
|
+
`Punkt` er distribuert under [MIT-lisens](https://github.com/oslokommune/punkt/blob/main/packages/vue/LICENSE) for åpen kildekode.
|
|
64
|
+
|
|
65
|
+

|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const r=require("./Icon-Q_SkpRJa.cjs"),e=require("vue"),i=require("./plugins-AiK__HqQ.cjs"),c={name:"PktAlert",components:{PktIcon:r.PktIcon},props:{skin:{type:String,default:"info",validator(n){return["error","success","warning","info"].includes(n)}},closeAlert:{type:Boolean,default:!1},title:{type:String,default:""},date:{type:String,default:""},ariaLive:{type:String,default:"polite",validator(n){return["off","polite","assertive"].includes(n)}},slim:{type:Boolean,default:!1}},data:()=>({closed:!1}),methods:{close(){this.closed=!0,this.$emit("on-close",this.closed)}},computed:{skinClass(){return[`pkt-alert--${this.skin}`]},open(){return!this.closed},iconName(){return this.skin==="info"?"alert-information":`alert-${this.skin}`}}},d=["aria-live"],k={key:0,class:"pkt-alert__close"},u={key:1,class:"pkt-alert__title"},m={class:"pkt-alert__text"},_={key:2,class:"pkt-alert__date"};function p(n,o,t,v,y,l){const a=e.resolveComponent("pkt-icon");return e.withDirectives((e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"pkt-alert":!0,[l.skinClass]:!0,"pkt-alert--slim":t.slim}),"aria-live":t.ariaLive},[e.createVNode(a,{name:l.iconName,class:"pkt-alert__icon"},null,8,["name"]),t.closeAlert?(e.openBlock(),e.createElementBlock("div",k,[e.createElementVNode("button",{class:"pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only",type:"button",role:"button",tabindex:"0","aria-label":"close",onKeyup:o[0]||(o[0]=e.withKeys((...s)=>l.close&&l.close(...s),["enter"])),onClick:o[1]||(o[1]=(...s)=>l.close&&l.close(...s))},[e.createVNode(a,{class:"pkt-btn__icon",name:"close"})],32)])):e.createCommentVNode("",!0),t.title?(e.openBlock(),e.createElementBlock("div",u,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",m,[e.renderSlot(n.$slots,"default")]),t.date?(e.openBlock(),e.createElementBlock("div",_,"Sist oppdatert: "+e.toDisplayString(t.date),1)):e.createCommentVNode("",!0)],10,d)),[[e.vShow,l.open]])}const f=i._export_sfc(c,[["render",p]]);exports.PktAlert=f;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { P as u } from "./Icon-s3ZNrtl-.js";
|
|
2
|
+
import { resolveComponent as m, withDirectives as _, openBlock as a, createElementBlock as n, normalizeClass as p, createVNode as c, createElementVNode as d, withKeys as f, createCommentVNode as i, toDisplayString as k, renderSlot as v, vShow as y } from "vue";
|
|
3
|
+
import { _ as h } from "./plugins-IeJb3XDX.js";
|
|
4
|
+
const b = {
|
|
5
|
+
name: "PktAlert",
|
|
6
|
+
components: {
|
|
7
|
+
PktIcon: u
|
|
8
|
+
},
|
|
9
|
+
props: {
|
|
10
|
+
skin: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: "info",
|
|
13
|
+
validator(l) {
|
|
14
|
+
return ["error", "success", "warning", "info"].includes(l);
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
closeAlert: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: !1
|
|
20
|
+
},
|
|
21
|
+
title: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: ""
|
|
24
|
+
},
|
|
25
|
+
date: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: ""
|
|
28
|
+
},
|
|
29
|
+
ariaLive: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: "polite",
|
|
32
|
+
validator(l) {
|
|
33
|
+
return ["off", "polite", "assertive"].includes(l);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
slim: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: !1
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
data: () => ({
|
|
42
|
+
closed: !1
|
|
43
|
+
}),
|
|
44
|
+
methods: {
|
|
45
|
+
close() {
|
|
46
|
+
this.closed = !0, this.$emit("on-close", this.closed);
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
computed: {
|
|
50
|
+
skinClass() {
|
|
51
|
+
return [`pkt-alert--${this.skin}`];
|
|
52
|
+
},
|
|
53
|
+
open() {
|
|
54
|
+
return !this.closed;
|
|
55
|
+
},
|
|
56
|
+
iconName() {
|
|
57
|
+
return this.skin === "info" ? "alert-information" : `alert-${this.skin}`;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}, S = ["aria-live"], g = {
|
|
61
|
+
key: 0,
|
|
62
|
+
class: "pkt-alert__close"
|
|
63
|
+
}, C = {
|
|
64
|
+
key: 1,
|
|
65
|
+
class: "pkt-alert__title"
|
|
66
|
+
}, N = { class: "pkt-alert__text" }, P = {
|
|
67
|
+
key: 2,
|
|
68
|
+
class: "pkt-alert__date"
|
|
69
|
+
};
|
|
70
|
+
function w(l, s, t, x, A, e) {
|
|
71
|
+
const r = m("pkt-icon");
|
|
72
|
+
return _((a(), n("div", {
|
|
73
|
+
class: p({ "pkt-alert": !0, [e.skinClass]: !0, "pkt-alert--slim": t.slim }),
|
|
74
|
+
"aria-live": t.ariaLive
|
|
75
|
+
}, [
|
|
76
|
+
c(r, {
|
|
77
|
+
name: e.iconName,
|
|
78
|
+
class: "pkt-alert__icon"
|
|
79
|
+
}, null, 8, ["name"]),
|
|
80
|
+
t.closeAlert ? (a(), n("div", g, [
|
|
81
|
+
d("button", {
|
|
82
|
+
class: "pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only",
|
|
83
|
+
type: "button",
|
|
84
|
+
role: "button",
|
|
85
|
+
tabindex: "0",
|
|
86
|
+
"aria-label": "close",
|
|
87
|
+
onKeyup: s[0] || (s[0] = f((...o) => e.close && e.close(...o), ["enter"])),
|
|
88
|
+
onClick: s[1] || (s[1] = (...o) => e.close && e.close(...o))
|
|
89
|
+
}, [
|
|
90
|
+
c(r, {
|
|
91
|
+
class: "pkt-btn__icon",
|
|
92
|
+
name: "close"
|
|
93
|
+
})
|
|
94
|
+
], 32)
|
|
95
|
+
])) : i("", !0),
|
|
96
|
+
t.title ? (a(), n("div", C, k(t.title), 1)) : i("", !0),
|
|
97
|
+
d("div", N, [
|
|
98
|
+
v(l.$slots, "default")
|
|
99
|
+
]),
|
|
100
|
+
t.date ? (a(), n("div", P, "Sist oppdatert: " + k(t.date), 1)) : i("", !0)
|
|
101
|
+
], 10, S)), [
|
|
102
|
+
[y, e.open]
|
|
103
|
+
]);
|
|
104
|
+
}
|
|
105
|
+
const E = /* @__PURE__ */ h(b, [["render", w]]);
|
|
106
|
+
export {
|
|
107
|
+
E as P
|
|
108
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const o=require("./Icon-Q_SkpRJa.cjs"),e=require("vue"),a=require("./plugins-AiK__HqQ.cjs"),c={name:"PktButton",components:{PktIcon:o.PktIcon},props:{disabled:{type:Boolean,required:!1,default:!1},iconName:{type:String,required:!1,default:"user"},secondIconName:{type:String,required:!1,default:"user"},size:{type:String,default:"medium",validator:t=>["small","medium","large"].includes(t)},skin:{type:String,default:"primary",validator:t=>["primary","secondary","tertiary"].includes(t)},color:{type:String,validator:t=>["blue","blue-outline","green","green-outline","green-dark","green-dark-outline","beige-light","beige-dark-outline","yellow","yellow-outline","red","red-outline"].includes(t)},text:{type:String,required:!1,default:"Trykk her"},variant:{type:String,default:"label-only",validator:t=>["label-only","icon-left","icon-right","icon-only","icons-right-and-left"].includes(t)},type:{type:String,default:"button",validator:t=>["button","submit","reset"].includes(t)}},computed:{classes(){return["pkt-btn",this.sizeClass,this.skinClass,this.variantClass,this.colorClass]},sizeClass(){return this.size!=="medium"?`pkt-btn--${this.size}`:""},skinClass(){return this.skin!=="primary"?`pkt-btn--${this.skin}`:""},colorClass(){return this.color?`pkt-btn--${this.color}`:""},variantClass(){return this.variant!=="label-only"?`pkt-btn--${this.variant}`:""}}},u=["type","disabled"],d={class:"pkt-btn__text"};function k(t,i,n,y,p,s){const l=e.resolveComponent("pkt-icon");return e.openBlock(),e.createElementBlock("button",e.mergeProps(t.$attrs,{type:n.type,class:s.classes,onClick:i[0]||(i[0]=r=>t.$emit("onClick")),onKeyup:i[1]||(i[1]=e.withKeys(r=>t.$emit("onClick"),["enter"])),disabled:n.disabled}),[n.variant!=="label-only"?(e.openBlock(),e.createBlock(l,{key:0,class:"pkt-btn__icon",name:n.iconName},null,8,["name"])):e.createCommentVNode("",!0),e.createElementVNode("span",d,[e.renderSlot(t.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(n.text),1)])]),n.variant==="icons-right-and-left"?(e.openBlock(),e.createBlock(l,{key:1,class:"pkt-btn__icon",name:n.secondIconName},null,8,["name"])):e.createCommentVNode("",!0)],16,u)}const m=a._export_sfc(c,[["render",k]]);exports.PktButton=m;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { P as d } from "./Icon-s3ZNrtl-.js";
|
|
2
|
+
import { resolveComponent as u, openBlock as i, createElementBlock as c, mergeProps as m, withKeys as k, createBlock as r, createCommentVNode as s, createElementVNode as p, renderSlot as y, createTextVNode as b, toDisplayString as f } from "vue";
|
|
3
|
+
import { _ as g } from "./plugins-IeJb3XDX.js";
|
|
4
|
+
const h = {
|
|
5
|
+
name: "PktButton",
|
|
6
|
+
components: {
|
|
7
|
+
PktIcon: d
|
|
8
|
+
},
|
|
9
|
+
props: {
|
|
10
|
+
disabled: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
required: !1,
|
|
13
|
+
default: !1
|
|
14
|
+
},
|
|
15
|
+
iconName: {
|
|
16
|
+
type: String,
|
|
17
|
+
required: !1,
|
|
18
|
+
default: "user"
|
|
19
|
+
},
|
|
20
|
+
secondIconName: {
|
|
21
|
+
type: String,
|
|
22
|
+
required: !1,
|
|
23
|
+
default: "user"
|
|
24
|
+
},
|
|
25
|
+
size: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: "medium",
|
|
28
|
+
validator: (e) => ["small", "medium", "large"].includes(e)
|
|
29
|
+
},
|
|
30
|
+
skin: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: "primary",
|
|
33
|
+
validator: (e) => ["primary", "secondary", "tertiary"].includes(e)
|
|
34
|
+
},
|
|
35
|
+
color: {
|
|
36
|
+
type: String,
|
|
37
|
+
validator: (e) => [
|
|
38
|
+
"blue",
|
|
39
|
+
"blue-outline",
|
|
40
|
+
"green",
|
|
41
|
+
"green-outline",
|
|
42
|
+
"green-dark",
|
|
43
|
+
"green-dark-outline",
|
|
44
|
+
"beige-light",
|
|
45
|
+
"beige-dark-outline",
|
|
46
|
+
"yellow",
|
|
47
|
+
"yellow-outline",
|
|
48
|
+
"red",
|
|
49
|
+
"red-outline"
|
|
50
|
+
].includes(e)
|
|
51
|
+
},
|
|
52
|
+
// Text will get overwritten by "slot" if we have any DOM children in the button element
|
|
53
|
+
text: {
|
|
54
|
+
type: String,
|
|
55
|
+
required: !1,
|
|
56
|
+
default: "Trykk her"
|
|
57
|
+
},
|
|
58
|
+
variant: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: "label-only",
|
|
61
|
+
validator: (e) => ["label-only", "icon-left", "icon-right", "icon-only", "icons-right-and-left"].includes(e)
|
|
62
|
+
},
|
|
63
|
+
type: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: "button",
|
|
66
|
+
validator: (e) => ["button", "submit", "reset"].includes(e)
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
computed: {
|
|
70
|
+
classes() {
|
|
71
|
+
return ["pkt-btn", this.sizeClass, this.skinClass, this.variantClass, this.colorClass];
|
|
72
|
+
},
|
|
73
|
+
sizeClass() {
|
|
74
|
+
return this.size !== "medium" ? `pkt-btn--${this.size}` : "";
|
|
75
|
+
},
|
|
76
|
+
skinClass() {
|
|
77
|
+
return this.skin !== "primary" ? `pkt-btn--${this.skin}` : "";
|
|
78
|
+
},
|
|
79
|
+
colorClass() {
|
|
80
|
+
return this.color ? `pkt-btn--${this.color}` : "";
|
|
81
|
+
},
|
|
82
|
+
variantClass() {
|
|
83
|
+
return this.variant !== "label-only" ? `pkt-btn--${this.variant}` : "";
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}, v = ["type", "disabled"], _ = { class: "pkt-btn__text" };
|
|
87
|
+
function C(e, n, t, S, N, a) {
|
|
88
|
+
const l = u("pkt-icon");
|
|
89
|
+
return i(), c("button", m(e.$attrs, {
|
|
90
|
+
type: t.type,
|
|
91
|
+
class: a.classes,
|
|
92
|
+
onClick: n[0] || (n[0] = (o) => e.$emit("onClick")),
|
|
93
|
+
onKeyup: n[1] || (n[1] = k((o) => e.$emit("onClick"), ["enter"])),
|
|
94
|
+
disabled: t.disabled
|
|
95
|
+
}), [
|
|
96
|
+
t.variant !== "label-only" ? (i(), r(l, {
|
|
97
|
+
key: 0,
|
|
98
|
+
class: "pkt-btn__icon",
|
|
99
|
+
name: t.iconName
|
|
100
|
+
}, null, 8, ["name"])) : s("", !0),
|
|
101
|
+
p("span", _, [
|
|
102
|
+
y(e.$slots, "default", {}, () => [
|
|
103
|
+
b(f(t.text), 1)
|
|
104
|
+
])
|
|
105
|
+
]),
|
|
106
|
+
t.variant === "icons-right-and-left" ? (i(), r(l, {
|
|
107
|
+
key: 1,
|
|
108
|
+
class: "pkt-btn__icon",
|
|
109
|
+
name: t.secondIconName
|
|
110
|
+
}, null, 8, ["name"])) : s("", !0)
|
|
111
|
+
], 16, v);
|
|
112
|
+
}
|
|
113
|
+
const z = /* @__PURE__ */ g(h, [["render", C]]);
|
|
114
|
+
export {
|
|
115
|
+
z as P
|
|
116
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const o=require("vue"),i=require("./plugins-AiK__HqQ.cjs"),r={},c='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>';function u(t,n){return!r[t]&&typeof window.fetch=="function"&&(r[t]=window.fetch(n+t+".svg").then(e=>e.ok?e.text():(console.error("Missing icon: "+n+t+".svg"),c)).then(e=>e)),Promise.resolve(r[t])}const h={name:"PktIcon",data(){return{defaultSvgPath:"https://punkt-cdn.oslo.kommune.no/latest/icons/",innerHtml:""}},props:{name:{type:String,required:!0,default:void 0},path:{type:String,default:void 0}},watch:{name:{handler:"onNameChange",immediate:!0}},methods:{onNameChange(t){const n=this.path||this.$pktSvgPath||this.defaultSvgPath;u(t,n).then(e=>{this.innerHtml=e})}}},a=["innerHTML"];function l(t,n,e,p,s,f){return s.innerHtml?(o.openBlock(),o.createElementBlock("span",{key:0,class:"pkt-icon",innerHTML:s.innerHtml},null,8,a)):o.createCommentVNode("",!0)}const d=i._export_sfc(h,[["render",l]]);exports.PktIcon=d;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { openBlock as i, createElementBlock as s, createCommentVNode as c } from "vue";
|
|
2
|
+
import { _ as a } from "./plugins-IeJb3XDX.js";
|
|
3
|
+
const o = {}, h = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>';
|
|
4
|
+
function u(t, n) {
|
|
5
|
+
return !o[t] && typeof window.fetch == "function" && (o[t] = window.fetch(n + t + ".svg").then((e) => e.ok ? e.text() : (console.error("Missing icon: " + n + t + ".svg"), h)).then((e) => e)), Promise.resolve(o[t]);
|
|
6
|
+
}
|
|
7
|
+
const p = {
|
|
8
|
+
name: "PktIcon",
|
|
9
|
+
data() {
|
|
10
|
+
return {
|
|
11
|
+
defaultSvgPath: "https://punkt-cdn.oslo.kommune.no/latest/icons/",
|
|
12
|
+
innerHtml: ""
|
|
13
|
+
};
|
|
14
|
+
},
|
|
15
|
+
props: {
|
|
16
|
+
name: {
|
|
17
|
+
type: String,
|
|
18
|
+
required: !0,
|
|
19
|
+
default: void 0
|
|
20
|
+
},
|
|
21
|
+
path: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: void 0
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
watch: {
|
|
27
|
+
name: {
|
|
28
|
+
handler: "onNameChange",
|
|
29
|
+
immediate: !0
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
methods: {
|
|
33
|
+
onNameChange(t) {
|
|
34
|
+
const n = this.path || this.$pktSvgPath || this.defaultSvgPath;
|
|
35
|
+
u(t, n).then((e) => {
|
|
36
|
+
this.innerHtml = e;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}, l = ["innerHTML"];
|
|
41
|
+
function m(t, n, e, d, r, f) {
|
|
42
|
+
return r.innerHtml ? (i(), s("span", {
|
|
43
|
+
key: 0,
|
|
44
|
+
class: "pkt-icon",
|
|
45
|
+
innerHTML: r.innerHtml
|
|
46
|
+
}, null, 8, l)) : c("", !0);
|
|
47
|
+
}
|
|
48
|
+
const _ = /* @__PURE__ */ a(p, [["render", m]]);
|
|
49
|
+
export {
|
|
50
|
+
_ as P
|
|
51
|
+
};
|