@tedi-design-system/react 18.1.0-rc.3 → 18.1.0-rc.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tedi-design-system/react",
3
- "version": "18.1.0-rc.3",
3
+ "version": "18.1.0-rc.5",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "exports": {
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),v=require("../../../../../external/classnames/index.cjs.js"),e=require("./base-map-selection.module.scss.cjs.js"),l=o=>{const{title:r,content:c,selected:d,onSelect:t,type:n="selection",className:u,id:p,multiple:m,disabled:a}=o,b=()=>{a||t==null||t()},f=i=>{a||(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),t==null||t())},_=v.default(e.default["tedi-base-map-selection__wrapper"],d&&e.default["tedi-base-map-selection--selected"],n&&e.default[`tedi-base-map-selection--${n}`],m&&e.default["tedi-base-map-selection--multiple"],a&&e.default["tedi-base-map-selection--disabled"],u);return s.jsxs("div",{role:"button",tabIndex:a?-1:0,"aria-pressed":!!d,"aria-disabled":a||void 0,onClick:b,onKeyDown:f,className:_,id:p,children:[s.jsx("div",{"aria-hidden":!0,className:e.default["tedi-base-map-selection__content"],children:c}),s.jsx("div",{className:e.default["tedi-base-map-selection__title"],children:r})]})};l.displayName="BaseMapOption";exports.BaseMapOption=l;exports.default=l;
@@ -0,0 +1,51 @@
1
+ import { JSX } from 'react';
2
+ export type BaseMapOptionType = 'button' | 'historical' | 'selection';
3
+ export interface BaseMapOptionProps {
4
+ /**
5
+ * The title displayed within the option.
6
+ */
7
+ title: string;
8
+ /**
9
+ * The main content of the option, typically a thumbnail. Can be any valid React node.
10
+ */
11
+ content: React.ReactNode;
12
+ /**
13
+ * Indicates whether the option is currently selected.
14
+ * Used to apply specific visual styles.
15
+ */
16
+ selected?: boolean;
17
+ /**
18
+ * Callback triggered when the option is clicked
19
+ * or activated via keyboard (Enter or Space).
20
+ */
21
+ onSelect?: () => void;
22
+ /**
23
+ * The type of the option, which controls styling.
24
+ * - `'selection'`: thumbnail with the title rendered below (default)
25
+ * - `'button'`: square thumbnail with the title overlaid
26
+ * - `'historical'`: styled for historical context
27
+ * @default 'selection'
28
+ */
29
+ type?: BaseMapOptionType;
30
+ /**
31
+ * Optional custom class name to apply additional styles.
32
+ */
33
+ className?: string;
34
+ /**
35
+ * HTML `id` attribute to identify the element.
36
+ */
37
+ id: string;
38
+ /**
39
+ * When `true`, renders a "stacked" visual indicating multiple maps.
40
+ */
41
+ multiple?: boolean;
42
+ /**
43
+ * Applies disabled style.
44
+ */
45
+ disabled?: boolean;
46
+ }
47
+ export declare const BaseMapOption: {
48
+ (props: BaseMapOptionProps): JSX.Element;
49
+ displayName: string;
50
+ };
51
+ export default BaseMapOption;
@@ -0,0 +1,39 @@
1
+ import { jsxs as y, jsx as l } from "react/jsx-runtime";
2
+ import h from "../../../../../external/classnames/index.es.js";
3
+ import e from "./base-map-selection.module.scss.es.js";
4
+ const N = (d) => {
5
+ const { title: o, content: r, selected: i, onSelect: t, type: n = "selection", className: c, id: p, multiple: m, disabled: s } = d, b = () => {
6
+ s || t == null || t();
7
+ }, u = (a) => {
8
+ s || (a.key === "Enter" || a.key === " ") && (a.preventDefault(), t == null || t());
9
+ }, f = h(
10
+ e["tedi-base-map-selection__wrapper"],
11
+ i && e["tedi-base-map-selection--selected"],
12
+ n && e[`tedi-base-map-selection--${n}`],
13
+ m && e["tedi-base-map-selection--multiple"],
14
+ s && e["tedi-base-map-selection--disabled"],
15
+ c
16
+ );
17
+ return /* @__PURE__ */ y(
18
+ "div",
19
+ {
20
+ role: "button",
21
+ tabIndex: s ? -1 : 0,
22
+ "aria-pressed": !!i,
23
+ "aria-disabled": s || void 0,
24
+ onClick: b,
25
+ onKeyDown: u,
26
+ className: f,
27
+ id: p,
28
+ children: [
29
+ /* @__PURE__ */ l("div", { "aria-hidden": !0, className: e["tedi-base-map-selection__content"], children: r }),
30
+ /* @__PURE__ */ l("div", { className: e["tedi-base-map-selection__title"], children: o })
31
+ ]
32
+ }
33
+ );
34
+ };
35
+ N.displayName = "BaseMapOption";
36
+ export {
37
+ N as BaseMapOption,
38
+ N as default
39
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),b=require("../../../../../external/classnames/index.cjs.js"),e=require("./base-map-selection.module.scss.cjs.js"),f=n=>{const{title:i,content:c,selected:o,onSelect:t,type:s="button",className:d,id:u,multiple:r}=n,p=a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),t==null||t())},m=b.default(e.default["tedi-base-map-selection__wrapper"],o&&e.default["tedi-base-map-selection--selected"],s&&e.default[`tedi-base-map-selection--${s}`],r&&e.default["tedi-base-map-selection--multiple"],d);return l.jsxs("div",{role:"button",tabIndex:0,onClick:t,onKeyDown:p,className:m,id:u,children:[l.jsx("div",{className:e.default["tedi-base-map-selection__content"],children:c}),l.jsx("div",{className:e.default["tedi-base-map-selection__title"],children:i})]})};exports.BaseMapSelection=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),N=require("../../../../../external/classnames/index.cjs.js"),S=require("react"),B=require("../../../../tedi/components/buttons/button/button.cjs.js"),T=require("../../../../tedi/components/form/field/field.cjs.js"),O=require("../../../../tedi/components/form/input-group/input-group.cjs.js"),C=require("../../../../tedi/components/form/slider/slider.cjs.js"),f=require("./base-map-option.cjs.js"),n=require("./base-map-selection.module.scss.cjs.js"),l=require("../../../../tedi/components/overlays/popover/popover.cjs.js"),L=require("../../../../tedi/components/form/input-group/components/input/input.cjs.js"),P=require("../../../../tedi/components/form/input-group/components/suffix/suffix.cjs.js"),c=a=>{const t=Number(a);return Number.isNaN(t)?0:Math.min(100,Math.max(0,t))};function o(a){const{title:t,content:x,children:h,multiple:y=!1,showTransparency:j=!1,transparency:d,defaultTransparency:_,onTransparencyChange:s,transparencyLabel:r="",id:i}=a,p=d!==void 0,[v,g]=S.useState(()=>c(_??0)),u=c(p?d:v),m=M=>{const b=c(M);p||g(b),s==null||s(b)},q=N.default(n.default["tedi-base-map-selection__wrapper"],n.default["tedi-base-map-selection__trigger"],n.default["tedi-base-map-selection--button"],y&&n.default["tedi-base-map-selection--multiple"]);return e.jsxs(l.Popover,{placement:"top-end",children:[e.jsx(l.Popover.Trigger,{children:e.jsxs(B.Button,{noStyle:!0,id:i,className:q,children:[e.jsx("div",{className:n.default["tedi-base-map-selection__content"],"aria-hidden":!0,children:x}),e.jsx("div",{className:n.default["tedi-base-map-selection__title"],children:t})]})}),e.jsxs(l.Popover.Content,{width:"medium",children:[e.jsx("div",{className:n.default["tedi-base-map-selection__options"],children:h}),j&&e.jsx("div",{className:n.default["tedi-base-map-selection__transparency"],children:e.jsx(C.Slider,{label:r,"aria-label":r||"Transparency",min:0,max:100,value:u,onChange:m,minLabel:"0%",maxLabel:"100%",addonRight:e.jsx("div",{className:n.default["tedi-base-map-selection__transparency-field"],children:e.jsxs(O.InputGroupBase,{id:`${i}-transparency`,label:r||"Transparency",hideLabel:!0,children:[e.jsx(L.Input,{children:e.jsx(T.Field,{type:"number",id:`${i}-transparency`,value:String(u),onChange:m})}),e.jsx(P.Suffix,{children:"%"})]})})})})]})]})}o.Option=f.BaseMapOption;o.displayName="BaseMapSelection";exports.BaseMapOption=f.BaseMapOption;exports.BaseMapSelection=o;
@@ -1,44 +1,59 @@
1
1
  import { JSX } from 'react';
