@redneckz/wildless-cms-uni-blocks 0.8.6 → 0.8.8
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/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +11 -8
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/ProductTile/ProductTileContent.d.ts +4 -13
- package/bundle/components/StepsBlock/StepsBlockContent.d.ts +6 -4
- package/bundle/components/TextBlock/TextBlockContent.d.ts +3 -2
- package/bundle/model/DefaultListItemType.d.ts +4 -0
- package/bundle/model/RichTextItem.d.ts +8 -0
- package/bundle/ui-kit/BenefitItem/BenefitItemProps.d.ts +4 -13
- package/dist/components/ProductTile/ProductTile.js +1 -2
- package/dist/components/ProductTile/ProductTile.js.map +1 -1
- package/dist/components/ProductTile/ProductTileContent.d.ts +4 -13
- package/dist/components/StepsBlock/StepsBlockContent.d.ts +6 -4
- package/dist/components/TextBlock/TextBlock.js +3 -2
- package/dist/components/TextBlock/TextBlock.js.map +1 -1
- package/dist/components/TextBlock/TextBlockContent.d.ts +3 -2
- package/dist/hooks/useLink.js +7 -3
- package/dist/hooks/useLink.js.map +1 -1
- package/dist/model/DefaultListItemType.d.ts +4 -0
- package/dist/model/DefaultListItemType.js +2 -0
- package/dist/model/DefaultListItemType.js.map +1 -0
- package/dist/model/RichTextItem.d.ts +8 -0
- package/dist/model/RichTextItem.js +2 -0
- package/dist/model/RichTextItem.js.map +1 -0
- package/dist/ui-kit/BenefitItem/BenefitItemProps.d.ts +4 -13
- package/lib/components/ProductTile/ProductTile.js +1 -2
- package/lib/components/ProductTile/ProductTile.js.map +1 -1
- package/lib/components/ProductTile/ProductTileContent.d.ts +4 -13
- package/lib/components/StepsBlock/StepsBlockContent.d.ts +6 -4
- package/lib/components/TextBlock/TextBlock.js +3 -2
- package/lib/components/TextBlock/TextBlock.js.map +1 -1
- package/lib/components/TextBlock/TextBlockContent.d.ts +3 -2
- package/lib/hooks/useLink.js +8 -4
- package/lib/hooks/useLink.js.map +1 -1
- package/lib/model/DefaultListItemType.d.ts +4 -0
- package/lib/model/DefaultListItemType.js +2 -0
- package/lib/model/DefaultListItemType.js.map +1 -0
- package/lib/model/RichTextItem.d.ts +8 -0
- package/lib/model/RichTextItem.js +2 -0
- package/lib/model/RichTextItem.js.map +1 -0
- package/lib/ui-kit/BenefitItem/BenefitItemProps.d.ts +4 -13
- package/mobile/bundle/bundle.umd.js +8 -4
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/ProductTile/ProductTileContent.d.ts +4 -13
- package/mobile/bundle/components/StepsBlock/StepsBlockContent.d.ts +6 -4
- package/mobile/bundle/components/TextBlock/TextBlockContent.d.ts +3 -2
- package/mobile/bundle/model/DefaultListItemType.d.ts +4 -0
- package/mobile/bundle/model/RichTextItem.d.ts +8 -0
- package/mobile/bundle/ui-kit/BenefitItem/BenefitItemProps.d.ts +4 -13
- package/mobile/dist/components/ProductTile/ProductTile.js +1 -2
- package/mobile/dist/components/ProductTile/ProductTile.js.map +1 -1
- package/mobile/dist/components/ProductTile/ProductTileContent.d.ts +4 -13
- package/mobile/dist/components/StepsBlock/StepsBlockContent.d.ts +6 -4
- package/mobile/dist/components/TextBlock/TextBlockContent.d.ts +3 -2
- package/mobile/dist/hooks/useLink.js +7 -3
- package/mobile/dist/hooks/useLink.js.map +1 -1
- package/mobile/dist/model/DefaultListItemType.d.ts +4 -0
- package/mobile/dist/model/DefaultListItemType.js +2 -0
- package/mobile/dist/model/DefaultListItemType.js.map +1 -0
- package/mobile/dist/model/RichTextItem.d.ts +8 -0
- package/mobile/dist/model/RichTextItem.js +2 -0
- package/mobile/dist/model/RichTextItem.js.map +1 -0
- package/mobile/dist/ui-kit/BenefitItem/BenefitItemProps.d.ts +4 -13
- package/mobile/lib/components/ProductTile/ProductTile.js +1 -2
- package/mobile/lib/components/ProductTile/ProductTile.js.map +1 -1
- package/mobile/lib/components/ProductTile/ProductTileContent.d.ts +4 -13
- package/mobile/lib/components/StepsBlock/StepsBlockContent.d.ts +6 -4
- package/mobile/lib/components/TextBlock/TextBlockContent.d.ts +3 -2
- package/mobile/lib/hooks/useLink.js +8 -4
- package/mobile/lib/hooks/useLink.js.map +1 -1
- package/mobile/lib/model/DefaultListItemType.d.ts +4 -0
- package/mobile/lib/model/DefaultListItemType.js +2 -0
- package/mobile/lib/model/DefaultListItemType.js.map +1 -0
- package/mobile/lib/model/RichTextItem.d.ts +8 -0
- package/mobile/lib/model/RichTextItem.js +2 -0
- package/mobile/lib/model/RichTextItem.js.map +1 -0
- package/mobile/lib/ui-kit/BenefitItem/BenefitItemProps.d.ts +4 -13
- package/mobile/src/components/ProductTile/ProductTile.tsx +1 -2
- package/mobile/src/components/ProductTile/ProductTileContent.ts +4 -15
- package/mobile/src/components/StepsBlock/StepsBlockContent.ts +13 -13
- package/mobile/src/components/TextBlock/TextBlock.ui.json +7 -1
- package/mobile/src/components/TextBlock/TextBlockContent.ts +12 -10
- package/mobile/src/hooks/useLink.ts +10 -5
- package/mobile/src/model/DefaultListItemType.ts +4 -0
- package/mobile/src/model/RichTextItem.ts +9 -0
- package/mobile/src/ui-kit/BenefitItem/BenefitItemProps.ts +4 -14
- package/package.json +1 -1
- package/src/components/ProductTile/ProductTile.tsx +1 -2
- package/src/components/ProductTile/ProductTileContent.ts +4 -15
- package/src/components/StepsBlock/StepsBlockContent.ts +13 -13
- package/src/components/TextBlock/TextBlock.tsx +3 -0
- package/src/components/TextBlock/TextBlock.ui.json +7 -1
- package/src/components/TextBlock/TextBlockContent.ts +12 -10
- package/src/hooks/useLink.ts +10 -5
- package/src/model/DefaultListItemType.ts +4 -0
- package/src/model/RichTextItem.ts +9 -0
- package/src/ui-kit/BenefitItem/BenefitItemProps.ts +4 -14
- package/dist/model/BlurVersion.d.ts +0 -0
- package/dist/model/BlurVersion.js +0 -1
- package/dist/model/BlurVersion.js.map +0 -1
- package/lib/model/BlurVersion.d.ts +0 -0
- package/lib/model/BlurVersion.js +0 -1
- package/lib/model/BlurVersion.js.map +0 -1
- package/mobile/dist/model/BlurVersion.d.ts +0 -0
- package/mobile/dist/model/BlurVersion.js +0 -1
- package/mobile/dist/model/BlurVersion.js.map +0 -1
- package/mobile/lib/model/BlurVersion.d.ts +0 -0
- package/mobile/lib/model/BlurVersion.js +0 -1
- package/mobile/lib/model/BlurVersion.js.map +0 -1
- package/mobile/src/model/BlurVersion.ts +0 -0
- package/src/model/BlurVersion.ts +0 -0
package/src/hooks/useLink.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { LinkProps } from '../model/LinkProps';
|
|
2
2
|
import { projectSettings } from '../ProjectSettings';
|
|
3
3
|
import { useBlockRouter } from '../services/BlockRouter/useBlockRouter';
|
|
4
|
-
import { isHash, isLocalURL,
|
|
4
|
+
import { isHash, isLocalURL, joinPath } from '../utils/url';
|
|
5
5
|
import { handlerDecorator } from './handlerDecorator';
|
|
6
6
|
import { useRouter } from './useRouter';
|
|
7
7
|
|
|
@@ -19,14 +19,19 @@ export function useLink(isRemote?: boolean) {
|
|
|
19
19
|
|
|
20
20
|
return <L extends Partial<LinkProps & Clickable>>(props: L): L & Clickable => ({
|
|
21
21
|
...props,
|
|
22
|
-
href:
|
|
23
|
-
projectSettings.BASE_PATH && props.href && !(isRemote || isURL(props.href))
|
|
24
|
-
? joinPath(projectSettings.BASE_PATH, props.href)
|
|
25
|
-
: props.href,
|
|
22
|
+
href: adjustHref(props.href),
|
|
26
23
|
'aria-label': props.text,
|
|
27
24
|
onClick: handlerDecorator(handleHref(props), props),
|
|
28
25
|
});
|
|
29
26
|
|
|
27
|
+
function adjustHref(href: string | undefined) {
|
|
28
|
+
const isRelativeToBase = !isRemote && href?.startsWith('/');
|
|
29
|
+
|
|
30
|
+
return projectSettings.BASE_PATH && href && isRelativeToBase
|
|
31
|
+
? joinPath(projectSettings.BASE_PATH, href)
|
|
32
|
+
: href;
|
|
33
|
+
}
|
|
34
|
+
|
|
30
35
|
function handleHref({ href, target, onClick }: Partial<LinkProps & Clickable>) {
|
|
31
36
|
return (ev?: PreventableEvent) => {
|
|
32
37
|
onClick && onClick(ev);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { BlockVersion } from '../../model/BlockVersion';
|
|
2
|
+
import type { DefaultListItemType } from '../../model/DefaultListItemType';
|
|
2
3
|
import type { DescriptionProps, LabelProps } from '../../model/HeadlineType';
|
|
3
4
|
import type { IconVersion } from '../../model/IconVersion';
|
|
4
5
|
import type { IconProps } from '../../model/Picture';
|
|
5
|
-
import {
|
|
6
|
+
import type { RichTextItem } from '../../model/RichTextItem';
|
|
6
7
|
|
|
7
8
|
export interface BenefitItemCommonProps {
|
|
8
9
|
/** @hidden */
|
|
@@ -18,18 +19,7 @@ export type BenefitItemProps = DescriptionProps & LabelProps & IconProps;
|
|
|
18
19
|
/**
|
|
19
20
|
* @title Стандартный бенефит
|
|
20
21
|
*/
|
|
21
|
-
type DefaultBenefit = BenefitItemProps &
|
|
22
|
-
/** @default default */
|
|
23
|
-
type: 'default';
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* @title Форматированный текст
|
|
28
|
-
*/
|
|
29
|
-
type RichText = RichTextProps & {
|
|
30
|
-
/** @default rte */
|
|
31
|
-
type: 'rte';
|
|
32
|
-
};
|
|
22
|
+
type DefaultBenefit = BenefitItemProps & DefaultListItemType;
|
|
33
23
|
|
|
34
24
|
/**
|
|
35
25
|
* @title Преимущество
|
|
@@ -37,7 +27,7 @@ type RichText = RichTextProps & {
|
|
|
37
27
|
* "type": "default"
|
|
38
28
|
* }
|
|
39
29
|
*/
|
|
40
|
-
export type ComplexBenefitProps = DefaultBenefit |
|
|
30
|
+
export type ComplexBenefitProps = DefaultBenefit | RichTextItem;
|
|
41
31
|
|
|
42
32
|
/**
|
|
43
33
|
* @title Преимущество
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=BlurVersion.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BlurVersion.js","sourceRoot":"","sources":["../../src/model/BlurVersion.ts"],"names":[],"mappings":""}
|
|
File without changes
|
package/lib/model/BlurVersion.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=BlurVersion.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BlurVersion.js","sourceRoot":"","sources":["../../src/model/BlurVersion.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=BlurVersion.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BlurVersion.js","sourceRoot":"","sources":["../../src/model/BlurVersion.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=BlurVersion.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BlurVersion.js","sourceRoot":"","sources":["../../src/model/BlurVersion.ts"],"names":[],"mappings":""}
|
|
File without changes
|
package/src/model/BlurVersion.ts
DELETED
|
File without changes
|