@bolttech/atoms-section-header 0.16.0 → 0.18.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/README.md CHANGED
@@ -17,13 +17,13 @@ To use the **SectionHeader** component in your React application, you need to fo
17
17
  ### Installation
18
18
 
19
19
  ```bash
20
- npm install @edirect/frontend-foundations @bolttech/atoms-section-header
20
+ npm install @bolttech/frontend-foundations @bolttech/atoms-section-header
21
21
  ```
22
22
 
23
23
  or
24
24
 
25
25
  ```bash
26
- yarn add @edirect/frontend-foundations @bolttech/atoms-section-header
26
+ yarn add @bolttech/frontend-foundations @bolttech/atoms-section-header
27
27
  ```
28
28
 
29
29
  Once you have the required dependencies installed, you can start using the `SectionHeader` component in your React application.
@@ -37,7 +37,7 @@ To use the component, import it and include it in your JSX:
37
37
  ```jsx
38
38
  import React from 'react';
39
39
  import {SectionHeader} from '@bolttech/atoms-section-header';
40
- import {bolttechTheme, BolttechThemeProvider} from "@edirect/frontend-foundations";
40
+ import {bolttechTheme, BolttechThemeProvider} from "@bolttech/frontend-foundations";
41
41
 
42
42
  function App() {
43
43
  return (
package/index.cjs CHANGED
@@ -6,7 +6,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
7
  var react = require('react');
8
8
  var styled = require('styled-components');
9
- var frontendFoundations = require('@edirect/frontend-foundations');
9
+ var frontendFoundations = require('@bolttech/frontend-foundations');
10
10
  var uiUtils = require('@bolttech/ui-utils');
11
11
 
12
12
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -1148,13 +1148,21 @@ const Background = /*#__PURE__*/styled__default["default"].div.withConfig({
1148
1148
  displayName: "atoms-section-headerstyle__Background",
1149
1149
  componentId: "sc-xtf6u-2"
1150
1150
  })(["display:flex;align-items:flex-end;z-index:0;"]);
1151
+ const BackgroundImage = /*#__PURE__*/styled__default["default"].img.withConfig({
1152
+ displayName: "atoms-section-headerstyle__BackgroundImage",
1153
+ componentId: "sc-xtf6u-3"
1154
+ })(["display:flex;align-items:flex-end;z-index:0;max-height:150px;"]);
1151
1155
  const Icon = /*#__PURE__*/styled__default["default"].div.withConfig({
1152
1156
  displayName: "atoms-section-headerstyle__Icon",
1153
- componentId: "sc-xtf6u-3"
1157
+ componentId: "sc-xtf6u-4"
1154
1158
  })(["position:absolute;display:flex;bottom:0;z-index:1;transform:translate(-50%);"]);
1159
+ const IconImage = /*#__PURE__*/styled__default["default"].img.withConfig({
1160
+ displayName: "atoms-section-headerstyle__IconImage",
1161
+ componentId: "sc-xtf6u-5"
1162
+ })(["position:absolute;display:flex;bottom:0;z-index:1;transform:translate(-50%);max-height:150px;width:auto;"]);
1155
1163
  const IlustrationContainer = /*#__PURE__*/styled__default["default"].div.withConfig({
1156
1164
  displayName: "atoms-section-headerstyle__IlustrationContainer",
1157
- componentId: "sc-xtf6u-4"
1165
+ componentId: "sc-xtf6u-6"
1158
1166
  })(["display:flex;position:relative;justify-content:flex-end;align-items:flex-end;@media only screen and (max-width:1431px){width:60%;height:100%;svg{max-width:100%;max-height:100%;height:100%;}}"]);
1159
1167
 
1160
1168
  const SectionHeader = /*#__PURE__*/react.forwardRef((_a, ref) => {
@@ -1165,6 +1173,28 @@ const SectionHeader = /*#__PURE__*/react.forwardRef((_a, ref) => {
1165
1173
  background
1166
1174
  } = _a,
1167
1175
  props = __rest(_a, ["dataTestId", "title", "icon", "background"]);
1176
+ const renderIcon = () => {
1177
+ if (icon && typeof icon === 'string') return jsxRuntime.jsx(IconImage, {
1178
+ "data-testid": `${dataTestId}-iconimg`,
1179
+ src: icon
1180
+ });
1181
+ if (icon && typeof icon !== 'string') return jsxRuntime.jsx(Icon, {
1182
+ "data-testid": `${dataTestId}-icon`,
1183
+ children: icon
1184
+ });
1185
+ return null;
1186
+ };
1187
+ const renderBackground = () => {
1188
+ if (background && typeof background === 'string') return jsxRuntime.jsx(BackgroundImage, {
1189
+ "data-testid": `${dataTestId}-backgroundimg`,
1190
+ src: background
1191
+ });
1192
+ if (background && typeof background !== 'string') return jsxRuntime.jsx(Background, {
1193
+ "data-testid": `${dataTestId}-background`,
1194
+ children: background
1195
+ });
1196
+ return null;
1197
+ };
1168
1198
  return jsxRuntime.jsxs(SectionHeaderContainer, Object.assign({
1169
1199
  fullWidth: true,
1170
1200
  "data-testid": dataTestId,
@@ -1177,11 +1207,7 @@ const SectionHeader = /*#__PURE__*/react.forwardRef((_a, ref) => {
1177
1207
  }, uiUtils.applyDataAttributes(props, 'title'), {
1178
1208
  children: title
1179
1209
  })), jsxRuntime.jsxs(IlustrationContainer, {
1180
- children: [icon && jsxRuntime.jsx(Icon, {
1181
- children: icon
1182
- }), background && jsxRuntime.jsx(Background, {
1183
- children: background
1184
- })]
1210
+ children: [renderIcon(), renderBackground()]
1185
1211
  })]
1186
1212
  }));
1187
1213
  });
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@bolttech/atoms-section-header",
3
- "version": "0.16.0",
3
+ "version": "0.18.0",
4
4
  "main": "./index.cjs",
5
5
  "type": "commonjs",
6
6
  "types": "./src/index.d.ts",
7
7
  "dependencies": {
8
+ "@bolttech/default-theme": "0.0.1",
9
+ "@bolttech/frontend-foundations": "0.0.1",
8
10
  "@bolttech/ui-utils": "0.1.1",
9
- "@edirect/frontend-foundations": "0.0.69",
10
11
  "react": "18.2.0",
11
12
  "styled-components": "5.3.6"
12
13
  },
package/src/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export * from './lib/atoms-section-header';
2
- export { SectionHeaderProps } from './lib/atoms-section-header.type';
2
+ export type { SectionHeaderProps } from './lib/atoms-section-header.type';
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  export declare const SectionHeader: React.ForwardRefExoticComponent<import("@bolttech/ui-utils").DefaultProps & {
3
3
  dataTestId?: string | undefined;
4
4
  title: string;
5
- icon?: React.ReactElement<SVGElement, string | React.JSXElementConstructor<any>> | undefined;
6
- background?: React.ReactElement<SVGElement, string | React.JSXElementConstructor<any>> | undefined;
5
+ icon?: string | React.ReactElement<SVGElement, string | React.JSXElementConstructor<any>> | undefined;
6
+ background?: string | React.ReactElement<SVGElement, string | React.JSXElementConstructor<any>> | undefined;
7
7
  } & React.RefAttributes<HTMLDivElement>>;
8
8
  export default SectionHeader;
@@ -1,6 +1,16 @@
1
1
  /// <reference types="react" />
2
- export declare const SectionHeaderContainer: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@edirect/frontend-foundations/dist/src/shared/types/row.type").RowPropsType & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
3
- export declare const SectionHeaderLabel: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@edirect/frontend-foundations/dist/src/shared/types/typography.type").TypographyPropsType & import("react").RefAttributes<HTMLElement>>, any, {}, never>;
2
+ export declare const SectionHeaderContainer: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("dist/libs/frontend-foundations/src/lib/shared/types/row.type").RowPropsType & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
3
+ export declare const SectionHeaderLabel: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("dist/libs/utils/src").DefaultProps & {
4
+ className?: string | undefined;
5
+ children?: string | string[] | undefined;
6
+ type?: string | undefined;
7
+ variant?: string | undefined;
8
+ align?: "center" | "left" | "right" | undefined;
9
+ text?: string | undefined;
10
+ htmlFor?: string | undefined;
11
+ } & import("react").RefAttributes<HTMLHeadingElement | HTMLLabelElement | HTMLParagraphElement | HTMLSpanElement | null>>, any, {}, never>;
4
12
  export declare const Background: import("styled-components").StyledComponent<"div", any, {}, never>;
13
+ export declare const BackgroundImage: import("styled-components").StyledComponent<"img", any, {}, never>;
5
14
  export declare const Icon: import("styled-components").StyledComponent<"div", any, {}, never>;
15
+ export declare const IconImage: import("styled-components").StyledComponent<"img", any, {}, never>;
6
16
  export declare const IlustrationContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -13,7 +13,7 @@ export type SectionHeaderProps = DefaultProps & {
13
13
  /** Main text that will be displayed on the section header */
14
14
  title: string;
15
15
  /** SVG that will be displayed on top */
16
- icon?: React.ReactElement<SVGElement>;
16
+ icon?: string | React.ReactElement<SVGElement>;
17
17
  /** SVG that will be displayed as the background of the icon */
18
- background?: React.ReactElement<SVGElement>;
18
+ background?: string | React.ReactElement<SVGElement>;
19
19
  };