create-bestax 4.2.14 → 4.2.16

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.
@@ -67,8 +67,11 @@ Set it once on `ConfigProvider` and omit `library` everywhere else.
67
67
 
68
68
  ## Google Material Icons — `'material-icons'`
69
69
 
70
- - **Setup:** `npm install material-icons` and `import 'material-icons';`.
71
- - **Scaffold flag:** `--icon material-icons`.
70
+ - **Setup:** `npm install material-icons` and `import 'material-icons/iconfont/filled.css';`, the
71
+ style `Icon` renders by default. Add `outlined.css`, `round.css`, `sharp.css` or `two-tone.css`
72
+ from `material-icons/iconfont/` for those variants; the bare `import 'material-icons';` loads
73
+ all five fonts.
74
+ - **Scaffold flag:** `--icon material-icons` (imports `filled.css` only).
72
75
  - **Names:** snake_case ligature text: `home`, `rocket_launch`, `shopping_cart`. A kebab-case
73
76
  name will not match a ligature and renders as raw text.
74
77
  - **Variants:** `filled` (default) / `outlined` / `round` / `sharp` — note **`round`**, not
@@ -77,8 +80,10 @@ Set it once on `ConfigProvider` and omit `library` everywhere else.
77
80
 
78
81
  ## Material Symbols — `'material-symbols'`
79
82
 
80
- - **Setup:** `npm install material-symbols` and `import 'material-symbols';`.
81
- - **Scaffold flag:** `--icon material-symbols`.
83
+ - **Setup:** `npm install material-symbols` and `import 'material-symbols/outlined.css';`, the
84
+ style `Icon` renders by default. Add `rounded.css` or `sharp.css` for those variants; the bare
85
+ `import 'material-symbols';` loads all three fonts.
86
+ - **Scaffold flag:** `--icon material-symbols` (imports `outlined.css` only).
82
87
  - **Names:** snake_case ligature text, same as Material Icons: `rocket_launch`.
83
88
  - **Variants:** `outlined` (default) / `rounded` / `sharp` — note **`rounded`** here vs
84
89
  Material Icons' `round`.
@@ -321,6 +321,14 @@ renders `has-text-<color>` too, and so does `is-centered`, which `isCentered` re
321
321
  beside `isRight`. Anything else keeps it as markup with a `children:File`, `context:File` or
322
322
  `attr` TODO.
323
323
 
324
+ A `has-name` `.file` with no `.file-name` converts only with Bulma's `is-empty` written on it as a
325
+ static class, since `File` renders `is-empty` there itself whatever a condition says, so a
326
+ condition on it can't stand in. The class then goes with the rest of the tree. The `File` gets
327
+ `fileName=""`, which pins its name empty the way a `.file-name`'s text pins it to that text. With
328
+ no `fileName`, `File` would show the name of the file a user picks and drop `is-empty`, which the
329
+ markup never does. Without a static `is-empty` the `.file` stays markup with a `defaults:File` TODO
330
+ that names the class to write.
331
+
324
332
  ## Families this source leaves as markup
325
333
 
326
334
  Their markup doesn't map element by element (the bestax component renders parts of its own, or
@@ -88,6 +88,11 @@ element the attribute it's missing.
88
88
  sets none, and `Card.Header.Icon` renders `aria-label="more options"` too. One whose `type` isn't
89
89
  `button`, `submit` or `reset` gets an `attr:type` TODO instead, since bestax writes `button` in its
90
90
  place. Write the type you mean, then re-run.
91
+ `File` renders a class rather than an attribute: Bulma's `is-empty`, on a `has-name` `.file` with
92
+ no `.file-name`, whatever a condition says. Write `is-empty` on the `.file` as a static class, then
93
+ re-run: a condition on `is-empty` can't stand in, so one already there still gets this TODO. The
94
+ `File` it becomes gets `fileName=""`, so a file the user picks leaves it as the markup was: no name
95
+ area, and `is-empty` still on.
91
96
 
