@reykjavik/hanna-react 0.10.72 → 0.10.75
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 +20 -2
- package/Datepicker.d.ts +1 -1
- package/Datepicker.js +20 -2
- package/SiteSearchInput.d.ts +1 -1
- package/package.json +2 -2
- package/utils/config.d.ts +2 -0
- package/utils/config.js +8 -0
- package/utils/useFormatMonitor.d.ts +1 -1
- package/utils/useGetSVGtext.d.ts +4 -0
- package/utils/useGetSVGtext.js +4 -0
- package/utils.d.ts +1 -0
- package/utils.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,26 @@
|
|
|
4
4
|
|
|
5
5
|
- ... <!-- Add new lines here. -->
|
|
6
6
|
|
|
7
|
+
## 0.10.75
|
|
8
|
+
|
|
9
|
+
_2022-12-15_
|
|
10
|
+
|
|
11
|
+
- feat: Add `setLinkRenderer`, exported from `/utils` — to allow hooking
|
|
12
|
+
`hanna-react` into custom routing components
|
|
13
|
+
|
|
14
|
+
## 0.10.74
|
|
15
|
+
|
|
16
|
+
_2022-12-12_
|
|
17
|
+
|
|
18
|
+
- feat: Add support for Polish to `DatePicker`
|
|
19
|
+
- fix: Make Icelandic the default `DatePicker` locale
|
|
20
|
+
|
|
21
|
+
## 0.10.73
|
|
22
|
+
|
|
23
|
+
_2022-12-08_
|
|
24
|
+
|
|
25
|
+
- fix: `Datepicker` calendar not closing when date is selected
|
|
26
|
+
|
|
7
27
|
## 0.10.72
|
|
8
28
|
|
|
9
29
|
_2022-12-07_
|
|
@@ -392,8 +412,6 @@ _2022-02-15_
|
|
|
392
412
|
|
|
393
413
|
_2022-02-08_
|
|
394
414
|
|
|
395
|
-
- feat: Add `setLinkRenderer`, exported from `utils/config` — to allow hooking
|
|
396
|
-
`hanna-react` into custom routing components
|
|
397
415
|
- feat: Add optional prop `lang` to `MegaMenuItem` (and export that type)
|
|
398
416
|
- feat(ts): Export type `MainMenuSeparator`
|
|
399
417
|
- fix: `ContactBubble` not reacting/appearing on scroll on mobile browsers
|
package/Datepicker.d.ts
CHANGED
package/Datepicker.js
CHANGED
|
@@ -9,8 +9,10 @@ const hooks_1 = require("@hugsmidjan/react/hooks");
|
|
|
9
9
|
const getBemClass_1 = tslib_1.__importDefault(require("@hugsmidjan/react/utils/getBemClass"));
|
|
10
10
|
// For more info on localization see: https://stackoverflow.com/questions/54399084/change-locale-in-react-datepicker/58306958#58306958
|
|
11
11
|
const is_1 = tslib_1.__importDefault(require("date-fns/locale/is"));
|
|
12
|
+
const pl_1 = tslib_1.__importDefault(require("date-fns/locale/pl"));
|
|
12
13
|
const FormField_1 = tslib_1.__importDefault(require("./FormField"));
|
|
13
14
|
(0, react_datepicker_1.registerLocale)('is', is_1.default);
|
|
15
|
+
(0, react_datepicker_1.registerLocale)('pl', pl_1.default);
|
|
14
16
|
const getDateDiff = (date, diff) => {
|
|
15
17
|
const newDate = new Date(date);
|
|
16
18
|
newDate.setDate(newDate.getDate() + diff);
|
|
@@ -34,15 +36,31 @@ const i18n = {
|
|
|
34
36
|
chooseDayAriaLabelPrefix: 'Veldu:',
|
|
35
37
|
disabledDayAriaLabelPrefix: 'Dagsetning ekki í boði',
|
|
36
38
|
},
|
|
39
|
+
pl: {
|
|
40
|
+
nextMonthAriaLabel: 'Następny miesiącu',
|
|
41
|
+
nextMonthButtonLabel: 'Następny miesiącu',
|
|
42
|
+
nextYearAriaLabel: 'Następny rok',
|
|
43
|
+
nextYearButtonLabel: 'Następny rok',
|
|
44
|
+
previousMonthAriaLabel: 'Poprzedni miesiac',
|
|
45
|
+
previousMonthButtonLabel: 'Poprzedni miesiac',
|
|
46
|
+
previousYearAriaLabel: 'Poprzedni rok',
|
|
47
|
+
previousYearButtonLabel: 'Poprzedni rok',
|
|
48
|
+
timeInputLabel: 'Czas: ',
|
|
49
|
+
weekAriaLabelPrefix: 'Tydzień: ',
|
|
50
|
+
weekLabel: 'Tydzień',
|
|
51
|
+
ariaLabelPrefix: 'Miesiąc:',
|
|
52
|
+
chooseDayAriaLabelPrefix: 'Wybierać:',
|
|
53
|
+
disabledDayAriaLabelPrefix: 'Data niedostępna',
|
|
54
|
+
},
|
|
37
55
|
};
|
|
38
56
|
const Datepicker = (props) => {
|
|
39
|
-
const { className, id, label, hideLabel, assistText, disabled, readOnly, invalid, errorMessage, required, reqText, placeholder, small, localeCode, dateFormat = 'd.M.yyy', initialDate, value = initialDate, name, startDate, endDate, minDate, maxDate, isStartDate = false, isEndDate = false, onChange, datepickerExtraProps, ssr, inputRef, } = props;
|
|
57
|
+
const { className, id, label, hideLabel, assistText, disabled, readOnly, invalid, errorMessage, required, reqText, placeholder, small, localeCode = 'is', dateFormat = 'd.M.yyy', initialDate, value = initialDate, name, startDate, endDate, minDate, maxDate, isStartDate = false, isEndDate = false, onChange, datepickerExtraProps, ssr, inputRef, } = props;
|
|
40
58
|
const domid = (0, hooks_1.useDomid)(id);
|
|
41
59
|
const txts = (localeCode && i18n[localeCode]) || {};
|
|
42
60
|
const filled = !!value;
|
|
43
61
|
const empty = !filled && !placeholder;
|
|
44
62
|
return (react_1.default.createElement(FormField_1.default, { className: (0, getBemClass_1.default)('Datepicker', [], className), ssr: ssr, label: label, small: small, assistText: assistText, hideLabel: hideLabel, invalid: invalid, required: required, reqText: reqText, disabled: disabled, readOnly: readOnly, filled: filled, empty: empty, errorMessage: errorMessage, renderInput: (className, inputProps, addFocusProps) => {
|
|
45
|
-
return (react_1.default.createElement("div", Object.assign({ className: className.input, onClick: (
|
|
63
|
+
return (react_1.default.createElement("div", Object.assign({ className: className.input, onClick: ({ target, currentTarget }) => target === currentTarget && currentTarget.querySelector('input').focus(), ref: inputRef &&
|
|
46
64
|
((elm) => {
|
|
47
65
|
inputRef.current =
|
|
48
66
|
(elm === null || elm === void 0 ? void 0 : elm.querySelector('input')) || undefined;
|
package/SiteSearchInput.d.ts
CHANGED
|
@@ -20,5 +20,5 @@ export declare type SiteSearchInputProps = {
|
|
|
20
20
|
children?: never;
|
|
21
21
|
ssr?: SSRSupport;
|
|
22
22
|
} & WrappingProps & InputElmProps;
|
|
23
|
-
export declare const SiteSearchInput: React.ForwardRefExoticComponent<Pick<SiteSearchInputProps, "form" | "label" | "slot" | "style" | "title" | "
|
|
23
|
+
export declare const SiteSearchInput: React.ForwardRefExoticComponent<Pick<SiteSearchInputProps, "form" | "label" | "slot" | "style" | "title" | "key" | "list" | "pattern" | "is" | "value" | "defaultValue" | "id" | "ssr" | "children" | "hidden" | "onClick" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "defaultChecked" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "size" | "step" | "src" | "multiple" | "alt" | "width" | "accept" | "autoComplete" | "capture" | "checked" | "crossOrigin" | "enterKeyHint" | "height" | "max" | "maxLength" | "min" | "minLength" | "onButtonClick" | "buttonText"> & React.RefAttributes<HTMLInputElement>>;
|
|
24
24
|
export default SiteSearchInput;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reykjavik/hanna-react",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.75",
|
|
4
4
|
"author": "Reykjavík (http://www.reykjavik.is)",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Hugsmiðjan ehf (http://www.hugsmidjan.is)",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"@hugsmidjan/qj": "^4.10.2",
|
|
17
17
|
"@hugsmidjan/react": "^0.4.20",
|
|
18
18
|
"@reykjavik/hanna-css": "^0.3.10",
|
|
19
|
-
"@reykjavik/hanna-utils": "^0.1.
|
|
19
|
+
"@reykjavik/hanna-utils": "^0.1.18",
|
|
20
20
|
"@types/react": "^17.0.24",
|
|
21
21
|
"@types/react-autosuggest": "^10.1.0",
|
|
22
22
|
"@types/react-datepicker": "^3.0.2",
|
package/utils/config.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setLinkRenderer = void 0;
|
|
4
|
+
var _Link_1 = require("../_abstract/_Link");
|
|
5
|
+
Object.defineProperty(exports, "setLinkRenderer", { enumerable: true, get: function () { return _Link_1.setLinkRenderer; } });
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
// TODO:
|
|
8
|
+
// * Add defaultSSR variable that can be set globally for
|
|
@@ -35,4 +35,4 @@
|
|
|
35
35
|
* media.leftHamburger
|
|
36
36
|
* ```
|
|
37
37
|
*/
|
|
38
|
-
export declare const useFormatMonitor: (callback: (media: import("formatchange").BaseMedia & Record<"isHamburger" | "isTopmenu" | "wasHamburger" | "wasTopmenu" | "becameHamburger" | "becameTopmenu" | "leftHamburger" | "leftTopmenu", boolean>) => void) => void;
|
|
38
|
+
export declare const useFormatMonitor: (callback: ((media: import("formatchange").BaseMedia & Record<"isHamburger" | "isTopmenu" | "wasHamburger" | "wasTopmenu" | "becameHamburger" | "becameTopmenu" | "leftHamburger" | "leftTopmenu", boolean>) => void) | undefined) => void;
|
package/utils/useGetSVGtext.d.ts
CHANGED
|
@@ -2,5 +2,9 @@ declare type SVGMeta = {
|
|
|
2
2
|
imageSrc: string;
|
|
3
3
|
code: string;
|
|
4
4
|
};
|
|
5
|
+
/**
|
|
6
|
+
* Fetches a remote SVG image and returns its XML/source
|
|
7
|
+
* string for inlining, or further processing
|
|
8
|
+
*/
|
|
5
9
|
export declare const useGetSVGtext: (imageSrc: string | undefined) => SVGMeta | undefined;
|
|
6
10
|
export {};
|
package/utils/useGetSVGtext.js
CHANGED
|
@@ -3,6 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useGetSVGtext = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const hanna_utils_1 = require("@reykjavik/hanna-utils");
|
|
6
|
+
/**
|
|
7
|
+
* Fetches a remote SVG image and returns its XML/source
|
|
8
|
+
* string for inlining, or further processing
|
|
9
|
+
*/
|
|
6
10
|
const useGetSVGtext = (imageSrc) => {
|
|
7
11
|
const [inlineSvg, setInlineSvg] = (0, react_1.useState)();
|
|
8
12
|
const srcRef = (0, react_1.useRef)(imageSrc);
|
package/utils.d.ts
CHANGED
package/utils.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./utils/config"), exports);
|
|
4
5
|
tslib_1.__exportStar(require("./utils/useDidChange"), exports);
|
|
5
6
|
tslib_1.__exportStar(require("./utils/useFormatMonitor"), exports);
|
|
6
7
|
tslib_1.__exportStar(require("./utils/useGetSVGtext"), exports);
|