2
- type BaseMapSelectionType = 'button' | 'historical' | 'selection';
2
+ import { default as BaseMapOption } from './base-map-option';
3
3
  export interface BaseMapSelectionProps {
4
4
  /**
5
- * The title displayed within the component.
5
+ * Title of the trigger button and used as its accessible label.
6
6
  */
7
7
  title: string;
8
8
  /**
9
- * The main content of the selection card. Can be any valid React node.
9
+ * Visual content (thumbnail) of the currently active base map, shown on the trigger button.
10
10
  */
11
11
  content: React.ReactNode;
12
12
  /**
13
- * Indicates whether the current item is selected.
14
- * Used to apply specific visual styles.
13
+ * Selectable base map options rendered inside the popover, typically `BaseMapSelection.Option` elements.
15
14
  */
16
- selected?: boolean;
15
+ children: React.ReactNode;
17
16
  /**
18
- * Callback function triggered when the selection is clicked
19
- * or activated via keyboard (Enter or Space).
17
+ * Renders a "stacked" trigger, indicating that multiple base maps are available.
18
+ * @default false
20
19
  */
21
- onSelect?: () => void;
20
+ multiple?: boolean;
22
21
  /**
23
- * The type of the selection, which controls styling.
24
- * - `'button'`: default interactive selection
25
- * - `'historical'`: styled for historical context
26
- * - `'selection'`: styled for multi-selection context
22
+ * When `true`, renders a transparency slider at the bottom of the popover.
23
+ * @default false
27
24
  */
28
- type: BaseMapSelectionType;
25
+ showTransparency?: boolean;
29
26
  /**
30
- * Optional custom class name to apply additional styles.
27
+ * Controlled transparency value (0-100). Use together with `onTransparencyChange`.
28
+ * Values outside the range are clamped. Omit for uncontrolled usage.
31
29
  */
32
- className?: string;
30
+ transparency?: number;
33
31
  /**
34
- * Optional HTML `id` attribute to identify the element.
32
+ * Initial transparency value (0-100) for uncontrolled usage. Ignored when `transparency` is provided.
33
+ * @default 0
35
34
  */
36
- id?: string;
35
+ defaultTransparency?: number;
37
36
  /**
38
- * When `true`, indicates that multiple selections are allowed.
39
- * Affects the visual style.
37
+ * Callback fired when the transparency value changes. The reported value is always clamped to 0-100.
40
38
  */
41
- multiple?: boolean;
39
+ onTransparencyChange?: (value: number) => void;
40
+ /**
41
+ * Label for the transparency slider.
42
+ */
43
+ transparencyLabel?: string;
44
+ /**
45
+ * HTML `id` attribute applied to the trigger button.
46
+ */
47
+ id: string;
48
+ }
49
+ export declare function BaseMapSelection(props: BaseMapSelectionProps): JSX.Element;
50
+ export declare namespace BaseMapSelection {
51
+ var Option: {
52
+ (props: import("./base-map-option").BaseMapOptionProps): JSX.Element;
53
+ displayName: string;
54
+ };
55
+ var displayName: string;
42
56
  }
