dibk-design 10.5.8 → 11.1.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/README.md CHANGED
@@ -1,49 +1,42 @@
1
1
  # DIBK design
2
2
 
3
- Shared components for DIBK applications
3
+ Shared React component library for DIBK applications — 43 components, design tokens, and themes, published as the [`dibk-design`](https://www.npmjs.com/package/dibk-design) npm package.
4
4
 
5
- ## Getting Started
5
+ Component documentation (Storybook): https://arkitektum.github.io/dibk-design/
6
6
 
7
- 1. **Install Dependencies**
7
+ ## Using the package
8
+
9
+ 1. **Install**
8
10
 
9
- This project uses [pnpm](https://pnpm.io/) as the package manager.
10
11
  ```bash
11
- pnpm install
12
+ npm install dibk-design
12
13
  ```
13
14
 
14
- 2. **Run Storybook for Development**
15
+ Peer dependencies (must be installed in your app): `react` (18 or 19), `react-dom`, `react-router-dom` (6.4+ or 7).
15
16
 
16
- To view and work on components in isolation, run the Storybook development server:
17
- ```bash
18
- pnpm run storybook
19
- ```
20
- This will open Storybook in your browser, usually at `http://localhost:6006`.
17
+ 2. **Import the component styles**
21
18
 
22
- ## Building for Production
19
+ All compiled component styles ship in a single CSS file that your app must import once (e.g. in your global CSS or app entry):
23
20
 
24
- When you need to create a distributable version of the library or the Storybook site, use the following commands.
21
+ ```css
22
+ @import "dibk-design/dibk-design.css";
23
+ ```
25
24
 
26
- ### Build Library
27
- Bundles the library for production and generates TypeScript types. The output is saved to the `/dist` folder.
28
- ```bash
29
- pnpm run build
30
- ```
25
+ 3. **Use the components**
31
26
 
32
- ### Build TypeScript Types
33
- Only generates the TypeScript declaration files (`.d.ts`).
34
- ```bash
35
- pnpm run build:types
36
- ```
27
+ ```jsx
28
+ import { Button } from "dibk-design";
37
29
 
38
- ### Build Storybook
39
- Builds the Storybook as a static web application. The output is saved to the `/storybook-static` folder.
40
- ```bash
41
- pnpm run build-storybook
42
- ```
30
+ const Example = () => (
31
+ <Button onClick={() => {}} size="small" color="primary">
32
+ I'm a button
33
+ </Button>
34
+ );
35
+ ```
43
36
 
44
37
  ## Styles & tokens
45
38
 
46
- This package ships two CSS entrypoints:
39
+ In addition to `dibk-design/dibk-design.css` (component styles), the package ships two design-token entrypoints:
47
40
 
48
41
  - `dibk-design/theme.css` — Tailwind-friendly theme tokens (via `@theme`)
49
42
  - `dibk-design/tokens.css` — plain CSS variables for non-Tailwind apps
@@ -55,6 +48,7 @@ Import the theme tokens in your global CSS:
55
48
  ```css
56
49
  @import "tailwindcss";
57
50
  @import "dibk-design/theme.css";
51
+ @import "dibk-design/dibk-design.css";
58
52
  ```
59
53
 
60
54
  ### Use without Tailwind
@@ -63,33 +57,88 @@ Import the plain tokens instead:
63
57
 
64
58
  ```css
65
59
  @import "dibk-design/tokens.css";
60
+ @import "dibk-design/dibk-design.css";
66
61
  ```
67
62
 
68
63
  ## Use with Next.js
69
64
 
70
- 1. Import the CSS entrypoint in your `globals.css`
65
+ 1. Import the CSS entrypoints in your `globals.css`
71
66
 
72
67
  ```css
73
68
  @import "tailwindcss";
74
69
  @import "dibk-design/theme.css";
70
+ @import "dibk-design/dibk-design.css";
75
71
  ```
76
72
 
77
- 2. Import component from the library
73
+ 2. Import components from the library
78
74
 
79
75
  ```jsx
80
- "use client"
81
- import React from 'react'
82
- import { Button } from 'dibk-design'
76
+ "use client";
77
+ import React from "react";
78
+ import { Button } from "dibk-design";
83
79
 
84
80
  const Home = () => {
85
81
  return (
86
82
  <main>
87
- <Button onClick={() => {}} size="small" color="primary" content="Button">
88
- I'm a button
83
+ <Button onClick={() => {}} size="small" color="primary">
84
+ I'm a button
89
85
  </Button>
90
86
  </main>
91
- )
92
- }
87
+ );
88
+ };
89
+
90
+ export default Home;
91
+ ```
92
+
93
+ ## Developing the library
94
+
95
+ This project uses [pnpm](https://pnpm.io/) as the package manager.
96
+
97
+ 1. **Install dependencies**
98
+
99
+ ```bash
100
+ pnpm install
101
+ ```
102
+
103
+ 2. **Run Storybook for development**
104
+
105
+ To view and work on components in isolation, run the Storybook development server:
106
+ ```bash
107
+ pnpm run storybook
108
+ ```
109
+ This will open Storybook in your browser, usually at `http://localhost:6006`.
110
+
111
+ ## Building for production
112
+
113
+ ### Build library
114
+
115
+ Type-checks, bundles the library (ES/CJS + a bundled `index.d.ts`), and copies the token files. The output is saved to the `/dist` folder.
116
+ ```bash
117
+ pnpm run build:lib
118
+ ```
119
+
120
+ ### Build Storybook
121
+
122
+ Builds the Storybook as a static web application. The output is saved to the `/storybook-static` folder.
123
+ ```bash
124
+ pnpm run build:storybook
125
+ ```
126
+
127
+ ### Build everything
128
+
129
+ Builds both the library and the Storybook site:
130
+ ```bash
131
+ pnpm run build
132
+ ```
133
+
134
+ ## Testing local changes in a consuming app
135
+
136
+ Use [yalc](https://github.com/wclr/yalc) to test the built package in another app without publishing:
137
+
138
+ ```bash
139
+ # In dibk-design — after making changes:
140
+ pnpm run build:lib && npx yalc push
93
141
 
94
- export default Home
142
+ # In the consuming app — first time only:
143
+ npx yalc add dibk-design
95
144
  ```