@dnb/eufemia 9.28.0 → 9.29.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/CHANGELOG.md +17 -0
- package/cjs/components/dialog/style/dnb-dialog.css +9 -6
- package/cjs/components/dialog/style/dnb-dialog.min.css +1 -1
- package/cjs/components/drawer/style/_drawer.scss +4 -3
- package/cjs/components/drawer/style/dnb-drawer.css +17 -10
- package/cjs/components/drawer/style/dnb-drawer.min.css +1 -1
- package/cjs/components/form-row/FormRowHelpers.d.ts +1 -1
- package/cjs/components/lib.d.ts +1 -89
- package/cjs/components/modal/style/_modal.scss +0 -1
- package/cjs/components/modal/style/dnb-modal.css +9 -6
- package/cjs/components/modal/style/dnb-modal.min.css +1 -1
- package/cjs/components/skeleton/SkeletonHelper.d.ts +2 -1
- package/cjs/components/slider/Slider.d.ts +6 -144
- package/cjs/components/slider/Slider.js +5 -595
- package/cjs/components/slider/SliderHelpers.d.ts +23 -0
- package/cjs/components/slider/SliderHelpers.js +239 -0
- package/cjs/components/slider/SliderInstance.d.ts +6 -0
- package/cjs/components/slider/SliderInstance.js +190 -0
- package/cjs/components/slider/SliderProvider.d.ts +4 -0
- package/cjs/components/slider/SliderProvider.js +264 -0
- package/cjs/components/slider/SliderThumb.d.ts +2 -0
- package/cjs/components/slider/SliderThumb.js +137 -0
- package/cjs/components/slider/SliderTrack.d.ts +6 -0
- package/cjs/components/slider/SliderTrack.js +131 -0
- package/cjs/components/slider/hooks/useSliderEvents.d.ts +11 -0
- package/cjs/components/slider/hooks/useSliderEvents.js +146 -0
- package/cjs/components/slider/hooks/useSliderProps.d.ts +1 -0
- package/cjs/components/slider/hooks/useSliderProps.js +16 -0
- package/cjs/components/slider/style/_slider.scss +19 -48
- package/cjs/components/slider/style/dnb-slider.css +30 -60
- package/cjs/components/slider/style/dnb-slider.min.css +1 -1
- package/cjs/components/slider/style/themes/dnb-slider-theme-ui.css +0 -16
- package/cjs/components/slider/style/themes/dnb-slider-theme-ui.min.css +1 -1
- package/cjs/components/slider/style/themes/dnb-slider-theme-ui.scss +0 -17
- package/cjs/components/slider/types.d.ts +75 -0
- package/cjs/components/slider/types.js +1 -0
- package/cjs/elements/Anchor.d.ts +44 -105
- package/cjs/elements/Anchor.js +48 -138
- package/cjs/elements/Element.d.ts +23 -40
- package/cjs/elements/Element.js +48 -122
- package/cjs/elements/Link.d.ts +18 -1
- package/cjs/elements/lib.d.ts +36 -2
- package/cjs/shared/Context.d.ts +2 -0
- package/cjs/shared/Eufemia.js +1 -1
- package/cjs/shared/helpers/Suffix.d.ts +2 -1
- package/cjs/shared/helpers/Suffix.js +5 -2
- package/cjs/shared/helpers/withCamelCaseProps.d.ts +1 -1
- package/cjs/shared/helpers/withSnakeCaseProps.d.ts +40 -0
- package/cjs/shared/helpers/withSnakeCaseProps.js +168 -0
- package/cjs/shared/locales/en-GB.d.ts +3 -3
- package/cjs/shared/locales/en-GB.js +3 -3
- package/cjs/shared/locales/en-US.d.ts +3 -3
- package/cjs/shared/locales/index.d.ts +6 -6
- package/cjs/shared/locales/nb-NO.d.ts +3 -3
- package/cjs/shared/locales/nb-NO.js +3 -3
- package/cjs/style/dnb-ui-components.css +39 -66
- package/cjs/style/dnb-ui-components.min.css +3 -3
- package/cjs/style/dnb-ui-elements.css +44 -28
- package/cjs/style/dnb-ui-elements.min.css +1 -1
- package/cjs/style/dnb-ui-tags.css +63 -40
- package/cjs/style/dnb-ui-tags.min.css +1 -1
- package/cjs/style/elements/_anchor-mixins.scss +6 -3
- package/cjs/style/themes/theme-eiendom/dnb-theme-eiendom.css +40 -40
- package/cjs/style/themes/theme-eiendom/dnb-theme-eiendom.min.css +2 -2
- package/cjs/style/themes/theme-ui/dnb-theme-ui.css +44 -44
- package/cjs/style/themes/theme-ui/dnb-theme-ui.min.css +2 -2
- package/components/dialog/style/dnb-dialog.css +9 -6
- package/components/dialog/style/dnb-dialog.min.css +1 -1
- package/components/drawer/style/_drawer.scss +4 -3
- package/components/drawer/style/dnb-drawer.css +17 -10
- package/components/drawer/style/dnb-drawer.min.css +1 -1
- package/components/form-row/FormRowHelpers.d.ts +1 -1
- package/components/lib.d.ts +1 -89
- package/components/modal/style/_modal.scss +0 -1
- package/components/modal/style/dnb-modal.css +9 -6
- package/components/modal/style/dnb-modal.min.css +1 -1
- package/components/skeleton/SkeletonHelper.d.ts +2 -1
- package/components/slider/Slider.d.ts +6 -144
- package/components/slider/Slider.js +5 -528
- package/components/slider/SliderHelpers.d.ts +23 -0
- package/components/slider/SliderHelpers.js +152 -0
- package/components/slider/SliderInstance.d.ts +6 -0
- package/components/slider/SliderInstance.js +162 -0
- package/components/slider/SliderProvider.d.ts +4 -0
- package/components/slider/SliderProvider.js +199 -0
- package/components/slider/SliderThumb.d.ts +2 -0
- package/components/slider/SliderThumb.js +109 -0
- package/components/slider/SliderTrack.d.ts +6 -0
- package/components/slider/SliderTrack.js +104 -0
- package/components/slider/hooks/useSliderEvents.d.ts +11 -0
- package/components/slider/hooks/useSliderEvents.js +132 -0
- package/components/slider/hooks/useSliderProps.d.ts +1 -0
- package/components/slider/hooks/useSliderProps.js +5 -0
- package/components/slider/style/_slider.scss +19 -48
- package/components/slider/style/dnb-slider.css +30 -60
- package/components/slider/style/dnb-slider.min.css +1 -1
- package/components/slider/style/themes/dnb-slider-theme-ui.css +0 -16
- package/components/slider/style/themes/dnb-slider-theme-ui.min.css +1 -1
- package/components/slider/style/themes/dnb-slider-theme-ui.scss +0 -17
- package/components/slider/types.d.ts +75 -0
- package/components/slider/types.js +1 -0
- package/elements/Anchor.d.ts +44 -105
- package/elements/Anchor.js +51 -113
- package/elements/Element.d.ts +23 -40
- package/elements/Element.js +44 -92
- package/elements/Link.d.ts +18 -1
- package/elements/lib.d.ts +36 -2
- package/es/components/dialog/style/dnb-dialog.css +9 -6
- package/es/components/dialog/style/dnb-dialog.min.css +1 -1
- package/es/components/drawer/style/_drawer.scss +4 -3
- package/es/components/drawer/style/dnb-drawer.css +17 -10
- package/es/components/drawer/style/dnb-drawer.min.css +1 -1
- package/es/components/form-row/FormRowHelpers.d.ts +1 -1
- package/es/components/lib.d.ts +1 -89
- package/es/components/modal/style/_modal.scss +0 -1
- package/es/components/modal/style/dnb-modal.css +9 -6
- package/es/components/modal/style/dnb-modal.min.css +1 -1
- package/es/components/skeleton/SkeletonHelper.d.ts +2 -1
- package/es/components/slider/Slider.d.ts +6 -144
- package/es/components/slider/Slider.js +5 -484
- package/es/components/slider/SliderHelpers.d.ts +23 -0
- package/es/components/slider/SliderHelpers.js +124 -0
- package/es/components/slider/SliderInstance.d.ts +6 -0
- package/es/components/slider/SliderInstance.js +167 -0
- package/es/components/slider/SliderProvider.d.ts +4 -0
- package/es/components/slider/SliderProvider.js +178 -0
- package/es/components/slider/SliderThumb.d.ts +2 -0
- package/es/components/slider/SliderThumb.js +100 -0
- package/es/components/slider/SliderTrack.d.ts +6 -0
- package/es/components/slider/SliderTrack.js +99 -0
- package/es/components/slider/hooks/useSliderEvents.d.ts +11 -0
- package/es/components/slider/hooks/useSliderEvents.js +129 -0
- package/es/components/slider/hooks/useSliderProps.d.ts +1 -0
- package/es/components/slider/hooks/useSliderProps.js +5 -0
- package/es/components/slider/style/_slider.scss +19 -48
- package/es/components/slider/style/dnb-slider.css +30 -60
- package/es/components/slider/style/dnb-slider.min.css +1 -1
- package/es/components/slider/style/themes/dnb-slider-theme-ui.css +0 -16
- package/es/components/slider/style/themes/dnb-slider-theme-ui.min.css +1 -1
- package/es/components/slider/style/themes/dnb-slider-theme-ui.scss +0 -17
- package/es/components/slider/types.d.ts +75 -0
- package/es/components/slider/types.js +1 -0
- package/es/elements/Anchor.d.ts +44 -105
- package/es/elements/Anchor.js +49 -80
- package/es/elements/Element.d.ts +23 -40
- package/es/elements/Element.js +44 -61
- package/es/elements/Link.d.ts +18 -1
- package/es/elements/lib.d.ts +36 -2
- package/es/shared/Context.d.ts +2 -0
- package/es/shared/Eufemia.js +1 -1
- package/es/shared/helpers/Suffix.d.ts +2 -1
- package/es/shared/helpers/Suffix.js +5 -3
- package/es/shared/helpers/withCamelCaseProps.d.ts +1 -1
- package/es/shared/helpers/withSnakeCaseProps.d.ts +40 -0
- package/es/shared/helpers/withSnakeCaseProps.js +72 -0
- package/es/shared/locales/en-GB.d.ts +3 -3
- package/es/shared/locales/en-GB.js +3 -3
- package/es/shared/locales/en-US.d.ts +3 -3
- package/es/shared/locales/index.d.ts +6 -6
- package/es/shared/locales/nb-NO.d.ts +3 -3
- package/es/shared/locales/nb-NO.js +3 -3
- package/es/style/dnb-ui-components.css +39 -66
- package/es/style/dnb-ui-components.min.css +3 -3
- package/es/style/dnb-ui-elements.css +44 -28
- package/es/style/dnb-ui-elements.min.css +1 -1
- package/es/style/dnb-ui-tags.css +63 -40
- package/es/style/dnb-ui-tags.min.css +1 -1
- package/es/style/elements/_anchor-mixins.scss +6 -3
- package/es/style/themes/theme-eiendom/dnb-theme-eiendom.css +40 -40
- package/es/style/themes/theme-eiendom/dnb-theme-eiendom.min.css +2 -2
- package/es/style/themes/theme-ui/dnb-theme-ui.css +44 -44
- package/es/style/themes/theme-ui/dnb-theme-ui.min.css +2 -2
- package/esm/dnb-ui-basis.min.mjs +1 -1
- package/esm/dnb-ui-components.min.mjs +3 -3
- package/esm/dnb-ui-elements.min.mjs +9 -10
- package/esm/dnb-ui-extensions.min.mjs +4 -4
- package/esm/dnb-ui-lib.min.mjs +3 -3
- package/esm/dnb-ui-web-components.min.mjs +3 -3
- package/package.json +1 -1
- package/shared/Context.d.ts +2 -0
- package/shared/Eufemia.js +1 -1
- package/shared/helpers/Suffix.d.ts +2 -1
- package/shared/helpers/Suffix.js +4 -2
- package/shared/helpers/withCamelCaseProps.d.ts +1 -1
- package/shared/helpers/withSnakeCaseProps.d.ts +40 -0
- package/shared/helpers/withSnakeCaseProps.js +115 -0
- package/shared/locales/en-GB.d.ts +3 -3
- package/shared/locales/en-GB.js +3 -3
- package/shared/locales/en-US.d.ts +3 -3
- package/shared/locales/index.d.ts +6 -6
- package/shared/locales/nb-NO.d.ts +3 -3
- package/shared/locales/nb-NO.js +3 -3
- package/style/dnb-ui-components.css +39 -66
- package/style/dnb-ui-components.min.css +3 -3
- package/style/dnb-ui-elements.css +44 -28
- package/style/dnb-ui-elements.min.css +1 -1
- package/style/dnb-ui-tags.css +63 -40
- package/style/dnb-ui-tags.min.css +1 -1
- package/style/elements/_anchor-mixins.scss +6 -3
- package/style/themes/theme-eiendom/dnb-theme-eiendom.css +40 -40
- package/style/themes/theme-eiendom/dnb-theme-eiendom.min.css +2 -2
- package/style/themes/theme-ui/dnb-theme-ui.css +44 -44
- package/style/themes/theme-ui/dnb-theme-ui.min.css +2 -2
- package/umd/dnb-ui-basis.min.js +1 -1
- package/umd/dnb-ui-components.min.js +5 -5
- package/umd/dnb-ui-elements.min.js +20 -21
- package/umd/dnb-ui-extensions.min.js +3 -3
- package/umd/dnb-ui-lib.min.js +4 -4
- package/umd/dnb-ui-web-components.min.js +3 -3
package/es/elements/Anchor.d.ts
CHANGED
|
@@ -1,108 +1,47 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export type AnchorSpace =
|
|
3
|
-
| string
|
|
4
|
-
| number
|
|
5
|
-
| boolean
|
|
6
|
-
| {
|
|
7
|
-
/**
|
|
8
|
-
* Use spacing values like: `small`, `1rem`, `1` or , `16px`. Will use `margin-top`.
|
|
9
|
-
*/
|
|
10
|
-
top?: string | number | boolean;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Use spacing values like: `small`, `1rem`, `1` or , `16px`. will use `margin-right`.
|
|
14
|
-
*/
|
|
15
|
-
right?: string | number | boolean;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Use spacing values like: `small`, `1rem`, `1` or , `16px`. will use `margin-bottom`.
|
|
19
|
-
*/
|
|
20
|
-
bottom?: string | number | boolean;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Use spacing values like: `small`, `1rem`, `1` or , `16px`. will use `margin-left`.
|
|
24
|
-
*/
|
|
25
|
-
left?: string | number | boolean;
|
|
26
|
-
};
|
|
27
|
-
export type AnchorTop = string | number | boolean;
|
|
28
|
-
export type AnchorRight = string | number | boolean;
|
|
29
|
-
export type AnchorBottom = string | number | boolean;
|
|
30
|
-
export type AnchorLeft = string | number | boolean;
|
|
31
|
-
export type AnchorElement =
|
|
32
|
-
| ((...args: any[]) => any)
|
|
33
|
-
| Object
|
|
34
|
-
| React.ReactNode;
|
|
35
|
-
export type AnchorTo = string | Object | ((...args: any[]) => any);
|
|
36
|
-
export type AnchorClassName = string | Object | any[];
|
|
37
|
-
export type AnchorTooltip = ((...args: any[]) => any) | React.ReactNode;
|
|
38
|
-
export type AnchorSkeleton = string | boolean;
|
|
39
|
-
|
|
40
1
|
/**
|
|
41
|
-
*
|
|
2
|
+
* HTML Element
|
|
3
|
+
*
|
|
42
4
|
*/
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* The title shown as a tooltip when target is set to `_blank`.
|
|
87
|
-
*/
|
|
88
|
-
target_blank_title?: string;
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Defines the opening method. Use `_blank` to open a new browser window/tab.
|
|
92
|
-
*/
|
|
93
|
-
target?: string;
|
|
94
|
-
className?: AnchorClassName;
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Provide a string or a React Element to be shown as the tooltip content.
|
|
98
|
-
*/
|
|
99
|
-
tooltip?: AnchorTooltip;
|
|
100
|
-
children?: React.ReactNode;
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* If set to `true`, an overlaying skeleton with animation will be shown.
|
|
104
|
-
*/
|
|
105
|
-
skeleton?: AnchorSkeleton;
|
|
106
|
-
}
|
|
107
|
-
declare const Anchor: React.FC<AnchorProps>;
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { ISpacingProps } from '../shared/interfaces';
|
|
7
|
+
export declare type AnchorProps = {
|
|
8
|
+
element?: React.ReactNode;
|
|
9
|
+
href?: string;
|
|
10
|
+
to?: string;
|
|
11
|
+
targetBlankTitle?: string;
|
|
12
|
+
target?: string;
|
|
13
|
+
tooltip?: React.ReactNode;
|
|
14
|
+
skeleton?: boolean;
|
|
15
|
+
className?: string;
|
|
16
|
+
children?: React.ReactNode;
|
|
17
|
+
omitClass?: boolean;
|
|
18
|
+
innerRef?: React.ForwardedRef<unknown>;
|
|
19
|
+
id?: string;
|
|
20
|
+
title?: string;
|
|
21
|
+
lang?: string;
|
|
22
|
+
/** @deprecated use innerRef instead */
|
|
23
|
+
inner_ref?: React.ForwardedRef<unknown>;
|
|
24
|
+
/** @deprecated use targetBlankTitle instead */
|
|
25
|
+
target_blank_title?: string;
|
|
26
|
+
} & Partial<Omit<HTMLAnchorElement, 'children'>> & ISpacingProps;
|
|
27
|
+
declare const Anchor: React.ForwardRefExoticComponent<{
|
|
28
|
+
element?: React.ReactNode;
|
|
29
|
+
href?: string;
|
|
30
|
+
to?: string;
|
|
31
|
+
targetBlankTitle?: string;
|
|
32
|
+
target?: string;
|
|
33
|
+
tooltip?: React.ReactNode;
|
|
34
|
+
skeleton?: boolean;
|
|
35
|
+
className?: string;
|
|
36
|
+
children?: React.ReactNode;
|
|
37
|
+
omitClass?: boolean;
|
|
38
|
+
innerRef?: React.ForwardedRef<unknown>;
|
|
39
|
+
id?: string;
|
|
40
|
+
title?: string;
|
|
41
|
+
lang?: string;
|
|
42
|
+
/** @deprecated use innerRef instead */
|
|
43
|
+
inner_ref?: React.ForwardedRef<unknown>;
|
|
44
|
+
/** @deprecated use targetBlankTitle instead */
|
|
45
|
+
target_blank_title?: string;
|
|
46
|
+
} & Partial<Omit<HTMLAnchorElement, "children">> & ISpacingProps & React.RefAttributes<unknown>>;
|
|
108
47
|
export default Anchor;
|
package/es/elements/Anchor.js
CHANGED
|
@@ -1,96 +1,65 @@
|
|
|
1
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
7
|
-
|
|
8
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
9
|
-
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
const _excluded = ["id", "element", "className", "children", "tooltip", "omitClass", "innerRef", "targetBlankTitle"];
|
|
10
4
|
import React from 'react';
|
|
11
|
-
import PropTypes from 'prop-types';
|
|
12
5
|
import classnames from 'classnames';
|
|
13
|
-
import { spacingPropTypes } from '../components/space/SpacingHelper';
|
|
14
6
|
import E from './Element';
|
|
15
7
|
import Context from '../shared/Context';
|
|
16
|
-
import { makeUniqueId
|
|
8
|
+
import { makeUniqueId } from '../shared/component-helper';
|
|
17
9
|
import Tooltip from '../components/tooltip/Tooltip';
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
inner_ref: ref
|
|
21
|
-
}, props));
|
|
22
|
-
});
|
|
23
|
-
process.env.NODE_ENV !== "production" ? Anchor.propTypes = _objectSpread(_objectSpread({}, spacingPropTypes), {}, {
|
|
24
|
-
element: PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.node]),
|
|
25
|
-
href: PropTypes.string,
|
|
26
|
-
to: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.func]),
|
|
27
|
-
omitClass: PropTypes.bool,
|
|
28
|
-
target_blank_title: PropTypes.string,
|
|
29
|
-
target: PropTypes.string,
|
|
30
|
-
className: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.array]),
|
|
31
|
-
tooltip: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
|
|
32
|
-
children: PropTypes.node,
|
|
33
|
-
skeleton: PropTypes.oneOfType([PropTypes.string, PropTypes.bool])
|
|
34
|
-
}) : void 0;
|
|
35
|
-
Anchor.defaultProps = {
|
|
36
|
-
element: null,
|
|
37
|
-
href: null,
|
|
38
|
-
to: null,
|
|
39
|
-
omitClass: null,
|
|
40
|
-
target_blank_title: null,
|
|
41
|
-
target: null,
|
|
42
|
-
className: null,
|
|
43
|
-
tooltip: null,
|
|
44
|
-
children: null,
|
|
45
|
-
skeleton: null
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
class AnchorInstance extends React.PureComponent {
|
|
49
|
-
constructor(props) {
|
|
50
|
-
super(props);
|
|
10
|
+
import usePropsWithContext from '../shared/hooks/usePropsWithContext';
|
|
11
|
+
const defaultProps = {};
|
|
51
12
|
|
|
52
|
-
|
|
13
|
+
function AnchorInstance(localProps) {
|
|
14
|
+
const context = React.useContext(Context);
|
|
15
|
+
const allProps = usePropsWithContext(localProps, defaultProps, {
|
|
16
|
+
skeleton: context === null || context === void 0 ? void 0 : context.skeleton
|
|
17
|
+
}, context === null || context === void 0 ? void 0 : context.getTranslation(localProps).Anchor, context === null || context === void 0 ? void 0 : context.Anchor);
|
|
53
18
|
|
|
54
|
-
|
|
55
|
-
|
|
19
|
+
if (typeof allProps.inner_ref !== 'undefined') {
|
|
20
|
+
allProps.innerRef = allProps.inner_ref;
|
|
21
|
+
delete allProps.inner_ref;
|
|
56
22
|
}
|
|
57
23
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}, this.context.getTranslation(this.props).Anchor, this.context.Anchor);
|
|
62
|
-
|
|
63
|
-
const {
|
|
64
|
-
element,
|
|
65
|
-
className,
|
|
66
|
-
children,
|
|
67
|
-
tooltip,
|
|
68
|
-
omitClass,
|
|
69
|
-
inner_ref
|
|
70
|
-
} = props,
|
|
71
|
-
attributes = _objectWithoutProperties(props, _excluded);
|
|
72
|
-
|
|
73
|
-
const showTooltip = props.target === '_blank' && !props.title;
|
|
74
|
-
attributes.className = classnames(className, omitClass !== true && 'dnb-anchor', props.target === '_blank' && typeof children !== 'string' && 'dnb-anchor--no-icon');
|
|
75
|
-
return React.createElement(React.Fragment, null, React.createElement(E, _extends({
|
|
76
|
-
is: element || 'a'
|
|
77
|
-
}, attributes, {
|
|
78
|
-
inner_ref: this._ref
|
|
79
|
-
}), children), showTooltip && React.createElement(Tooltip, {
|
|
80
|
-
show_delay: 100,
|
|
81
|
-
id: this._id + '-tooltip',
|
|
82
|
-
target_element: this._ref,
|
|
83
|
-
tooltip: tooltip
|
|
84
|
-
}, props.title || props.target_blank_title));
|
|
24
|
+
if (typeof allProps.target_blank_title !== 'undefined') {
|
|
25
|
+
allProps.targetBlankTitle = allProps.target_blank_title;
|
|
26
|
+
delete allProps.target_blank_title;
|
|
85
27
|
}
|
|
86
28
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
29
|
+
if (!allProps.innerRef) {
|
|
30
|
+
allProps.innerRef = React.createRef();
|
|
31
|
+
}
|
|
90
32
|
|
|
91
|
-
|
|
33
|
+
const {
|
|
34
|
+
id,
|
|
35
|
+
element,
|
|
36
|
+
className,
|
|
37
|
+
children,
|
|
38
|
+
tooltip,
|
|
39
|
+
omitClass,
|
|
40
|
+
innerRef,
|
|
41
|
+
targetBlankTitle
|
|
42
|
+
} = allProps,
|
|
43
|
+
attributes = _objectWithoutProperties(allProps, _excluded);
|
|
92
44
|
|
|
93
|
-
|
|
45
|
+
const internalId = id || 'id' + makeUniqueId();
|
|
46
|
+
const showTooltip = allProps.target === '_blank' && !allProps.title;
|
|
47
|
+
return React.createElement(React.Fragment, null, React.createElement(E, _extends({
|
|
48
|
+
is: element || 'a',
|
|
49
|
+
className: classnames(className, omitClass !== true && 'dnb-anchor', allProps.target === '_blank' && typeof children !== 'string' && 'dnb-anchor--no-icon')
|
|
50
|
+
}, attributes, {
|
|
51
|
+
innerRef: innerRef
|
|
52
|
+
}), children), showTooltip && React.createElement(Tooltip, {
|
|
53
|
+
show_delay: 100,
|
|
54
|
+
id: internalId + '-tooltip',
|
|
55
|
+
target_element: innerRef,
|
|
56
|
+
tooltip: tooltip
|
|
57
|
+
}, allProps.title || targetBlankTitle));
|
|
58
|
+
}
|
|
94
59
|
|
|
95
|
-
|
|
60
|
+
const Anchor = React.forwardRef((props, ref) => {
|
|
61
|
+
return React.createElement(AnchorInstance, _extends({
|
|
62
|
+
inner_ref: ref
|
|
63
|
+
}, props));
|
|
64
|
+
});
|
|
96
65
|
export default Anchor;
|
package/es/elements/Element.d.ts
CHANGED
|
@@ -1,43 +1,26 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export type ElementIs =
|
|
3
|
-
| ((...args: any[]) => any)
|
|
4
|
-
| Object
|
|
5
|
-
| React.ReactNode;
|
|
6
|
-
export type ElementSkeleton = string | boolean;
|
|
7
|
-
export type ElementSpace =
|
|
8
|
-
| string
|
|
9
|
-
| number
|
|
10
|
-
| boolean
|
|
11
|
-
| {
|
|
12
|
-
top?: string | number | boolean;
|
|
13
|
-
right?: string | number | boolean;
|
|
14
|
-
bottom?: string | number | boolean;
|
|
15
|
-
left?: string | number | boolean;
|
|
16
|
-
};
|
|
17
|
-
export type ElementTop = string | number | boolean;
|
|
18
|
-
export type ElementRight = string | number | boolean;
|
|
19
|
-
export type ElementBottom = string | number | boolean;
|
|
20
|
-
export type ElementLeft = string | number | boolean;
|
|
21
|
-
export type ElementClassName = string | Object | any[];
|
|
22
|
-
export type ElementCss = string | Object;
|
|
23
|
-
|
|
24
1
|
/**
|
|
25
|
-
*
|
|
2
|
+
* This is mainly a Wrapper, to build more easily HTML Elements
|
|
3
|
+
*
|
|
26
4
|
*/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { SkeletonMethods } from '../components/skeleton/SkeletonHelper';
|
|
7
|
+
export declare type ElementProps = {
|
|
8
|
+
is: React.ReactNode;
|
|
9
|
+
skeleton?: boolean;
|
|
10
|
+
skeletonMethod?: SkeletonMethods;
|
|
11
|
+
class?: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
internalClass?: string;
|
|
14
|
+
css?: string;
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
innerRef?: React.ForwardedRef<unknown>;
|
|
17
|
+
/** @deprecated use innerRef instead */
|
|
18
|
+
inner_ref?: React.ForwardedRef<unknown>;
|
|
19
|
+
/** @deprecated use skeletonMethod instead */
|
|
20
|
+
skeleton_method?: SkeletonMethods;
|
|
21
|
+
};
|
|
22
|
+
export declare const defaultProps: {
|
|
23
|
+
skeletonMethod: string;
|
|
24
|
+
};
|
|
25
|
+
declare const Element: React.ForwardRefExoticComponent<ElementProps & React.RefAttributes<unknown>>;
|
|
43
26
|
export default Element;
|
package/es/elements/Element.js
CHANGED
|
@@ -1,81 +1,64 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
-
const _excluded = ["className", "class", "internalClass", "css", "is", "
|
|
5
|
-
|
|
6
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
7
|
-
|
|
8
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
9
|
-
|
|
3
|
+
const _excluded = ["className", "class", "internalClass", "css", "is", "innerRef", "skeleton", "skeletonMethod"];
|
|
10
4
|
import React from 'react';
|
|
11
|
-
import PropTypes from 'prop-types';
|
|
12
5
|
import classnames from 'classnames';
|
|
13
6
|
import Context from '../shared/Context';
|
|
14
|
-
import { validateDOMAttributes
|
|
15
|
-
import {
|
|
7
|
+
import { validateDOMAttributes } from '../shared/component-helper';
|
|
8
|
+
import { createSpacingClasses } from '../components/space/SpacingHelper';
|
|
16
9
|
import { createSkeletonClass, skeletonDOMAttributes } from '../components/skeleton/SkeletonHelper';
|
|
10
|
+
import usePropsWithContext from '../shared/hooks/usePropsWithContext';
|
|
11
|
+
import { includeValidProps } from '../components/form-row/FormRowHelpers';
|
|
12
|
+
export const defaultProps = {
|
|
13
|
+
skeletonMethod: 'font'
|
|
14
|
+
};
|
|
17
15
|
const Element = React.forwardRef((props, ref) => {
|
|
18
16
|
return React.createElement(ElementInstance, _extends({
|
|
19
|
-
|
|
17
|
+
innerRef: ref
|
|
20
18
|
}, props));
|
|
21
19
|
});
|
|
22
|
-
process.env.NODE_ENV !== "production" ? Element.propTypes = _objectSpread(_objectSpread({
|
|
23
|
-
is: PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.node]),
|
|
24
|
-
skeleton: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
25
|
-
skeleton_method: PropTypes.string
|
|
26
|
-
}, spacingPropTypes), {}, {
|
|
27
|
-
className: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.array]),
|
|
28
|
-
class: PropTypes.string,
|
|
29
|
-
internalClass: PropTypes.string,
|
|
30
|
-
css: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
|
|
31
|
-
children: PropTypes.node
|
|
32
|
-
}) : void 0;
|
|
33
|
-
Element.defaultProps = {
|
|
34
|
-
is: null,
|
|
35
|
-
skeleton: null,
|
|
36
|
-
skeleton_method: 'font',
|
|
37
|
-
className: null,
|
|
38
|
-
class: null,
|
|
39
|
-
internalClass: null,
|
|
40
|
-
css: null,
|
|
41
|
-
children: null
|
|
42
|
-
};
|
|
43
20
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
21
|
+
function ElementInstance(localProps) {
|
|
22
|
+
const context = React.useContext(Context);
|
|
23
|
+
const props = usePropsWithContext(localProps, defaultProps, {
|
|
24
|
+
skeleton: context === null || context === void 0 ? void 0 : context.skeleton
|
|
25
|
+
}, includeValidProps(context === null || context === void 0 ? void 0 : context.FormRow));
|
|
49
26
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
} = props,
|
|
60
|
-
rest = _objectWithoutProperties(props, _excluded);
|
|
27
|
+
if (typeof props.inner_ref !== 'undefined') {
|
|
28
|
+
props.innerRef = props.inner_ref;
|
|
29
|
+
delete props.inner_ref;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (typeof props.skeleton_method !== 'undefined') {
|
|
33
|
+
props.skeletonMethod = props.skeleton_method;
|
|
34
|
+
delete props.skeleton_method;
|
|
35
|
+
}
|
|
61
36
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
37
|
+
const {
|
|
38
|
+
className,
|
|
39
|
+
class: _className,
|
|
40
|
+
internalClass,
|
|
41
|
+
css,
|
|
42
|
+
is,
|
|
43
|
+
innerRef,
|
|
44
|
+
skeleton,
|
|
45
|
+
skeletonMethod
|
|
46
|
+
} = props,
|
|
47
|
+
attributes = _objectWithoutProperties(props, _excluded);
|
|
66
48
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
49
|
+
const Tag = is;
|
|
50
|
+
const tagClass = internalClass || (typeof Tag === 'string' ? `dnb-${Tag}` : '');
|
|
51
|
+
const internalClassName = classnames(className, _className, css, createSkeletonClass(skeletonMethod, skeleton, context), createSpacingClasses(attributes, typeof Tag === 'string' ? `dnb-${Tag}` : null), !new RegExp(`${tagClass}(\\s|$)`).test(String(className)) && tagClass);
|
|
52
|
+
validateDOMAttributes(null, attributes);
|
|
53
|
+
skeletonDOMAttributes(attributes, skeleton, context);
|
|
70
54
|
|
|
71
|
-
|
|
55
|
+
if (typeof Tag !== 'function' && innerRef) {
|
|
56
|
+
attributes.ref = innerRef;
|
|
72
57
|
}
|
|
73
58
|
|
|
59
|
+
return React.createElement(Tag, _extends({
|
|
60
|
+
className: internalClassName
|
|
61
|
+
}, attributes));
|
|
74
62
|
}
|
|
75
63
|
|
|
76
|
-
_defineProperty(ElementInstance, "contextType", Context);
|
|
77
|
-
|
|
78
|
-
_defineProperty(ElementInstance, "defaultProps", Element.defaultProps);
|
|
79
|
-
|
|
80
|
-
process.env.NODE_ENV !== "production" ? ElementInstance.propTypes = Element.propTypes : void 0;
|
|
81
64
|
export default Element;
|
package/es/elements/Link.d.ts
CHANGED
|
@@ -1,2 +1,19 @@
|
|
|
1
1
|
export default Link;
|
|
2
|
-
declare const Link: import("react").
|
|
2
|
+
declare const Link: import("react").ForwardRefExoticComponent<{
|
|
3
|
+
element?: import("react").ReactNode;
|
|
4
|
+
href?: string;
|
|
5
|
+
to?: string;
|
|
6
|
+
targetBlankTitle?: string;
|
|
7
|
+
target?: string;
|
|
8
|
+
tooltip?: import("react").ReactNode;
|
|
9
|
+
skeleton?: boolean;
|
|
10
|
+
className?: string;
|
|
11
|
+
children?: import("react").ReactNode;
|
|
12
|
+
omitClass?: boolean;
|
|
13
|
+
innerRef?: import("react").ForwardedRef<unknown>;
|
|
14
|
+
id?: string;
|
|
15
|
+
title?: string;
|
|
16
|
+
lang?: string;
|
|
17
|
+
inner_ref?: import("react").ForwardedRef<unknown>;
|
|
18
|
+
target_blank_title?: string;
|
|
19
|
+
} & Partial<Omit<HTMLAnchorElement, "children">> & import("../shared/interfaces").ISpacingProps & import("react").RefAttributes<unknown>>;
|
package/es/elements/lib.d.ts
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
export function getElements(): {
|
|
2
|
-
Anchor: import("react").
|
|
2
|
+
Anchor: import("react").ForwardRefExoticComponent<{
|
|
3
|
+
element?: import("react").ReactNode;
|
|
4
|
+
href?: string;
|
|
5
|
+
to?: string;
|
|
6
|
+
targetBlankTitle?: string;
|
|
7
|
+
target?: string;
|
|
8
|
+
tooltip?: import("react").ReactNode;
|
|
9
|
+
skeleton?: boolean;
|
|
10
|
+
className?: string;
|
|
11
|
+
children?: import("react").ReactNode;
|
|
12
|
+
omitClass?: boolean;
|
|
13
|
+
innerRef?: import("react").ForwardedRef<unknown>;
|
|
14
|
+
id?: string;
|
|
15
|
+
title?: string;
|
|
16
|
+
lang?: string;
|
|
17
|
+
inner_ref?: import("react").ForwardedRef<unknown>;
|
|
18
|
+
target_blank_title?: string;
|
|
19
|
+
} & Partial<Omit<HTMLAnchorElement, "children">> & import("../shared/interfaces").ISpacingProps & import("react").RefAttributes<unknown>>;
|
|
3
20
|
Blockquote: import("react").FC<import("./Blockquote").BlockquoteProps>;
|
|
4
21
|
Code: import("react").FC<import("./Code").CodeProps>;
|
|
5
22
|
Dd: import("react").FC<import("./Dd").DdProps>;
|
|
@@ -24,7 +41,24 @@ export function getElements(): {
|
|
|
24
41
|
tagName: string;
|
|
25
42
|
};
|
|
26
43
|
Li: import("react").FC<import("./Li").LiProps>;
|
|
27
|
-
Link: import("react").
|
|
44
|
+
Link: import("react").ForwardRefExoticComponent<{
|
|
45
|
+
element?: import("react").ReactNode;
|
|
46
|
+
href?: string;
|
|
47
|
+
to?: string;
|
|
48
|
+
targetBlankTitle?: string;
|
|
49
|
+
target?: string;
|
|
50
|
+
tooltip?: import("react").ReactNode;
|
|
51
|
+
skeleton?: boolean;
|
|
52
|
+
className?: string;
|
|
53
|
+
children?: import("react").ReactNode;
|
|
54
|
+
omitClass?: boolean;
|
|
55
|
+
innerRef?: import("react").ForwardedRef<unknown>;
|
|
56
|
+
id?: string;
|
|
57
|
+
title?: string;
|
|
58
|
+
lang?: string;
|
|
59
|
+
inner_ref?: import("react").ForwardedRef<unknown>;
|
|
60
|
+
target_blank_title?: string;
|
|
61
|
+
} & Partial<Omit<HTMLAnchorElement, "children">> & import("../shared/interfaces").ISpacingProps & import("react").RefAttributes<unknown>>;
|
|
28
62
|
Ol: import("react").FC<import("./Ol").OlProps>;
|
|
29
63
|
P: import("react").FC<import("./P").PProps>;
|
|
30
64
|
Paragraph: {
|
package/es/shared/Context.d.ts
CHANGED
|
@@ -18,8 +18,10 @@ import type { TimelineItemProps } from '../components/timeline/TimelineItem';
|
|
|
18
18
|
import type { VisuallyHiddenProps } from '../components/visually-hidden/VisuallyHidden';
|
|
19
19
|
import type { DrawerProps } from '../components/drawer/types';
|
|
20
20
|
import type { DialogProps } from '../components/dialog/types';
|
|
21
|
+
import type { AnchorProps } from '../elements/Anchor';
|
|
21
22
|
export declare type ContextProps = {
|
|
22
23
|
Button?: Partial<ButtonProps>;
|
|
24
|
+
Anchor?: Partial<AnchorProps>;
|
|
23
25
|
Avatar?: Partial<AvatarProps>;
|
|
24
26
|
AvatarGroup?: Partial<AvatarGroupProps>;
|
|
25
27
|
Badge?: Partial<BadgeProps>;
|
package/es/shared/Eufemia.js
CHANGED
|
@@ -9,7 +9,8 @@ export declare type SuffixProps = {
|
|
|
9
9
|
className: string;
|
|
10
10
|
children: SuffixChildren;
|
|
11
11
|
context: Record<string, unknown>;
|
|
12
|
+
skeleton?: boolean;
|
|
12
13
|
};
|
|
13
|
-
declare const Suffix: ({ className, children, context, ...props }: SuffixProps & React.HTMLAttributes<HTMLSpanElement>) => JSX.Element;
|
|
14
|
+
declare const Suffix: ({ className, children, context, skeleton, ...props }: SuffixProps & React.HTMLAttributes<HTMLSpanElement>) => JSX.Element;
|
|
14
15
|
export { SuffixContext };
|
|
15
16
|
export default Suffix;
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
const _excluded = ["className", "children", "context"];
|
|
3
|
+
const _excluded = ["className", "children", "context", "skeleton"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import classnames from 'classnames';
|
|
6
|
+
import { createSkeletonClass } from '../../components/skeleton/SkeletonHelper';
|
|
6
7
|
const SuffixContext = React.createContext(null);
|
|
7
8
|
|
|
8
9
|
const Suffix = _ref => {
|
|
9
10
|
let {
|
|
10
11
|
className,
|
|
11
12
|
children,
|
|
12
|
-
context
|
|
13
|
+
context,
|
|
14
|
+
skeleton
|
|
13
15
|
} = _ref,
|
|
14
16
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
15
17
|
|
|
16
18
|
const content = React.createElement("span", _extends({
|
|
17
|
-
className: classnames('dnb-suffix', className)
|
|
19
|
+
className: classnames('dnb-suffix', className, !React.isValidElement(children) && createSkeletonClass('font', skeleton, context))
|
|
18
20
|
}, props), children);
|
|
19
21
|
|
|
20
22
|
if (typeof children !== 'string' && context) {
|
|
@@ -32,7 +32,7 @@ export declare function classWithCamelCaseProps<TBase extends React.ComponentCla
|
|
|
32
32
|
*/
|
|
33
33
|
export declare type ToCamelCasePartial<T> = Partial<ToCamelCase<T>>;
|
|
34
34
|
export declare type ToCamelCase<T> = T extends object ? {
|
|
35
|
-
[K in keyof T as ConvertSnakeToCamelCase<K & string>]: ToCamelCase<T[K]>;
|
|
35
|
+
[K in keyof T as ConvertSnakeToCamelCase<K & string>]: T[K] | ToCamelCase<T[K]>;
|
|
36
36
|
} : T;
|
|
37
37
|
export declare type IncludeCamelCase<T> = Partial<T> & ToCamelCasePartial<T>;
|
|
38
38
|
declare type ConvertSnakeToCamelCase<S extends string> = S extends `${infer T}_${infer U}` ? `${T}${Capitalize<ConvertSnakeToCamelCase<U>>}` : S;
|