@uva-glass/component-library 3.31.0 → 3.32.1

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.
Files changed (46) hide show
  1. package/dist/SortableProvider-DisCfTTN.js +160 -0
  2. package/dist/SortableProvider-DisCfTTN.js.map +1 -0
  3. package/dist/{TablePlugin-Dmy98Epb.js → TablePlugin-oF-gInNx.js} +2 -2
  4. package/dist/{TablePlugin-Dmy98Epb.js.map → TablePlugin-oF-gInNx.js.map} +1 -1
  5. package/dist/assets/TextArea.css +1 -1
  6. package/dist/components/CheckboxTree/CheckboxTree.js +2 -2
  7. package/dist/components/FormInput/FormInput.js +2 -2
  8. package/dist/components/InputField/InputField.stories.js +2 -2
  9. package/dist/components/MultiSelect/MultiSelect.js +1 -1
  10. package/dist/components/MultiSelect/MultiSelect.stories.js +1 -1
  11. package/dist/components/MultiSelect/components/MultiSelectHeader.js +2 -2
  12. package/dist/components/MultiSelect/index.js +1 -1
  13. package/dist/components/PeriodSelector/PeriodSelector.js +2 -2
  14. package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +2 -2
  15. package/dist/components/RadioTabSelector/RadioTabSelector.js +2 -2
  16. package/dist/components/RteEditor/EditorHeader/EditorHeader.js +2 -2
  17. package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +2 -2
  18. package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js +2 -2
  19. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +2 -2
  20. package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +2 -2
  21. package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +2 -2
  22. package/dist/components/RteEditor/Plugins/TablePlugin/index.js +1 -1
  23. package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +1 -1
  24. package/dist/components/RteEditor/Plugins/index.js +1 -1
  25. package/dist/components/RteEditor/RteEditor.js +2 -2
  26. package/dist/components/Sortable/Sortable.d.ts +5 -3
  27. package/dist/components/Sortable/Sortable.js +36 -31
  28. package/dist/components/Sortable/Sortable.js.map +1 -1
  29. package/dist/components/Sortable/Sortable.stories.d.ts +3 -3
  30. package/dist/components/Sortable/Sortable.stories.js +19 -12
  31. package/dist/components/Sortable/Sortable.stories.js.map +1 -1
  32. package/dist/components/Sortable/SortableProvider.d.ts +9 -6
  33. package/dist/components/Sortable/SortableProvider.js +1 -1
  34. package/dist/components/Sortable/components/SortableContainer.js +1 -1
  35. package/dist/components/Sortable/components/SortableItem.js +1 -1
  36. package/dist/components/TextArea/TextArea.d.ts +3 -1
  37. package/dist/components/TextArea/TextArea.js +28 -23
  38. package/dist/components/TextArea/TextArea.js.map +1 -1
  39. package/dist/components/TextArea/TextArea.stories.d.ts +1 -0
  40. package/dist/components/TextArea/TextArea.stories.js +18 -19
  41. package/dist/components/TextArea/TextArea.stories.js.map +1 -1
  42. package/dist/components/index.js +1 -1
  43. package/dist/index.js +1 -1
  44. package/package.json +1 -1
  45. package/dist/SortableProvider-C2T7b-pm.js +0 -153
  46. package/dist/SortableProvider-C2T7b-pm.js.map +0 -1
@@ -4,7 +4,7 @@ import "../../../../clsx-OuTLNxxd.js";
4
4
  import "../../../../LexicalTable.prod-9xjyWB0C.js";
5
5
  import "../../../../Lexical.prod-B84LhBo3.js";
6
6
  import "react";
7
- import { T as F } from "../../../../TablePlugin-Dmy98Epb.js";
7
+ import { T as F } from "../../../../TablePlugin-oF-gInNx.js";
8
8
  import "./helpers.js";
9
9
  import "../../hooks/useFlyout.js";
10
10
  import "../../../Icon/Icon.js";
@@ -29,7 +29,7 @@ import "../../../../index-nrPtQ1dv.js";
29
29
  import "../../../SelectListbox/SelectListbox.js";
30
30
  import "../../../SelectListbox/SelectProvider.js";
31
31
  import "../../../Sortable/components/SortableItem.js";
32
- import "../../../../SortableProvider-C2T7b-pm.js";
32
+ import "../../../../SortableProvider-DisCfTTN.js";
33
33
  export {
34
34
  F as TablePlugin
35
35
  };
@@ -1,4 +1,4 @@
1
- import { T as o } from "../../../../TablePlugin-Dmy98Epb.js";
1
+ import { T as o } from "../../../../TablePlugin-oF-gInNx.js";
2
2
  import { TableCellContextMenu as t } from "./TableCellContextMenu/TableCellContextMenu.js";
