@navikt/ds-react 0.19.18 → 1.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_docs.json +354 -491
- package/cjs/accordion/Accordion.js +2 -2
- package/cjs/accordion/AccordionContent.js +2 -2
- package/cjs/accordion/AccordionHeader.js +6 -5
- package/cjs/accordion/AccordionItem.js +2 -2
- package/cjs/alert/Alert.js +2 -2
- package/cjs/button/Button.js +3 -4
- package/cjs/{speech-bubble → chat}/Bubble.js +7 -4
- package/cjs/{speech-bubble/SpeechBubble.js → chat/Chat.js} +11 -10
- package/cjs/{menu → chat}/index.js +3 -3
- package/cjs/chat/package.json +6 -0
- package/cjs/form/ConfirmationPanel.js +2 -2
- package/cjs/form/Fieldset/Fieldset.js +6 -6
- package/cjs/form/Select.js +6 -6
- package/cjs/form/Switch.js +4 -4
- package/cjs/form/TextField.js +6 -6
- package/cjs/form/Textarea.js +14 -14
- package/cjs/form/checkbox/Checkbox.js +3 -3
- package/cjs/form/checkbox/CheckboxGroup.js +2 -2
- package/cjs/form/error-summary/ErrorSummary.js +3 -3
- package/cjs/form/error-summary/ErrorSummaryItem.js +2 -2
- package/cjs/form/radio/Radio.js +2 -2
- package/cjs/form/radio/RadioGroup.js +2 -2
- package/cjs/form/search/Search.js +6 -7
- package/cjs/form/search/SearchButton.js +2 -2
- package/cjs/form/useFormField.js +2 -2
- package/cjs/grid/Cell.js +2 -2
- package/cjs/grid/ContentContainer.js +2 -2
- package/cjs/grid/Grid.js +2 -2
- package/cjs/guide-panel/Guide.js +3 -3
- package/cjs/guide-panel/GuidePanel.js +2 -2
- package/cjs/help-text/HelpText.js +5 -5
- package/cjs/index.js +1 -6
- package/cjs/link/Link.js +2 -2
- package/cjs/link-panel/LinkPanel.js +2 -2
- package/cjs/link-panel/LinkPanelDescription.js +2 -2
- package/cjs/link-panel/LinkPanelTitle.js +2 -2
- package/cjs/loader/Loader.js +2 -2
- package/cjs/modal/Modal.js +4 -5
- package/cjs/modal/ModalContent.js +2 -2
- package/cjs/pagination/Pagination.js +18 -23
- package/cjs/{menu/MenuItem.js → pagination/PaginationItem.js} +5 -4
- package/cjs/panel/Panel.js +2 -2
- package/cjs/popover/Popover.js +55 -45
- package/cjs/popover/PopoverContent.js +2 -2
- package/cjs/read-more/ReadMore.js +2 -2
- package/cjs/stepper/Step.js +2 -2
- package/cjs/stepper/Stepper.js +3 -3
- package/cjs/table/Body.js +2 -2
- package/cjs/table/DataCell.js +2 -2
- package/cjs/table/ExpandableRow.js +4 -4
- package/cjs/table/Header.js +2 -2
- package/cjs/table/HeaderCell.js +2 -2
- package/cjs/table/Row.js +2 -2
- package/cjs/table/Table.js +2 -2
- package/cjs/tabs/Tab.js +3 -3
- package/cjs/tabs/TabList.js +8 -7
- package/cjs/tabs/TabPanel.js +2 -2
- package/cjs/tabs/Tabs.js +5 -3
- package/cjs/tag/Tag.js +2 -2
- package/cjs/toggle-group/ToggleGroup.js +5 -5
- package/cjs/toggle-group/ToggleItem.js +2 -2
- package/cjs/tooltip/Tooltip.js +45 -92
- package/cjs/typography/BodyLong.js +2 -2
- package/cjs/typography/BodyShort.js +2 -2
- package/cjs/typography/Detail.js +2 -2
- package/cjs/typography/ErrorMessage.js +2 -2
- package/cjs/typography/Heading.js +2 -2
- package/cjs/typography/Ingress.js +2 -2
- package/cjs/typography/Label.js +2 -2
- package/cjs/util/TextareaAutoSize.js +174 -0
- package/cjs/util/debounce.js +18 -0
- package/cjs/util/index.js +14 -1
- package/cjs/util/mergeRefs.js +16 -0
- package/cjs/util/useId.js +60 -17
- package/esm/accordion/Accordion.js +1 -1
- package/esm/accordion/Accordion.js.map +1 -1
- package/esm/accordion/AccordionContent.js +1 -1
- package/esm/accordion/AccordionContent.js.map +1 -1
- package/esm/accordion/AccordionHeader.js +3 -2
- package/esm/accordion/AccordionHeader.js.map +1 -1
- package/esm/accordion/AccordionItem.js +1 -1
- package/esm/accordion/AccordionItem.js.map +1 -1
- package/esm/alert/Alert.d.ts +1 -1
- package/esm/alert/Alert.js +1 -1
- package/esm/alert/Alert.js.map +1 -1
- package/esm/button/Button.js +4 -5
- package/esm/button/Button.js.map +1 -1
- package/esm/{speech-bubble → chat}/Bubble.d.ts +7 -3
- package/esm/{speech-bubble → chat}/Bubble.js +7 -4
- package/esm/chat/Bubble.js.map +1 -0
- package/esm/chat/Chat.d.ts +38 -0
- package/esm/chat/Chat.js +28 -0
- package/esm/chat/Chat.js.map +1 -0
- package/esm/chat/index.d.ts +1 -0
- package/esm/chat/index.js +2 -0
- package/esm/chat/index.js.map +1 -0
- package/esm/form/ConfirmationPanel.js +1 -1
- package/esm/form/ConfirmationPanel.js.map +1 -1
- package/esm/form/Fieldset/Fieldset.js +1 -1
- package/esm/form/Fieldset/Fieldset.js.map +1 -1
- package/esm/form/Select.js +1 -1
- package/esm/form/Select.js.map +1 -1
- package/esm/form/Switch.js +1 -1
- package/esm/form/Switch.js.map +1 -1
- package/esm/form/TextField.js +1 -1
- package/esm/form/TextField.js.map +1 -1
- package/esm/form/Textarea.js +6 -6
- package/esm/form/Textarea.js.map +1 -1
- package/esm/form/checkbox/Checkbox.js +1 -1
- package/esm/form/checkbox/Checkbox.js.map +1 -1
- package/esm/form/checkbox/CheckboxGroup.js +1 -1
- package/esm/form/checkbox/CheckboxGroup.js.map +1 -1
- package/esm/form/error-summary/ErrorSummary.js +3 -3
- package/esm/form/error-summary/ErrorSummary.js.map +1 -1
- package/esm/form/error-summary/ErrorSummaryItem.js +1 -1
- package/esm/form/error-summary/ErrorSummaryItem.js.map +1 -1
- package/esm/form/radio/Radio.js +1 -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 -5
- package/esm/form/search/Search.js.map +1 -1
- package/esm/form/search/SearchButton.js +1 -1
- 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/grid/Cell.js +1 -1
- package/esm/grid/Cell.js.map +1 -1
- package/esm/grid/ContentContainer.js +1 -1
- package/esm/grid/ContentContainer.js.map +1 -1
- package/esm/grid/Grid.js +1 -1
- package/esm/grid/Grid.js.map +1 -1
- package/esm/guide-panel/Guide.js +1 -1
- package/esm/guide-panel/Guide.js.map +1 -1
- package/esm/guide-panel/GuidePanel.js +1 -1
- package/esm/guide-panel/GuidePanel.js.map +1 -1
- package/esm/help-text/HelpText.d.ts +1 -2
- package/esm/help-text/HelpText.js +7 -7
- package/esm/help-text/HelpText.js.map +1 -1
- package/esm/index.d.ts +1 -5
- package/esm/index.js +1 -6
- package/esm/index.js.map +1 -1
- package/esm/link/Link.js +1 -1
- package/esm/link/Link.js.map +1 -1
- package/esm/link-panel/LinkPanel.js +1 -1
- package/esm/link-panel/LinkPanel.js.map +1 -1
- package/esm/link-panel/LinkPanelDescription.js +1 -1
- package/esm/link-panel/LinkPanelDescription.js.map +1 -1
- package/esm/link-panel/LinkPanelTitle.js +1 -1
- package/esm/link-panel/LinkPanelTitle.js.map +1 -1
- package/esm/loader/Loader.js +1 -1
- package/esm/loader/Loader.js.map +1 -1
- package/esm/modal/Modal.js +4 -5
- package/esm/modal/Modal.js.map +1 -1
- package/esm/modal/ModalContent.js +1 -1
- package/esm/modal/ModalContent.js.map +1 -1
- package/esm/pagination/Pagination.d.ts +12 -3
- package/esm/pagination/Pagination.js +17 -22
- package/esm/pagination/Pagination.js.map +1 -1
- package/esm/pagination/PaginationItem.d.ts +22 -0
- package/esm/{menu/MenuItem.js → pagination/PaginationItem.js} +6 -5
- package/esm/pagination/PaginationItem.js.map +1 -0
- package/esm/pagination/index.d.ts +1 -2
- package/esm/pagination/index.js.map +1 -1
- package/esm/panel/Panel.js +1 -1
- package/esm/panel/Panel.js.map +1 -1
- package/esm/popover/Popover.d.ts +2 -3
- package/esm/popover/Popover.js +56 -46
- package/esm/popover/Popover.js.map +1 -1
- package/esm/popover/PopoverContent.js +1 -1
- package/esm/popover/PopoverContent.js.map +1 -1
- package/esm/read-more/ReadMore.js +1 -1
- package/esm/read-more/ReadMore.js.map +1 -1
- package/esm/stepper/Step.js +1 -1
- package/esm/stepper/Step.js.map +1 -1
- package/esm/stepper/Stepper.js +1 -1
- package/esm/stepper/Stepper.js.map +1 -1
- package/esm/table/Body.js +1 -1
- package/esm/table/Body.js.map +1 -1
- package/esm/table/DataCell.js +1 -1
- package/esm/table/DataCell.js.map +1 -1
- package/esm/table/ExpandableRow.js +2 -2
- package/esm/table/ExpandableRow.js.map +1 -1
- package/esm/table/Header.js +1 -1
- package/esm/table/Header.js.map +1 -1
- package/esm/table/HeaderCell.js +1 -1
- package/esm/table/HeaderCell.js.map +1 -1
- package/esm/table/Row.js +1 -1
- package/esm/table/Row.js.map +1 -1
- package/esm/table/Table.js +1 -1
- package/esm/table/Table.js.map +1 -1
- package/esm/tabs/Tab.d.ts +0 -5
- package/esm/tabs/Tab.js +4 -4
- package/esm/tabs/Tab.js.map +1 -1
- package/esm/tabs/TabList.d.ts +0 -4
- package/esm/tabs/TabList.js +7 -6
- package/esm/tabs/TabList.js.map +1 -1
- package/esm/tabs/TabPanel.js +1 -1
- package/esm/tabs/TabPanel.js.map +1 -1
- package/esm/tabs/Tabs.d.ts +12 -0
- package/esm/tabs/Tabs.js +4 -2
- package/esm/tabs/Tabs.js.map +1 -1
- package/esm/tag/Tag.js +1 -1
- package/esm/tag/Tag.js.map +1 -1
- package/esm/toggle-group/ToggleGroup.js +3 -3
- package/esm/toggle-group/ToggleGroup.js.map +1 -1
- package/esm/toggle-group/ToggleItem.js +1 -1
- package/esm/toggle-group/ToggleItem.js.map +1 -1
- package/esm/tooltip/Tooltip.js +44 -91
- package/esm/tooltip/Tooltip.js.map +1 -1
- package/esm/typography/BodyLong.js +1 -1
- package/esm/typography/BodyLong.js.map +1 -1
- package/esm/typography/BodyShort.js +1 -1
- package/esm/typography/BodyShort.js.map +1 -1
- package/esm/typography/Detail.js +1 -1
- package/esm/typography/Detail.js.map +1 -1
- package/esm/typography/ErrorMessage.js +1 -1
- package/esm/typography/ErrorMessage.js.map +1 -1
- package/esm/typography/Heading.js +1 -1
- package/esm/typography/Heading.js.map +1 -1
- package/esm/typography/Ingress.js +1 -1
- package/esm/typography/Ingress.js.map +1 -1
- package/esm/typography/Label.js +1 -1
- package/esm/typography/Label.js.map +1 -1
- package/esm/util/TextareaAutoSize.d.ts +14 -0
- package/esm/util/TextareaAutoSize.js +150 -0
- package/esm/util/TextareaAutoSize.js.map +1 -0
- package/esm/util/debounce.d.ts +4 -0
- package/esm/util/debounce.js +16 -0
- package/esm/util/debounce.js.map +1 -0
- package/esm/util/index.d.ts +4 -0
- package/esm/util/index.js +9 -1
- package/esm/util/index.js.map +1 -1
- package/esm/util/mergeRefs.d.ts +2 -0
- package/esm/util/mergeRefs.js +14 -0
- package/esm/util/mergeRefs.js.map +1 -0
- package/esm/util/useId.d.ts +7 -3
- package/esm/util/useId.js +36 -16
- package/esm/util/useId.js.map +1 -1
- package/package.json +13 -14
- package/src/accordion/Accordion.tsx +1 -1
- package/src/accordion/AccordionContent.tsx +1 -1
- package/src/accordion/AccordionHeader.tsx +2 -2
- package/src/accordion/AccordionItem.tsx +1 -1
- package/src/alert/Alert.tsx +2 -2
- package/src/alert/alert.stories.tsx +7 -0
- package/src/button/Button.tsx +5 -5
- package/src/chat/Bubble.tsx +52 -0
- package/src/chat/Chat.tsx +96 -0
- package/src/chat/chat.stories.tsx +202 -0
- package/src/chat/index.ts +1 -0
- package/src/form/ConfirmationPanel.tsx +1 -1
- package/src/form/Fieldset/Fieldset.tsx +1 -1
- package/src/form/Select.tsx +1 -1
- package/src/form/Switch.tsx +1 -1
- package/src/form/TextField.tsx +1 -1
- package/src/form/Textarea.tsx +6 -6
- package/src/form/checkbox/Checkbox.test.tsx +20 -17
- package/src/form/checkbox/Checkbox.tsx +1 -1
- package/src/form/checkbox/CheckboxGroup.tsx +1 -1
- package/src/form/error-summary/ErrorSummary.tsx +3 -3
- package/src/form/error-summary/ErrorSummaryItem.tsx +1 -1
- package/src/form/radio/Radio.tsx +1 -1
- package/src/form/radio/RadioGroup.tsx +1 -1
- package/src/form/search/Search.tsx +11 -4
- package/src/form/search/SearchButton.tsx +1 -1
- package/src/form/useFormField.ts +1 -1
- package/src/grid/Cell.tsx +1 -1
- package/src/grid/ContentContainer.tsx +1 -1
- package/src/grid/Grid.tsx +1 -1
- package/src/grid/grid.stories.tsx +68 -0
- package/src/guide-panel/Guide.tsx +1 -1
- package/src/guide-panel/GuidePanel.tsx +1 -1
- package/src/help-text/HelpText.tsx +22 -8
- package/src/help-text/help-text.stories.tsx +12 -16
- package/src/index.ts +1 -7
- package/src/link/Link.tsx +1 -1
- package/src/link-panel/LinkPanel.tsx +1 -1
- package/src/link-panel/LinkPanelDescription.tsx +1 -1
- package/src/link-panel/LinkPanelTitle.tsx +1 -1
- package/src/loader/Loader.tsx +1 -1
- package/src/modal/Modal.tsx +4 -5
- package/src/modal/ModalContent.tsx +1 -1
- package/src/pagination/Pagination.tsx +84 -78
- package/src/pagination/PaginationItem.tsx +57 -0
- package/src/pagination/index.ts +1 -2
- package/src/pagination/pagination.stories.tsx +90 -16
- package/src/panel/Panel.tsx +1 -1
- package/src/popover/Popover.test.tsx +143 -0
- package/src/popover/Popover.tsx +107 -73
- package/src/popover/PopoverContent.tsx +1 -1
- package/src/popover/popover.stories.tsx +22 -27
- package/src/read-more/ReadMore.tsx +1 -1
- package/src/stepper/Step.tsx +1 -1
- package/src/stepper/Stepper.tsx +1 -1
- package/src/table/Body.tsx +1 -1
- package/src/table/DataCell.tsx +1 -1
- package/src/table/ExpandableRow.tsx +2 -2
- package/src/table/Header.tsx +1 -1
- package/src/table/HeaderCell.tsx +1 -1
- package/src/table/Row.tsx +1 -1
- package/src/table/Table.tsx +1 -1
- package/src/tabs/Tab.tsx +5 -10
- package/src/tabs/TabList.tsx +14 -9
- package/src/tabs/TabPanel.tsx +1 -1
- package/src/tabs/Tabs.stories.tsx +94 -117
- package/src/tabs/Tabs.tsx +17 -1
- package/src/tag/Tag.tsx +1 -1
- package/src/toggle-group/ToggleGroup.tsx +3 -3
- package/src/toggle-group/ToggleItem.tsx +1 -1
- package/src/tooltip/Tooltip.test.tsx +167 -0
- package/src/tooltip/Tooltip.tsx +106 -173
- package/src/tooltip/tooltip.stories.tsx +15 -1
- 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/util/TextareaAutoSize.tsx +224 -0
- package/src/util/debounce.ts +17 -0
- package/src/util/index.ts +14 -2
- package/src/util/mergeRefs.tsx +14 -0
- package/src/util/useId.ts +37 -20
- package/cjs/card/MicroCard.js +0 -47
- package/cjs/card/index.js +0 -8
- package/cjs/card/package.json +0 -6
- package/cjs/menu/Menu.js +0 -53
- package/cjs/menu/MenuCollapse.js +0 -65
- package/cjs/menu/MenuItems.js +0 -23
- package/cjs/menu/package.json +0 -6
- package/cjs/page-header/PageHeader.js +0 -51
- package/cjs/page-header/index.js +0 -8
- package/cjs/page-header/package.json +0 -6
- package/cjs/speech-bubble/index.js +0 -8
- package/cjs/speech-bubble/package.json +0 -6
- package/cjs/step-indicator/Step.js +0 -67
- package/cjs/step-indicator/StepIndicator.js +0 -80
- package/cjs/step-indicator/index.js +0 -8
- package/cjs/step-indicator/package.json +0 -6
- package/esm/card/MicroCard.d.ts +0 -10
- package/esm/card/MicroCard.js +0 -19
- package/esm/card/MicroCard.js.map +0 -1
- package/esm/card/index.d.ts +0 -2
- package/esm/card/index.js +0 -2
- package/esm/card/index.js.map +0 -1
- package/esm/menu/Menu.d.ts +0 -12
- package/esm/menu/Menu.js +0 -25
- package/esm/menu/Menu.js.map +0 -1
- package/esm/menu/MenuCollapse.d.ts +0 -12
- package/esm/menu/MenuCollapse.js +0 -37
- package/esm/menu/MenuCollapse.js.map +0 -1
- package/esm/menu/MenuItem.d.ts +0 -13
- package/esm/menu/MenuItem.js.map +0 -1
- package/esm/menu/MenuItems.d.ts +0 -6
- package/esm/menu/MenuItems.js +0 -19
- package/esm/menu/MenuItems.js.map +0 -1
- package/esm/menu/index.d.ts +0 -3
- package/esm/menu/index.js +0 -2
- package/esm/menu/index.js.map +0 -1
- package/esm/page-header/PageHeader.d.ts +0 -27
- package/esm/page-header/PageHeader.js +0 -24
- package/esm/page-header/PageHeader.js.map +0 -1
- package/esm/page-header/index.d.ts +0 -2
- package/esm/page-header/index.js +0 -2
- package/esm/page-header/index.js.map +0 -1
- package/esm/speech-bubble/Bubble.js.map +0 -1
- package/esm/speech-bubble/SpeechBubble.d.ts +0 -34
- package/esm/speech-bubble/SpeechBubble.js +0 -27
- package/esm/speech-bubble/SpeechBubble.js.map +0 -1
- package/esm/speech-bubble/index.d.ts +0 -1
- package/esm/speech-bubble/index.js +0 -2
- package/esm/speech-bubble/index.js.map +0 -1
- package/esm/step-indicator/Step.d.ts +0 -23
- package/esm/step-indicator/Step.js +0 -39
- package/esm/step-indicator/Step.js.map +0 -1
- package/esm/step-indicator/StepIndicator.d.ts +0 -41
- package/esm/step-indicator/StepIndicator.js +0 -52
- package/esm/step-indicator/StepIndicator.js.map +0 -1
- package/esm/step-indicator/index.d.ts +0 -1
- package/esm/step-indicator/index.js +0 -2
- package/esm/step-indicator/index.js.map +0 -1
- package/src/card/MicroCard.tsx +0 -32
- package/src/card/index.ts +0 -2
- package/src/card/stories/card.stories.mdx +0 -26
- package/src/card/stories/card.stories.tsx +0 -16
- package/src/grid/stories/grid.stories.mdx +0 -79
- package/src/grid/stories/grid.stories.tsx +0 -51
- package/src/grid/stories/styles.css +0 -21
- package/src/menu/Menu.tsx +0 -36
- package/src/menu/MenuCollapse.tsx +0 -80
- package/src/menu/MenuItem.tsx +0 -39
- package/src/menu/MenuItems.tsx +0 -21
- package/src/menu/index.ts +0 -3
- package/src/menu/stories/menu.stories.mdx +0 -93
- package/src/menu/stories/menu.stories.tsx +0 -139
- package/src/page-header/PageHeader.tsx +0 -72
- package/src/page-header/index.ts +0 -2
- package/src/page-header/stories/header.stories.mdx +0 -81
- package/src/page-header/stories/header.stories.tsx +0 -61
- package/src/page-header/stories/pictogram.tsx +0 -14
- package/src/speech-bubble/Bubble.tsx +0 -48
- package/src/speech-bubble/SpeechBubble.tsx +0 -93
- package/src/speech-bubble/index.ts +0 -1
- package/src/speech-bubble/stories/illustration.tsx +0 -66
- package/src/speech-bubble/stories/speechbubble.stories.mdx +0 -184
- package/src/speech-bubble/stories/speechbubble.stories.tsx +0 -104
- package/src/step-indicator/Step.tsx +0 -81
- package/src/step-indicator/StepIndicator.tsx +0 -148
- package/src/step-indicator/index.ts +0 -1
- package/src/step-indicator/stories/Example.tsx +0 -23
- package/src/step-indicator/stories/step-indicator.stories.mdx +0 -122
- package/src/step-indicator/stories/step-indicator.stories.tsx +0 -104
package/cjs/typography/Label.js
CHANGED
|
@@ -39,10 +39,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
40
|
exports.Label = void 0;
|
|
41
41
|
const react_1 = __importStar(require("react"));
|
|
42
|
-
const
|
|
42
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
43
43
|
exports.Label = (0, react_1.forwardRef)((_a, ref) => {
|
|
44
44
|
var { className, size = "medium", spacing, as: Component = "p" } = _a, rest = __rest(_a, ["className", "size", "spacing", "as"]);
|
|
45
|
-
return (react_1.default.createElement(Component, Object.assign({}, rest, { ref: ref, className: (0,
|
|
45
|
+
return (react_1.default.createElement(Component, Object.assign({}, rest, { ref: ref, className: (0, clsx_1.default)(className, "navds-label", {
|
|
46
46
|
"navds-label--small": size === "small",
|
|
47
47
|
"navds-typo--spacing": !!spacing,
|
|
48
48
|
}) })));
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
+
var t = {};
|
|
27
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
+
t[p] = s[p];
|
|
29
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
+
t[p[i]] = s[p[i]];
|
|
33
|
+
}
|
|
34
|
+
return t;
|
|
35
|
+
};
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
/* https://github.com/mui/material-ui/blob/master/packages/mui-base/src/TextareaAutosize/TextareaAutosize.js */
|
|
38
|
+
const react_1 = __importStar(require("react"));
|
|
39
|
+
const __1 = require("..");
|
|
40
|
+
/**
|
|
41
|
+
* https://github.com/mui/material-ui/blob/master/packages/mui-utils/src/ownerDocument.ts
|
|
42
|
+
* https://github.com/mui/material-ui/blob/master/packages/mui-utils/src/ownerWindow.ts
|
|
43
|
+
*/
|
|
44
|
+
const ownerWindow = (node) => {
|
|
45
|
+
const doc = (node && node.ownerDocument) || document;
|
|
46
|
+
return doc.defaultView || window;
|
|
47
|
+
};
|
|
48
|
+
function getStyleValue(computedStyle, property) {
|
|
49
|
+
return parseInt(computedStyle[property], 10) || 0;
|
|
50
|
+
}
|
|
51
|
+
const TextareaAutosize = (0, react_1.forwardRef)((_a, ref) => {
|
|
52
|
+
var { className, onChange, maxRows, minRows = 1, style, value } = _a, other = __rest(_a, ["className", "onChange", "maxRows", "minRows", "style", "value"]);
|
|
53
|
+
const { current: isControlled } = (0, react_1.useRef)(value != null);
|
|
54
|
+
const inputRef = (0, react_1.useRef)(null);
|
|
55
|
+
const handleRef = (0, react_1.useMemo)(() => (0, __1.mergeRefs)([inputRef, ref]), [ref]);
|
|
56
|
+
const shadowRef = (0, react_1.useRef)(null);
|
|
57
|
+
const renders = (0, react_1.useRef)(0);
|
|
58
|
+
const [state, setState] = (0, react_1.useState)({});
|
|
59
|
+
const syncHeight = (0, react_1.useCallback)(() => {
|
|
60
|
+
if (!inputRef.current || !shadowRef.current)
|
|
61
|
+
return;
|
|
62
|
+
const input = inputRef.current;
|
|
63
|
+
const containerWindow = ownerWindow(input);
|
|
64
|
+
const computedStyle = containerWindow.getComputedStyle(input);
|
|
65
|
+
// If input's width is shrunk and it's not visible, don't sync height.
|
|
66
|
+
if (computedStyle.width === "0px") {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const inputShallow = shadowRef.current;
|
|
70
|
+
inputShallow.style.width = computedStyle.width;
|
|
71
|
+
inputShallow.value = input.value || (other === null || other === void 0 ? void 0 : other.placeholder) || "x";
|
|
72
|
+
if (inputShallow.value.slice(-1) === "\n") {
|
|
73
|
+
// Certain fonts which overflow the line height will cause the textarea
|
|
74
|
+
// to report a different scrollHeight depending on whether the last line
|
|
75
|
+
// is empty. Make it non-empty to avoid this issue.
|
|
76
|
+
inputShallow.value += " ";
|
|
77
|
+
}
|
|
78
|
+
const boxSizing = computedStyle["box-sizing"];
|
|
79
|
+
const padding = getStyleValue(computedStyle, "padding-bottom") +
|
|
80
|
+
getStyleValue(computedStyle, "padding-top");
|
|
81
|
+
const border = getStyleValue(computedStyle, "border-bottom-width") +
|
|
82
|
+
getStyleValue(computedStyle, "border-top-width");
|
|
83
|
+
// The height of the inner content
|
|
84
|
+
const innerHeight = inputShallow.scrollHeight - padding;
|
|
85
|
+
// Measure height of a textarea with a single row
|
|
86
|
+
inputShallow.value = "x";
|
|
87
|
+
const singleRowHeight = inputShallow.scrollHeight - padding;
|
|
88
|
+
// The height of the outer content
|
|
89
|
+
let outerHeight = innerHeight;
|
|
90
|
+
if (minRows) {
|
|
91
|
+
outerHeight = Math.max(Number(minRows) * singleRowHeight, outerHeight);
|
|
92
|
+
}
|
|
93
|
+
if (maxRows) {
|
|
94
|
+
outerHeight = Math.min(Number(maxRows) * singleRowHeight, outerHeight);
|
|
95
|
+
}
|
|
96
|
+
outerHeight = Math.max(outerHeight, singleRowHeight);
|
|
97
|
+
// Take the box sizing into account for applying this value as a style.
|
|
98
|
+
const outerHeightStyle = outerHeight + (boxSizing === "border-box" ? padding + border : 0);
|
|
99
|
+
const overflow = Math.abs(outerHeight - innerHeight) <= 1;
|
|
100
|
+
setState((prevState) => {
|
|
101
|
+
// Need a large enough difference to update the height.
|
|
102
|
+
// This prevents infinite rendering loop.
|
|
103
|
+
if (renders.current < 20 &&
|
|
104
|
+
((outerHeightStyle > 0 &&
|
|
105
|
+
Math.abs((prevState.outerHeightStyle || 0) - outerHeightStyle) >
|
|
106
|
+
1) ||
|
|
107
|
+
prevState.overflow !== overflow)) {
|
|
108
|
+
renders.current += 1;
|
|
109
|
+
return {
|
|
110
|
+
overflow,
|
|
111
|
+
outerHeightStyle,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
if (process.env.NODE_ENV !== "production") {
|
|
115
|
+
if (renders.current === 20) {
|
|
116
|
+
console.error([
|
|
117
|
+
"MUI: Too many re-renders. The layout is unstable.",
|
|
118
|
+
"TextareaAutosize limits the number of renders to prevent an infinite loop.",
|
|
119
|
+
].join("\n"));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return prevState;
|
|
123
|
+
});
|
|
124
|
+
}, [maxRows, minRows, other === null || other === void 0 ? void 0 : other.placeholder]);
|
|
125
|
+
(0, react_1.useEffect)(() => {
|
|
126
|
+
const handleResize = (0, __1.debounce)(() => {
|
|
127
|
+
renders.current = 0;
|
|
128
|
+
syncHeight();
|
|
129
|
+
});
|
|
130
|
+
const containerWindow = ownerWindow(inputRef.current);
|
|
131
|
+
containerWindow.addEventListener("resize", handleResize);
|
|
132
|
+
let resizeObserver;
|
|
133
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
134
|
+
resizeObserver = new ResizeObserver(handleResize);
|
|
135
|
+
resizeObserver.observe(inputRef.current);
|
|
136
|
+
}
|
|
137
|
+
return () => {
|
|
138
|
+
handleResize.clear();
|
|
139
|
+
containerWindow.removeEventListener("resize", handleResize);
|
|
140
|
+
if (resizeObserver) {
|
|
141
|
+
resizeObserver.disconnect();
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
}, [syncHeight]);
|
|
145
|
+
(0, __1.useClientLayoutEffect)(() => {
|
|
146
|
+
syncHeight();
|
|
147
|
+
});
|
|
148
|
+
(0, react_1.useEffect)(() => {
|
|
149
|
+
renders.current = 0;
|
|
150
|
+
}, [value]);
|
|
151
|
+
const handleChange = (event) => {
|
|
152
|
+
renders.current = 0;
|
|
153
|
+
if (!isControlled) {
|
|
154
|
+
syncHeight();
|
|
155
|
+
}
|
|
156
|
+
if (onChange) {
|
|
157
|
+
onChange(event);
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
161
|
+
react_1.default.createElement("textarea", Object.assign({ value: value, onChange: handleChange, ref: handleRef,
|
|
162
|
+
// Apply the rows prop to get a "correct" first SSR paint
|
|
163
|
+
rows: minRows, style: Object.assign(Object.assign({ height: state.outerHeightStyle }, (state.overflow ? { overflow: "hidden" } : {})), style) }, other, { className: className })),
|
|
164
|
+
react_1.default.createElement("textarea", { "aria-hidden": true, className: className, readOnly: true, ref: shadowRef, tabIndex: -1, style: Object.assign({
|
|
165
|
+
// Visibility needed to hide the extra text area on iPads
|
|
166
|
+
visibility: "hidden",
|
|
167
|
+
// Remove from the content flow
|
|
168
|
+
position: "absolute",
|
|
169
|
+
// Ignore the scrollbar width
|
|
170
|
+
overflow: "hidden", height: 0, top: 0, left: 0,
|
|
171
|
+
// Create a new layer, increase the isolation of the computed values
|
|
172
|
+
transform: "translateZ(0)" }, style) })));
|
|
173
|
+
});
|
|
174
|
+
exports.default = TextareaAutosize;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// https://github.com/mui/material-ui/blob/master/packages/mui-utils/src/debounce.js
|
|
4
|
+
function debounce(func, wait = 166) {
|
|
5
|
+
let timeout;
|
|
6
|
+
function debounced(...args) {
|
|
7
|
+
const later = () => {
|
|
8
|
+
func.apply(this, args);
|
|
9
|
+
};
|
|
10
|
+
clearTimeout(timeout);
|
|
11
|
+
timeout = setTimeout(later, wait);
|
|
12
|
+
}
|
|
13
|
+
debounced.clear = () => {
|
|
14
|
+
clearTimeout(timeout);
|
|
15
|
+
};
|
|
16
|
+
return debounced;
|
|
17
|
+
}
|
|
18
|
+
exports.default = debounce;
|
package/cjs/util/index.js
CHANGED
|
@@ -13,11 +13,24 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
16
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.composeEventHandlers = exports.useEventListener = exports.omit = void 0;
|
|
20
|
+
exports.composeEventHandlers = exports.useEventListener = exports.omit = exports.useClientLayoutEffect = exports.debounce = exports.mergeRefs = void 0;
|
|
18
21
|
const react_1 = require("react");
|
|
19
22
|
__exportStar(require("./OverridableComponent"), exports);
|
|
20
23
|
__exportStar(require("./useId"), exports);
|
|
24
|
+
var mergeRefs_1 = require("./mergeRefs");
|
|
25
|
+
Object.defineProperty(exports, "mergeRefs", { enumerable: true, get: function () { return __importDefault(mergeRefs_1).default; } });
|
|
26
|
+
var debounce_1 = require("./debounce");
|
|
27
|
+
Object.defineProperty(exports, "debounce", { enumerable: true, get: function () { return __importDefault(debounce_1).default; } });
|
|
28
|
+
const canUseDOM = () => {
|
|
29
|
+
return (typeof window !== "undefined" &&
|
|
30
|
+
typeof window.document !== "undefined" &&
|
|
31
|
+
typeof window.document.createElement !== "undefined");
|
|
32
|
+
};
|
|
33
|
+
exports.useClientLayoutEffect = canUseDOM() ? react_1.useLayoutEffect : () => { };
|
|
21
34
|
const omit = (obj, props) => Object.entries(obj)
|
|
22
35
|
.filter(([key]) => !props.includes(key))
|
|
23
36
|
.reduce((obj, [key, value]) => (Object.assign(Object.assign({}, obj), { [key]: value })), {});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// https://github.com/gregberge/react-merge-refs
|
|
4
|
+
function mergeRefs(refs) {
|
|
5
|
+
return (value) => {
|
|
6
|
+
refs.forEach((ref) => {
|
|
7
|
+
if (typeof ref === "function") {
|
|
8
|
+
ref(value);
|
|
9
|
+
}
|
|
10
|
+
else if (ref !== null && ref !== undefined) {
|
|
11
|
+
ref.current = value;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
exports.default = mergeRefs;
|
package/cjs/util/useId.js
CHANGED
|
@@ -1,20 +1,63 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
19
24
|
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.useId = void 0;
|
|
27
|
+
//https://github.com/mui/material-ui/blob/master/packages/mui-utils/src/useId.ts
|
|
28
|
+
const react_1 = __importStar(require("react"));
|
|
29
|
+
let globalId = 0;
|
|
30
|
+
function useGlobalId(idOverride) {
|
|
31
|
+
const [defaultId, setDefaultId] = (0, react_1.useState)(idOverride);
|
|
32
|
+
const id = idOverride || defaultId;
|
|
33
|
+
(0, react_1.useEffect)(() => {
|
|
34
|
+
if (defaultId == null) {
|
|
35
|
+
// Fallback to this default id when possible.
|
|
36
|
+
// Use the incrementing value for client-side rendering only.
|
|
37
|
+
// We can't use it server-side.
|
|
38
|
+
// If you want to use random values please consider the Birthday Problem: https://en.wikipedia.org/wiki/Birthday_problem
|
|
39
|
+
globalId += 1;
|
|
40
|
+
setDefaultId(`navds-id-${globalId}`);
|
|
41
|
+
}
|
|
42
|
+
}, [defaultId]);
|
|
43
|
+
return id;
|
|
44
|
+
}
|
|
45
|
+
// eslint-disable-next-line no-useless-concat -- Workaround for https://github.com/webpack/webpack/issues/14814
|
|
46
|
+
const maybeReactUseId = react_1.default[
|
|
47
|
+
// eslint-disable-next-line no-useless-concat
|
|
48
|
+
"useId" + ""];
|
|
49
|
+
/**
|
|
50
|
+
*
|
|
51
|
+
* @example <div id={useId()} />
|
|
52
|
+
* @param idOverride
|
|
53
|
+
* @returns {string}
|
|
54
|
+
*/
|
|
55
|
+
function useId(idOverride) {
|
|
56
|
+
if (maybeReactUseId !== undefined) {
|
|
57
|
+
const reactId = maybeReactUseId();
|
|
58
|
+
return idOverride !== null && idOverride !== void 0 ? idOverride : reactId;
|
|
59
|
+
}
|
|
60
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- `useId` is invariant at runtime.
|
|
61
|
+
return useGlobalId(idOverride);
|
|
62
|
+
}
|
|
20
63
|
exports.useId = useId;
|
|
@@ -9,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import cl from "
|
|
12
|
+
import cl from "clsx";
|
|
13
13
|
import React, { forwardRef } from "react";
|
|
14
14
|
import AccordionItem from "./AccordionItem";
|
|
15
15
|
import AccordionContent from "./AccordionContent";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.js","sourceRoot":"","sources":["../../src/accordion/Accordion.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Accordion.js","sourceRoot":"","sources":["../../src/accordion/Accordion.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,aAAoC,MAAM,iBAAiB,CAAC;AACnE,OAAO,gBAA0C,MAAM,oBAAoB,CAAC;AAC5E,OAAO,eAAwC,MAAM,mBAAmB,CAAC;AAkBzE,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CACjC,CAAC,EAAsB,EAAE,GAAG,EAAE,EAAE;QAA/B,EAAE,SAAS,OAAW,EAAN,IAAI,cAApB,aAAsB,CAAF;IAAY,OAAA,CAC/B,6CAAS,IAAI,IAAE,SAAS,EAAE,EAAE,CAAC,iBAAiB,EAAE,SAAS,CAAC,EAAE,GAAG,EAAE,GAAG,IAAI,CACzE,CAAA;CAAA,CACoB,CAAC;AAExB,SAAS,CAAC,MAAM,GAAG,eAAe,CAAC;AACnC,SAAS,CAAC,OAAO,GAAG,gBAAgB,CAAC;AACrC,SAAS,CAAC,IAAI,GAAG,aAAa,CAAC;AAE/B,eAAe,SAAS,CAAC"}
|
|
@@ -9,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import cl from "
|
|
12
|
+
import cl from "clsx";
|
|
13
13
|
import React, { forwardRef, useContext } from "react";
|
|
14
14
|
import { Collapse, UnmountClosed } from "react-collapse";
|
|
15
15
|
import { AccordionItemContext } from "./AccordionItem";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionContent.js","sourceRoot":"","sources":["../../src/accordion/AccordionContent.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"AccordionContent.js","sourceRoot":"","sources":["../../src/accordion/AccordionContent.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAgBvD,MAAM,gBAAgB,GAAyB,UAAU,CACvD,CAAC,EAAoC,EAAE,GAAG,EAAE,EAAE;QAA7C,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,OAAW,EAAN,IAAI,cAAlC,+BAAoC,CAAF;IACjC,MAAM,OAAO,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC;IAEjD,IAAI,OAAO,KAAK,IAAI,EAAE;QACpB,OAAO,CAAC,KAAK,CACX,+DAA+D,CAChE,CAAC;QACF,OAAO,IAAI,CAAC;KACb;IAED,MAAM,iBAAiB,GAAG,OAAO,CAAC,uBAAuB;QACvD,CAAC,CAAC,QAAQ;QACV,CAAC,CAAC,aAAa,CAAC;IAElB,OAAO,CACL,2CAAK,GAAG,EAAE,GAAG,qBAAmB,OAAO,CAAC,QAAQ,IAAM,IAAI;QACxD,oBAAC,iBAAiB,IAAC,QAAQ,EAAE,OAAO,CAAC,IAAI;YACvC,6BAAK,SAAS,EAAE,EAAE,CAAC,0BAA0B,EAAE,SAAS,CAAC,IACtD,QAAQ,CACL,CACY,CAChB,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -10,7 +10,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { Expand, ExpandFilled } from "@navikt/ds-icons";
|
|
13
|
-
import cl from "
|
|
13
|
+
import cl from "clsx";
|
|
14
14
|
import React, { forwardRef, useContext } from "react";
|
|
15
15
|
import { AccordionItemContext } from "./AccordionItem";
|
|
16
16
|
import { useClientLayoutEffect, useId } from "..";
|
|
@@ -20,7 +20,8 @@ const AccordionHeader = forwardRef((_a, ref) => {
|
|
|
20
20
|
const newId = useId(id);
|
|
21
21
|
const setButtonId = context && context.setButtonId;
|
|
22
22
|
useClientLayoutEffect(() => {
|
|
23
|
-
|
|
23
|
+
var _a;
|
|
24
|
+
setButtonId && setButtonId((_a = (id ? newId : newId)) !== null && _a !== void 0 ? _a : "");
|
|
24
25
|
}, [setButtonId, newId]);
|
|
25
26
|
if (context === null) {
|
|
26
27
|
console.error("<Accordion.Header> has to be used within an <Accordion.Item>");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionHeader.js","sourceRoot":"","sources":["../../src/accordion/AccordionHeader.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"AccordionHeader.js","sourceRoot":"","sources":["../../src/accordion/AccordionHeader.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAclD,MAAM,eAAe,GAAwB,UAAU,CACrD,CAAC,EAA6C,EAAE,GAAG,EAAE,EAAE;QAAtD,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,OAAW,EAAN,IAAI,cAA3C,0CAA6C,CAAF;IAC1C,MAAM,OAAO,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACjD,MAAM,KAAK,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC;IAExB,MAAM,WAAW,GAAG,OAAO,IAAI,OAAO,CAAC,WAAW,CAAC;IAEnD,qBAAqB,CAAC,GAAG,EAAE;;QACzB,WAAW,IAAI,WAAW,CAAC,MAAA,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,mCAAI,EAAE,CAAC,CAAC;IACzD,CAAC,EAAE,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;IAEzB,IAAI,OAAO,KAAK,IAAI,EAAE;QACpB,OAAO,CAAC,KAAK,CACX,8DAA8D,CAC/D,CAAC;QACF,OAAO,IAAI,CAAC;KACb;IAED,MAAM,WAAW,GAAG,CAClB,CAAkD,EAClD,EAAE;QACF,OAAO,CAAC,UAAU,EAAE,CAAC;QACrB,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC,CAAC;IAEF,OAAO,CACL,gDACM,IAAI,IACR,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,OAAO,CAAC,QAAQ,EACpB,SAAS,EAAE,EAAE,CACX,yBAAyB,EACzB,SAAS,EACT,eAAe,EACf,sBAAsB,CACvB,EACD,OAAO,EAAE,WAAW,mBACL,OAAO,CAAC,IAAI;QAE1B,QAAQ;QACT,oBAAC,MAAM,yBAEL,SAAS,EAAE,EAAE,CAAC,8BAA8B,EAAE;gBAC5C,oCAAoC,EAAE,OAAO,CAAC,IAAI;aACnD,CAAC,GACF;QACF,oBAAC,YAAY,yBAEX,SAAS,EAAE,EAAE,CACX,8BAA8B,EAC9B,sCAAsC,EACtC;gBACE,oCAAoC,EAAE,OAAO,CAAC,IAAI;aACnD,CACF,GACD,CACK,CACV,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -9,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import cl from "
|
|
12
|
+
import cl from "clsx";
|
|
13
13
|
import React, { createContext, forwardRef, useState } from "react";
|
|
14
14
|
export const AccordionItemContext = createContext(null);
|
|
15
15
|
const AccordionItem = forwardRef((_a, ref) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionItem.js","sourceRoot":"","sources":["../../src/accordion/AccordionItem.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"AccordionItem.js","sourceRoot":"","sources":["../../src/accordion/AccordionItem.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAsCnE,MAAM,CAAC,MAAM,oBAAoB,GAC/B,aAAa,CAAmC,IAAI,CAAC,CAAC;AAExD,MAAM,aAAa,GAAsB,UAAU,CACjD,CACE,EASC,EACD,GAAG,EACH,EAAE;QAXF,EACE,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,WAAW,GAAG,KAAK,EACnB,uBAAuB,GAAG,KAAK,EAC/B,OAAO,EACP,EAAE,OAEH,EADI,IAAI,cART,4FASC,CADQ;IAIT,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAU,WAAW,CAAC,CAAC;IACvE,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAE7C,OAAO,CACL,2CACE,SAAS,EAAE,EAAE,CAAC,uBAAuB,EAAE,SAAS,EAAE;YAChD,6BAA6B,EAAE,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,YAAY;SACpD,CAAC,EACF,GAAG,EAAE,GAAG,IACJ,IAAI;QAER,oBAAC,oBAAoB,CAAC,QAAQ,IAC5B,KAAK,EAAE;gBACL,IAAI,EAAE,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,YAAY;gBAC1B,UAAU,EAAE,GAAG,EAAE;oBACf,IAAI,IAAI,KAAK,SAAS,EAAE;wBACtB,eAAe,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;qBACpC;gBACH,CAAC;gBACD,uBAAuB;gBACvB,WAAW;gBACX,QAAQ;aACT,IAEA,QAAQ,CACqB,CAC5B,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
package/esm/alert/Alert.d.ts
CHANGED
package/esm/alert/Alert.js
CHANGED
|
@@ -10,7 +10,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { ErrorColored, InformationColored, SuccessColored, WarningColored, } from "@navikt/ds-icons";
|
|
13
|
-
import cl from "
|
|
13
|
+
import cl from "clsx";
|
|
14
14
|
import React, { forwardRef } from "react";
|
|
15
15
|
import { BodyLong } from "..";
|
|
16
16
|
const Icon = (_a) => {
|
package/esm/alert/Alert.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.js","sourceRoot":"","sources":["../../src/alert/Alert.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Alert.js","sourceRoot":"","sources":["../../src/alert/Alert.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AA4B9B,MAAM,IAAI,GAAG,CAAC,EAAqB,EAAE,EAAE;QAAzB,EAAE,OAAO,OAAY,EAAP,KAAK,cAAnB,WAAqB,CAAF;IAC/B,QAAQ,OAAO,EAAE;QACf,KAAK,OAAO;YACV,OAAO,oBAAC,YAAY,kBAAC,KAAK,EAAC,MAAM,IAAK,KAAK,EAAI,CAAC;QAClD,KAAK,SAAS;YACZ,OAAO,oBAAC,cAAc,kBAAC,KAAK,EAAC,UAAU,IAAK,KAAK,EAAI,CAAC;QACxD,KAAK,MAAM;YACT,OAAO,oBAAC,kBAAkB,kBAAC,KAAK,EAAC,aAAa,IAAK,KAAK,EAAI,CAAC;QAC/D,KAAK,SAAS;YACZ,OAAO,oBAAC,cAAc,kBAAC,KAAK,EAAC,SAAS,IAAK,KAAK,EAAI,CAAC;QACvD;YACE,OAAO,IAAI,CAAC;KACf;AACH,CAAC,CAAC;AAMF,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAC7B,CACE,EAQC,EACD,GAAG,EACH,EAAE;QAVF,EACE,QAAQ,EACR,SAAS,EACT,OAAO,EACP,IAAI,GAAG,QAAQ,EACf,SAAS,GAAG,KAAK,EACjB,MAAM,GAAG,KAAK,OAEf,EADI,IAAI,cAPT,mEAQC,CADQ;IAGN,OAAA,CACH,6CACM,IAAI,IACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACX,SAAS,EACT,aAAa,EACb,gBAAgB,OAAO,EAAE,EACzB,gBAAgB,IAAI,EAAE,EACtB,EAAE,yBAAyB,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,EAAE,CACxE;QAED,oBAAC,IAAI,IAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAC,mBAAmB,GAAG;QACxD,oBAAC,QAAQ,IAAC,EAAE,EAAC,KAAK,EAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAC,sBAAsB,IAC5D,QAAQ,CACA,CACP,CACP,CAAA;CAAA,CACF,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
package/esm/button/Button.js
CHANGED
|
@@ -9,16 +9,15 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import React, { useRef, useState, forwardRef } from "react";
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import { BodyShort, Loader } from "../";
|
|
12
|
+
import React, { useRef, useState, forwardRef, useMemo } from "react";
|
|
13
|
+
import cl from "clsx";
|
|
14
|
+
import { BodyShort, Loader, mergeRefs } from "../";
|
|
16
15
|
import { useClientLayoutEffect } from "../util";
|
|
17
16
|
export const Button = forwardRef((_a, ref) => {
|
|
18
17
|
var { as: Component = "button", variant = "primary", className, children, size = "medium", loading = false, disabled, style } = _a, rest = __rest(_a, ["as", "variant", "className", "children", "size", "loading", "disabled", "style"]);
|
|
19
18
|
const buttonRef = useRef(null);
|
|
20
|
-
const mergedRef = mergeRefs([buttonRef, ref]);
|
|
21
19
|
const [widthOverride, setWidthOverride] = useState();
|
|
20
|
+
const mergedRef = useMemo(() => mergeRefs([buttonRef, ref]), [ref]);
|
|
22
21
|
useClientLayoutEffect(() => {
|
|
23
22
|
if (loading) {
|
|
24
23
|
const requestID = window.requestAnimationFrame(() => {
|
package/esm/button/Button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../src/button/Button.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../src/button/Button.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACrE,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,EAAE,SAAS,EAAwB,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AA8BhD,MAAM,CAAC,MAAM,MAAM,GACjB,UAAU,CACR,CACE,EAUC,EACD,GAAG,EACH,EAAE;QAZF,EACE,EAAE,EAAE,SAAS,GAAG,QAAQ,EACxB,OAAO,GAAG,SAAS,EACnB,SAAS,EACT,QAAQ,EACR,IAAI,GAAG,QAAQ,EACf,OAAO,GAAG,KAAK,EACf,QAAQ,EACR,KAAK,OAEN,EADI,IAAI,cATT,kFAUC,CADQ;IAIT,MAAM,SAAS,GAAG,MAAM,CAA2B,IAAI,CAAC,CAAC;IACzD,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,EAAU,CAAC;IAE7D,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAEpE,qBAAqB,CAAC,GAAG,EAAE;QACzB,IAAI,OAAO,EAAE;YACX,MAAM,SAAS,GAAG,MAAM,CAAC,qBAAqB,CAAC,GAAG,EAAE;;gBAClD,gBAAgB,CACd,MAAA,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,OAAO,0CAAE,qBAAqB,EAAE,0CAAE,KAAK,CACnD,CAAC;YACJ,CAAC,CAAC,CAAC;YACH,OAAO,GAAG,EAAE;gBACV,gBAAgB,CAAC,SAAS,CAAC,CAAC;gBAC5B,oBAAoB,CAAC,SAAS,CAAC,CAAC;YAClC,CAAC,CAAC;SACH;IACH,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;IAExB,OAAO,CACL,oBAAC,SAAS,oBACJ,IAAI,IACR,GAAG,EAAE,SAAS,EACd,SAAS,EAAE,EAAE,CACX,SAAS,EACT,cAAc,EACd,iBAAiB,OAAO,EAAE,EAC1B,iBAAiB,IAAI,EAAE,EACvB;YACE,uBAAuB,EAAE,aAAa;SACvC,CACF,EACD,KAAK,kCACA,KAAK,KACR,KAAK,EAAE,aAAa,KAEtB,QAAQ,EAAE,CAAA,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,aAAa,EAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;QAEtD,oBAAC,SAAS,IACR,EAAE,EAAC,MAAM,EACT,SAAS,EAAC,qBAAqB,EAC/B,IAAI,EAAE,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,eAClC,QAAQ,IAEjB,aAAa,CAAC,CAAC,CAAC,oBAAC,MAAM,IAAC,IAAI,EAAE,IAAI,GAAI,CAAC,CAAC,CAAC,QAAQ,CACxC,CACF,CACb,CAAC;AACJ,CAAC,CACF,CAAC;AAEJ,eAAe,MAAM,CAAC"}
|
|
@@ -5,11 +5,15 @@ export interface BubbleProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
5
5
|
*/
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* name/sender on bubble
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
name?: string;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Timestamp for sent message
|
|
13
|
+
*/
|
|
14
|
+
timestamp?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Background color on bubble
|
|
13
17
|
*/
|
|
14
18
|
backgroundColor?: string;
|
|
15
19
|
}
|
|
@@ -10,11 +10,14 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import React, { forwardRef } from "react";
|
|
13
|
-
import cl from "
|
|
13
|
+
import cl from "clsx";
|
|
14
|
+
import { Detail } from "../typography";
|
|
14
15
|
const Bubble = forwardRef((_a, ref) => {
|
|
15
|
-
var { children, className,
|
|
16
|
-
return (React.createElement("div", Object.assign({ ref: ref, className: cl("navds-
|
|
17
|
-
|
|
16
|
+
var { children, className, name, timestamp, backgroundColor } = _a, rest = __rest(_a, ["children", "className", "name", "timestamp", "backgroundColor"]);
|
|
17
|
+
return (React.createElement("div", Object.assign({ ref: ref, className: cl("navds-chat__bubble", className), style: { backgroundColor: backgroundColor }, tabIndex: 0 }, rest),
|
|
18
|
+
(timestamp || name) && (React.createElement("div", { className: "navds-chat__top-text" },
|
|
19
|
+
name && React.createElement(Detail, { className: "navds-chat__name" }, name),
|
|
20
|
+
timestamp && (React.createElement(Detail, { className: "navds-chat__timestamp" }, timestamp)))),
|
|
18
21
|
children));
|
|
19
22
|
});
|
|
20
23
|
export default Bubble;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Bubble.js","sourceRoot":"","sources":["../../src/chat/Bubble.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAkB,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAyBvC,MAAM,MAAM,GAAe,UAAU,CACnC,CAAC,EAAkE,EAAE,GAAG,EAAE,EAAE;QAA3E,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,eAAe,OAAW,EAAN,IAAI,cAAhE,iEAAkE,CAAF;IAC/D,OAAO,CACL,2CACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,oBAAoB,EAAE,SAAS,CAAC,EAC9C,KAAK,EAAE,EAAE,eAAe,EAAE,eAAe,EAAE,EAC3C,QAAQ,EAAE,CAAC,IACP,IAAI;QAEP,CAAC,SAAS,IAAI,IAAI,CAAC,IAAI,CACtB,6BAAK,SAAS,EAAC,sBAAsB;YAClC,IAAI,IAAI,oBAAC,MAAM,IAAC,SAAS,EAAC,kBAAkB,IAAE,IAAI,CAAU;YAC5D,SAAS,IAAI,CACZ,oBAAC,MAAM,IAAC,SAAS,EAAC,uBAAuB,IAAE,SAAS,CAAU,CAC/D,CACG,CACP;QACA,QAAQ,CACL,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React, { HTMLAttributes } from "react";
|
|
2
|
+
import { BubbleType } from "./Bubble";
|
|
3
|
+
export interface ChatProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/**
|
|
5
|
+
* Children of type <Chat.Bubble />
|
|
6
|
+
*/
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Chat-message name
|
|
10
|
+
*/
|
|
11
|
+
name: string;
|
|
12
|
+
/**
|
|
13
|
+
* Timestamp for sent message
|
|
14
|
+
*/
|
|
15
|
+
timestamp?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Avatar for messenger. Regular text for initials works to
|
|
18
|
+
*/
|
|
19
|
+
avatar: React.ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Background color on bubbles
|
|
22
|
+
*/
|
|
23
|
+
backgroundColor?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Background color for avatar
|
|
26
|
+
*/
|
|
27
|
+
avatarBgColor?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Positions avatar and Bubbles
|
|
30
|
+
* @default "left"
|
|
31
|
+
*/
|
|
32
|
+
position?: "left" | "right";
|
|
33
|
+
}
|
|
34
|
+
interface ChatComponent extends React.ForwardRefExoticComponent<ChatProps & React.RefAttributes<HTMLDivElement>> {
|
|
35
|
+
Bubble: BubbleType;
|
|
36
|
+
}
|
|
37
|
+
export declare const Chat: ChatComponent;
|
|
38
|
+
export default Chat;
|
package/esm/chat/Chat.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React, { forwardRef } from "react";
|
|
13
|
+
import cl from "clsx";
|
|
14
|
+
import Bubble from "./Bubble";
|
|
15
|
+
import { BodyLong, BodyShort } from "..";
|
|
16
|
+
export const Chat = forwardRef((_a, ref) => {
|
|
17
|
+
var { children, className, name, timestamp, avatar, position = "left", avatarBgColor, backgroundColor } = _a, rest = __rest(_a, ["children", "className", "name", "timestamp", "avatar", "position", "avatarBgColor", "backgroundColor"]);
|
|
18
|
+
return (React.createElement("div", Object.assign({ ref: ref, className: cl("navds-chat", className, `navds-chat--${position}`) }, rest),
|
|
19
|
+
React.createElement(BodyShort, { as: "div", className: "navds-chat__avatar", style: { backgroundColor: avatarBgColor } }, avatar),
|
|
20
|
+
React.createElement("ol", { className: "navds-chat__bubble-wrapper" }, React.Children.map(children, (child, i) => {
|
|
21
|
+
if (React.isValidElement(child)) {
|
|
22
|
+
return (React.createElement(BodyLong, { as: "li" }, React.cloneElement(child, Object.assign({ name: name && i === 0 ? name : undefined, timestamp: timestamp && i === 0 ? timestamp : undefined, backgroundColor }, child.props))));
|
|
23
|
+
}
|
|
24
|
+
}))));
|
|
25
|
+
});
|
|
26
|
+
Chat.Bubble = Bubble;
|
|
27
|
+
export default Chat;
|
|
28
|
+
//# sourceMappingURL=Chat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chat.js","sourceRoot":"","sources":["../../src/chat/Chat.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAkB,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,MAAsB,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAyCzC,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAC5B,CACE,EAUC,EACD,GAAG,EACH,EAAE;QAZF,EACE,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,SAAS,EACT,MAAM,EACN,QAAQ,GAAG,MAAM,EACjB,aAAa,EACb,eAAe,OAEhB,EADI,IAAI,cATT,wGAUC,CADQ;IAIT,OAAO,CACL,2CACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,YAAY,EAAE,SAAS,EAAE,eAAe,QAAQ,EAAE,CAAC,IAC7D,IAAI;QAER,oBAAC,SAAS,IACR,EAAE,EAAC,KAAK,EACR,SAAS,EAAC,oBAAoB,EAC9B,KAAK,EAAE,EAAE,eAAe,EAAE,aAAa,EAAE,IAExC,MAAM,CACG;QACZ,4BAAI,SAAS,EAAC,4BAA4B,IACvC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;YACzC,IAAI,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE;gBAC/B,OAAO,CACL,oBAAC,QAAQ,IAAC,EAAE,EAAC,IAAI,IACd,KAAK,CAAC,YAAY,CAAC,KAAK,kBACvB,IAAI,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EACxC,SAAS,EAAE,SAAS,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EACvD,eAAe,IACZ,KAAK,CAAC,KAAK,EACd,CACO,CACZ,CAAC;aACH;QACH,CAAC,CAAC,CACC,CACD,CACP,CAAC;AACJ,CAAC,CACe,CAAC;AAEnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AAErB,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Chat, ChatProps } from "./Chat";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/chat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,IAAI,EAAa,MAAM,QAAQ,CAAC"}
|
|
@@ -10,7 +10,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import React, { forwardRef } from "react";
|
|
13
|
-
import cl from "
|
|
13
|
+
import cl from "clsx";
|
|
14
14
|
import { BodyLong, Checkbox, ErrorMessage } from "..";
|
|
15
15
|
import { useFormField } from "./useFormField";
|
|
16
16
|
export const ConfirmationPanel = forwardRef((_a, ref) => {
|