92
97
  ### `drops:<Target>`
93
98
 
@@ -153,11 +153,13 @@ not `flexbox` — `flexbox` holds only the alignment props. Verified failure mod
153
153
  ## Worked example — the create-bestax starter app
154
154
 
155
155
  The `npm create bestax` starter renders `Container`, `Section`, `Columns`/`Column`, `Image`,
156
- `Title`/`SubTitle`, `Box`, `Card`, `Buttons`/`Button`, and `Notification` — all stock Bulma,
157
- no bestax extras. Its helper props are `display`/`justifyContent` (visibility + flexbox),
158
- `textAlign` (typography), and `textColor` (color); it uses no spacing props. That inventory
159
- compiles to the following — verified pixel-equivalent to the prebuilt `complete` flavor in
160
- headless Chromium (light and dark), at 453 KB raw / 40 KB gzip vs 813 KB / 83 KB:
156
+ `Title`/`SubTitle`, `Box`, `Card`, `Buttons`/`Button`, and `Notification` with its close
157
+ button: all stock Bulma, no bestax extras. Its helper props are `display` (visibility),
158
+ `flexGrow` (flexbox), and `textAlign` (typography); it uses no spacing or color props. That
159
+ inventory compiles to the following, verified pixel-equivalent to the prebuilt `complete`
160
+ flavor in headless Chromium (light and dark, phone and desktop width, notification open), at
161
+ 274 KB raw / 30 KB gzip vs 819 KB / 84 KB. Scaffolded with an icon library, the starter also
162
+ needs `bulma/sass/elements/icon` for its `IconText` card titles:
161
163
 
162
164
  ```scss
163
165
  // src/styles.scss
@@ -170,6 +172,7 @@ headless Chromium (light and dark), at 453 KB raw / 40 KB gzip vs 813 KB / 83 KB
170
172
 
171
173
  @use 'bulma/sass/elements/box';
172
174
  @use 'bulma/sass/elements/button'; // Button + Buttons
175
+ @use 'bulma/sass/elements/delete'; // Notification's close button
173
176
  @use 'bulma/sass/elements/image';
174
177
  @use 'bulma/sass/elements/notification';
175
178
  @use 'bulma/sass/elements/title'; // Title + SubTitle
@@ -179,9 +182,8 @@ headless Chromium (light and dark), at 453 KB raw / 40 KB gzip vs 813 KB / 83 KB
179
182
  @use 'bulma/sass/layout/section';
180
183
 
181
184
  @use 'bulma/sass/helpers/visibility'; // display="flex"
182
- @use 'bulma/sass/helpers/flexbox'; // justifyContent/flexGrow/flexShrink
185
+ @use 'bulma/sass/helpers/flexbox'; // flexGrow
183
186
  @use 'bulma/sass/helpers/typography'; // textAlign
184
- @use 'bulma/sass/helpers/color'; // textColor
185
187
  ```
186
188
 
187
189
  ```tsx
@@ -6,15 +6,15 @@ This template provides a minimal setup to get React working in Vite with HMR and
6
6
 
7
7
  ```bash
8
8
  pnpm install
