@tedi-design-system/react 19.1.0-rc.14 → 19.1.0-rc.15
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-stats.html +1 -1
- package/index.css +1 -1
- package/package.json +1 -1
- package/src/community/components/map-components/base-map-selection/base-map-selection.cjs.js +1 -1
- package/src/community/components/map-components/base-map-selection/base-map-selection.es.js +19 -19
- package/src/community/components/map-components/map-button/map-button.cjs.js +1 -1
- package/src/community/components/map-components/map-button/map-button.d.ts +10 -1
- package/src/community/components/map-components/map-button/map-button.es.js +31 -29
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tedi-design-system/react",
|
|
3
|
-
"version": "19.1.0-rc.
|
|
3
|
+
"version": "19.1.0-rc.15",
|
|
4
4
|
"description": "TEDI Design System React component library — accessible, reusable UI components. Docs & live examples: https://storybook.tedi.ee/react/rc/",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
package/src/community/components/map-components/base-map-selection/base-map-selection.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),C=require("../../../../../external/classnames/index.cjs.js"),h=require("react"),I=require("../../../../tedi/components/buttons/button/button.cjs.js"),P=require("../../../../tedi/components/form/field/field.cjs.js"),R=require("../../../../tedi/components/form/input-group/input-group.cjs.js"),k=require("../../../../tedi/components/form/slider/slider.cjs.js"),G=require("../map-button/map-button.cjs.js"),x=require("./base-map-option.cjs.js"),t=require("./base-map-selection.module.scss.cjs.js"),$=require("../../../../tedi/providers/label-provider/use-labels.cjs.js"),f=require("../../../../tedi/helpers/hooks/use-breakpoint.cjs.js"),r=require("../../../../tedi/components/overlays/popover/popover.cjs.js"),z=require("../../../../tedi/components/form/input-group/components/input/input.cjs.js"),D=require("../../../../tedi/components/form/input-group/components/suffix/suffix.cjs.js"),o=s=>{const n=Number(s);return Number.isNaN(n)?0:Math.min(100,Math.max(0,n))};function l(s){const{title:n,content:y,children:j,multiple:g=!1,showTransparency:q=!1,transparency:c,defaultTransparency:M,onTransparencyChange:i,id:a}=s,{getLabel:B}=$.useLabels(),S=f.isBreakpointBelow(f.default(),"md"),[v,_]=h.useState(!1),u=B("baseMapSelection.transparency"),d=c!==void 0,[N,L]=h.useState(()=>o(M??0)),p=o(d?c:N),m=w=>{const b=o(w);d||L(b),i==null||i(b)},O=C.default(t.default["tedi-base-map-selection__wrapper"],t.default["tedi-base-map-selection--button"],g&&t.default["tedi-base-map-selection--multiple"]),T=S?e.jsx(G.MapButton,{id:a,icon:"map",showDropdownIndicator:!0,hideLabel:!0,iconSize:24,tooltipContent:null,selected:v,children:n}):e.jsxs(I.Button,{noStyle:!0,id:a,className:O,children:[e.jsx("div",{className:t.default["tedi-base-map-selection__content"],"aria-hidden":!0,children:y}),e.jsx("div",{className:t.default["tedi-base-map-selection__title"],children:n})]});return e.jsxs(r.Popover,{placement:"top-start",onToggle:_,children:[e.jsx(r.Popover.Trigger,{children:T}),e.jsxs(r.Popover.Content,{width:"medium",children:[e.jsx("div",{className:t.default["tedi-base-map-selection__options"],children:j}),q&&e.jsx("div",{className:t.default["tedi-base-map-selection__transparency"],children:e.jsx(k.Slider,{"aria-label":u,min:0,max:100,value:p,onChange:m,minLabel:"0%",maxLabel:"100%",addonRight:e.jsx("div",{className:t.default["tedi-base-map-selection__transparency-field"],children:e.jsxs(R.InputGroupBase,{id:`${a}-transparency`,label:u,hideLabel:!0,children:[e.jsx(z.Input,{children:e.jsx(P.Field,{type:"number",id:`${a}-transparency`,value:String(p),onChange:m})}),e.jsx(D.Suffix,{children:"%"})]})})})})]})]})}l.Option=x.BaseMapOption;l.displayName="BaseMapSelection";exports.BaseMapOption=x.BaseMapOption;exports.BaseMapSelection=l;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import O from "../../../../../external/classnames/index.es.js";
|
|
3
3
|
import { useState as h } from "react";
|
|
4
4
|
import { Button as j } from "../../../../tedi/components/buttons/button/button.es.js";
|
|
5
5
|
import { Field as k } from "../../../../tedi/components/form/field/field.es.js";
|
|
6
6
|
import { InputGroupBase as $ } from "../../../../tedi/components/form/input-group/input-group.es.js";
|
|
7
|
-
import { Slider as
|
|
8
|
-
import { MapButton as
|
|
9
|
-
import { BaseMapOption as
|
|
7
|
+
import { Slider as z } from "../../../../tedi/components/form/slider/slider.es.js";
|
|
8
|
+
import { MapButton as D } from "../map-button/map-button.es.js";
|
|
9
|
+
import { BaseMapOption as E } from "./base-map-option.es.js";
|
|
10
10
|
import t from "./base-map-selection.module.scss.es.js";
|
|
11
|
-
import { useLabels as
|
|
12
|
-
import
|
|
11
|
+
import { useLabels as F } from "../../../../tedi/providers/label-provider/use-labels.es.js";
|
|
12
|
+
import G, { isBreakpointBelow as P } from "../../../../tedi/helpers/hooks/use-breakpoint.es.js";
|
|
13
13
|
import { Popover as s } from "../../../../tedi/components/overlays/popover/popover.es.js";
|
|
14
|
-
import { Input as
|
|
15
|
-
import { Suffix as
|
|
14
|
+
import { Input as R } from "../../../../tedi/components/form/input-group/components/input/input.es.js";
|
|
15
|
+
import { Suffix as U } from "../../../../tedi/components/form/input-group/components/suffix/suffix.es.js";
|
|
16
16
|
const l = (i) => {
|
|
17
17
|
const n = Number(i);
|
|
18
18
|
return Number.isNaN(n) ? 0 : Math.min(100, Math.max(0, n));
|
|
@@ -28,25 +28,25 @@ function b(i) {
|
|
|
28
28
|
defaultTransparency: B,
|
|
29
29
|
onTransparencyChange: o,
|
|
30
30
|
id: a
|
|
31
|
-
} = i, { getLabel: v } =
|
|
31
|
+
} = i, { getLabel: v } = F(), x = P(G(), "md"), [M, S] = h(!1), p = v("baseMapSelection.transparency"), m = c !== void 0, [L, T] = h(
|
|
32
32
|
() => l(B ?? 0)
|
|
33
|
-
), d = l(m ? c : L), u = (
|
|
34
|
-
const f = l(
|
|
33
|
+
), d = l(m ? c : L), u = (I) => {
|
|
34
|
+
const f = l(I);
|
|
35
35
|
m || T(f), o == null || o(f);
|
|
36
|
-
},
|
|
36
|
+
}, w = O(
|
|
37
37
|
t["tedi-base-map-selection__wrapper"],
|
|
38
38
|
t["tedi-base-map-selection--button"],
|
|
39
39
|
N && t["tedi-base-map-selection--multiple"]
|
|
40
|
-
),
|
|
40
|
+
), C = x ? /* @__PURE__ */ e(D, { id: a, icon: "map", showDropdownIndicator: !0, hideLabel: !0, iconSize: 24, tooltipContent: null, selected: M, children: n }) : /* @__PURE__ */ r(j, { noStyle: !0, id: a, className: w, children: [
|
|
41
41
|
/* @__PURE__ */ e("div", { className: t["tedi-base-map-selection__content"], "aria-hidden": !0, children: y }),
|
|
42
42
|
/* @__PURE__ */ e("div", { className: t["tedi-base-map-selection__title"], children: n })
|
|
43
43
|
] });
|
|
44
44
|
return /* @__PURE__ */ r(s, { placement: "top-start", onToggle: S, children: [
|
|
45
|
-
/* @__PURE__ */ e(s.Trigger, { children:
|
|
45
|
+
/* @__PURE__ */ e(s.Trigger, { children: C }),
|
|
46
46
|
/* @__PURE__ */ r(s.Content, { width: "medium", children: [
|
|
47
47
|
/* @__PURE__ */ e("div", { className: t["tedi-base-map-selection__options"], children: g }),
|
|
48
48
|
_ && /* @__PURE__ */ e("div", { className: t["tedi-base-map-selection__transparency"], children: /* @__PURE__ */ e(
|
|
49
|
-
|
|
49
|
+
z,
|
|
50
50
|
{
|
|
51
51
|
"aria-label": p,
|
|
52
52
|
min: 0,
|
|
@@ -56,7 +56,7 @@ function b(i) {
|
|
|
56
56
|
minLabel: "0%",
|
|
57
57
|
maxLabel: "100%",
|
|
58
58
|
addonRight: /* @__PURE__ */ e("div", { className: t["tedi-base-map-selection__transparency-field"], children: /* @__PURE__ */ r($, { id: `${a}-transparency`, label: p, hideLabel: !0, children: [
|
|
59
|
-
/* @__PURE__ */ e(
|
|
59
|
+
/* @__PURE__ */ e(R, { children: /* @__PURE__ */ e(
|
|
60
60
|
k,
|
|
61
61
|
{
|
|
62
62
|
type: "number",
|
|
@@ -65,16 +65,16 @@ function b(i) {
|
|
|
65
65
|
onChange: u
|
|
66
66
|
}
|
|
67
67
|
) }),
|
|
68
|
-
/* @__PURE__ */ e(
|
|
68
|
+
/* @__PURE__ */ e(U, { children: "%" })
|
|
69
69
|
] }) })
|
|
70
70
|
}
|
|
71
71
|
) })
|
|
72
72
|
] })
|
|
73
73
|
] });
|
|
74
74
|
}
|
|
75
|
-
b.Option =
|
|
75
|
+
b.Option = E;
|
|
76
76
|
b.displayName = "BaseMapSelection";
|
|
77
77
|
export {
|
|
78
|
-
|
|
78
|
+
E as BaseMapOption,
|
|
79
79
|
b as BaseMapSelection
|
|
80
80
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),b=require("../../../../../external/classnames/index.cjs.js"),h=require("react"),y=require("../../../../tedi/components/base/icon/icon.cjs.js"),O=require("../../../../tedi/components/loaders/spinner/spinner.cjs.js"),A=require("../../../../tedi/components/buttons/button/button.cjs.js"),l=require("../map-dropdown/map-dropdown.cjs.js"),t=require("./map-button.module.scss.cjs.js"),d=require("../../../../tedi/components/overlays/tooltip/tooltip.cjs.js"),u=h.forwardRef((x,j)=>{const{size:n="default",icon:c,selected:g=!1,className:w,children:i,hideLabel:p=!1,tooltipContent:m=i,dropdownItems:s,showDropdownIndicator:v=!1,isActive:q,isHovered:D,underline:M,isLoading:a,iconSize:f,..._}=x,[S,B]=h.useState(!1),C=g||S,N=b.default(t.default["tedi-map-button"],t.default[`tedi-map-button--${n}`],C&&t.default["tedi-map-button--selected"],(s||v)&&t.default["tedi-map-button--dropdown"],q&&t.default["tedi-map-button--is-active"],D&&t.default["tedi-map-button--is-hovered"],M&&t.default["tedi-map-button--underline"],a&&t.default["tedi-map-button--loading"],w),T=()=>f||(n==="small"?24:18),z=e.jsxs(e.Fragment,{children:[a?e.jsx(O.Spinner,{size:n==="small"?16:18,className:t.default["tedi-map-button__icon"]}):c&&e.jsx(y.Icon,{name:c,className:t.default["tedi-map-button__icon"],size:T()}),p?e.jsx("span",{className:"sr-only",children:i}):e.jsx("div",{className:b.default(t.default["tedi-map-button__text"]),children:i})]}),r=e.jsx(A.Button,{noStyle:!0,isLoading:a,className:N,size:n,..._,ref:j,children:z}),I=p&&m?e.jsxs(d.Tooltip,{placement:"right",children:[e.jsx(d.Tooltip.Trigger,{children:r}),e.jsx(d.Tooltip.Content,{children:m})]}):r;return s?e.jsxs(l.MapDropdown,{onOpenChange:B,placement:"right-start",children:[e.jsx(l.MapDropdown.Trigger,{children:r}),e.jsx(l.MapDropdown.Content,{items:s.map(o=>({children:o.children,onClick:o.onClick,isActive:o.isActive,isDisabled:o.isDisabled}))})]}):I});u.displayName="MapButton";exports.MapButton=u;exports.default=u;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ButtonProps } from '../../../../tedi';
|
|
1
|
+
import { ButtonProps, IconSize } from '../../../../tedi';
|
|
2
2
|
import { MapDropdownItem } from '../map-dropdown/map-dropdown';
|
|
3
3
|
/**
|
|
4
4
|
* Button props that don't apply to MapButton because it renders `<Button noStyle>` with its own
|
|
@@ -37,6 +37,15 @@ export interface MapButtonProps extends Omit<ButtonProps, OmittedButtonProps> {
|
|
|
37
37
|
* When provided, the button can toggle a dropdown menu.
|
|
38
38
|
*/
|
|
39
39
|
dropdownItems?: MapDropdownItem[];
|
|
40
|
+
/**
|
|
41
|
+
* Renders the dropdown indicator arrow in the bottom-right corner without wiring up a dropdown.
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
showDropdownIndicator?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Size of the icon displayed on the button.
|
|
47
|
+
*/
|
|
48
|
+
iconSize?: IconSize;
|
|
40
49
|
}
|
|
41
50
|
export declare const MapButton: import('react').ForwardRefExoticComponent<Omit<MapButtonProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
|
|
42
51
|
export default MapButton;
|
|
@@ -1,45 +1,47 @@
|
|
|
1
|
-
import { jsxs as l, Fragment as
|
|
1
|
+
import { jsxs as l, Fragment as A, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import b from "../../../../../external/classnames/index.es.js";
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { Icon as
|
|
5
|
-
import { Spinner as
|
|
6
|
-
import { Button as
|
|
3
|
+
import { forwardRef as O, useState as j } from "react";
|
|
4
|
+
import { Icon as k } from "../../../../tedi/components/base/icon/icon.es.js";
|
|
5
|
+
import { Spinner as E } from "../../../../tedi/components/loaders/spinner/spinner.es.js";
|
|
6
|
+
import { Button as L } from "../../../../tedi/components/buttons/button/button.es.js";
|
|
7
7
|
import { MapDropdown as d } from "../map-dropdown/map-dropdown.es.js";
|
|
8
8
|
import t from "./map-button.module.scss.es.js";
|
|
9
9
|
import { Tooltip as m } from "../../../../tedi/components/overlays/tooltip/tooltip.es.js";
|
|
10
|
-
const
|
|
10
|
+
const F = O((h, g) => {
|
|
11
11
|
const {
|
|
12
12
|
size: o = "default",
|
|
13
|
-
icon:
|
|
14
|
-
selected:
|
|
15
|
-
className:
|
|
13
|
+
icon: c,
|
|
14
|
+
selected: v = !1,
|
|
15
|
+
className: w,
|
|
16
16
|
children: i,
|
|
17
|
-
hideLabel:
|
|
17
|
+
hideLabel: p = !1,
|
|
18
18
|
tooltipContent: u = i,
|
|
19
19
|
dropdownItems: s,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
showDropdownIndicator: N = !1,
|
|
21
|
+
isActive: C,
|
|
22
|
+
isHovered: D,
|
|
23
|
+
underline: S,
|
|
23
24
|
isLoading: r,
|
|
25
|
+
iconSize: f,
|
|
24
26
|
..._
|
|
25
|
-
} =
|
|
27
|
+
} = h, [z, B] = j(!1), I = v || z, x = b(
|
|
26
28
|
t["tedi-map-button"],
|
|
27
29
|
t[`tedi-map-button--${o}`],
|
|
28
|
-
|
|
29
|
-
s && t["tedi-map-button--dropdown"],
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
I && t["tedi-map-button--selected"],
|
|
31
|
+
(s || N) && t["tedi-map-button--dropdown"],
|
|
32
|
+
C && t["tedi-map-button--is-active"],
|
|
33
|
+
D && t["tedi-map-button--is-hovered"],
|
|
34
|
+
S && t["tedi-map-button--underline"],
|
|
33
35
|
r && t["tedi-map-button--loading"],
|
|
34
|
-
|
|
35
|
-
), M = /* @__PURE__ */ l(
|
|
36
|
-
r ? /* @__PURE__ */ e(
|
|
37
|
-
|
|
38
|
-
] }), a = /* @__PURE__ */ e(
|
|
36
|
+
w
|
|
37
|
+
), y = () => f || (o === "small" ? 24 : 18), M = /* @__PURE__ */ l(A, { children: [
|
|
38
|
+
r ? /* @__PURE__ */ e(E, { size: o === "small" ? 16 : 18, className: t["tedi-map-button__icon"] }) : c && /* @__PURE__ */ e(k, { name: c, className: t["tedi-map-button__icon"], size: y() }),
|
|
39
|
+
p ? /* @__PURE__ */ e("span", { className: "sr-only", children: i }) : /* @__PURE__ */ e("div", { className: b(t["tedi-map-button__text"]), children: i })
|
|
40
|
+
] }), a = /* @__PURE__ */ e(L, { noStyle: !0, isLoading: r, className: x, size: o, ..._, ref: g, children: M }), T = p && u ? /* @__PURE__ */ l(m, { placement: "right", children: [
|
|
39
41
|
/* @__PURE__ */ e(m.Trigger, { children: a }),
|
|
40
42
|
/* @__PURE__ */ e(m.Content, { children: u })
|
|
41
43
|
] }) : a;
|
|
42
|
-
return s ? /* @__PURE__ */ l(d, { onOpenChange:
|
|
44
|
+
return s ? /* @__PURE__ */ l(d, { onOpenChange: B, placement: "right-start", children: [
|
|
43
45
|
/* @__PURE__ */ e(d.Trigger, { children: a }),
|
|
44
46
|
/* @__PURE__ */ e(
|
|
45
47
|
d.Content,
|
|
@@ -52,10 +54,10 @@ const k = z((f, h) => {
|
|
|
52
54
|
}))
|
|
53
55
|
}
|
|
54
56
|
)
|
|
55
|
-
] }) :
|
|
57
|
+
] }) : T;
|
|
56
58
|
});
|
|
57
|
-
|
|
59
|
+
F.displayName = "MapButton";
|
|
58
60
|
export {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
F as MapButton,
|
|
62
|
+
F as default
|
|
61
63
|
};
|