@uva-glass/component-library 1.48.1 → 1.50.0
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/dist/MultiSelect-Ckf3uGw5.js.map +1 -1
- package/dist/assets/CheckboxButton.css +1 -0
- package/dist/assets/CheckboxButtonBar.css +1 -0
- package/dist/assets/CheckboxTree.css +1 -1
- package/dist/assets/Label.css +1 -1
- package/dist/assets/PeriodSelector.css +1 -0
- package/dist/components/Button/Button.d.ts +4 -0
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Button/Button.stories.js +14 -13
- package/dist/components/Button/Button.stories.js.map +1 -1
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +3 -0
- package/dist/components/ButtonGroup/ButtonGroup.js.map +1 -1
- package/dist/components/ButtonGroup/ButtonGroup.stories.js +1 -0
- package/dist/components/ButtonGroup/ButtonGroup.stories.js.map +1 -1
- package/dist/components/Card/Card.d.ts +6 -0
- package/dist/components/Card/Card.js.map +1 -1
- package/dist/components/Card/Card.stories.js +14 -13
- package/dist/components/Card/Card.stories.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +1 -0
- package/dist/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.stories.js +17 -16
- package/dist/components/Checkbox/Checkbox.stories.js.map +1 -1
- package/dist/components/CheckboxButton/CheckboxButton.d.ts +16 -0
- package/dist/components/CheckboxButton/CheckboxButton.js +51 -0
- package/dist/components/CheckboxButton/CheckboxButton.js.map +1 -0
- package/dist/components/CheckboxButton/CheckboxButton.stories.d.ts +5 -0
- package/dist/components/CheckboxButton/CheckboxButton.stories.js +48 -0
- package/dist/components/CheckboxButton/CheckboxButton.stories.js.map +1 -0
- package/dist/components/CheckboxButton/index.d.ts +1 -0
- package/dist/components/CheckboxButton/index.js +5 -0
- package/dist/components/CheckboxButton/index.js.map +1 -0
- package/dist/components/CheckboxButtonBar/CheckboxButtonBar.d.ts +22 -0
- package/dist/components/CheckboxButtonBar/CheckboxButtonBar.js +62 -0
- package/dist/components/CheckboxButtonBar/CheckboxButtonBar.js.map +1 -0
- package/dist/components/CheckboxButtonBar/CheckboxButtonBar.stories.d.ts +5 -0
- package/dist/components/CheckboxButtonBar/CheckboxButtonBar.stories.js +70 -0
- package/dist/components/CheckboxButtonBar/CheckboxButtonBar.stories.js.map +1 -0
- package/dist/components/CheckboxButtonBar/index.d.ts +1 -0
- package/dist/components/CheckboxButtonBar/index.js +5 -0
- package/dist/components/CheckboxButtonBar/index.js.map +1 -0
- package/dist/components/CheckboxTree/CheckboxTree.d.ts +5 -3
- package/dist/components/CheckboxTree/CheckboxTree.js +42 -42
- package/dist/components/CheckboxTree/CheckboxTree.js.map +1 -1
- package/dist/components/CheckboxTree/CheckboxTree.stories.js +1 -1
- package/dist/components/CheckboxTree/CheckboxTree.stories.js.map +1 -1
- package/dist/components/Drawer/Drawer.d.ts +6 -0
- package/dist/components/Drawer/Drawer.js.map +1 -1
- package/dist/components/Drawer/Drawer.stories.js +16 -15
- package/dist/components/Drawer/Drawer.stories.js.map +1 -1
- package/dist/components/EmptyStateDataDisplay/EmptyStateDataDisplay.d.ts +3 -0
- package/dist/components/EmptyStateDataDisplay/EmptyStateDataDisplay.js.map +1 -1
- package/dist/components/EmptyStateDataDisplay/EmptyStateDataDisplay.stories.js +3 -2
- package/dist/components/EmptyStateDataDisplay/EmptyStateDataDisplay.stories.js.map +1 -1
- package/dist/components/FeedbackBox/FeedbackBox.d.ts +4 -0
- package/dist/components/FeedbackBox/FeedbackBox.js.map +1 -1
- package/dist/components/FeedbackBox/FeedbackBox.stories.js +10 -9
- package/dist/components/FeedbackBox/FeedbackBox.stories.js.map +1 -1
- package/dist/components/FieldHint/FieldHint.d.ts +4 -0
- package/dist/components/FieldHint/FieldHint.js.map +1 -1
- package/dist/components/FieldHint/FieldHint.stories.js +1 -0
- package/dist/components/FieldHint/FieldHint.stories.js.map +1 -1
- package/dist/components/Fieldset/Fieldset.d.ts +5 -0
- package/dist/components/Fieldset/Fieldset.js.map +1 -1
- package/dist/components/Fieldset/Fieldset.stories.js +20 -19
- package/dist/components/Fieldset/Fieldset.stories.js.map +1 -1
- package/dist/components/FormField/FormField.d.ts +3 -0
- package/dist/components/FormField/FormField.js.map +1 -1
- package/dist/components/FormField/FormField.stories.js +16 -15
- package/dist/components/FormField/FormField.stories.js.map +1 -1
- package/dist/components/GridRow/GridRow.d.ts +4 -0
- package/dist/components/GridRow/GridRow.js +4 -4
- package/dist/components/GridRow/GridRow.js.map +1 -1
- package/dist/components/GridRow/GridRow.stories.js +1 -0
- package/dist/components/GridRow/GridRow.stories.js.map +1 -1
- package/dist/components/HorizontalList/HorizontalList.d.ts +3 -0
- package/dist/components/HorizontalList/HorizontalList.js.map +1 -1
- package/dist/components/HorizontalList/HorizontalList.stories.js +7 -6
- package/dist/components/HorizontalList/HorizontalList.stories.js.map +1 -1
- package/dist/components/Icon/Icon.d.ts +4 -0
- package/dist/components/Icon/Icon.js.map +1 -1
- package/dist/components/Icon/Icon.stories.js +1 -0
- package/dist/components/Icon/Icon.stories.js.map +1 -1
- package/dist/components/IconButton/IconButton.d.ts +5 -0
- package/dist/components/IconButton/IconButton.js.map +1 -1
- package/dist/components/IconButton/IconButton.stories.js +8 -7
- package/dist/components/IconButton/IconButton.stories.js.map +1 -1
- package/dist/components/InfoMessage/InfoMessage.d.ts +3 -0
- package/dist/components/InfoMessage/InfoMessage.js.map +1 -1
- package/dist/components/InfoMessage/InfoMessage.stories.js +4 -3
- package/dist/components/InfoMessage/InfoMessage.stories.js.map +1 -1
- package/dist/components/Input/Input.d.ts +6 -0
- package/dist/components/Input/Input.js.map +1 -1
- package/dist/components/Input/Input.stories.js +11 -10
- package/dist/components/Input/Input.stories.js.map +1 -1
- package/dist/components/InputField/InputField.d.ts +6 -0
- package/dist/components/InputField/InputField.js.map +1 -1
- package/dist/components/InputField/InputField.stories.js +16 -15
- package/dist/components/InputField/InputField.stories.js.map +1 -1
- package/dist/components/Label/Label.d.ts +6 -1
- package/dist/components/Label/Label.js +12 -10
- package/dist/components/Label/Label.js.map +1 -1
- package/dist/components/Label/Label.stories.js +1 -0
- package/dist/components/Label/Label.stories.js.map +1 -1
- package/dist/components/MenuButton/MenuButton.d.ts +4 -0
- package/dist/components/MenuButton/MenuButton.js +1 -1
- package/dist/components/MenuButton/MenuButton.js.map +1 -1
- package/dist/components/MenuButton/MenuButton.stories.js +19 -18
- package/dist/components/MenuButton/MenuButton.stories.js.map +1 -1
- package/dist/components/MenuLink/MenuLink.d.ts +1 -0
- package/dist/components/MenuLink/MenuLink.js.map +1 -1
- package/dist/components/MenuLink/MenuLink.stories.js +5 -4
- package/dist/components/MenuLink/MenuLink.stories.js.map +1 -1
- package/dist/components/MetaDataList/MetaDataList.d.ts +2 -0
- package/dist/components/MetaDataList/MetaDataList.js.map +1 -1
- package/dist/components/MetaDataList/MetaDataList.stories.js +5 -4
- package/dist/components/MetaDataList/MetaDataList.stories.js.map +1 -1
- package/dist/components/ModalDialog/ModalDialog.d.ts +20 -1
- package/dist/components/ModalDialog/ModalDialog.js.map +1 -1
- package/dist/components/ModalDialog/ModalDialog.stories.js +9 -8
- package/dist/components/ModalDialog/ModalDialog.stories.js.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.d.ts +4 -0
- package/dist/components/MultiSelect/MultiSelect.stories.js +23 -22
- package/dist/components/MultiSelect/MultiSelect.stories.js.map +1 -1
- package/dist/components/OverlayCloseButton/OverlayCloseButton.d.ts +3 -0
- package/dist/components/OverlayCloseButton/OverlayCloseButton.js.map +1 -1
- package/dist/components/OverlayCloseButton/OverlayCloseButton.stories.js +11 -10
- package/dist/components/OverlayCloseButton/OverlayCloseButton.stories.js.map +1 -1
- package/dist/components/PeriodSelector/PeriodSelector.d.ts +16 -0
- package/dist/components/PeriodSelector/PeriodSelector.js +74 -0
- package/dist/components/PeriodSelector/PeriodSelector.js.map +1 -0
- package/dist/components/PeriodSelector/PeriodSelector.stories.d.ts +5 -0
- package/dist/components/PeriodSelector/PeriodSelector.stories.js +25 -0
- package/dist/components/PeriodSelector/PeriodSelector.stories.js.map +1 -0
- package/dist/components/PeriodSelector/index.d.ts +1 -0
- package/dist/components/PeriodSelector/index.js +5 -0
- package/dist/components/PeriodSelector/index.js.map +1 -0
- package/dist/components/Periods/Periods.d.ts +4 -0
- package/dist/components/Periods/Periods.js.map +1 -1
- package/dist/components/Periods/Periods.stories.js +1 -0
- package/dist/components/Periods/Periods.stories.js.map +1 -1
- package/dist/components/ProgrammeCard/ProgrammeCard.d.ts +4 -0
- package/dist/components/ProgrammeCard/ProgrammeCard.js.map +1 -1
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +19 -18
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js.map +1 -1
- package/dist/components/RadioButton/RadioButton.d.ts +5 -0
- package/dist/components/RadioButton/RadioButton.js.map +1 -1
- package/dist/components/RadioButton/RadioButton.stories.js +9 -8
- package/dist/components/RadioButton/RadioButton.stories.js.map +1 -1
- package/dist/components/Repeater/Repeater.d.ts +3 -0
- package/dist/components/Repeater/Repeater.js.map +1 -1
- package/dist/components/Repeater/Repeater.stories.js +6 -5
- package/dist/components/Repeater/Repeater.stories.js.map +1 -1
- package/dist/components/SectionNotification/SectionNotification.d.ts +2 -0
- package/dist/components/SectionNotification/SectionNotification.js.map +1 -1
- package/dist/components/SectionNotification/SectionNotification.stories.js +1 -0
- package/dist/components/SectionNotification/SectionNotification.stories.js.map +1 -1
- package/dist/components/SelectListbox/SelectListBox.stories.d.ts +2 -2
- package/dist/components/SelectListbox/SelectListBox.stories.js +1 -0
- package/dist/components/SelectListbox/SelectListBox.stories.js.map +1 -1
- package/dist/components/SelectListbox/SelectListbox.d.ts +12 -0
- package/dist/components/SelectListbox/SelectListbox.js +9 -9
- package/dist/components/SelectListbox/SelectListbox.js.map +1 -1
- package/dist/components/Spinner/Spinner.d.ts +3 -1
- package/dist/components/Spinner/Spinner.js.map +1 -1
- package/dist/components/Spinner/Spinner.stories.js +4 -3
- package/dist/components/Spinner/Spinner.stories.js.map +1 -1
- package/dist/components/StatusPill/StatusPill.d.ts +4 -0
- package/dist/components/StatusPill/StatusPill.js.map +1 -1
- package/dist/components/StatusPill/StatusPill.stories.js +7 -6
- package/dist/components/StatusPill/StatusPill.stories.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +6 -0
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.stories.js +10 -9
- package/dist/components/Tooltip/Tooltip.stories.js.map +1 -1
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +73 -67
- package/dist/components/index.js.map +1 -1
- package/dist/index.js +73 -67
- package/dist/index.js.map +1 -1
- package/package.json +17 -17
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
2
|
import { OptionValue, SelectValue } from './SelectProvider';
|
|
3
3
|
export interface SelectListboxProps {
|
|
4
|
+
/** The possible options to select. */
|
|
4
5
|
options: OptionValue[];
|
|
6
|
+
/** The selected value by default. */
|
|
5
7
|
defaultValue?: SelectValue;
|
|
8
|
+
/** The max height of the options. */
|
|
6
9
|
maxOptionHeight?: `${number}${'px' | 'rem'}`;
|
|
10
|
+
/** `true` to disable the select box; otherwise, `false`. The default is `false`. */
|
|
7
11
|
disabled?: boolean;
|
|
12
|
+
/** The name of the property in the options structure that contains the label of the options. */
|
|
8
13
|
buttonLabelProp?: string;
|
|
14
|
+
/** `true` to render the labels in bold; otherwise, `false`. The default is `false`. */
|
|
9
15
|
buttonLabelBold?: boolean;
|
|
16
|
+
/** The variant of the select box. */
|
|
10
17
|
variant?: 'noborder' | 'pill' | 'pillLeft' | 'pillRight';
|
|
18
|
+
/** The size of the select box. */
|
|
11
19
|
size?: 'small' | 'default';
|
|
20
|
+
/** `true` to align the right side of the options with the select box; otherwise, `false` to align on the left side. */
|
|
12
21
|
optionPositionRight?: boolean;
|
|
22
|
+
/** The breakpoint at which to switch to the mobile view. */
|
|
13
23
|
mobileBreakpoint?: `${number}${'px' | 'rem'}`;
|
|
24
|
+
/** The callback function that is invoked when an option is selected. */
|
|
14
25
|
onChange?: (option: OptionValue) => void;
|
|
15
26
|
}
|
|
27
|
+
/** Represents a component to render a select list box. */
|
|
16
28
|
export declare const SelectListbox: {
|
|
17
29
|
({ options, variant, size, optionPositionRight, defaultValue, maxOptionHeight, disabled, buttonLabelProp, buttonLabelBold, onChange, children, }: PropsWithChildren<SelectListboxProps>): import("react/jsx-runtime").JSX.Element;
|
|
18
30
|
SelectOption: ({ option, index, children }: import('./components/SelectOption').SelectOptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as e, jsxs as E } from "react/jsx-runtime";
|
|
2
2
|
import { useState as t } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { SelectProvider as b } from "./SelectProvider.js";
|
|
4
|
+
import { SelectButton as P } from "./components/SelectButton.js";
|
|
5
|
+
import { SelectContainer as B } from "./components/SelectContainer.js";
|
|
6
|
+
import { SelectOptionBox as O } from "./components/SelectOptionBox.js";
|
|
7
|
+
import { SelectOption as g } from "./components/SelectOption.js";
|
|
8
8
|
import { usePositionedFloaters as j } from "../hooks/usePositionedFloaters.js";
|
|
9
9
|
const k = ({
|
|
10
10
|
options: o,
|
|
@@ -27,9 +27,9 @@ const k = ({
|
|
|
27
27
|
horizontalPosition: n ? "right" : "left",
|
|
28
28
|
mobileBreakpoint: "28rem"
|
|
29
29
|
});
|
|
30
|
-
return /* @__PURE__ */ e(
|
|
30
|
+
return /* @__PURE__ */ e(b, { options: o, defaultValue: l, children: /* @__PURE__ */ E(B, { children: [
|
|
31
31
|
/* @__PURE__ */ e(
|
|
32
|
-
|
|
32
|
+
P,
|
|
33
33
|
{
|
|
34
34
|
disabled: s,
|
|
35
35
|
buttonLabelProp: c,
|
|
@@ -40,10 +40,10 @@ const k = ({
|
|
|
40
40
|
ref: d
|
|
41
41
|
}
|
|
42
42
|
),
|
|
43
|
-
/* @__PURE__ */ e(
|
|
43
|
+
/* @__PURE__ */ e(O, { ref: u, ...h, children: S })
|
|
44
44
|
] }) });
|
|
45
45
|
};
|
|
46
|
-
k.SelectOption =
|
|
46
|
+
k.SelectOption = g;
|
|
47
47
|
export {
|
|
48
48
|
k as SelectListbox
|
|
49
49
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectListbox.js","sources":["../../../src/components/SelectListbox/SelectListbox.tsx"],"sourcesContent":["import { useState } from 'react';\n\nimport type { PropsWithChildren } from 'react';\nimport type { OptionValue, SelectValue } from './SelectProvider';\n\nimport {
|
|
1
|
+
{"version":3,"file":"SelectListbox.js","sources":["../../../src/components/SelectListbox/SelectListbox.tsx"],"sourcesContent":["import { useState } from 'react';\n\nimport type { PropsWithChildren } from 'react';\nimport type { OptionValue, SelectValue } from './SelectProvider';\n\nimport { SelectProvider } from './SelectProvider';\nimport { SelectButton } from './components/SelectButton';\nimport { SelectContainer } from './components/SelectContainer';\nimport { SelectOptionBox } from './components/SelectOptionBox';\nimport { SelectOption } from './components/SelectOption';\n\nimport { usePositionedFloaters } from 'components/hooks/usePositionedFloaters';\n\nexport interface SelectListboxProps {\n /** The possible options to select. */\n options: OptionValue[];\n /** The selected value by default. */\n defaultValue?: SelectValue;\n /** The max height of the options. */\n maxOptionHeight?: `${number}${'px' | 'rem'}`;\n /** `true` to disable the select box; otherwise, `false`. The default is `false`. */\n disabled?: boolean;\n /** The name of the property in the options structure that contains the label of the options. */\n buttonLabelProp?: string;\n /** `true` to render the labels in bold; otherwise, `false`. The default is `false`. */\n buttonLabelBold?: boolean;\n /** The variant of the select box. */\n variant?: 'noborder' | 'pill' | 'pillLeft' | 'pillRight';\n /** The size of the select box. */\n size?: 'small' | 'default';\n /** `true` to align the right side of the options with the select box; otherwise, `false` to align on the left side. */\n optionPositionRight?: boolean;\n /** The breakpoint at which to switch to the mobile view. */\n mobileBreakpoint?: `${number}${'px' | 'rem'}`;\n /** The callback function that is invoked when an option is selected. */\n onChange?: (option: OptionValue) => void;\n}\n\n/** Represents a component to render a select list box. */\nexport const SelectListbox = ({\n options,\n variant,\n size = 'default',\n optionPositionRight,\n defaultValue = -1,\n maxOptionHeight,\n disabled,\n buttonLabelProp = 'label',\n buttonLabelBold,\n onChange,\n children,\n}: PropsWithChildren<SelectListboxProps>) => {\n const [positionElement, setPositionElement] = useState<HTMLElement | null>(null);\n const [referenceElement, setReferenceElement] = useState<HTMLElement | null>(null);\n const { style: positionStyle } = usePositionedFloaters(positionElement, referenceElement, {\n mouseEvent: 'click',\n position: 'bottomLeft',\n offset: 4,\n maxFixedHeight: maxOptionHeight,\n horizontalPosition: optionPositionRight ? 'right' : 'left',\n mobileBreakpoint: '28rem',\n });\n\n return (\n <SelectProvider options={options} defaultValue={defaultValue}>\n <SelectContainer>\n <SelectButton\n disabled={disabled}\n buttonLabelProp={buttonLabelProp}\n buttonLabelBold={buttonLabelBold}\n variant={variant}\n size={size}\n onChange={onChange}\n ref={setReferenceElement}\n />\n\n <SelectOptionBox ref={setPositionElement} {...positionStyle}>\n {children}\n </SelectOptionBox>\n </SelectContainer>\n </SelectProvider>\n );\n};\n\nSelectListbox.SelectOption = SelectOption;\n"],"names":["SelectListbox","options","variant","size","optionPositionRight","defaultValue","maxOptionHeight","disabled","buttonLabelProp","buttonLabelBold","onChange","children","positionElement","setPositionElement","useState","referenceElement","setReferenceElement","positionStyle","usePositionedFloaters","jsx","SelectProvider","SelectContainer","SelectButton","SelectOptionBox","SelectOption"],"mappings":";;;;;;;;AAuCO,MAAMA,IAAgB,CAAC;AAAA,EAC5B,SAAAC;AAAA,EACA,SAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,qBAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,iBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,iBAAAC,IAAkB;AAAA,EAClB,iBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AACF,MAA6C;AAC3C,QAAM,CAACC,GAAiBC,CAAkB,IAAIC,EAA6B,IAAI,GACzE,CAACC,GAAkBC,CAAmB,IAAIF,EAA6B,IAAI,GAC3E,EAAE,OAAOG,EAAA,IAAkBC,EAAsBN,GAAiBG,GAAkB;AAAA,IACxF,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,gBAAgBT;AAAA,IAChB,oBAAoBF,IAAsB,UAAU;AAAA,IACpD,kBAAkB;AAAA,EAAA,CACnB;AAED,SACG,gBAAAe,EAAAC,GAAA,EAAe,SAAAnB,GAAkB,cAAAI,GAChC,4BAACgB,GACC,EAAA,UAAA;AAAA,IAAA,gBAAAF;AAAA,MAACG;AAAA,MAAA;AAAA,QACC,UAAAf;AAAA,QACA,iBAAAC;AAAA,QACA,iBAAAC;AAAA,QACA,SAAAP;AAAA,QACA,MAAAC;AAAA,QACA,UAAAO;AAAA,QACA,KAAKM;AAAA,MAAA;AAAA,IACP;AAAA,sBAECO,GAAgB,EAAA,KAAKV,GAAqB,GAAGI,GAC3C,UAAAN,GACH;AAAA,EAAA,EACF,CAAA,EACF,CAAA;AAEJ;AAEAX,EAAc,eAAewB;"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export interface SpinnerProps {
|
|
2
|
+
/** The `aria-valuetext` of the spinner. */
|
|
2
3
|
ariaValueText: string;
|
|
3
|
-
/** Delay in milliseconds after which the spinner becomes visible. The default is 250
|
|
4
|
+
/** Delay in milliseconds after which the spinner becomes visible. The default is `250`. */
|
|
4
5
|
showAfterMs?: number;
|
|
5
6
|
}
|
|
7
|
+
/** Represents a component to display a spinner. */
|
|
6
8
|
export declare const Spinner: ({ ariaValueText, showAfterMs }: SpinnerProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spinner.js","sources":["../../../src/components/Spinner/Spinner.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nimport styles from './Spinner.module.css';\n\nconst DEFAULT_DELAY_IN_MS = 250;\n\nexport interface SpinnerProps {\n ariaValueText: string;\n /** Delay in milliseconds after which the spinner becomes visible. The default is 250
|
|
1
|
+
{"version":3,"file":"Spinner.js","sources":["../../../src/components/Spinner/Spinner.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nimport styles from './Spinner.module.css';\n\nconst DEFAULT_DELAY_IN_MS = 250;\n\nexport interface SpinnerProps {\n /** The `aria-valuetext` of the spinner. */\n ariaValueText: string;\n /** Delay in milliseconds after which the spinner becomes visible. The default is `250`. */\n showAfterMs?: number;\n}\n\n/** Represents a component to display a spinner. */\nexport const Spinner = ({ ariaValueText, showAfterMs = DEFAULT_DELAY_IN_MS }: SpinnerProps) => {\n const [visible, setVisible] = useState(() => (showAfterMs === 0 ? true : false));\n\n useEffect(() => {\n if (showAfterMs === 0) {\n return;\n }\n const t = window.setTimeout(() => {\n setVisible(true);\n }, showAfterMs);\n\n return () => {\n window.clearTimeout(t);\n };\n });\n\n if (!visible) {\n return null;\n }\n\n return (\n <div className={styles['spinner-container']}>\n <div className={styles['spinner']} role=\"progressbar\" aria-label=\"Spinner\" aria-valuetext={ariaValueText}></div>\n </div>\n );\n};\n"],"names":["DEFAULT_DELAY_IN_MS","Spinner","ariaValueText","showAfterMs","visible","setVisible","useState","useEffect","t","styles"],"mappings":";;;;;;GAIMA,IAAsB,KAUfC,IAAU,CAAC,EAAE,eAAAC,GAAe,aAAAC,IAAcH,QAAwC;AACvF,QAAA,CAACI,GAASC,CAAU,IAAIC,EAAS,MAAOH,MAAgB,CAAiB;AAe/E,SAbAI,EAAU,MAAM;AACd,QAAIJ,MAAgB;AAClB;AAEI,UAAAK,IAAI,OAAO,WAAW,MAAM;AAChC,MAAAH,EAAW,EAAI;AAAA,OACdF,CAAW;AAEd,WAAO,MAAM;AACX,aAAO,aAAaK,CAAC;AAAA,IAAA;AAAA,EACvB,CACD,GAEIJ,sBAKF,OAAI,EAAA,WAAWK,EAAO,mBAAmB,GACxC,4BAAC,OAAI,EAAA,WAAWA,EAAO,SAAY,MAAK,eAAc,cAAW,WAAU,kBAAgBP,GAAe,EAC5G,CAAA,IANO;AAQX;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { Spinner as e } from "./Spinner.js";
|
|
3
|
-
const
|
|
3
|
+
const n = "<Spinner ariaValueText={ariaValueText} />", p = {
|
|
4
4
|
title: "Atoms/Spinner",
|
|
5
5
|
component: e,
|
|
6
6
|
argTypes: {
|
|
@@ -12,9 +12,10 @@ const a = "<Spinner ariaValueText={ariaValueText} />", p = {
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
parameters: {
|
|
15
|
-
|
|
15
|
+
inspectComponent: e,
|
|
16
|
+
codeString: n
|
|
16
17
|
}
|
|
17
|
-
},
|
|
18
|
+
}, a = (t) => /* @__PURE__ */ r(e, { ...t }), o = a.bind({});
|
|
18
19
|
o.args = {
|
|
19
20
|
ariaValueText: "Example value text",
|
|
20
21
|
showAfterMs: 250
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spinner.stories.js","sources":["../../../src/components/Spinner/Spinner.stories.tsx"],"sourcesContent":["import type { Meta, StoryFn } from '@storybook/react';\nimport type { SpinnerProps } from './Spinner';\n\nimport { Spinner } from './Spinner';\n\nconst codeString = '<Spinner ariaValueText={ariaValueText} />';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Atoms/Spinner',\n component: Spinner,\n argTypes: {\n ariaValueText: {\n control: 'text',\n },\n showAfterMs: {\n control: 'number',\n },\n },\n parameters: {\n codeString: codeString,\n },\n} as Meta<SpinnerProps>;\n\nconst Template: StoryFn<SpinnerProps> = (args) => <Spinner {...args} />;\n\nexport const SpinnerExample = Template.bind({});\nSpinnerExample.args = {\n ariaValueText: 'Example value text',\n showAfterMs: 250,\n};\n"],"names":["codeString","Spinner_stories","Spinner","Template","args","jsx","SpinnerExample"],"mappings":";;AAKA,MAAMA,IAAa,6CAGJC,IAAA;AAAA,EACb,OAAO;AAAA,EACP,WAAWC;AAAA,EACX,UAAU;AAAA,IACR,eAAe;AAAA,MACb,SAAS;AAAA,IACX;AAAA,IACA,aAAa;AAAA,MACX,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EACA,YAAY;AAAA,IACV,YAAAF;AAAA,EACF;AACF,GAEMG,IAAkC,CAACC,MAAU,gBAAAC,EAAAH,GAAA,EAAS,GAAGE,EAAM,CAAA,GAExDE,IAAiBH,EAAS,KAAK,EAAE;AAC9CG,EAAe,OAAO;AAAA,EACpB,eAAe;AAAA,EACf,aAAa;AACf;"}
|
|
1
|
+
{"version":3,"file":"Spinner.stories.js","sources":["../../../src/components/Spinner/Spinner.stories.tsx"],"sourcesContent":["import type { Meta, StoryFn } from '@storybook/react';\nimport type { SpinnerProps } from './Spinner';\n\nimport { Spinner } from './Spinner';\n\nconst codeString = '<Spinner ariaValueText={ariaValueText} />';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Atoms/Spinner',\n component: Spinner,\n argTypes: {\n ariaValueText: {\n control: 'text',\n },\n showAfterMs: {\n control: 'number',\n },\n },\n parameters: {\n inspectComponent: Spinner,\n codeString: codeString,\n },\n} as Meta<SpinnerProps>;\n\nconst Template: StoryFn<SpinnerProps> = (args) => <Spinner {...args} />;\n\nexport const SpinnerExample = Template.bind({});\nSpinnerExample.args = {\n ariaValueText: 'Example value text',\n showAfterMs: 250,\n};\n"],"names":["codeString","Spinner_stories","Spinner","Template","args","jsx","SpinnerExample"],"mappings":";;AAKA,MAAMA,IAAa,6CAGJC,IAAA;AAAA,EACb,OAAO;AAAA,EACP,WAAWC;AAAA,EACX,UAAU;AAAA,IACR,eAAe;AAAA,MACb,SAAS;AAAA,IACX;AAAA,IACA,aAAa;AAAA,MACX,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EACA,YAAY;AAAA,IACV,kBAAkBA;AAAA,IAClB,YAAAF;AAAA,EACF;AACF,GAEMG,IAAkC,CAACC,MAAU,gBAAAC,EAAAH,GAAA,EAAS,GAAGE,EAAM,CAAA,GAExDE,IAAiBH,EAAS,KAAK,EAAE;AAC9CG,EAAe,OAAO;AAAA,EACpB,eAAe;AAAA,EACf,aAAa;AACf;"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export interface StatusPillProps {
|
|
2
|
+
/** The status to convey. */
|
|
2
3
|
status: 'possible' | 'impossible' | 'new';
|
|
4
|
+
/** The variant of the pill. */
|
|
3
5
|
variant?: 'default' | 'bar';
|
|
6
|
+
/** A description of the status. */
|
|
4
7
|
label: string;
|
|
5
8
|
}
|
|
9
|
+
/** Represents a component for a status pill. */
|
|
6
10
|
export declare function StatusPill({ status, variant, label }: StatusPillProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusPill.js","sources":["../../../src/components/StatusPill/StatusPill.tsx"],"sourcesContent":["import { clsx } from 'clsx';\n\nimport type { IconProps } from 'components/Icon';\n\nimport styles from './StatusPill.module.css';\n\nimport { Icon } from 'components/Icon';\n\nexport interface StatusPillProps {\n status: 'possible' | 'impossible' | 'new';\n variant?: 'default' | 'bar';\n label: string;\n}\n\nconst iconNameMap: Partial<Record<StatusPillProps['status'], IconProps['name']>> = {\n possible: 'CheckCircleFillMini',\n impossible: 'CrossCircleFillMini',\n};\n\nexport function StatusPill({ status, variant = 'default', label }: StatusPillProps) {\n return (\n <span\n className={clsx(\n styles['status-pill'],\n styles[`status-pill__${status}`],\n variant !== 'default' && styles[`status-pill--${variant}`]\n )}\n >\n {status !== 'new' && <Icon name={iconNameMap[status]!} title={status} size={16} />}\n {label}\n </span>\n );\n}\n"],"names":["iconNameMap","StatusPill","status","variant","label","jsxs","clsx","styles","jsx","Icon"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"StatusPill.js","sources":["../../../src/components/StatusPill/StatusPill.tsx"],"sourcesContent":["import { clsx } from 'clsx';\n\nimport type { IconProps } from 'components/Icon';\n\nimport styles from './StatusPill.module.css';\n\nimport { Icon } from 'components/Icon';\n\nexport interface StatusPillProps {\n /** The status to convey. */\n status: 'possible' | 'impossible' | 'new';\n /** The variant of the pill. */\n variant?: 'default' | 'bar';\n /** A description of the status. */\n label: string;\n}\n\nconst iconNameMap: Partial<Record<StatusPillProps['status'], IconProps['name']>> = {\n possible: 'CheckCircleFillMini',\n impossible: 'CrossCircleFillMini',\n};\n\n/** Represents a component for a status pill. */\nexport function StatusPill({ status, variant = 'default', label }: StatusPillProps) {\n return (\n <span\n className={clsx(\n styles['status-pill'],\n styles[`status-pill__${status}`],\n variant !== 'default' && styles[`status-pill--${variant}`]\n )}\n >\n {status !== 'new' && <Icon name={iconNameMap[status]!} title={status} size={16} />}\n {label}\n </span>\n );\n}\n"],"names":["iconNameMap","StatusPill","status","variant","label","jsxs","clsx","styles","jsx","Icon"],"mappings":";;;;;;;;;GAiBMA,IAA6E;AAAA,EACjF,UAAU;AAAA,EACV,YAAY;AACd;AAGO,SAASC,EAAW,EAAE,QAAAC,GAAQ,SAAAC,IAAU,WAAW,OAAAC,KAA0B;AAEhF,SAAA,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACTC,EAAO,aAAa;AAAA,QACpBA,EAAO,gBAAgBL,CAAM,EAAE;AAAA,QAC/BC,MAAY,aAAaI,EAAO,gBAAgBJ,CAAO,EAAE;AAAA,MAC3D;AAAA,MAEC,UAAA;AAAA,QAAWD,MAAA,SAAU,gBAAAM,EAAAC,GAAA,EAAK,MAAMT,EAAYE,CAAM,GAAI,OAAOA,GAAQ,MAAM,GAAI,CAAA;AAAA,QAC/EE;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { StatusPill as
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { StatusPill as t } from "./StatusPill.js";
|
|
3
3
|
import { Container as s } from "../../storyComponents/Container/Container.js";
|
|
4
|
-
const e = "<StatusPill status={status} label={label} variant={variant}/>",
|
|
4
|
+
const e = "<StatusPill status={status} label={label} variant={variant}/>", p = {
|
|
5
5
|
title: "Molecules/StatusPill",
|
|
6
|
-
component:
|
|
6
|
+
component: t,
|
|
7
7
|
parameters: {
|
|
8
|
+
inspectComponent: t,
|
|
8
9
|
codeString: e
|
|
9
10
|
}
|
|
10
|
-
}, i = (l) => /* @__PURE__ */
|
|
11
|
+
}, i = (l) => /* @__PURE__ */ a(s, { children: /* @__PURE__ */ a(t, { ...l }) }), o = i.bind({});
|
|
11
12
|
o.args = {
|
|
12
13
|
status: "possible",
|
|
13
14
|
variant: "default",
|
|
@@ -15,6 +16,6 @@ o.args = {
|
|
|
15
16
|
};
|
|
16
17
|
export {
|
|
17
18
|
o as StatusPillExample,
|
|
18
|
-
|
|
19
|
+
p as default
|
|
19
20
|
};
|
|
20
21
|
//# sourceMappingURL=StatusPill.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusPill.stories.js","sources":["../../../src/components/StatusPill/StatusPill.stories.tsx"],"sourcesContent":["import type { Meta, StoryFn } from '@storybook/react';\nimport type { StatusPillProps } from './StatusPill';\n\nimport { StatusPill } from './StatusPill';\n\nimport { Container } from 'storyComponents/Container';\n\nconst codeString = '<StatusPill status={status} label={label} variant={variant}/>';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Molecules/StatusPill',\n component: StatusPill,\n parameters: {\n codeString: codeString,\n },\n} as Meta<StatusPillProps>;\n\nconst Template: StoryFn<StatusPillProps> = (args) => (\n <Container>\n <StatusPill {...args} />\n </Container>\n);\n\nexport const StatusPillExample = Template.bind({});\nStatusPillExample.args = {\n status: 'possible',\n variant: 'default',\n label: 'Example Status Pill',\n};\n"],"names":["codeString","StatusPill_stories","StatusPill","Template","args","jsx","Container","StatusPillExample"],"mappings":";;;AAOA,MAAMA,IAAa,kEAGJC,IAAA;AAAA,EACb,OAAO;AAAA,EACP,WAAWC;AAAA,EACX,YAAY;AAAA,IACV,YAAAF;AAAA,EACF;AACF,GAEMG,IAAqC,CAACC,MAC1C,gBAAAC,EAACC,KACC,UAAC,gBAAAD,EAAAH,GAAA,EAAY,GAAGE,EAAM,CAAA,EACxB,CAAA,GAGWG,IAAoBJ,EAAS,KAAK,EAAE;AACjDI,EAAkB,OAAO;AAAA,EACvB,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,OAAO;AACT;"}
|
|
1
|
+
{"version":3,"file":"StatusPill.stories.js","sources":["../../../src/components/StatusPill/StatusPill.stories.tsx"],"sourcesContent":["import type { Meta, StoryFn } from '@storybook/react';\nimport type { StatusPillProps } from './StatusPill';\n\nimport { StatusPill } from './StatusPill';\n\nimport { Container } from 'storyComponents/Container';\n\nconst codeString = '<StatusPill status={status} label={label} variant={variant}/>';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Molecules/StatusPill',\n component: StatusPill,\n parameters: {\n inspectComponent: StatusPill,\n codeString: codeString,\n },\n} as Meta<StatusPillProps>;\n\nconst Template: StoryFn<StatusPillProps> = (args) => (\n <Container>\n <StatusPill {...args} />\n </Container>\n);\n\nexport const StatusPillExample = Template.bind({});\nStatusPillExample.args = {\n status: 'possible',\n variant: 'default',\n label: 'Example Status Pill',\n};\n"],"names":["codeString","StatusPill_stories","StatusPill","Template","args","jsx","Container","StatusPillExample"],"mappings":";;;AAOA,MAAMA,IAAa,kEAGJC,IAAA;AAAA,EACb,OAAO;AAAA,EACP,WAAWC;AAAA,EACX,YAAY;AAAA,IACV,kBAAkBA;AAAA,IAClB,YAAAF;AAAA,EACF;AACF,GAEMG,IAAqC,CAACC,MAC1C,gBAAAC,EAACC,KACC,UAAC,gBAAAD,EAAAH,GAAA,EAAY,GAAGE,EAAM,CAAA,EACxB,CAAA,GAGWG,IAAoBJ,EAAS,KAAK,EAAE;AACjDI,EAAkB,OAAO;AAAA,EACvB,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,OAAO;AACT;"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
export interface TooltipProps {
|
|
3
|
+
/** The element which triggers the tooltip on hover. */
|
|
3
4
|
element: ReactNode;
|
|
5
|
+
/** The id of the tooltip element. */
|
|
4
6
|
id: string;
|
|
7
|
+
/** The contents of the tooltip. */
|
|
5
8
|
text: string;
|
|
9
|
+
/** The size of the tooltip. */
|
|
6
10
|
size?: 'small' | 'medium' | 'large';
|
|
11
|
+
/** <span style="color: red">**Obsolete**</span>. Used by Lens only, and should be refactored */
|
|
7
12
|
openUnderTrigger?: boolean;
|
|
8
13
|
}
|
|
14
|
+
/** Represents a component for a custom tooltip. */
|
|
9
15
|
export declare function Tooltip({ element, id, text, size, openUnderTrigger }: TooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\nimport type { ReactNode } from 'react';\n\nimport styles from './Tooltip.module.css';\n\nexport interface TooltipProps {\n element: ReactNode;\n id: string;\n text: string;\n size?: 'small' | 'medium' | 'large';\n openUnderTrigger?: boolean;\n}\n\nexport function Tooltip({ element, id, text, size = 'medium', openUnderTrigger = false }: TooltipProps) {\n const containerRef = useRef<HTMLDivElement>(null);\n const tooltipRef = useRef<HTMLSpanElement>(null);\n const [isOpen, setIsOpen] = useState(false);\n const [position, setPosition] = useState({ top: 0, left: 0 });\n\n /* eslint-disable @typescript-eslint/no-magic-numbers */\n const topOffset = (size === 'small' && 20) || (size === 'large' && 35) || 27;\n const leftOffset = (size === 'small' && 25) || (size === 'large' && 70) || 47;\n /* eslint-enable @typescript-eslint/no-magic-numbers */\n\n const calculatePosition = useCallback(() => {\n if (containerRef.current && tooltipRef.current) {\n const triggerRect = containerRef.current.getBoundingClientRect();\n const tooltipRect = tooltipRef.current.getBoundingClientRect();\n const scrollY = window.scrollY;\n const scrollX = window.scrollX;\n let top = triggerRect.top + scrollY + topOffset - tooltipRect.height;\n // eslint-disable-next-line @typescript-eslint/no-magic-numbers\n const left = triggerRect.left + scrollX + leftOffset + (triggerRect.width - tooltipRect.width) / 2;\n\n // Adjust top position to account for page scrolling\n top -= scrollY;\n\n // Position tooltip below if it would be above the viewport\n if (top < 0) {\n top = triggerRect.bottom + scrollY;\n }\n\n setPosition({ top, left });\n }\n }, [leftOffset, topOffset]);\n\n const onKeyUp = useCallback(\n (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n setIsOpen(false);\n }\n },\n [setIsOpen]\n );\n\n function show() {\n setIsOpen(true);\n }\n\n function hide() {\n setIsOpen(false);\n }\n\n function toggle() {\n if (isOpen) setIsOpen(false);\n else setIsOpen(true);\n }\n\n useEffect(() => {\n if (!containerRef.current) return;\n\n const tooltipContainerRef = containerRef.current;\n\n tooltipContainerRef.addEventListener('keyup', onKeyUp, true);\n\n return () => {\n tooltipContainerRef.removeEventListener('keyup', onKeyUp, true);\n };\n }, [onKeyUp]);\n\n useEffect(() => {\n calculatePosition();\n window.addEventListener('resize', calculatePosition);\n return () => {\n window.removeEventListener('resize', calculatePosition);\n };\n }, [calculatePosition]);\n\n useEffect(() => {\n // Recalculate position when isOpen changes\n if (isOpen && !openUnderTrigger) {\n calculatePosition();\n }\n }, [isOpen, openUnderTrigger, calculatePosition]);\n\n return (\n <div\n className={styles['tooltip-container']}\n onBlur={hide}\n onFocus={show}\n onMouseEnter={show}\n onMouseLeave={hide}\n onMouseUp={toggle}\n ref={containerRef}\n role=\"button\"\n tabIndex={-1}\n >\n <div aria-describedby={isOpen ? id : undefined}>{element}</div>\n {isOpen && (\n <span\n ref={tooltipRef}\n className={openUnderTrigger ? styles['tooltip_under-trigger'] : styles[`tooltip_${size}`]}\n id={id}\n role=\"tooltip\"\n style={openUnderTrigger ? {} : { top: position.top, left: position.left }}\n >\n {text}\n </span>\n )}\n </div>\n );\n}\n"],"names":["Tooltip","element","id","text","size","openUnderTrigger","containerRef","useRef","tooltipRef","isOpen","setIsOpen","useState","position","setPosition","topOffset","leftOffset","calculatePosition","useCallback","triggerRect","tooltipRect","scrollY","scrollX","top","left","onKeyUp","event","show","hide","toggle","useEffect","tooltipContainerRef","jsxs","styles","jsx"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\nimport type { ReactNode } from 'react';\n\nimport styles from './Tooltip.module.css';\n\nexport interface TooltipProps {\n /** The element which triggers the tooltip on hover. */\n element: ReactNode;\n /** The id of the tooltip element. */\n id: string;\n /** The contents of the tooltip. */\n text: string;\n /** The size of the tooltip. */\n size?: 'small' | 'medium' | 'large';\n /** <span style=\"color: red\">**Obsolete**</span>. Used by Lens only, and should be refactored */\n openUnderTrigger?: boolean;\n}\n\n/** Represents a component for a custom tooltip. */\nexport function Tooltip({ element, id, text, size = 'medium', openUnderTrigger = false }: TooltipProps) {\n const containerRef = useRef<HTMLDivElement>(null);\n const tooltipRef = useRef<HTMLSpanElement>(null);\n const [isOpen, setIsOpen] = useState(false);\n const [position, setPosition] = useState({ top: 0, left: 0 });\n\n /* eslint-disable @typescript-eslint/no-magic-numbers */\n const topOffset = (size === 'small' && 20) || (size === 'large' && 35) || 27;\n const leftOffset = (size === 'small' && 25) || (size === 'large' && 70) || 47;\n /* eslint-enable @typescript-eslint/no-magic-numbers */\n\n const calculatePosition = useCallback(() => {\n if (containerRef.current && tooltipRef.current) {\n const triggerRect = containerRef.current.getBoundingClientRect();\n const tooltipRect = tooltipRef.current.getBoundingClientRect();\n const scrollY = window.scrollY;\n const scrollX = window.scrollX;\n let top = triggerRect.top + scrollY + topOffset - tooltipRect.height;\n // eslint-disable-next-line @typescript-eslint/no-magic-numbers\n const left = triggerRect.left + scrollX + leftOffset + (triggerRect.width - tooltipRect.width) / 2;\n\n // Adjust top position to account for page scrolling\n top -= scrollY;\n\n // Position tooltip below if it would be above the viewport\n if (top < 0) {\n top = triggerRect.bottom + scrollY;\n }\n\n setPosition({ top, left });\n }\n }, [leftOffset, topOffset]);\n\n const onKeyUp = useCallback(\n (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n setIsOpen(false);\n }\n },\n [setIsOpen]\n );\n\n function show() {\n setIsOpen(true);\n }\n\n function hide() {\n setIsOpen(false);\n }\n\n function toggle() {\n if (isOpen) setIsOpen(false);\n else setIsOpen(true);\n }\n\n useEffect(() => {\n if (!containerRef.current) return;\n\n const tooltipContainerRef = containerRef.current;\n\n tooltipContainerRef.addEventListener('keyup', onKeyUp, true);\n\n return () => {\n tooltipContainerRef.removeEventListener('keyup', onKeyUp, true);\n };\n }, [onKeyUp]);\n\n useEffect(() => {\n calculatePosition();\n window.addEventListener('resize', calculatePosition);\n return () => {\n window.removeEventListener('resize', calculatePosition);\n };\n }, [calculatePosition]);\n\n useEffect(() => {\n // Recalculate position when isOpen changes\n if (isOpen && !openUnderTrigger) {\n calculatePosition();\n }\n }, [isOpen, openUnderTrigger, calculatePosition]);\n\n return (\n <div\n className={styles['tooltip-container']}\n onBlur={hide}\n onFocus={show}\n onMouseEnter={show}\n onMouseLeave={hide}\n onMouseUp={toggle}\n ref={containerRef}\n role=\"button\"\n tabIndex={-1}\n >\n <div aria-describedby={isOpen ? id : undefined}>{element}</div>\n {isOpen && (\n <span\n ref={tooltipRef}\n className={openUnderTrigger ? styles['tooltip_under-trigger'] : styles[`tooltip_${size}`]}\n id={id}\n role=\"tooltip\"\n style={openUnderTrigger ? {} : { top: position.top, left: position.left }}\n >\n {text}\n </span>\n )}\n </div>\n );\n}\n"],"names":["Tooltip","element","id","text","size","openUnderTrigger","containerRef","useRef","tooltipRef","isOpen","setIsOpen","useState","position","setPosition","topOffset","leftOffset","calculatePosition","useCallback","triggerRect","tooltipRect","scrollY","scrollX","top","left","onKeyUp","event","show","hide","toggle","useEffect","tooltipContainerRef","jsxs","styles","jsx"],"mappings":";;;;;;;;;AAoBgB,SAAAA,EAAQ,EAAE,SAAAC,GAAS,IAAAC,GAAI,MAAAC,GAAM,MAAAC,IAAO,UAAU,kBAAAC,IAAmB,MAAuB;AAChG,QAAAC,IAAeC,EAAuB,IAAI,GAC1CC,IAAaD,EAAwB,IAAI,GACzC,CAACE,GAAQC,CAAS,IAAIC,EAAS,EAAK,GACpC,CAACC,GAAUC,CAAW,IAAIF,EAAS,EAAE,KAAK,GAAG,MAAM,EAAA,CAAG,GAGtDG,IAAaV,MAAS,WAAW,MAAQA,MAAS,WAAW,MAAO,IACpEW,IAAcX,MAAS,WAAW,MAAQA,MAAS,WAAW,MAAO,IAGrEY,IAAoBC,EAAY,MAAM;AACtC,QAAAX,EAAa,WAAWE,EAAW,SAAS;AACxC,YAAAU,IAAcZ,EAAa,QAAQ,sBAAsB,GACzDa,IAAcX,EAAW,QAAQ,sBAAsB,GACvDY,IAAU,OAAO,SACjBC,IAAU,OAAO;AACvB,UAAIC,IAAMJ,EAAY,MAAME,IAAUN,IAAYK,EAAY;AAExD,YAAAI,IAAOL,EAAY,OAAOG,IAAUN,KAAcG,EAAY,QAAQC,EAAY,SAAS;AAG1F,MAAAG,KAAAF,GAGHE,IAAM,MACRA,IAAMJ,EAAY,SAASE,IAGjBP,EAAA,EAAE,KAAAS,GAAK,MAAAC,EAAA,CAAM;AAAA,IAC3B;AAAA,EAAA,GACC,CAACR,GAAYD,CAAS,CAAC,GAEpBU,IAAUP;AAAA,IACd,CAACQ,MAAyB;AACpB,MAAAA,EAAM,QAAQ,YAChBf,EAAU,EAAK;AAAA,IAEnB;AAAA,IACA,CAACA,CAAS;AAAA,EAAA;AAGZ,WAASgB,IAAO;AACd,IAAAhB,EAAU,EAAI;AAAA,EAChB;AAEA,WAASiB,IAAO;AACd,IAAAjB,EAAU,EAAK;AAAA,EACjB;AAEA,WAASkB,IAAS;AACZ,MAAA,CAAAnB,CAAuB;AAAA,EAE7B;AAEA,SAAAoB,EAAU,MAAM;AACV,QAAA,CAACvB,EAAa,QAAS;AAE3B,UAAMwB,IAAsBxB,EAAa;AAErB,WAAAwB,EAAA,iBAAiB,SAASN,GAAS,EAAI,GAEpD,MAAM;AACS,MAAAM,EAAA,oBAAoB,SAASN,GAAS,EAAI;AAAA,IAAA;AAAA,EAChE,GACC,CAACA,CAAO,CAAC,GAEZK,EAAU,OACUb,KACX,OAAA,iBAAiB,UAAUA,CAAiB,GAC5C,MAAM;AACJ,WAAA,oBAAoB,UAAUA,CAAiB;AAAA,EAAA,IAEvD,CAACA,CAAiB,CAAC,GAEtBa,EAAU,MAAM;AAEV,IAAApB,KAAU,CAACJ,KACKW;EAEnB,GAAA,CAACP,GAAQJ,GAAkBW,CAAiB,CAAC,GAG9C,gBAAAe;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,EAAO,mBAAmB;AAAA,MACrC,QAAQL;AAAA,MACR,SAASD;AAAA,MACT,cAAcA;AAAA,MACd,cAAcC;AAAA,MACd,WAAWC;AAAA,MACX,KAAKtB;AAAA,MACL,MAAK;AAAA,MACL,UAAU;AAAA,MAEV,UAAA;AAAA,QAAA,gBAAA2B,EAAC,OAAI,EAAA,oBAAkBxB,IAASP,IAAK,QAAY,UAAQD,GAAA;AAAA,QACxDQ,KACC,gBAAAwB;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,KAAKzB;AAAA,YACL,WAAWH,IAAmB2B,EAAO,uBAAuB,IAAIA,EAAO,WAAW5B,CAAI,EAAE;AAAA,YACxF,IAAAF;AAAA,YACA,MAAK;AAAA,YACL,OAAOG,IAAmB,CAAK,IAAA,EAAE,KAAKO,EAAS,KAAK,MAAMA,EAAS,KAAK;AAAA,YAEvE,UAAAT;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR;"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Tooltip as
|
|
3
|
-
import { Container as
|
|
4
|
-
const
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { Tooltip as e } from "./Tooltip.js";
|
|
3
|
+
import { Container as i } from "../../storyComponents/Container/Container.js";
|
|
4
|
+
const r = "<Tooltip element={element} id={id} text={text} size={size} />", c = {
|
|
5
5
|
title: "Atoms/Tooltip",
|
|
6
|
-
component:
|
|
6
|
+
component: e,
|
|
7
7
|
argTypes: {
|
|
8
8
|
element: {
|
|
9
9
|
control: "text"
|
|
10
10
|
},
|
|
11
|
-
// Disable openUnderTrigger controls as this
|
|
11
|
+
// Disable openUnderTrigger controls as this is a Lens specific prop that we should not use in other places.
|
|
12
12
|
// This is still needed until Lens structure is reworked.
|
|
13
13
|
openUnderTrigger: {
|
|
14
14
|
table: {
|
|
@@ -17,9 +17,10 @@ const i = "<Tooltip element={element} id={id} text={text} size={size} />", a = {
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
parameters: {
|
|
20
|
-
|
|
20
|
+
inspectComponent: e,
|
|
21
|
+
codeString: r
|
|
21
22
|
}
|
|
22
|
-
}, n = (o) => /* @__PURE__ */
|
|
23
|
+
}, n = (o) => /* @__PURE__ */ t(i, { centerContent: !0, children: /* @__PURE__ */ t(e, { ...o }) }), l = n.bind({});
|
|
23
24
|
l.args = {
|
|
24
25
|
element: "Tooltip Trigger",
|
|
25
26
|
id: "52fcc9e9",
|
|
@@ -27,6 +28,6 @@ l.args = {
|
|
|
27
28
|
};
|
|
28
29
|
export {
|
|
29
30
|
l as TooltipExample,
|
|
30
|
-
|
|
31
|
+
c as default
|
|
31
32
|
};
|
|
32
33
|
//# sourceMappingURL=Tooltip.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.stories.js","sources":["../../../src/components/Tooltip/Tooltip.stories.tsx"],"sourcesContent":["import type { Meta, StoryFn } from '@storybook/react';\nimport type { TooltipProps } from './Tooltip';\n\nimport { Tooltip } from './Tooltip';\n\nimport { Container } from 'storyComponents/Container';\n\nconst codeString = '<Tooltip element={element} id={id} text={text} size={size} />';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Atoms/Tooltip',\n component: Tooltip,\n argTypes: {\n element: {\n control: 'text',\n },\n // Disable openUnderTrigger controls as this
|
|
1
|
+
{"version":3,"file":"Tooltip.stories.js","sources":["../../../src/components/Tooltip/Tooltip.stories.tsx"],"sourcesContent":["import type { Meta, StoryFn } from '@storybook/react';\nimport type { TooltipProps } from './Tooltip';\n\nimport { Tooltip } from './Tooltip';\n\nimport { Container } from 'storyComponents/Container';\n\nconst codeString = '<Tooltip element={element} id={id} text={text} size={size} />';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Atoms/Tooltip',\n component: Tooltip,\n argTypes: {\n element: {\n control: 'text',\n },\n // Disable openUnderTrigger controls as this is a Lens specific prop that we should not use in other places.\n // This is still needed until Lens structure is reworked.\n openUnderTrigger: {\n table: {\n disable: true,\n },\n },\n },\n parameters: {\n inspectComponent: Tooltip,\n codeString: codeString,\n },\n} as Meta<TooltipProps>;\n\nconst Template: StoryFn<TooltipProps> = (args) => (\n <Container centerContent>\n <Tooltip {...args} />\n </Container>\n);\n\nexport const TooltipExample = Template.bind({});\nTooltipExample.args = {\n element: 'Tooltip Trigger',\n id: '52fcc9e9',\n text: 'Here is your Tooltip',\n};\n"],"names":["codeString","Tooltip_stories","Tooltip","Template","args","jsx","Container","TooltipExample"],"mappings":";;;AAOA,MAAMA,IAAa,iEAGJC,IAAA;AAAA,EACb,OAAO;AAAA,EACP,WAAWC;AAAA,EACX,UAAU;AAAA,IACR,SAAS;AAAA,MACP,SAAS;AAAA,IACX;AAAA;AAAA;AAAA,IAGA,kBAAkB;AAAA,MAChB,OAAO;AAAA,QACL,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AAAA,EACA,YAAY;AAAA,IACV,kBAAkBA;AAAA,IAClB,YAAAF;AAAA,EACF;AACF,GAEMG,IAAkC,CAACC,MACtC,gBAAAC,EAAAC,GAAA,EAAU,eAAa,IACtB,UAAC,gBAAAD,EAAAH,GAAA,EAAS,GAAGE,EAAM,CAAA,EACrB,CAAA,GAGWG,IAAiBJ,EAAS,KAAK,EAAE;AAC9CI,EAAe,OAAO;AAAA,EACpB,SAAS;AAAA,EACT,IAAI;AAAA,EACJ,MAAM;AACR;"}
|
|
@@ -7,6 +7,8 @@ export * from './Button';
|
|
|
7
7
|
export * from './ButtonGroup';
|
|
8
8
|
export * from './Card';
|
|
9
9
|
export * from './Checkbox';
|
|
10
|
+
export * from './CheckboxButton';
|
|
11
|
+
export * from './CheckboxButtonBar';
|
|
10
12
|
export * from './CheckboxTree';
|
|
11
13
|
export * from './Drawer';
|
|
12
14
|
export * from './EmptyStateDataDisplay';
|
|
@@ -29,6 +31,7 @@ export * from './ModalDialog';
|
|
|
29
31
|
export * from './MultiSelect';
|
|
30
32
|
export * from './OverlayCloseButton';
|
|
31
33
|
export * from './Periods';
|
|
34
|
+
export * from './PeriodSelector';
|
|
32
35
|
export * from './ProgrammeCard';
|
|
33
36
|
export * from './RadioButton';
|
|
34
37
|
export * from './Repeater';
|
package/dist/components/index.js
CHANGED
|
@@ -1,84 +1,90 @@
|
|
|
1
1
|
import { Accordion as t } from "./Accordion/Accordion.js";
|
|
2
2
|
import { ActionList as p } from "./ActionList/ActionList.js";
|
|
3
|
-
import { AppStatusBar as
|
|
3
|
+
import { AppStatusBar as m } from "./AppStatusBar/AppStatusBar.js";
|
|
4
4
|
import { Attention as i } from "./Attention/Attention.js";
|
|
5
5
|
import { Backdrop as n } from "./Backdrop/Backdrop.js";
|
|
6
6
|
import { Button as c } from "./Button/Button.js";
|
|
7
7
|
import { ButtonGroup as d } from "./ButtonGroup/ButtonGroup.js";
|
|
8
8
|
import { Card as B } from "./Card/Card.js";
|
|
9
|
-
import { Checkbox as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
9
|
+
import { Checkbox as b } from "./Checkbox/Checkbox.js";
|
|
10
|
+
import { CheckboxButton as C } from "./CheckboxButton/CheckboxButton.js";
|
|
11
|
+
import { CheckboxButtonBar as F } from "./CheckboxButtonBar/CheckboxButtonBar.js";
|
|
12
|
+
import { CheckboxTree as D } from "./CheckboxTree/CheckboxTree.js";
|
|
13
|
+
import { Drawer as P } from "./Drawer/Drawer.js";
|
|
14
|
+
import { EmptyStateDataDisplay as A } from "./EmptyStateDataDisplay/EmptyStateDataDisplay.js";
|
|
15
|
+
import { FeedbackBox as y } from "./FeedbackBox/FeedbackBox.js";
|
|
16
|
+
import { FieldHint as v } from "./FieldHint/FieldHint.js";
|
|
17
|
+
import { Fieldset as G } from "./Fieldset/Fieldset.js";
|
|
18
|
+
import { FormField as T } from "./FormField/FormField.js";
|
|
19
|
+
import { GridRow as E } from "./GridRow/GridRow.js";
|
|
20
|
+
import { HorizontalList as O } from "./HorizontalList/HorizontalList.js";
|
|
21
|
+
import { Icon as q } from "./Icon/Icon.js";
|
|
22
|
+
import { IconButton as K } from "./IconButton/IconButton.js";
|
|
23
|
+
import { InfoMessage as U } from "./InfoMessage/InfoMessage.js";
|
|
24
|
+
import { Input as W } from "./Input/Input.js";
|
|
25
|
+
import { InputField as Y } from "./InputField/InputField.js";
|
|
26
|
+
import { Label as _ } from "./Label/Label.js";
|
|
27
|
+
import { MenuButton as oo } from "./MenuButton/MenuButton.js";
|
|
28
|
+
import { MenuLink as to } from "./MenuLink/MenuLink.js";
|
|
29
|
+
import { MetaDataList as po } from "./MetaDataList/MetaDataList.js";
|
|
30
|
+
import { ModalDialog as mo } from "./ModalDialog/ModalDialog.js";
|
|
31
|
+
import { M as io } from "../MultiSelect-Ckf3uGw5.js";
|
|
32
|
+
import { OverlayCloseButton as no } from "./OverlayCloseButton/OverlayCloseButton.js";
|
|
33
|
+
import { Periods as co } from "./Periods/Periods.js";
|
|
34
|
+
import { PeriodSelector as so } from "./PeriodSelector/PeriodSelector.js";
|
|
35
|
+
import { ProgrammeCard as So } from "./ProgrammeCard/ProgrammeCard.js";
|
|
36
|
+
import { RadioButton as ko } from "./RadioButton/RadioButton.js";
|
|
37
|
+
import { Repeater as Mo } from "./Repeater/Repeater.js";
|
|
38
|
+
import { SectionNotification as Lo } from "./SectionNotification/SectionNotification.js";
|
|
39
|
+
import { SelectListbox as Io } from "./SelectListbox/SelectListbox.js";
|
|
40
|
+
import { SelectProvider as ho, useSelect as Ao } from "./SelectListbox/SelectProvider.js";
|
|
41
|
+
import { Spinner as yo } from "./Spinner/Spinner.js";
|
|
42
|
+
import { StatusPill as vo } from "./StatusPill/StatusPill.js";
|
|
43
|
+
import { Tooltip as Go } from "./Tooltip/Tooltip.js";
|
|
41
44
|
export {
|
|
42
45
|
t as Accordion,
|
|
43
46
|
p as ActionList,
|
|
44
|
-
|
|
47
|
+
m as AppStatusBar,
|
|
45
48
|
i as Attention,
|
|
46
49
|
n as Backdrop,
|
|
47
50
|
c as Button,
|
|
48
51
|
d as ButtonGroup,
|
|
49
52
|
B as Card,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
D as
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
v as
|
|
58
|
-
G as
|
|
59
|
-
T as
|
|
60
|
-
E as
|
|
61
|
-
O as
|
|
62
|
-
q as
|
|
63
|
-
K as
|
|
64
|
-
U as
|
|
65
|
-
W as
|
|
66
|
-
Y as
|
|
67
|
-
_ as
|
|
68
|
-
oo as
|
|
69
|
-
to as
|
|
70
|
-
po as
|
|
71
|
-
|
|
72
|
-
io as
|
|
73
|
-
no as
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
So as
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
53
|
+
b as Checkbox,
|
|
54
|
+
C as CheckboxButton,
|
|
55
|
+
F as CheckboxButtonBar,
|
|
56
|
+
D as CheckboxTree,
|
|
57
|
+
P as Drawer,
|
|
58
|
+
A as EmptyStateDataDisplay,
|
|
59
|
+
y as FeedbackBox,
|
|
60
|
+
v as FieldHint,
|
|
61
|
+
G as Fieldset,
|
|
62
|
+
T as FormField,
|
|
63
|
+
E as GridRow,
|
|
64
|
+
O as HorizontalList,
|
|
65
|
+
q as Icon,
|
|
66
|
+
K as IconButton,
|
|
67
|
+
U as InfoMessage,
|
|
68
|
+
W as Input,
|
|
69
|
+
Y as InputField,
|
|
70
|
+
_ as Label,
|
|
71
|
+
oo as MenuButton,
|
|
72
|
+
to as MenuLink,
|
|
73
|
+
po as MetaDataList,
|
|
74
|
+
mo as ModalDialog,
|
|
75
|
+
io as MultiSelect,
|
|
76
|
+
no as OverlayCloseButton,
|
|
77
|
+
so as PeriodSelector,
|
|
78
|
+
co as Periods,
|
|
79
|
+
So as ProgrammeCard,
|
|
80
|
+
ko as RadioButton,
|
|
81
|
+
Mo as Repeater,
|
|
82
|
+
Lo as SectionNotification,
|
|
83
|
+
Io as SelectListbox,
|
|
84
|
+
ho as SelectProvider,
|
|
85
|
+
yo as Spinner,
|
|
86
|
+
vo as StatusPill,
|
|
87
|
+
Go as Tooltip,
|
|
88
|
+
Ao as useSelect
|
|
83
89
|
};
|
|
84
90
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|