3
3
  export {
4
4
  t as TableCellContextMenu,
@@ -7,7 +7,7 @@ import { BlockFormatPlugin as T } from "../BlockFormatPlugin/BlockFormatPlugin.j
7
7
  import { ListPlugin as k } from "../ListPlugin/ListPlugin.js";
8
8
  import { LinkPlugin as x } from "../LinkPlugin/LinkPlugin.js";
9
9
  import { HistoryPlugin as B } from "../HistoryPlugin/HistoryPlugin.js";
10
- import { T as S } from "../../../../TablePlugin-Dmy98Epb.js";
10
+ import { T as S } from "../../../../TablePlugin-oF-gInNx.js";
11
11
  import { TableCellContextMenu as z } from "../TablePlugin/TableCellContextMenu/TableCellContextMenu.js";
12
12
  import { s as A } from "../../../../RteEditor.module-B_3uFnFu.js";
13
13
  import { setScrollableContainers as b, removeScrollableContainers as K } from "../../helpers.js";
@@ -3,7 +3,7 @@ import { BlockFormatPlugin as l } from "./BlockFormatPlugin/BlockFormatPlugin.js
3
3
  import { ListPlugin as n } from "./ListPlugin/ListPlugin.js";
4
4
  import { LinkPlugin as m, getLinkNodeTag as x } from "./LinkPlugin/LinkPlugin.js";
5
5
  import { HistoryPlugin as p } from "./HistoryPlugin/HistoryPlugin.js";
6
- import { T as a } from "../../../TablePlugin-Dmy98Epb.js";
6
+ import { T as a } from "../../../TablePlugin-oF-gInNx.js";
7
7
  import { TableCellContextMenu as T } from "./TablePlugin/TableCellContextMenu/TableCellContextMenu.js";
8
8
  export {
9
9
  l as BlockFormatPlugin,
@@ -16,7 +16,7 @@ import { exportMap as ir, isStartingWithHtmlTag as lr, mergeBoldStrongTags as ur
16
16
  import { s as I } from "../../RteEditor.module-B_3uFnFu.js";
17
17
  import { ToolBarPlugin as cr } from "./Plugins/ToolbarPlugin/ToolbarPlugin.js";
18
18
  import { useTranslation as dr } from "./hooks/useTranslation.js";
19
- import "../../TablePlugin-Dmy98Epb.js";
19
+ import "../../TablePlugin-oF-gInNx.js";
20
20
  import "./Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js";
21
21
  import "./hooks/components/Flyout.js";
22
22
  import "../Buttons/Button.js";
@@ -36,7 +36,7 @@ import "react-router";
36
36
  import "../SelectListbox/SelectListbox.js";
37
37
  import "../SelectListbox/SelectProvider.js";
38
38
  import "../Sortable/components/SortableItem.js";
39
- import "../../SortableProvider-C2T7b-pm.js";
39
+ import "../../SortableProvider-DisCfTTN.js";
40
40
  import { UvaTheme as mr } from "./UvaTheme/UvaTheme.js";
41
41
  import { EditorHeader as pr } from "./EditorHeader/EditorHeader.js";
42
42
  import { LanguageProvider as gr, useLanguage as hr } from "./Providers/LanguageProvider.js";
@@ -2,9 +2,11 @@ import { ReactElement } from 'react';
2
2
  import { SortableItemProps } from './components/SortableItem';
3
3
  export type Index = string | number;
4
4
  export type SortableItemColors = 'grey-200' | 'white';
5
- export interface SortableProps {
5
+ export interface SortableProps<T = unknown> {
6
6
  /** The elements to show inside the Sortable. */
7
7
  children: ReactElement[] | string[];
8
+ /** The data objects that are actually being sorted. */
9
+ childrenData?: T[];
8
10
  /** The placement of each item Handle (6 dots 2x3). */
9
11
  ItemHandlePlacement?: SortableItemProps['handlePlacement'];
10
12
  /** If true, a scrollable version of the list will be rendered (max height 21rem/336px). */
@@ -16,6 +18,6 @@ export interface SortableProps {
16
18
  /** Change the color of the SortableItem wrapper. */
17
19
  sortableItemColor?: SortableItemColors;
18
20
  /** The callback function that is invoked when new sorting takes place. */
19
- onSort?: (items: (string | ReactElement)[]) => void;
21
+ onSort?: (items: T[]) => void;
20
22
  }
21
- export declare const Sortable: ({ children, ItemHandlePlacement, scrollable, disabled, onSort, hideNumbers, sortableItemColor, }: SortableProps) => import("react/jsx-runtime").JSX.Element;
23
+ export declare const Sortable: <T>({ children, childrenData, ItemHandlePlacement, scrollable, disabled, onSort, hideNumbers, sortableItemColor, }: SortableProps<T>) => import("react/jsx-runtime").JSX.Element;
@@ -1,37 +1,42 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
- import { Children as e } from "react";
3
- import { SortableItem as p } from "./components/SortableItem.js";
4
- import { S as f } from "../../SortableProvider-C2T7b-pm.js";
5
- const u = ({
6
- children: r,
7
- ItemHandlePlacement: m = "left",
8
- scrollable: a,
9
- disabled: l,
2
+ import { Children as a } from "react";
3
+ import { SortableItem as f } from "./components/SortableItem.js";
4
+ import { S as I } from "../../SortableProvider-DisCfTTN.js";
5
+ const P = ({
6
+ children: t,
7
+ childrenData: m,
8
+ ItemHandlePlacement: s = "left",
9
+ scrollable: l,
10
+ disabled: n,
10
11
  onSort: i,
11
- hideNumbers: s,
12
+ hideNumbers: p,
12
13
  sortableItemColor: b = "grey-200"
13
- }) => /* @__PURE__ */ o(
14
- f,
15
- {
16
- items: r,
17
- scrollable: a,
18
- hideNumbers: s,
19
- onSort: i,
20
- children: r.map((n, t) => /* @__PURE__ */ o(
21
- p,
22
- {
23
- handlePlacement: m,
24
- disabled: l || e.count(r) <= 1,
25
- sortableItemColor: b,
26
- index: t,
27
- children: n
28
- },
29
- `sortable-item-${t}`
30
- ))
31
- },
32
- `sortable-with-children-${e.count(r)}`
33
- );
14
+ }) => {
15
+ const d = m ?? t, r = t.map((c, e) => /* @__PURE__ */ o(
16
+ f,
17
+ {
18
+ handlePlacement: s,
19
+ disabled: n || a.count(t) <= 1,
20
+ sortableItemColor: b,
21
+ index: e,
22
+ children: c
23
+ },
24
+ `sortable-item-${e}`
25
+ ));
26
+ return /* @__PURE__ */ o(
27
+ I,
28
+ {
29
+ renderItems: r,
30
+ dataItems: d,
31
+ scrollable: l,
32
+ hideNumbers: p,
33
+ onSort: i,
34
+ children: r
35
+ },
36
+ `sortable-with-children-${a.count(t)}`
37
+ );
38
+ };
34
39
  export {
35
- u as Sortable
40
+ P as Sortable
36
41
  };
37
42
  //# sourceMappingURL=Sortable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Sortable.js","sources":["../../../src/components/Sortable/Sortable.tsx"],"sourcesContent":["import { Children } from 'react';\n\nimport type { ReactElement } from 'react';\nimport type { SortableItemProps } from './components/SortableItem';\n\nimport { SortableItem } from './components/SortableItem';\nimport { SortableProvider } from './SortableProvider';\n\nexport type Index = string | number;\nexport type SortableItemColors = 'grey-200' | 'white';\n\nexport interface SortableProps {\n /** The elements to show inside the Sortable. */\n children: ReactElement[] | string[];\n /** The placement of each item Handle (6 dots 2x3). */\n ItemHandlePlacement?: SortableItemProps['handlePlacement'];\n /** If true, a scrollable version of the list will be rendered (max height 21rem/336px). */\n scrollable?: boolean;\n /** If true, the sorting will be disabled. */\n disabled?: boolean;\n /** Hide the numbers shown next to the sortable elements. */\n hideNumbers?: boolean;\n /** Change the color of the SortableItem wrapper. */\n sortableItemColor?: SortableItemColors;\n /** The callback function that is invoked when new sorting takes place. */\n onSort?: (items: (string | ReactElement)[]) => void;\n}\n\n// A component that renders a list of children that can be sorted with drag and drop.\nexport const Sortable = ({\n children,\n ItemHandlePlacement = 'left',\n scrollable,\n disabled,\n onSort,\n hideNumbers,\n sortableItemColor = 'grey-200',\n}: SortableProps) => {\n return (\n <SortableProvider\n items={children}\n scrollable={scrollable}\n hideNumbers={hideNumbers}\n onSort={onSort}\n key={`sortable-with-children-${Children.count(children)}`}\n >\n {children.map((child, index) => (\n <SortableItem\n handlePlacement={ItemHandlePlacement}\n disabled={disabled || Children.count(children) <= 1}\n sortableItemColor={sortableItemColor}\n index={index}\n key={`sortable-item-${index}`}\n >\n {child}\n </SortableItem>\n ))}\n </SortableProvider>\n );\n};\n"],"names":["Sortable","children","ItemHandlePlacement","scrollable","disabled","onSort","hideNumbers","sortableItemColor","jsx","SortableProvider","child","index","SortableItem","Children"],"mappings":";;;;AA6BO,MAAMA,IAAW,CAAC;AAAA,EACvB,UAAAC;AAAA,EACA,qBAAAC,IAAsB;AAAA,EACtB,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,aAAAC;AAAA,EACA,mBAAAC,IAAoB;AACtB,MAEI,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACC,OAAOR;AAAA,IACP,YAAAE;AAAA,IACA,aAAAG;AAAA,IACA,QAAAD;AAAA,IAGC,UAAAJ,EAAS,IAAI,CAACS,GAAOC,MACpB,gBAAAH;AAAA,MAACI;AAAA,MAAA;AAAA,QACC,iBAAiBV;AAAA,QACjB,UAAUE,KAAYS,EAAS,MAAMZ,CAAQ,KAAK;AAAA,QAClD,mBAAAM;AAAA,QACA,OAAAI;AAAA,QAGC,UAAAD;AAAA,MAAA;AAAA,MAFI,iBAAiBC,CAAK;AAAA,IAAA,CAI9B;AAAA,EAAA;AAAA,EAZI,0BAA0BE,EAAS,MAAMZ,CAAQ,CAAC;AAAA;"}
1
+ {"version":3,"file":"Sortable.js","sources":["../../../src/components/Sortable/Sortable.tsx"],"sourcesContent":["import { Children } from 'react';\n\nimport type { ReactElement } from 'react';\nimport type { SortableItemProps } from './components/SortableItem';\n\nimport { SortableItem } from './components/SortableItem';\nimport { SortableProvider } from './SortableProvider';\n\nexport type Index = string | number;\nexport type SortableItemColors = 'grey-200' | 'white';\n\nexport interface SortableProps<T = unknown> {\n /** The elements to show inside the Sortable. */\n children: ReactElement[] | string[];\n /** The data objects that are actually being sorted. */\n childrenData?: T[];\n /** The placement of each item Handle (6 dots 2x3). */\n ItemHandlePlacement?: SortableItemProps['handlePlacement'];\n /** If true, a scrollable version of the list will be rendered (max height 21rem/336px). */\n scrollable?: boolean;\n /** If true, the sorting will be disabled. */\n disabled?: boolean;\n /** Hide the numbers shown next to the sortable elements. */\n hideNumbers?: boolean;\n /** Change the color of the SortableItem wrapper. */\n sortableItemColor?: SortableItemColors;\n /** The callback function that is invoked when new sorting takes place. */\n onSort?: (items: T[]) => void;\n}\n\n// A component that renders a list of children that can be sorted with drag and drop.\nexport const Sortable = <T,>({\n children,\n childrenData,\n ItemHandlePlacement = 'left',\n scrollable,\n disabled,\n onSort,\n hideNumbers,\n sortableItemColor = 'grey-200',\n}: SortableProps<T>) => {\n const sortableData: T[] = childrenData ?? (children as unknown as T[]);\n\n const wrappedItems = children.map((child, index) => (\n <SortableItem\n handlePlacement={ItemHandlePlacement}\n disabled={disabled || Children.count(children) <= 1}\n sortableItemColor={sortableItemColor}\n index={index}\n key={`sortable-item-${index}`}\n >\n {child}\n </SortableItem>\n ));\n\n return (\n <SortableProvider\n renderItems={wrappedItems}\n dataItems={sortableData}\n scrollable={scrollable}\n hideNumbers={hideNumbers}\n onSort={onSort}\n key={`sortable-with-children-${Children.count(children)}`}\n >\n {wrappedItems}\n </SortableProvider>\n );\n};\n"],"names":["Sortable","children","childrenData","ItemHandlePlacement","scrollable","disabled","onSort","hideNumbers","sortableItemColor","sortableData","wrappedItems","child","index","jsx","SortableItem","Children","SortableProvider"],"mappings":";;;;AA+BO,MAAMA,IAAW,CAAK;AAAA,EAC3B,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,qBAAAC,IAAsB;AAAA,EACtB,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,aAAAC;AAAA,EACA,mBAAAC,IAAoB;AACtB,MAAwB;AACtB,QAAMC,IAAoBP,KAAiBD,GAErCS,IAAeT,EAAS,IAAI,CAACU,GAAOC,MACxC,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,iBAAiBX;AAAA,MACjB,UAAUE,KAAYU,EAAS,MAAMd,CAAQ,KAAK;AAAA,MAClD,mBAAAO;AAAA,MACA,OAAAI;AAAA,MAGC,UAAAD;AAAA,IAAA;AAAA,IAFI,iBAAiBC,CAAK;AAAA,EAAA,CAI9B;AAED,SACE,gBAAAC;AAAA,IAACG;AAAA,IAAA;AAAA,MACC,aAAaN;AAAA,MACb,WAAWD;AAAA,MACX,YAAAL;AAAA,MACA,aAAAG;AAAA,MACA,QAAAD;AAAA,MAGC,UAAAI;AAAA,IAAA;AAAA,IAFI,0BAA0BK,EAAS,MAAMd,CAAQ,CAAC;AAAA,EAAA;AAK7D;"}
@@ -2,6 +2,6 @@ import { Meta } from '@storybook/react';
2
2
  import { SortableProps } from './Sortable';
3
3
  declare const _default: Meta<SortableProps>;
4
4
  export default _default;
5
- export declare const SortableExample: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, SortableProps>;
6
- export declare const withHandleRight: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, SortableProps>;
7
- export declare const WithComplexChildren: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, SortableProps>;
5
+ export declare const SortableExample: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, SortableProps<unknown>>;
6
+ export declare const withHandleRight: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, SortableProps<unknown>>;
7
+ export declare const WithComplexChildren: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, SortableProps<unknown>>;
@@ -1,15 +1,15 @@
1
- import { jsx as e, jsxs as m, Fragment as i } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as i, Fragment as m } from "react/jsx-runtime";
2
2
  import { l as s } from "../../index-C2E9FY6V.js";
3
- import { Sortable as o } from "./Sortable.js";
3
+ import { Sortable as l } from "./Sortable.js";
4
4
  import { InputField as d } from "../InputField/InputField.js";
5
5
  import { Icon as c } from "../Icon/Icon.js";
6
6
  import { Button as b } from "../Buttons/Button.js";
7
7
  import "../Buttons/LinkButton.js";
8
8
  import "@react-aria/button";
9
9
  const p = `<Sortable onSort={onSortFunction} ItemHandlePlacement={ItemHandlePlacement} scrollable={scrollable}
10
- disabled={ disabled } hideNumbers={ hideNumbers } sortableItemColor={ sortableItemColor } > { children } </ Sortable > `, j = {
10
+ disabled={ disabled } hideNumbers={ hideNumbers } sortableItemColor={ sortableItemColor } > { children } </ Sortable > `, F = {
11
11
  title: "Organisms/Sortable",
12
- component: o,
12
+ component: l,
13
13
  argTypes: {
14
14
  children: {
15
15
  table: {
@@ -23,13 +23,13 @@ const p = `<Sortable onSort={onSortFunction} ItemHandlePlacement={ItemHandlePlac
23
23
  }
24
24
  },
25
25
  parameters: {
26
- inspectComponent: o,
26
+ inspectComponent: l,
27
27
  codeString: p
28
28
  }
29
29
  }, r = {
30
30
  ItemHandlePlacement: "left",
31
31
  onSort: s()
32
- }, a = ["Item-1", "Item-2", "Item-3", "Item-4", "Item-5"], n = (l) => /* @__PURE__ */ e(o, { ...l, children: a }), h = n.bind({});
32
+ }, a = ["Item-1", "Item-2", "Item-3", "Item-4", "Item-5"], n = (o) => /* @__PURE__ */ e(l, { ...o, children: a }), h = n.bind({});
33
33
  h.args = {
34
34
  ...r
35
35
  };
@@ -38,17 +38,24 @@ I.args = {
38
38
  ...r,
39
39
  ItemHandlePlacement: "right"
40
40
  };
41
- const f = (l) => /* @__PURE__ */ e(o, { ...l, children: a.map((t) => /* @__PURE__ */ m(i, { children: [
41
+ const u = (o) => /* @__PURE__ */ e(l, { ...o, children: a.map((t) => /* @__PURE__ */ i(m, { children: [
42
42
  /* @__PURE__ */ e("div", { style: { width: "100%" }, children: /* @__PURE__ */ e(d, { id: t, placeholder: t }, t) }),
43
43
  /* @__PURE__ */ e(b, { variant: "blank-icon", children: /* @__PURE__ */ e(c, { name: "Trash", color: "#a0002aff" }) })
44
- ] }, t)) }), g = f.bind({});
45
- g.args = {
46
- ...r
44
+ ] }, t)) }), f = u.bind({});
45
+ f.args = {
46
+ ...r,
47
+ childrenData: [
48
+ { title: "item-1", value: 1 },
49
+ { title: "item-2", value: 2 },
50
+ { title: "item-3", value: 3 },
51
+ { title: "item-4", value: 4 },
52
+ { title: "item-5", value: 5 }
53
+ ]
47
54
  };
48
55
  export {
49
56
  h as SortableExample,
50
- g as WithComplexChildren,
51
- j as default,
57
+ f as WithComplexChildren,
58
+ F as default,
52
59
  I as withHandleRight
53
60
  };
54
61
  //# sourceMappingURL=Sortable.stories.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Sortable.stories.js","sources":["../../../src/components/Sortable/Sortable.stories.tsx"],"sourcesContent":["import { fn } from 'storybook/test';\nimport { Fragment } from 'react/jsx-runtime';\n\nimport type { Meta, StoryFn } from '@storybook/react';\nimport type { SortableProps } from './Sortable';\n\nimport { Sortable } from './Sortable';\n\nimport { InputField } from 'components/InputField';\nimport { Icon } from 'components/Icon';\nimport { Button } from 'components/Buttons';\n\nconst codeString = `<Sortable onSort={onSortFunction} ItemHandlePlacement={ItemHandlePlacement} scrollable={scrollable} \n disabled={ disabled } hideNumbers={ hideNumbers } sortableItemColor={ sortableItemColor } > { children } </ Sortable > `;\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Organisms/Sortable',\n component: Sortable,\n argTypes: {\n children: {\n table: {\n disable: true,\n },\n },\n ItemHandlePlacement: {\n table: {\n disable: true,\n },\n },\n },\n parameters: {\n inspectComponent: Sortable,\n codeString: codeString,\n },\n} as Meta<SortableProps>;\n\nconst defaultArgs: Partial<SortableProps> = {\n ItemHandlePlacement: 'left',\n onSort: fn(),\n};\n\nconst mockItems = ['Item-1', 'Item-2', 'Item-3', 'Item-4', 'Item-5'];\n\nconst Template: StoryFn<SortableProps> = (args) => <Sortable {...args}>{mockItems}</Sortable>;\n\nexport const SortableExample = Template.bind({});\nSortableExample.args = {\n ...defaultArgs,\n};\n\nexport const withHandleRight = Template.bind({});\nwithHandleRight.args = {\n ...defaultArgs,\n ItemHandlePlacement: 'right',\n};\n\nconst TemplateComplex: StoryFn<SortableProps> = (args) => (\n <Sortable {...args}>\n {mockItems.map((item) => (\n <Fragment key={item}>\n <div style={{ width: '100%' }}>\n <InputField key={item} id={item} placeholder={item} />\n </div>\n <Button variant=\"blank-icon\">\n <Icon name=\"Trash\" color=\"#a0002aff\" />\n </Button>\n </Fragment>\n ))}\n </Sortable>\n);\n\nexport const WithComplexChildren = TemplateComplex.bind({});\nWithComplexChildren.args = {\n ...defaultArgs,\n};\n"],"names":["codeString","Sortable_stories","Sortable","defaultArgs","fn","mockItems","Template","args","SortableExample","withHandleRight","TemplateComplex","jsx","item","jsxs","Fragment","InputField","Button","Icon","WithComplexChildren"],"mappings":";;;;;;;;AAYA,MAAMA,IAAa;AAAA,8HAInBC,IAAe;AAAA,EACb,OAAO;AAAA,EACP,WAAWC;AAAA,EACX,UAAU;AAAA,IACR,UAAU;AAAA,MACR,OAAO;AAAA,QACL,SAAS;AAAA,MAAA;AAAA,IACX;AAAA,IAEF,qBAAqB;AAAA,MACnB,OAAO;AAAA,QACL,SAAS;AAAA,MAAA;AAAA,IACX;AAAA,EACF;AAAA,EAEF,YAAY;AAAA,IACV,kBAAkBA;AAAA,IAClB,YAAAF;AAAA,EAAA;AAEJ,GAEMG,IAAsC;AAAA,EAC1C,qBAAqB;AAAA,EACrB,QAAQC,EAAA;AACV,GAEMC,IAAY,CAAC,UAAU,UAAU,UAAU,UAAU,QAAQ,GAE7DC,IAAmC,CAACC,wBAAUL,GAAA,EAAU,GAAGK,GAAO,UAAAF,GAAU,GAErEG,IAAkBF,EAAS,KAAK,CAAA,CAAE;AAC/CE,EAAgB,OAAO;AAAA,EACrB,GAAGL;AACL;AAEO,MAAMM,IAAkBH,EAAS,KAAK,CAAA,CAAE;AAC/CG,EAAgB,OAAO;AAAA,EACrB,GAAGN;AAAA,EACH,qBAAqB;AACvB;AAEA,MAAMO,IAA0C,CAACH,MAC/C,gBAAAI,EAACT,GAAA,EAAU,GAAGK,GACX,UAAAF,EAAU,IAAI,CAACO,MACd,gBAAAC,EAACC,GAAA,EACC,UAAA;AAAA,EAAA,gBAAAH,EAAC,OAAA,EAAI,OAAO,EAAE,OAAO,OAAA,GACnB,UAAA,gBAAAA,EAACI,GAAA,EAAsB,IAAIH,GAAM,aAAaA,EAAA,GAA7BA,CAAmC,GACtD;AAAA,EACA,gBAAAD,EAACK,GAAA,EAAO,SAAQ,cACd,UAAA,gBAAAL,EAACM,KAAK,MAAK,SAAQ,OAAM,YAAA,CAAY,EAAA,CACvC;AAAA,KANaL,CAOf,CACD,GACH,GAGWM,IAAsBR,EAAgB,KAAK,CAAA,CAAE;AAC1DQ,EAAoB,OAAO;AAAA,EACzB,GAAGf;AACL;"}
1
+ {"version":3,"file":"Sortable.stories.js","sources":["../../../src/components/Sortable/Sortable.stories.tsx"],"sourcesContent":["import { fn } from 'storybook/test';\nimport { Fragment } from 'react/jsx-runtime';\n\nimport type { Meta, StoryFn } from '@storybook/react';\nimport type { SortableProps } from './Sortable';\n\nimport { Sortable } from './Sortable';\n\nimport { InputField } from 'components/InputField';\nimport { Icon } from 'components/Icon';\nimport { Button } from 'components/Buttons';\n\nconst codeString = `<Sortable onSort={onSortFunction} ItemHandlePlacement={ItemHandlePlacement} scrollable={scrollable} \n disabled={ disabled } hideNumbers={ hideNumbers } sortableItemColor={ sortableItemColor } > { children } </ Sortable > `;\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Organisms/Sortable',\n component: Sortable,\n argTypes: {\n children: {\n table: {\n disable: true,\n },\n },\n ItemHandlePlacement: {\n table: {\n disable: true,\n },\n },\n },\n parameters: {\n inspectComponent: Sortable,\n codeString: codeString,\n },\n} as Meta<SortableProps>;\n\nconst defaultArgs: Partial<SortableProps> = {\n ItemHandlePlacement: 'left',\n onSort: fn(),\n};\n\nconst mockItems = ['Item-1', 'Item-2', 'Item-3', 'Item-4', 'Item-5'];\n\nconst Template: StoryFn<SortableProps> = (args) => <Sortable {...args}>{mockItems}</Sortable>;\n\nexport const SortableExample = Template.bind({});\nSortableExample.args = {\n ...defaultArgs,\n};\n\nexport const withHandleRight = Template.bind({});\nwithHandleRight.args = {\n ...defaultArgs,\n ItemHandlePlacement: 'right',\n};\n\nconst TemplateComplex: StoryFn<SortableProps> = (args) => (\n <Sortable {...args}>\n {mockItems.map((item) => (\n <Fragment key={item}>\n <div style={{ width: '100%' }}>\n <InputField key={item} id={item} placeholder={item} />\n </div>\n <Button variant=\"blank-icon\">\n <Icon name=\"Trash\" color=\"#a0002aff\" />\n </Button>\n </Fragment>\n ))}\n </Sortable>\n);\n\nexport const WithComplexChildren = TemplateComplex.bind({});\nWithComplexChildren.args = {\n ...defaultArgs,\n childrenData: [\n { title: 'item-1', value: 1 },\n { title: 'item-2', value: 2 },\n { title: 'item-3', value: 3 },\n { title: 'item-4', value: 4 },\n { title: 'item-5', value: 5 },\n ],\n};\n"],"names":["codeString","Sortable_stories","Sortable","defaultArgs","fn","mockItems","Template","args","SortableExample","withHandleRight","TemplateComplex","jsx","item","jsxs","Fragment","InputField","Button","Icon","WithComplexChildren"],"mappings":";;;;;;;;AAYA,MAAMA,IAAa;AAAA,8HAInBC,IAAe;AAAA,EACb,OAAO;AAAA,EACP,WAAWC;AAAA,EACX,UAAU;AAAA,IACR,UAAU;AAAA,MACR,OAAO;AAAA,QACL,SAAS;AAAA,MAAA;AAAA,IACX;AAAA,IAEF,qBAAqB;AAAA,MACnB,OAAO;AAAA,QACL,SAAS;AAAA,MAAA;AAAA,IACX;AAAA,EACF;AAAA,EAEF,YAAY;AAAA,IACV,kBAAkBA;AAAA,IAClB,YAAAF;AAAA,EAAA;AAEJ,GAEMG,IAAsC;AAAA,EAC1C,qBAAqB;AAAA,EACrB,QAAQC,EAAA;AACV,GAEMC,IAAY,CAAC,UAAU,UAAU,UAAU,UAAU,QAAQ,GAE7DC,IAAmC,CAACC,wBAAUL,GAAA,EAAU,GAAGK,GAAO,UAAAF,GAAU,GAErEG,IAAkBF,EAAS,KAAK,CAAA,CAAE;AAC/CE,EAAgB,OAAO;AAAA,EACrB,GAAGL;AACL;AAEO,MAAMM,IAAkBH,EAAS,KAAK,CAAA,CAAE;AAC/CG,EAAgB,OAAO;AAAA,EACrB,GAAGN;AAAA,EACH,qBAAqB;AACvB;AAEA,MAAMO,IAA0C,CAACH,MAC/C,gBAAAI,EAACT,GAAA,EAAU,GAAGK,GACX,UAAAF,EAAU,IAAI,CAACO,MACd,gBAAAC,EAACC,GAAA,EACC,UAAA;AAAA,EAAA,gBAAAH,EAAC,OAAA,EAAI,OAAO,EAAE,OAAO,OAAA,GACnB,UAAA,gBAAAA,EAACI,GAAA,EAAsB,IAAIH,GAAM,aAAaA,EAAA,GAA7BA,CAAmC,GACtD;AAAA,EACA,gBAAAD,EAACK,GAAA,EAAO,SAAQ,cACd,UAAA,gBAAAL,EAACM,KAAK,MAAK,SAAQ,OAAM,YAAA,CAAY,EAAA,CACvC;AAAA,KANaL,CAOf,CACD,GACH,GAGWM,IAAsBR,EAAgB,KAAK,CAAA,CAAE;AAC1DQ,EAAoB,OAAO;AAAA,EACzB,GAAGf;AAAA,EACH,cAAc;AAAA,IACZ,EAAE,OAAO,UAAU,OAAO,EAAA;AAAA,IAC1B,EAAE,OAAO,UAAU,OAAO,EAAA;AAAA,IAC1B,EAAE,OAAO,UAAU,OAAO,EAAA;AAAA,IAC1B,EAAE,OAAO,UAAU,OAAO,EAAA;AAAA,IAC1B,EAAE,OAAO,UAAU,OAAO,EAAA;AAAA,EAAE;AAEhC;"}
@@ -1,5 +1,6 @@
1
- import { ReactElement } from 'react';
1
+ import { ReactElement, ReactNode } from 'react';
2
2
  import { SortableStateType } from './sortableReducer';
3
+ import { SortableItem, SortableItemProps } from './components/SortableItem';
3
4
  type SortableContextType = {
4
5
  clearDraggingSource: () => void;
5
6
  clearDraggingTarget: () => void;
@@ -12,13 +13,15 @@ type SortableContextType = {
12
13
  setDraggingSource: (index: number) => void;
13
14
  setDraggingTarget: (index: number) => void;
14
15
  };
15
- interface Props {
16
- children: SortableStateType['sortableItems'];
17
- items: ReactElement[] | string[];
16
+ type SortableItems = ReactElement<SortableItemProps, typeof SortableItem>[];
17
+ interface Props<T = unknown> {
18
+ renderItems: SortableItems;
19
+ dataItems: T[];
18
20
  scrollable?: boolean;
19
21
  hideNumbers?: boolean;
20
- onSort?: (items: (string | ReactElement)[]) => void;
22
+ onSort?: (items: T[]) => void;
23
+ children?: ReactNode;
21
24
  }
22
- export declare function SortableProvider({ children, items, scrollable, hideNumbers, onSort }: Props): import("react/jsx-runtime").JSX.Element;
25
+ export declare function SortableProvider<T>({ renderItems, dataItems, scrollable, hideNumbers, onSort }: Props<T>): import("react/jsx-runtime").JSX.Element;
23
26
  export declare function useSortable(): SortableContextType & SortableStateType;
24
27
  export {};
@@ -1,7 +1,7 @@
1
1
  import "react/jsx-runtime";
2
2
  import "react";
3
3
  import "./sortableReducer.js";
4
- import { S as p, u as a } from "../../SortableProvider-C2T7b-pm.js";
4
+ import { S as p, u as a } from "../../SortableProvider-DisCfTTN.js";
5
5
  import "./actions.js";
6
6
  export {
7
7
  p as SortableProvider,
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
2
2
  import "react";
3
3
  import "../../../clsx-OuTLNxxd.js";
4
4
  import "../../../Sortable.module--kgnzOjW.js";
5
- import { a } from "../../../SortableProvider-C2T7b-pm.js";
5
+ import { a } from "../../../SortableProvider-DisCfTTN.js";
6
6
  export {
7
7
  a as SortableContainer
8
8
  };
@@ -4,7 +4,7 @@ import { c as G } from "../../../clsx-OuTLNxxd.js";
4
4
  import { Icon as w } from "../../Icon/Icon.js";
5
5
  import { SortableHandle as E } from "./SortableHandle.js";
6
6
  import { s as e } from "../../../Sortable.module--kgnzOjW.js";
7
- import { u as J } from "../../../SortableProvider-C2T7b-pm.js";
7
+ import { u as J } from "../../../SortableProvider-DisCfTTN.js";
8
8
  const j = ["Space", "ArrowDown", "ArrowUp"], F = "ontouchstart" in globalThis.document.documentElement, C = new Image(0, 0);
9
9
  C.src = // 1px transparent png
10
10
  "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==";
@@ -3,9 +3,11 @@ export interface TextAreaProps {
3
3
  onChange: (value: string) => void;
4
4
  /** The label for the text area */
5
5
  label?: string;
6
+ /** Optional sub label for the text area */
7
+ subLabel?: string;
6
8
  /** The max amount of allowed charecters in the text area */
7
9
  maxCharacters?: number;
8
10
  /** The default value for the text area */
9
11
  defaultValue?: string;
10
12
  }
11
- export declare function TextArea({ onChange, label, maxCharacters, defaultValue }: TextAreaProps): import("react/jsx-runtime").JSX.Element;
13
+ export declare function TextArea({ onChange, label, subLabel, maxCharacters, defaultValue }: TextAreaProps): import("react/jsx-runtime").JSX.Element;
@@ -1,40 +1,45 @@
1
- import { jsxs as _, jsx as n } from "react/jsx-runtime";
1
+ import { jsxs as r, jsx as _ } from "react/jsx-runtime";
2
2
  import { useRef as x, useState as p } from "react";
3
3
  import { c as d } from "../../clsx-OuTLNxxd.js";
4
- import '../../assets/TextArea.css';const r = {
5
- "text-area__wrapper": "_text-area__wrapper_1pu93_1",
6
- "text-area__header": "_text-area__header_1pu93_7",
7
- "text-area__label": "_text-area__label_1pu93_13",
8
- "text-area__word-count": "_text-area__word-count_1pu93_20",
9
- "text-area__word-count--alert": "_text-area__word-count--alert_1pu93_25",
10
- "text-area": "_text-area_1pu93_1"
4
+ import '../../assets/TextArea.css';const e = {
5
+ "text-area__wrapper": "_text-area__wrapper_iztus_1",
6
+ "text-area__header": "_text-area__header_iztus_7",
7
+ "text-area__label-wrapper": "_text-area__label-wrapper_iztus_13",
8
+ "text-area__label": "_text-area__label_iztus_13",
9
+ "text-area__sub-label": "_text-area__sub-label_iztus_26",
10
+ "text-area__word-count": "_text-area__word-count_iztus_31",
11
+ "text-area__word-count--alert": "_text-area__word-count--alert_iztus_36",
12
+ "text-area": "_text-area_iztus_1"
11
13
  };
12
- function w({ onChange: u, label: a, maxCharacters: t = 0, defaultValue: c = "" }) {
13
- const e = x(null), [o, l] = p(0), s = () => {
14
- e.current && (e.current.style.height = "auto", e.current.style.height = `${e.current.scrollHeight}px`, l(e.current.value.length), u(e.current.value.trim()));
14
+ function b({ onChange: u, label: l, subLabel: s, maxCharacters: a = 0, defaultValue: c = "" }) {
15
+ const t = x(null), [n, o] = p(0), i = () => {
16
+ t.current && (t.current.style.height = "auto", t.current.style.height = `${t.current.scrollHeight}px`, o(t.current.value.length), u(t.current.value.trim()));
15
17
  };
16
- return /* @__PURE__ */ _("div", { className: r["text-area__wrapper"], children: [
17
- (a || t > 0) && /* @__PURE__ */ _("div", { className: r["text-area__header"], children: [
18
- a && /* @__PURE__ */ n("span", { className: r["text-area__label"], children: a }),
19
- t > 0 && /* @__PURE__ */ _("div", { className: r["text-area__word-count"], children: [
20
- /* @__PURE__ */ n("span", { className: d({ [r["text-area__word-count--alert"]]: o === t }), children: o }),
18
+ return /* @__PURE__ */ r("div", { className: e["text-area__wrapper"], children: [
19
+ (l || a > 0) && /* @__PURE__ */ r("div", { className: e["text-area__header"], children: [
20
+ /* @__PURE__ */ r("span", { className: e["text-area__label-wrapper"], children: [
21
+ l && /* @__PURE__ */ _("span", { className: e["text-area__label"], children: l }),
22
+ s && /* @__PURE__ */ _("span", { className: e["text-area__sub-label"], children: s })
23
+ ] }),
24
+ a > 0 && /* @__PURE__ */ r("div", { className: e["text-area__word-count"], children: [
25
+ /* @__PURE__ */ _("span", { className: d({ [e["text-area__word-count--alert"]]: n === a }), children: n }),
21
26
  " / ",
22
- t
27
+ a
23
28
  ] })
24
29
  ] }),
25
- /* @__PURE__ */ n(
30
+ /* @__PURE__ */ _(
26
31
  "textarea",
27
32
  {
28
- ref: e,
29
- className: r["text-area"],
30
- maxLength: t > 0 ? t : void 0,
31
- onInput: s,
33
+ ref: t,
34
+ className: e["text-area"],
35
+ maxLength: a > 0 ? a : void 0,
36
+ onInput: i,
32
37
  defaultValue: c
33
38
  }
34
39
  )
35
40
  ] });
36
41
  }
37
42
  export {
38
- w as TextArea
43
+ b as TextArea
39
44
  };
40
45
  //# sourceMappingURL=TextArea.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.js","sources":["../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import { useRef, useState } from 'react';\nimport { clsx } from 'clsx';\n\nimport styles from './TextArea.module.css';\n\nexport interface TextAreaProps {\n /** Returns entered values as trimmed string */\n onChange: (value: string) => void;\n /** The label for the text area */\n label?: string;\n /** The max amount of allowed charecters in the text area */\n maxCharacters?: number;\n /** The default value for the text area */\n defaultValue?: string;\n}\n\nexport function TextArea({ onChange, label, maxCharacters = 0, defaultValue = '' }: TextAreaProps) {\n const textAreaRef = useRef<HTMLTextAreaElement>(null);\n const [characterCount, setCharacterCount] = useState(0);\n\n const handleInput = () => {\n if (textAreaRef.current) {\n textAreaRef.current.style.height = 'auto';\n textAreaRef.current.style.height = `${textAreaRef.current.scrollHeight}px`;\n\n setCharacterCount(textAreaRef.current.value.length);\n onChange(textAreaRef.current.value.trim());\n }\n };\n\n return (\n <div className={styles['text-area__wrapper']}>\n {(label || maxCharacters > 0) && (\n <div className={styles['text-area__header']}>\n {label && <span className={styles['text-area__label']}>{label}</span>}\n {maxCharacters > 0 && (\n <div className={styles['text-area__word-count']}>\n <span className={clsx({ [styles['text-area__word-count--alert']]: characterCount === maxCharacters })}>\n {characterCount}\n </span>\n &nbsp;/&nbsp;{maxCharacters}\n </div>\n )}\n </div>\n )}\n\n <textarea\n ref={textAreaRef}\n className={styles['text-area']}\n maxLength={maxCharacters > 0 ? maxCharacters : undefined}\n onInput={handleInput}\n defaultValue={defaultValue}\n />\n </div>\n );\n}\n"],"names":["TextArea","onChange","label","maxCharacters","defaultValue","textAreaRef","useRef","characterCount","setCharacterCount","useState","handleInput","jsxs","styles","jsx","clsx"],"mappings":";;;;;;;;;;;AAgBO,SAASA,EAAS,EAAE,UAAAC,GAAU,OAAAC,GAAO,eAAAC,IAAgB,GAAG,cAAAC,IAAe,MAAqB;AACjG,QAAMC,IAAcC,EAA4B,IAAI,GAC9C,CAACC,GAAgBC,CAAiB,IAAIC,EAAS,CAAC,GAEhDC,IAAc,MAAM;AACxB,IAAIL,EAAY,YACdA,EAAY,QAAQ,MAAM,SAAS,QACnCA,EAAY,QAAQ,MAAM,SAAS,GAAGA,EAAY,QAAQ,YAAY,MAEtEG,EAAkBH,EAAY,QAAQ,MAAM,MAAM,GAClDJ,EAASI,EAAY,QAAQ,MAAM,KAAA,CAAM;AAAA,EAC3C;AAGF,SACE,gBAAAM,EAAC,OAAA,EAAI,WAAWC,EAAO,oBAAoB,GACvC,UAAA;AAAA,KAAAV,KAASC,IAAgB,MACzB,gBAAAQ,EAAC,SAAI,WAAWC,EAAO,mBAAmB,GACvC,UAAA;AAAA,MAAAV,uBAAU,QAAA,EAAK,WAAWU,EAAO,kBAAkB,GAAI,UAAAV,GAAM;AAAA,MAC7DC,IAAgB,KACf,gBAAAQ,EAAC,SAAI,WAAWC,EAAO,uBAAuB,GAC5C,UAAA;AAAA,QAAA,gBAAAC,EAAC,QAAA,EAAK,WAAWC,EAAK,EAAE,CAACF,EAAO,8BAA8B,CAAC,GAAGL,MAAmBJ,EAAA,CAAe,GACjG,UAAAI,EAAA,CACH;AAAA,QAAO;AAAA,QACOJ;AAAA,MAAA,EAAA,CAChB;AAAA,IAAA,GAEJ;AAAA,IAGF,gBAAAU;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAKR;AAAA,QACL,WAAWO,EAAO,WAAW;AAAA,QAC7B,WAAWT,IAAgB,IAAIA,IAAgB;AAAA,QAC/C,SAASO;AAAA,QACT,cAAAN;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
1
+ {"version":3,"file":"TextArea.js","sources":["../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import { useRef, useState } from 'react';\nimport { clsx } from 'clsx';\n\nimport styles from './TextArea.module.css';\n\nexport interface TextAreaProps {\n /** Returns entered values as trimmed string */\n onChange: (value: string) => void;\n /** The label for the text area */\n label?: string;\n /** Optional sub label for the text area */\n subLabel?: string;\n /** The max amount of allowed charecters in the text area */\n maxCharacters?: number;\n /** The default value for the text area */\n defaultValue?: string;\n}\n\nexport function TextArea({ onChange, label, subLabel, maxCharacters = 0, defaultValue = '' }: TextAreaProps) {\n const textAreaRef = useRef<HTMLTextAreaElement>(null);\n const [characterCount, setCharacterCount] = useState(0);\n\n const handleInput = () => {\n if (textAreaRef.current) {\n textAreaRef.current.style.height = 'auto';\n textAreaRef.current.style.height = `${textAreaRef.current.scrollHeight}px`;\n\n setCharacterCount(textAreaRef.current.value.length);\n onChange(textAreaRef.current.value.trim());\n }\n };\n\n return (\n <div className={styles['text-area__wrapper']}>\n {(label || maxCharacters > 0) && (\n <div className={styles['text-area__header']}>\n <span className={styles['text-area__label-wrapper']}>\n {label && <span className={styles['text-area__label']}>{label}</span>}\n {subLabel && <span className={styles['text-area__sub-label']}>{subLabel}</span>}\n </span>\n {maxCharacters > 0 && (\n <div className={styles['text-area__word-count']}>\n <span className={clsx({ [styles['text-area__word-count--alert']]: characterCount === maxCharacters })}>\n {characterCount}\n </span>\n &nbsp;/&nbsp;{maxCharacters}\n </div>\n )}\n </div>\n )}\n\n <textarea\n ref={textAreaRef}\n className={styles['text-area']}\n maxLength={maxCharacters > 0 ? maxCharacters : undefined}\n onInput={handleInput}\n defaultValue={defaultValue}\n />\n </div>\n );\n}\n"],"names":["TextArea","onChange","label","subLabel","maxCharacters","defaultValue","textAreaRef","useRef","characterCount","setCharacterCount","useState","handleInput","jsxs","styles","jsx","clsx"],"mappings":";;;;;;;;;;;;;AAkBO,SAASA,EAAS,EAAE,UAAAC,GAAU,OAAAC,GAAO,UAAAC,GAAU,eAAAC,IAAgB,GAAG,cAAAC,IAAe,MAAqB;AAC3G,QAAMC,IAAcC,EAA4B,IAAI,GAC9C,CAACC,GAAgBC,CAAiB,IAAIC,EAAS,CAAC,GAEhDC,IAAc,MAAM;AACxB,IAAIL,EAAY,YACdA,EAAY,QAAQ,MAAM,SAAS,QACnCA,EAAY,QAAQ,MAAM,SAAS,GAAGA,EAAY,QAAQ,YAAY,MAEtEG,EAAkBH,EAAY,QAAQ,MAAM,MAAM,GAClDL,EAASK,EAAY,QAAQ,MAAM,KAAA,CAAM;AAAA,EAC3C;AAGF,SACE,gBAAAM,EAAC,OAAA,EAAI,WAAWC,EAAO,oBAAoB,GACvC,UAAA;AAAA,KAAAX,KAASE,IAAgB,MACzB,gBAAAQ,EAAC,SAAI,WAAWC,EAAO,mBAAmB,GACxC,UAAA;AAAA,MAAA,gBAAAD,EAAC,QAAA,EAAK,WAAWC,EAAO,0BAA0B,GAC/C,UAAA;AAAA,QAAAX,uBAAU,QAAA,EAAK,WAAWW,EAAO,kBAAkB,GAAI,UAAAX,GAAM;AAAA,QAC7DC,KAAY,gBAAAW,EAAC,QAAA,EAAK,WAAWD,EAAO,sBAAsB,GAAI,UAAAV,EAAA,CAAS;AAAA,MAAA,GAC1E;AAAA,MACCC,IAAgB,KACf,gBAAAQ,EAAC,SAAI,WAAWC,EAAO,uBAAuB,GAC5C,UAAA;AAAA,QAAA,gBAAAC,EAAC,QAAA,EAAK,WAAWC,EAAK,EAAE,CAACF,EAAO,8BAA8B,CAAC,GAAGL,MAAmBJ,EAAA,CAAe,GACjG,UAAAI,EAAA,CACH;AAAA,QAAO;AAAA,QACOJ;AAAA,MAAA,EAAA,CAChB;AAAA,IAAA,GAEJ;AAAA,IAGF,gBAAAU;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAKR;AAAA,QACL,WAAWO,EAAO,WAAW;AAAA,QAC7B,WAAWT,IAAgB,IAAIA,IAAgB;AAAA,QAC/C,SAASO;AAAA,QACT,cAAAN;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
@@ -3,3 +3,4 @@ import { TextAreaProps } from './TextArea';
3
3
  declare const _default: Meta<TextAreaProps>;
4
4
  export default _default;
5
5
  export declare const TextAreaExample: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, TextAreaProps>;
6
+ export declare const TextAreaSubtitleExample: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, TextAreaProps>;
@@ -1,31 +1,30 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { l as r } from "../../index-C2E9FY6V.js";
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { l as a } from "../../index-C2E9FY6V.js";
3
3
  import { TextArea as e } from "./TextArea.js";
4
- const l = `
5
- <TextArea label={label} maxCharacters={maxCharacters} defaultValue={string}/> `, p = {
4
+ const o = `
5
+ <TextArea label={label} maxCharacters={maxCharacters} defaultValue={string}/> `, x = {
6
6
  title: "Atoms/TextArea",
7
7
  component: e,
8
- argTypes: {
9
- label: {
10
- control: "text"
11
- },
12
- maxCharacters: {
13
- control: "number"
14
- }
15
- },
16
- parameters: {
17
- inspectComponent: e,
18
- codeString: l
19
- }
20
- }, o = (a) => /* @__PURE__ */ t(e, { ...a }), m = o.bind({});
8
+ argTypes: { label: { control: "text" }, maxCharacters: { control: "number" } },
9
+ parameters: { inspectComponent: e, codeString: o }
10
+ }, t = (l) => /* @__PURE__ */ r(e, { ...l }), m = t.bind({});
21
11
  m.args = {
22
12
  label: "Sample label",
23
13
  maxCharacters: 140,
24
14
  defaultValue: "Sample default value",
25
- onChange: r()
15
+ onChange: a()
16
+ };
17
+ const s = t.bind({});
18
+ s.args = {
19
+ label: "Sample label",
20
+ subLabel: "Sample sub label",
21
+ maxCharacters: 140,
22
+ defaultValue: "Sample default value",
23
+ onChange: a()
26
24
  };
27
25
  export {
28
26
  m as TextAreaExample,
29
- p as default
27
+ s as TextAreaSubtitleExample,
28
+ x as default
30
29
  };
31
30
  //# sourceMappingURL=TextArea.stories.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.stories.js","sources":["../../../src/components/TextArea/TextArea.stories.tsx"],"sourcesContent":["import { fn } from 'storybook/test';\n\nimport type { Meta, StoryFn } from '@storybook/react';\nimport type { TextAreaProps } from './TextArea';\n\nimport { TextArea } from './TextArea';\n\nconst codeString = `\n <TextArea label={label} maxCharacters={maxCharacters} defaultValue={string}/> `;\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Atoms/TextArea',\n component: TextArea,\n argTypes: {\n label: {\n control: 'text',\n },\n maxCharacters: {\n control: 'number',\n },\n },\n parameters: {\n inspectComponent: TextArea,\n codeString: codeString,\n },\n} as Meta<TextAreaProps>;\n\nconst Template: StoryFn<TextAreaProps> = (args) => <TextArea {...args} />;\n\nexport const TextAreaExample = Template.bind({});\nTextAreaExample.args = {\n label: 'Sample label',\n maxCharacters: 140,\n defaultValue: 'Sample default value',\n onChange: fn(),\n};\n"],"names":["codeString","TextArea_stories","TextArea","Template","args","jsx","TextAreaExample","fn"],"mappings":";;;AAOA,MAAMA,IAAa;AAAA,mFAInBC,IAAe;AAAA,EACb,OAAO;AAAA,EACP,WAAWC;AAAA,EACX,UAAU;AAAA,IACR,OAAO;AAAA,MACL,SAAS;AAAA,IAAA;AAAA,IAEX,eAAe;AAAA,MACb,SAAS;AAAA,IAAA;AAAA,EACX;AAAA,EAEF,YAAY;AAAA,IACV,kBAAkBA;AAAA,IAClB,YAAAF;AAAA,EAAA;AAEJ,GAEMG,IAAmC,CAACC,MAAS,gBAAAC,EAACH,GAAA,EAAU,GAAGE,GAAM,GAE1DE,IAAkBH,EAAS,KAAK,CAAA,CAAE;AAC/CG,EAAgB,OAAO;AAAA,EACrB,OAAO;AAAA,EACP,eAAe;AAAA,EACf,cAAc;AAAA,EACd,UAAUC,EAAA;AACZ;"}
1
+ {"version":3,"file":"TextArea.stories.js","sources":["../../../src/components/TextArea/TextArea.stories.tsx"],"sourcesContent":["import { fn } from 'storybook/test';\n\nimport type { Meta, StoryFn } from '@storybook/react';\nimport type { TextAreaProps } from './TextArea';\n\nimport { TextArea } from './TextArea';\n\nconst codeString = `\n <TextArea label={label} maxCharacters={maxCharacters} defaultValue={string}/> `;\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Atoms/TextArea',\n component: TextArea,\n argTypes: { label: { control: 'text' }, maxCharacters: { control: 'number' } },\n parameters: { inspectComponent: TextArea, codeString: codeString },\n} as Meta<TextAreaProps>;\n\nconst Template: StoryFn<TextAreaProps> = (args) => <TextArea {...args} />;\n\nexport const TextAreaExample = Template.bind({});\nTextAreaExample.args = {\n label: 'Sample label',\n maxCharacters: 140,\n defaultValue: 'Sample default value',\n onChange: fn(),\n};\n\nexport const TextAreaSubtitleExample = Template.bind({});\nTextAreaSubtitleExample.args = {\n label: 'Sample label',\n subLabel: 'Sample sub label',\n maxCharacters: 140,\n defaultValue: 'Sample default value',\n onChange: fn(),\n};\n"],"names":["codeString","TextArea_stories","TextArea","Template","args","jsx","TextAreaExample","fn","TextAreaSubtitleExample"],"mappings":";;;AAOA,MAAMA,IAAa;AAAA,mFAInBC,IAAe;AAAA,EACb,OAAO;AAAA,EACP,WAAWC;AAAA,EACX,UAAU,EAAE,OAAO,EAAE,SAAS,OAAA,GAAU,eAAe,EAAE,SAAS,WAAS;AAAA,EAC3E,YAAY,EAAE,kBAAkBA,GAAU,YAAAF,EAAA;AAC5C,GAEMG,IAAmC,CAACC,MAAS,gBAAAC,EAACH,GAAA,EAAU,GAAGE,GAAM,GAE1DE,IAAkBH,EAAS,KAAK,CAAA,CAAE;AAC/CG,EAAgB,OAAO;AAAA,EACrB,OAAO;AAAA,EACP,eAAe;AAAA,EACf,cAAc;AAAA,EACd,UAAUC,EAAA;AACZ;AAEO,MAAMC,IAA0BL,EAAS,KAAK,CAAA,CAAE;AACvDK,EAAwB,OAAO;AAAA,EAC7B,OAAO;AAAA,EACP,UAAU;AAAA,EACV,eAAe;AAAA,EACf,cAAc;AAAA,EACd,UAAUD,EAAA;AACZ;"}
@@ -35,7 +35,7 @@ import { Label as Bo } from "./Label/Label.js";
35
35
  import { MenuLink as So } from "./MenuLink/MenuLink.js";
36
36
  import { MetaDataList as Co } from "./MetaDataList/MetaDataList.js";
37
37
  import { ModalDialog as ko } from "./ModalDialog/ModalDialog.js";
38
- import { M as Mo } from "../TablePlugin-Dmy98Epb.js";
38
+ import { M as Mo } from "../TablePlugin-oF-gInNx.js";
39
39
  import { MultiSelectBox as Lo } from "./MultiSelectBox/MultiSelectBox.js";
40
40
  import { Notification as Ro } from "./Notification/Notification.js";
41
41
  import { OverlayCloseButton as ho } from "./OverlayCloseButton/OverlayCloseButton.js";
package/dist/index.js CHANGED
@@ -35,7 +35,7 @@ import { Label as Bo } from "./components/Label/Label.js";
35
35
  import { MenuLink as So } from "./components/MenuLink/MenuLink.js";
36
36
  import { MetaDataList as Co } from "./components/MetaDataList/MetaDataList.js";
37
37
  import { ModalDialog as ko } from "./components/ModalDialog/ModalDialog.js";
38
- import { M as Mo } from "./TablePlugin-Dmy98Epb.js";
38
+ import { M as Mo } from "./TablePlugin-oF-gInNx.js";
39
39
  import { MultiSelectBox as Lo } from "./components/MultiSelectBox/MultiSelectBox.js";
40
40
  import { Notification as Ro } from "./components/Notification/Notification.js";
41
41
  import { OverlayCloseButton as ho } from "./components/OverlayCloseButton/OverlayCloseButton.js";
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@uva-glass/component-library",
3
3
  "author": "Team Glass - Frontend vrienden",
4
4
  "private": false,
5
- "version": "3.31.0",
5
+ "version": "3.32.1",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",