9
- pnpm dev
9
+ pnpm run dev
10
10
  ```
11
11
 
12
12
  ## Available Scripts
13
13
 
14
- - `pnpm dev` - Start development server
15
- - `pnpm build` - Build for production
16
- - `pnpm preview` - Preview production build
17
- - `pnpm lint` - Run ESLint
14
+ - `pnpm run dev` - Start development server
15
+ - `pnpm run build` - Build for production
16
+ - `pnpm run preview` - Preview production build
17
+ - `pnpm run lint` - Run ESLint
18
18
 
19
19
  ## Features
20
20
 
@@ -22,7 +22,6 @@ pnpm dev
22
22
  - 🎨 Bulma CSS framework
23
23
  - 📦 bestax-bulma component library
24
24
  - 🔧 ESLint pre-configured
25
- - 🎯 Font Awesome icons included
26
25
 
27
26
  ## Learn More
28
27
 
@@ -1 +1,14 @@
1
- /* App-specific styles - keep minimal, let Bulma handle the styling */
1
+ /* App-specific styles - keep minimal, let Bulma handle the styling */
2
+
3
+ /* A link inside running text needs more than its color to stand out
4
+ (WCAG 1.4.1), and no helper prop sets an underline. */
5
+ .text-link {
6
+ text-decoration: underline;
7
+ }
8
+
9
+ /* Bulma spaces a notification from whatever follows it in the same parent,
10
+ and each notification here is alone in its status region, so the space
11
+ between two showing at once goes between their regions instead. */
12
+ .status-region:not(:empty) + .status-region:not(:empty) {
13
+ margin-top: var(--bulma-block-spacing);
14
+ }
@@ -1,4 +1,4 @@
1
- import { useState } from 'react';
1
+ import { useRef, useState } from 'react';
2
2
  import {
3
3
  Box,
4
4
  Button,
@@ -18,127 +18,155 @@ import './App.css';
18
18
  function App() {
19
19
  const [showNotification, setShowNotification] = useState(false);
20
20
  const [count, setCount] = useState(0);
21
+ // Where focus goes when the button holding it goes away (the notification's
22
+ // close button) or disables itself (Reset, at zero), so a keyboard user is
23
+ // not dropped at the top of the page.
24
+ const toggleRef = useRef(null);
25
+ const countRef = useRef(null);
21
26
 
22
27
  return (
23
- <>
24
- <Container breakpoint="desktop" isMax>
25
- <Section>
26
- <Columns isCentered>
27
- <Column isNarrow display="flex" justifyContent="center">
28
+ <main>
29
+ <Section>
30
+ <Container breakpoint="desktop" isMax>
31
+ <Columns isCentered isMobile isMultiline>
32
+ <Column isNarrow>
28
33
  <Image src="/bestax.svg" alt="Bestax" size="128x128" />
29
34
  </Column>
30
- <Column isNarrow display="flex" justifyContent="center">
35
+ <Column isNarrow>
31
36
  <Image src="/vite.svg" alt="Vite" size="128x128" />
32
37
  </Column>
33
- <Column isNarrow display="flex" justifyContent="center">
38
+ <Column isNarrow>
34
39
  <Image src="/react.svg" alt="React" size="128x128" />
35
40
  </Column>
36
41
  </Columns>
37
42
  <Title size="1" textAlign="centered">
38
43
  Bestax + Vite + React
39
44
  </Title>
40
- </Section>
41
45
 
42
- <Box>
43
- <Title size="3">Get Started</Title>
44
- <SubTitle size="5" textColor="grey">
45
- This template includes everything you need to build with
46
- bestax-bulma
47
- </SubTitle>
48
- </Box>
46
+ <Box>
47
+ <Title as="h2">Get Started</Title>
48
+ <SubTitle as="p" size="5">
49
+ This template includes everything you need to build with
50
+ bestax-bulma
51
+ </SubTitle>
52
+ </Box>
49
53
 
50
- <Columns>
51
- <Column display="flex">
52
- <Card flexGrow="1" flexShrink="1">
53
- <Card.Header>
54
- <Card.Header.Title>Quick Start</Card.Header.Title>
55
- </Card.Header>
56
- <Card.Content>
57
- Edit src/App.jsx and save to test HMR updates.
58
- </Card.Content>
59
- </Card>
60
- </Column>
54
+ <Columns>
55
+ <Column display="flex">
56
+ <Card flexGrow="1">
57
+ <Card.Header>
58
+ <Card.Header.Title as="h3">Quick Start</Card.Header.Title>
59
+ </Card.Header>
60
+ <Card.Content>
61
+ Edit src/App.jsx and save to test HMR updates.
62
+ </Card.Content>
63
+ </Card>
64
+ </Column>
61
65
 
62
- <Column display="flex">
63
- <Card flexGrow="1" flexShrink="1">
64
- <Card.Header>
65
- <Card.Header.Title>Documentation</Card.Header.Title>
66
- </Card.Header>
67
- <Card.Content>
68
- Visit{' '}
69
- <a
70
- href="https://bestax.io"
71
- target="_blank"
72
- rel="noopener noreferrer"
73
- >
74
- bestax.io
75
- </a>{' '}
76
- for component docs.
77
- </Card.Content>
78
- </Card>
79
- </Column>
66
+ <Column display="flex">
67
+ <Card flexGrow="1">
68
+ <Card.Header>
69
+ <Card.Header.Title as="h3">Documentation</Card.Header.Title>
70
+ </Card.Header>
71
+ <Card.Content>
72
+ Visit{' '}
73
+ <a
74
+ className="text-link"
75
+ href="https://bestax.io"
76
+ target="_blank"
77
+ rel="noopener noreferrer"
78
+ >
79
+ bestax.io
80
+ </a>{' '}
81
+ for component docs.
82
+ </Card.Content>
83
+ </Card>
84
+ </Column>
80
85
 
81
- <Column display="flex">
82
- <Card flexGrow="1" flexShrink="1">
83
- <Card.Header>
84
- <Card.Header.Title>Examples</Card.Header.Title>
85
- </Card.Header>
86
- <Card.Content>
87
- Check the examples below to see components in action.
88
- </Card.Content>
89
- </Card>
90
- </Column>
91
- </Columns>
86
+ <Column display="flex">
87
+ <Card flexGrow="1">
88
+ <Card.Header>
89
+ <Card.Header.Title as="h3">Examples</Card.Header.Title>
90
+ </Card.Header>
91
+ <Card.Content>
92
+ Check the examples below to see components in action.
93
+ </Card.Content>
94
+ </Card>
95
+ </Column>
96
+ </Columns>
92
97
 
93
- <Box>
94
- <Title size="4">Interactive Example</Title>
98
+ <Box>
99
+ <Title as="h2">Interactive Example</Title>
95
100
 
96
- <Columns isVCentered>
97
- <Column size="half">
98
- <Buttons>
99
- <Button
100
- color="primary"
101
- onClick={() => setShowNotification(!showNotification)}
102
- >
103
- Toggle Notification
104
- </Button>
101
+ <Columns isVCentered>
102
+ <Column size="half">
103
+ <Buttons>
104
+ <Button
105
+ ref={toggleRef}
106
+ color="primary"
107
+ onClick={() => setShowNotification(!showNotification)}
108
+ >
109
+ Toggle Notification
110
+ </Button>
105
111
 
106
- <Button color="info" onClick={() => setCount(count + 1)}>
107
- Count: {count}
108
- </Button>
112
+ <Button
113
+ ref={countRef}
114
+ color="info"
115
+ onClick={() => setCount(count + 1)}
116
+ >
117
+ Count: {count}
118
+ </Button>
109
119
 
110
- <Button
111
- color="warning"
112
- onClick={() => setCount(0)}
113
- disabled={count === 0}
114
- >
115
- Reset
116
- </Button>
117
- </Buttons>
118
- </Column>
120
+ <Button
121
+ color="warning"
122
+ onClick={() => {
123
+ setCount(0);
124
+ countRef.current?.focus();
125
+ }}
126
+ disabled={count === 0}
127
+ >
128
+ Reset
129
+ </Button>
130
+ </Buttons>
131
+ </Column>
119
132
 
120
- <Column size="half">
121
- {showNotification && (
122
- <Notification
123
- color="success"
124
- isLight
125
- onDelete={() => setShowNotification(false)}
126
- >
127
- <strong>Success!</strong> Your Vite + Bestax setup is working
128
- perfectly!
129
- </Notification>
130
- )}
133
+ {/* A status region reads out all it holds whenever any of it
134
+ changes, so each notification has a region of its own: a
135
+ screen reader hears the one that appeared or changed, and
136
+ not the other with it. The regions stay mounted while their
137
+ content changes: one added along with its content may not
138
+ be announced. */}
139
+ <Column size="half">
140
+ <div role="status" className="status-region">
141
+ {showNotification && (
142
+ <Notification
143
+ color="success"
144
+ isLight
145
+ hasDelete
146
+ onDelete={() => {
147
+ setShowNotification(false);
148
+ toggleRef.current?.focus();
149
+ }}
150
+ >
151
+ <strong>Success!</strong> Your Vite + Bestax setup is
152
+ working perfectly!
153
+ </Notification>
154
+ )}
155
+ </div>
131
156
 
132
- {count > 10 && (
133
- <Notification color="info" isLight>
134
- You&apos;ve clicked the button {count} times!
135
- </Notification>
136
- )}
137
- </Column>
138
- </Columns>
139
- </Box>
140
- </Container>
141
- </>
157
+ <div role="status" className="status-region">
158
+ {count > 10 && (
159
+ <Notification color="info" isLight>
160
+ You&apos;ve clicked the button {count} times!
161
+ </Notification>
162
+ )}
163
+ </div>
164
+ </Column>
165
+ </Columns>
166
+ </Box>
167
+ </Container>
168
+ </Section>
169
+ </main>
142
170
  );
143
171
  }
144
172
 
@@ -1,10 +1,11 @@
1
1
  import { StrictMode } from 'react';
2
2
  import { createRoot } from 'react-dom/client';
3
- import App from './App.jsx';
4
3
 
5
- // Import Bestax CSS (Bulma + extras)
4
+ // Bestax's stylesheet loads before the app's own CSS, so a named class in
5
+ // src/App.css wins over a Bulma rule of the same weight.
6
6
  import '@allxsmith/bestax-bulma/bestax.css';
7
7
  import './index.css';
8
+ import App from './App.jsx';
8
9
 
9
10
  createRoot(document.getElementById('root')).render(
10
11
  <StrictMode>
@@ -6,15 +6,15 @@ This template provides a minimal setup to get React working in Vite with TypeScr
6
6
 
7
7
  ```bash
