@reykjavik/hanna-react 0.10.151 → 0.10.153

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/CHANGELOG.md CHANGED
@@ -4,6 +4,21 @@
4
4
 
5
5
  - ... <!-- Add new lines here. -->
6
6
 
7
+ ## 0.10.153
8
+
9
+ _2025-06-19_
10
+
11
+ - `Layout`:
12
+ - feat: Add prop `customLogo`
13
+ - fix: Change `__header__navlink`'s redundant `aria-label=` to `title=`
14
+
15
+ ## 0.10.152
16
+
17
+ _2025-05-23_
18
+
19
+ - `Datepicker`:
20
+ - fix: set `autoComplete="off"` on the input element
21
+
7
22
  ## 0.10.151
8
23
 
9
24
  _2025-05-22_
package/Datepicker.js CHANGED
@@ -173,7 +173,7 @@ const Datepicker = (props) => {
173
173
  }, placeholderText: placeholder,
174
174
  // TODO: Implement this
175
175
  // selectsRange
176
- minDate: minDateNormalized, maxDate: maxDate, startDate: startDate, endDate: endDate, selectsStart: isStartDate, selectsEnd: isEndDate, formatWeekDay: (weekday) => weekday.charAt(0).toUpperCase(), showYearDropdown: true, scrollableYearDropdown: true, yearDropdownItemNumber: 15, showMonthDropdown: true }, inputProps, txts, datepickerExtraProps))));
176
+ minDate: minDateNormalized, maxDate: maxDate, startDate: startDate, endDate: endDate, selectsStart: isStartDate, selectsEnd: isEndDate, formatWeekDay: (weekday) => weekday.charAt(0).toUpperCase(), showYearDropdown: true, scrollableYearDropdown: true, yearDropdownItemNumber: 15, showMonthDropdown: true }, inputProps, txts, datepickerExtraProps, { autoComplete: "off" }))));
177
177
  } })));
178
178
  };
179
179
  exports.Datepicker = Datepicker;
package/Layout.d.ts CHANGED
@@ -21,6 +21,10 @@ export type LayoutProps = {
21
21
  colorTheme?: HannaColorTheme;
22
22
  logoLink?: string;
23
23
  siteName?: string;
24
+ customLogo?: {
25
+ src: string;
26
+ altText: string;
27
+ };
24
28
  texts?: LayoutI18n;
25
29
  lang?: HannaLang;
26
30
  /** @deprecated Not used (Will be removed in v0.11) */
package/Layout.js CHANGED
@@ -15,16 +15,16 @@ exports.defaultLayoutTexts = {
15
15
  };
16
16
  const Layout = (props) => {
17
17
  (0, utils_js_1.useScrollbarWidthCSSVar)();
18
- const { globalAlerts, mainChildren, navChildren, footerChildren, colorTheme, children, siteName, logoLink = '/', wrapperProps, } = props;
18
+ const { globalAlerts, mainChildren, navChildren, footerChildren, colorTheme, children, siteName, logoLink = '/', customLogo, wrapperProps, } = props;
19
19
  (0, _Layouts_js_1.issueSiteNameWarningInDev)(props);
20
20
  const txt = (0, i18n_1.getTexts)(props, exports.defaultLayoutTexts);
21
21
  return (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, hanna_utils_1.modifiedClass)('Layout', props.modifier, (wrapperProps || {}).className), "data-color-theme": colorTheme }),
22
22
  globalAlerts && (react_1.default.createElement("div", { className: "Layout__alerts", role: "alert" }, globalAlerts)),
23
23
  react_1.default.createElement("div", { className: "Layout__content" },
24
24
  react_1.default.createElement("div", { className: "Layout__header", role: "banner" },
25
- (0, _Layouts_js_1.renderLayoutHomeLink)('Layout', logoLink, siteName),
25
+ (0, _Layouts_js_1.renderLayoutHomeLink)('Layout', logoLink, siteName, customLogo),
26
26
  ' ',
27
- navChildren && (react_1.default.createElement("a", { className: "Layout__header__navlink", href: "#pagenav", onClick: (e) => (0, a11yHelpers_js_1.handleAnchorLinkClick)(e, true), "aria-label": txt.skipLinkLabel }, txt.skipLinkLabel))),
27
+ navChildren && (react_1.default.createElement("a", { className: "Layout__header__navlink", href: "#pagenav", onClick: (e) => (0, a11yHelpers_js_1.handleAnchorLinkClick)(e, true), title: txt.skipLinkLabel }, txt.skipLinkLabel))),
28
28
  react_1.default.createElement("div", { className: "Layout__main", role: "main" }, mainChildren || children),
