@razerspine/pug-ui-kit 1.2.1 → 1.3.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 +75 -28
- package/README.md +325 -24
- package/package.json +28 -1
- package/scss/components/_aside.scss +3 -2
- package/scss/components/_forms.scss +2 -1
- package/scss/components/_main.scss +3 -2
- package/scss/layout/_layout.scss +2 -1
- package/scss/utils/_helpers.scss +5 -2
- package/scss/utils/_mixins.scss +2 -1
- package/scss/utils/_utilities.scss +34 -20
- package/style/style.css +1899 -0
- package/style/style.css.map +1 -0
- package/style/style.min.css +2 -0
- package/style/style.min.css.map +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,34 +1,54 @@
|
|
|
1
|
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
# Changelog
|
|
4
|
+
|
|
5
|
+
## [1.3.0] - 2026-02-11
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- **Production CSS build pipeline**
|
|
9
|
+
- Compiles SCSS into `style/style.css`
|
|
10
|
+
- Generates minified version `style/style.min.css`
|
|
11
|
+
- Adds vendor prefixes via PostCSS + Autoprefixer
|
|
12
|
+
- **New build scripts**
|
|
13
|
+
- `clean`
|
|
14
|
+
- `build:css`
|
|
15
|
+
- `build:postcss`
|
|
16
|
+
- `build` (full pipeline)
|
|
17
|
+
- **Distributable CSS output**
|
|
18
|
+
- Users can now import compiled CSS directly:
|
|
19
|
+
```scss
|
|
20
|
+
@import "@razerspine/pug-ui-kit/style/style.min.css";
|
|
21
|
+
```
|
|
2
22
|
|
|
3
23
|
### Changed
|
|
4
|
-
-
|
|
5
|
-
-
|
|
24
|
+
- Migrated SCSS utilities to modern Dart Sass syntax
|
|
25
|
+
- Replaced deprecated global built-in functions
|
|
26
|
+
- Removed deprecated `if()` Sass function usage
|
|
27
|
+
- Updated `map-get` → `map.get`
|
|
28
|
+
- Improved forward-compatibility with Dart Sass 3.0+
|
|
6
29
|
|
|
7
|
-
###
|
|
8
|
-
-
|
|
30
|
+
### Notes
|
|
31
|
+
- No breaking changes.
|
|
32
|
+
- Existing SCSS/LESS usage remains fully supported.
|
|
33
|
+
- CSS build output is optional — advanced users can still consume SCSS/LESS sources directly.
|
|
9
34
|
|
|
10
|
-
### Migration Guide
|
|
11
|
-
If you were using the block content for actions:
|
|
12
|
-
```pug
|
|
13
|
-
// Old version (v1.0.0)
|
|
14
|
-
+dataTable(items, cols, { showActions: true })
|
|
15
|
-
a(href=`/edit/${item.id}`) Edit
|
|
16
|
-
```
|
|
17
|
-
You should now update to:
|
|
18
35
|
|
|
19
|
-
|
|
20
|
-
// New version (v1.0.1)
|
|
21
|
-
+dataTable(items, cols, {
|
|
22
|
-
actions: [
|
|
23
|
-
{ label: 'Edit', url: (item) => `/edit/${item.id}` }
|
|
24
|
-
]
|
|
25
|
-
})
|
|
26
|
-
```
|
|
36
|
+
## [1.2.2] - 2026-02-08
|
|
27
37
|
|
|
28
|
-
## [1.1.0] - 2026-02-03
|
|
29
38
|
### Added
|
|
30
|
-
- **
|
|
31
|
-
|
|
39
|
+
- **Build script**: Added a no-op `build` script (`echo "pug-ui-kit: nothing to build"`) to ensure compatibility with monorepo CI pipelines.
|
|
40
|
+
|
|
41
|
+
### Changed
|
|
42
|
+
- **Documentation**: Expanded `README.md` with full documentation of all available Pug mixins, including usage examples and configuration notes.
|
|
43
|
+
|
|
44
|
+
### Notes
|
|
45
|
+
- This release does not change runtime behavior.
|
|
46
|
+
- The update ensures smooth CI execution when building all workspace packages together.
|
|
47
|
+
|
|
48
|
+
## [1.2.1] - 2026-02-03
|
|
49
|
+
|
|
50
|
+
### Fixed
|
|
51
|
+
- **SCSS Scope**: Fixed "Undefined variable" error in `_fonts.scss` by explicitly importing settings module via `@use`.
|
|
32
52
|
|
|
33
53
|
## [1.2.0] - 2026-02-03
|
|
34
54
|
### Added
|
|
@@ -40,7 +60,7 @@ You should now update to:
|
|
|
40
60
|
- **Assets**: Resolved "Module not found" errors in Webpack by using tilde-prefixed paths (~) for internal asset resolution.
|
|
41
61
|
|
|
42
62
|
### Migration Guide (Optional)
|
|
43
|
-
By default, the kit now looks for fonts inside the package.
|
|
63
|
+
By default, the kit now looks for fonts inside the package.
|
|
44
64
|
If you wish to use a custom font path (e.g., a CDN or a different local folder), override the path variable before importing the kit:
|
|
45
65
|
|
|
46
66
|
#### SCSS:
|
|
@@ -57,7 +77,34 @@ If you wish to use a custom font path (e.g., a CDN or a different local folder),
|
|
|
57
77
|
@import "@razerspine/pug-ui-kit/less/ui-kit.less";
|
|
58
78
|
```
|
|
59
79
|
|
|
60
|
-
## [1.
|
|
80
|
+
## [1.1.0] - 2026-02-03
|
|
81
|
+
### Added
|
|
82
|
+
- **Styles**: Full SCSS and LESS support for all UI components.
|
|
83
|
+
- **Architecture**: Added global settings, grid system, and themes (light/dark).
|
|
61
84
|
|
|
62
|
-
|
|
63
|
-
|
|
85
|
+
## [1.0.1] - 2026-02-03
|
|
86
|
+
|
|
87
|
+
### Changed
|
|
88
|
+
- **dataTable**: Refactored the `dataTable` mixin to improve configuration consistency.
|
|
89
|
+
- **dataTable**: The `options` parameter now accepts an `actions` array to define row actions (links/buttons) dynamically.
|
|
90
|
+
|
|
91
|
+
### Removed
|
|
92
|
+
- **dataTable**: Removed support for the Pug `block` (slot) content for rendering actions. The `showActions` boolean option has also been removed.
|
|
93
|
+
|
|
94
|
+
### Migration Guide
|
|
95
|
+
If you were using the block content for actions:
|
|
96
|
+
```pug
|
|
97
|
+
// Old version (v1.0.0)
|
|
98
|
+
+dataTable(items, cols, { showActions: true })
|
|
99
|
+
a(href=`/edit/${item.id}`) Edit
|
|
100
|
+
```
|
|
101
|
+
You should now update to:
|
|
102
|
+
|
|
103
|
+
```pug
|
|
104
|
+
// New version (v1.0.1)
|
|
105
|
+
+dataTable(items, cols, {
|
|
106
|
+
actions: [
|
|
107
|
+
{ label: 'Edit', url: (item) => `/edit/${item.id}` }
|
|
108
|
+
]
|
|
109
|
+
})
|
|
110
|
+
```
|
package/README.md
CHANGED
|
@@ -11,11 +11,57 @@ This package is automatically included in templates generated via the CLI. To in
|
|
|
11
11
|
npm install @razerspine/pug-ui-kit
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
##
|
|
14
|
+
## 🎨 Styling Options
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
You now have **three ways** to use the styles:
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
### 1. Use compiled production CSS (Recommended for simple setups)
|
|
19
|
+
|
|
20
|
+
Fully prefixed and minified:
|
|
21
|
+
```scss
|
|
22
|
+
@import "@razerspine/pug-ui-kit/style/style.min.css";
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Non-minified version:
|
|
26
|
+
```scss
|
|
27
|
+
@import "@razerspine/pug-ui-kit/style/style.css";
|
|
28
|
+
```
|
|
29
|
+
- ✔ Includes vendor prefixes
|
|
30
|
+
- ✔ Cross-browser ready
|
|
31
|
+
- ✔ No Sass setup required
|
|
32
|
+
|
|
33
|
+
### 2. Use SCSS (Advanced / Customizable)
|
|
34
|
+
|
|
35
|
+
```scss
|
|
36
|
+
@use "@razerspine/pug-ui-kit/scss/ui-kit" as *;
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
If overriding settings:
|
|
40
|
+
|
|
41
|
+
```scss
|
|
42
|
+
@use "@razerspine/pug-ui-kit/scss/settings" with (
|
|
43
|
+
$font-path: "/my-custom-path/fonts"
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
@use "@razerspine/pug-ui-kit/scss/ui-kit" as *;
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 3. Use LESS
|
|
50
|
+
|
|
51
|
+
```less
|
|
52
|
+
@import "@razerspine/pug-ui-kit/less/ui-kit";
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Override font path:
|
|
56
|
+
|
|
57
|
+
```less
|
|
58
|
+
@font-path: "/my-custom-path/fonts";
|
|
59
|
+
@import "@razerspine/pug-ui-kit/less/ui-kit";
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## 🛠 Webpack Configuration (Pug Mixins)
|
|
63
|
+
|
|
64
|
+
To avoid complex relative paths:
|
|
19
65
|
|
|
20
66
|
```js
|
|
21
67
|
const uiKit = require('@razerspine/pug-ui-kit');
|
|
@@ -31,31 +77,60 @@ module.exports = {
|
|
|
31
77
|
};
|
|
32
78
|
```
|
|
33
79
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
Note: Always import settings first, as other components depend on them.
|
|
39
|
-
|
|
40
|
-
#### For SCSS:
|
|
41
|
-
|
|
42
|
-
```scss
|
|
43
|
-
// In your main.scss
|
|
44
|
-
@use "@razerspine/pug-ui-kit/scss/ui-kit" as *;
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
#### For LESS:
|
|
48
|
-
|
|
49
|
-
```less
|
|
50
|
-
// In your main.less
|
|
51
|
-
@import "@razerspine/pug-ui-kit/less/ui-kit";
|
|
80
|
+
Then:
|
|
81
|
+
```pug
|
|
82
|
+
include ~pug-ui-kit/btn.pug
|
|
52
83
|
```
|
|
53
84
|
|
|
54
|
-
## 🚀 Usage
|
|
85
|
+
## 🚀 Usage Examples
|
|
55
86
|
|
|
56
87
|
#### Button
|
|
57
88
|
|
|
58
89
|
```pug
|
|
90
|
+
//- Renders a configurable button with optional icon and text. Visual appearance
|
|
91
|
+
//- is primarily controlled by the `variant` and `size` parameters and by CSS
|
|
92
|
+
//- classes applied via `attrs` or global styles.
|
|
93
|
+
//-
|
|
94
|
+
//- NOTE: project migrated to an SVG sprite. The mixin references symbols by id
|
|
95
|
+
//- using <use href="#icon-{iconName}"> (xlink:href kept for legacy browsers).
|
|
96
|
+
//- Ensure your sprite contains <symbol id="icon-{name}"> entries.
|
|
97
|
+
//-
|
|
98
|
+
//- Parameters:
|
|
99
|
+
//- text - **String | null** — Visible button text. If `null` or an empty
|
|
100
|
+
//- string, the text node is omitted (icon-only button).
|
|
101
|
+
//- Default: null
|
|
102
|
+
//- variant - **String** — Visual variant modifier appended to `.btn--{variant}`.
|
|
103
|
+
//- Common values: 'primary', 'secondary', 'outline', 'text-primary',
|
|
104
|
+
//- 'text-secondary', 'icon-primary', 'icon-secondary', 'icon-outline', 'icon'.
|
|
105
|
+
//- Default: 'primary'
|
|
106
|
+
//- size - **String** — Size modifier appended to `.btn--{size}` and used
|
|
107
|
+
//- for icon sizing `.icon--{size}`. Common values: 'small', 'medium', 'large'.
|
|
108
|
+
//- Default: 'medium'
|
|
109
|
+
//- attrs - **Object | null** — Attributes to spread onto the `<button>`
|
|
110
|
+
//- element via `&attributes(attrs)`. Use this to pass `type`,
|
|
111
|
+
//- `id`, `aria-*`, `data-*`, etc. If `null`, no attributes are spread.
|
|
112
|
+
//- If `attrs.class` is present it will be merged with the base classes.
|
|
113
|
+
//- Default: { type: 'button' }
|
|
114
|
+
//- iconName - **String | null** — Icon name (without prefix). The mixin uses
|
|
115
|
+
//- `#icon-{iconName}` in <use> to reference the SVG sprite symbol.
|
|
116
|
+
//- If `null`, no icon is rendered.
|
|
117
|
+
//- Default: null
|
|
118
|
+
//-
|
|
119
|
+
//- Accessibility notes:
|
|
120
|
+
//- - If the button has visible text, the SVG is treated as decorative and gets
|
|
121
|
+
//- `aria-hidden="true"` so screen readers ignore it.
|
|
122
|
+
//- - If the button is icon-only (text === null or empty), the mixin will set
|
|
123
|
+
//- `aria-label` on the button if `attrs` does not already provide one. Provide
|
|
124
|
+
//- a meaningful `aria-label` in `attrs` for icon-only buttons.
|
|
125
|
+
//-
|
|
126
|
+
//- Behavior summary:
|
|
127
|
+
//- - Computes `hasText` to decide whether to render the text node.
|
|
128
|
+
//- - Builds base classes and safely merges any `attrs.class` with them.
|
|
129
|
+
//- - Renders <svg><use href="#icon-{iconName}" xlink:href="#icon-{iconName}"></use></svg>
|
|
130
|
+
//- when `iconName` is provided.
|
|
131
|
+
//- - Sets `aria-hidden` on the SVG when text is present; ensures icon-only buttons
|
|
132
|
+
//- have an accessible label.
|
|
133
|
+
|
|
59
134
|
include ~pug-ui-kit/btn.pug
|
|
60
135
|
|
|
61
136
|
+btn('Save', 'primary', 'small', { type: 'submit' })
|
|
@@ -64,6 +139,40 @@ include ~pug-ui-kit/btn.pug
|
|
|
64
139
|
#### Data Table (New in v1.1.0)
|
|
65
140
|
|
|
66
141
|
```pug
|
|
142
|
+
//- Renders a flexible table from an array of objects. Columns are derived
|
|
143
|
+
//- from the provided `columns` array or automatically collected from object keys.
|
|
144
|
+
//-
|
|
145
|
+
//- Parameters:
|
|
146
|
+
//- items - **Array** — Array of objects to render as rows. Each object
|
|
147
|
+
//- represents one row.
|
|
148
|
+
//- Default: []
|
|
149
|
+
//- columns - **Array | undefined** — Optional ordered list of keys to use
|
|
150
|
+
//- as columns. If omitted, unique keys are collected from `items`.
|
|
151
|
+
//- Default: auto-collected from items
|
|
152
|
+
//- options - **Object | undefined** — Configuration options:
|
|
153
|
+
//- - emptyText: **String** — Text shown when no rows; Default: 'No data'.
|
|
154
|
+
//- - showIndex: **Boolean** — Render leading index column; Default: false.
|
|
155
|
+
//- - formatters: **Object** — Map of column -> function(value) for custom rendering.
|
|
156
|
+
//- Example: { createdAt: v => new Date(v).toLocaleDateString() }.
|
|
157
|
+
//- - labels: **Object** — Map of column -> header label string.
|
|
158
|
+
//- Example: { id: 'ID', user_name: 'Name' }.
|
|
159
|
+
//- - actions: **Array** — List of action objects to render in the last column.
|
|
160
|
+
//- Replaces the deprecated block/slot mechanism.
|
|
161
|
+
//- Structure:
|
|
162
|
+
//- [
|
|
163
|
+
//- {
|
|
164
|
+
//- label: String, // Text of the link/button
|
|
165
|
+
//- url: Function(item), // Callback returning the URL string based on the row item
|
|
166
|
+
//- class: String (optional) // CSS classes for the link
|
|
167
|
+
//- }
|
|
168
|
+
//- ]
|
|
169
|
+
//- Default: []
|
|
170
|
+
//-
|
|
171
|
+
//- Behavior:
|
|
172
|
+
//- - Renders a table with Bootstrap-like classes (`table`).
|
|
173
|
+
//- - If `items` is empty, displays a unified row with `emptyText`.
|
|
174
|
+
//- - Actions are rendered as `<a>` tags in a separate column if `options.actions` is provided.
|
|
175
|
+
|
|
67
176
|
include ~pug-ui-kit/data-table.pug
|
|
68
177
|
|
|
69
178
|
- const data = [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}];
|
|
@@ -78,12 +187,51 @@ include ~pug-ui-kit/data-table.pug
|
|
|
78
187
|
url: (item) => `/users/edit/${item.id}`
|
|
79
188
|
}
|
|
80
189
|
]
|
|
81
|
-
})
|
|
190
|
+
})]
|
|
82
191
|
```
|
|
83
192
|
|
|
84
193
|
#### Form Input
|
|
85
194
|
|
|
86
195
|
```pug
|
|
196
|
+
//- Renders a configurable <input> element with optional label and placeholder.
|
|
197
|
+
//- Supports different input types, custom name, value, and placeholder text.
|
|
198
|
+
//-
|
|
199
|
+
//- Parameters:
|
|
200
|
+
//- type - **String** — Input type attribute.
|
|
201
|
+
//- Example: 'text', 'email', 'password', 'number'.
|
|
202
|
+
//- Default: none (required).
|
|
203
|
+
//- id - **String** — Unique identifier for the <input> element.
|
|
204
|
+
//- Also used by the <label> `for` attribute.
|
|
205
|
+
//- Example: 'username', 'email'.
|
|
206
|
+
//- Default: none (required).
|
|
207
|
+
//- label - **String | null** — Visible label text. If `null` or empty,
|
|
208
|
+
//- no label is rendered.
|
|
209
|
+
//- Example: 'Name', 'Email address'.
|
|
210
|
+
//- Default: null.
|
|
211
|
+
//- placeholder - **String** — Placeholder text displayed inside the input
|
|
212
|
+
//- when empty.
|
|
213
|
+
//- Example: 'Enter your name', 'example@mail.com'.
|
|
214
|
+
//- Default: ''.
|
|
215
|
+
//- name - **String** — Name attribute for form submission.
|
|
216
|
+
//- Example: 'username', 'email'.
|
|
217
|
+
//- Default: ''.
|
|
218
|
+
//- value - **String** — Default value for the input field.
|
|
219
|
+
//- Example: 'John Doe', 'test@mail.com'.
|
|
220
|
+
//- Default: ''.
|
|
221
|
+
//-
|
|
222
|
+
//- Behavior:
|
|
223
|
+
//- - The input always has `.form-control` class for styling.
|
|
224
|
+
//- - The label, if provided, uses `.form-label` class and is linked via `for=id`.
|
|
225
|
+
//- - The placeholder text is shown until the user types content.
|
|
226
|
+
//- - The `name` attribute ensures the input value is submitted with the form.
|
|
227
|
+
//- - The `value` attribute pre-fills the input field if provided.
|
|
228
|
+
//-
|
|
229
|
+
//- Notes about styling and classes:
|
|
230
|
+
//- - Visual appearance is controlled by `.form-control` and `.form-label`
|
|
231
|
+
//- styles in your SCSS.
|
|
232
|
+
//- - To add custom classes or attributes, extend the mixin or wrap it.
|
|
233
|
+
//- - Ensure `id` is unique to avoid duplicate `for`/`id` collisions.
|
|
234
|
+
|
|
87
235
|
include ~pug-ui-kit/form-input.pug
|
|
88
236
|
|
|
89
237
|
+formInput('text', 'name', 'Name', 'Enter your name', 'name')
|
|
@@ -92,6 +240,38 @@ include ~pug-ui-kit/form-input.pug
|
|
|
92
240
|
#### Form Textarea
|
|
93
241
|
|
|
94
242
|
```pug
|
|
243
|
+
//- Renders a configurable <textarea> element with optional label and placeholder.
|
|
244
|
+
//- Supports custom name attribute for form submission.
|
|
245
|
+
//-
|
|
246
|
+
//- Parameters:
|
|
247
|
+
//- id - **String** — Unique identifier for the <textarea> element.
|
|
248
|
+
//- Also used by the <label> `for` attribute.
|
|
249
|
+
//- Example: 'message', 'comment'.
|
|
250
|
+
//- Default: none (required).
|
|
251
|
+
//- label - **String | null** — Visible label text. If `null` or empty,
|
|
252
|
+
//- no label is rendered.
|
|
253
|
+
//- Example: 'Message', 'Comment'.
|
|
254
|
+
//- Default: null.
|
|
255
|
+
//- placeholder - **String** — Placeholder text displayed inside the textarea
|
|
256
|
+
//- when empty.
|
|
257
|
+
//- Example: 'Type your message...', 'Enter comment here'.
|
|
258
|
+
//- Default: ''.
|
|
259
|
+
//- name - **String** — Name attribute for form submission.
|
|
260
|
+
//- Example: 'message', 'feedback'.
|
|
261
|
+
//- Default: ''.
|
|
262
|
+
//-
|
|
263
|
+
//- Behavior:
|
|
264
|
+
//- - The textarea always has `.form-textarea` class for styling.
|
|
265
|
+
//- - The label, if provided, uses `.form-label` class and is linked via `for=id`.
|
|
266
|
+
//- - The placeholder text is shown until the user types content.
|
|
267
|
+
//- - The `name` attribute ensures the textarea value is submitted with the form.
|
|
268
|
+
//-
|
|
269
|
+
//- Notes about styling and classes:
|
|
270
|
+
//- - Visual appearance is controlled by `.form-textarea` and `.form-label`
|
|
271
|
+
//- styles in your SCSS.
|
|
272
|
+
//- - To add custom classes or attributes, extend the mixin or wrap it.
|
|
273
|
+
//- - Ensure `id` is unique to avoid duplicate `for`/`id` collisions.
|
|
274
|
+
|
|
95
275
|
include ~pug-ui-kit/form-textarea.pug
|
|
96
276
|
|
|
97
277
|
+formTextarea('message', 'Message', 'Type your message...', 'message')
|
|
@@ -100,6 +280,35 @@ include ~pug-ui-kit/form-textarea.pug
|
|
|
100
280
|
#### Input Checkbox
|
|
101
281
|
|
|
102
282
|
```pug
|
|
283
|
+
//- Renders a configurable checkbox with label and optional attributes.
|
|
284
|
+
//-
|
|
285
|
+
//- Summary
|
|
286
|
+
//- Renders a checkbox input and its label inside a single inline control.
|
|
287
|
+
//- Uses the project's base input styles so visual appearance is driven by SCSS.
|
|
288
|
+
//-
|
|
289
|
+
//- Parameters
|
|
290
|
+
//- id - **String** — Unique id for the <input>. Also used by <label for>.
|
|
291
|
+
//- Required; example: 'agree'.
|
|
292
|
+
//- label - **String** — Visible label text shown next to the checkbox.
|
|
293
|
+
//- Required; example: 'I agree to terms'.
|
|
294
|
+
//- name - **String** — Name attribute for form submission/grouping.
|
|
295
|
+
//- Optional; default: ''.
|
|
296
|
+
//- value - **String** — Value submitted when checked. Optional; default: 'on'.
|
|
297
|
+
//- checked - **Boolean** — Whether the checkbox is checked by default.
|
|
298
|
+
//- Optional; default: false.
|
|
299
|
+
//-
|
|
300
|
+
//- Behavior
|
|
301
|
+
//- - Wraps input and label in a single inline control element (uses .check-control-label).
|
|
302
|
+
//- - Input uses base input class (.input-base) so theme styles apply consistently.
|
|
303
|
+
//- - Label text is rendered in a sibling element (.input-text) and is clickable.
|
|
304
|
+
//- - If checked is true, the input is rendered with the checked attribute.
|
|
305
|
+
//- - Any attributes passed via attrs are applied to the <input> (useful for disabled, required, aria-*).
|
|
306
|
+
//-
|
|
307
|
+
//- Styling and accessibility
|
|
308
|
+
//- - Visual styling is controlled by .input-base, input[type="checkbox"], .check-control-label and .input-text in SCSS.
|
|
309
|
+
//- - Ensure id is unique to keep label association correct for screen readers.
|
|
310
|
+
//- - Prefer passing ARIA attributes via attrs for additional accessibility.
|
|
311
|
+
|
|
103
312
|
include ~pug-ui-kit/input-checkbox.pug
|
|
104
313
|
|
|
105
314
|
+inputCheckbox('agree', 'I agree to all terms')
|
|
@@ -108,6 +317,33 @@ include ~pug-ui-kit/input-checkbox.pug
|
|
|
108
317
|
#### Input Radio
|
|
109
318
|
|
|
110
319
|
```pug
|
|
320
|
+
//- Renders a configurable radio input with label for use in radio groups.
|
|
321
|
+
//-
|
|
322
|
+
//- Summary
|
|
323
|
+
//- Renders a single radio control paired with a clickable label.
|
|
324
|
+
//- Intended for groups where multiple radios share the same name.
|
|
325
|
+
//-
|
|
326
|
+
//- Parameters
|
|
327
|
+
//- id - **String** — Unique id for the <input>. Also used by <label for>.
|
|
328
|
+
//- Required; example: 'contact-email'.
|
|
329
|
+
//- label - **String** — Visible label text shown next to the radio.
|
|
330
|
+
//- Required; example: 'Email'.
|
|
331
|
+
//- name - **String** — Name attribute to group radios. Required; example: 'contact'.
|
|
332
|
+
//- value - **String** — Value submitted when selected. Required; example: 'email'.
|
|
333
|
+
//- checked - **Boolean** — Whether this radio is selected by default.
|
|
334
|
+
//- Optional; default: false.
|
|
335
|
+
//-
|
|
336
|
+
//- Behavior
|
|
337
|
+
//- - Wraps input and label in a single inline control (.check-control-label).
|
|
338
|
+
//- - Input uses .input-base so theme styles apply consistently.
|
|
339
|
+
//- - Radios with the same name are mutually exclusive; only one can be selected.
|
|
340
|
+
//- - If checked is true, the input is rendered with the checked attribute.
|
|
341
|
+
//- - Any attrs are applied to the <input> (useful for disabled, required, aria-*).
|
|
342
|
+
//-
|
|
343
|
+
//- Styling and accessibility
|
|
344
|
+
//- - Visual styling is controlled by .input-base, input[type="radio"], .check-control-label and .input-text in SCSS.
|
|
345
|
+
//- - Ensure id is unique to keep label association correct for screen readers.
|
|
346
|
+
|
|
111
347
|
include ~pug-ui-kit/input-radio.pug
|
|
112
348
|
|
|
113
349
|
.form-group
|
|
@@ -120,6 +356,57 @@ include ~pug-ui-kit/input-radio.pug
|
|
|
120
356
|
#### Single Select
|
|
121
357
|
|
|
122
358
|
```pug
|
|
359
|
+
//- Renders a configurable <select> element with label, options, and optional placeholder.
|
|
360
|
+
//- Supports both arrays of strings and arrays of objects with configurable
|
|
361
|
+
//- keys for label and value. Provides ability to set a default selected option.
|
|
362
|
+
//-
|
|
363
|
+
//- Parameters:
|
|
364
|
+
//- id - **String** — Unique identifier for the <select> element.
|
|
365
|
+
//- Also used as the `name` attribute.
|
|
366
|
+
//- Example: 'topic', 'country'.
|
|
367
|
+
//- Default: none (required).
|
|
368
|
+
//- label - **String | null** — Visible label text. If `null` or empty,
|
|
369
|
+
//- no label is rendered.
|
|
370
|
+
//- Example: 'Topic', 'Choose country'.
|
|
371
|
+
//- Default: null.
|
|
372
|
+
//- options - **Array** — Options to render. Can be:
|
|
373
|
+
//- - Array of strings: ['Support', 'Feedback', 'Other']
|
|
374
|
+
//- - Array of objects: [{value:'support', text:'Support'}, …]
|
|
375
|
+
//- - Array of objects with custom keys (see labelKey/valueKey).
|
|
376
|
+
//- Default: [].
|
|
377
|
+
//- labelKey - **String** — Key name in option objects for display text.
|
|
378
|
+
//- Example: 'text', 'label'.
|
|
379
|
+
//- Default: 'text'.
|
|
380
|
+
//- valueKey - **String** — Key name in option objects for option value.
|
|
381
|
+
//- Example: 'value', 'id'.
|
|
382
|
+
//- Default: 'value'.
|
|
383
|
+
//- selectedValue - **String** — Value of the option that should be selected
|
|
384
|
+
//- by default. If empty, no option is preselected.
|
|
385
|
+
//- Example: 'feedback', '2'.
|
|
386
|
+
//- Default: ''.
|
|
387
|
+
//- placeholder - **String** — Text for a placeholder option. Rendered only
|
|
388
|
+
//- if `label` is null and `selectedValue` is empty.
|
|
389
|
+
//- Example: 'Choose an option', 'Select country'.
|
|
390
|
+
//- Default: 'Choose an option'.
|
|
391
|
+
//-
|
|
392
|
+
//- Behavior:
|
|
393
|
+
//- - If `options` is an array of strings, each string is used as both
|
|
394
|
+
//- the option value and label.
|
|
395
|
+
//- - If `options` is an array of objects, the keys defined by `labelKey`
|
|
396
|
+
//- and `valueKey` are used.
|
|
397
|
+
//- - The option whose value matches `selectedValue` is rendered with
|
|
398
|
+
//- the `selected` attribute.
|
|
399
|
+
//- - If no label is provided and no selectedValue is set, a placeholder
|
|
400
|
+
//- option is rendered at the top (`disabled selected hidden`).
|
|
401
|
+
//- - The <select> element always has `.single-select` class for styling.
|
|
402
|
+
//- - The label, if provided, uses `.form-label` class.
|
|
403
|
+
//-
|
|
404
|
+
//- Notes about styling and classes:
|
|
405
|
+
//- - Visual appearance is controlled by `.single-select` and `.form-label`
|
|
406
|
+
//- styles in your SCSS.
|
|
407
|
+
//- - To add custom classes or attributes, extend the mixin or wrap it.
|
|
408
|
+
//- - Ensure `id` is unique to avoid duplicate `for`/`id` collisions.
|
|
409
|
+
|
|
123
410
|
include ~pug-ui-kit/single-select.pug
|
|
124
411
|
|
|
125
412
|
+singleSelect('topic', 'Topic', [
|
|
@@ -133,7 +420,9 @@ include ~pug-ui-kit/single-select.pug
|
|
|
133
420
|
|
|
134
421
|
* mixins/ - reusable Pug components.
|
|
135
422
|
* scss/ - complete SCSS kit (Settings, Components, Themes, Layout).
|
|
136
|
-
* less/ - complete LESS version for alternative workflows.
|
|
423
|
+
* less/ - complete LESS version for alternative workflows.
|
|
424
|
+
* style/ → Compiled CSS output (since v1.3.0)
|
|
425
|
+
* fonts/ → Roboto font family
|
|
137
426
|
* index.js - path resolution helper.
|
|
138
427
|
|
|
139
428
|
## 🧱 Components Included
|
|
@@ -146,5 +435,17 @@ include ~pug-ui-kit/single-select.pug
|
|
|
146
435
|
* input-radio.pug
|
|
147
436
|
* single-select.pug
|
|
148
437
|
|
|
438
|
+
## ⚙ Build (for contributors)
|
|
439
|
+
|
|
440
|
+
```bash
|
|
441
|
+
npm run build
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
**This will:**
|
|
445
|
+
|
|
446
|
+
- Compile SCSS
|
|
447
|
+
- Run PostCSS + Autoprefixer
|
|
448
|
+
- Generate minified CSS
|
|
449
|
+
|
|
149
450
|
## 📄 License
|
|
150
451
|
This project is licensed under the ISC License.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@razerspine/pug-ui-kit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Shared Pug mixins for Webpack Starter templates",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pug",
|
|
@@ -13,24 +13,51 @@
|
|
|
13
13
|
"fonts",
|
|
14
14
|
"scss",
|
|
15
15
|
"less",
|
|
16
|
+
"style",
|
|
16
17
|
"index.js",
|
|
17
18
|
"README.md",
|
|
18
19
|
"LICENSE",
|
|
19
20
|
"CHANGELOG.md"
|
|
20
21
|
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build:css": "sass scss/ui-kit.scss style/style.css",
|
|
24
|
+
"build:postcss": "postcss style/style.css --config postcss.config.js --output style/style.min.css",
|
|
25
|
+
"build": "npm run clean && npm run build:css && npm run build:postcss",
|
|
26
|
+
"clean": "rm -rf style",
|
|
27
|
+
"prepublishOnly": "npm run build"
|
|
28
|
+
},
|
|
21
29
|
"style": "scss/ui-kit.scss",
|
|
22
30
|
"less": "less/ui-kit.less",
|
|
31
|
+
"exports": {
|
|
32
|
+
".": "./index.js",
|
|
33
|
+
"./style": "./style/style.min.css",
|
|
34
|
+
"./style/style.css": "./style/style.css",
|
|
35
|
+
"./style/style.min.css": "./style/style.min.css"
|
|
36
|
+
},
|
|
23
37
|
"author": "Razerspine",
|
|
24
38
|
"repository": {
|
|
25
39
|
"type": "git",
|
|
26
40
|
"url": "https://github.com/Razerspine/webpack-starter-monorepo",
|
|
27
41
|
"directory": "packages/pug-ui-kit"
|
|
28
42
|
},
|
|
43
|
+
"homepage": "https://github.com/Razerspine/webpack-starter-monorepo/blob/main/packages/pug-ui-kit#readme",
|
|
29
44
|
"bugs": {
|
|
30
45
|
"url": "https://github.com/Razerspine/webpack-starter-monorepo/issues"
|
|
31
46
|
},
|
|
32
47
|
"license": "ISC",
|
|
33
48
|
"publishConfig": {
|
|
34
49
|
"access": "public"
|
|
50
|
+
},
|
|
51
|
+
"browserslist": [
|
|
52
|
+
">0.5%",
|
|
53
|
+
"last 2 versions",
|
|
54
|
+
"not dead"
|
|
55
|
+
],
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"sass": "^1.77.0",
|
|
58
|
+
"postcss": "^8.4.38",
|
|
59
|
+
"postcss-cli": "^11.0.0",
|
|
60
|
+
"autoprefixer": "^10.4.19",
|
|
61
|
+
"cssnano": "^6.1.2"
|
|
35
62
|
}
|
|
36
63
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@use "sass:map";
|
|
1
2
|
@use '../settings/index' as *;
|
|
2
3
|
|
|
3
4
|
.aside {
|
|
@@ -5,7 +6,7 @@
|
|
|
5
6
|
display: flex;
|
|
6
7
|
justify-content: flex-start;
|
|
7
8
|
padding: 0 $gutter;
|
|
8
|
-
@media screen and (min-width: map
|
|
9
|
+
@media screen and (min-width: map.get($breakpoints, lg)) {
|
|
9
10
|
padding: 0;
|
|
10
11
|
}
|
|
11
12
|
}
|
|
@@ -16,7 +17,7 @@
|
|
|
16
17
|
border-radius: $border-radius;
|
|
17
18
|
padding: $gutter;
|
|
18
19
|
width: 100%;
|
|
19
|
-
@media screen and (min-width: map
|
|
20
|
+
@media screen and (min-width: map.get($breakpoints, lg)) {
|
|
20
21
|
padding: calc($gutter * 2);
|
|
21
22
|
}
|
|
22
23
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@use "sass:map";
|
|
1
2
|
@use '../settings/index' as *;
|
|
2
3
|
|
|
3
4
|
.main {
|
|
@@ -6,7 +7,7 @@
|
|
|
6
7
|
justify-content: flex-start;
|
|
7
8
|
padding: 0 $gutter;
|
|
8
9
|
overflow: hidden;
|
|
9
|
-
@media screen and (min-width: map
|
|
10
|
+
@media screen and (min-width: map.get($breakpoints, lg)) {
|
|
10
11
|
padding: 0;
|
|
11
12
|
}
|
|
12
13
|
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
width: 100%;
|
|
18
19
|
min-height: 100%;
|
|
19
20
|
padding: $gutter;
|
|
20
|
-
@media screen and (min-width: map
|
|
21
|
+
@media screen and (min-width: map.get($breakpoints, lg)) {
|
|
21
22
|
padding: calc($gutter * 2);
|
|
22
23
|
}
|
|
23
24
|
}
|