43
- export declare const BaseMapSelection: (props: BaseMapSelectionProps) => JSX.Element;
57
+ export type { BaseMapOptionProps, BaseMapOptionType } from './base-map-option';
58
+ export { BaseMapOption };
44
59
  export default BaseMapSelection;
@@ -1,21 +1,80 @@
1
- import { jsxs as u, jsx as a } from "react/jsx-runtime";
2
- import y from "../../../../../external/classnames/index.es.js";
3
- import e from "./base-map-selection.module.scss.es.js";
4
- const h = (n) => {
5
- const { title: l, content: o, selected: c, onSelect: t, type: i = "button", className: m, id: p, multiple: d } = n, r = (s) => {
6
- (s.key === "Enter" || s.key === " ") && (s.preventDefault(), t == null || t());
7
- }, b = y(
8
- e["tedi-base-map-selection__wrapper"],
9
- c && e["tedi-base-map-selection--selected"],
10
- i && e[`tedi-base-map-selection--${i}`],
11
- d && e["tedi-base-map-selection--multiple"],
12
- m
1
+ import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
+ import B from "../../../../../external/classnames/index.es.js";
3
+ import { useState as M } from "react";
4
+ import { Button as C } from "../../../../tedi/components/buttons/button/button.es.js";
5
+ import { Field as L } from "../../../../tedi/components/form/field/field.es.js";
6
+ import { InputGroupBase as w } from "../../../../tedi/components/form/input-group/input-group.es.js";
7
+ import { Slider as j } from "../../../../tedi/components/form/slider/slider.es.js";
8
+ import { BaseMapOption as I } from "./base-map-option.es.js";
9
+ import a from "./base-map-selection.module.scss.es.js";
10
+ import { Popover as l } from "../../../../tedi/components/overlays/popover/popover.es.js";
11
+ import { Input as O } from "../../../../tedi/components/form/input-group/components/input/input.es.js";
12
+ import { Suffix as $ } from "../../../../tedi/components/form/input-group/components/suffix/suffix.es.js";
13
+ const c = (r) => {
14
+ const n = Number(r);
15
+ return Number.isNaN(n) ? 0 : Math.min(100, Math.max(0, n));
16
+ };
17
+ function f(r) {
18
+ const {
19
+ title: n,
20
+ content: b,
21
+ children: y,
22
+ multiple: _ = !1,
23
+ showTransparency: N = !1,
24
+ transparency: m,
25
+ defaultTransparency: g,
26
+ onTransparencyChange: i,
27
+ transparencyLabel: s = "",
28
+ id: o
29
+ } = r, p = m !== void 0, [v, x] = M(
30
+ () => c(g ?? 0)
31
+ ), d = c(p ? m : v), u = (S) => {
32
+ const h = c(S);
33
+ p || x(h), i == null || i(h);
34
+ }, T = B(
35
+ a["tedi-base-map-selection__wrapper"],
36
+ a["tedi-base-map-selection__trigger"],
37
+ a["tedi-base-map-selection--button"],
38
+ _ && a["tedi-base-map-selection--multiple"]
13
39
  );
14
- return /* @__PURE__ */ u("div", { role: "button", tabIndex: 0, onClick: t, onKeyDown: r, className: b, id: p, children: [
15
- /* @__PURE__ */ a("div", { className: e["tedi-base-map-selection__content"], children: o }),
16
- /* @__PURE__ */ a("div", { className: e["tedi-base-map-selection__title"], children: l })
40
+ return /* @__PURE__ */ t(l, { placement: "top-end", children: [
41
+ /* @__PURE__ */ e(l.Trigger, { children: /* @__PURE__ */ t(C, { noStyle: !0, id: o, className: T, children: [
42
+ /* @__PURE__ */ e("div", { className: a["tedi-base-map-selection__content"], "aria-hidden": !0, children: b }),
43
+ /* @__PURE__ */ e("div", { className: a["tedi-base-map-selection__title"], children: n })
44
+ ] }) }),
45
+ /* @__PURE__ */ t(l.Content, { width: "medium", children: [
46
+ /* @__PURE__ */ e("div", { className: a["tedi-base-map-selection__options"], children: y }),
47
+ N && /* @__PURE__ */ e("div", { className: a["tedi-base-map-selection__transparency"], children: /* @__PURE__ */ e(
48
+ j,
49
+ {
50
+ label: s,
51
+ "aria-label": s || "Transparency",
52
+ min: 0,
53
+ max: 100,
54
+ value: d,
55
+ onChange: u,
56
+ minLabel: "0%",
57
+ maxLabel: "100%",
58
+ addonRight: /* @__PURE__ */ e("div", { className: a["tedi-base-map-selection__transparency-field"], children: /* @__PURE__ */ t(w, { id: `${o}-transparency`, label: s || "Transparency", hideLabel: !0, children: [
59
+ /* @__PURE__ */ e(O, { children: /* @__PURE__ */ e(
60
+ L,
61
+ {
62
+ type: "number",
63
+ id: `${o}-transparency`,
64
+ value: String(d),
65
+ onChange: u
66
+ }
67
+ ) }),
68
+ /* @__PURE__ */ e($, { children: "%" })
69
+ ] }) })
70
+ }
71
+ ) })
72
+ ] })
17
73
  ] });
18
- };
74
+ }
75
+ f.Option = I;
76
+ f.displayName = "BaseMapSelection";
19
77
  export {
20
- h as BaseMapSelection
78
+ I as BaseMapOption,
79
+ f as BaseMapSelection
21
80
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-base-map-selection__wrapper":"tedi-base-map-selection__wrapper-aae7464f","tedi-base-map-selection__content":"tedi-base-map-selection__content-3145448d","tedi-base-map-selection--historical":"tedi-base-map-selection--historical-159d3def","tedi-base-map-selection__title":"tedi-base-map-selection__title-d46b74ec","tedi-map-selection__title":"tedi-map-selection__title-20651d60","tedi-base-map-selection--selected":"tedi-base-map-selection--selected-914a0483","tedi-base-map-selection--button":"tedi-base-map-selection--button-0e9e36f4","tedi-base-map-selection--selection":"tedi-base-map-selection--selection-910cae90","tedi-base-map-selection--multiple":"tedi-base-map-selection--multiple-58cb365c"};exports.default=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-base-map-selection__wrapper":"tedi-base-map-selection__wrapper-aae7464f","tedi-base-map-selection__content":"tedi-base-map-selection__content-3145448d","tedi-base-map-selection__options":"tedi-base-map-selection__options-dce549ce","tedi-base-map-selection__transparency":"tedi-base-map-selection__transparency-d4be551d","tedi-base-map-selection__transparency-field":"tedi-base-map-selection__transparency-field-d8b5a065","tedi-base-map-selection--historical":"tedi-base-map-selection--historical-159d3def","tedi-base-map-selection__title":"tedi-base-map-selection__title-d46b74ec","tedi-base-map-selection--selected":"tedi-base-map-selection--selected-914a0483","tedi-base-map-selection--disabled":"tedi-base-map-selection--disabled-a957b2c8","tedi-base-map-selection--button":"tedi-base-map-selection--button-0e9e36f4","tedi-base-map-selection--selection":"tedi-base-map-selection--selection-910cae90","tedi-base-map-selection--multiple":"tedi-base-map-selection--multiple-58cb365c"};exports.default=e;
@@ -1,10 +1,13 @@
1
1
  const e = {
2
2
  "tedi-base-map-selection__wrapper": "tedi-base-map-selection__wrapper-aae7464f",
3
3
  "tedi-base-map-selection__content": "tedi-base-map-selection__content-3145448d",
4
+ "tedi-base-map-selection__options": "tedi-base-map-selection__options-dce549ce",
5
+ "tedi-base-map-selection__transparency": "tedi-base-map-selection__transparency-d4be551d",
6
+ "tedi-base-map-selection__transparency-field": "tedi-base-map-selection__transparency-field-d8b5a065",
4
7
  "tedi-base-map-selection--historical": "tedi-base-map-selection--historical-159d3def",
5
8
  "tedi-base-map-selection__title": "tedi-base-map-selection__title-d46b74ec",
6
- "tedi-map-selection__title": "tedi-map-selection__title-20651d60",
7
9
  "tedi-base-map-selection--selected": "tedi-base-map-selection--selected-914a0483",
10
+ "tedi-base-map-selection--disabled": "tedi-base-map-selection--disabled-a957b2c8",
8
11
  "tedi-base-map-selection--button": "tedi-base-map-selection--button-0e9e36f4",
9
12
  "tedi-base-map-selection--selection": "tedi-base-map-selection--selection-910cae90",
10
13
  "tedi-base-map-selection--multiple": "tedi-base-map-selection--multiple-58cb365c"