29
29
  navChildren && (react_1.default.createElement("div", { className: "Layout__nav", id: "pagenav", tabIndex: -1, role: "navigation" }, navChildren)),
30
30
  footerChildren && (react_1.default.createElement("div", { className: "Layout__footer", role: "complementary" }, footerChildren)))));
@@ -1,5 +1,7 @@
1
- export declare const renderLayoutHomeLink: (bem: string, logoLink: string, siteName?: string) => JSX.Element;
2
- export declare const renderLegacyLayoutHomeLink: (bem: string, logoLink: string, siteName?: string) => JSX.Element;
1
+ export declare const renderLayoutHomeLink: (bem: string, logoLink: string, siteName?: string, customLogo?: {
2
+ src: string;
3
+ altText: string;
4
+ }) => JSX.Element;
3
5
  export declare const issueSiteNameWarningInDev: (props: {
4
6
  siteName?: string;
5
7
  }) => void;
@@ -1,28 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.issueSiteNameWarningInDev = exports.renderLegacyLayoutHomeLink = exports.renderLayoutHomeLink = void 0;
3
+ exports.issueSiteNameWarningInDev = exports.renderLayoutHomeLink = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importDefault(require("react"));
6
+ const hanna_utils_1 = require("@reykjavik/hanna-utils");
6
7
  const assets_1 = require("@reykjavik/hanna-utils/assets");
7
8
  const _Image_js_1 = require("./_Image.js");
8
9
  const _Link_js_1 = require("./_Link.js");
9
10
  // ---------------------------------------------------------------------------
10
- const renderLayoutHomeLink = (bem, logoLink, siteName) => (react_1.default.createElement(_Link_js_1.Link, { className: `${bem}__header__homelink`, href: logoLink },
11
- ' ',
12
- react_1.default.createElement(_Image_js_1.Image, { bem: undefined, className: `${bem}__header__logo`, src: (0, assets_1.getRvkLogoUrl)(siteName ? 'reykjavik-logo-notext.svg' : 'reykjavik-logo.svg'), altText: "Reykjav\u00EDk", inline: true }),
13
- ' ',
14
- siteName && react_1.default.createElement("span", { className: `${bem}__header__sitename` }, siteName),
15
- ' '));
11
+ const renderLayoutHomeLink = (bem, logoLink, siteName, customLogo) => {
12
+ if (!siteName) {
13
+ customLogo = undefined;
14
+ }
15
+ return (react_1.default.createElement(_Link_js_1.Link, { className: `${bem}__header__homelink`, href: logoLink },
16
+ ' ',
17
+ react_1.default.createElement(_Image_js_1.Image, { bem: undefined, className: (0, hanna_utils_1.modifiedClass)(`${bem}__header__logo`, customLogo && 'custom'), src: (customLogo === null || customLogo === void 0 ? void 0 : customLogo.src) ||
18
+ (0, assets_1.getRvkLogoUrl)(siteName ? 'reykjavik-logo-notext.svg' : 'reykjavik-logo.svg'), altText: (customLogo === null || customLogo === void 0 ? void 0 : customLogo.altText) || 'Reykjavík', inline: true }),
19
+ ' ',
20
+ siteName && react_1.default.createElement("span", { className: `${bem}__header__sitename` }, siteName),
21
+ ' '));
22
+ };
16
23
  exports.renderLayoutHomeLink = renderLayoutHomeLink;
17
24
  // ---------------------------------------------------------------------------
