@allxsmith/bestax-bulma 5.25.0 → 5.26.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/dist/index.cjs +59 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +59 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/types/helpers/Theme.d.ts +18 -2
- package/dist/types-cjs/helpers/Theme.d.ts +18 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -15300,17 +15300,20 @@ function cssVarToProp(varName) {
|
|
|
15300
15300
|
.join('');
|
|
15301
15301
|
}
|
|
15302
15302
|
/**
|
|
15303
|
-
* Prop names `cssVarToProp` would mint that are already
|
|
15304
|
-
*
|
|
15305
|
-
* `
|
|
15306
|
-
*
|
|
15307
|
-
* through
|
|
15303
|
+
* Prop names `cssVarToProp` would mint that are already helper props:
|
|
15304
|
+
* `--bulma-shadow` becomes `shadow`, `--bulma-radius` becomes `radius` and
|
|
15305
|
+
* `--bulma-column-gap` becomes `columnGap`. They stay out of
|
|
15306
|
+
* `bulmaVarPropMap`, so on Theme each is the helper prop it is on every other
|
|
15307
|
+
* component, and every one of those variables is still reachable through
|
|
15308
|
+
* `bulmaVars`.
|
|
15308
15309
|
*
|
|
15309
15310
|
* `radius` was missed here once and set `--bulma-radius` while typed as the
|
|
15310
15311
|
* helper (#694). It still writes that variable, so what it did then keeps
|
|
15311
|
-
* working; see `themeRadiusVar`.
|
|
15312
|
+
* working; see `themeRadiusVar`. `columnGap` joined when the gap helpers
|
|
15313
|
+
* became shared helper props, and keeps its old variable route the same way;
|
|
15314
|
+
* see `themeColumnGapVar`.
|
|
15312
15315
|
*/
|
|
15313
|
-
const helperPropNames = ['shadow', 'radius'];
|
|
15316
|
+
const helperPropNames = ['shadow', 'radius', 'columnGap'];
|
|
15314
15317
|
/**
|
|
15315
15318
|
* Mapping of camelCase prop names to their Bulma CSS variable counterparts,
|
|
15316
15319
|
* minus the `helperPropNames` above.
|
|
@@ -15372,6 +15375,36 @@ const themeRadiusVar = (radius) => {
|
|
|
15372
15375
|
`bulmaVars={{ '--bulma-radius': '${radius}' }} instead.`);
|
|
15373
15376
|
return radius;
|
|
15374
15377
|
};
|
|
15378
|
+
/**
|
|
15379
|
+
* What `columnGap` writes to `--bulma-column-gap` on a Theme, or `undefined`
|
|
15380
|
+
* when it writes nothing.
|
|
15381
|
+
*
|
|
15382
|
+
* Until the gap helpers were shared helper props, `columnGap` on Theme was
|
|
15383
|
+
* the camelCase prop Theme mints for `--bulma-column-gap`. It was never in
|
|
15384
|
+
* `ThemeProps`, so only untyped code reached it, but that code got the
|
|
15385
|
+
* columns gutter it asked for. It is the column gap helper now, as on every
|
|
15386
|
+
* other component, so a gap step goes to the helper and writes nothing here.
|
|
15387
|
+
* Any other non-empty string is still written as given, so a length such as
|
|
15388
|
+
* `'1rem'` keeps working, with a development warning pointing at `bulmaVars`.
|
|
15389
|
+
*
|
|
15390
|
+
* Only a string writes anything, for the reason `themeRadiusVar` gives: a
|
|
15391
|
+
* number or a boolean was never a usable length.
|
|
15392
|
+
*/
|
|
15393
|
+
const themeColumnGapVar = (columnGap) => {
|
|
15394
|
+
if (typeof columnGap !== 'string' || columnGap === '') {
|
|
15395
|
+
return undefined;
|
|
15396
|
+
}
|
|
15397
|
+
if (validGaps.includes(columnGap)) {
|
|
15398
|
+
return undefined;
|
|
15399
|
+
}
|
|
15400
|
+
warnOnce('Theme:column-gap-variable', `[bestax-bulma] <Theme columnGap="${columnGap}">: setting ` +
|
|
15401
|
+
'--bulma-column-gap through the columnGap prop is deprecated and will ' +
|
|
15402
|
+
'stop working in a future major version. On Theme, as on every other ' +
|
|
15403
|
+
'component, columnGap is the column gap helper ' +
|
|
15404
|
+
`("${validGaps.join('", "')}"). Set the variable with ` +
|
|
15405
|
+
`bulmaVars={{ '--bulma-column-gap': '${columnGap}' }} instead.`);
|
|
15406
|
+
return columnGap;
|
|
15407
|
+
};
|
|
15375
15408
|
/** The one `<style>` element every `isRoot` Theme writes into. */
|
|
15376
15409
|
const ROOT_STYLE_ID = 'bestax-bulma-theme-vars';
|
|
15377
15410
|
/**
|
|
@@ -15449,8 +15482,9 @@ const setRootThemeRules = (order, rules) => {
|
|
|
15449
15482
|
* <Button color="primary">Themed</Button>
|
|
15450
15483
|
* </Theme>
|
|
15451
15484
|
*/
|
|
15452
|
-
const Theme = ({ bulmaVars = {}, children, className, isRoot = false, colorMode, radius, ...restProps }) => {
|
|
15485
|
+
const Theme = ({ bulmaVars = {}, children, className, isRoot = false, colorMode, radius, columnGap, ...restProps }) => {
|
|
15453
15486
|
const radiusVar = themeRadiusVar(radius);
|
|
15487
|
+
const columnGapVar = themeColumnGapVar(columnGap);
|
|
15454
15488
|
const radiusHelper = validRadii.includes(radius)
|
|
15455
15489
|
? radius
|
|
15456
15490
|
: undefined;
|
|
@@ -15464,6 +15498,18 @@ const Theme = ({ bulmaVars = {}, children, className, isRoot = false, colorMode,
|
|
|
15464
15498
|
`element, put radius="${radiusHelper}" on it. To change the radius ` +
|
|
15465
15499
|
"across the page, set bulmaVars={{ '--bulma-radius': '…' }} instead.");
|
|
15466
15500
|
}
|
|
15501
|
+
// The same for a gap step in `columnGap`, which reads like the columns
|
|
15502
|
+
// gutter it once set and, at the root, has no element for its class.
|
|
15503
|
+
const columnGapStep = typeof columnGap === 'number' ? String(columnGap) : columnGap;
|
|
15504
|
+
if (isRoot &&
|
|
15505
|
+
columnGapStep !== undefined &&
|
|
15506
|
+
validGaps.includes(columnGapStep)) {
|
|
15507
|
+
warnOnce('Theme:root-column-gap', `[bestax-bulma] <Theme isRoot columnGap="${columnGapStep}">: a root ` +
|
|
15508
|
+
`Theme has no wrapper element for is-column-gap-${columnGapStep}, ` +
|
|
15509
|
+
'and a gap step sets no variable, so this does nothing. To change ' +
|
|
15510
|
+
'the columns gutter across the page, set ' +
|
|
15511
|
+
"bulmaVars={{ '--bulma-column-gap': '…' }} instead.");
|
|
15512
|
+
}
|
|
15467
15513
|
// Extract Bulma variable props from restProps
|
|
15468
15514
|
const { bulmaVarProps, otherProps } = React.useMemo(() => {
|
|
15469
15515
|
const varProps = {};
|
|
@@ -15483,6 +15529,7 @@ const Theme = ({ bulmaVars = {}, children, className, isRoot = false, colorMode,
|
|
|
15483
15529
|
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
15484
15530
|
...otherProps,
|
|
15485
15531
|
radius: radiusHelper,
|
|
15532
|
+
columnGap,
|
|
15486
15533
|
});
|
|
15487
15534
|
// Merge bulmaVars and individual props, with props taking precedence
|
|
15488
15535
|
const mergedVars = React.useMemo(() => {
|
|
@@ -15495,8 +15542,11 @@ const Theme = ({ bulmaVars = {}, children, className, isRoot = false, colorMode,
|
|
|
15495
15542
|
if (radiusVar !== undefined) {
|
|
15496
15543
|
vars['--bulma-radius'] = radiusVar;
|
|
15497
15544
|
}
|
|
15545
|
+
if (columnGapVar !== undefined) {
|
|
15546
|
+
vars['--bulma-column-gap'] = columnGapVar;
|
|
15547
|
+
}
|
|
15498
15548
|
return vars;
|
|
15499
|
-
}, [bulmaVars, bulmaVarProps, radiusVar]);
|
|
15549
|
+
}, [bulmaVars, bulmaVarProps, radiusVar, columnGapVar]);
|
|
15500
15550
|
// This Theme's place among root Themes; see `rootThemeRules`.
|
|
15501
15551
|
const [rootOrder] = React.useState(() => nextRootOrder++);
|
|
15502
15552
|
// The `:root` rules this Theme contributes, or '' when it contributes none.
|