@oslokommune/punkt-react 0.20.21 → 0.22.2

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 ADDED
@@ -0,0 +1,11 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## [0.22.2](https://github.com/oslokommune/punkt/compare/v0.22.1...v0.22.2) (2023-02-26)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **react:** Sett opp react-lib og publiseringsflyter ([#660](https://github.com/oslokommune/punkt/issues/660)) ([1bb89c7](https://github.com/oslokommune/punkt/commit/1bb89c764e1fd0e100cd7c2d6d820d958273609e))
@@ -0,0 +1,67 @@
1
+ ## Hvordan bidra - React ⭐
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
+ Vi oppfordrer deg til å starte med å lese vår
8
+ [overordnede guide for å bidra](/kom-i-gang/bidra/).
9
+
10
+ 👋 Happy coding!
11
+
12
+ ## 📝 Forutsetninger
13
+ - nodejs 16.15
14
+ - Kunnskap om [Sass (SCSS)](https://sass-lang.com/) og [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS).
15
+ - Forståelse av [BEM-navnekonvensjoner](http://getbem.com/) som designsystemet følger.
16
+ - 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).
17
+
18
+ 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.
19
+
20
+ Sett opp git hooks:
21
+
22
+ ```sh
23
+ git config core.hooksPath scripts/git-hooks
24
+ ```
25
+
26
+ ### Lerna
27
+
28
+ Punkt er et monorepo og bruker `lerna`. Det betyr at alle kommandoer kjører
29
+ fra repoets rot, og ikke i subrepoene.
30
+
31
+ Et utdrag fra rot-package.json viser noen scripts som er satt opp for å forenkle
32
+ utvikling i dette subrepoet:
33
+
34
+ ```sh
35
+ "scripts": {
36
+ "build-react": "npx lerna run build --scope=@oslokommune/punkt-react",
37
+ "build-react-app": "npx lerna run build-app --scope=@oslokommune/punkt-react",
38
+ "dev-react": "npx lerna run dev --scope=@oslokommune/punkt-react",
39
+ }
40
+ ```
41
+
42
+ ### Figma
43
+ 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)
44
+ (Krever innlogging og tilgang).
45
+
46
+ ## 🛠️ Gjør arbeidet
47
+ Kod som om livet ditt avhenger av det, men ha det gøy mens du gjør det!
48
+
49
+ ## 🤝 Lag PR
50
+ Når du er klar for en PR skriv din GitHub-message som sier hva som er gjort, og evt issue nummer.
51
+
52
+ Vi bruker [Conventional Commits](https://www.conventionalcommits.org/) for å beskrive commits gjennom
53
+ noen regler. Ingen fare om du ikke følger den, vi tar en gjennomgang og evt justerer 😎.
54
+
55
+ ```sh
56
+ fix(react): #NR Rett feil på alert-komponenten # med issuenummer
57
+ fix(react): Rett feil på alert-komponenten # patcher en bug i koden (patch i Semantic Versioning)
58
+ feat(react): Legg til funksjonalitet # ny funksjonalitet i koden (minor i Semantic Versioning)
59
+ feat(react)!: Legg til funksjonalitet og endre eksisterende # breaking change i koden (major i Semantic Versioning)
60
+ docs: Endre dokumentasjon # Endring i dokumentasjon
61
+ ```
62
+
63
+ ## 🔢 Publisering og versjonering
64
+ Vi tar oss av publisering av pakken og versjonering.
65
+
66
+ Punkt bruker [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html) for versjonering av pakkene.
67
+
package/LICENSE CHANGED
@@ -1,22 +1,21 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021-present Oslo kommune, Team Designsystem
3
+ Copyright (c) 2023-present Oslo kommune, Oslo Origo
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
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:
12
11
 
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
15
14
 
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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 CHANGED
@@ -1,37 +1,50 @@
1
- ## Bruk av @oslokommune/punkt-react
1
+ ## Bruk av punkt-react
2
2
 
3
3
  <a href="https://www.npmjs.com/package/@oslokommune/punkt-react" target="_blank"><img src="https://img.shields.io/npm/v/@oslokommune/punkt-react?logo=react&label=react&style=for-the-badge&color=61dafb" alt="React komponenter" /></a>
4
4
 
5
- Dette repoet inneholder Punkt sine UI-komponenter for React. Komponentene er laget for å fungere sammen med CSS fra designsystemet `@oslokommune/punkt-css`.
5
+ Dette repoet inneholder Punkt sine UI-komponenter for React. Komponentene er laget for å fungere sammen med `@oslokommune/punkt-assets` og `@oslokommune/punkt-css`.
6
6
 
7
- ## Forutsetninger
7
+ Se punkt-react i bruk i en [Vite-app med React og TypeScript](https://stackblitz.com/edit/vitejs-vite-ep2eyk?file=src/App.tsx).
8
+
9
+ ## 📝 Forutsetninger
8
10
 
9
11
  Peer dependencies:
10
12
  - nodejs `16.15`
11
- - react `>= 16`
12
- - @oslokommune/punkt-css `>= 0.20.0`
13
+ - react `>= 18`
14
+ - @oslokommune/punkt-assets `>= 1.0`
15
+ - @oslokommune/punkt-css `>= 1.0`
13
16
 
14
- ## 📄 Dokumentasjon [UNDER ARBEID]
17
+ ## 🚀 Kom i gang - npm
15
18
 
16
- Hver komponent vil være dokumentert på
17
- [nettsiden til designsystemet](https://punkt.oslo.kommune.no),
18
- på en stadig bedre måte.
19
+ ### 1. Installer komponentbiblioteket
19
20
 
20
- ## 🚀 Kom i gang [UNDER ARBEID]
21
+ ```sh
22
+ npm add @oslokommune/punkt-react
23
+ ```
21
24
 
22
- Vi jobber med denne!
25
+ ### 2. Importer komponentene
23
26
 
24
- ## Versjonering
27
+ ```js
28
+ // src/App.tsx
25
29
 
26
- Punkt bruker [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html) for versjonering av pakkene.
30
+ import { PktButton, PktInput } from "@oslokommune/punkt-react";
27
31
 
28
- Mens vi er i en beta-fase, versjonering vil følge dette mønsteret: **v0.Y.Z**, hvor
32
+ ...
29
33
 
30
- - **Y**: Major (breaking changes)
31
- - **Z**: Minor eller patch
34
+ <PktInput label="First name" id="firstName" />
35
+ <PktButton skin="primary" variant="icon-left" iconName="user">
36
+ Testbutton
37
+ </PktButton>
32
38
 
33
- ## 👮 Lisens
39
+ ```
40
+
41
+ ## 🧩 Komponentbiblioteket
42
+ For beskrivelse av hvordan ta i bruk hver enkelt komponent se [om komponenter](/komponenter/om-komponenter).
34
43
 
44
+ ## 🔢 Versjonering
45
+ Punkt bruker [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html) for versjonering av pakkene.
46
+
47
+ ## 👮 Lisens
35
48
  `Punkt` er distribuert under [MIT-lisens](https://github.com/oslokommune/punkt/blob/main/packages/react/LICENSE) for åpen kildekode.
36
49
 
37
- ![NPM License](https://img.shields.io/npm/l/@oslokommune/punkt-css?style=for-the-badge)
50
+ ![NPM License](https://img.shields.io/npm/l/@oslokommune/punkt-react?style=for-the-badge)
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ export interface IPktButton extends React.ButtonHTMLAttributes<HTMLButtonElement> {
3
+ iconName?: string;
4
+ mode?: 'light' | 'dark';
5
+ size?: 'small' | 'medium' | 'large';
6
+ skin?: 'primary' | 'secondary' | 'tertiary' | 'flat' | 'primary-confirm';
7
+ state?: 'normal' | 'focus' | 'hover' | 'active';
8
+ variant?: 'label-only' | 'icon-left' | 'icon-right' | 'icon-only';
9
+ }
10
+ export declare const PktButton: React.FC<IPktButton>;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ type HeaderProps = React.HTMLAttributes<HTMLDivElement> & {
3
+ logoLink?: string;
4
+ isLoggedIn?: boolean;
5
+ representing?: string;
6
+ canChangeRepresentation?: boolean;
7
+ showLogInButton?: boolean;
8
+ onLogIn?: () => void;
9
+ onLogOut?: () => void;
10
+ onChangeRepresentation?: () => void;
11
+ };
12
+ export declare const PktHeader: React.FC<HeaderProps>;
13
+ export {};
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface IPktIcon extends React.SVGProps<SVGSVGElement> {
3
+ name: string;
4
+ viewBox?: string;
5
+ }
6
+ export declare const PktIcon: React.FC<IPktIcon>;
7
+ export {};
@@ -0,0 +1,9 @@
1
+ export { PktButton } from './button/Button';
2
+ export { PktHeader } from './header/Header';
3
+ export { PktInput } from './input/Input';
4
+ export { PktTextarea } from './textarea/Textarea';
5
+ export { PktRadio } from './radio/Radio';
6
+ export { PktRadioGroup } from './radioGroup/RadioGroup';
7
+ export { PktTable } from './table/Table';
8
+ export { PktTableData } from './table/TableData';
9
+ export { PktTableHeader } from './table/TableHeader';
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
3
+ /** The input's label */
4
+ label?: string;
5
+ /** The input's id */
6
+ id: string;
7
+ }
8
+ /**
9
+ * Input component
10
+ * @param {string} label - Label for the input
11
+ * @param {string} id - Id for the input
12
+ * @param {string} validationMessage - Validation message for the input
13
+ * @param {React.InputHTMLAttributes<HTMLInputElement>} props - Other props to pass to the input
14
+ * @returns {React.ReactElement} - React element
15
+ *
16
+ * @example
17
+ * <Input label="First name" id="firstName" validationMessage="First name is required" />
18
+ *
19
+ */
20
+ export declare const PktInput: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
21
+ export {};