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