pallote-react 0.16.9 → 0.16.11

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.
@@ -1,4 +1,4 @@
1
- import { HTMLAttributes } from 'react';
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
2
  type AlertColor = 'success' | 'info' | 'warning' | 'error';
3
3
  type AlertVariant = 'bar' | 'toast' | 'notice';
4
4
  export interface AlertProps extends HTMLAttributes<HTMLDivElement> {
@@ -6,11 +6,12 @@ export interface AlertProps extends HTMLAttributes<HTMLDivElement> {
6
6
  variant?: AlertVariant;
7
7
  title: string;
8
8
  subtitle?: string;
9
+ actions?: ReactNode;
9
10
  dense?: boolean;
10
11
  noIcon?: boolean;
11
12
  show?: boolean;
12
13
  onClose?: () => void;
13
14
  className?: string;
14
15
  }
15
- export declare const Alert: ({ color, variant, title, subtitle, dense, noIcon, show, onClose, className, ...props }: AlertProps) => import("react/jsx-runtime").JSX.Element;
16
+ export declare const Alert: ({ color, variant, title, subtitle, actions, dense, noIcon, show, onClose, className, ...props }: AlertProps) => import("react/jsx-runtime").JSX.Element;
16
17
  export {};
@@ -5,9 +5,8 @@ export interface SectionProps extends HTMLAttributes<HTMLDivElement> {
5
5
  align?: SectionAlign;
6
6
  color?: SectionColor;
7
7
  landing?: boolean;
8
- header?: boolean;
9
8
  className?: string;
10
9
  children: ReactNode;
11
10
  }
12
- export declare const Section: ({ align, color, landing, header, className, children, ...props }: SectionProps) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const Section: ({ align, color, landing, className, children, ...props }: SectionProps) => import("react/jsx-runtime").JSX.Element;
13
12
  export {};
@@ -1,13 +1,13 @@
1
1
  import { HTMLAttributes, ReactNode } from 'react';
2
- type TitleComponent = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p';
2
+ type TitleLevel = 1 | 2 | 3;
3
3
  export interface SectionHeaderProps extends HTMLAttributes<HTMLDivElement> {
4
4
  label?: string;
5
5
  title: string;
6
- promoteTitle?: boolean;
7
- titleComponent?: TitleComponent;
6
+ titleLevel?: TitleLevel;
8
7
  subtitle?: ReactNode;
9
8
  actions?: ReactNode;
9
+ actionsPosition?: 'right' | 'bottom';
10
10
  className?: string;
11
11
  }
12
- export declare const SectionHeader: ({ label, title, promoteTitle, titleComponent, subtitle, actions, className, ...props }: SectionHeaderProps) => import("react/jsx-runtime").JSX.Element;
12
+ export declare const SectionHeader: ({ label, title, titleLevel, subtitle, actions, actionsPosition, className, ...props }: SectionHeaderProps) => import("react/jsx-runtime").JSX.Element;
13
13
  export {};
package/dist/index.js CHANGED
@@ -272,7 +272,7 @@ const a$6 = /* @__PURE__ */ new Map([
272
272
  const e$7 = e$9.forwardRef((r, t) => /* @__PURE__ */ e$9.createElement(p, { ref: t, ...r, weights: a$6 }));
273
273
  e$7.displayName = "XIcon";
274
274
 
275
- const Alert = ({ color = 'success', variant = 'toast', title, subtitle, dense, noIcon, show, onClose, className, ...props }) => {
275
+ const Alert = ({ color = 'success', variant = 'toast', title, subtitle, actions, dense, noIcon, show, onClose, className, ...props }) => {
276
276
  const [shouldRender, setRender] = useState(show);
277
277
  const [container] = useState(() => {
278
278
  let el = document.getElementById('alerts');
@@ -302,7 +302,7 @@ const Alert = ({ color = 'success', variant = 'toast', title, subtitle, dense, n
302
302
  'alert-noIcon': noIcon
303
303
  },
304
304
  className
305
- ]), onAnimationEnd: onAnimationEnd, ...props, children: [jsxs("div", { className: classnames('alert_content'), children: [title ? jsx(Text, { className: classnames('alert_title'), variant: dense ? 'caption' : 'body', weight: 'bold', children: title }) : null, subtitle ? jsx(Text, { variant: dense ? 'overline' : 'caption', className: classnames('alert_subtitle'), children: subtitle }) : null] }), onClose ? (jsx("button", { type: "button", className: classnames('alert_close'), onClick: onClose, "aria-label": "Dismiss alert", children: jsx(e$7, { size: dense ? 14 : 16, "aria-hidden": "true" }) })) : null] }));
305
+ ]), onAnimationEnd: onAnimationEnd, ...props, children: [jsxs("div", { className: classnames('alert_content'), children: [title ? jsx(Text, { className: classnames('alert_title'), variant: dense ? 'caption' : 'body', weight: 'bold', children: title }) : null, subtitle ? jsx(Text, { variant: dense ? 'overline' : 'caption', className: classnames('alert_subtitle'), children: subtitle }) : null] }), actions ? jsx("div", { className: classnames('alert_actions'), children: actions }) : null, onClose ? (jsx("button", { type: "button", className: classnames('alert_close'), onClick: onClose, "aria-label": "Dismiss alert", children: jsx(e$7, { size: dense ? 14 : 16, "aria-hidden": "true" }) })) : null] }));
306
306
  if (variant === 'notice') {
307
307
  return jsx(Fragment, { children: alert });
308
308
  }
