@lunit/oui 3.0.0 → 3.1.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.
Files changed (61) hide show
  1. package/dist/components/Autocomplete/Autocomplete.js +22 -0
  2. package/dist/components/Autocomplete/Autocomplete.styled.js +36 -0
  3. package/dist/components/Autocomplete/Autocomplete.types.js +1 -0
  4. package/dist/components/Autocomplete/index.js +2 -0
  5. package/dist/components/Chip/Chip.utils.js +0 -1
  6. package/dist/components/Collapse/Collapse.js +6 -0
  7. package/dist/components/Collapse/Collapse.types.js +1 -0
  8. package/dist/components/Collapse/index.js +2 -0
  9. package/dist/components/DataTable/DataTable.js +6 -4
  10. package/dist/components/DataTable/DataTable.types.js +1 -0
  11. package/dist/components/Drawer/Drawer.js +6 -0
  12. package/dist/components/Drawer/Drawer.styled.js +29 -0
  13. package/dist/components/Drawer/Drawer.types.js +1 -0
  14. package/dist/components/Drawer/index.js +2 -0
  15. package/dist/components/Dropdown/Dropdown.js +1 -3
  16. package/dist/components/Dropdown/IconDropdown.js +1 -3
  17. package/dist/components/EllipsisTypography/EllipsisTypography.js +51 -15
  18. package/dist/components/List/ListItemCaption.styled.js +0 -1
  19. package/dist/components/LoadingIndicator/LoadingIndicator.js +0 -1
  20. package/dist/components/NoMatchContainer/NoMatchContainer.js +3 -3
  21. package/dist/components/Popover/Popover.js +6 -0
  22. package/dist/components/Popover/Popover.styled.js +10 -0
  23. package/dist/components/Popover/Popover.types.js +1 -0
  24. package/dist/components/Popover/index.js +2 -0
  25. package/dist/components/Radio/RadioGroup.styled.js +0 -1
  26. package/dist/components/TextField/TextInput.styled.js +2 -6
  27. package/dist/components/Toggle/Toggle.js +12 -7
  28. package/dist/components/UploadManager/UploadManager.js +9 -5
  29. package/dist/components/index.js +4 -0
  30. package/dist/presentations/AnalysisBar/AnalysisBar.styled.js +12 -7
  31. package/dist/presentations/FreeText/FreeText.js +50 -28
  32. package/dist/presentations/HorizonDivider/HorizonDivider.js +1 -1
  33. package/dist/presentations/Threshold/Threshold.js +11 -9
  34. package/dist/presentations/Threshold/Threshold.styled.js +56 -58
  35. package/dist/presentations/Threshold/Threshold.utils.js +27 -18
  36. package/dist/types/components/Autocomplete/Autocomplete.d.ts +3 -0
  37. package/dist/types/components/Autocomplete/Autocomplete.styled.d.ts +6 -0
  38. package/dist/types/components/Autocomplete/Autocomplete.types.d.ts +20 -0
  39. package/dist/types/components/Autocomplete/index.d.ts +4 -0
  40. package/dist/types/components/Collapse/Collapse.d.ts +3 -0
  41. package/dist/types/components/Collapse/Collapse.types.d.ts +4 -0
  42. package/dist/types/components/Collapse/index.d.ts +4 -0
  43. package/dist/types/components/DataTable/DataTable.d.ts +2 -2
  44. package/dist/types/components/DataTable/DataTable.types.d.ts +8 -0
  45. package/dist/types/components/DataTable/index.d.ts +1 -0
  46. package/dist/types/components/Drawer/Drawer.d.ts +3 -0
  47. package/dist/types/components/Drawer/Drawer.styled.d.ts +3 -0
  48. package/dist/types/components/Drawer/Drawer.types.d.ts +14 -0
  49. package/dist/types/components/Drawer/index.d.ts +4 -0
  50. package/dist/types/components/EllipsisTypography/EllipsisTypography.d.ts +2 -1
  51. package/dist/types/components/Popover/Popover.d.ts +3 -0
  52. package/dist/types/components/Popover/Popover.styled.d.ts +2 -0
  53. package/dist/types/components/Popover/Popover.types.d.ts +4 -0
  54. package/dist/types/components/Popover/index.d.ts +4 -0
  55. package/dist/types/components/Tooltip/Tooltip.types.d.ts +2 -2
  56. package/dist/types/components/index.d.ts +4 -0
  57. package/dist/types/presentations/Threshold/Threshold.d.ts +1 -1
  58. package/dist/types/presentations/Threshold/Threshold.types.d.ts +16 -4
  59. package/dist/types/presentations/Threshold/Threshold.utils.d.ts +18 -16
  60. package/docs/COMPONENTS.md +42 -38
  61. package/package.json +21 -6