8
8
  pnpm install
9
- pnpm dev
9
+ pnpm run dev
10
10
  ```
11
11
 
12
12
  ## Available Scripts
13
13
 
14
- - `pnpm dev` - Start development server
15
- - `pnpm build` - Build for production
16
- - `pnpm preview` - Preview production build
17
- - `pnpm lint` - Run ESLint
14
+ - `pnpm run dev` - Start development server
15
+ - `pnpm run build` - Build for production
16
+ - `pnpm run preview` - Preview production build
17
+ - `pnpm run lint` - Run ESLint
18
18
 
19
19
  ## Features
20
20
 
@@ -23,7 +23,6 @@ pnpm dev
23
23
  - 📦 bestax-bulma component library
24
24
  - 📘 TypeScript for type safety
25
25
  - 🔧 ESLint pre-configured
26
- - 🎯 Font Awesome icons included
27
26
 
28
27
  ## Learn More
29
28
 
@@ -1 +1,14 @@
1
- /* App-specific styles - keep minimal, let Bulma handle the styling */
1
+ /* App-specific styles - keep minimal, let Bulma handle the styling */
2
+
3
+ /* A link inside running text needs more than its color to stand out
4
+ (WCAG 1.4.1), and no helper prop sets an underline. */
5
+ .text-link {
6
+ text-decoration: underline;
7
+ }
8
+
9
+ /* Bulma spaces a notification from whatever follows it in the same parent,
10
+ and each notification here is alone in its status region, so the space
11
+ between two showing at once goes between their regions instead. */
12
+ .status-region:not(:empty) + .status-region:not(:empty) {
13
+ margin-top: var(--bulma-block-spacing);
14
+ }