@allxsmith/bestax-bulma 5.18.1 → 5.18.2

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.
@@ -114,6 +114,9 @@ export type AvatarProps<T extends React.ElementType = 'figure'> = Omit<AvatarOwn
114
114
  * `role="img"`. A role claiming the opposite, such as `"button"`, says nothing here, and
115
115
  * neither does an `href`: that settles it on its own. A genuine `'a'`/`'button'`/`href`
116
116
  * avatar keeps its accessible name either way.
117
+ *
118
+ * `'button'` renders `type="button"` unless you pass `type="submit"` or `type="reset"`, so
119
+ * an avatar inside a form does not submit it.
117
120
  */
118
121
  as?: T;
119
122
  };
@@ -81,7 +81,12 @@ export interface DropdownItemOwnProps extends BulmaClassesProps {
81
81
  * `__typetests__/polymorphic.tsx`; the component itself is unaffected.
82
82
  */
83
83
  export type DropdownItemProps<T extends DropdownItemElement = DropdownItemElement> = DropdownItemOwnProps & Omit<React.ComponentPropsWithoutRef<T>, keyof DropdownItemOwnProps | 'as'> & {
84
- /** The element type to render. */
84
+ /**
85
+ * The element type to render.
86
+ *
87
+ * `'button'` renders `type="button"` unless you pass `type="submit"` or `type="reset"`, so
88
+ * an item inside a form does not submit it.
89
+ */
85
90
  as?: T;
86
91
  };
87
92
  /**
@@ -80,7 +80,12 @@ export interface MenuItemOwnProps extends BulmaClassesProps {
80
80
  * @extraProp {PolymorphicRef<React.ElementType>} [ref] - Ref forwarded to the inner element `as` renders, not the wrapping `<li>`, typed from `as`: the DOM node for an intrinsic tag, or whatever handle a custom component exposes.
81
81
  */
82
82
  export type MenuItemProps<T extends React.ElementType = 'a'> = MenuItemOwnProps & Omit<React.ComponentPropsWithoutRef<T>, keyof MenuItemOwnProps | 'as'> & {
83
- /** Custom link component (e.g. `Link` from router). */
83
+ /**
84
+ * Custom link component (e.g. `Link` from router).
85
+ *
86
+ * `'button'` renders `type="button"` unless you pass `type="submit"` or `type="reset"`, so
87
+ * an item inside a form does not submit it.
88
+ */
84
89
  as?: T;
85
90
  };
86
91
  /**
@@ -18,8 +18,8 @@ export interface ToastProps extends Omit<React.HTMLAttributes<HTMLDivElement>, '
18
18
  actionType?: ToastType;
19
19
  /**
20
20
  * Position on the screen. Default: 'top-right'. On a standalone `<Toast>`
21
- * this places it; through `toast.show()` it is currently ignored, because
22
- * `ToastContainer`'s own `position` places every toast it shows.
21
+ * this places it. Through `toast.show()` it places that toast, and a toast
22
+ * shown without one goes to `ToastContainer`'s `position` instead.
23
23
  */
24
24
  position?: ToastPosition;
25
25
  /** Duration in ms before auto-close. `0` disables auto-close. */
@@ -72,7 +72,10 @@ export declare const Toast: React.ForwardRefExoticComponent<ToastProps & React.R
72
72
  export interface ToastOptions extends Omit<ToastProps, 'message'> {
73
73
  /** The message to display. */
74
74
  message: string;
75
- /** When true, toasts enter a FIFO queue and display one at a time. Default false. */
75
+ /**
76
+ * When true, toasts enter a FIFO queue and display one at a time, one queue
77
+ * across every `position`. Default false.
78
+ */
76
79
  queue?: boolean;
77
80
  }
78
81
  /**
@@ -142,13 +145,21 @@ export declare const toast: {
142
145
  };
143
146
  /**
144
147
  * Container component for rendering programmatic toasts.
145
- * Place once at your app root to enable the toast API.
148
+ * Place once at your app root to enable the toast API. A toast shown with a
149
+ * `position` appears there, and one shown without goes to the container's
150
+ * `position`.
146
151
  *
147
152
  * @function
148
153
  * @param {{ position?: ToastPosition }} props - Container props.
149
154
  * @returns {JSX.Element | null} The rendered toast container, or null if empty.
150
155
  */
151
156
  export declare const ToastContainer: React.FC<{
157
+ /**
158
+ * Where a toast shown without a `position` of its own appears. Default:
159
+ * 'top-right'. When it changes, those toasts move without remounting, but
160
+ * one shown with its own `position` equal to the old or new value
161
+ * remounts and starts over as if it had just been shown.
162
+ */
152
163
  position?: ToastPosition;
153
164
  }>;
154
165
  export default Toast;
@@ -59,11 +59,14 @@ export interface NotificationOptions {
59
59
  /** Duration in ms before auto-close. Default 3000. */
60
60
  duration?: number;
61
61
  /**
62
- * Position on the screen. Currently ignored: `NotificationContainer`'s own
63
- * `position` places every notification it shows, so set it there.
62
+ * Position on the screen. A notification shown without one goes to
63
+ * `NotificationContainer`'s `position`.
64
64
  */
65
65
  position?: NotificationPosition;
66
- /** When true, notifications enter a FIFO queue and display one at a time. Default false. */
66
+ /**
67
+ * When true, notifications enter a FIFO queue and display one at a time,
68
+ * one queue across every `position`. Default false.
69
+ */
67
70
  queue?: boolean;
68
71
  /** Show a delete (close) button. Default true. */
69
72
  hasDelete?: boolean;
@@ -139,13 +142,22 @@ export declare const notification: {
139
142
  };
140
143
  /**
141
144
  * Container component for rendering programmatic notifications.
142
- * Place once at your app root to enable the notification API.
145
+ * Place once at your app root to enable the notification API. A notification
146
+ * shown with a `position` appears there, and one shown without goes to the
147
+ * container's `position`, so the container renders a stack for each position
148
+ * in use.
143
149
  *
144
150
  * @function
145
151
  * @param {{ position?: NotificationPosition }} props - Container props.
146
152
  * @returns {JSX.Element | null} The rendered notification container, or null if empty.
147
153
  */
148
154
  export declare const NotificationContainer: React.FC<{
155
+ /**
156
+ * Where a notification shown without a `position` of its own appears.
157
+ * Default: 'top-right'. When it changes, those notifications move without
158
+ * remounting, but one shown with its own `position` equal to the old or new
159
+ * value remounts and starts over as if it had just been shown.
160
+ */
149
161
  position?: NotificationPosition;
150
162
  }>;
151
163
  export {};
@@ -0,0 +1,19 @@
1
+ import type React from 'react';
2
+ /** The values HTML defines for a `<button>`'s `type`. */
3
+ export type ButtonType = NonNullable<React.ButtonHTMLAttributes<HTMLButtonElement>['type']>;
4
+ /**
5
+ * The `type` to render on a `<button>` a component defaults to `button`: the
6
+ * caller's own value when it is `button`, `submit` or `reset`, and `button`
7
+ * otherwise.
8
+ *
9
+ * A missing `type` is not the only way a button ends up submitting the form
10
+ * around it. HTML reads an invalid value, such as the anchor's MIME-type
11
+ * `type="text/html"`, as submit too, and a props spread carrying
12
+ * `type: undefined` removes the attribute outright. Both can arrive through a
13
+ * spread or an untyped caller the component's own types never see, so this
14
+ * checks the value rather than trusting where it came from.
15
+ *
16
+ * Call it AFTER the forwarded props are spread and pass it the forwarded
17
+ * `type`, so its result is the attribute that renders.
18
+ */
19
+ export declare function buttonType(given: unknown): ButtonType;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The items a programmatic container shows at one place on the screen.
3
+ */
4
+ export interface PositionStack<Item, Position extends string> {
5
+ /**
6
+ * A React key for the stack. The stack at the container's own position
7
+ * keeps the same key whatever that position is, so changing the container's
8
+ * `position` moves the items in it instead of remounting them.
9
+ */
10
+ key: string;
11
+ /** Where on the screen the stack sits. */
12
+ position: Position;
13
+ /** The items at that position, in the order they were shown. */
14
+ items: Item[];
15
+ }
16
+ /**
17
+ * Splits the items a container shows into one stack per position in use. An
18
+ * item goes to its own position when it has one and to the container's
19
+ * otherwise. A position with no items gets no stack.
20
+ *
21
+ * Stacks come back in `order`, so their order in the page follows the screen
22
+ * rather than which position happened to be used first, and a stack keeps its
23
+ * place while the others come and go. A position missing from `order` sorts
24
+ * after the known ones.
25
+ *
26
+ * @function groupIntoPositionStacks
27
+ * @param items - The items the container shows, in the order they were shown.
28
+ * @param positionOf - Reads an item's own position, if it has one.
29
+ * @param containerPosition - Where an item without a position of its own goes.
30
+ * @param order - Every known position, in the order stacks should render.
31
+ * @returns One stack per position in use.
32
+ */
33
+ export declare function groupIntoPositionStacks<Item, Position extends string>(items: readonly Item[], positionOf: (item: Item) => Position | undefined, containerPosition: Position, order: readonly Position[]): PositionStack<Item, Position>[];
@@ -114,6 +114,9 @@ export type AvatarProps<T extends React.ElementType = 'figure'> = Omit<AvatarOwn
114
114
  * `role="img"`. A role claiming the opposite, such as `"button"`, says nothing here, and
115
115
  * neither does an `href`: that settles it on its own. A genuine `'a'`/`'button'`/`href`
116
116
  * avatar keeps its accessible name either way.
117
+ *
118
+ * `'button'` renders `type="button"` unless you pass `type="submit"` or `type="reset"`, so
119
+ * an avatar inside a form does not submit it.
117
120
  */
118
121
  as?: T;
119
122
  };
@@ -81,7 +81,12 @@ export interface DropdownItemOwnProps extends BulmaClassesProps {
81
81
  * `__typetests__/polymorphic.tsx`; the component itself is unaffected.
82
82
  */
83
83
  export type DropdownItemProps<T extends DropdownItemElement = DropdownItemElement> = DropdownItemOwnProps & Omit<React.ComponentPropsWithoutRef<T>, keyof DropdownItemOwnProps | 'as'> & {
84
- /** The element type to render. */
84
+ /**
85
+ * The element type to render.
86
+ *
87
+ * `'button'` renders `type="button"` unless you pass `type="submit"` or `type="reset"`, so
88
+ * an item inside a form does not submit it.
89
+ */
85
90
  as?: T;
86
91
  };
87
92
  /**
@@ -80,7 +80,12 @@ export interface MenuItemOwnProps extends BulmaClassesProps {
80
80
  * @extraProp {PolymorphicRef<React.ElementType>} [ref] - Ref forwarded to the inner element `as` renders, not the wrapping `<li>`, typed from `as`: the DOM node for an intrinsic tag, or whatever handle a custom component exposes.
81
81
  */
82
82
  export type MenuItemProps<T extends React.ElementType = 'a'> = MenuItemOwnProps & Omit<React.ComponentPropsWithoutRef<T>, keyof MenuItemOwnProps | 'as'> & {
83
- /** Custom link component (e.g. `Link` from router). */
83
+ /**
84
+ * Custom link component (e.g. `Link` from router).
85
+ *
86
+ * `'button'` renders `type="button"` unless you pass `type="submit"` or `type="reset"`, so
87
+ * an item inside a form does not submit it.
88
+ */
84
89
  as?: T;
85
90
  };
86
91
  /**
@@ -18,8 +18,8 @@ export interface ToastProps extends Omit<React.HTMLAttributes<HTMLDivElement>, '
18
18
  actionType?: ToastType;
19
19
  /**
20
20
  * Position on the screen. Default: 'top-right'. On a standalone `<Toast>`
21
- * this places it; through `toast.show()` it is currently ignored, because
22
- * `ToastContainer`'s own `position` places every toast it shows.
21
+ * this places it. Through `toast.show()` it places that toast, and a toast
22
+ * shown without one goes to `ToastContainer`'s `position` instead.
23
23
  */
24
24
  position?: ToastPosition;
25
25
  /** Duration in ms before auto-close. `0` disables auto-close. */
@@ -72,7 +72,10 @@ export declare const Toast: React.ForwardRefExoticComponent<ToastProps & React.R
72
72
  export interface ToastOptions extends Omit<ToastProps, 'message'> {
73
73
  /** The message to display. */
74
74
  message: string;
75
- /** When true, toasts enter a FIFO queue and display one at a time. Default false. */
75
+ /**
76
+ * When true, toasts enter a FIFO queue and display one at a time, one queue
77
+ * across every `position`. Default false.
78
+ */
76
79
  queue?: boolean;
77
80
  }
78
81
  /**
@@ -142,13 +145,21 @@ export declare const toast: {
142
145
  };
143
146
  /**
144
147
  * Container component for rendering programmatic toasts.
145
- * Place once at your app root to enable the toast API.
148
+ * Place once at your app root to enable the toast API. A toast shown with a
149
+ * `position` appears there, and one shown without goes to the container's
150
+ * `position`.
146
151
  *
147
152
  * @function
148
153
  * @param {{ position?: ToastPosition }} props - Container props.
149
154
  * @returns {JSX.Element | null} The rendered toast container, or null if empty.
150
155
  */
151
156
  export declare const ToastContainer: React.FC<{
157
+ /**
158
+ * Where a toast shown without a `position` of its own appears. Default:
159
+ * 'top-right'. When it changes, those toasts move without remounting, but
160
+ * one shown with its own `position` equal to the old or new value
161
+ * remounts and starts over as if it had just been shown.
162
+ */
152
163
  position?: ToastPosition;
153
164
  }>;
154
165
  export default Toast;
@@ -59,11 +59,14 @@ export interface NotificationOptions {
59
59
  /** Duration in ms before auto-close. Default 3000. */
60
60
  duration?: number;
61
61
  /**
62
- * Position on the screen. Currently ignored: `NotificationContainer`'s own
63
- * `position` places every notification it shows, so set it there.
62
+ * Position on the screen. A notification shown without one goes to
63
+ * `NotificationContainer`'s `position`.
64
64
  */
65
65
  position?: NotificationPosition;
66
- /** When true, notifications enter a FIFO queue and display one at a time. Default false. */
66
+ /**
67
+ * When true, notifications enter a FIFO queue and display one at a time,
68
+ * one queue across every `position`. Default false.
69
+ */
67
70
  queue?: boolean;
68
71
  /** Show a delete (close) button. Default true. */
69
72
  hasDelete?: boolean;
@@ -139,13 +142,22 @@ export declare const notification: {
139
142
  };
140
143
  /**
141
144
  * Container component for rendering programmatic notifications.
142
- * Place once at your app root to enable the notification API.
145
+ * Place once at your app root to enable the notification API. A notification
146
+ * shown with a `position` appears there, and one shown without goes to the
147
+ * container's `position`, so the container renders a stack for each position
148
+ * in use.
143
149
  *
144
150
  * @function
145
151
  * @param {{ position?: NotificationPosition }} props - Container props.
146
152
  * @returns {JSX.Element | null} The rendered notification container, or null if empty.
147
153
  */
148
154
  export declare const NotificationContainer: React.FC<{
155
+ /**
156
+ * Where a notification shown without a `position` of its own appears.
157
+ * Default: 'top-right'. When it changes, those notifications move without
158
+ * remounting, but one shown with its own `position` equal to the old or new
159
+ * value remounts and starts over as if it had just been shown.
160
+ */
149
161
  position?: NotificationPosition;
150
162
  }>;
151
163
  export {};
@@ -0,0 +1,19 @@
1
+ import type React from 'react';
2
+ /** The values HTML defines for a `<button>`'s `type`. */
3
+ export type ButtonType = NonNullable<React.ButtonHTMLAttributes<HTMLButtonElement>['type']>;
4
+ /**
5
+ * The `type` to render on a `<button>` a component defaults to `button`: the
6
+ * caller's own value when it is `button`, `submit` or `reset`, and `button`
7
+ * otherwise.
8
+ *
9
+ * A missing `type` is not the only way a button ends up submitting the form
10
+ * around it. HTML reads an invalid value, such as the anchor's MIME-type
11
+ * `type="text/html"`, as submit too, and a props spread carrying
12
+ * `type: undefined` removes the attribute outright. Both can arrive through a
13
+ * spread or an untyped caller the component's own types never see, so this
14
+ * checks the value rather than trusting where it came from.
15
+ *
16
+ * Call it AFTER the forwarded props are spread and pass it the forwarded
17
+ * `type`, so its result is the attribute that renders.
18
+ */
19
+ export declare function buttonType(given: unknown): ButtonType;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The items a programmatic container shows at one place on the screen.
3
+ */
4
+ export interface PositionStack<Item, Position extends string> {
5
+ /**
6
+ * A React key for the stack. The stack at the container's own position
7
+ * keeps the same key whatever that position is, so changing the container's
8
+ * `position` moves the items in it instead of remounting them.
9
+ */
10
+ key: string;
11
+ /** Where on the screen the stack sits. */
12
+ position: Position;
13
+ /** The items at that position, in the order they were shown. */
14
+ items: Item[];
15
+ }
16
+ /**
17
+ * Splits the items a container shows into one stack per position in use. An
18
+ * item goes to its own position when it has one and to the container's
19
+ * otherwise. A position with no items gets no stack.
20
+ *
21
+ * Stacks come back in `order`, so their order in the page follows the screen
22
+ * rather than which position happened to be used first, and a stack keeps its
23
+ * place while the others come and go. A position missing from `order` sorts
24
+ * after the known ones.
25
+ *
26
+ * @function groupIntoPositionStacks
27
+ * @param items - The items the container shows, in the order they were shown.
28
+ * @param positionOf - Reads an item's own position, if it has one.
29
+ * @param containerPosition - Where an item without a position of its own goes.
30
+ * @param order - Every known position, in the order stacks should render.
31
+ * @returns One stack per position in use.
32
+ */
33
+ export declare function groupIntoPositionStacks<Item, Position extends string>(items: readonly Item[], positionOf: (item: Item) => Position | undefined, containerPosition: Position, order: readonly Position[]): PositionStack<Item, Position>[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allxsmith/bestax-bulma",
3
- "version": "5.18.1",
3
+ "version": "5.18.2",
4
4
  "description": "A fully-typed React component library for the Bulma CSS framework. Build modern UIs quickly with reusable, accessible, and customizable Bulma-based React components.",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.esm.js",