@@ -1,4 +1,5 @@
1
1
  import { Box, Slider, styled } from '@mui/material';
2
+ import { NO_LABEL_ONLY_MARK } from './Threshold.utils';
2
3
  import theme from '../../theme';
3
4
  export const Container = styled(Box)({
4
5
  display: 'flex',
@@ -6,67 +7,64 @@ export const Container = styled(Box)({
6
7
  gap: '12px',
7
8
  });
8
9
  export const BaseSlider = styled(Slider, {
9
- shouldForwardProp: (prop) => prop !== 'defaultThreshold',
10
- })(({ defaultThreshold, marks, disabled }) => {
11
- let markIndex = 0;
12
- if (Array.isArray(marks) && marks.length > 0) {
13
- markIndex = marks.findIndex((mark) => mark.value === defaultThreshold);
14
- }
15
- const defaultThresClass = `&:nth-of-type(${markIndex + 4})`;
16
- const defaultLabelClass = `&:nth-of-type(${markIndex + 5})`;
17
- return {
18
- '& .MuiSlider-rail': {
19
- background: theme.palette.neutralGrey[75],
20
- height: '8px',
10
+ shouldForwardProp: (prop) => prop !== 'labelOnlyMarkIndex',
11
+ })(({ disabled, labelOnlyMarkIndex = NO_LABEL_ONLY_MARK }) => ({
12
+ '& .MuiSlider-rail': {
13
+ background: theme.palette.neutralGrey[75],
14
+ height: '8px',
15
+ },
16
+ '& .MuiSlider-track': {
17
+ display: 'none',
18
+ },
19
+ '& .MuiSlider-thumb': {
20
+ background: theme.palette.neutralGrey[0],
21
+ '&:hover': {
22
+ boxShadow: `0px 0px 0px 8px rgba(255, 0, 0, 0.2)`,
21
23
  },
22
- '& .MuiSlider-track': {
23
- display: 'none',
24
+ '&.Mui-focusVisible': {
25
+ boxShadow: `0px 0px 0px 8px rgba(255, 0, 0, 0.2)`,
24
26
  },
25
- '& .MuiSlider-thumb': {
26
- background: theme.palette.neutralGrey[0],
27
- '&:hover': {
28
- boxShadow: `0px 0px 0px 8px rgba(255, 0, 0, 0.2)`,
29
- },
30
- '&.Mui-focusVisible': {
31
- boxShadow: `0px 0px 0px 8px rgba(255, 0, 0, 0.2)`,
32
- },
27
+ },
28
+ '& .MuiSlider-mark': {
29
+ background: theme.palette.neutralGrey[40],
30
+ height: '6px',
31
+ width: '6px',
32
+ borderRadius: '50%',
33
+ },
34
+ '& .MuiSlider-markLabel': {
35
+ fontFamily: 'Pretendard,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"',
36
+ fontSize: '8px',
37
+ fontStyle: 'normal',
38
+ fontWeight: '500',
39
+ lineHeight: '12px',
40
+ },
41
+ '& .MuiSlider-valueLabel': {
42
+ fontFamily: 'Pretendard,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"',
43
+ fontSize: '12px',
44
+ fontWeight: '700',
45
+ lineHeight: '16px',
46
+ background: 'unset',
47
+ padding: 0,
48
+ width: 32,
49
+ height: 32,
50
+ borderRadius: '50% 50% 50% 0',
51
+ backgroundColor: disabled ? theme.palette.neutralGrey[60] : theme.palette.lunitTeal[40],
52
+ transformOrigin: 'bottom left',
53
+ transform: 'translate(50%, -100%) rotate(-45deg) scale(0)',
54
+ '&:before': { display: 'none' },
55
+ '&.MuiSlider-valueLabelOpen': {
56
+ transform: 'translate(50%, -100%) rotate(-45deg) scale(1)',
33
57
  },
34
- '& .MuiSlider-mark': {
35
- background: theme.palette.neutralGrey[40],
36
- height: '6px',
37
- width: '6px',
38
- borderRadius: '50%',
58
+ '& > *': {
59
+ transform: 'rotate(45deg)',
39
60
  },
40
- '& .MuiSlider-markLabel': {
41
- fontFamily: 'Pretendard,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"',
42
- fontSize: '8px',
43
- fontStyle: 'normal',
44
- fontWeight: '500',
45
- lineHeight: '12px',
61
+ '&.Mui-disabled': {
62
+ visibility: 'visible',
46
63
  },
47
- '& .MuiSlider-valueLabel': {
48
- fontFamily: 'Pretendard,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"',
49
- fontSize: '12px',
50
- fontWeight: '700',
51
- lineHeight: '16px',
52
- background: 'unset',
53
- padding: 0,
54
- width: 32,
55
- height: 32,
56
- borderRadius: '50% 50% 50% 0',
57
- backgroundColor: disabled ? theme.palette.neutralGrey[60] : theme.palette.lunitTeal[40],
58
- transformOrigin: 'bottom left',
59
- transform: 'translate(50%, -100%) rotate(-45deg) scale(0)',
60
- '&:before': { display: 'none' },
61
- '&.MuiSlider-valueLabelOpen': {
62
- transform: 'translate(50%, -100%) rotate(-45deg) scale(1)',
63
- },
64
- '& > *': {
65
- transform: 'rotate(45deg)',
66
- },
67
- '&.Mui-disabled': {
68
- visibility: 'visible',
69
- },
64
+ },
65
+ ...(labelOnlyMarkIndex > NO_LABEL_ONLY_MARK && {
66
+ [`& .MuiSlider-mark[data-index="${labelOnlyMarkIndex}"]`]: {
67
+ display: 'none',
70
68
  },
71
- };
72
- });
69
+ }),
70
+ }));
@@ -1,3 +1,5 @@
1
+ const DEFAULT_MARK_LABEL_PREFIX = 'Default: ';
2
+ export const NO_LABEL_ONLY_MARK = -1;
1
3
  export const baseSliderMarks = [
2
4
  { value: 0, label: '0' },
3
5
  { value: 10 },
@@ -11,24 +13,31 @@ export const baseSliderMarks = [
11
13
  { value: 90 },
12
14
  { value: 100, label: '100' },
13
15
  ];
14
- export const getPresetValue = (options, selectedItem) => {
15
- const presetValue = options.find((option) => option.title === selectedItem && option.isPreset)
16
- ?.value;
17
- return presetValue;
18
- };
19
- export const getSliderMarks = (presetValue) => {
20
- const marks = baseSliderMarks.map((mark) => {
21
- if (mark.value === presetValue) {
22
- return {
23
- ...mark,
24
- label: `Preset: ${presetValue}`,
25
- };
26
- }
27
- return mark;
16
+ /**
17
+ * Builds the slider marks with the default threshold labelled.
18
+ *
19
+ * @param defaultThreshold - Default threshold of the selected option
20
+ * @returns Marks ordered by value, including an extra mark when the default sits between intervals
21
+ */
22
+ export const getSliderMarks = (defaultThreshold) => {
23
+ const defaultLabel = `${DEFAULT_MARK_LABEL_PREFIX}${defaultThreshold}`;
24
+ const marks = baseSliderMarks.map((mark) => mark.value === defaultThreshold ? { ...mark, label: defaultLabel } : mark);
25
+ if (baseSliderMarks.some((mark) => mark.value === defaultThreshold))
26
+ return marks;
27
+ const insertIndex = marks.findIndex((mark) => mark.value > defaultThreshold);
28
+ marks.splice(insertIndex < 0 ? marks.length : insertIndex, 0, {
29
+ value: defaultThreshold,
30
+ label: defaultLabel,
28
31
  });
29
- if (!baseSliderMarks.find((mark) => mark.value === presetValue)) {
30
- const index = Math.floor(presetValue / 10);
31
- marks.splice(index + 1, 0, { value: presetValue, label: `Preset: ${presetValue}` });
32
- }
33
32
  return marks;
34
33
  };
34
+ /**
35
+ * Finds the mark that exists only to label the default threshold.
36
+ *
37
+ * @param marks - Marks built by `getSliderMarks`
38
+ * @param defaultThreshold - Default threshold of the selected option
39
+ * @returns Index of the mark whose dot should stay hidden, or `-1` when the default sits on an interval
40
+ */
41
+ export const getLabelOnlyMarkIndex = (marks, defaultThreshold) => baseSliderMarks.some((mark) => mark.value === defaultThreshold)
42
+ ? NO_LABEL_ONLY_MARK
43
+ : marks.findIndex((mark) => mark.value === defaultThreshold);
@@ -0,0 +1,3 @@
1
+ import type { AutocompleteProps } from './Autocomplete.types';
2
+ declare function Autocomplete({ placeholder, error, helperText, loading, noOptionsText, onDelete, onClearButtonClick, disabled, inputValue, sx, ...otherProps }: AutocompleteProps): import("react/jsx-runtime").JSX.Element;
3
+ export default Autocomplete;
@@ -0,0 +1,6 @@
1
+ import type { Theme } from '@mui/material/styles';
2
+ import type { SxProps } from '@mui/system';
3
+ /** Tokenized styling for the underlying MUI Autocomplete. */
4
+ export declare const autocompleteSx: (theme: Theme, disabled?: boolean) => SxProps<Theme>;
5
+ /** Tokenized styling for the listbox paper. */
6
+ export declare const paperSx: (theme: Theme) => SxProps<Theme>;
@@ -0,0 +1,20 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { AutocompleteProps as MuiAutocompleteProps } from '@mui/material';
3
+ type MuiBase = MuiAutocompleteProps<string, true, true, true>;
4
+ export interface AutocompleteProps extends Omit<MuiBase, 'renderInput' | 'renderValue' | 'renderTags' | 'multiple' | 'freeSolo' | 'disableClearable'> {
5
+ /** Placeholder shown in the text input. */
6
+ placeholder?: string;
7
+ /** Whether the field is in an error state. */
8
+ error?: boolean;
9
+ /** Helper / error message shown below the input. */
10
+ helperText?: string;
11
+ /** Shows a loading indicator and `noOptionsText` while fetching options. */
12
+ loading?: boolean;
13
+ /** Message shown when there are no matching options. */
14
+ noOptionsText?: ReactNode;
15
+ /** Called when a selected chip's delete icon is clicked. */
16
+ onDelete?: (value: string) => void;
17
+ /** When provided, renders a clear button in the input adornment. */
18
+ onClearButtonClick?: () => void;
19
+ }
20
+ export {};
@@ -0,0 +1,4 @@
1
+ import Autocomplete from './Autocomplete';
2
+ import type { AutocompleteProps } from './Autocomplete.types';
3
+ export { Autocomplete };
4
+ export type { AutocompleteProps };
@@ -0,0 +1,3 @@
1
+ import type { CollapseProps } from './Collapse.types';
2
+ declare function Collapse({ children, ...otherProps }: CollapseProps): import("react/jsx-runtime").JSX.Element;
3
+ export default Collapse;
@@ -0,0 +1,4 @@
1
+ import type { CollapseProps as MuiCollapseProps } from '@mui/material';
2
+ /** Props for Collapse. Re-exports MUI Collapse props for expand/collapse transitions. */
3
+ export interface CollapseProps extends MuiCollapseProps {
4
+ }
@@ -0,0 +1,4 @@
1
+ import Collapse from './Collapse';
2
+ import type { CollapseProps } from './Collapse.types';
3
+ export { Collapse };
4
+ export type { CollapseProps };
@@ -1,3 +1,3 @@
1
- import { type DataGridProProps } from '@mui/x-data-grid-pro';
2
- declare function DataTable({ rows, columns, ...otherProps }: DataGridProProps): import("react/jsx-runtime").JSX.Element;
1
+ import type { DataTableProps } from './DataTable.types';
2
+ declare function DataTable({ rows, columns, slots, ...otherProps }: DataTableProps): import("react/jsx-runtime").JSX.Element;
3
3
  export default DataTable;
@@ -0,0 +1,8 @@
1
+ import type { DataGridProProps } from '@mui/x-data-grid-pro';
2
+ /**
3
+ * Props for the DataTable component. Extends MUI X DataGridPro props; OUI sets
4
+ * sensible defaults (header/row height, borders, base checkbox, empty overlay)
5
+ * that consumers can still override, including per-key `slots` merging.
6
+ */
7
+ export interface DataTableProps extends DataGridProProps {
8
+ }
@@ -1 +1,2 @@
1
1
  export { default as DataTable } from './DataTable';
2
+ export type { DataTableProps } from './DataTable.types';
@@ -0,0 +1,3 @@
1
+ import type { DrawerProps } from './Drawer.types';
2
+ declare function Drawer({ children, open, wide, variant, ...otherProps }: DrawerProps): import("react/jsx-runtime").JSX.Element;
3
+ export default Drawer;
@@ -0,0 +1,3 @@
1
+ import type { BaseDrawerProps } from './Drawer.types';
2
+ declare const BaseDrawer: import("@emotion/styled").StyledComponent<import("@mui/material").DrawerProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & BaseDrawerProps, {}, {}>;
3
+ export default BaseDrawer;
@@ -0,0 +1,14 @@
1
+ import type { DrawerProps as MuiDrawerProps } from '@mui/material';
2
+ export interface BaseDrawerProps extends MuiDrawerProps {
3
+ /** Whether the drawer is expanded. When false, collapses to `closedWidth`. */
4
+ open?: boolean;
5
+ /** Whether to use the wider expanded width (`wideWidth`) instead of `openWidth`. */
6
+ wide?: boolean;
7
+ /** Width when collapsed (`open=false`). Defaults to 52px. */
8
+ closedWidth?: number | string;
9
+ /** Width when expanded. Defaults to 240px. */
10
+ openWidth?: number | string;
11
+ /** Width when expanded and `wide` is set. Defaults to 280px. */
12
+ wideWidth?: number | string;
13
+ }
14
+ export type DrawerProps = BaseDrawerProps;
@@ -0,0 +1,4 @@
1
+ import Drawer from './Drawer';
2
+ import type { BaseDrawerProps, DrawerProps } from './Drawer.types';
3
+ export { Drawer };
4
+ export type { BaseDrawerProps, DrawerProps };
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import type { EllipsisTypographyProps } from './EllipsisTypography.types';
2
- declare function EllipsisTypography({ children, heightThreshold: heightThresholdProp, tooltipPlacement, maxLines, ...otherProps }: EllipsisTypographyProps): import("react/jsx-runtime").JSX.Element;
3
+ declare const EllipsisTypography: React.ForwardRefExoticComponent<Omit<EllipsisTypographyProps, "ref"> & React.RefAttributes<HTMLElement>>;
3
4
  export default EllipsisTypography;
@@ -0,0 +1,3 @@
1
+ import type { PopoverProps } from './Popover.types';
2
+ declare function Popover({ children, ...otherProps }: PopoverProps): import("react/jsx-runtime").JSX.Element;
3
+ export default Popover;
@@ -0,0 +1,2 @@
1
+ declare const StyledPopover: import("@emotion/styled").StyledComponent<import("@mui/material").PopoverProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
2
+ export default StyledPopover;
@@ -0,0 +1,4 @@
1
+ import type { PopoverProps as MuiPopoverProps } from '@mui/material';
2
+ /** Props for Popover. Extends MUI Popover with OUI's tokenized paper styling. */
3
+ export interface PopoverProps extends MuiPopoverProps {
4
+ }
@@ -0,0 +1,4 @@
1
+ import Popover from './Popover';
2
+ import type { PopoverProps } from './Popover.types';
3
+ export { Popover };
4
+ export type { PopoverProps };
@@ -2,10 +2,10 @@ import { ReactNode } from 'react';
2
2
  import type { TooltipClasses, TooltipProps as MuiTooltipProps } from '@mui/material';
3
3
  export type Position = Pick<TooltipProps, 'placement'>;
4
4
  export type TooltipSizes = 'small' | 'large';
5
- export type TooltipSize = {
5
+ export interface TooltipSize {
6
6
  width: number;
7
7
  height: number;
8
- };
8
+ }
9
9
  export type TooltipPlacement = TooltipClasses['tooltipPlacementBottom'] | TooltipClasses['tooltipPlacementLeft'] | TooltipClasses['tooltipPlacementRight'] | TooltipClasses['tooltipPlacementTop'];
10
10
  export type ArrowSizeBySize = Record<TooltipSizes, TooltipSize>;
11
11
  export type TooltipPlacementToSize = Record<TooltipPlacement, ArrowSizeBySize>;
@@ -1,16 +1,20 @@
1
1
  export * from './Alert';
2
+ export * from './Autocomplete';
2
3
  export * from './Button';
3
4
  export * from './Card';
4
5
  export * from './Checkbox';
5
6
  export * from './Chip';
7
+ export * from './Collapse';
6
8
  export * from './DataTable';
7
9
  export * from './DatePicker';
8
10
  export * from './Dialog';
9
11
  export * from './Divider';
12
+ export * from './Drawer';
10
13
  export * from './Dropdown';
11
14
  export * from './EllipsisTypography';
12
15
  export * from './FileDnDZone';
13
16
  export * from './List';
17
+ export * from './Popover';
14
18
  export * from './LoadingIndicator';
15
19
  export * from './Menu';
16
20
  export * from './Pagination';
@@ -1,3 +1,3 @@
1
1
  import { ThresholdProps } from './Threshold.types';
2
- declare const Threshold: ({ componentType, title, totalScore, totalCells, statisticItems, options, description, controlStep, isLoading, thresholdState, onChangeDropdown, onChangeSlider, onSliderChangeCommitted, onClickUpdateConfiguration, }: ThresholdProps) => import("react/jsx-runtime").JSX.Element;
2
+ declare const Threshold: ({ componentType, title, totalScore, totalCells, statisticItems, options, description, controlStep, showDefaultMark, isLoading, thresholdState, onChangeDropdown, onChangeSlider, onSliderChangeCommitted, onClickUpdateConfiguration, }: ThresholdProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export default Threshold;
@@ -9,18 +9,29 @@ export interface ThresholdOption {
9
9
  value: number;
10
10
  isPreset?: boolean;
11
11
  }
12
+ export interface ThresholdMark {
13
+ /** Position of the mark on the 0-100 intensity scale */
14
+ value: number;
15
+ /** Text rendered under the mark; marks without a label render as a dot only */
16
+ label?: string;
17
+ }
12
18
  export interface ThresholdSpec {
13
19
  componentType: 'threshold';
14
- totalScore: ScoreProps;
20
+ /** Overall score summary shown above the cell statistics; omitted when the analysis has no score */
21
+ totalScore?: ScoreProps;
15
22
  totalCells: StatisticProps;
16
23
  statisticItems: StatisticProps[];
17
24
  title?: string;
18
25
  description?: {
19
- preset: string;
20
- user: string;
26
+ /** Guidance shown while a preset option is selected */
27
+ preset?: string;
28
+ /** Guidance shown while a user-adjustable option is selected */
29
+ user?: string;
21
30
  };
22
31
  options: ThresholdOption[];
23
32
  controlStep?: number;
33
+ /** Labels the selected option's threshold on the slider, e.g. `Default: 40`; off by default */
34
+ showDefaultMark?: boolean;
24
35
  }
25
36
  export interface ThresholdProps extends ThresholdSpec {
26
37
  thresholdState?: {
@@ -35,5 +46,6 @@ export interface ThresholdProps extends ThresholdSpec {
35
46
  isLoading?: boolean;
36
47
  }
37
48
  export interface BaseSliderProps extends SliderProps {
38
- defaultThreshold: number;
49
+ /** Index of the mark that renders its label without a dot; `-1` hides nothing */
50
+ labelOnlyMarkIndex?: number;
39
51
  }
@@ -1,16 +1,18 @@
1
- import { ThresholdOption } from './Threshold.types';
2
- export declare const baseSliderMarks: ({
3
- value: number;
4
- label: string;
5
- } | {
6
- value: number;
7
- label?: undefined;
8
- })[];
9
- export declare const getPresetValue: (options: ThresholdOption[], selectedItem: string) => number;
10
- export declare const getSliderMarks: (presetValue: number) => ({
11
- value: number;
12
- label: string;
13
- } | {
14
- value: number;
15
- label?: undefined;
16
- })[];
1
+ import { ThresholdMark } from './Threshold.types';
2
+ export declare const NO_LABEL_ONLY_MARK = -1;
3
+ export declare const baseSliderMarks: ThresholdMark[];
4
+ /**
5
+ * Builds the slider marks with the default threshold labelled.
6
+ *
7
+ * @param defaultThreshold - Default threshold of the selected option
8
+ * @returns Marks ordered by value, including an extra mark when the default sits between intervals
9
+ */
10
+ export declare const getSliderMarks: (defaultThreshold: number) => ThresholdMark[];
11
+ /**
12
+ * Finds the mark that exists only to label the default threshold.
13
+ *
14
+ * @param marks - Marks built by `getSliderMarks`
15
+ * @param defaultThreshold - Default threshold of the selected option
16
+ * @returns Index of the mark whose dot should stay hidden, or `-1` when the default sits on an interval
17
+ */
18
+ export declare const getLabelOnlyMarkIndex: (marks: ThresholdMark[], defaultThreshold: number) => number;
@@ -18,14 +18,14 @@ import { theme } from '@lunit/oui';
18
18
  <ThemeProvider theme={theme}>
19
19
  <CssBaseline />
20
20
  <App />
21
- </ThemeProvider>
21
+ </ThemeProvider>;
22
22
  ```
23
23
 
24
24
  ## Import paths
25
25
 
26
26
  ```ts
27
27
  import { Button, Dialog, TextField } from '@lunit/oui'; // components
28
- import { ArrowDoubleDown } from '@lunit/oui/icons'; // icons
28
+ import { ArrowDoubleDown } from '@lunit/oui/icons'; // icons
29
29
  import { theme, palette, typography, spacing } from '@lunit/oui'; // theme & tokens
30
30
  ```
31
31
 
@@ -37,54 +37,58 @@ import { theme, palette, typography, spacing } from '@lunit/oui'; // theme & tok
37
37
 
38
38
  ### Input / Form
39
39
 
40
- | Component | Purpose | Key props |
41
- |---|---|---|
42
- | **Button** | Trigger actions. Supports label/icon buttons and loading | `variant: 'contained' \| 'ghost' \| 'outlined'`, `color: 'primary' \| 'secondary' \| 'error'`, `size: 'small' \| 'medium' \| 'large'`, `label`, `icon`, `loading` |
43
- | **TextField** / **BaseTextField** | Text input | extends MUI TextField |
44
- | **Checkbox** | Checkbox | — |
45
- | **Radio** | Radio button | — |
46
- | **Toggle** | on/off switch | — |
47
- | **Dropdown** | Selection dropdown | — |
48
- | **DatePicker** | Date selection (based on `@mui/x-date-pickers`) | |
49
- | **FileDnDZone** | File drag-and-drop area | — |
50
- | **UploadManager** | Upload progress/management UI | — |
40
+ | Component | Purpose | Key props |
41
+ | --------------------------------- | -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
42
+ | **Button** | Trigger actions. Supports label/icon buttons and loading | `variant: 'contained' \| 'ghost' \| 'outlined'`, `color: 'primary' \| 'secondary' \| 'error'`, `size: 'small' \| 'medium' \| 'large'`, `label`, `icon`, `loading` |
43
+ | **TextField** / **BaseTextField** | Text input | extends MUI TextField |
44
+ | **Checkbox** | Checkbox | — |
45
+ | **Radio** | Radio button | — |
46
+ | **Toggle** | on/off switch | — |
47
+ | **Dropdown** | Selection dropdown | — |
48
+ | **Autocomplete** | Multi-select chip input with clear button + loading | `placeholder`, `error`, `helperText`, `loading`, `noOptionsText`, `onDelete`, `onClearButtonClick` |
49
+ | **DatePicker** | Date selection (based on `@mui/x-date-pickers`) | — |
50
+ | **FileDnDZone** | File drag-and-drop area | — |
51
+ | **UploadManager** | Upload progress/management UI | — |
51
52
 
52
53
  ### Display / Layout
53
54
 
54
- | Component | Purpose | Key props |
55
- |---|---|---|
56
- | **Card** | Content card container | `size: 'small' \| 'large'` |
57
- | **Divider** | Separator line | `orientation: 'horizontal' \| 'vertical'` |
58
- | **List** | List | `size: 'small' \| 'medium' \| 'large'` |
59
- | **DataTable** | Data table (based on `@mui/x-data-grid`) | — |
60
- | **EllipsisTypography** | Text with ellipsis (...) truncation | — |
61
- | **ProductLabel** | Product label badge | — |
62
- | **NoMatchContainer** | Empty state (e.g. no search results) | — |
55
+ | Component | Purpose | Key props |
56
+ | ---------------------- | ----------------------------------------------- | ------------------------------------------------------- |
57
+ | **Card** | Content card container | `size: 'small' \| 'large'` |
58
+ | **Divider** | Separator line | `orientation: 'horizontal' \| 'vertical'` |
59
+ | **Drawer** | Side drawer with collapsed/expanded/wide widths | `open`, `wide`, `closedWidth`, `openWidth`, `wideWidth` |
60
+ | **Collapse** | Expand/collapse transition wrapper | extends MUI Collapse (`in`, `orientation`, `timeout`) |
61
+ | **List** | List | `size: 'small' \| 'medium' \| 'large'` |
62
+ | **DataTable** | Data table (based on `@mui/x-data-grid`) | — |
63
+ | **EllipsisTypography** | Text with ellipsis (...) truncation | — |
64
+ | **ProductLabel** | Product label badge | — |
65
+ | **NoMatchContainer** | Empty state (e.g. no search results) | — |
63
66
 
64
67
  ### Feedback / Overlay
65
68
 
66
- | Component | Purpose | Key props |
67
- |---|---|---|
68
- | **Alert** | Inline notification (info/success/error/warning) | — |
69
- | **Dialog** | Modal dialog | — |
70
- | **Tooltip** | Tooltip | `size: 'small' \| 'large'`, `placement` |
71
- | **Progress** | Progress indicator (Circular/Linear) | `CircularProgress`: `size`, `circleColor` |
72
- | **LoadingIndicator** | Loading spinner | |
73
- | **Chip** | Chip/tag | `preset` (ChipsPreset) |
69
+ | Component | Purpose | Key props |
70
+ | -------------------- | ------------------------------------------------ | -------------------------------------------------------- |
71
+ | **Alert** | Inline notification (info/success/error/warning) | — |
72
+ | **Dialog** | Modal dialog | — |
73
+ | **Popover** | Anchored overlay with tokenized paper styling | extends MUI Popover (`open`, `anchorEl`, `anchorOrigin`) |
74
+ | **Tooltip** | Tooltip | `size: 'small' \| 'large'`, `placement` |
75
+ | **Progress** | Progress indicator (Circular/Linear) | `CircularProgress`: `size`, `circleColor` |
76
+ | **LoadingIndicator** | Loading spinner | |
77
+ | **Chip** | Chip/tag | `preset` (ChipsPreset) |
74
78
 
75
79
  ### Navigation / Structure
76
80
 
77
- | Component | Purpose | Key props |
78
- |---|---|---|
79
- | **Menu** | Menu | `size: 'small' \| 'medium'` |
80
- | **Pagination** | Pagination | `size: number` |
81
- | **Stepper** | Step progress indicator | — |
82
- | **TabbedPanel** | Tab panel | `size: 'small' \| 'medium'`, `variant: 'normal' \| 'toggle'` |
81
+ | Component | Purpose | Key props |
82
+ | --------------- | ----------------------- | ------------------------------------------------------------ |
83
+ | **Menu** | Menu | `size: 'small' \| 'medium'` |
84
+ | **Pagination** | Pagination | `size: number` |
85
+ | **Stepper** | Step progress indicator | — |
86
+ | **TabbedPanel** | Tab panel | `size: 'small' \| 'medium'`, `variant: 'normal' \| 'toggle'` |
83
87
 
84
88
  ### Utility
85
89
 
86
- | Component | Purpose |
87
- |---|---|
90
+ | Component | Purpose |
91
+ | ------------------ | ----------------------------- |
88
92
  | **ResizeObserver** | Size-change detection wrapper |
89
93
 
90
94
  ---