@rio-cloud/rio-uikit 2.0.0-beta.2 → 2.0.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.
package/README.md CHANGED
@@ -6,97 +6,98 @@ The documentation and how to integrate the UIKIT in your project can be found he
6
6
 
7
7
  ## Changelog
8
8
 
9
- All changes, updates, and improvements for each version are documented in the changelog (https://uikit.developers.rio.cloud/#start/changelog). Refer to it for a detailed overview of new features, bug fixes, and other modifications.
9
+ All changes, updates, and improvements for each version are documented in the changelog (https://uikit.developers.rio.cloud/#start/changelog). Capture entries during development as work lands, and add the release date when you cut a release.
10
+
11
+ ## Development
12
+
13
+ To run the UIKIT and the UIKIT Demo locally for development, use:
14
+
15
+ ```bash
16
+ npm install && cd uikit-demo/ && npm i && npm start
17
+ ```
18
+
19
+ The UIKIT demo is accessible at http://localhost:8090.
10
20
 
11
21
  ## Release
12
22
 
13
- Starting with version `0.12.8`, all versions of the uikit will be available under https://uikit.developers.rio.cloud/${VERSION}/.
23
+ All versions of the UIKIT will be available under https://uikit.developers.rio.cloud/${VERSION}/.
14
24
 
15
- Starting with version `0.14.6`, even the corresponding uikit-demo will be published under https://uikit.developers.rio.cloud/${VERSION}/.
25
+ All changes made on `master` will be deployed to https://uikit.developers.rio.cloud/latest/ as our current development branch.
16
26
 
17
- All changes made on `master` will be deployed to https://uikit.developers.rio.cloud/latest/.
27
+ Release workflow (for stable and beta):
18
28
 
19
- When releasing a new version:
29
+ 1. From `master`, create a branch named `release/v${VERSION}` (e.g., `release/v2.1.0`) and push the empty branch to origin immediately. This initial push is required to let the CI/CD release pipeline initialize.
30
+ 2. Bump versions: `package.json`, both version fields in `package-lock.json`, and `src/version.json`. For betas use `x.y.z-beta.n`. Update `uikit-demo/src/sites/start/Changelog.tsx` with date/notes.
31
+ 3. Commit the version/changelog changes to `release/v${VERSION}` and push. This push triggers the release pipeline that publishes the demo/CSS to CDN (this is the deploy step).
32
+ 4. Publish the JavaScript package to npm manually (see “Publishing to NPM (manual)” below) — there is no automation for npm publishes.
33
+ 5. After the demo is live, update `versionsList.json` on `master` so the new version appears (and adjust `latest_release`/`latest` if applicable).
34
+ 6. Once the release is done, merge the release branch back into `master` and continue new work on `master`.
20
35
 
21
- 1. Create new `release/${VERSION}` branch and trigger pipeline with a commit
22
- 2. After the new uikit-demo is published, update `versionsList.json` in `master` branch.
36
+ ## Publishing to NPM (manual)
23
37
 
24
- Create a new development beta version:
38
+ The UIKIT JavaScript package is **always** published manually.
25
39
 
26
- 1. Update the `package.json`. Example `1.2.4-beta.1`
27
- 2. Update the `src/version.json`. Example `1.2.4-beta.1`
28
- 3. Update the `src/versionList.json`. Example `1.2.4`
29
- 4. run `npm i` or update `package-lock.json`. Example `1.2.4-beta.1`
40
+ Run this after pushing the release branch changes (steps above) and before updating `versionsList.json`; it is separate from the release pipeline.
30
41
 
31
- ## Development
42
+ 1. Run `npm run build` to generate the output.
43
+ 2. `cd package` (publish only from this folder; build copies the needed files here).
44
+ 3. Ensure you are logged in to npm CLI with access to [@rio-cloud/rio-uikit](https://www.npmjs.com/package/@rio-cloud/rio-uikit).
45
+ 4. Run `npm publish --access public` for stable releases (for betas, use `npm publish --access public --tag beta`).
46
+ 5. After publishing, bump to the next version in `package.json`, `package-lock.json` (both top-level entries), and `src/version.json` to avoid reusing the same version on subsequent work.
32
47
 
33
- To run the UIKIT and the UIKIT Demo locally for development, use:
48
+ ## Publishing to UIKIT CDN / demo
34
49
 
35
- ```bash
36
- $ npm install && cd uikit-demo/ && npm i && npm start
37
- ```
50
+ This is handled by the release pipeline when you push commits to a `release/v${VERSION}` branch (see “Release workflow”). The pipeline publishes `dist` and the demo to the CDN. Run `npm run build` locally if you want to inspect artifacts before pushing.
38
51
 
39
- The UIKIT demo is accessible at http://localhost:8090.
52
+ ### Beta versions
53
+
54
+ Beta versions should stay in sync across npm and CDN. After publishing a beta, immediately bump to the next beta version to avoid overwriting assets.
40
55
 
41
56
  ## Versions List
42
57
 
43
- We introduced a versions list containing all the versions for which a uikit-demo exists. It looks as follows.
58
+ All the versions for which a uikit-demo exists are listed in versionList.json. Update this after a release so the new version (and latest beta) are reflected, typically right after you confirm the demo/CDN deployment is live.
59
+
60
+ Example:
44
61
 
45
62
  ```json
46
63
  {
47
- "latest_release": "0.15.1",
64
+ "latest_release": "1.13.2",
48
65
  "versions": [
49
66
  {
50
- "id": "0.16.0",
51
- "label": "v0.16.0",
67
+ "id": "2.0.0",
68
+ "label": "v2.0.0",
52
69
  "path": "latest/",
53
70
  "url": "https://uikit.developers.rio.cloud/latest/",
54
71
  "tag": "Beta"
55
72
  },
56
73
  {
57
- "id": "0.15.1",
58
- "label": "v0.15.1",
59
- "path": "0.15.1/",
60
- "url": "https://uikit.developers.rio.cloud/0.15.1/"
74
+ "id": "1.13.2",
75
+ "label": "v1.13.2",
76
+ "path": "1.13.2/",
77
+ "url": "https://uikit.developers.rio.cloud/1.13.2/"
78
+ },
79
+ {
80
+ "id": "1.13.1",
81
+ "label": "v1.13.1",
82
+ "path": "1.13.1/",
83
+ "url": "https://uikit.developers.rio.cloud/1.13.1/"
61
84
  },
62
85
  {
63
- "id": "0.15.0",
64
- "label": "v0.15.0",
65
- "path": "0.15.0/",
66
- "url": "https://uikit.developers.rio.cloud/0.15.0/"
86
+ "id": "1.13.0",
87
+ "label": "v1.13.0",
88
+ "path": "1.13.0/",
89
+ "url": "https://uikit.developers.rio.cloud/1.13.0/"
67
90
  },
68
91
  {
69
- "id": "0.14.6",
70
- "label": "v0.14.6",
71
- "path": "0.14.6/",
72
- "url": "https://uikit.developers.rio.cloud/0.14.6/"
92
+ "id": "1.12.0",
93
+ "label": "v1.12.0",
94
+ "path": "1.12.0/",
95
+ "url": "https://uikit.developers.rio.cloud/1.12.0/"
73
96
  }
74
97
  ]
75
98
  }
76
99
  ```
77
100
 
78
- ## How to publish
79
-
80
- The UIKIT needs to be published to NPM for the JavaScript components and the UIKIT CDN for the CSS files.
81
-
82
- ### Publish to NPM
83
-
84
- **Publish** the UIKIT **only from** the **package** folder. All required files like package.json, README and License files are copied there during the build.
85
-
86
- 1. Run `npm run build && npm run build:npm` in order to generate the output.
87
- 2. Switch into the [package](package) folder.
88
- 3. Make sure you're logged in to npm's CLI and have the appropriate access rights to [the NPM package](https://www.npmjs.com/package/@rio-cloud/rio-uikit).
89
- 4. Run `npm publish --access public` to perform the actual publishing.
90
- 5. Update the version number to the next applicable one in [package.json](package.json), [package-lock.json](package-lock.json) (attention: two places to edit!) and of course [src/version.json](src/version.json).
91
-
92
- ### Publishing to UIKIT CDN
93
-
94
- Run `npm run build` to build the production bundle and compile the styles to inspect locally. When committing to the main development branch the build outcome from `dist` is published via our internal CICD pipeline.
95
-
96
- ### Beta Versions
97
-
98
- Beta versions of the UIKIT ideally should be kept in synch in NPM and CDN. After a new beta has been released, increase the version number to avoid overwriting published stylings.
99
-
100
101
  ## License
101
102
 
102
103
  RIO UIKIT is licensed under the Apache 2.0 license.
@@ -1,8 +1,8 @@
1
1
  import { AreaProps as RechartsAreaProps } from 'recharts';
2
2
  import { CurveType } from 'recharts/types/shape/Curve';
3
- export type AreaProps = Omit<RechartsAreaProps, 'ref'> & {
3
+ export type AreaProps<T = unknown> = Omit<RechartsAreaProps, 'ref'> & {
4
4
  strokeColor?: string;
5
- dataKey?: string;
5
+ dataKey?: string | number | ((obj: T) => unknown);
6
6
  unit?: string;
7
7
  legendType?: string;
8
8
  type?: CurveType;
@@ -1 +1 @@
1
- {"version":3,"file":"Area.js","sources":["../../../src/components/charts/Area.tsx"],"sourcesContent":["/* eslint-disable react/prop-types */\nimport type { AreaProps as RechartsAreaProps } from 'recharts';\nimport type { CurveType } from 'recharts/types/shape/Curve';\n\nexport type AreaProps = Omit<RechartsAreaProps, 'ref'> & {\n strokeColor?: string;\n dataKey?: string;\n unit?: string;\n legendType?: string;\n type?: CurveType;\n isAnimationActive?: boolean;\n};\n\nexport const getAreaDefaultProps = () => ({\n dataKey: 'value',\n unit: '',\n strokeColor: 'color-coldplay-fountain',\n legendType: 'square',\n type: 'monotone',\n isAnimationActive: true,\n});\n\nconst Area = (props: AreaProps) => null;\n\nexport default Area;\n"],"names":["getAreaDefaultProps","Area","props"],"mappings":"AAaO,MAAMA,IAAsB,OAAO;AAAA,EACtC,SAAS;AAAA,EACT,MAAM;AAAA,EACN,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,mBAAmB;AACvB,IAEMC,IAAO,CAACC,MAAqB;"}
1
+ {"version":3,"file":"Area.js","sources":["../../../src/components/charts/Area.tsx"],"sourcesContent":["/* eslint-disable react/prop-types */\nimport type { AreaProps as RechartsAreaProps } from 'recharts';\nimport type { CurveType } from 'recharts/types/shape/Curve';\n\nexport type AreaProps<T = unknown> = Omit<RechartsAreaProps, 'ref'> & {\n strokeColor?: string;\n dataKey?: string | number | ((obj: T) => unknown);\n unit?: string;\n legendType?: string;\n type?: CurveType;\n isAnimationActive?: boolean;\n};\n\nexport const getAreaDefaultProps = () => ({\n dataKey: 'value',\n unit: '',\n strokeColor: 'color-coldplay-fountain',\n legendType: 'square',\n type: 'monotone',\n isAnimationActive: true,\n});\n\nconst Area = (props: AreaProps) => null;\n\nexport default Area;\n"],"names":["getAreaDefaultProps","Area","props"],"mappings":"AAaO,MAAMA,IAAsB,OAAO;AAAA,EACtC,SAAS;AAAA,EACT,MAAM;AAAA,EACN,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,mBAAmB;AACvB,IAEMC,IAAO,CAACC,MAAqB;"}
@@ -1,8 +1,8 @@
1
1
  import { LineProps as RechartsLineProps } from 'recharts';
2
2
  import { CurveType } from 'recharts/types/shape/Curve';
3
- export type LineProps = Omit<RechartsLineProps, 'ref'> & {
3
+ export type LineProps<T = unknown> = Omit<RechartsLineProps, 'ref'> & {
4
4
  strokeColor?: string;
5
- dataKey?: string;
5
+ dataKey?: string | number | ((obj: T) => unknown);
6
6
  unit?: string;
7
7
  legendType?: string;
8
8
  type?: CurveType;
@@ -1 +1 @@
1
- {"version":3,"file":"Line.js","sources":["../../../src/components/charts/Line.tsx"],"sourcesContent":["/* eslint-disable react/prop-types */\nimport type { LineProps as RechartsLineProps } from 'recharts';\nimport type { CurveType } from 'recharts/types/shape/Curve';\n\nexport type LineProps = Omit<RechartsLineProps, 'ref'> & {\n strokeColor?: string;\n dataKey?: string;\n unit?: string;\n legendType?: string;\n type?: CurveType;\n isAnimationActive?: boolean;\n};\n\nexport const getLineDefaultProps = () => ({\n dataKey: 'value',\n unit: '',\n strokeColor: 'color-coldplay-fountain',\n legendType: 'square',\n type: 'monotone',\n isAnimationActive: true,\n});\n\nconst Line = (props: LineProps) => null;\n\nexport default Line;\n"],"names":["getLineDefaultProps","Line","props"],"mappings":"AAaO,MAAMA,IAAsB,OAAO;AAAA,EACtC,SAAS;AAAA,EACT,MAAM;AAAA,EACN,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,mBAAmB;AACvB,IAEMC,IAAO,CAACC,MAAqB;"}
1
+ {"version":3,"file":"Line.js","sources":["../../../src/components/charts/Line.tsx"],"sourcesContent":["/* eslint-disable react/prop-types */\nimport type { LineProps as RechartsLineProps } from 'recharts';\nimport type { CurveType } from 'recharts/types/shape/Curve';\n\nexport type LineProps<T = unknown> = Omit<RechartsLineProps, 'ref'> & {\n strokeColor?: string;\n dataKey?: string | number | ((obj: T) => unknown);\n unit?: string;\n legendType?: string;\n type?: CurveType;\n isAnimationActive?: boolean;\n};\n\nexport const getLineDefaultProps = () => ({\n dataKey: 'value',\n unit: '',\n strokeColor: 'color-coldplay-fountain',\n legendType: 'square',\n type: 'monotone',\n isAnimationActive: true,\n});\n\nconst Line = (props: LineProps) => null;\n\nexport default Line;\n"],"names":["getLineDefaultProps","Line","props"],"mappings":"AAaO,MAAMA,IAAsB,OAAO;AAAA,EACtC,SAAS;AAAA,EACT,MAAM;AAAA,EACN,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,mBAAmB;AACvB,IAEMC,IAAO,CAACC,MAAqB;"}
@@ -1,6 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
  import { Moment } from 'moment';
3
- import { default as Datetime, DatetimepickerProps } from 'react-datetime';
3
+ import { default as DatetimeImport, DatetimepickerProps } from 'react-datetime';
4
4
  export type DatePickerProps = Omit<DatetimepickerProps, 'onChange' | 'initialValue'> & {
5
5
  /**
6
6
  * An id used for the internal input element.
@@ -85,7 +85,7 @@ export type DatePickerProps = Omit<DatetimepickerProps, 'onChange' | 'initialVal
85
85
  */
86
86
  className?: string;
87
87
  };
88
- declare const DatePicker: React.ForwardRefExoticComponent<Omit<Datetime.DatetimepickerProps, "onChange" | "initialValue"> & {
88
+ declare const DatePicker: React.ForwardRefExoticComponent<Omit<DatetimeImport.DatetimepickerProps, "onChange" | "initialValue"> & {
89
89
  /**
90
90
  * An id used for the internal input element.
91
91
  */
@@ -1,42 +1,42 @@
1
1
  import { jsx as C } from "react/jsx-runtime";
2
- import { forwardRef as I, useState as L } from "react";
3
- import N from "classnames";
4
- import O from "react-datetime";
2
+ import { forwardRef as L, useState as N } from "react";
3
+ import O from "classnames";
4
+ import o from "react-datetime";
5
5
  import { noop as A } from "es-toolkit/function";
6
- const _ = "en-GB", k = 0, T = I((a, x) => {
6
+ const _ = o?.default ? o.default : o, k = "en-GB", x = 0, U = L((s, y) => {
7
7
  const {
8
- id: s,
9
- dropup: n = !1,
10
- alignRight: c = !1,
11
- locale: i = _,
12
- minWidth: p = k,
13
- onChange: l = A,
14
- mandatory: m = !0,
8
+ id: n,
9
+ dropup: c = !1,
10
+ alignRight: i = !1,
11
+ locale: l = k,
12
+ minWidth: p = x,
13
+ onChange: m = A,
14
+ mandatory: f = !0,
15
15
  dateValidation: r,
16
- clearableInput: f = !1,
17
- closeOnSelect: u = !0,
18
- inputProps: d,
19
- className: o,
20
- ...h
21
- } = a, [g, D] = L(!1), P = (e) => r ? r(e) : typeof e == "object", E = (e) => {
22
- const t = m ? P(e) : !0;
23
- D(!t), l(e, t);
24
- }, b = N(
16
+ clearableInput: u = !1,
17
+ closeOnSelect: d = !0,
18
+ inputProps: h,
19
+ className: a,
20
+ ...D
21
+ } = s, [g, P] = N(!1), E = (t) => r ? r(t) : typeof t == "object", I = (t) => {
22
+ const e = f ? E(t) : !0;
23
+ P(!e), m(t, e);
24
+ }, b = O(
25
25
  "DatePicker",
26
26
  "form-group",
27
27
  g && "has-error",
28
- n && "dropup",
29
- c && "align-right",
30
- o && o
31
- ), j = { id: s, ...d };
28
+ c && "dropup",
29
+ i && "align-right",
30
+ a && a
31
+ ), j = { id: n, ...h };
32
32
  return /* @__PURE__ */ C(
33
- O,
33
+ _,
34
34
  {
35
- ...h,
36
- locale: i,
37
- clearableInput: f,
38
- closeOnSelect: u,
39
- onChange: E,
35
+ ...D,
36
+ locale: l,
37
+ clearableInput: u,
38
+ closeOnSelect: d,
39
+ onChange: I,
40
40
  minWidth: p,
41
41
  inputProps: j,
42
42
  className: b
@@ -44,6 +44,6 @@ const _ = "en-GB", k = 0, T = I((a, x) => {
44
44
  );
45
45
  });
46
46
  export {
47
- T as default
47
+ U as default
48
48
  };
49
49
  //# sourceMappingURL=DatePicker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.js","sources":["../../../src/components/datepicker/DatePicker.tsx"],"sourcesContent":["import type React from 'react';\nimport { useState, forwardRef } from 'react';\nimport classNames from 'classnames';\nimport type { Moment } from 'moment';\nimport Datetime, { type DatetimepickerProps } from 'react-datetime';\nimport { noop } from 'es-toolkit/function';\n\nconst DEFAULT_LOCALE = 'en-GB';\nconst DEFAULT_MIN_WIDTH = 0;\n\nexport type DatePickerProps = Omit<DatetimepickerProps, 'onChange' | 'initialValue'> & {\n /**\n * An id used for the internal input element.\n */\n id?: string;\n\n /**\n * The moment locale to be used for the date picker.\n * Make sure to import the respective moment locale files.\n *\n * @default 'en-GB'\n * @example import 'moment/dist/locale/de';\n */\n locale?: string;\n\n /**\n * Once the day has been selected, the date picker will be closed automatically.\n *\n * @default true\n */\n closeOnSelect?: boolean;\n\n /**\n * Default value of the DatePicker (date or moment).\n */\n initialValue?: Date | Moment;\n\n /**\n * Value of the DatePicker (date or moment). Use this only if you want to use\n * this component as a controlled component\n */\n value?: Date | string | Moment;\n\n /*\n * Defines the format for the date. It accepts any moment.js date format.\n * If true the date will be displayed using the defaults for the current locale.\n * If false the date picker is disabled and the component can be used as time picker.\n */\n dateFormat?: boolean | string;\n\n /*\n * Defines the format for the time. It accepts any moment.js time format.\n * If true the time will be displayed using the defaults for the current locale.\n * If false the time picker is disabled and the component can be used as date picker.\n */\n timeFormat?: boolean | string;\n\n /*\n * Defines additional attributes for the input element of the component.\n */\n inputProps?: React.HTMLProps<HTMLInputElement>;\n\n /**\n * Defines whether the dropdown opens upwards or not.\n *\n * @default false\n */\n dropup?: boolean;\n\n /**\n * Opens the picker right aligned.\n *\n * @default false\n */\n\n alignRight?: boolean;\n\n /**\n * Defines whether the clearableInput button is shown.\n *\n * @default false\n */\n clearableInput?: boolean;\n\n /**\n * Optional min-width value (without px). Since the DatePicker has a max-width of 100%\n * you can also set a high minWidth number to use 100% with of the parent element.\n * A value of \"0\" means no extra width is set and it becomes 100% width of the parent.\n *\n * @default 0\n */\n minWidth?: number;\n\n /**\n * Callback function when the value changes. Receives the new date (moment)\n * and a boolean (whether date is valid or not) as arguments.\n *\n * @param value\n * @param isValid\n * @returns\n */\n onChange?: (value: Moment | string, isValid: boolean) => void;\n\n /**\n * Defines whether the input shows an error when the date is invalid or cleared.\n *\n * @default true\n */\n mandatory?: boolean;\n\n /**\n * Overwrites the internal date validation function in case you need to customize it.\n *\n * @param date\n * @returns\n */\n dateValidation?: (date: Moment | string) => boolean;\n\n /**\n * Additional classes to be set on the DatePicker element.\n */\n className?: string;\n};\n\nconst DatePicker = forwardRef((props: DatePickerProps, ref) => {\n const {\n id,\n dropup = false,\n alignRight = false,\n locale = DEFAULT_LOCALE,\n minWidth = DEFAULT_MIN_WIDTH,\n onChange = noop,\n mandatory = true,\n dateValidation,\n clearableInput = false,\n closeOnSelect = true,\n inputProps,\n className,\n ...remainingProp\n } = props;\n\n const [hasError, setHasError] = useState(false);\n\n const validateDate = (dateToValidate: Moment | string) => {\n // If the entered date complies with the defined dateFormat, the Datetime component\n // returns a moment object, otherwise the return value is a string.\n // Note, using a isValid() function from moment or the Date object itself will result in\n // different outcome in various browsers.\n // For instance `new Date('1')` or `moment('1')` are valid dates in Chrome where it defaults\n // to \"01/01/2001\" whereas in Firefox it is an invalid date.\n // The solution is to compare the entered value to the date format which is done by React Datetime.\n const isDateObject = typeof dateToValidate === 'object';\n\n return dateValidation ? dateValidation(dateToValidate) : isDateObject;\n };\n\n const handleChange = (date: Moment | string) => {\n const isValid = mandatory ? validateDate(date) : true;\n setHasError(!isValid);\n onChange(date, isValid);\n };\n\n const classes = classNames(\n 'DatePicker',\n 'form-group',\n hasError && 'has-error',\n dropup && 'dropup',\n alignRight && 'align-right',\n className && className\n );\n\n // This way we can expose the \"id\" as top level prop and not as part of the inputProps which\n // makes the use of the id much more convenient\n const enhancedInputProps = { id, ...inputProps };\n\n return (\n <Datetime\n // TODO: add support for setting ref to the input. Maybe add a \"inputRef\" prop to react-datetime\n // ref={ref}\n {...remainingProp}\n locale={locale}\n clearableInput={clearableInput}\n closeOnSelect={closeOnSelect}\n onChange={handleChange}\n minWidth={minWidth}\n inputProps={enhancedInputProps}\n className={classes}\n />\n );\n});\n\nexport default DatePicker;\n"],"names":["DEFAULT_LOCALE","DEFAULT_MIN_WIDTH","DatePicker","forwardRef","props","ref","id","dropup","alignRight","locale","minWidth","onChange","noop","mandatory","dateValidation","clearableInput","closeOnSelect","inputProps","className","remainingProp","hasError","setHasError","useState","validateDate","dateToValidate","handleChange","date","isValid","classes","classNames","enhancedInputProps","jsx","Datetime"],"mappings":";;;;;AAOA,MAAMA,IAAiB,SACjBC,IAAoB,GAoHpBC,IAAaC,EAAW,CAACC,GAAwBC,MAAQ;AAC3D,QAAM;AAAA,IACF,IAAAC;AAAA,IACA,QAAAC,IAAS;AAAA,IACT,YAAAC,IAAa;AAAA,IACb,QAAAC,IAAST;AAAA,IACT,UAAAU,IAAWT;AAAA,IACX,UAAAU,IAAWC;AAAA,IACX,WAAAC,IAAY;AAAA,IACZ,gBAAAC;AAAA,IACA,gBAAAC,IAAiB;AAAA,IACjB,eAAAC,IAAgB;AAAA,IAChB,YAAAC;AAAA,IACA,WAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACHf,GAEE,CAACgB,GAAUC,CAAW,IAAIC,EAAS,EAAK,GAExCC,IAAe,CAACC,MAUXV,IAAiBA,EAAeU,CAAc,IAFhC,OAAOA,KAAmB,UAK7CC,IAAe,CAACC,MAA0B;AAC5C,UAAMC,IAAUd,IAAYU,EAAaG,CAAI,IAAI;AACjD,IAAAL,EAAY,CAACM,CAAO,GACpBhB,EAASe,GAAMC,CAAO;AAAA,EAC1B,GAEMC,IAAUC;AAAA,IACZ;AAAA,IACA;AAAA,IACAT,KAAY;AAAA,IACZb,KAAU;AAAA,IACVC,KAAc;AAAA,IACdU,KAAaA;AAAA,EAAA,GAKXY,IAAqB,EAAE,IAAAxB,GAAI,GAAGW,EAAA;AAEpC,SACI,gBAAAc;AAAA,IAACC;AAAA,IAAA;AAAA,MAGI,GAAGb;AAAA,MACJ,QAAAV;AAAA,MACA,gBAAAM;AAAA,MACA,eAAAC;AAAA,MACA,UAAUS;AAAA,MACV,UAAAf;AAAA,MACA,YAAYoB;AAAA,MACZ,WAAWF;AAAA,IAAA;AAAA,EAAA;AAGvB,CAAC;"}
1
+ {"version":3,"file":"DatePicker.js","sources":["../../../src/components/datepicker/DatePicker.tsx"],"sourcesContent":["import type React from 'react';\nimport { useState, forwardRef } from 'react';\nimport classNames from 'classnames';\nimport type { Moment } from 'moment';\nimport DatetimeImport, { type DatetimepickerProps } from 'react-datetime';\nimport { noop } from 'es-toolkit/function';\n\n// Fix: Handle ESM/CJS interop by unwrapping default if necessary\n// @ts-expect-error\nconst Datetime = DatetimeImport?.default ? DatetimeImport.default : DatetimeImport;\n\nconst DEFAULT_LOCALE = 'en-GB';\nconst DEFAULT_MIN_WIDTH = 0;\n\nexport type DatePickerProps = Omit<DatetimepickerProps, 'onChange' | 'initialValue'> & {\n /**\n * An id used for the internal input element.\n */\n id?: string;\n\n /**\n * The moment locale to be used for the date picker.\n * Make sure to import the respective moment locale files.\n *\n * @default 'en-GB'\n * @example import 'moment/dist/locale/de';\n */\n locale?: string;\n\n /**\n * Once the day has been selected, the date picker will be closed automatically.\n *\n * @default true\n */\n closeOnSelect?: boolean;\n\n /**\n * Default value of the DatePicker (date or moment).\n */\n initialValue?: Date | Moment;\n\n /**\n * Value of the DatePicker (date or moment). Use this only if you want to use\n * this component as a controlled component\n */\n value?: Date | string | Moment;\n\n /*\n * Defines the format for the date. It accepts any moment.js date format.\n * If true the date will be displayed using the defaults for the current locale.\n * If false the date picker is disabled and the component can be used as time picker.\n */\n dateFormat?: boolean | string;\n\n /*\n * Defines the format for the time. It accepts any moment.js time format.\n * If true the time will be displayed using the defaults for the current locale.\n * If false the time picker is disabled and the component can be used as date picker.\n */\n timeFormat?: boolean | string;\n\n /*\n * Defines additional attributes for the input element of the component.\n */\n inputProps?: React.HTMLProps<HTMLInputElement>;\n\n /**\n * Defines whether the dropdown opens upwards or not.\n *\n * @default false\n */\n dropup?: boolean;\n\n /**\n * Opens the picker right aligned.\n *\n * @default false\n */\n\n alignRight?: boolean;\n\n /**\n * Defines whether the clearableInput button is shown.\n *\n * @default false\n */\n clearableInput?: boolean;\n\n /**\n * Optional min-width value (without px). Since the DatePicker has a max-width of 100%\n * you can also set a high minWidth number to use 100% with of the parent element.\n * A value of \"0\" means no extra width is set and it becomes 100% width of the parent.\n *\n * @default 0\n */\n minWidth?: number;\n\n /**\n * Callback function when the value changes. Receives the new date (moment)\n * and a boolean (whether date is valid or not) as arguments.\n *\n * @param value\n * @param isValid\n * @returns\n */\n onChange?: (value: Moment | string, isValid: boolean) => void;\n\n /**\n * Defines whether the input shows an error when the date is invalid or cleared.\n *\n * @default true\n */\n mandatory?: boolean;\n\n /**\n * Overwrites the internal date validation function in case you need to customize it.\n *\n * @param date\n * @returns\n */\n dateValidation?: (date: Moment | string) => boolean;\n\n /**\n * Additional classes to be set on the DatePicker element.\n */\n className?: string;\n};\n\nconst DatePicker = forwardRef((props: DatePickerProps, ref) => {\n const {\n id,\n dropup = false,\n alignRight = false,\n locale = DEFAULT_LOCALE,\n minWidth = DEFAULT_MIN_WIDTH,\n onChange = noop,\n mandatory = true,\n dateValidation,\n clearableInput = false,\n closeOnSelect = true,\n inputProps,\n className,\n ...remainingProp\n } = props;\n\n const [hasError, setHasError] = useState(false);\n\n const validateDate = (dateToValidate: Moment | string) => {\n // If the entered date complies with the defined dateFormat, the Datetime component\n // returns a moment object, otherwise the return value is a string.\n // Note, using a isValid() function from moment or the Date object itself will result in\n // different outcome in various browsers.\n // For instance `new Date('1')` or `moment('1')` are valid dates in Chrome where it defaults\n // to \"01/01/2001\" whereas in Firefox it is an invalid date.\n // The solution is to compare the entered value to the date format which is done by React Datetime.\n const isDateObject = typeof dateToValidate === 'object';\n\n return dateValidation ? dateValidation(dateToValidate) : isDateObject;\n };\n\n const handleChange = (date: Moment | string) => {\n const isValid = mandatory ? validateDate(date) : true;\n setHasError(!isValid);\n onChange(date, isValid);\n };\n\n const classes = classNames(\n 'DatePicker',\n 'form-group',\n hasError && 'has-error',\n dropup && 'dropup',\n alignRight && 'align-right',\n className && className\n );\n\n // This way we can expose the \"id\" as top level prop and not as part of the inputProps which\n // makes the use of the id much more convenient\n const enhancedInputProps = { id, ...inputProps };\n\n return (\n <Datetime\n // TODO: add support for setting ref to the input. Maybe add a \"inputRef\" prop to react-datetime\n // ref={ref}\n {...remainingProp}\n locale={locale}\n clearableInput={clearableInput}\n closeOnSelect={closeOnSelect}\n onChange={handleChange}\n minWidth={minWidth}\n inputProps={enhancedInputProps}\n className={classes}\n />\n );\n});\n\nexport default DatePicker;\n"],"names":["Datetime","DatetimeImport","DEFAULT_LOCALE","DEFAULT_MIN_WIDTH","DatePicker","forwardRef","props","ref","id","dropup","alignRight","locale","minWidth","onChange","noop","mandatory","dateValidation","clearableInput","closeOnSelect","inputProps","className","remainingProp","hasError","setHasError","useState","validateDate","dateToValidate","handleChange","date","isValid","classes","classNames","enhancedInputProps","jsx"],"mappings":";;;;;AASA,MAAMA,IAAWC,GAAgB,UAAUA,EAAe,UAAUA,GAE9DC,IAAiB,SACjBC,IAAoB,GAoHpBC,IAAaC,EAAW,CAACC,GAAwBC,MAAQ;AAC3D,QAAM;AAAA,IACF,IAAAC;AAAA,IACA,QAAAC,IAAS;AAAA,IACT,YAAAC,IAAa;AAAA,IACb,QAAAC,IAAST;AAAA,IACT,UAAAU,IAAWT;AAAA,IACX,UAAAU,IAAWC;AAAA,IACX,WAAAC,IAAY;AAAA,IACZ,gBAAAC;AAAA,IACA,gBAAAC,IAAiB;AAAA,IACjB,eAAAC,IAAgB;AAAA,IAChB,YAAAC;AAAA,IACA,WAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACHf,GAEE,CAACgB,GAAUC,CAAW,IAAIC,EAAS,EAAK,GAExCC,IAAe,CAACC,MAUXV,IAAiBA,EAAeU,CAAc,IAFhC,OAAOA,KAAmB,UAK7CC,IAAe,CAACC,MAA0B;AAC5C,UAAMC,IAAUd,IAAYU,EAAaG,CAAI,IAAI;AACjD,IAAAL,EAAY,CAACM,CAAO,GACpBhB,EAASe,GAAMC,CAAO;AAAA,EAC1B,GAEMC,IAAUC;AAAA,IACZ;AAAA,IACA;AAAA,IACAT,KAAY;AAAA,IACZb,KAAU;AAAA,IACVC,KAAc;AAAA,IACdU,KAAaA;AAAA,EAAA,GAKXY,IAAqB,EAAE,IAAAxB,GAAI,GAAGW,EAAA;AAEpC,SACI,gBAAAc;AAAA,IAACjC;AAAA,IAAA;AAAA,MAGI,GAAGqB;AAAA,MACJ,QAAAV;AAAA,MACA,gBAAAM;AAAA,MACA,eAAAC;AAAA,MACA,UAAUS;AAAA,MACV,UAAAf;AAAA,MACA,YAAYoB;AAAA,MACZ,WAAWF;AAAA,IAAA;AAAA,EAAA;AAGvB,CAAC;"}
@@ -1 +1 @@
1
- export type RioglyphIconType = 'rioglyph-academic-cap' | 'rioglyph-addressbook' | 'rioglyph-ai' | 'rioglyph-air-pay' | 'rioglyph-am' | 'rioglyph-angle-double-down' | 'rioglyph-angle-double-left' | 'rioglyph-angle-double-right' | 'rioglyph-angle-double-up' | 'rioglyph-antenna' | 'rioglyph-api' | 'rioglyph-archive' | 'rioglyph-area-chart' | 'rioglyph-area-in' | 'rioglyph-area-out' | 'rioglyph-arrow-down' | 'rioglyph-arrow-left' | 'rioglyph-arrow-right' | 'rioglyph-arrow-up' | 'rioglyph-arrows-collapse' | 'rioglyph-arrows-combine' | 'rioglyph-arrows-expand' | 'rioglyph-arrows-horizontal' | 'rioglyph-arrows-split' | 'rioglyph-assigned' | 'rioglyph-axle' | 'rioglyph-ban-circle' | 'rioglyph-bar-chart-box' | 'rioglyph-battery-charging' | 'rioglyph-battery-level-empty' | 'rioglyph-battery-level-full' | 'rioglyph-battery-level-low' | 'rioglyph-beacon' | 'rioglyph-book' | 'rioglyph-bookable-poi' | 'rioglyph-bookmark-square' | 'rioglyph-bookmark' | 'rioglyph-border-crossing' | 'rioglyph-brain' | 'rioglyph-brake' | 'rioglyph-branch-horizontal' | 'rioglyph-branch-remove' | 'rioglyph-branch-vertical' | 'rioglyph-broadcast' | 'rioglyph-building' | 'rioglyph-bulb' | 'rioglyph-bus-baseline' | 'rioglyph-bus-breakdown' | 'rioglyph-bus' | 'rioglyph-businessman' | 'rioglyph-calendar-parking' | 'rioglyph-calendar-plus' | 'rioglyph-calendar-today' | 'rioglyph-calendar' | 'rioglyph-camera' | 'rioglyph-car-baseline' | 'rioglyph-car-wash' | 'rioglyph-car' | 'rioglyph-card-hotel' | 'rioglyph-card-reader' | 'rioglyph-cards-add' | 'rioglyph-cards-grid' | 'rioglyph-cards-list' | 'rioglyph-cards-table' | 'rioglyph-cargo' | 'rioglyph-carrier' | 'rioglyph-chat' | 'rioglyph-check-badge' | 'rioglyph-check-shield' | 'rioglyph-checkbox-checked' | 'rioglyph-checkbox' | 'rioglyph-checkboxes' | 'rioglyph-chevron-down' | 'rioglyph-chevron-left' | 'rioglyph-chevron-right' | 'rioglyph-chevron-up' | 'rioglyph-chip' | 'rioglyph-circle-dashed' | 'rioglyph-circle-stack' | 'rioglyph-click' | 'rioglyph-climate-control' | 'rioglyph-clipboard' | 'rioglyph-cloud-download' | 'rioglyph-cloud-not-saved' | 'rioglyph-cloud-progress' | 'rioglyph-cloud-upload' | 'rioglyph-cloud' | 'rioglyph-coasting' | 'rioglyph-code-braces' | 'rioglyph-code-brackets' | 'rioglyph-coffee' | 'rioglyph-cog' | 'rioglyph-color-swatch' | 'rioglyph-comment' | 'rioglyph-compare' | 'rioglyph-compass' | 'rioglyph-component-custom-recurrent' | 'rioglyph-component-custom' | 'rioglyph-component' | 'rioglyph-construction' | 'rioglyph-convert' | 'rioglyph-conveyor-belt' | 'rioglyph-cookie' | 'rioglyph-cooling' | 'rioglyph-cost-efficency' | 'rioglyph-cost-efficiency' | 'rioglyph-crown' | 'rioglyph-cruise-control' | 'rioglyph-csv' | 'rioglyph-cube-dashed' | 'rioglyph-cube' | 'rioglyph-currency-euro' | 'rioglyph-damages' | 'rioglyph-dangerousgoods' | 'rioglyph-dashboard-view' | 'rioglyph-dashboard' | 'rioglyph-delivery-completed' | 'rioglyph-delivery-error' | 'rioglyph-delivery-late' | 'rioglyph-delivery-on-track' | 'rioglyph-delivery-warning' | 'rioglyph-delivery' | 'rioglyph-design' | 'rioglyph-desktop' | 'rioglyph-detail-view-info' | 'rioglyph-detail-view' | 'rioglyph-direction' | 'rioglyph-discount-badge' | 'rioglyph-document-out' | 'rioglyph-document' | 'rioglyph-download' | 'rioglyph-drag-n-drop' | 'rioglyph-drive-history' | 'rioglyph-driver-card' | 'rioglyph-driver-off' | 'rioglyph-driver' | 'rioglyph-drivercard-in' | 'rioglyph-drivercard-out' | 'rioglyph-duplicate' | 'rioglyph-earphone' | 'rioglyph-emergency-stop' | 'rioglyph-empty' | 'rioglyph-engine' | 'rioglyph-envelope-indicator' | 'rioglyph-envelope-open' | 'rioglyph-envelope' | 'rioglyph-erase' | 'rioglyph-error-sign' | 'rioglyph-euro-note' | 'rioglyph-exclamation-sign' | 'rioglyph-exclamation' | 'rioglyph-eye-close' | 'rioglyph-eye-closed' | 'rioglyph-eye-open' | 'rioglyph-eye-option' | 'rioglyph-face-frown' | 'rioglyph-face-neutral' | 'rioglyph-face-smile' | 'rioglyph-facetime-video' | 'rioglyph-factory' | 'rioglyph-file-signature' | 'rioglyph-files' | 'rioglyph-fill' | 'rioglyph-filling-e-station' | 'rioglyph-filling-station' | 'rioglyph-filter-active' | 'rioglyph-filter-reset' | 'rioglyph-filter' | 'rioglyph-fingerprint' | 'rioglyph-finish' | 'rioglyph-fire' | 'rioglyph-flag' | 'rioglyph-flash' | 'rioglyph-folder-closed' | 'rioglyph-folder-open' | 'rioglyph-fuel-diesel' | 'rioglyph-fuel-electric' | 'rioglyph-fuel-gas' | 'rioglyph-fuel-hydrogen' | 'rioglyph-fuel-liquid' | 'rioglyph-fuel-mix' | 'rioglyph-fullscreen' | 'rioglyph-geofence' | 'rioglyph-get' | 'rioglyph-give' | 'rioglyph-globe-alt' | 'rioglyph-globe' | 'rioglyph-group-blocks' | 'rioglyph-group' | 'rioglyph-hand-down' | 'rioglyph-hand-left' | 'rioglyph-hand-right' | 'rioglyph-hand-up' | 'rioglyph-handshake' | 'rioglyph-hash' | 'rioglyph-heart' | 'rioglyph-heating' | 'rioglyph-hierarchy' | 'rioglyph-history' | 'rioglyph-home-sign' | 'rioglyph-home' | 'rioglyph-hour-glass' | 'rioglyph-id' | 'rioglyph-inbox-in' | 'rioglyph-inbox-out' | 'rioglyph-inbox-stack' | 'rioglyph-inbox' | 'rioglyph-info-sign' | 'rioglyph-info' | 'rioglyph-insert' | 'rioglyph-issue-tracking' | 'rioglyph-key' | 'rioglyph-kickdown' | 'rioglyph-language' | 'rioglyph-layer-pois' | 'rioglyph-layer' | 'rioglyph-leafs' | 'rioglyph-light-bulb' | 'rioglyph-line-chart' | 'rioglyph-link' | 'rioglyph-load-unload' | 'rioglyph-load' | 'rioglyph-location-arrow' | 'rioglyph-lock-open' | 'rioglyph-lock' | 'rioglyph-log-in' | 'rioglyph-logout' | 'rioglyph-looking-glass-man' | 'rioglyph-looking-glass' | 'rioglyph-magic-wand' | 'rioglyph-maintenance-components' | 'rioglyph-map-location' | 'rioglyph-map-marker' | 'rioglyph-map' | 'rioglyph-megaphone' | 'rioglyph-menu-hamburger' | 'rioglyph-merge' | 'rioglyph-migrate' | 'rioglyph-milage' | 'rioglyph-minus-light' | 'rioglyph-minus-sign' | 'rioglyph-minus' | 'rioglyph-missing' | 'rioglyph-mode-dark-light' | 'rioglyph-more' | 'rioglyph-new-window' | 'rioglyph-newspaper' | 'rioglyph-note' | 'rioglyph-notification' | 'rioglyph-number-1' | 'rioglyph-number-2' | 'rioglyph-number-3' | 'rioglyph-off' | 'rioglyph-oil-can' | 'rioglyph-ok-circle' | 'rioglyph-ok-dashed' | 'rioglyph-ok-sign' | 'rioglyph-ok' | 'rioglyph-onboarding' | 'rioglyph-ongoing' | 'rioglyph-option-horizontal' | 'rioglyph-option-vertical' | 'rioglyph-order' | 'rioglyph-palette-broken' | 'rioglyph-palette' | 'rioglyph-paper-clip' | 'rioglyph-parcel-broken' | 'rioglyph-parcel' | 'rioglyph-parking' | 'rioglyph-pause-circle' | 'rioglyph-pause' | 'rioglyph-pdf-file' | 'rioglyph-pencil-square' | 'rioglyph-pencil' | 'rioglyph-phone' | 'rioglyph-pictures' | 'rioglyph-pin-range' | 'rioglyph-pin' | 'rioglyph-play-circle' | 'rioglyph-play' | 'rioglyph-plugged-off' | 'rioglyph-plugged-on' | 'rioglyph-plus-light' | 'rioglyph-plus-sign' | 'rioglyph-plus' | 'rioglyph-pm' | 'rioglyph-poi' | 'rioglyph-polygon' | 'rioglyph-position' | 'rioglyph-print' | 'rioglyph-progress-ongoing' | 'rioglyph-progress-remaining' | 'rioglyph-progression' | 'rioglyph-prompt' | 'rioglyph-pto-off' | 'rioglyph-pto-on' | 'rioglyph-pushpin' | 'rioglyph-puzzle' | 'rioglyph-pylon' | 'rioglyph-qr-code' | 'rioglyph-question-sign' | 'rioglyph-question' | 'rioglyph-record' | 'rioglyph-recycle' | 'rioglyph-refresh' | 'rioglyph-remove-circle' | 'rioglyph-remove-sign' | 'rioglyph-remove' | 'rioglyph-repeat-square' | 'rioglyph-repeat' | 'rioglyph-resize-full' | 'rioglyph-resize-horizontal' | 'rioglyph-resize-small' | 'rioglyph-resize-vertical' | 'rioglyph-retrofit' | 'rioglyph-retweet' | 'rioglyph-revert' | 'rioglyph-rio-marker' | 'rioglyph-rio' | 'rioglyph-road-restrictions' | 'rioglyph-road' | 'rioglyph-robot' | 'rioglyph-rocket' | 'rioglyph-role-management' | 'rioglyph-route-option' | 'rioglyph-route-view' | 'rioglyph-route' | 'rioglyph-ruler' | 'rioglyph-satellite-radar' | 'rioglyph-save' | 'rioglyph-scale' | 'rioglyph-scan' | 'rioglyph-scissors' | 'rioglyph-search-list' | 'rioglyph-search-truck' | 'rioglyph-search' | 'rioglyph-send' | 'rioglyph-series' | 'rioglyph-server-stack' | 'rioglyph-settings' | 'rioglyph-share-alt' | 'rioglyph-share-nodes' | 'rioglyph-share' | 'rioglyph-shelve' | 'rioglyph-ship' | 'rioglyph-shopping-bag' | 'rioglyph-shopping-cart' | 'rioglyph-signature' | 'rioglyph-slope-down-max' | 'rioglyph-slope-down-min' | 'rioglyph-slope-up-max' | 'rioglyph-slope-up-min' | 'rioglyph-sort-by-attributes-alt' | 'rioglyph-sort-by-attributes' | 'rioglyph-sort' | 'rioglyph-sparkles' | 'rioglyph-speed' | 'rioglyph-sphere' | 'rioglyph-spinner' | 'rioglyph-split-view' | 'rioglyph-square-dashed' | 'rioglyph-stack-add' | 'rioglyph-stack-iso' | 'rioglyph-stack' | 'rioglyph-star-empty' | 'rioglyph-star' | 'rioglyph-stars' | 'rioglyph-start' | 'rioglyph-stats-high' | 'rioglyph-stats-line-dots' | 'rioglyph-stats-low' | 'rioglyph-stats-medium' | 'rioglyph-stats' | 'rioglyph-status-available' | 'rioglyph-status-change-horizontal' | 'rioglyph-status-change' | 'rioglyph-status-driving' | 'rioglyph-status-resting' | 'rioglyph-status-working' | 'rioglyph-steering-wheel' | 'rioglyph-stopover' | 'rioglyph-support' | 'rioglyph-table-view' | 'rioglyph-tachograph-download' | 'rioglyph-tachograph' | 'rioglyph-tag' | 'rioglyph-tasks' | 'rioglyph-temperature' | 'rioglyph-th-list' | 'rioglyph-thumbs-down' | 'rioglyph-thumbs-up' | 'rioglyph-tickets' | 'rioglyph-time-alt' | 'rioglyph-time-cancle' | 'rioglyph-time-incomplete' | 'rioglyph-time' | 'rioglyph-tire' | 'rioglyph-tms' | 'rioglyph-to-bottom' | 'rioglyph-to-left' | 'rioglyph-to-right' | 'rioglyph-to-top' | 'rioglyph-tracking-package' | 'rioglyph-traffic-lights' | 'rioglyph-trailer-baseline' | 'rioglyph-trailer' | 'rioglyph-trailerposition' | 'rioglyph-train' | 'rioglyph-transfer' | 'rioglyph-transition-push-right' | 'rioglyph-transition-right' | 'rioglyph-trash' | 'rioglyph-triangle-bottom' | 'rioglyph-triangle-left' | 'rioglyph-triangle-right' | 'rioglyph-triangle-top' | 'rioglyph-trophy' | 'rioglyph-truck-baseline' | 'rioglyph-truck-breakdown' | 'rioglyph-truck-unit' | 'rioglyph-truck' | 'rioglyph-unassigned' | 'rioglyph-unavailable' | 'rioglyph-unlink' | 'rioglyph-upload' | 'rioglyph-user-add' | 'rioglyph-user-group' | 'rioglyph-user-ok' | 'rioglyph-user-remove' | 'rioglyph-user-sign-off' | 'rioglyph-user-sign' | 'rioglyph-user' | 'rioglyph-van-baseline' | 'rioglyph-van' | 'rioglyph-variable' | 'rioglyph-video-off' | 'rioglyph-video' | 'rioglyph-volume' | 'rioglyph-wallet' | 'rioglyph-warehouse' | 'rioglyph-warning-sign' | 'rioglyph-weather-cloudy' | 'rioglyph-weather-icy' | 'rioglyph-weather-overcast' | 'rioglyph-weather-raining' | 'rioglyph-weather-snowing' | 'rioglyph-weather-stormy' | 'rioglyph-weather-sunny' | 'rioglyph-weather-thundering' | 'rioglyph-weather-windy' | 'rioglyph-weight' | 'rioglyph-width' | 'rioglyph-wifi-off' | 'rioglyph-wifi' | 'rioglyph-window' | 'rioglyph-workflow-step' | 'rioglyph-workflow' | 'rioglyph-workshop' | 'rioglyph-wrench' | 'rioglyph-xmas-raindeer' | 'rioglyph-xmas-santa';
1
+ export type RioglyphIconType = 'rioglyph-academic-cap' | 'rioglyph-addressbook' | 'rioglyph-ai' | 'rioglyph-air-pay' | 'rioglyph-am' | 'rioglyph-angle-double-down' | 'rioglyph-angle-double-left' | 'rioglyph-angle-double-right' | 'rioglyph-angle-double-up' | 'rioglyph-antenna' | 'rioglyph-api' | 'rioglyph-archive' | 'rioglyph-area-chart' | 'rioglyph-area-in' | 'rioglyph-area-out' | 'rioglyph-arrow-down' | 'rioglyph-arrow-left' | 'rioglyph-arrow-right' | 'rioglyph-arrow-up' | 'rioglyph-arrows-collapse' | 'rioglyph-arrows-combine' | 'rioglyph-arrows-expand' | 'rioglyph-arrows-horizontal' | 'rioglyph-arrows-split' | 'rioglyph-assigned' | 'rioglyph-axis-x' | 'rioglyph-axis-y' | 'rioglyph-axis-z' | 'rioglyph-axle' | 'rioglyph-ban-circle' | 'rioglyph-bar-chart-box' | 'rioglyph-battery-charging' | 'rioglyph-battery-level-empty' | 'rioglyph-battery-level-full' | 'rioglyph-battery-level-low' | 'rioglyph-beacon' | 'rioglyph-book' | 'rioglyph-bookable-poi' | 'rioglyph-bookmark-square' | 'rioglyph-bookmark' | 'rioglyph-border-crossing' | 'rioglyph-brain' | 'rioglyph-brake' | 'rioglyph-branch-horizontal' | 'rioglyph-branch-remove' | 'rioglyph-branch-vertical' | 'rioglyph-broadcast' | 'rioglyph-building' | 'rioglyph-bulb' | 'rioglyph-bus-baseline' | 'rioglyph-bus-breakdown' | 'rioglyph-bus' | 'rioglyph-businessman' | 'rioglyph-calendar-parking' | 'rioglyph-calendar-plus' | 'rioglyph-calendar-today' | 'rioglyph-calendar' | 'rioglyph-camera' | 'rioglyph-car-baseline' | 'rioglyph-car-wash' | 'rioglyph-car' | 'rioglyph-card-hotel' | 'rioglyph-card-reader' | 'rioglyph-cards-add' | 'rioglyph-cards-grid' | 'rioglyph-cards-list' | 'rioglyph-cards-table' | 'rioglyph-cargo' | 'rioglyph-carrier' | 'rioglyph-chat' | 'rioglyph-check-badge' | 'rioglyph-check-shield' | 'rioglyph-checkbox-checked' | 'rioglyph-checkbox' | 'rioglyph-checkboxes' | 'rioglyph-chevron-down' | 'rioglyph-chevron-left' | 'rioglyph-chevron-right' | 'rioglyph-chevron-up' | 'rioglyph-chip' | 'rioglyph-circle-dashed' | 'rioglyph-circle-stack' | 'rioglyph-click' | 'rioglyph-climate-control' | 'rioglyph-clipboard' | 'rioglyph-cloud-download' | 'rioglyph-cloud-not-saved' | 'rioglyph-cloud-progress' | 'rioglyph-cloud-upload' | 'rioglyph-cloud' | 'rioglyph-coasting' | 'rioglyph-code-braces' | 'rioglyph-code-brackets' | 'rioglyph-coffee' | 'rioglyph-cog' | 'rioglyph-color-swatch' | 'rioglyph-comment' | 'rioglyph-compare' | 'rioglyph-compass' | 'rioglyph-component-custom-recurrent' | 'rioglyph-component-custom' | 'rioglyph-component' | 'rioglyph-construction' | 'rioglyph-convert' | 'rioglyph-conveyor-belt' | 'rioglyph-cookie' | 'rioglyph-cooling' | 'rioglyph-cost-efficency' | 'rioglyph-cost-efficiency' | 'rioglyph-crown' | 'rioglyph-cruise-control' | 'rioglyph-csv' | 'rioglyph-cube-dashed' | 'rioglyph-cube' | 'rioglyph-currency-euro' | 'rioglyph-damages' | 'rioglyph-dangerousgoods' | 'rioglyph-dashboard-view' | 'rioglyph-dashboard' | 'rioglyph-delivery-completed' | 'rioglyph-delivery-error' | 'rioglyph-delivery-late' | 'rioglyph-delivery-on-track' | 'rioglyph-delivery-warning' | 'rioglyph-delivery' | 'rioglyph-design' | 'rioglyph-desktop' | 'rioglyph-detail-view-info' | 'rioglyph-detail-view' | 'rioglyph-direction' | 'rioglyph-discount-badge' | 'rioglyph-document-out' | 'rioglyph-document' | 'rioglyph-download' | 'rioglyph-drag-n-drop' | 'rioglyph-drive-history' | 'rioglyph-driver-card' | 'rioglyph-driver-off' | 'rioglyph-driver' | 'rioglyph-drivercard-in' | 'rioglyph-drivercard-out' | 'rioglyph-duplicate' | 'rioglyph-earphone' | 'rioglyph-emergency-stop' | 'rioglyph-empty' | 'rioglyph-engine' | 'rioglyph-envelope-indicator' | 'rioglyph-envelope-open' | 'rioglyph-envelope' | 'rioglyph-erase' | 'rioglyph-error-sign' | 'rioglyph-euro-note' | 'rioglyph-exclamation-sign' | 'rioglyph-exclamation' | 'rioglyph-eye-close' | 'rioglyph-eye-closed' | 'rioglyph-eye-open' | 'rioglyph-eye-option' | 'rioglyph-face-frown' | 'rioglyph-face-neutral' | 'rioglyph-face-smile' | 'rioglyph-facetime-video' | 'rioglyph-factory' | 'rioglyph-file-signature' | 'rioglyph-files' | 'rioglyph-fill' | 'rioglyph-filling-e-station' | 'rioglyph-filling-station' | 'rioglyph-filter-active' | 'rioglyph-filter-reset' | 'rioglyph-filter' | 'rioglyph-fingerprint' | 'rioglyph-finish' | 'rioglyph-fire' | 'rioglyph-flag' | 'rioglyph-flash' | 'rioglyph-folder-closed' | 'rioglyph-folder-open' | 'rioglyph-fuel-diesel' | 'rioglyph-fuel-electric' | 'rioglyph-fuel-gas' | 'rioglyph-fuel-hydrogen' | 'rioglyph-fuel-liquid' | 'rioglyph-fuel-mix' | 'rioglyph-fullscreen' | 'rioglyph-geofence' | 'rioglyph-get' | 'rioglyph-give' | 'rioglyph-globe-alt' | 'rioglyph-globe' | 'rioglyph-group-blocks' | 'rioglyph-group' | 'rioglyph-hand-down' | 'rioglyph-hand-left' | 'rioglyph-hand-right' | 'rioglyph-hand-up' | 'rioglyph-handshake' | 'rioglyph-hash' | 'rioglyph-heart' | 'rioglyph-heating' | 'rioglyph-hierarchy' | 'rioglyph-history' | 'rioglyph-home-sign' | 'rioglyph-home' | 'rioglyph-hour-glass' | 'rioglyph-id' | 'rioglyph-inbox-in' | 'rioglyph-inbox-out' | 'rioglyph-inbox-stack' | 'rioglyph-inbox' | 'rioglyph-info-sign' | 'rioglyph-info' | 'rioglyph-insert' | 'rioglyph-issue-tracking' | 'rioglyph-key' | 'rioglyph-kickdown' | 'rioglyph-language' | 'rioglyph-layer-pois' | 'rioglyph-layer' | 'rioglyph-leafs' | 'rioglyph-light-bulb' | 'rioglyph-line-chart' | 'rioglyph-link' | 'rioglyph-load-unload' | 'rioglyph-load' | 'rioglyph-location-arrow' | 'rioglyph-lock-open' | 'rioglyph-lock' | 'rioglyph-log-in' | 'rioglyph-logout' | 'rioglyph-looking-glass-man' | 'rioglyph-looking-glass' | 'rioglyph-magic-wand' | 'rioglyph-maintenance-components' | 'rioglyph-map-location' | 'rioglyph-map-marker' | 'rioglyph-map' | 'rioglyph-megaphone' | 'rioglyph-menu-hamburger' | 'rioglyph-merge' | 'rioglyph-migrate' | 'rioglyph-milage' | 'rioglyph-minus-light' | 'rioglyph-minus-sign' | 'rioglyph-minus' | 'rioglyph-missing' | 'rioglyph-mode-dark-light' | 'rioglyph-more' | 'rioglyph-new-window' | 'rioglyph-newspaper' | 'rioglyph-note' | 'rioglyph-notification' | 'rioglyph-number-1' | 'rioglyph-number-2' | 'rioglyph-number-3' | 'rioglyph-off' | 'rioglyph-oil-can' | 'rioglyph-ok-circle' | 'rioglyph-ok-dashed' | 'rioglyph-ok-sign' | 'rioglyph-ok' | 'rioglyph-onboarding' | 'rioglyph-ongoing' | 'rioglyph-option-horizontal' | 'rioglyph-option-vertical' | 'rioglyph-order' | 'rioglyph-palette-broken' | 'rioglyph-palette' | 'rioglyph-paper-clip' | 'rioglyph-parcel-broken' | 'rioglyph-parcel' | 'rioglyph-parking' | 'rioglyph-pause-circle' | 'rioglyph-pause' | 'rioglyph-pdf-file' | 'rioglyph-pencil-square' | 'rioglyph-pencil' | 'rioglyph-phone' | 'rioglyph-pictures' | 'rioglyph-pin-range' | 'rioglyph-pin' | 'rioglyph-play-circle' | 'rioglyph-play' | 'rioglyph-plugged-off' | 'rioglyph-plugged-on' | 'rioglyph-plus-light' | 'rioglyph-plus-sign' | 'rioglyph-plus' | 'rioglyph-pm' | 'rioglyph-poi' | 'rioglyph-polygon' | 'rioglyph-position' | 'rioglyph-print' | 'rioglyph-progress-ongoing' | 'rioglyph-progress-remaining' | 'rioglyph-progression' | 'rioglyph-prompt' | 'rioglyph-pto-off' | 'rioglyph-pto-on' | 'rioglyph-pushpin' | 'rioglyph-puzzle' | 'rioglyph-pylon' | 'rioglyph-qr-code' | 'rioglyph-question-sign' | 'rioglyph-question' | 'rioglyph-record' | 'rioglyph-recycle' | 'rioglyph-refresh' | 'rioglyph-remove-circle' | 'rioglyph-remove-sign' | 'rioglyph-remove' | 'rioglyph-repeat-square' | 'rioglyph-repeat' | 'rioglyph-resize-full' | 'rioglyph-resize-horizontal' | 'rioglyph-resize-small' | 'rioglyph-resize-vertical' | 'rioglyph-retrofit' | 'rioglyph-retweet' | 'rioglyph-revert' | 'rioglyph-rio-marker' | 'rioglyph-rio' | 'rioglyph-road-restrictions' | 'rioglyph-road' | 'rioglyph-robot' | 'rioglyph-rocket' | 'rioglyph-role-management' | 'rioglyph-route-option' | 'rioglyph-route-view' | 'rioglyph-route' | 'rioglyph-ruler' | 'rioglyph-satellite-radar' | 'rioglyph-save' | 'rioglyph-scale' | 'rioglyph-scan' | 'rioglyph-scissors' | 'rioglyph-search-list' | 'rioglyph-search-truck' | 'rioglyph-search' | 'rioglyph-send' | 'rioglyph-series' | 'rioglyph-server-stack' | 'rioglyph-settings' | 'rioglyph-share-alt' | 'rioglyph-share-nodes' | 'rioglyph-share' | 'rioglyph-shelve' | 'rioglyph-ship' | 'rioglyph-shopping-bag' | 'rioglyph-shopping-cart' | 'rioglyph-signature' | 'rioglyph-slope-down-max' | 'rioglyph-slope-down-min' | 'rioglyph-slope-up-max' | 'rioglyph-slope-up-min' | 'rioglyph-sort-by-attributes-alt' | 'rioglyph-sort-by-attributes' | 'rioglyph-sort' | 'rioglyph-sparkles' | 'rioglyph-speed' | 'rioglyph-sphere' | 'rioglyph-spinner' | 'rioglyph-split-view' | 'rioglyph-square-dashed' | 'rioglyph-stack-add' | 'rioglyph-stack-iso' | 'rioglyph-stack' | 'rioglyph-star-empty' | 'rioglyph-star' | 'rioglyph-stars' | 'rioglyph-start' | 'rioglyph-stats-high' | 'rioglyph-stats-line-dots' | 'rioglyph-stats-low' | 'rioglyph-stats-medium' | 'rioglyph-stats' | 'rioglyph-status-available' | 'rioglyph-status-change-horizontal' | 'rioglyph-status-change' | 'rioglyph-status-driving' | 'rioglyph-status-resting' | 'rioglyph-status-working' | 'rioglyph-steering-wheel' | 'rioglyph-stopover' | 'rioglyph-support' | 'rioglyph-table-view' | 'rioglyph-tachograph-download' | 'rioglyph-tachograph' | 'rioglyph-tag' | 'rioglyph-tasks' | 'rioglyph-temperature' | 'rioglyph-th-list' | 'rioglyph-thumbs-down' | 'rioglyph-thumbs-up' | 'rioglyph-tickets' | 'rioglyph-time-alt' | 'rioglyph-time-cancle' | 'rioglyph-time-incomplete' | 'rioglyph-time' | 'rioglyph-tire' | 'rioglyph-tms' | 'rioglyph-to-bottom' | 'rioglyph-to-left' | 'rioglyph-to-right' | 'rioglyph-to-top' | 'rioglyph-tracking-package' | 'rioglyph-traffic-lights' | 'rioglyph-trailer-baseline' | 'rioglyph-trailer' | 'rioglyph-trailerposition' | 'rioglyph-train' | 'rioglyph-transfer' | 'rioglyph-transition-push-right' | 'rioglyph-transition-right' | 'rioglyph-trash' | 'rioglyph-triangle-bottom' | 'rioglyph-triangle-left' | 'rioglyph-triangle-right' | 'rioglyph-triangle-top' | 'rioglyph-trophy' | 'rioglyph-truck-baseline' | 'rioglyph-truck-breakdown' | 'rioglyph-truck-unit' | 'rioglyph-truck' | 'rioglyph-unassigned' | 'rioglyph-unavailable' | 'rioglyph-unlink' | 'rioglyph-upload' | 'rioglyph-user-add' | 'rioglyph-user-group' | 'rioglyph-user-ok' | 'rioglyph-user-remove' | 'rioglyph-user-sign-off' | 'rioglyph-user-sign' | 'rioglyph-user' | 'rioglyph-van-baseline' | 'rioglyph-van' | 'rioglyph-variable' | 'rioglyph-video-off' | 'rioglyph-video' | 'rioglyph-volume' | 'rioglyph-wallet' | 'rioglyph-warehouse' | 'rioglyph-warning-sign' | 'rioglyph-weather-cloudy' | 'rioglyph-weather-icy' | 'rioglyph-weather-overcast' | 'rioglyph-weather-raining' | 'rioglyph-weather-snowing' | 'rioglyph-weather-stormy' | 'rioglyph-weather-sunny' | 'rioglyph-weather-thundering' | 'rioglyph-weather-windy' | 'rioglyph-weight' | 'rioglyph-width' | 'rioglyph-wifi-off' | 'rioglyph-wifi' | 'rioglyph-window' | 'rioglyph-workflow-step' | 'rioglyph-workflow' | 'rioglyph-workshop' | 'rioglyph-wrench' | 'rioglyph-xmas-raindeer' | 'rioglyph-xmas-santa';
@@ -8,7 +8,7 @@ type ActionMessageHandlerDeclaration = {
8
8
  origin?: string;
9
9
  handlers: Record<string, ActionMessageHandler>;
10
10
  };
11
- type IncomingPostMessageOption = MessageHandler | OriginFilteredMessageHandler | ActionMessageHandlerDeclaration;
11
+ type IncomingPostMessageOptions = MessageHandler | OriginFilteredMessageHandler | ActionMessageHandlerDeclaration;
12
12
  /**
13
13
  * A hook for handling incoming postMessage events.
14
14
  *
@@ -20,7 +20,7 @@ type IncomingPostMessageOption = MessageHandler | OriginFilteredMessageHandler |
20
20
  * The idea behind action-based handlers is that you can declaratively define listeners that only react to specific
21
21
  * events that belong to a specific `type` of message event when the event looks like a {@link ActionMessage}.
22
22
  *
23
- * @param option Configuration object or function defining how to handle messages
23
+ * @param options Configuration object or function defining how to handle messages
24
24
  *
25
25
  * @example
26
26
  * // Raw handler
@@ -45,5 +45,5 @@ type IncomingPostMessageOption = MessageHandler | OriginFilteredMessageHandler |
45
45
  * }
46
46
  * });
47
47
  */
48
- export declare const useIncomingPostMessages: (option: IncomingPostMessageOption) => void;
49
- export {};
48
+ declare const useIncomingPostMessages: (options: IncomingPostMessageOptions) => void;
49
+ export default useIncomingPostMessages;
@@ -0,0 +1,24 @@
1
+ import { useCallback as l, useEffect as f } from "react";
2
+ import { useUpdatingRef as c } from "./useUpdatingRef.js";
3
+ const d = (e) => e !== null && typeof e == "object" && "type" in e && typeof e.type == "string", o = (e) => typeof e == "function", g = (e) => typeof e == "object" && "origin" in e && typeof e.origin == "string" && "handler" in e && o(e.handler), u = (e) => typeof e == "object" && "handlers" in e && e.handlers !== null && typeof e.handlers == "object", a = (e, r) => r === "*" || e.origin === r, p = (e) => {
4
+ const r = c(e), i = l((n) => {
5
+ const s = r.current;
6
+ if (o(s))
7
+ s(n);
8
+ else if (g(s))
9
+ a(n, s.origin) && s.handler(n);
10
+ else if (u(s)) {
11
+ if (!a(n, s.origin ?? "*") || !d(n.data))
12
+ return;
13
+ const t = s.handlers[n.data.type];
14
+ t && t(n.data.payload);
15
+ }
16
+ }, []);
17
+ f(() => (window.addEventListener("message", i, !1), () => {
18
+ window.removeEventListener("message", i, !1);
19
+ }), []);
20
+ };
21
+ export {
22
+ p as default
23
+ };
24
+ //# sourceMappingURL=useIncomingPostMessages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIncomingPostMessages.js","sources":["../../src/hooks/useIncomingPostMessages.ts"],"sourcesContent":["import { useCallback, useEffect } from 'react';\nimport { useUpdatingRef } from './useUpdatingRef';\n\ntype ActionMessage = { type: string; payload?: unknown };\nconst isActionMessage = (eventData: unknown): eventData is ActionMessage =>\n eventData !== null && typeof eventData === 'object' && 'type' in eventData && typeof eventData.type === 'string';\n\ntype MessageHandler = (event: MessageEvent<unknown>) => void;\nconst isMessageHandler = (options: IncomingPostMessageOptions): options is MessageHandler =>\n typeof options === 'function';\n\ntype OriginFilteredMessageHandler = { origin: string; handler: MessageHandler };\nconst isOriginFilteredMessageHandler = (options: IncomingPostMessageOptions): options is OriginFilteredMessageHandler =>\n typeof options === 'object' &&\n 'origin' in options &&\n typeof options.origin === 'string' &&\n 'handler' in options &&\n isMessageHandler(options.handler);\n\n// biome-ignore lint/suspicious/noExplicitAny: unknown would be more correct, but we want to make the user's lives easier :)\ntype ActionMessageHandler = (payload: any) => void;\ntype ActionMessageHandlerDeclaration = { origin?: string; handlers: Record<string, ActionMessageHandler> };\nconst isActionMessageHandlerDeclaration = (\n options: IncomingPostMessageOptions\n): options is ActionMessageHandlerDeclaration =>\n typeof options === 'object' &&\n 'handlers' in options &&\n options.handlers !== null &&\n typeof options.handlers === 'object';\n\ntype IncomingPostMessageOptions = MessageHandler | OriginFilteredMessageHandler | ActionMessageHandlerDeclaration;\n\nconst originMatches = (event: MessageEvent<unknown>, expectedOrigin: string) =>\n expectedOrigin === '*' || event.origin === expectedOrigin;\n\n/**\n * A hook for handling incoming postMessage events.\n *\n * Can be used in three ways, based on your requirements:\n * 1. Raw handler: Direct access to MessageEvent\n * 2. Origin-filtered handler: Only handle messages from specific origin\n * 3. Action-based handlers: Route messages by type and extract payloads\n *\n * The idea behind action-based handlers is that you can declaratively define listeners that only react to specific\n * events that belong to a specific `type` of message event when the event looks like a {@link ActionMessage}.\n *\n * @param options Configuration object or function defining how to handle messages\n *\n * @example\n * // Raw handler\n * useIncomingPostMessages((event) => {\n * console.log('Received:', event.data);\n * });\n *\n * @example\n * // Origin-filtered handler\n * useIncomingPostMessages({\n * origin: 'https://trusted-domain.com',\n * handler: (event) => console.log('From trusted origin:', event.data)\n * });\n *\n * @example\n * // Action-based handlers\n * useIncomingPostMessages({\n * origin: 'https://widget-domain.com', // optional, defaults to '*'\n * handlers: {\n * 'WIDGET_READY': () => setWidgetReady(true), // actions without payload are possible, too\n * 'WIDGET_DATA': (payload) => setData(payload), // utilizing the payload\n * }\n * });\n */\nconst useIncomingPostMessages = (options: IncomingPostMessageOptions) => {\n // prevent stale references\n const optionRef = useUpdatingRef(options);\n\n const listener = useCallback((event: MessageEvent<unknown>) => {\n const currentOption = optionRef.current;\n\n if (isMessageHandler(currentOption)) {\n // raw handler\n currentOption(event);\n } else if (isOriginFilteredMessageHandler(currentOption)) {\n // origin-filtered handler\n if (originMatches(event, currentOption.origin)) {\n currentOption.handler(event);\n }\n } else if (isActionMessageHandlerDeclaration(currentOption)) {\n // declarative action message handlers\n if (!originMatches(event, currentOption.origin ?? '*')) {\n return;\n }\n\n if (!isActionMessage(event.data)) {\n return;\n }\n\n const handler = currentOption.handlers[event.data.type];\n if (handler) {\n handler(event.data.payload);\n }\n }\n }, []);\n\n useEffect(() => {\n window.addEventListener('message', listener, false);\n return () => {\n window.removeEventListener('message', listener, false);\n };\n }, []);\n};\n\nexport default useIncomingPostMessages;\n"],"names":["isActionMessage","eventData","isMessageHandler","options","isOriginFilteredMessageHandler","isActionMessageHandlerDeclaration","originMatches","event","expectedOrigin","useIncomingPostMessages","optionRef","useUpdatingRef","listener","useCallback","currentOption","handler","useEffect"],"mappings":";;AAIA,MAAMA,IAAkB,CAACC,MACrBA,MAAc,QAAQ,OAAOA,KAAc,YAAY,UAAUA,KAAa,OAAOA,EAAU,QAAS,UAGtGC,IAAmB,CAACC,MACtB,OAAOA,KAAY,YAGjBC,IAAiC,CAACD,MACpC,OAAOA,KAAY,YACnB,YAAYA,KACZ,OAAOA,EAAQ,UAAW,YAC1B,aAAaA,KACbD,EAAiBC,EAAQ,OAAO,GAK9BE,IAAoC,CACtCF,MAEA,OAAOA,KAAY,YACnB,cAAcA,KACdA,EAAQ,aAAa,QACrB,OAAOA,EAAQ,YAAa,UAI1BG,IAAgB,CAACC,GAA8BC,MACjDA,MAAmB,OAAOD,EAAM,WAAWC,GAsCzCC,IAA0B,CAACN,MAAwC;AAErE,QAAMO,IAAYC,EAAeR,CAAO,GAElCS,IAAWC,EAAY,CAACN,MAAiC;AAC3D,UAAMO,IAAgBJ,EAAU;AAEhC,QAAIR,EAAiBY,CAAa;AAE9B,MAAAA,EAAcP,CAAK;AAAA,aACZH,EAA+BU,CAAa;AAEnD,MAAIR,EAAcC,GAAOO,EAAc,MAAM,KACzCA,EAAc,QAAQP,CAAK;AAAA,aAExBF,EAAkCS,CAAa,GAAG;AAMzD,UAJI,CAACR,EAAcC,GAAOO,EAAc,UAAU,GAAG,KAIjD,CAACd,EAAgBO,EAAM,IAAI;AAC3B;AAGJ,YAAMQ,IAAUD,EAAc,SAASP,EAAM,KAAK,IAAI;AACtD,MAAIQ,KACAA,EAAQR,EAAM,KAAK,OAAO;AAAA,IAElC;AAAA,EACJ,GAAG,CAAA,CAAE;AAEL,EAAAS,EAAU,OACN,OAAO,iBAAiB,WAAWJ,GAAU,EAAK,GAC3C,MAAM;AACT,WAAO,oBAAoB,WAAWA,GAAU,EAAK;AAAA,EACzD,IACD,CAAA,CAAE;AACT;"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Provides helper functions to allow sending {@link postMessage} events.
3
+ */
4
+ declare const usePostMessageSender: () => {
5
+ sendMessage: (message: unknown, targetWindow: WindowProxy | null | undefined, targetOrigin?: string) => void;
6
+ sendMessageToParent: (message: unknown, targetOrigin?: string) => void;
7
+ sendMessageToTop: (message: unknown, targetOrigin?: string) => void;
8
+ sendMessageToAllIframes: (message: unknown, targetOrigin?: string) => void;
9
+ };
10
+ export default usePostMessageSender;
@@ -0,0 +1,21 @@
1
+ import { useCallback as n } from "react";
2
+ const f = () => {
3
+ const o = n(
4
+ (e, s, t = "*") => {
5
+ s?.postMessage(e, t);
6
+ },
7
+ []
8
+ ), a = n((e, s = "*") => {
9
+ parent !== window && o(e, parent, s);
10
+ }, []), r = n((e, s = "*") => {
11
+ top !== window && o(e, top, s);
12
+ }, []), c = n((e, s = "*") => {
13
+ for (const t of document.querySelectorAll("iframe"))
14
+ o(e, t.contentWindow, s);
15
+ }, []);
16
+ return { sendMessage: o, sendMessageToParent: a, sendMessageToTop: r, sendMessageToAllIframes: c };
17
+ };
18
+ export {
19
+ f as default
20
+ };
21
+ //# sourceMappingURL=usePostMessageSender.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePostMessageSender.js","sources":["../../src/hooks/usePostMessageSender.ts"],"sourcesContent":["import { useCallback } from 'react';\n\n/**\n * Provides helper functions to allow sending {@link postMessage} events.\n */\nconst usePostMessageSender = () => {\n /**\n * Sends the given message to the given target window.\n *\n * If the target window is null or undefined, this will do nothing.\n *\n * Note that the target window's origin is not checked.\n *\n * @param message The message data to send.\n * @param targetWindow The window to receive the message.\n * @param targetOrigin The expected origin of the target window (optional, defaults to '*').\n */\n const sendMessage = useCallback(\n (message: unknown, targetWindow: WindowProxy | null | undefined, targetOrigin = '*') => {\n targetWindow?.postMessage(message, targetOrigin);\n },\n []\n );\n\n /**\n * Sends the given message to the current \"parent\" window.\n *\n * If there is no parent window (or if window.parent points to the current window), this will do nothing.\n *\n * @param message The message data to send.\n * @param targetOrigin The expected origin of the target window (optional, defaults to '*').\n */\n const sendMessageToParent = useCallback((message: unknown, targetOrigin = '*') => {\n if (parent !== window) {\n sendMessage(message, parent, targetOrigin);\n }\n }, []);\n\n /**\n * Sends the given message to the current \"top\" window.\n *\n * If there is no top window (or if window.top points to the current window), this will do nothing.\n *\n * @param message The message data to send.\n * @param targetOrigin The expected origin of the target window (optional, defaults to '*').\n */\n const sendMessageToTop = useCallback((message: unknown, targetOrigin = '*') => {\n if (top !== window) {\n sendMessage(message, top, targetOrigin);\n }\n }, []);\n\n /**\n * \"Broadcast\" the given message to all iframes that are currently in the browsing context.\n *\n * @param message The message data to send.\n * @param targetOrigin The expected origin of the target window (optional, defaults to '*').\n */\n const sendMessageToAllIframes = useCallback((message: unknown, targetOrigin = '*') => {\n for (const iframe of document.querySelectorAll('iframe')) {\n sendMessage(message, iframe.contentWindow, targetOrigin);\n }\n }, []);\n\n return { sendMessage, sendMessageToParent, sendMessageToTop, sendMessageToAllIframes };\n};\n\nexport default usePostMessageSender;\n"],"names":["usePostMessageSender","sendMessage","useCallback","message","targetWindow","targetOrigin","sendMessageToParent","sendMessageToTop","sendMessageToAllIframes","iframe"],"mappings":";AAKA,MAAMA,IAAuB,MAAM;AAY/B,QAAMC,IAAcC;AAAA,IAChB,CAACC,GAAkBC,GAA8CC,IAAe,QAAQ;AACpF,MAAAD,GAAc,YAAYD,GAASE,CAAY;AAAA,IACnD;AAAA,IACA,CAAA;AAAA,EAAC,GAWCC,IAAsBJ,EAAY,CAACC,GAAkBE,IAAe,QAAQ;AAC9E,IAAI,WAAW,UACXJ,EAAYE,GAAS,QAAQE,CAAY;AAAA,EAEjD,GAAG,CAAA,CAAE,GAUCE,IAAmBL,EAAY,CAACC,GAAkBE,IAAe,QAAQ;AAC3E,IAAI,QAAQ,UACRJ,EAAYE,GAAS,KAAKE,CAAY;AAAA,EAE9C,GAAG,CAAA,CAAE,GAQCG,IAA0BN,EAAY,CAACC,GAAkBE,IAAe,QAAQ;AAClF,eAAWI,KAAU,SAAS,iBAAiB,QAAQ;AACnD,MAAAR,EAAYE,GAASM,EAAO,eAAeJ,CAAY;AAAA,EAE/D,GAAG,CAAA,CAAE;AAEL,SAAO,EAAE,aAAAJ,GAAa,qBAAAK,GAAqB,kBAAAC,GAAkB,yBAAAC,EAAA;AACjE;"}
@@ -0,0 +1,11 @@
1
+ import { useRef as t, useEffect as f } from "react";
2
+ const o = (e) => {
3
+ const r = t(e);
4
+ return f(() => {
5
+ r.current = e;
6
+ }, [e]), r;
7
+ };
8
+ export {
9
+ o as useUpdatingRef
10
+ };
11
+ //# sourceMappingURL=useUpdatingRef.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUpdatingRef.js","sources":["../../src/hooks/useUpdatingRef.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\n/**\n * Used to create a self-updating ref that can be utilized in tasks that are happening outside React's render loop.\n *\n * Event listeners for 'message' events, for example: they define a singular, never-changing handler but this handler\n * needs always-up-to-date access to the latest callbacks that got passed in by the user.\n *\n * @param value The value to be stored (and updated) in the ref's `current` property.\n *\n * @return A read-only ref that always contains the latest value.\n */\nexport const useUpdatingRef = <T extends NonNullable<unknown>>(value: T): { readonly current: T } => {\n // Please note that we're deliberately not returning a `RefObject<T>`, because its value could be null.\n // Also note that we're deliberately not returning a `MutableRefObject<T>`, because we don't want the `current`\n // property to be writable.\n const ref = useRef(value);\n\n useEffect(() => {\n ref.current = value;\n }, [value]);\n\n return ref;\n};\n"],"names":["useUpdatingRef","value","ref","useRef","useEffect"],"mappings":";AAYO,MAAMA,IAAiB,CAAiCC,MAAsC;AAIjG,QAAMC,IAAMC,EAAOF,CAAK;AAExB,SAAAG,EAAU,MAAM;AACZ,IAAAF,EAAI,UAAUD;AAAA,EAClB,GAAG,CAACA,CAAK,CAAC,GAEHC;AACX;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rio-cloud/rio-uikit",
3
- "version": "2.0.0-beta.2",
3
+ "version": "2.0.1",
4
4
  "description": "The RIO UIKIT component library",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,8 +21,8 @@
21
21
  "test-dev": "vitest",
22
22
  "test:ui": "node tools/testUI.js && backstop reference --config='test/backstop/config.js' && backstop test --config='test/backstop/config.js'",
23
23
  "coverage": "vitest run --coverage",
24
- "check-licenses": "node tools/check-licenses.js .",
25
- "license-check": "license-checker --production --json --onlyAllow \"`cat whitelist.txt`\" --excludePackages \"@rio-cloud/rio-uikit\" --out licenses.txt"
24
+ "license-check": "echo license-check",
25
+ "check-licenses": "echo check-licenses"
26
26
  },
27
27
  "author": "TB Digital Services GmbH",
28
28
  "license": "Apache-2.0",
@@ -46,30 +46,30 @@
46
46
  }
47
47
  },
48
48
  "devDependencies": {
49
- "@biomejs/biome": "2.3.7",
49
+ "@biomejs/biome": "2.3.8",
50
50
  "@rio-cloud/biome-config": "1.1.0",
51
+ "@rio-cloud/vite-plugin-frontend-license-check": "1.1.0",
51
52
  "@testing-library/dom": "10.4.1",
52
53
  "@testing-library/jest-dom": "6.9.1",
53
54
  "@testing-library/react": "16.3.0",
54
55
  "@testing-library/user-event": "14.6.1",
55
56
  "@types/heremaps": "3.1.14",
56
- "@types/node": "^24.10.1",
57
+ "@types/node": "24.10.1",
57
58
  "@types/qs": "6.14.0",
58
59
  "@types/react": "18.3.18",
59
60
  "@types/react-dom": "18.3.5",
60
61
  "@types/react-redux": "7.1.34",
61
62
  "@types/resize-observer-browser": "0.1.11",
62
- "@vitejs/plugin-react": "5.1.1",
63
+ "@vitejs/plugin-react": "5.1.2",
63
64
  "@vitest/coverage-c8": "0.33.0",
64
65
  "autoprefixer": "10.4.22",
65
66
  "backstopjs": "6.3.25",
66
67
  "copyfiles": "2.4.1",
67
68
  "dotenv": "17.2.3",
68
- "glob": "^13.0.0",
69
- "happy-dom": "20.0.10",
70
- "jsdom": "27.2.0",
69
+ "glob": "13.0.0",
70
+ "happy-dom": "20.0.11",
71
+ "jsdom": "27.3.0",
71
72
  "jsdom-global": "3.0.2",
72
- "license-checker": "25.0.1",
73
73
  "postcss": "8.5.6",
74
74
  "postcss-preset-env": "8.5.1",
75
75
  "postcss-short": "5.0.0",
@@ -78,15 +78,15 @@
78
78
  "react-dom": "18.0.0",
79
79
  "react-intl": "7.1.14",
80
80
  "rollup-plugin-copy": "3.5.0",
81
- "sass": "^1.94.2",
81
+ "sass": "1.94.2",
82
82
  "strip-ansi": "7.1.2",
83
83
  "svgo": "4.0.0",
84
84
  "typescript": "5.9.3",
85
- "vite": "7.2.4",
86
- "vite-plugin-dts": "^4.5.4",
85
+ "vite": "7.2.7",
86
+ "vite-plugin-dts": "4.5.4",
87
87
  "vite-plugin-zip-pack": "1.2.4",
88
88
  "vitest": "3.2.4",
89
- "vitest-fetch-mock": "^0.4.5"
89
+ "vitest-fetch-mock": "0.4.5"
90
90
  },
91
91
  "peerDependencies": {
92
92
  "react": ">=18.0.0",
@@ -96,10 +96,10 @@
96
96
  "@dnd-kit/core": "6.3.1",
97
97
  "@dnd-kit/modifiers": "9.0.0",
98
98
  "@dnd-kit/sortable": "10.0.0",
99
- "@dnd-kit/utilities": "^3.2.2",
99
+ "@dnd-kit/utilities": "3.2.2",
100
100
  "@formkit/auto-animate": "0.9.0",
101
101
  "@popperjs/core": "2.11.8",
102
- "@tanstack/react-virtual": "^3.13.12",
102
+ "@tanstack/react-virtual": "3.13.13",
103
103
  "classnames": "2.5.1",
104
104
  "date-fns": "4.1.0",
105
105
  "driver.js": "1.4.0",
@@ -107,7 +107,7 @@
107
107
  "events": "3.3.0",
108
108
  "iframe-resizer-react": "1.1.0",
109
109
  "moment": "2.30.1",
110
- "motion": "12.23.24",
110
+ "motion": "12.23.26",
111
111
  "natural-orderby": "5.0.0",
112
112
  "process": "0.11.10",
113
113
  "prop-types": "15.8.1",
@@ -116,15 +116,14 @@
116
116
  "react-content-loader": "7.1.1",
117
117
  "react-custom-scrollbars-4": "4.5.1",
118
118
  "react-datetime": "github:rio-cloud/react-datetime#v3.1.1-1-merged",
119
- "react-day-picker": "9.11.2",
119
+ "react-day-picker": "9.12.0",
120
120
  "react-dropzone": "14.3.8",
121
121
  "react-imask": "7.6.1",
122
122
  "react-notifications": "1.7.4",
123
123
  "react-onclickoutside": "6.13.2",
124
124
  "react-popper": "2.3.0",
125
- "react-shadow-root": "6.2.0",
126
125
  "react-toastify": "11.0.5",
127
- "recharts": "3.5.0",
126
+ "recharts": "3.5.1",
128
127
  "tiny-invariant": "1.3.3",
129
128
  "tslib": "2.8.1"
130
129
  },
@@ -0,0 +1 @@
1
+ export { useAutoAnimate as default } from '@formkit/auto-animate/react';
@@ -0,0 +1,5 @@
1
+ import { useAutoAnimate as a } from "@formkit/auto-animate/react";
2
+ export {
3
+ a as default
4
+ };
5
+ //# sourceMappingURL=useAutoAnimate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAutoAnimate.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,2 @@
1
+ export { default } from './hooks/useIncomingPostMessages';
2
+ export * from './hooks/useIncomingPostMessages';
@@ -0,0 +1,5 @@
1
+ import { default as o } from "./hooks/useIncomingPostMessages.js";
2
+ export {
3
+ o as default
4
+ };
5
+ //# sourceMappingURL=useIncomingPostMessages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIncomingPostMessages.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,2 @@
1
+ export { default } from './hooks/usePostMessageSender';
2
+ export * from './hooks/usePostMessageSender';
@@ -0,0 +1,5 @@
1
+ import { default as o } from "./hooks/usePostMessageSender.js";
2
+ export {
3
+ o as default
4
+ };
5
+ //# sourceMappingURL=usePostMessageSender.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePostMessageSender.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1 +1 @@
1
- {"version":3,"file":"urlFeatureToggles.js","sources":["../../src/utils/urlFeatureToggles.ts"],"sourcesContent":["import qs from 'qs';\nimport { get, mapValues } from 'es-toolkit/compat';\n\nimport { storage } from './storageUtils';\n\nexport const DEFAULT_PREFIX = 'featureToggle.';\n\nexport type ToggleType = string | boolean | number;\n\nexport const cleanupOldToggles = (oldToggles: string[], prefix: string) => {\n try {\n oldToggles.forEach(toggle => {\n storage.removeItem(toggle, prefix);\n });\n } catch (error) {\n console.error(error);\n }\n};\n\nconst detectToggle = <T extends ToggleType, DEFAULT extends T | null>(\n param: string,\n prefix: string,\n transformFn: (urlValue: string) => T,\n defaultValue: DEFAULT\n) => {\n const [_, searchParams = ''] = window.location.hash.split('?');\n const urlSearchParams = qs.parse(searchParams);\n const urlValue = get(urlSearchParams, param)?.toString() || '';\n\n const storageValue = urlValue ? storage.save(param, urlValue, prefix) : storage.load(param, prefix);\n return storageValue ? transformFn(storageValue) : defaultValue;\n};\n\nconst transformBoolean = (value: string) => value === 'true' || value === '1';\nconst transformString = (value: string) => value;\nconst transformNumber = (value: string) => Number.parseFloat(value);\n\nexport const asBoolean = (urlParamName: string) => (prefix: string) =>\n detectToggle(urlParamName, prefix, transformBoolean, null);\n\nexport const asBooleanWithDefault = (urlParamName: string, defaultValue: boolean) => (prefix: string) =>\n detectToggle(urlParamName, prefix, transformBoolean, defaultValue);\n\nexport const asString = (urlParamName: string) => (prefix: string) =>\n detectToggle(urlParamName, prefix, transformString, null);\n\nexport const asStringWithDefault = (urlParamName: string, defaultValue: string) => (prefix: string) =>\n detectToggle(urlParamName, prefix, transformString, defaultValue);\n\nexport const asNumber = (urlParamName: string) => (prefix: string) =>\n detectToggle(urlParamName, prefix, transformNumber, null);\n\nexport const asNumberWithDefault = (urlParamName: string, defaultValue: number) => (prefix: string) =>\n detectToggle(urlParamName, prefix, transformNumber, defaultValue);\n\ntype ToggleValueExtractor = (prefix: string) => ToggleType | null;\n\n// The extends conditional here is intentional because it gives nicer type hints in editors.\ntype ToggleValues<TOGGLE_DEFS> = TOGGLE_DEFS extends Record<string, ToggleValueExtractor>\n ? {\n [K in keyof TOGGLE_DEFS]: ReturnType<TOGGLE_DEFS[K]>;\n }\n : never;\n\nexport const detectFeatureToggles = <TOGGLE_DEFS extends Record<string, ToggleValueExtractor>>(\n toggleDefinitions: TOGGLE_DEFS,\n oldToggles: string[] = [],\n prefix: string = DEFAULT_PREFIX\n): ToggleValues<TOGGLE_DEFS> => {\n cleanupOldToggles(oldToggles, prefix);\n\n return mapValues(toggleDefinitions, toggleFn => toggleFn(prefix)) as ToggleValues<TOGGLE_DEFS>;\n};\n"],"names":["DEFAULT_PREFIX","cleanupOldToggles","oldToggles","prefix","toggle","storage","error","detectToggle","param","transformFn","defaultValue","_","searchParams","urlSearchParams","qs","urlValue","get","storageValue","transformBoolean","value","transformString","transformNumber","asBoolean","urlParamName","asBooleanWithDefault","asString","asStringWithDefault","asNumber","asNumberWithDefault","detectFeatureToggles","toggleDefinitions","mapValues","toggleFn"],"mappings":";;;AAKO,MAAMA,IAAiB,kBAIjBC,IAAoB,CAACC,GAAsBC,MAAmB;AACvE,MAAI;AACA,IAAAD,EAAW,QAAQ,CAAAE,MAAU;AACzB,MAAAC,EAAQ,WAAWD,GAAQD,CAAM;AAAA,IACrC,CAAC;AAAA,EACL,SAASG,GAAO;AACZ,YAAQ,MAAMA,CAAK;AAAA,EACvB;AACJ,GAEMC,IAAe,CACjBC,GACAL,GACAM,GACAC,MACC;AACD,QAAM,CAACC,GAAGC,IAAe,EAAE,IAAI,OAAO,SAAS,KAAK,MAAM,GAAG,GACvDC,IAAkBC,EAAG,MAAMF,CAAY,GACvCG,IAAWC,EAAIH,GAAiBL,CAAK,GAAG,cAAc,IAEtDS,IAAeF,IAAWV,EAAQ,KAAKG,GAAOO,GAAUZ,CAAM,IAAIE,EAAQ,KAAKG,GAAOL,CAAM;AAClG,SAAOc,IAAeR,EAAYQ,CAAY,IAAIP;AACtD,GAEMQ,IAAmB,CAACC,MAAkBA,MAAU,UAAUA,MAAU,KACpEC,IAAkB,CAACD,MAAkBA,GACrCE,IAAkB,CAACF,MAAkB,OAAO,WAAWA,CAAK,GAErDG,IAAY,CAACC,MAAyB,CAACpB,MAChDI,EAAagB,GAAcpB,GAAQe,GAAkB,IAAI,GAEhDM,IAAuB,CAACD,GAAsBb,MAA0B,CAACP,MAClFI,EAAagB,GAAcpB,GAAQe,GAAkBR,CAAY,GAExDe,IAAW,CAACF,MAAyB,CAACpB,MAC/CI,EAAagB,GAAcpB,GAAQiB,GAAiB,IAAI,GAE/CM,IAAsB,CAACH,GAAsBb,MAAyB,CAACP,MAChFI,EAAagB,GAAcpB,GAAQiB,GAAiBV,CAAY,GAEvDiB,IAAW,CAACJ,MAAyB,CAACpB,MAC/CI,EAAagB,GAAcpB,GAAQkB,GAAiB,IAAI,GAE/CO,IAAsB,CAACL,GAAsBb,MAAyB,CAACP,MAChFI,EAAagB,GAAcpB,GAAQkB,GAAiBX,CAAY,GAWvDmB,IAAuB,CAChCC,GACA5B,IAAuB,CAAA,GACvBC,IAAiBH,OAEjBC,EAAkBC,GAAYC,CAAM,GAE7B4B,EAAUD,GAAmB,CAAAE,MAAYA,EAAS7B,CAAM,CAAC;"}
1
+ {"version":3,"file":"urlFeatureToggles.js","sources":["../../src/utils/urlFeatureToggles.ts"],"sourcesContent":["import qs from 'qs';\nimport { get, mapValues } from 'es-toolkit/compat';\n\nimport { storage } from './storageUtils';\n\nexport const DEFAULT_PREFIX = 'featureToggle.';\n\nexport type ToggleType = string | boolean | number;\n\nexport const cleanupOldToggles = (oldToggles: string[], prefix: string) => {\n try {\n oldToggles.forEach(toggle => {\n storage.removeItem(toggle, prefix);\n });\n } catch (error) {\n console.error(error);\n }\n};\n\nconst detectToggle = <T extends ToggleType, DEFAULT extends T | null>(\n param: string,\n prefix: string,\n transformFn: (urlValue: string) => T,\n defaultValue: DEFAULT\n) => {\n const [_, searchParams = ''] = window.location.hash.split('?');\n const urlSearchParams = qs.parse(searchParams);\n const urlValue = get(urlSearchParams, param)?.toString() || '';\n\n const storageValue = urlValue ? storage.save(param, urlValue, prefix) : storage.load(param, prefix);\n return storageValue ? transformFn(storageValue) : defaultValue;\n};\n\nconst transformBoolean = (value: string) => value === 'true' || value === '1';\nconst transformString = (value: string) => value;\nconst transformNumber = (value: string) => Number.parseFloat(value);\n\nexport const asBoolean = (urlParamName: string) => (prefix: string) =>\n detectToggle(urlParamName, prefix, transformBoolean, null);\n\nexport const asBooleanWithDefault = (urlParamName: string, defaultValue: boolean) => (prefix: string) =>\n detectToggle(urlParamName, prefix, transformBoolean, defaultValue);\n\nexport const asString = (urlParamName: string) => (prefix: string) =>\n detectToggle(urlParamName, prefix, transformString, null);\n\nexport const asStringWithDefault = (urlParamName: string, defaultValue: string) => (prefix: string) =>\n detectToggle(urlParamName, prefix, transformString, defaultValue);\n\nexport const asNumber = (urlParamName: string) => (prefix: string) =>\n detectToggle(urlParamName, prefix, transformNumber, null);\n\nexport const asNumberWithDefault = (urlParamName: string, defaultValue: number) => (prefix: string) =>\n detectToggle(urlParamName, prefix, transformNumber, defaultValue);\n\ntype ToggleValueExtractor = (prefix: string) => ToggleType | null;\n\n// The extends conditional here is intentional because it gives nicer type hints in editors.\ntype ToggleValues<TOGGLE_DEFS> =\n TOGGLE_DEFS extends Record<string, ToggleValueExtractor>\n ? {\n [K in keyof TOGGLE_DEFS]: ReturnType<TOGGLE_DEFS[K]>;\n }\n : never;\n\nexport const detectFeatureToggles = <TOGGLE_DEFS extends Record<string, ToggleValueExtractor>>(\n toggleDefinitions: TOGGLE_DEFS,\n oldToggles: string[] = [],\n prefix: string = DEFAULT_PREFIX\n): ToggleValues<TOGGLE_DEFS> => {\n cleanupOldToggles(oldToggles, prefix);\n\n return mapValues(toggleDefinitions, toggleFn => toggleFn(prefix)) as ToggleValues<TOGGLE_DEFS>;\n};\n"],"names":["DEFAULT_PREFIX","cleanupOldToggles","oldToggles","prefix","toggle","storage","error","detectToggle","param","transformFn","defaultValue","_","searchParams","urlSearchParams","qs","urlValue","get","storageValue","transformBoolean","value","transformString","transformNumber","asBoolean","urlParamName","asBooleanWithDefault","asString","asStringWithDefault","asNumber","asNumberWithDefault","detectFeatureToggles","toggleDefinitions","mapValues","toggleFn"],"mappings":";;;AAKO,MAAMA,IAAiB,kBAIjBC,IAAoB,CAACC,GAAsBC,MAAmB;AACvE,MAAI;AACA,IAAAD,EAAW,QAAQ,CAAAE,MAAU;AACzB,MAAAC,EAAQ,WAAWD,GAAQD,CAAM;AAAA,IACrC,CAAC;AAAA,EACL,SAASG,GAAO;AACZ,YAAQ,MAAMA,CAAK;AAAA,EACvB;AACJ,GAEMC,IAAe,CACjBC,GACAL,GACAM,GACAC,MACC;AACD,QAAM,CAACC,GAAGC,IAAe,EAAE,IAAI,OAAO,SAAS,KAAK,MAAM,GAAG,GACvDC,IAAkBC,EAAG,MAAMF,CAAY,GACvCG,IAAWC,EAAIH,GAAiBL,CAAK,GAAG,cAAc,IAEtDS,IAAeF,IAAWV,EAAQ,KAAKG,GAAOO,GAAUZ,CAAM,IAAIE,EAAQ,KAAKG,GAAOL,CAAM;AAClG,SAAOc,IAAeR,EAAYQ,CAAY,IAAIP;AACtD,GAEMQ,IAAmB,CAACC,MAAkBA,MAAU,UAAUA,MAAU,KACpEC,IAAkB,CAACD,MAAkBA,GACrCE,IAAkB,CAACF,MAAkB,OAAO,WAAWA,CAAK,GAErDG,IAAY,CAACC,MAAyB,CAACpB,MAChDI,EAAagB,GAAcpB,GAAQe,GAAkB,IAAI,GAEhDM,IAAuB,CAACD,GAAsBb,MAA0B,CAACP,MAClFI,EAAagB,GAAcpB,GAAQe,GAAkBR,CAAY,GAExDe,IAAW,CAACF,MAAyB,CAACpB,MAC/CI,EAAagB,GAAcpB,GAAQiB,GAAiB,IAAI,GAE/CM,IAAsB,CAACH,GAAsBb,MAAyB,CAACP,MAChFI,EAAagB,GAAcpB,GAAQiB,GAAiBV,CAAY,GAEvDiB,IAAW,CAACJ,MAAyB,CAACpB,MAC/CI,EAAagB,GAAcpB,GAAQkB,GAAiB,IAAI,GAE/CO,IAAsB,CAACL,GAAsBb,MAAyB,CAACP,MAChFI,EAAagB,GAAcpB,GAAQkB,GAAiBX,CAAY,GAYvDmB,IAAuB,CAChCC,GACA5B,IAAuB,CAAA,GACvBC,IAAiBH,OAEjBC,EAAkBC,GAAYC,CAAM,GAE7B4B,EAAUD,GAAmB,CAAAE,MAAYA,EAAS7B,CAAM,CAAC;"}
package/version.d.ts CHANGED
@@ -1 +1 @@
1
- export const version: "2.0.0-beta.2";
1
+ export const version: "2.0.1";
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
- const e = "2.0.0-beta.2";
1
+ const o = "2.0.1";
2
2
  export {
3
- e as version
3
+ o as version
4
4
  };
5
5
  //# sourceMappingURL=version.js.map
package/version.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sources":["../src/version.js"],"sourcesContent":["export const version = '2.0.0-beta.2';\n"],"names":["version"],"mappings":"AAAY,MAACA,IAAU;"}
1
+ {"version":3,"file":"version.js","sources":["../src/version.js"],"sourcesContent":["export const version = '2.0.1';\n"],"names":["version"],"mappings":"AAAY,MAACA,IAAU;"}
package/.DS_Store DELETED
Binary file