@@ -802,7 +802,7 @@ function ColumnFilter({ header }) {
802
802
  const options = filterOptions.map(normalizeFilterOption);
803
803
  return (jsxs(Select, { dense: true, id: `filter-${header.id}`, label: `Filter ${header.column.columnDef.header}`, hideLabel: true, className: "datatable_filter", value: filterValue, onChange: (e) => header.column.setFilterValue(e.target.value || undefined), children: [jsx("option", { value: "", children: "All" }), options.map(({ value, label }) => (jsx("option", { value: value, children: label }, value)))] }));
804
804
  }
805
- return (jsx(Input, { dense: true, id: `filter-${header.id}`, label: `Filter ${header.column.columnDef.header}`, hideLabel: true, placeholder: "Filter...", className: "datatable_filter", value: filterValue, onChange: (e) => header.column.setFilterValue(e.target.value || undefined) }));
805
+ return (jsx(Input, { dense: true, id: `filter-${header.id}`, label: `Filter ${header.column.columnDef.header}`, hideLabel: true, placeholder: "Search column", className: "datatable_filter", value: filterValue, onChange: (e) => header.column.setFilterValue(e.target.value || undefined) }));
806
806
  }
807
807
  function DataTable({ data, columns: columnDefs, enableSearch, searchPlaceholder = 'Search...', pageSize: initialPageSize = 10, pageSizeOptions = [10, 25, 50, 100], striped, hasHover = true, dense, border, kind: defaultKind, className, ...props }) {
808
808
  const [sorting, setSorting] = useState([]);
@@ -945,26 +945,31 @@ const Nav = ({ direction, dense, className, children, ...props }) => {
945
945
  ]), ...props, children: jsx("div", { className: 'nav_container', children: children }) }));
946
946
  };
947
947
 
948
- const SectionHeader = ({ label, title, promoteTitle = false, titleComponent = 'h2', subtitle, actions, className, ...props }) => {
948
+ const SectionHeader = ({ label, title, titleLevel = 2, subtitle, actions, actionsPosition, className, ...props }) => {
949
+ const titleVariant = titleLevel === 1 ? 'h2' : titleLevel === 2 ? 'h3' : 'h4';
950
+ const titleComponent = titleLevel === 1 ? 'h1' : titleLevel === 2 ? 'h2' : 'h3';
949
951
  return (jsxs("div", { className: classnames([
950
952
  'section_header',
953
+ `section_header-${titleLevel}`,
951
954
  className
952
- ]), ...props, children: [label ? jsx(Text, { className: classnames('section_label'), children: label }) : null, jsx(Text, { className: "section_title", component: titleComponent || (promoteTitle ? 'h1' : 'h2'), children: title }), subtitle ? jsx("div", { className: classnames('section_subtitle'), children: subtitle }) : null, actions ? (jsx("div", { className: "section_actions", children: actions })) : null] }));
955
+ ]), ...props, children: [label ? jsx(Text, { className: classnames('section_label'), children: label }) : null, jsxs("div", { className: "section_titleWrapper", children: [jsx(Text, { className: "section_title", variant: titleVariant, component: titleComponent, children: title }), actions && actionsPosition === 'right' ? (jsx(Display, { hide: "tablet", children: jsx("div", { className: "section_actions", children: actions }) })) : null] }), subtitle ? jsx("div", { className: classnames('section_subtitle'), children: subtitle }) : null, actions ? (actionsPosition === 'right' ? (jsx(Display, { show: "tablet", children: jsx("div", { className: "section_actions", children: actions }) })) : (jsx("div", { className: "section_actions", children: actions }))) : null] }));
953
956
  };
954
957
 
955
- const Section = ({ align = 'left', color = 'default', landing, header, className, children, ...props }) => {
958
+ const Section = ({ align = 'left', color = 'default', landing, className, children, ...props }) => {
956
959
  return (jsx("div", { className: classnames([
957
960
  'section',
958
961
  {
959
962
  [`section-${align}`]: align,
960
963
  [`section-${color}`]: color,
961
- 'section-landing': landing,
962
- 'section-header': header
964
+ 'section-landing': landing
963
965
  },
964
966
  className
965
- ]), ...props, children: jsx("div", { className: 'section_container', children: e__default.Children.map(children, child => {
966
- if (e__default.isValidElement(child) && child.type === SectionHeader) {
967
- return e__default.cloneElement(child, { promoteTitle: landing || header });
967
+ ]), ...props, children: jsx("div", { className: 'section_container', children: Children.map(children, child => {
968
+ if (isValidElement(child) && child.type === SectionHeader) {
969
+ const currentTitleLevel = child.props.titleLevel;
970
+ return cloneElement(child, {
971
+ titleLevel: currentTitleLevel ?? (landing ? 1 : 2)
972
+ });
968
973
  }
969
974
  return child;
970
975
  }) }) }));
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pallote-react",
3
- "version": "0.16.9",
3
+ "version": "0.16.11",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pallote-react",
3
- "version": "0.16.9",
3
+ "version": "0.16.11",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  "classnames": "^2.5.1",
25
25
  "react-syntax-highlighter": "^15.6.1",
26
26
  "sass": "^1.71.1",
27
- "pallote-css": "^0.10.2"
27
+ "pallote-css": "^0.10.6"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@chromatic-com/storybook": "^3.2.4",