pallote-react 0.16.9 → 0.16.10

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.
@@ -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
@@ -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.10",
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.10",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",