@apolitical/component-library 1.4.1-beta.0 → 1.5.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.
Files changed (36) hide show
  1. package/accessibility/visually-hidden/visually-hidden.d.ts +2 -1
  2. package/discussion/discussion.mock.d.ts +6 -33
  3. package/discussion/index.d.ts +2 -0
  4. package/discussion/post/post.d.ts +9 -1
  5. package/discussion/post/post.mock.d.ts +18 -0
  6. package/discussion/responses-heading/index.d.ts +1 -0
  7. package/discussion/responses-heading/responses-heading.d.ts +10 -0
  8. package/discussion/thread/index.d.ts +1 -0
  9. package/discussion/thread/thread.d.ts +11 -0
  10. package/general/buttons/button-wrapper/button-wrapper.d.ts +1 -0
  11. package/general/divider/divider.d.ts +6 -0
  12. package/general/divider/index.d.ts +1 -0
  13. package/general/index.d.ts +1 -0
  14. package/general/link/link.d.ts +1 -1
  15. package/index.js +45 -49
  16. package/index.mjs +6278 -6017
  17. package/layout/page-layout/page-layout.d.ts +1 -1
  18. package/modals/index.d.ts +1 -0
  19. package/modals/modal/modal.d.ts +19 -2
  20. package/modals/overlay/index.d.ts +2 -0
  21. package/modals/overlay/overlay.d.ts +36 -0
  22. package/modals/overlay/overlay.helpers.d.ts +5 -0
  23. package/navigation/index.d.ts +1 -0
  24. package/navigation/more-menu/index.d.ts +2 -0
  25. package/navigation/more-menu/more-menu.d.ts +37 -0
  26. package/package.json +1 -1
  27. package/style.css +1 -1
  28. package/styles/base/_overlays.scss +41 -7
  29. package/styles/base/buttons/_buttons.scss +6 -4
  30. package/styles/base/buttons/_icons.scss +7 -1
  31. package/styles/variables/colors/_theme.scss +27 -8
  32. package/text/helper-text-box/helper-text-box.d.ts +1 -1
  33. package/text/index.d.ts +1 -1
  34. package/text/status-banner/index.d.ts +1 -0
  35. package/text/{alert/alert.d.ts → status-banner/status-banner.d.ts} +2 -2
  36. package/text/alert/index.d.ts +0 -1
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  interface Props {
3
3
  /** Content to show on the page */
4
- children: React.ReactNode;
4
+ children: React.ReactNode | JSX.Element | React.ReactPortal;
5
5
  /** Handle errors */
6
6
  reportError: () => void;
7
7
  background?: 'default' | 'gradient';
package/modals/index.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export * from './modal';
2
+ export * from './overlay';
@@ -1,9 +1,26 @@
1
1
  import React from 'react';
2
2
  interface Props {
3
+ /** The element that will render around the content */
4
+ element?: 'section' | 'div' | 'ul';
3
5
  /** The content to display */
4
- children: React.ReactNode | string;
6
+ children: React.ReactNode | JSX.Element | string;
7
+ /** The ID of the element */
8
+ id?: string;
5
9
  /** Additional classes */
6
10
  className?: string;
11
+ /** If the element should be hidden */
12
+ hidden?: boolean | string;
13
+ /** Optional styling */
14
+ style?: React.CSSProperties;
7
15
  }
8
- declare const Modal: ({ children, className }: Props) => import("react/jsx-runtime").JSX.Element;
16
+ declare const Modal: ({ element, children, className, ...props }: Props) => React.DOMElement<{
17
+ /** The ID of the element */
18
+ id?: string | undefined;
19
+ /** If the element should be hidden */
20
+ hidden?: string | boolean | undefined;
21
+ /** Optional styling */
22
+ style?: React.CSSProperties | undefined;
23
+ className: string;
24
+ children: number | boolean | Iterable<React.ReactNode> | JSX.Element | null | undefined;
25
+ }, Element>;
9
26
  export default Modal;
@@ -0,0 +1,2 @@
1
+ export { default as Overlay } from './overlay';
2
+ export { addAriaProps } from './overlay.helpers';
@@ -0,0 +1,36 @@
1
+ /// <reference types="react" />
2
+ import { ButtonPropsType } from '../../general';
3
+ interface Props {
4
+ /** ID of the overlay */
5
+ id?: string;
6
+ /** If the overlay is showing or not */
7
+ isOpen?: boolean;
8
+ /** The maximum width of the modal */
9
+ maxWidth?: number;
10
+ /** Functions to handle the overlay */
11
+ functions?: {
12
+ /** Function to call when the user opens the modal */
13
+ onOpen?: () => void;
14
+ /** Function to call when the user closes the modal */
15
+ onClose?: () => void;
16
+ };
17
+ /** Force elements on the form to show, regardless of the overlay state */
18
+ forceShow?: {
19
+ /** If an error, created externally, should always show */
20
+ error?: false | string;
21
+ };
22
+ /** The title to show */
23
+ title?: string | undefined;
24
+ /** The content to show */
25
+ children: JSX.Element | string;
26
+ /** The buttons to render; these can also be handled inside `children` */
27
+ buttons?: ButtonPropsType[];
28
+ /** Additional classes */
29
+ className?: string;
30
+ /** GTM context */
31
+ gtmContext?: string;
32
+ /** Language to use */
33
+ locale?: string;
34
+ }
35
+ declare const Overlay: ({ id, isOpen, maxWidth, functions: { onOpen, onClose }, forceShow: { error }, title, children, buttons, className, gtmContext }: Props) => import("react/jsx-runtime").JSX.Element;
36
+ export default Overlay;
@@ -0,0 +1,5 @@
1
+ export declare const addAriaProps: (id: string, isOpen: boolean) => {
2
+ 'aria-haspopup': boolean;
3
+ 'aria-expanded': boolean;
4
+ 'aria-controls': string;
5
+ };
@@ -1,4 +1,5 @@
1
1
  export * from './filters';
2
2
  export * from './load-more';
3
+ export * from './more-menu';
3
4
  export * from './logo';
4
5
  export * from './tags';
@@ -0,0 +1,2 @@
1
+ export type { IMoreMenuOptions } from './more-menu';
2
+ export { default as MoreMenu } from './more-menu';
@@ -0,0 +1,37 @@
1
+ import React from 'react';
2
+ export interface IMoreMenuOptions {
3
+ /** The link to use */
4
+ href?: string;
5
+ /** The function to call when the user clicks the button */
6
+ onClick?: (e: React.MouseEvent<HTMLElement>) => void;
7
+ /** The text to show */
8
+ text: string;
9
+ /** The icon to show */
10
+ icon?: string;
11
+ /** Additional classes */
12
+ className?: string;
13
+ /** The GTM context */
14
+ 'data-gtm-event-context'?: string;
15
+ /** The GTM event type */
16
+ 'data-gtm-event-type'?: string;
17
+ /** The Jest test ID */
18
+ 'data-testid'?: string;
19
+ }
20
+ interface Props {
21
+ /** The element to wrap around the content */
22
+ element?: 'div' | 'li' | 'p';
23
+ /** An id for the menu */
24
+ id?: string;
25
+ /** The menu items */
26
+ options: Array<IMoreMenuOptions>;
27
+ /** Additional classes */
28
+ className?: string;
29
+ /** The language to use */
30
+ locale?: string;
31
+ }
32
+ declare const MoreMenu: ({ element, id, options, className }: Props) => React.DetailedReactHTMLElement<{
33
+ ref: React.RefObject<HTMLDivElement | HTMLParagraphElement | HTMLLIElement>;
34
+ className: string;
35
+ children: import("react/jsx-runtime").JSX.Element;
36
+ }, HTMLDivElement | HTMLParagraphElement | HTMLLIElement>;
37
+ export default MoreMenu;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apolitical/component-library",
3
- "version": "1.4.1-beta.0",
3
+ "version": "1.5.0",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {