@navikt/ds-react 5.13.0 → 5.15.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/_docs.json +206 -135
- package/cjs/accordion/AccordionHeader.js +2 -4
- package/cjs/button/Button.js +11 -12
- package/cjs/chips/Removable.js +3 -6
- package/cjs/copybutton/CopyButton.js +4 -5
- package/cjs/date/datepicker/DatePicker.js +4 -2
- package/cjs/date/datepicker/parts/WeekRow.js +2 -2
- package/cjs/date/monthpicker/MonthPicker.js +4 -3
- package/cjs/date/parts/DateWrapper.js +2 -2
- package/cjs/dropdown/Menu/GroupedList/GroupedItem.js +3 -6
- package/cjs/dropdown/Menu/List/Item.js +3 -6
- package/cjs/dropdown/Toggle.js +6 -5
- package/cjs/form/ConfirmationPanel.js +2 -2
- package/cjs/form/Textarea.js +2 -1
- package/cjs/form/checkbox/Checkbox.js +3 -2
- package/cjs/form/combobox/Combobox.js +2 -2
- package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js +3 -4
- package/cjs/form/combobox/Input/inputContext.js +2 -2
- package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.js +2 -5
- package/cjs/form/error-summary/ErrorSummary.js +2 -2
- package/cjs/form/radio/Radio.js +3 -2
- package/cjs/form/radio/RadioGroup.js +2 -2
- package/cjs/form/search/Search.js +2 -1
- package/cjs/form/search/SearchButton.js +2 -4
- package/cjs/form/useFormField.js +2 -2
- package/cjs/guide-panel/Illustration.js +2 -2
- package/cjs/help-text/HelpText.js +5 -7
- package/cjs/help-text/HelpTextIcon.js +2 -2
- package/cjs/list/List.js +2 -2
- package/cjs/loader/Loader.js +2 -1
- package/cjs/modal/Modal.js +21 -18
- package/cjs/modal/dialog-polyfill.js +2 -2
- package/cjs/popover/Popover.js +6 -5
- package/cjs/read-more/ReadMore.js +2 -4
- package/cjs/stepper/Step.js +6 -6
- package/cjs/{util → table}/AnimateHeight.js +4 -5
- package/cjs/table/DataCell.js +2 -2
- package/cjs/table/ExpandableRow.js +9 -9
- package/cjs/table/HeaderCell.js +2 -1
- package/cjs/tabs/TabList.js +2 -1
- package/cjs/tag/Tag.js +4 -2
- package/cjs/timeline/Pin.js +2 -2
- package/cjs/timeline/period/ClickablePeriod.js +2 -2
- package/cjs/toggle-group/ToggleGroup.js +2 -2
- package/cjs/tooltip/Tooltip.js +6 -5
- package/cjs/util/Slot.js +2 -5
- package/cjs/util/TextareaAutoSize.js +7 -5
- package/cjs/util/composeEventHandlers.js +17 -0
- package/cjs/util/hooks/index.js +19 -0
- package/cjs/util/hooks/package.json +6 -0
- package/cjs/util/hooks/useClientLayoutEffect.js +7 -0
- package/cjs/util/hooks/useMergeRefs.js +37 -0
- package/cjs/util/{usePrevious.js → hooks/usePrevious.js} +2 -1
- package/cjs/util/index.js +7 -7
- package/cjs/util/types/index.js +2 -0
- package/cjs/util/types/package.json +6 -0
- package/esm/accordion/AccordionHeader.js +2 -4
- package/esm/accordion/AccordionHeader.js.map +1 -1
- package/esm/button/Button.d.ts +1 -1
- package/esm/button/Button.js +12 -13
- package/esm/button/Button.js.map +1 -1
- package/esm/chips/Chips.d.ts +1 -1
- package/esm/chips/Removable.js +3 -6
- package/esm/chips/Removable.js.map +1 -1
- package/esm/chips/Toggle.d.ts +1 -1
- package/esm/copybutton/CopyButton.js +4 -5
- package/esm/copybutton/CopyButton.js.map +1 -1
- package/esm/date/datepicker/DatePicker.js +5 -3
- package/esm/date/datepicker/DatePicker.js.map +1 -1
- package/esm/date/datepicker/parts/WeekRow.js +1 -1
- package/esm/date/datepicker/parts/WeekRow.js.map +1 -1
- package/esm/date/monthpicker/MonthPicker.js +4 -3
- package/esm/date/monthpicker/MonthPicker.js.map +1 -1
- package/esm/date/parts/DateWrapper.js +1 -1
- package/esm/date/parts/DateWrapper.js.map +1 -1
- package/esm/date/utils/dates-disabled.d.ts +1 -1
- package/esm/date/utils/dates-disabled.js.map +1 -1
- package/esm/dropdown/Menu/GroupedList/GroupedItem.d.ts +1 -1
- package/esm/dropdown/Menu/GroupedList/GroupedItem.js +3 -6
- package/esm/dropdown/Menu/GroupedList/GroupedItem.js.map +1 -1
- package/esm/dropdown/Menu/GroupedList/index.d.ts +1 -1
- package/esm/dropdown/Menu/List/Item.d.ts +1 -1
- package/esm/dropdown/Menu/List/Item.js +3 -6
- package/esm/dropdown/Menu/List/Item.js.map +1 -1
- package/esm/dropdown/Menu/List/index.d.ts +1 -1
- package/esm/dropdown/Toggle.js +6 -5
- package/esm/dropdown/Toggle.js.map +1 -1
- package/esm/expansion-card/ExpansionCard.d.ts +1 -1
- package/esm/expansion-card/ExpansionCardTitle.d.ts +1 -1
- package/esm/form/ConfirmationPanel.js +1 -1
- package/esm/form/ConfirmationPanel.js.map +1 -1
- package/esm/form/Textarea.js +2 -1
- package/esm/form/Textarea.js.map +1 -1
- package/esm/form/checkbox/Checkbox.js +2 -1
- package/esm/form/checkbox/Checkbox.js.map +1 -1
- package/esm/form/combobox/Combobox.js +3 -3
- package/esm/form/combobox/Combobox.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js +1 -2
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/useVirtualFocus.js.map +1 -1
- package/esm/form/combobox/Input/inputContext.js +1 -1
- package/esm/form/combobox/Input/inputContext.js.map +1 -1
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.js +1 -1
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.js.map +1 -1
- package/esm/form/error-summary/ErrorSummary.js +1 -1
- package/esm/form/error-summary/ErrorSummary.js.map +1 -1
- package/esm/form/error-summary/ErrorSummaryItem.d.ts +1 -1
- package/esm/form/radio/Radio.js +2 -1
- package/esm/form/radio/Radio.js.map +1 -1
- package/esm/form/radio/RadioGroup.js +1 -1
- package/esm/form/radio/RadioGroup.js.map +1 -1
- package/esm/form/search/Search.js +4 -3
- package/esm/form/search/Search.js.map +1 -1
- package/esm/form/search/SearchButton.js +2 -4
- package/esm/form/search/SearchButton.js.map +1 -1
- package/esm/form/useFormField.js +1 -1
- package/esm/form/useFormField.js.map +1 -1
- package/esm/guide-panel/Illustration.js +1 -1
- package/esm/guide-panel/Illustration.js.map +1 -1
- package/esm/help-text/HelpText.d.ts +0 -5
- package/esm/help-text/HelpText.js +6 -8
- package/esm/help-text/HelpText.js.map +1 -1
- package/esm/help-text/HelpTextIcon.js +1 -1
- package/esm/internal-header/InternalHeader.d.ts +1 -1
- package/esm/internal-header/InternalHeaderButton.d.ts +1 -1
- package/esm/internal-header/InternalHeaderTitle.d.ts +1 -1
- package/esm/internal-header/InternalHeaderUserButton.d.ts +1 -1
- package/esm/layout/box/Box.d.ts +1 -1
- package/esm/layout/page/parts/PageBlock.d.ts +1 -1
- package/esm/layout/stack/HStack.d.ts +1 -1
- package/esm/layout/stack/Stack.d.ts +1 -1
- package/esm/layout/stack/VStack.d.ts +1 -1
- package/esm/link/Link.d.ts +1 -1
- package/esm/link-panel/LinkPanel.d.ts +1 -1
- package/esm/link-panel/LinkPanelTitle.d.ts +1 -1
- package/esm/list/List.js +1 -1
- package/esm/loader/Loader.js +2 -1
- package/esm/loader/Loader.js.map +1 -1
- package/esm/modal/Modal.js +21 -18
- package/esm/modal/Modal.js.map +1 -1
- package/esm/modal/dialog-polyfill.js +2 -2
- package/esm/modal/dialog-polyfill.js.map +1 -1
- package/esm/modal/types.d.ts +1 -1
- package/esm/pagination/PaginationItem.d.ts +1 -1
- package/esm/panel/Panel.d.ts +1 -1
- package/esm/popover/Popover.d.ts +1 -1
- package/esm/popover/Popover.js +4 -3
- package/esm/popover/Popover.js.map +1 -1
- package/esm/read-more/ReadMore.js +2 -4
- package/esm/read-more/ReadMore.js.map +1 -1
- package/esm/stepper/Step.d.ts +1 -1
- package/esm/stepper/Step.js +6 -6
- package/esm/stepper/Step.js.map +1 -1
- package/esm/{util → table}/AnimateHeight.js +4 -5
- package/esm/table/AnimateHeight.js.map +1 -0
- package/esm/table/DataCell.d.ts +4 -0
- package/esm/table/DataCell.js +2 -2
- package/esm/table/DataCell.js.map +1 -1
- package/esm/table/ExpandableRow.js +8 -8
- package/esm/table/ExpandableRow.js.map +1 -1
- package/esm/table/HeaderCell.d.ts +4 -0
- package/esm/table/HeaderCell.js +2 -1
- package/esm/table/HeaderCell.js.map +1 -1
- package/esm/tabs/Tab.d.ts +1 -1
- package/esm/tabs/TabList.js +3 -2
- package/esm/tabs/TabList.js.map +1 -1
- package/esm/tabs/Tabs.d.ts +1 -1
- package/esm/tag/Tag.d.ts +4 -0
- package/esm/tag/Tag.js +4 -2
- package/esm/tag/Tag.js.map +1 -1
- package/esm/timeline/Pin.js +3 -3
- package/esm/timeline/Pin.js.map +1 -1
- package/esm/timeline/period/ClickablePeriod.js +3 -3
- package/esm/timeline/period/ClickablePeriod.js.map +1 -1
- package/esm/toggle-group/ToggleGroup.js +1 -1
- package/esm/toggle-group/ToggleGroup.js.map +1 -1
- package/esm/tooltip/Tooltip.js +6 -5
- package/esm/tooltip/Tooltip.js.map +1 -1
- package/esm/typography/BodyLong.d.ts +1 -1
- package/esm/typography/BodyShort.d.ts +1 -1
- package/esm/typography/Detail.d.ts +1 -1
- package/esm/typography/ErrorMessage.d.ts +1 -1
- package/esm/typography/Heading.d.ts +1 -1
- package/esm/typography/Ingress.d.ts +1 -1
- package/esm/typography/Label.d.ts +1 -1
- package/esm/util/Slot.js +1 -1
- package/esm/util/Slot.js.map +1 -1
- package/esm/util/TextareaAutoSize.js +5 -3
- package/esm/util/TextareaAutoSize.js.map +1 -1
- package/esm/util/composeEventHandlers.d.ts +8 -0
- package/esm/util/composeEventHandlers.js +14 -0
- package/esm/util/composeEventHandlers.js.map +1 -0
- package/esm/util/hooks/index.d.ts +8 -0
- package/esm/util/hooks/index.js +9 -0
- package/esm/util/hooks/index.js.map +1 -0
- package/esm/util/hooks/useClientLayoutEffect.js +5 -0
- package/esm/util/hooks/useClientLayoutEffect.js.map +1 -0
- package/esm/util/{useEventListener.d.ts → hooks/useEventListener.d.ts} +1 -1
- package/esm/util/hooks/useEventListener.js.map +1 -0
- package/esm/util/hooks/useId.js.map +1 -0
- package/esm/util/hooks/useMedia.js.map +1 -0
- package/esm/util/hooks/useMergeRefs.d.ts +15 -0
- package/esm/util/hooks/useMergeRefs.js +30 -0
- package/esm/util/hooks/useMergeRefs.js.map +1 -0
- package/esm/util/hooks/usePrevious.d.ts +1 -0
- package/esm/util/{usePrevious.js → hooks/usePrevious.js} +1 -2
- package/esm/util/hooks/usePrevious.js.map +1 -0
- package/esm/util/index.d.ts +4 -5
- package/esm/util/index.js +3 -5
- package/esm/util/index.js.map +1 -1
- package/esm/util/types/OverridableComponent.js.map +1 -0
- package/esm/util/types/index.d.ts +1 -0
- package/esm/util/types/index.js +2 -0
- package/esm/util/types/index.js.map +1 -0
- package/package.json +3 -3
- package/src/accordion/AccordionHeader.tsx +2 -4
- package/src/accordion/AccordionItem.tsx +2 -2
- package/src/alert/alert.stories.tsx +1 -2
- package/src/button/Button.tsx +14 -19
- package/src/button/button.stories.tsx +2 -2
- package/src/chips/Chips.tsx +1 -1
- package/src/chips/Removable.tsx +3 -4
- package/src/chips/Toggle.tsx +1 -1
- package/src/copybutton/CopyButton.tsx +4 -5
- package/src/copybutton/copy-button.stories.tsx +1 -1
- package/src/date/datepicker/DatePicker.tsx +5 -3
- package/src/date/datepicker/parts/WeekRow.tsx +1 -1
- package/src/date/monthpicker/MonthPicker.tsx +4 -3
- package/src/date/parts/DateWrapper.tsx +1 -1
- package/src/date/utils/dates-disabled.ts +1 -1
- package/src/dropdown/Menu/GroupedList/GroupedItem.tsx +23 -23
- package/src/dropdown/Menu/GroupedList/index.tsx +1 -1
- package/src/dropdown/Menu/List/Item.tsx +23 -23
- package/src/dropdown/Menu/List/index.tsx +1 -1
- package/src/dropdown/Toggle.tsx +10 -6
- package/src/expansion-card/ExpansionCard.tsx +1 -1
- package/src/expansion-card/ExpansionCardTitle.tsx +1 -1
- package/src/form/ConfirmationPanel.tsx +1 -1
- package/src/form/Textarea.tsx +2 -1
- package/src/form/checkbox/Checkbox.tsx +2 -1
- package/src/form/combobox/Combobox.tsx +3 -6
- package/src/form/combobox/FilteredOptions/filteredOptionsContext.tsx +1 -2
- package/src/form/combobox/FilteredOptions/useVirtualFocus.ts +1 -1
- package/src/form/combobox/Input/inputContext.tsx +1 -1
- package/src/form/combobox/SelectedOptions/selectedOptionsContext.tsx +1 -1
- package/src/form/combobox/combobox.stories.tsx +10 -11
- package/src/form/error-summary/ErrorSummary.tsx +1 -1
- package/src/form/error-summary/ErrorSummaryItem.tsx +1 -1
- package/src/form/radio/Radio.tsx +2 -1
- package/src/form/radio/RadioGroup.tsx +1 -1
- package/src/form/search/Search.tsx +3 -3
- package/src/form/search/SearchButton.tsx +2 -4
- package/src/form/useFormField.ts +1 -1
- package/src/guide-panel/Illustration.tsx +1 -1
- package/src/help-text/HelpText.tsx +7 -25
- package/src/help-text/HelpTextIcon.tsx +1 -1
- package/src/help-text/help-text.stories.tsx +58 -68
- package/src/internal-header/InternalHeader.tsx +1 -1
- package/src/internal-header/InternalHeaderButton.tsx +1 -1
- package/src/internal-header/InternalHeaderTitle.tsx +1 -1
- package/src/internal-header/InternalHeaderUserButton.tsx +1 -1
- package/src/layout/box/Box.tsx +1 -1
- package/src/layout/page/parts/PageBlock.tsx +1 -1
- package/src/layout/stack/HStack.tsx +1 -1
- package/src/layout/stack/Stack.tsx +1 -1
- package/src/layout/stack/VStack.tsx +1 -1
- package/src/link/Link.tsx +1 -1
- package/src/link/{link.stories.tsx → stories/link.stories.tsx} +2 -2
- package/src/link-panel/LinkPanel.tsx +1 -1
- package/src/link-panel/LinkPanelTitle.tsx +1 -1
- package/src/list/List.tsx +1 -1
- package/src/loader/Loader.tsx +2 -1
- package/src/modal/Modal.tsx +30 -30
- package/src/modal/dialog-polyfill.ts +2 -2
- package/src/modal/types.ts +1 -1
- package/src/pagination/PaginationItem.tsx +1 -1
- package/src/panel/Panel.tsx +1 -1
- package/src/popover/Popover.tsx +4 -7
- package/src/read-more/ReadMore.tsx +2 -4
- package/src/stepper/Step.tsx +8 -5
- package/src/{util → table}/AnimateHeight.tsx +5 -9
- package/src/table/DataCell.tsx +6 -1
- package/src/table/ExpandableRow.tsx +11 -6
- package/src/table/HeaderCell.tsx +6 -1
- package/src/table/stories/table.stories.tsx +43 -29
- package/src/table/stories/tests/table.stories.tsx +2 -3
- package/src/tabs/Tab.tsx +1 -1
- package/src/tabs/TabList.tsx +4 -2
- package/src/tabs/Tabs.tsx +1 -1
- package/src/tag/Tag.tsx +9 -2
- package/src/tag/tag.stories.tsx +27 -1
- package/src/timeline/Pin.tsx +3 -6
- package/src/timeline/period/ClickablePeriod.tsx +3 -6
- package/src/toggle-group/ToggleGroup.tsx +1 -1
- package/src/tooltip/Tooltip.tsx +11 -22
- package/src/typography/BodyLong.tsx +1 -1
- package/src/typography/BodyShort.tsx +1 -1
- package/src/typography/Detail.tsx +1 -1
- package/src/typography/ErrorMessage.tsx +1 -1
- package/src/typography/Heading.tsx +1 -1
- package/src/typography/Ingress.tsx +1 -1
- package/src/typography/Label.tsx +1 -1
- package/src/typography/stories/bodylong.stories.tsx +1 -2
- package/src/typography/stories/bodyshort.stories.tsx +1 -2
- package/src/typography/stories/detail.stories.tsx +1 -2
- package/src/typography/stories/error-message.stories.tsx +1 -2
- package/src/typography/stories/heading.stories.tsx +1 -2
- package/src/typography/stories/ingress.stories.tsx +1 -2
- package/src/typography/stories/label.stories.tsx +1 -2
- package/src/util/Slot.tsx +1 -1
- package/src/util/TextareaAutoSize.tsx +7 -3
- package/src/util/__tests__/useMedia.test.tsx +1 -1
- package/src/util/composeEventHandlers.ts +19 -0
- package/src/util/hooks/index.ts +8 -0
- package/src/util/hooks/useCallbackRef.ts +1 -1
- package/src/util/hooks/useClientLayoutEffect.ts +5 -0
- package/src/util/hooks/useControllableState.ts +1 -1
- package/src/util/hooks/useMergeRefs.ts +32 -0
- package/src/util/{usePrevious.ts → hooks/usePrevious.ts} +1 -4
- package/src/util/index.ts +4 -5
- package/src/util/types/index.ts +1 -0
- package/cjs/util/RandomIcon.js +0 -38
- package/cjs/util/mergeRefs.js +0 -16
- package/cjs/util/useClientLayoutEffect.js +0 -10
- package/esm/util/AnimateHeight.js.map +0 -1
- package/esm/util/OverridableComponent.js.map +0 -1
- package/esm/util/RandomIcon.d.ts +0 -2
- package/esm/util/RandomIcon.js +0 -9
- package/esm/util/RandomIcon.js.map +0 -1
- package/esm/util/mergeRefs.d.ts +0 -2
- package/esm/util/mergeRefs.js +0 -14
- package/esm/util/mergeRefs.js.map +0 -1
- package/esm/util/useClientLayoutEffect.js +0 -8
- package/esm/util/useClientLayoutEffect.js.map +0 -1
- package/esm/util/useEventListener.js.map +0 -1
- package/esm/util/useId.js.map +0 -1
- package/esm/util/useMedia.js.map +0 -1
- package/esm/util/usePrevious.d.ts +0 -2
- package/esm/util/usePrevious.js.map +0 -1
- package/src/util/mergeRefs.tsx +0 -16
- package/src/util/useClientLayoutEffect.ts +0 -11
- /package/cjs/util/{useEventListener.js → hooks/useEventListener.js} +0 -0
- /package/cjs/util/{useId.js → hooks/useId.js} +0 -0
- /package/cjs/util/{useMedia.js → hooks/useMedia.js} +0 -0
- /package/cjs/util/{OverridableComponent.js → types/OverridableComponent.js} +0 -0
- /package/esm/{util → table}/AnimateHeight.d.ts +0 -0
- /package/esm/util/{useClientLayoutEffect.d.ts → hooks/useClientLayoutEffect.d.ts} +0 -0
- /package/esm/util/{useEventListener.js → hooks/useEventListener.js} +0 -0
- /package/esm/util/{useId.d.ts → hooks/useId.d.ts} +0 -0
- /package/esm/util/{useId.js → hooks/useId.js} +0 -0
- /package/esm/util/{useMedia.d.ts → hooks/useMedia.d.ts} +0 -0
- /package/esm/util/{useMedia.js → hooks/useMedia.js} +0 -0
- /package/esm/util/{OverridableComponent.d.ts → types/OverridableComponent.d.ts} +0 -0
- /package/esm/util/{OverridableComponent.js → types/OverridableComponent.js} +0 -0
- /package/src/{util → link/stories}/RandomIcon.tsx +0 -0
- /package/src/util/{useEventListener.ts → hooks/useEventListener.ts} +0 -0
- /package/src/util/{useId.ts → hooks/useId.ts} +0 -0
- /package/src/util/{useMedia.ts → hooks/useMedia.ts} +0 -0
- /package/src/util/{OverridableComponent.ts → types/OverridableComponent.ts} +0 -0
package/src/table/HeaderCell.tsx
CHANGED
|
@@ -9,6 +9,10 @@ export interface HeaderCellProps
|
|
|
9
9
|
* @default "left"
|
|
10
10
|
*/
|
|
11
11
|
align?: "left" | "center" | "right";
|
|
12
|
+
/**
|
|
13
|
+
* Adjusts font-size
|
|
14
|
+
*/
|
|
15
|
+
textSize?: "medium" | "small";
|
|
12
16
|
}
|
|
13
17
|
|
|
14
18
|
export interface HeaderCellType
|
|
@@ -17,12 +21,13 @@ export interface HeaderCellType
|
|
|
17
21
|
> {}
|
|
18
22
|
|
|
19
23
|
export const HeaderCell: HeaderCellType = forwardRef(
|
|
20
|
-
({ className, children, align, ...rest }, ref) => {
|
|
24
|
+
({ className, children, align, textSize, ...rest }, ref) => {
|
|
21
25
|
return (
|
|
22
26
|
<th
|
|
23
27
|
ref={ref}
|
|
24
28
|
className={cl("navds-table__header-cell", "navds-label", className, {
|
|
25
29
|
[`navds-table__header-cell--align-${align}`]: align,
|
|
30
|
+
"navds-label--small": textSize === "small",
|
|
26
31
|
})}
|
|
27
32
|
{...rest}
|
|
28
33
|
>
|
|
@@ -1,26 +1,30 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import { Table } from "../";
|
|
3
|
-
import { Alert, Button, Checkbox, Link } from "../..";
|
|
2
|
+
import { Table, TableProps } from "../";
|
|
3
|
+
import { Alert, Button, Checkbox, CheckboxGroup, Link } from "../..";
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
title: "ds-react/Table",
|
|
7
7
|
component: Table,
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
interface Props extends TableProps {
|
|
11
|
+
button?: boolean;
|
|
12
|
+
shadeOnHover?: boolean;
|
|
13
|
+
}
|
|
14
|
+
const TableComponent = ({ button, shadeOnHover, ...rest }: Props) => (
|
|
15
|
+
<Table {...rest}>
|
|
12
16
|
<Table.Header>
|
|
13
17
|
<Table.Row>
|
|
14
|
-
{
|
|
18
|
+
{button && <Table.HeaderCell>Action</Table.HeaderCell>}
|
|
15
19
|
<Table.HeaderCell>ID</Table.HeaderCell>
|
|
16
20
|
<Table.HeaderCell>Fornavn</Table.HeaderCell>
|
|
17
|
-
<Table.HeaderCell>Etternavn</Table.HeaderCell>
|
|
18
|
-
<Table.HeaderCell>Rolle</Table.HeaderCell>
|
|
21
|
+
<Table.HeaderCell textSize="medium">Etternavn</Table.HeaderCell>
|
|
22
|
+
<Table.HeaderCell textSize="small">Rolle</Table.HeaderCell>
|
|
19
23
|
</Table.Row>
|
|
20
24
|
</Table.Header>
|
|
21
25
|
<Table.Body>
|
|
22
|
-
<Table.Row shadeOnHover={
|
|
23
|
-
{
|
|
26
|
+
<Table.Row shadeOnHover={shadeOnHover}>
|
|
27
|
+
{button && (
|
|
24
28
|
<Table.DataCell
|
|
25
29
|
style={{
|
|
26
30
|
paddingTop: 6,
|
|
@@ -35,8 +39,8 @@ const TableComponent = (props) => (
|
|
|
35
39
|
<Table.DataCell>Picard</Table.DataCell>
|
|
36
40
|
<Table.DataCell>Kaptein</Table.DataCell>
|
|
37
41
|
</Table.Row>
|
|
38
|
-
<Table.Row shadeOnHover={
|
|
39
|
-
{
|
|
42
|
+
<Table.Row shadeOnHover={shadeOnHover}>
|
|
43
|
+
{button && (
|
|
40
44
|
<Table.DataCell
|
|
41
45
|
style={{
|
|
42
46
|
paddingTop: 6,
|
|
@@ -51,8 +55,8 @@ const TableComponent = (props) => (
|
|
|
51
55
|
<Table.DataCell>Riker</Table.DataCell>
|
|
52
56
|
<Table.DataCell>Kommandør</Table.DataCell>
|
|
53
57
|
</Table.Row>
|
|
54
|
-
<Table.Row shadeOnHover={
|
|
55
|
-
{
|
|
58
|
+
<Table.Row shadeOnHover={shadeOnHover}>
|
|
59
|
+
{button && (
|
|
56
60
|
<Table.DataCell
|
|
57
61
|
style={{
|
|
58
62
|
paddingTop: 6,
|
|
@@ -64,8 +68,8 @@ const TableComponent = (props) => (
|
|
|
64
68
|
)}
|
|
65
69
|
<Table.HeaderCell>3</Table.HeaderCell>
|
|
66
70
|
<Table.DataCell>Geordi</Table.DataCell>
|
|
67
|
-
<Table.DataCell>La Forge</Table.DataCell>
|
|
68
|
-
<Table.DataCell>Sjefsingeniør</Table.DataCell>
|
|
71
|
+
<Table.DataCell textSize="medium">La Forge</Table.DataCell>
|
|
72
|
+
<Table.DataCell textSize="small">Sjefsingeniør</Table.DataCell>
|
|
69
73
|
</Table.Row>
|
|
70
74
|
</Table.Body>
|
|
71
75
|
</Table>
|
|
@@ -229,22 +233,32 @@ const SelectionTable = ({ size = "medium" }: { size?: "small" | "medium" }) => {
|
|
|
229
233
|
</Table.Row>
|
|
230
234
|
<Table.Row selected={selectedRows.includes("3")}>
|
|
231
235
|
<Table.DataCell>
|
|
232
|
-
<
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
236
|
+
<CheckboxGroup legend="velg flere felt" hideLegend>
|
|
237
|
+
<Checkbox
|
|
238
|
+
size={size}
|
|
239
|
+
hideLabel
|
|
240
|
+
checked={selectedRows.includes("3")}
|
|
241
|
+
onChange={() => toggleSelectedRow("3")}
|
|
242
|
+
aria-labelledby={`x_r3-${size}`}
|
|
243
|
+
>
|
|
244
|
+
{" "}
|
|
245
|
+
</Checkbox>
|
|
246
|
+
<Checkbox
|
|
247
|
+
size={size}
|
|
248
|
+
hideLabel
|
|
249
|
+
checked={selectedRows.includes("3")}
|
|
250
|
+
onChange={() => toggleSelectedRow("3")}
|
|
251
|
+
aria-labelledby={`x_r3-${size}`}
|
|
252
|
+
>
|
|
253
|
+
{" "}
|
|
254
|
+
</Checkbox>
|
|
255
|
+
</CheckboxGroup>
|
|
241
256
|
</Table.DataCell>
|
|
242
|
-
<Table.HeaderCell scope="row">
|
|
243
|
-
<span id={`x_r3-${size}`}>
|
|
257
|
+
<Table.HeaderCell scope="row" colSpan={4}>
|
|
258
|
+
<span id={`x_r3-${size}`}>
|
|
259
|
+
Don't stack multiple checkboxes
|
|
260
|
+
</span>
|
|
244
261
|
</Table.HeaderCell>
|
|
245
|
-
<Table.DataCell>32</Table.DataCell>
|
|
246
|
-
<Table.DataCell>Germany</Table.DataCell>
|
|
247
|
-
<Table.DataCell>70</Table.DataCell>
|
|
248
262
|
</Table.Row>
|
|
249
263
|
</Table.Body>
|
|
250
264
|
</Table>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { expect,
|
|
2
|
-
import { userEvent, within } from "@storybook/testing-library";
|
|
1
|
+
import { expect, fn, userEvent, within } from "@storybook/test";
|
|
3
2
|
import React from "react";
|
|
4
3
|
import { Table } from "../..";
|
|
5
4
|
|
|
@@ -66,7 +65,7 @@ export const ClickableRowTest = {
|
|
|
66
65
|
);
|
|
67
66
|
},
|
|
68
67
|
args: {
|
|
69
|
-
onOpenChange:
|
|
68
|
+
onOpenChange: fn(),
|
|
70
69
|
},
|
|
71
70
|
play: async ({ canvasElement, args }) => {
|
|
72
71
|
args.onOpenChange.mockClear();
|
package/src/tabs/Tab.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import * as RadixTabs from "@radix-ui/react-tabs";
|
|
|
2
2
|
import cl from "clsx";
|
|
3
3
|
import React, { forwardRef, useContext } from "react";
|
|
4
4
|
import { BodyShort } from "../typography";
|
|
5
|
-
import { OverridableComponent } from "../util";
|
|
5
|
+
import { OverridableComponent } from "../util/types";
|
|
6
6
|
import { TabsContext } from "./context";
|
|
7
7
|
|
|
8
8
|
export interface TabProps
|
package/src/tabs/TabList.tsx
CHANGED
|
@@ -9,7 +9,8 @@ import React, {
|
|
|
9
9
|
useState,
|
|
10
10
|
} from "react";
|
|
11
11
|
import { ChevronLeftIcon, ChevronRightIcon } from "@navikt/aksel-icons";
|
|
12
|
-
import { debounce
|
|
12
|
+
import { debounce } from "../util";
|
|
13
|
+
import { useMergeRefs } from "../util/hooks/useMergeRefs";
|
|
13
14
|
import { TabsContext } from "./context";
|
|
14
15
|
|
|
15
16
|
export interface TabListProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
@@ -23,7 +24,8 @@ export const TabList = forwardRef<HTMLDivElement, TabListProps>(
|
|
|
23
24
|
({ className, ...rest }, ref) => {
|
|
24
25
|
const context = useContext(TabsContext);
|
|
25
26
|
const listRef = useRef<HTMLDivElement | null>(null);
|
|
26
|
-
const mergedRef =
|
|
27
|
+
const mergedRef = useMergeRefs(listRef, ref);
|
|
28
|
+
|
|
27
29
|
const [displayScroll, setDisplayScroll] = useState({
|
|
28
30
|
start: false,
|
|
29
31
|
end: false,
|
package/src/tabs/Tabs.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as RadixTabs from "@radix-ui/react-tabs";
|
|
2
2
|
import cl from "clsx";
|
|
3
3
|
import React, { HTMLAttributes, forwardRef } from "react";
|
|
4
|
-
import { OverridableComponent } from "../util/
|
|
4
|
+
import { OverridableComponent } from "../util/types";
|
|
5
5
|
import Tab, { TabProps } from "./Tab";
|
|
6
6
|
import TabList, { TabListProps } from "./TabList";
|
|
7
7
|
import TabPanel, { TabPanelProps } from "./TabPanel";
|
package/src/tag/Tag.tsx
CHANGED
|
@@ -36,6 +36,10 @@ export interface TagProps extends HTMLAttributes<HTMLSpanElement> {
|
|
|
36
36
|
* @default "medium"
|
|
37
37
|
*/
|
|
38
38
|
size?: "medium" | "small" | "xsmall";
|
|
39
|
+
/**
|
|
40
|
+
* Tag Icon
|
|
41
|
+
*/
|
|
42
|
+
icon?: React.ReactNode;
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
/**
|
|
@@ -50,7 +54,7 @@ export interface TagProps extends HTMLAttributes<HTMLSpanElement> {
|
|
|
50
54
|
* ```
|
|
51
55
|
*/
|
|
52
56
|
export const Tag = forwardRef<HTMLSpanElement, TagProps>(
|
|
53
|
-
({ className, variant, size = "medium", ...rest }, ref) => (
|
|
57
|
+
({ children, className, variant, size = "medium", icon, ...rest }, ref) => (
|
|
54
58
|
<BodyShort
|
|
55
59
|
{...rest}
|
|
56
60
|
ref={ref}
|
|
@@ -62,7 +66,10 @@ export const Tag = forwardRef<HTMLSpanElement, TagProps>(
|
|
|
62
66
|
`navds-tag--${variant}`,
|
|
63
67
|
`navds-tag--${size}`,
|
|
64
68
|
)}
|
|
65
|
-
|
|
69
|
+
>
|
|
70
|
+
{icon && <span className="navds-tag__icon--left">{icon}</span>}
|
|
71
|
+
{children}
|
|
72
|
+
</BodyShort>
|
|
66
73
|
),
|
|
67
74
|
);
|
|
68
75
|
|
package/src/tag/tag.stories.tsx
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { Meta } from "@storybook/react";
|
|
2
2
|
import React from "react";
|
|
3
|
+
import { ComponentIcon } from "@navikt/aksel-icons";
|
|
3
4
|
import { Tag, TagProps } from ".";
|
|
5
|
+
import { HStack } from "../layout/stack";
|
|
6
|
+
|
|
7
|
+
const sizes: TagProps["size"][] = ["xsmall", "small", "medium"];
|
|
4
8
|
|
|
5
9
|
const variants: TagProps["variant"][] = [
|
|
6
10
|
"warning",
|
|
@@ -52,7 +56,11 @@ export default {
|
|
|
52
56
|
|
|
53
57
|
export const Default = {
|
|
54
58
|
render: (props) => (
|
|
55
|
-
<Tag
|
|
59
|
+
<Tag
|
|
60
|
+
variant={props.variant}
|
|
61
|
+
size={props.size}
|
|
62
|
+
icon={props.icon && <ComponentIcon aria-hidden />}
|
|
63
|
+
>
|
|
56
64
|
{props.children}
|
|
57
65
|
</Tag>
|
|
58
66
|
),
|
|
@@ -60,6 +68,7 @@ export const Default = {
|
|
|
60
68
|
args: {
|
|
61
69
|
children: "Id elit esse",
|
|
62
70
|
variant: "info",
|
|
71
|
+
icon: false,
|
|
63
72
|
},
|
|
64
73
|
};
|
|
65
74
|
|
|
@@ -98,3 +107,20 @@ export const Variants = () => {
|
|
|
98
107
|
</div>
|
|
99
108
|
);
|
|
100
109
|
};
|
|
110
|
+
|
|
111
|
+
export const WithIcons = () => {
|
|
112
|
+
return (
|
|
113
|
+
<HStack gap="2" align="start">
|
|
114
|
+
{sizes.reverse().map((size) => (
|
|
115
|
+
<Tag
|
|
116
|
+
key={size}
|
|
117
|
+
variant="neutral-moderate"
|
|
118
|
+
size={size}
|
|
119
|
+
icon={<ComponentIcon aria-hidden />}
|
|
120
|
+
>
|
|
121
|
+
{size}
|
|
122
|
+
</Tag>
|
|
123
|
+
))}
|
|
124
|
+
</HStack>
|
|
125
|
+
);
|
|
126
|
+
};
|
package/src/timeline/Pin.tsx
CHANGED
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
useRole,
|
|
15
15
|
} from "@floating-ui/react";
|
|
16
16
|
import { format } from "date-fns";
|
|
17
|
-
import React, { forwardRef,
|
|
18
|
-
import {
|
|
17
|
+
import React, { forwardRef, useRef, useState } from "react";
|
|
18
|
+
import { useMergeRefs } from "../util/hooks/useMergeRefs";
|
|
19
19
|
import { useTimelineContext } from "./hooks/useTimelineContext";
|
|
20
20
|
import { position } from "./utils/calc";
|
|
21
21
|
import { TimelineComponentTypes } from "./utils/types.internal";
|
|
@@ -81,10 +81,7 @@ export const Pin = forwardRef<HTMLButtonElement, TimelinePinProps>(
|
|
|
81
81
|
role,
|
|
82
82
|
]);
|
|
83
83
|
|
|
84
|
-
const mergedRef =
|
|
85
|
-
() => mergeRefs([refs.setReference, ref]),
|
|
86
|
-
[ref, refs.setReference],
|
|
87
|
-
);
|
|
84
|
+
const mergedRef = useMergeRefs(refs.setReference, ref);
|
|
88
85
|
|
|
89
86
|
const staticSide = {
|
|
90
87
|
top: "bottom",
|
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
useRole,
|
|
15
15
|
} from "@floating-ui/react";
|
|
16
16
|
import cl from "clsx";
|
|
17
|
-
import React, {
|
|
18
|
-
import {
|
|
17
|
+
import React, { useRef, useState } from "react";
|
|
18
|
+
import { useMergeRefs } from "../../util/hooks/useMergeRefs";
|
|
19
19
|
import { usePeriodContext } from "../hooks/usePeriodContext";
|
|
20
20
|
import { useRowContext } from "../hooks/useRowContext";
|
|
21
21
|
import { useTimelineContext } from "../hooks/useTimelineContext";
|
|
@@ -89,10 +89,7 @@ const ClickablePeriod = React.memo(
|
|
|
89
89
|
role,
|
|
90
90
|
]);
|
|
91
91
|
|
|
92
|
-
const mergedRef =
|
|
93
|
-
() => mergeRefs([refs.setReference, periodRef]),
|
|
94
|
-
[periodRef, refs.setReference],
|
|
95
|
-
);
|
|
92
|
+
const mergedRef = useMergeRefs(refs.setReference, periodRef);
|
|
96
93
|
|
|
97
94
|
const staticSide = {
|
|
98
95
|
top: "bottom",
|
|
@@ -2,7 +2,7 @@ import * as RadixToggleGroup from "@radix-ui/react-toggle-group";
|
|
|
2
2
|
import cl from "clsx";
|
|
3
3
|
import React, { HTMLAttributes, forwardRef, useState } from "react";
|
|
4
4
|
import { Label } from "../typography";
|
|
5
|
-
import { useId } from "../util";
|
|
5
|
+
import { useId } from "../util/hooks";
|
|
6
6
|
import ToggleItem, { ToggleItemProps } from "./ToggleItem";
|
|
7
7
|
import { ToggleGroupContext } from "./context";
|
|
8
8
|
|
package/src/tooltip/Tooltip.tsx
CHANGED
|
@@ -18,14 +18,14 @@ import React, {
|
|
|
18
18
|
cloneElement,
|
|
19
19
|
forwardRef,
|
|
20
20
|
useContext,
|
|
21
|
-
useMemo,
|
|
22
21
|
useRef,
|
|
23
22
|
} from "react";
|
|
24
23
|
import { ModalContext } from "../modal/ModalContext";
|
|
25
24
|
import { useProvider } from "../provider";
|
|
26
25
|
import { Detail } from "../typography";
|
|
27
|
-
import {
|
|
26
|
+
import { useId } from "../util/hooks";
|
|
28
27
|
import { useControllableState } from "../util/hooks/useControllableState";
|
|
28
|
+
import { useMergeRefs } from "../util/hooks/useMergeRefs";
|
|
29
29
|
|
|
30
30
|
export interface TooltipProps extends HTMLAttributes<HTMLDivElement> {
|
|
31
31
|
/**
|
|
@@ -113,7 +113,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
|
|
|
113
113
|
maxChar = 80,
|
|
114
114
|
...rest
|
|
115
115
|
},
|
|
116
|
-
ref
|
|
116
|
+
ref,
|
|
117
117
|
) => {
|
|
118
118
|
const [_open, _setOpen] = useControllableState({
|
|
119
119
|
defaultValue: defaultOpen,
|
|
@@ -166,14 +166,8 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
|
|
|
166
166
|
|
|
167
167
|
const ariaId = useId(id);
|
|
168
168
|
|
|
169
|
-
const mergedRef =
|
|
170
|
-
|
|
171
|
-
[refs.setFloating, ref]
|
|
172
|
-
);
|
|
173
|
-
const childMergedRef = useMemo(
|
|
174
|
-
() => mergeRefs([(children as any).ref, refs.setReference]),
|
|
175
|
-
[children, refs.setReference]
|
|
176
|
-
);
|
|
169
|
+
const mergedRef = useMergeRefs(ref, refs.setFloating);
|
|
170
|
+
const childMergedRef = useMergeRefs(children.ref, refs.setReference);
|
|
177
171
|
|
|
178
172
|
if (
|
|
179
173
|
!children ||
|
|
@@ -181,7 +175,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
|
|
|
181
175
|
(children as any) === React.Fragment
|
|
182
176
|
) {
|
|
183
177
|
console.error(
|
|
184
|
-
"<Tooltip> children needs to be a single ReactElement and not: <React.Fragment/> | <></>"
|
|
178
|
+
"<Tooltip> children needs to be a single ReactElement and not: <React.Fragment/> | <></>",
|
|
185
179
|
);
|
|
186
180
|
return null;
|
|
187
181
|
}
|
|
@@ -189,7 +183,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
|
|
|
189
183
|
if (content?.length > maxChar) {
|
|
190
184
|
_open &&
|
|
191
185
|
console.warn(
|
|
192
|
-
`Because of strict accessibility concers we encourage all Tooltips to have less than 80 characters. Can be overwritten with the maxChar-prop\n\nLength:${content.length}\nTooltip-content: ${content}
|
|
186
|
+
`Because of strict accessibility concers we encourage all Tooltips to have less than 80 characters. Can be overwritten with the maxChar-prop\n\nLength:${content.length}\nTooltip-content: ${content}`,
|
|
193
187
|
);
|
|
194
188
|
}
|
|
195
189
|
|
|
@@ -203,7 +197,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
|
|
|
203
197
|
"aria-describedby": _open
|
|
204
198
|
? cl(ariaId, children?.props["aria-describedby"])
|
|
205
199
|
: children?.props["aria-describedby"],
|
|
206
|
-
})
|
|
200
|
+
}),
|
|
207
201
|
)}
|
|
208
202
|
<FloatingPortal root={rootElement}>
|
|
209
203
|
{_open && (
|
|
@@ -222,7 +216,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
|
|
|
222
216
|
className: cl(
|
|
223
217
|
"navds-tooltip",
|
|
224
218
|
"navds-detail navds-detail--small",
|
|
225
|
-
className
|
|
219
|
+
className,
|
|
226
220
|
),
|
|
227
221
|
})}
|
|
228
222
|
data-side={placement}
|
|
@@ -231,12 +225,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
|
|
|
231
225
|
{keys && (
|
|
232
226
|
<span className="navds-tooltip__keys">
|
|
233
227
|
{keys.map((key) => (
|
|
234
|
-
<Detail
|
|
235
|
-
size="small"
|
|
236
|
-
as="kbd"
|
|
237
|
-
key={key}
|
|
238
|
-
className="navds-tooltip__key"
|
|
239
|
-
>
|
|
228
|
+
<Detail as="kbd" key={key} className="navds-tooltip__key">
|
|
240
229
|
{key}
|
|
241
230
|
</Detail>
|
|
242
231
|
))}
|
|
@@ -267,7 +256,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
|
|
|
267
256
|
</FloatingPortal>
|
|
268
257
|
</>
|
|
269
258
|
);
|
|
270
|
-
}
|
|
259
|
+
},
|
|
271
260
|
);
|
|
272
261
|
|
|
273
262
|
export default Tooltip;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
|
-
import { OverridableComponent } from "../util/
|
|
3
|
+
import { OverridableComponent } from "../util/types";
|
|
4
4
|
import { TypoProps } from "./types";
|
|
5
5
|
import { typoClassNames } from "./util";
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
|
-
import { OverridableComponent } from "../util/
|
|
3
|
+
import { OverridableComponent } from "../util/types";
|
|
4
4
|
import { TypoProps } from "./types";
|
|
5
5
|
import { typoClassNames } from "./util";
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
|
-
import { OverridableComponent } from "../util/
|
|
3
|
+
import { OverridableComponent } from "../util/types";
|
|
4
4
|
import { TypoProps } from "./types";
|
|
5
5
|
import { typoClassNames } from "./util";
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
|
-
import { OverridableComponent } from "../util/
|
|
3
|
+
import { OverridableComponent } from "../util/types";
|
|
4
4
|
import { TypoProps } from "./types";
|
|
5
5
|
import { typoClassNames } from "./util";
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
|
-
import { OverridableComponent } from "../util/
|
|
3
|
+
import { OverridableComponent } from "../util/types";
|
|
4
4
|
import { TypoProps } from "./types";
|
|
5
5
|
import { typoClassNames } from "./util";
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
|
-
import { OverridableComponent } from "../util/
|
|
3
|
+
import { OverridableComponent } from "../util/types";
|
|
4
4
|
|
|
5
5
|
export interface IngressProps
|
|
6
6
|
extends React.HTMLAttributes<HTMLParagraphElement> {
|
package/src/typography/Label.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
|
-
import { OverridableComponent } from "../util/
|
|
3
|
+
import { OverridableComponent } from "../util/types";
|
|
4
4
|
import { TypoProps } from "./types";
|
|
5
5
|
import { typoClassNames } from "./util";
|
|
6
6
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { expect } from "@storybook/jest";
|
|
2
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
-
import { within } from "@storybook/
|
|
2
|
+
import { expect, within } from "@storybook/test";
|
|
4
3
|
import React from "react";
|
|
5
4
|
import { BodyLong } from "..";
|
|
6
5
|
import { VStack } from "../..";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { expect } from "@storybook/jest";
|
|
2
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
-
import { within } from "@storybook/
|
|
2
|
+
import { expect, within } from "@storybook/test";
|
|
4
3
|
import React from "react";
|
|
5
4
|
import { BodyShort } from "..";
|
|
6
5
|
import { VStack } from "../..";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { expect } from "@storybook/jest";
|
|
2
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
-
import { within } from "@storybook/
|
|
2
|
+
import { expect, within } from "@storybook/test";
|
|
4
3
|
import React from "react";
|
|
5
4
|
import { Detail } from "..";
|
|
6
5
|
import { VStack } from "../..";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { expect } from "@storybook/jest";
|
|
2
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
-
import { within } from "@storybook/
|
|
2
|
+
import { expect, within } from "@storybook/test";
|
|
4
3
|
import React from "react";
|
|
5
4
|
import { ErrorMessage } from "..";
|
|
6
5
|
import { VStack } from "../..";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { expect } from "@storybook/jest";
|
|
2
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
-
import { within } from "@storybook/
|
|
2
|
+
import { expect, within } from "@storybook/test";
|
|
4
3
|
import { default as React } from "react";
|
|
5
4
|
import { Heading } from "..";
|
|
6
5
|
import { VStack } from "../..";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { expect } from "@storybook/jest";
|
|
2
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
-
import { within } from "@storybook/
|
|
2
|
+
import { expect, within } from "@storybook/test";
|
|
4
3
|
import React from "react";
|
|
5
4
|
import { Ingress } from "..";
|
|
6
5
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { expect } from "@storybook/jest";
|
|
2
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
-
import { within } from "@storybook/
|
|
2
|
+
import { expect, within } from "@storybook/test";
|
|
4
3
|
import React from "react";
|
|
5
4
|
import { Label } from "..";
|
|
6
5
|
import { VStack } from "../..";
|
package/src/util/Slot.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// https://github.com/radix-ui/primitives/blob/main/packages/react/slot/src/Slot.tsx
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import mergeRefs from "./
|
|
3
|
+
import { mergeRefs } from "./hooks/useMergeRefs";
|
|
4
4
|
|
|
5
5
|
interface SlotProps extends React.HTMLAttributes<HTMLElement> {
|
|
6
6
|
children?: React.ReactNode;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/* https://github.com/mui/material-ui/blob/master/packages/mui-base/src/TextareaAutosize/TextareaAutosize.tsx */
|
|
2
|
-
import React, { forwardRef, useEffect,
|
|
2
|
+
import React, { forwardRef, useEffect, useRef, useState } from "react";
|
|
3
3
|
import ReactDOM from "react-dom";
|
|
4
|
-
import {
|
|
4
|
+
import { useClientLayoutEffect } from "../util/hooks";
|
|
5
|
+
import debounce from "./debounce";
|
|
6
|
+
import { useMergeRefs } from "./hooks/useMergeRefs";
|
|
5
7
|
|
|
6
8
|
type State = {
|
|
7
9
|
outerHeightStyle: number;
|
|
@@ -90,7 +92,9 @@ const TextareaAutosize = forwardRef<HTMLTextAreaElement, TextareaAutosizeProps>(
|
|
|
90
92
|
) => {
|
|
91
93
|
const { current: isControlled } = useRef(value != null);
|
|
92
94
|
const inputRef = useRef<HTMLTextAreaElement>(null);
|
|
93
|
-
|
|
95
|
+
|
|
96
|
+
const handleRef = useMergeRefs(inputRef, ref);
|
|
97
|
+
|
|
94
98
|
const shadowRef = useRef<HTMLTextAreaElement>(null);
|
|
95
99
|
const renders = useRef(0);
|
|
96
100
|
const [state, setState] = useState<State>({ outerHeightStyle: 0 });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { render, screen } from "@testing-library/react";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { useMedia } from "../
|
|
3
|
+
import { useMedia } from "../hooks";
|
|
4
4
|
|
|
5
5
|
function TestComponent({ fallback }: { fallback?: boolean }) {
|
|
6
6
|
const media = useMedia("screen and (min-width: 1024px)", fallback);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* https://github.com/radix-ui/primitives/blob/main/packages/core/primitive/src/primitive.tsx#L1 */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Utility to consistently call original eventhandler, often from props and internal eventhandler
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export function composeEventHandlers<T extends React.SyntheticEvent>(
|
|
8
|
+
originalEventHandler?: (event: T) => void,
|
|
9
|
+
ourEventHandler?: (event: T) => void,
|
|
10
|
+
{ checkForDefaultPrevented = true } = {},
|
|
11
|
+
) {
|
|
12
|
+
return function handleEvent(event: T) {
|
|
13
|
+
originalEventHandler?.(event);
|
|
14
|
+
|
|
15
|
+
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
16
|
+
return ourEventHandler?.(event);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { useCallbackRef } from "./useCallbackRef";
|
|
2
|
+
export { useClientLayoutEffect } from "./useClientLayoutEffect";
|
|
3
|
+
export { useControllableState } from "./useControllableState";
|
|
4
|
+
export { useMergeRefs } from "./useMergeRefs";
|
|
5
|
+
export { useEventListener } from "./useEventListener";
|
|
6
|
+
export { useId } from "./useId";
|
|
7
|
+
export { useMedia } from "./useMedia";
|
|
8
|
+
export { usePrevious } from "./usePrevious";
|