18
- const renderLegacyLayoutHomeLink = (bem, logoLink, siteName) => (react_1.default.createElement(_Link_js_1.Link, { className: "Layout__header__logo", href: logoLink },
19
- ' ',
20
- react_1.default.createElement(_Image_js_1.Image, { bem: undefined, inline: true, src: (0, assets_1.getRvkLogoUrl)('reykjavik-logo.svg'), altText: "Reykjav\u00EDk" }),
21
- ' ',
22
- siteName,
23
- ' '));
24
- exports.renderLegacyLayoutHomeLink = renderLegacyLayoutHomeLink;
25
- // ---------------------------------------------------------------------------
26
25
  const issueSiteNameWarningInDev = (props) => {
27
26
  if (process.env.NODE_ENV !== 'production') {
28
27
  if (!('siteName' in props)) {
package/esm/Datepicker.js CHANGED
@@ -168,7 +168,7 @@ export const Datepicker = (props) => {
168
168
  }, placeholderText: placeholder,
169
169
  // TODO: Implement this
170
170
  // selectsRange
171
- minDate: minDateNormalized, maxDate: maxDate, startDate: startDate, endDate: endDate, selectsStart: isStartDate, selectsEnd: isEndDate, formatWeekDay: (weekday) => weekday.charAt(0).toUpperCase(), showYearDropdown: true, scrollableYearDropdown: true, yearDropdownItemNumber: 15, showMonthDropdown: true }, inputProps, txts, datepickerExtraProps))));
171
+ minDate: minDateNormalized, maxDate: maxDate, startDate: startDate, endDate: endDate, selectsStart: isStartDate, selectsEnd: isEndDate, formatWeekDay: (weekday) => weekday.charAt(0).toUpperCase(), showYearDropdown: true, scrollableYearDropdown: true, yearDropdownItemNumber: 15, showMonthDropdown: true }, inputProps, txts, datepickerExtraProps, { autoComplete: "off" }))));
172
172
  } })));
173
173
  };
174
174
  export default Datepicker;
