@reykjavik/hanna-react 0.10.90 → 0.10.92
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 +8 -1
- package/Datepicker.js +4 -4
- package/ReadSpeakerPlayer.d.ts +64 -0
- package/ReadSpeakerPlayer.js +78 -0
- package/_mixed_export_resolution_/ReactDatepicker.d.ts +6 -0
- package/_mixed_export_resolution_/ReactDatepicker.js +17 -0
- package/esm/Datepicker.js +1 -1
- package/esm/ReadSpeakerPlayer.d.ts +64 -0
- package/esm/ReadSpeakerPlayer.js +72 -0
- package/esm/_mixed_export_resolution_/ReactDatepicker.d.ts +6 -0
- package/esm/_mixed_export_resolution_/ReactDatepicker.js +13 -0
- package/esm/index.d.ts +1 -0
- package/index.d.ts +1 -0
- package/package.json +8 -4
package/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
- ... <!-- Add new lines here. -->
|
|
6
6
|
|
|
7
|
-
## 0.10.
|
|
7
|
+
## 0.10.92
|
|
8
|
+
|
|
9
|
+
_2023-06-06_
|
|
10
|
+
|
|
11
|
+
- feat: Add component `ReadSpeakerPlayer` and a `stopReading` helper
|
|
12
|
+
- fix: Update dependencies for minor esm and `Modal`-related bugfixes
|
|
13
|
+
|
|
14
|
+
## 0.10.90 – 0.10.91
|
|
8
15
|
|
|
9
16
|
_2023-06-01_
|
|
10
17
|
|
package/Datepicker.js
CHANGED
|
@@ -3,15 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Datepicker = exports.getDateDiff = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const react_datepicker_1 = require("react-datepicker"); // Docs: https://reactdatepicker.com/
|
|
7
6
|
const hooks_1 = require("@hugsmidjan/react/hooks");
|
|
8
7
|
const getBemClass_1 = tslib_1.__importDefault(require("@hugsmidjan/react/utils/getBemClass"));
|
|
9
8
|
// For more info on localization see: https://stackoverflow.com/questions/54399084/change-locale-in-react-datepicker/58306958#58306958
|
|
10
9
|
const index_js_1 = tslib_1.__importDefault(require("date-fns/locale/is/index.js"));
|
|
11
10
|
const index_js_2 = tslib_1.__importDefault(require("date-fns/locale/pl/index.js"));
|
|
11
|
+
const ReactDatepicker_js_1 = require("./_mixed_export_resolution_/ReactDatepicker.js"); // Docs: https://reactdatepicker.com/
|
|
12
12
|
const FormField_js_1 = require("./FormField.js");
|
|
13
|
-
(0,
|
|
14
|
-
(0,
|
|
13
|
+
(0, ReactDatepicker_js_1.registerLocale)('is', index_js_1.default);
|
|
14
|
+
(0, ReactDatepicker_js_1.registerLocale)('pl', index_js_2.default);
|
|
15
15
|
const getDateDiff = (date, diff) => {
|
|
16
16
|
const newDate = new Date(date);
|
|
17
17
|
newDate.setDate(newDate.getDate() + diff);
|
|
@@ -65,7 +65,7 @@ const Datepicker = (props) => {
|
|
|
65
65
|
(elm === null || elm === void 0 ? void 0 : elm.querySelector('input')) || undefined;
|
|
66
66
|
return elm;
|
|
67
67
|
}) }, addFocusProps()),
|
|
68
|
-
react_1.default.createElement(
|
|
68
|
+
react_1.default.createElement(ReactDatepicker_js_1.ReactDatePicker, Object.assign({ id: domid, required: inputProps.required, disabled: inputProps.disabled, readOnly: inputProps.readOnly, selected: value, name: name, locale: localeCode, dateFormat:
|
|
69
69
|
// NOTE: Force all dateFormat values into Array<string> to temporarily work around
|
|
70
70
|
// a bug in the current version of react-datepicker where invalid **string** values
|
|
71
71
|
// are re-parsed with `new Date()`, causing surprising (weird) false positives
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { DefaultTexts } from '@reykjavik/hanna-utils/i18n';
|
|
2
|
+
import { HTMLProps } from './utils.js';
|
|
3
|
+
export type ReadSpeakerPlayerI18n = {
|
|
4
|
+
linkText: string;
|
|
5
|
+
linkLabel?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const defaultReadSpeakerPlayerTexts: DefaultTexts<ReadSpeakerPlayerI18n>;
|
|
8
|
+
export type ReadSpeakerPlayerProps = {
|
|
9
|
+
/**
|
|
10
|
+
* Your ReadSpeaker account/customer ID
|
|
11
|
+
*
|
|
12
|
+
* @see https://docs.typo3.org/p/readspeaker/readspeaker-services/main/en-us/Configuration/Index.html#customer-id
|
|
13
|
+
*/
|
|
14
|
+
customerId?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Reading language/locale for the ReadSpeaker player.
|
|
17
|
+
*
|
|
18
|
+
* If you don't specify a `lang`, the player will try to auto-detect
|
|
19
|
+
* the language of the page, and pick a default `voice` for that language.
|
|
20
|
+
*
|
|
21
|
+
* @see https://docs.typo3.org/p/readspeaker/readspeaker-services/main/en-us/Configuration/Index.html#reading-language
|
|
22
|
+
*/
|
|
23
|
+
lang?: Lowercase<string>;
|
|
24
|
+
/**
|
|
25
|
+
* Reading voice for the ReadSpeaker player.
|
|
26
|
+
*
|
|
27
|
+
* This prop only makes sense if you specfy a reading `lang`, as
|
|
28
|
+
* the voices are language-specific.
|
|
29
|
+
*
|
|
30
|
+
* @see https://docs.typo3.org/p/readspeaker/readspeaker-services/main/en-us/Configuration/Index.html#voice
|
|
31
|
+
*/
|
|
32
|
+
voice?: string;
|
|
33
|
+
/**
|
|
34
|
+
* The DOM `id=""` of the element to read.
|
|
35
|
+
*
|
|
36
|
+
* @see https://docs.typo3.org/p/readspeaker/readspeaker-services/main/en-us/Configuration/Index.html#reading-area-id
|
|
37
|
+
*/
|
|
38
|
+
readId?: string;
|
|
39
|
+
/**
|
|
40
|
+
* The DOM class-name of the element(s) to read
|
|
41
|
+
*
|
|
42
|
+
* Comma-separated list of class-names may also work...
|
|
43
|
+
*
|
|
44
|
+
* @see https://docs.typo3.org/p/readspeaker/readspeaker-services/main/en-us/Configuration/Index.html#reading-area-class
|
|
45
|
+
*/
|
|
46
|
+
readClass?: string;
|
|
47
|
+
texts?: ReadSpeakerPlayerI18n;
|
|
48
|
+
align?: 'left' | 'right';
|
|
49
|
+
/** Tooggles CSS float layout */
|
|
50
|
+
float?: boolean;
|
|
51
|
+
/** Custom HTML attributes for the wrapper element. */
|
|
52
|
+
wrapperProps?: HTMLProps<'div'>;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Embeds a ReadSpeaker player in the page
|
|
56
|
+
*
|
|
57
|
+
* @see https://docs.typo3.org/p/readspeaker/readspeaker-services/main/en-us/Configuration/Index.html
|
|
58
|
+
*/
|
|
59
|
+
export declare const ReadSpeakerPlayer: (props: ReadSpeakerPlayerProps) => JSX.Element;
|
|
60
|
+
/**
|
|
61
|
+
* Run this function if you find that the player keeps reading when a user
|
|
62
|
+
* swaps pages.
|
|
63
|
+
*/
|
|
64
|
+
export declare const stopReading: () => void | undefined;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stopReading = exports.ReadSpeakerPlayer = exports.defaultReadSpeakerPlayerTexts = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
const getBemClass_1 = tslib_1.__importDefault(require("@hugsmidjan/react/utils/getBemClass"));
|
|
7
|
+
const i18n_1 = require("@reykjavik/hanna-utils/i18n");
|
|
8
|
+
const scriptTagId = 'rs_req_Init';
|
|
9
|
+
const scriptTagSelector = `script#${scriptTagId}`;
|
|
10
|
+
let buttons = 0;
|
|
11
|
+
exports.defaultReadSpeakerPlayerTexts = {
|
|
12
|
+
en: { linkText: 'Listen', linkLabel: 'Listen to this page read outloud' },
|
|
13
|
+
is: { linkText: 'Hlusta', linkLabel: 'Hlusta á þessa síðu lesna upphátt' },
|
|
14
|
+
pl: { linkText: 'Posłuchaj', linkLabel: 'Posłuchaj tej strony odczytanej na głos' },
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Embeds a ReadSpeaker player in the page
|
|
18
|
+
*
|
|
19
|
+
* @see https://docs.typo3.org/p/readspeaker/readspeaker-services/main/en-us/Configuration/Index.html
|
|
20
|
+
*/
|
|
21
|
+
const ReadSpeakerPlayer = (props) => {
|
|
22
|
+
const { align, float, customerId = '11315', lang = '', voice = /^is(?:_is)?$/i.test(lang) ? 'is_dora' : '', readId = '', readClass = readId ? '' : 'Layout__main', wrapperProps = {}, texts, } = props;
|
|
23
|
+
const { linkText, linkLabel } = (0, i18n_1.getTexts)({ lang: lang.slice(0, 2), texts }, exports.defaultReadSpeakerPlayerTexts);
|
|
24
|
+
(0, react_1.useEffect)(() => {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
if (buttons < 0) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (buttons === 0) {
|
|
30
|
+
if (document.querySelector(scriptTagSelector)) {
|
|
31
|
+
buttons = -1;
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const script = document.createElement('script');
|
|
35
|
+
script.id = scriptTagId;
|
|
36
|
+
script.src = `https://cdn-eu.readspeaker.com/script/${customerId}/webReader/webReader.js?pids=wr`;
|
|
37
|
+
script.onload = () => { var _a, _b; return (_b = (_a = window.rspkr) === null || _a === void 0 ? void 0 : _a.ui) === null || _b === void 0 ? void 0 : _b.addClickEvents(); };
|
|
38
|
+
script.async = true;
|
|
39
|
+
document.head.appendChild(script);
|
|
40
|
+
}
|
|
41
|
+
buttons++;
|
|
42
|
+
(_b = (_a = window.rspkr) === null || _a === void 0 ? void 0 : _a.ui) === null || _b === void 0 ? void 0 : _b.addClickEvents();
|
|
43
|
+
return () => {
|
|
44
|
+
var _a;
|
|
45
|
+
buttons--;
|
|
46
|
+
if (buttons === 0) {
|
|
47
|
+
(_a = document.querySelector(scriptTagSelector)) === null || _a === void 0 ? void 0 : _a.remove();
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
|
+
[
|
|
53
|
+
// We're not trying to support dynamic changes to `customerId`
|
|
54
|
+
// or multiple different `customerId`s on the same page.
|
|
55
|
+
// If you try that, things will be weird and wonky.
|
|
56
|
+
]);
|
|
57
|
+
return (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, getBemClass_1.default)('ReadSpeakerPlayer', [align === 'right' && `align-${align}`, float && 'float'], wrapperProps.className) }),
|
|
58
|
+
react_1.default.createElement("div", { id: "readspeaker_button1", className: "rs_skip rsbtn rs_preserve" },
|
|
59
|
+
react_1.default.createElement("a", { rel: "nofollow", className: "rsbtn_play", accessKey: "L", title: linkLabel || linkText, href: `https://app-eu.readspeaker.com/cgi-bin/rsent?${new URLSearchParams({
|
|
60
|
+
customerid: customerId,
|
|
61
|
+
lang,
|
|
62
|
+
voice: lang && voice,
|
|
63
|
+
autoLang: !lang ? 'true' : 'false',
|
|
64
|
+
readclass: readClass,
|
|
65
|
+
readid: readId,
|
|
66
|
+
})}` },
|
|
67
|
+
react_1.default.createElement("span", { className: "rsbtn_left rsimg rspart" },
|
|
68
|
+
react_1.default.createElement("span", { className: "rsbtn_text" },
|
|
69
|
+
react_1.default.createElement("span", null, linkText))),
|
|
70
|
+
react_1.default.createElement("span", { className: "rsbtn_right rsimg rsplay rspart" })))));
|
|
71
|
+
};
|
|
72
|
+
exports.ReadSpeakerPlayer = ReadSpeakerPlayer;
|
|
73
|
+
/**
|
|
74
|
+
* Run this function if you find that the player keeps reading when a user
|
|
75
|
+
* swaps pages.
|
|
76
|
+
*/
|
|
77
|
+
const stopReading = () => { var _a, _b; return (_b = (_a = window.rspkr) === null || _a === void 0 ? void 0 : _a.ui) === null || _b === void 0 ? void 0 : _b.destroyActivePlayer(); };
|
|
78
|
+
exports.stopReading = stopReading;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as reactDropzonePkg from 'react-datepicker';
|
|
2
|
+
export declare const ReactDatePicker: typeof reactDropzonePkg.ReactDatePicker;
|
|
3
|
+
export declare const registerLocale: typeof reactDropzonePkg.registerLocale;
|
|
4
|
+
export declare const setDefaultLocale: typeof reactDropzonePkg.setDefaultLocale;
|
|
5
|
+
export declare const getDefaultLocale: typeof reactDropzonePkg.getDefaultLocale;
|
|
6
|
+
export declare const CalendarContainer: typeof reactDropzonePkg.CalendarContainer;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// See <file://./_WAT.md> for info on why this file exists
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.CalendarContainer = exports.getDefaultLocale = exports.setDefaultLocale = exports.registerLocale = exports.ReactDatePicker = void 0;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const reactDropzonePkg = tslib_1.__importStar(require("react-datepicker")); // Docs: https://reactdatepicker.com/
|
|
7
|
+
const _default = reactDropzonePkg.default;
|
|
8
|
+
// This defensive code is required to get around the fact that react-dropzone
|
|
9
|
+
// mixes default and named exports.
|
|
10
|
+
// Depending whether this module is run as ESM or CJS, then `_default` may be
|
|
11
|
+
// either the actual default export or an object with a default property.
|
|
12
|
+
// Rejoice in the woeful borderlands of modern ESM and legacy CJS interop.
|
|
13
|
+
exports.ReactDatePicker = 'default' in _default ? _default.default : _default;
|
|
14
|
+
exports.registerLocale = reactDropzonePkg.registerLocale;
|
|
15
|
+
exports.setDefaultLocale = reactDropzonePkg.setDefaultLocale;
|
|
16
|
+
exports.getDefaultLocale = reactDropzonePkg.getDefaultLocale;
|
|
17
|
+
exports.CalendarContainer = reactDropzonePkg.CalendarContainer;
|
package/esm/Datepicker.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ReactDatePicker, registerLocale } from 'react-datepicker'; // Docs: https://reactdatepicker.com/
|
|
3
2
|
import { useDomid } from '@hugsmidjan/react/hooks';
|
|
4
3
|
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
5
4
|
// For more info on localization see: https://stackoverflow.com/questions/54399084/change-locale-in-react-datepicker/58306958#58306958
|
|
6
5
|
import is from 'date-fns/locale/is/index.js';
|
|
7
6
|
import pl from 'date-fns/locale/pl/index.js';
|
|
7
|
+
import { ReactDatePicker, registerLocale, } from './_mixed_export_resolution_/ReactDatepicker.js'; // Docs: https://reactdatepicker.com/
|
|
8
8
|
import { FormField } from './FormField.js';
|
|
9
9
|
registerLocale('is', is);
|
|
10
10
|
registerLocale('pl', pl);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { DefaultTexts } from '@reykjavik/hanna-utils/i18n';
|
|
2
|
+
import { HTMLProps } from './utils.js';
|
|
3
|
+
export type ReadSpeakerPlayerI18n = {
|
|
4
|
+
linkText: string;
|
|
5
|
+
linkLabel?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const defaultReadSpeakerPlayerTexts: DefaultTexts<ReadSpeakerPlayerI18n>;
|
|
8
|
+
export type ReadSpeakerPlayerProps = {
|
|
9
|
+
/**
|
|
10
|
+
* Your ReadSpeaker account/customer ID
|
|
11
|
+
*
|
|
12
|
+
* @see https://docs.typo3.org/p/readspeaker/readspeaker-services/main/en-us/Configuration/Index.html#customer-id
|
|
13
|
+
*/
|
|
14
|
+
customerId?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Reading language/locale for the ReadSpeaker player.
|
|
17
|
+
*
|
|
18
|
+
* If you don't specify a `lang`, the player will try to auto-detect
|
|
19
|
+
* the language of the page, and pick a default `voice` for that language.
|
|
20
|
+
*
|
|
21
|
+
* @see https://docs.typo3.org/p/readspeaker/readspeaker-services/main/en-us/Configuration/Index.html#reading-language
|
|
22
|
+
*/
|
|
23
|
+
lang?: Lowercase<string>;
|
|
24
|
+
/**
|
|
25
|
+
* Reading voice for the ReadSpeaker player.
|
|
26
|
+
*
|
|
27
|
+
* This prop only makes sense if you specfy a reading `lang`, as
|
|
28
|
+
* the voices are language-specific.
|
|
29
|
+
*
|
|
30
|
+
* @see https://docs.typo3.org/p/readspeaker/readspeaker-services/main/en-us/Configuration/Index.html#voice
|
|
31
|
+
*/
|
|
32
|
+
voice?: string;
|
|
33
|
+
/**
|
|
34
|
+
* The DOM `id=""` of the element to read.
|
|
35
|
+
*
|
|
36
|
+
* @see https://docs.typo3.org/p/readspeaker/readspeaker-services/main/en-us/Configuration/Index.html#reading-area-id
|
|
37
|
+
*/
|
|
38
|
+
readId?: string;
|
|
39
|
+
/**
|
|
40
|
+
* The DOM class-name of the element(s) to read
|
|
41
|
+
*
|
|
42
|
+
* Comma-separated list of class-names may also work...
|
|
43
|
+
*
|
|
44
|
+
* @see https://docs.typo3.org/p/readspeaker/readspeaker-services/main/en-us/Configuration/Index.html#reading-area-class
|
|
45
|
+
*/
|
|
46
|
+
readClass?: string;
|
|
47
|
+
texts?: ReadSpeakerPlayerI18n;
|
|
48
|
+
align?: 'left' | 'right';
|
|
49
|
+
/** Tooggles CSS float layout */
|
|
50
|
+
float?: boolean;
|
|
51
|
+
/** Custom HTML attributes for the wrapper element. */
|
|
52
|
+
wrapperProps?: HTMLProps<'div'>;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Embeds a ReadSpeaker player in the page
|
|
56
|
+
*
|
|
57
|
+
* @see https://docs.typo3.org/p/readspeaker/readspeaker-services/main/en-us/Configuration/Index.html
|
|
58
|
+
*/
|
|
59
|
+
export declare const ReadSpeakerPlayer: (props: ReadSpeakerPlayerProps) => JSX.Element;
|
|
60
|
+
/**
|
|
61
|
+
* Run this function if you find that the player keeps reading when a user
|
|
62
|
+
* swaps pages.
|
|
63
|
+
*/
|
|
64
|
+
export declare const stopReading: () => void | undefined;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
3
|
+
import { getTexts } from '@reykjavik/hanna-utils/i18n';
|
|
4
|
+
const scriptTagId = 'rs_req_Init';
|
|
5
|
+
const scriptTagSelector = `script#${scriptTagId}`;
|
|
6
|
+
let buttons = 0;
|
|
7
|
+
export const defaultReadSpeakerPlayerTexts = {
|
|
8
|
+
en: { linkText: 'Listen', linkLabel: 'Listen to this page read outloud' },
|
|
9
|
+
is: { linkText: 'Hlusta', linkLabel: 'Hlusta á þessa síðu lesna upphátt' },
|
|
10
|
+
pl: { linkText: 'Posłuchaj', linkLabel: 'Posłuchaj tej strony odczytanej na głos' },
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Embeds a ReadSpeaker player in the page
|
|
14
|
+
*
|
|
15
|
+
* @see https://docs.typo3.org/p/readspeaker/readspeaker-services/main/en-us/Configuration/Index.html
|
|
16
|
+
*/
|
|
17
|
+
export const ReadSpeakerPlayer = (props) => {
|
|
18
|
+
const { align, float, customerId = '11315', lang = '', voice = /^is(?:_is)?$/i.test(lang) ? 'is_dora' : '', readId = '', readClass = readId ? '' : 'Layout__main', wrapperProps = {}, texts, } = props;
|
|
19
|
+
const { linkText, linkLabel } = getTexts({ lang: lang.slice(0, 2), texts }, defaultReadSpeakerPlayerTexts);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
if (buttons < 0) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (buttons === 0) {
|
|
26
|
+
if (document.querySelector(scriptTagSelector)) {
|
|
27
|
+
buttons = -1;
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const script = document.createElement('script');
|
|
31
|
+
script.id = scriptTagId;
|
|
32
|
+
script.src = `https://cdn-eu.readspeaker.com/script/${customerId}/webReader/webReader.js?pids=wr`;
|
|
33
|
+
script.onload = () => { var _a, _b; return (_b = (_a = window.rspkr) === null || _a === void 0 ? void 0 : _a.ui) === null || _b === void 0 ? void 0 : _b.addClickEvents(); };
|
|
34
|
+
script.async = true;
|
|
35
|
+
document.head.appendChild(script);
|
|
36
|
+
}
|
|
37
|
+
buttons++;
|
|
38
|
+
(_b = (_a = window.rspkr) === null || _a === void 0 ? void 0 : _a.ui) === null || _b === void 0 ? void 0 : _b.addClickEvents();
|
|
39
|
+
return () => {
|
|
40
|
+
var _a;
|
|
41
|
+
buttons--;
|
|
42
|
+
if (buttons === 0) {
|
|
43
|
+
(_a = document.querySelector(scriptTagSelector)) === null || _a === void 0 ? void 0 : _a.remove();
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
48
|
+
[
|
|
49
|
+
// We're not trying to support dynamic changes to `customerId`
|
|
50
|
+
// or multiple different `customerId`s on the same page.
|
|
51
|
+
// If you try that, things will be weird and wonky.
|
|
52
|
+
]);
|
|
53
|
+
return (React.createElement("div", Object.assign({}, wrapperProps, { className: getBemClass('ReadSpeakerPlayer', [align === 'right' && `align-${align}`, float && 'float'], wrapperProps.className) }),
|
|
54
|
+
React.createElement("div", { id: "readspeaker_button1", className: "rs_skip rsbtn rs_preserve" },
|
|
55
|
+
React.createElement("a", { rel: "nofollow", className: "rsbtn_play", accessKey: "L", title: linkLabel || linkText, href: `https://app-eu.readspeaker.com/cgi-bin/rsent?${new URLSearchParams({
|
|
56
|
+
customerid: customerId,
|
|
57
|
+
lang,
|
|
58
|
+
voice: lang && voice,
|
|
59
|
+
autoLang: !lang ? 'true' : 'false',
|
|
60
|
+
readclass: readClass,
|
|
61
|
+
readid: readId,
|
|
62
|
+
})}` },
|
|
63
|
+
React.createElement("span", { className: "rsbtn_left rsimg rspart" },
|
|
64
|
+
React.createElement("span", { className: "rsbtn_text" },
|
|
65
|
+
React.createElement("span", null, linkText))),
|
|
66
|
+
React.createElement("span", { className: "rsbtn_right rsimg rsplay rspart" })))));
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Run this function if you find that the player keeps reading when a user
|
|
70
|
+
* swaps pages.
|
|
71
|
+
*/
|
|
72
|
+
export const stopReading = () => { var _a, _b; return (_b = (_a = window.rspkr) === null || _a === void 0 ? void 0 : _a.ui) === null || _b === void 0 ? void 0 : _b.destroyActivePlayer(); };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as reactDropzonePkg from 'react-datepicker';
|
|
2
|
+
export declare const ReactDatePicker: typeof reactDropzonePkg.ReactDatePicker;
|
|
3
|
+
export declare const registerLocale: typeof reactDropzonePkg.registerLocale;
|
|
4
|
+
export declare const setDefaultLocale: typeof reactDropzonePkg.setDefaultLocale;
|
|
5
|
+
export declare const getDefaultLocale: typeof reactDropzonePkg.getDefaultLocale;
|
|
6
|
+
export declare const CalendarContainer: typeof reactDropzonePkg.CalendarContainer;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// See <file://./_WAT.md> for info on why this file exists
|
|
2
|
+
import * as reactDropzonePkg from 'react-datepicker'; // Docs: https://reactdatepicker.com/
|
|
3
|
+
const _default = reactDropzonePkg.default;
|
|
4
|
+
// This defensive code is required to get around the fact that react-dropzone
|
|
5
|
+
// mixes default and named exports.
|
|
6
|
+
// Depending whether this module is run as ESM or CJS, then `_default` may be
|
|
7
|
+
// either the actual default export or an object with a default property.
|
|
8
|
+
// Rejoice in the woeful borderlands of modern ESM and legacy CJS interop.
|
|
9
|
+
export const ReactDatePicker = 'default' in _default ? _default.default : _default;
|
|
10
|
+
export const registerLocale = reactDropzonePkg.registerLocale;
|
|
11
|
+
export const setDefaultLocale = reactDropzonePkg.setDefaultLocale;
|
|
12
|
+
export const getDefaultLocale = reactDropzonePkg.getDefaultLocale;
|
|
13
|
+
export const CalendarContainer = reactDropzonePkg.CalendarContainer;
|
package/esm/index.d.ts
CHANGED
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
/// <reference path="./RowBlockColumn.d.tsx" />
|
|
28
28
|
/// <reference path="./RowBlock.d.tsx" />
|
|
29
29
|
/// <reference path="./RelatedLinks.d.tsx" />
|
|
30
|
+
/// <reference path="./ReadSpeakerPlayer.d.tsx" />
|
|
30
31
|
/// <reference path="./RadioGroup.d.tsx" />
|
|
31
32
|
/// <reference path="./RadioButtonsGroup.d.tsx" />
|
|
32
33
|
/// <reference path="./PullQuote.d.tsx" />
|
package/index.d.ts
CHANGED
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
/// <reference path="./RowBlockColumn.d.tsx" />
|
|
28
28
|
/// <reference path="./RowBlock.d.tsx" />
|
|
29
29
|
/// <reference path="./RelatedLinks.d.tsx" />
|
|
30
|
+
/// <reference path="./ReadSpeakerPlayer.d.tsx" />
|
|
30
31
|
/// <reference path="./RadioGroup.d.tsx" />
|
|
31
32
|
/// <reference path="./RadioButtonsGroup.d.tsx" />
|
|
32
33
|
/// <reference path="./PullQuote.d.tsx" />
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reykjavik/hanna-react",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.92",
|
|
4
4
|
"author": "Reykjavík (http://www.reykjavik.is)",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Hugsmiðjan ehf (http://www.hugsmidjan.is)",
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@floating-ui/react": "^0.19.2",
|
|
17
|
-
"@hugsmidjan/qj": "^4.
|
|
18
|
-
"@hugsmidjan/react": "^0.4.
|
|
17
|
+
"@hugsmidjan/qj": "^4.20.0",
|
|
18
|
+
"@hugsmidjan/react": "^0.4.32",
|
|
19
19
|
"@reykjavik/hanna-css": "^0.4.2",
|
|
20
|
-
"@reykjavik/hanna-utils": "^0.2.
|
|
20
|
+
"@reykjavik/hanna-utils": "^0.2.6",
|
|
21
21
|
"@types/react": "^17.0.24",
|
|
22
22
|
"@types/react-autosuggest": "^10.1.0",
|
|
23
23
|
"@types/react-datepicker": "^4.8.0",
|
|
@@ -161,6 +161,10 @@
|
|
|
161
161
|
"import": "./esm/RelatedLinks.js",
|
|
162
162
|
"require": "./RelatedLinks.js"
|
|
163
163
|
},
|
|
164
|
+
"./ReadSpeakerPlayer": {
|
|
165
|
+
"import": "./esm/ReadSpeakerPlayer.js",
|
|
166
|
+
"require": "./ReadSpeakerPlayer.js"
|
|
167
|
+
},
|
|
164
168
|
"./RadioGroup": {
|
|
165
169
|
"import": "./esm/RadioGroup.js",
|
|
166
170
|
"require": "./RadioGroup.js"
|