package/esm/Layout.d.ts CHANGED
@@ -21,6 +21,10 @@ export type LayoutProps = {
21
21
  colorTheme?: HannaColorTheme;
22
22
  logoLink?: string;
23
23
  siteName?: string;
24
+ customLogo?: {
25
+ src: string;
26
+ altText: string;
27
+ };
24
28
  texts?: LayoutI18n;
25
29
  lang?: HannaLang;
26
30
  /** @deprecated Not used (Will be removed in v0.11) */
package/esm/Layout.js CHANGED
@@ -11,16 +11,16 @@ export const defaultLayoutTexts = {
11
11
  };
12
12
  export const Layout = (props) => {
13
13
  useScrollbarWidthCSSVar();
14
- const { globalAlerts, mainChildren, navChildren, footerChildren, colorTheme, children, siteName, logoLink = '/', wrapperProps, } = props;
14
+ const { globalAlerts, mainChildren, navChildren, footerChildren, colorTheme, children, siteName, logoLink = '/', customLogo, wrapperProps, } = props;
15
15
  issueSiteNameWarningInDev(props);
16
16
  const txt = getTexts(props, defaultLayoutTexts);
17
17
  return (React.createElement("div", Object.assign({}, wrapperProps, { className: modifiedClass('Layout', props.modifier, (wrapperProps || {}).className), "data-color-theme": colorTheme }),
18
18
  globalAlerts && (React.createElement("div", { className: "Layout__alerts", role: "alert" }, globalAlerts)),
19
19
  React.createElement("div", { className: "Layout__content" },
20
20
  React.createElement("div", { className: "Layout__header", role: "banner" },
21
- renderLayoutHomeLink('Layout', logoLink, siteName),
21
+ renderLayoutHomeLink('Layout', logoLink, siteName, customLogo),
22
22
  ' ',
23
- navChildren && (React.createElement("a", { className: "Layout__header__navlink", href: "#pagenav", onClick: (e) => handleAnchorLinkClick(e, true), "aria-label": txt.skipLinkLabel }, txt.skipLinkLabel))),
23
+ navChildren && (React.createElement("a", { className: "Layout__header__navlink", href: "#pagenav", onClick: (e) => handleAnchorLinkClick(e, true), title: txt.skipLinkLabel }, txt.skipLinkLabel))),
24
24
  React.createElement("div", { className: "Layout__main", role: "main" }, mainChildren || children),
25
25
  navChildren && (React.createElement("div", { className: "Layout__nav", id: "pagenav", tabIndex: -1, role: "navigation" }, navChildren)),
26
26
  footerChildren && (React.createElement("div", { className: "Layout__footer", role: "complementary" }, footerChildren)))));
@@ -1,5 +1,7 @@
1
- export declare const renderLayoutHomeLink: (bem: string, logoLink: string, siteName?: string) => JSX.Element;
2
- export declare const renderLegacyLayoutHomeLink: (bem: string, logoLink: string, siteName?: string) => JSX.Element;
1
+ export declare const renderLayoutHomeLink: (bem: string, logoLink: string, siteName?: string, customLogo?: {
2
+ src: string;
3
+ altText: string;
4
+ }) => JSX.Element;
3
5
  export declare const issueSiteNameWarningInDev: (props: {
4
6
  siteName?: string;
5
7
  }) => void;
@@ -1,21 +1,21 @@
1
1
  import React from 'react';
2
+ import { modifiedClass } from '@reykjavik/hanna-utils';
2
3
  import { getRvkLogoUrl } from '@reykjavik/hanna-utils/assets';
3
4
  import { Image } from './_Image.js';
4
5
  import { Link } from './_Link.js';
5
6
  // ---------------------------------------------------------------------------
6
- export const renderLayoutHomeLink = (bem, logoLink, siteName) => (React.createElement(Link, { className: `${bem}__header__homelink`, href: logoLink },
7
- ' ',
8
- React.createElement(Image, { bem: undefined, className: `${bem}__header__logo`, src: getRvkLogoUrl(siteName ? 'reykjavik-logo-notext.svg' : 'reykjavik-logo.svg'), altText: "Reykjav\u00EDk", inline: true }),
9
- ' ',
10
- siteName && React.createElement("span", { className: `${bem}__header__sitename` }, siteName),
11
- ' '));
12
- // ---------------------------------------------------------------------------
13
- export const renderLegacyLayoutHomeLink = (bem, logoLink, siteName) => (React.createElement(Link, { className: "Layout__header__logo", href: logoLink },
14
- ' ',
15
- React.createElement(Image, { bem: undefined, inline: true, src: getRvkLogoUrl('reykjavik-logo.svg'), altText: "Reykjav\u00EDk" }),
16
- ' ',
17
- siteName,
18
- ' '));
7
+ export const renderLayoutHomeLink = (bem, logoLink, siteName, customLogo) => {
8
+ if (!siteName) {
9
+ customLogo = undefined;
10
+ }
11
+ return (React.createElement(Link, { className: `${bem}__header__homelink`, href: logoLink },
12
+ ' ',
13
+ React.createElement(Image, { bem: undefined, className: modifiedClass(`${bem}__header__logo`, customLogo && 'custom'), src: (customLogo === null || customLogo === void 0 ? void 0 : customLogo.src) ||
14
+ getRvkLogoUrl(siteName ? 'reykjavik-logo-notext.svg' : 'reykjavik-logo.svg'), altText: (customLogo === null || customLogo === void 0 ? void 0 : customLogo.altText) || 'Reykjavík', inline: true }),
15
+ ' ',
16
+ siteName && React.createElement("span", { className: `${bem}__header__sitename` }, siteName),
17
+ ' '));
18
+ };
19
19
  // ---------------------------------------------------------------------------
20
20
  export const issueSiteNameWarningInDev = (props) => {
21
21
  if (process.env.NODE_ENV !== 'production') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reykjavik/hanna-react",
3
- "version": "0.10.151",
3
+ "version": "0.10.153",
4
4
  "author": "Reykjavík (http://www.reykjavik.is)",
5
5
  "contributors": [
6
6
  "Hugsmiðjan ehf (http://www.hugsmidjan.is)",
@@ -18,7 +18,7 @@
18
18
  "@hugsmidjan/qj": "^4.22.1",
19
19
  "@hugsmidjan/react": "^0.4.32",
20
20
  "@reykjavik/hanna-css": "^0.4.18",
21
- "@reykjavik/hanna-utils": "^0.2.20",
21
+ "@reykjavik/hanna-utils": "^0.2.21",
22
22
  "@types/react-autosuggest": "^10.1.0",
23
23
  "@types/react-datepicker": "^4.8.0",
24
24
  "@types/react-transition-group": "^4.4.0",