@navikt/ds-react 0.17.27 → 0.18.2
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 +9165 -0
- package/cjs/accordion/Accordion.js +6 -5
- package/cjs/accordion/index.js +0 -15
- package/cjs/alert/Alert.js +3 -2
- package/cjs/alert/index.js +0 -15
- package/cjs/button/Button.js +3 -2
- package/cjs/button/index.js +0 -15
- package/cjs/card/index.js +0 -15
- package/cjs/form/ConfirmationPanel.js +3 -2
- package/cjs/form/Fieldset/Fieldset.js +3 -3
- package/cjs/form/Fieldset/index.js +2 -2
- package/cjs/form/Select.js +4 -3
- package/cjs/form/Switch.js +3 -2
- package/cjs/form/TextField.js +4 -3
- package/cjs/form/Textarea.js +3 -3
- package/cjs/form/checkbox/Checkbox.js +3 -2
- package/cjs/form/checkbox/CheckboxGroup.js +3 -3
- package/cjs/form/error-summary/ErrorSummary.js +4 -3
- package/cjs/form/error-summary/ErrorSummaryItem.js +3 -2
- package/cjs/form/error-summary/index.js +0 -15
- package/cjs/form/index.js +6 -6
- package/cjs/form/radio/Radio.js +3 -2
- package/cjs/form/radio/RadioGroup.js +3 -3
- package/cjs/form/search/Search.js +5 -6
- package/cjs/form/search/SearchButton.js +3 -6
- package/cjs/grid/Cell.js +3 -2
- package/cjs/grid/ContentContainer.js +3 -2
- package/cjs/grid/Grid.js +3 -2
- package/cjs/grid/index.js +0 -17
- package/cjs/guide-panel/GuidePanel.js +3 -2
- package/cjs/guide-panel/index.js +0 -15
- package/cjs/help-text/HelpText.js +3 -2
- package/cjs/help-text/index.js +0 -15
- package/cjs/link/Link.js +3 -2
- package/cjs/link/index.js +0 -15
- package/cjs/link-panel/LinkPanel.js +3 -2
- package/cjs/link-panel/index.js +0 -15
- package/cjs/loader/Loader.js +3 -2
- package/cjs/loader/index.js +0 -15
- package/cjs/menu/Menu.js +5 -4
- package/cjs/menu/MenuCollapse.js +3 -3
- package/cjs/menu/MenuItem.js +3 -2
- package/cjs/modal/Modal.js +5 -4
- package/cjs/modal/index.js +0 -15
- package/cjs/page-header/index.js +0 -15
- package/cjs/pagination/Pagination.js +3 -3
- package/cjs/pagination/index.js +0 -15
- package/cjs/panel/Panel.js +3 -2
- package/cjs/panel/index.js +0 -15
- package/cjs/popover/Popover.js +4 -3
- package/cjs/popover/index.js +0 -15
- package/cjs/read-more/ReadMore.js +3 -2
- package/cjs/read-more/index.js +0 -15
- package/cjs/speech-bubble/SpeechBubble.js +4 -3
- package/cjs/speech-bubble/index.js +0 -15
- package/cjs/step-indicator/Step.js +5 -4
- package/cjs/step-indicator/StepIndicator.js +4 -4
- package/cjs/step-indicator/index.js +0 -15
- package/cjs/stepper/Step.js +5 -4
- package/cjs/stepper/Stepper.js +4 -4
- package/cjs/stepper/index.js +0 -15
- package/cjs/table/Body.js +3 -2
- package/cjs/table/ColumnHeader.js +5 -4
- package/cjs/table/DataCell.js +5 -4
- package/cjs/table/ExpandableRow.js +12 -12
- package/cjs/table/Header.js +3 -2
- package/cjs/table/HeaderCell.js +5 -3
- package/cjs/table/Row.js +3 -2
- package/cjs/table/Table.js +10 -10
- package/cjs/table/index.js +0 -15
- package/cjs/tabs/Tab.js +3 -2
- package/cjs/tabs/TabList.js +3 -2
- package/cjs/tabs/TabPanel.js +2 -2
- package/cjs/tabs/Tabs.js +6 -6
- package/cjs/tag/Tag.js +3 -2
- package/cjs/tag/index.js +0 -15
- package/cjs/toggle-group/ToggleGroup.js +4 -4
- package/cjs/tooltip/Tooltip.js +3 -2
- package/cjs/tooltip/index.js +0 -15
- package/cjs/typography/BodyLong.js +3 -2
- package/cjs/typography/BodyShort.js +3 -2
- package/cjs/typography/Detail.js +3 -2
- package/cjs/typography/Heading.js +3 -2
- package/cjs/typography/Ingress.js +3 -2
- package/cjs/typography/Label.js +3 -2
- package/cjs/typography/index.js +5 -5
- package/esm/accordion/Accordion.d.ts +1 -1
- package/esm/accordion/Accordion.js +1 -1
- package/esm/accordion/Accordion.js.map +1 -1
- package/esm/accordion/AccordionHeader.d.ts +1 -1
- package/esm/accordion/AccordionItem.d.ts +2 -2
- package/esm/accordion/index.d.ts +1 -2
- package/esm/accordion/index.js +0 -1
- package/esm/accordion/index.js.map +1 -1
- package/esm/alert/Alert.d.ts +2 -2
- package/esm/alert/Alert.js +1 -1
- package/esm/alert/Alert.js.map +1 -1
- package/esm/alert/index.d.ts +1 -1
- package/esm/alert/index.js +0 -1
- package/esm/alert/index.js.map +1 -1
- package/esm/button/Button.d.ts +3 -3
- package/esm/button/Button.js +1 -1
- package/esm/button/Button.js.map +1 -1
- package/esm/button/index.d.ts +1 -1
- package/esm/button/index.js +0 -1
- package/esm/button/index.js.map +1 -1
- package/esm/card/index.d.ts +1 -1
- package/esm/card/index.js +0 -1
- package/esm/card/index.js.map +1 -1
- package/esm/form/ConfirmationPanel.d.ts +1 -1
- package/esm/form/ConfirmationPanel.js +1 -1
- package/esm/form/ConfirmationPanel.js.map +1 -1
- package/esm/form/Fieldset/Fieldset.d.ts +1 -1
- package/esm/form/Fieldset/Fieldset.js +1 -1
- package/esm/form/Fieldset/Fieldset.js.map +1 -1
- package/esm/form/Fieldset/index.d.ts +1 -1
- package/esm/form/Fieldset/index.js +1 -1
- package/esm/form/Fieldset/index.js.map +1 -1
- package/esm/form/Select.d.ts +1 -1
- package/esm/form/Select.js +2 -2
- package/esm/form/Select.js.map +1 -1
- package/esm/form/Switch.d.ts +1 -1
- package/esm/form/Switch.js +1 -1
- package/esm/form/Switch.js.map +1 -1
- package/esm/form/TextField.d.ts +1 -1
- package/esm/form/TextField.js +2 -2
- package/esm/form/TextField.js.map +1 -1
- package/esm/form/Textarea.d.ts +1 -1
- package/esm/form/Textarea.js +1 -1
- package/esm/form/Textarea.js.map +1 -1
- package/esm/form/checkbox/Checkbox.d.ts +1 -1
- package/esm/form/checkbox/Checkbox.js +1 -1
- package/esm/form/checkbox/Checkbox.js.map +1 -1
- package/esm/form/checkbox/CheckboxGroup.d.ts +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.d.ts +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/error-summary/ErrorSummaryItem.js +1 -1
- package/esm/form/error-summary/ErrorSummaryItem.js.map +1 -1
- package/esm/form/error-summary/index.d.ts +1 -1
- package/esm/form/error-summary/index.js +0 -1
- package/esm/form/error-summary/index.js.map +1 -1
- package/esm/form/index.d.ts +5 -5
- package/esm/form/index.js +3 -3
- package/esm/form/index.js.map +1 -1
- package/esm/form/radio/Radio.d.ts +1 -1
- package/esm/form/radio/Radio.js +1 -1
- package/esm/form/radio/Radio.js.map +1 -1
- package/esm/form/radio/RadioGroup.d.ts +1 -1
- package/esm/form/radio/RadioGroup.js +1 -1
- package/esm/form/radio/RadioGroup.js.map +1 -1
- package/esm/form/search/Search.d.ts +1 -6
- package/esm/form/search/Search.js +2 -3
- package/esm/form/search/Search.js.map +1 -1
- package/esm/form/search/SearchButton.js +3 -6
- package/esm/form/search/SearchButton.js.map +1 -1
- package/esm/grid/Cell.d.ts +1 -1
- package/esm/grid/Cell.js +1 -1
- package/esm/grid/Cell.js.map +1 -1
- package/esm/grid/ContentContainer.d.ts +1 -1
- package/esm/grid/ContentContainer.js +1 -1
- package/esm/grid/ContentContainer.js.map +1 -1
- package/esm/grid/Grid.d.ts +1 -1
- package/esm/grid/Grid.js +1 -1
- package/esm/grid/Grid.js.map +1 -1
- package/esm/grid/index.d.ts +3 -6
- package/esm/grid/index.js +1 -4
- package/esm/grid/index.js.map +1 -1
- package/esm/guide-panel/GuidePanel.d.ts +1 -1
- package/esm/guide-panel/GuidePanel.js +1 -1
- package/esm/guide-panel/GuidePanel.js.map +1 -1
- package/esm/guide-panel/index.d.ts +1 -2
- package/esm/guide-panel/index.js +0 -1
- package/esm/guide-panel/index.js.map +1 -1
- package/esm/help-text/HelpText.d.ts +1 -1
- package/esm/help-text/HelpText.js +1 -1
- package/esm/help-text/HelpText.js.map +1 -1
- package/esm/help-text/index.d.ts +1 -1
- package/esm/help-text/index.js +0 -1
- package/esm/help-text/index.js.map +1 -1
- package/esm/link/Link.d.ts +1 -1
- package/esm/link/Link.js +1 -1
- package/esm/link/Link.js.map +1 -1
- package/esm/link/index.d.ts +1 -1
- package/esm/link/index.js +0 -1
- package/esm/link/index.js.map +1 -1
- package/esm/link-panel/LinkPanel.d.ts +1 -0
- package/esm/link-panel/LinkPanel.js +1 -1
- package/esm/link-panel/LinkPanel.js.map +1 -1
- package/esm/link-panel/index.d.ts +1 -1
- package/esm/link-panel/index.js +0 -1
- package/esm/link-panel/index.js.map +1 -1
- package/esm/loader/Loader.d.ts +1 -1
- package/esm/loader/Loader.js +1 -1
- package/esm/loader/Loader.js.map +1 -1
- package/esm/loader/index.d.ts +1 -1
- package/esm/loader/index.js +0 -1
- package/esm/loader/index.js.map +1 -1
- package/esm/menu/Menu.d.ts +1 -1
- package/esm/menu/Menu.js +1 -1
- package/esm/menu/Menu.js.map +1 -1
- package/esm/menu/MenuCollapse.d.ts +1 -1
- package/esm/menu/MenuCollapse.js +1 -1
- package/esm/menu/MenuCollapse.js.map +1 -1
- package/esm/menu/MenuItem.d.ts +1 -1
- package/esm/menu/MenuItem.js +1 -1
- package/esm/menu/MenuItem.js.map +1 -1
- package/esm/modal/Modal.d.ts +1 -1
- package/esm/modal/Modal.js +1 -1
- package/esm/modal/Modal.js.map +1 -1
- package/esm/modal/index.d.ts +1 -2
- package/esm/modal/index.js +0 -1
- package/esm/modal/index.js.map +1 -1
- package/esm/page-header/index.d.ts +1 -1
- package/esm/page-header/index.js +0 -1
- package/esm/page-header/index.js.map +1 -1
- package/esm/pagination/Pagination.d.ts +2 -2
- package/esm/pagination/Pagination.js +1 -1
- package/esm/pagination/Pagination.js.map +1 -1
- package/esm/pagination/index.d.ts +1 -1
- package/esm/pagination/index.js +0 -1
- package/esm/pagination/index.js.map +1 -1
- package/esm/panel/Panel.d.ts +1 -1
- package/esm/panel/Panel.js +1 -1
- package/esm/panel/Panel.js.map +1 -1
- package/esm/panel/index.d.ts +1 -1
- package/esm/panel/index.js +0 -1
- package/esm/panel/index.js.map +1 -1
- package/esm/popover/Popover.d.ts +1 -1
- package/esm/popover/Popover.js +1 -1
- package/esm/popover/Popover.js.map +1 -1
- package/esm/popover/index.d.ts +1 -2
- package/esm/popover/index.js +0 -1
- package/esm/popover/index.js.map +1 -1
- package/esm/read-more/ReadMore.d.ts +1 -1
- package/esm/read-more/ReadMore.js +1 -1
- package/esm/read-more/ReadMore.js.map +1 -1
- package/esm/read-more/index.d.ts +1 -2
- package/esm/read-more/index.js +0 -1
- package/esm/read-more/index.js.map +1 -1
- package/esm/speech-bubble/SpeechBubble.d.ts +1 -1
- package/esm/speech-bubble/SpeechBubble.js +1 -1
- package/esm/speech-bubble/SpeechBubble.js.map +1 -1
- package/esm/speech-bubble/index.d.ts +1 -2
- package/esm/speech-bubble/index.js +0 -1
- package/esm/speech-bubble/index.js.map +1 -1
- package/esm/step-indicator/Step.d.ts +1 -0
- package/esm/step-indicator/Step.js +3 -3
- package/esm/step-indicator/Step.js.map +1 -1
- package/esm/step-indicator/StepIndicator.d.ts +1 -1
- package/esm/step-indicator/StepIndicator.js +3 -3
- package/esm/step-indicator/StepIndicator.js.map +1 -1
- package/esm/step-indicator/index.d.ts +1 -2
- package/esm/step-indicator/index.js +0 -1
- package/esm/step-indicator/index.js.map +1 -1
- package/esm/stepper/Step.d.ts +1 -0
- package/esm/stepper/Step.js +2 -2
- package/esm/stepper/Step.js.map +1 -1
- package/esm/stepper/Stepper.d.ts +1 -1
- package/esm/stepper/Stepper.js +1 -1
- package/esm/stepper/Stepper.js.map +1 -1
- package/esm/stepper/index.d.ts +1 -2
- package/esm/stepper/index.js +0 -1
- package/esm/stepper/index.js.map +1 -1
- package/esm/table/Body.d.ts +2 -2
- package/esm/table/Body.js +1 -1
- package/esm/table/Body.js.map +1 -1
- package/esm/table/ColumnHeader.d.ts +2 -2
- package/esm/table/ColumnHeader.js +2 -2
- package/esm/table/ColumnHeader.js.map +1 -1
- package/esm/table/DataCell.d.ts +2 -2
- package/esm/table/DataCell.js +2 -2
- package/esm/table/DataCell.js.map +1 -1
- package/esm/table/ExpandableRow.d.ts +7 -2
- package/esm/table/ExpandableRow.js +10 -11
- package/esm/table/ExpandableRow.js.map +1 -1
- package/esm/table/Header.d.ts +2 -2
- package/esm/table/Header.js +1 -1
- package/esm/table/Header.js.map +1 -1
- package/esm/table/HeaderCell.d.ts +1 -1
- package/esm/table/HeaderCell.js +3 -2
- package/esm/table/HeaderCell.js.map +1 -1
- package/esm/table/Row.d.ts +1 -1
- package/esm/table/Row.js +1 -1
- package/esm/table/Row.js.map +1 -1
- package/esm/table/Table.d.ts +1 -1
- package/esm/table/Table.js +1 -1
- package/esm/table/Table.js.map +1 -1
- package/esm/table/index.d.ts +8 -2
- package/esm/table/index.js +0 -1
- package/esm/table/index.js.map +1 -1
- package/esm/tabs/Tab.d.ts +1 -1
- package/esm/tabs/Tab.js +1 -1
- package/esm/tabs/Tab.js.map +1 -1
- package/esm/tabs/TabList.d.ts +4 -4
- package/esm/tabs/TabList.js +2 -2
- package/esm/tabs/TabList.js.map +1 -1
- package/esm/tabs/TabPanel.d.ts +4 -4
- package/esm/tabs/TabPanel.js +2 -2
- package/esm/tabs/TabPanel.js.map +1 -1
- package/esm/tabs/Tabs.d.ts +5 -5
- package/esm/tabs/Tabs.js +5 -5
- package/esm/tabs/Tabs.js.map +1 -1
- package/esm/tabs/index.d.ts +3 -1
- package/esm/tabs/index.js.map +1 -1
- package/esm/tag/Tag.d.ts +1 -1
- package/esm/tag/Tag.js +1 -1
- package/esm/tag/Tag.js.map +1 -1
- package/esm/tag/index.d.ts +1 -2
- package/esm/tag/index.js +0 -1
- package/esm/tag/index.js.map +1 -1
- package/esm/toggle-group/ToggleGroup.d.ts +1 -1
- package/esm/toggle-group/ToggleGroup.js +1 -1
- package/esm/toggle-group/ToggleGroup.js.map +1 -1
- package/esm/toggle-group/index.d.ts +2 -2
- package/esm/toggle-group/index.js.map +1 -1
- package/esm/tooltip/Tooltip.d.ts +1 -1
- package/esm/tooltip/Tooltip.js +1 -1
- package/esm/tooltip/Tooltip.js.map +1 -1
- package/esm/tooltip/index.d.ts +1 -2
- package/esm/tooltip/index.js +0 -1
- package/esm/tooltip/index.js.map +1 -1
- package/esm/typography/BodyLong.d.ts +1 -1
- package/esm/typography/BodyLong.js +1 -1
- package/esm/typography/BodyLong.js.map +1 -1
- package/esm/typography/BodyShort.d.ts +1 -1
- package/esm/typography/BodyShort.js +1 -1
- package/esm/typography/BodyShort.js.map +1 -1
- package/esm/typography/Detail.d.ts +1 -1
- package/esm/typography/Detail.js +1 -1
- package/esm/typography/Detail.js.map +1 -1
- package/esm/typography/Heading.d.ts +1 -1
- package/esm/typography/Heading.js +1 -1
- package/esm/typography/Heading.js.map +1 -1
- package/esm/typography/Ingress.d.ts +1 -1
- package/esm/typography/Ingress.js +1 -1
- package/esm/typography/Ingress.js.map +1 -1
- package/esm/typography/Label.d.ts +1 -1
- package/esm/typography/Label.js +1 -1
- package/esm/typography/Label.js.map +1 -1
- package/esm/typography/index.d.ts +6 -6
- package/esm/typography/index.js +2 -2
- package/esm/typography/index.js.map +1 -1
- package/package.json +10 -5
- package/src/accordion/Accordion.tsx +1 -1
- package/src/accordion/AccordionHeader.tsx +1 -1
- package/src/accordion/AccordionItem.tsx +2 -2
- package/src/accordion/index.ts +1 -2
- package/src/alert/Alert.tsx +2 -2
- package/src/alert/index.ts +1 -1
- package/src/button/Button.tsx +6 -3
- package/src/button/index.ts +1 -1
- package/src/card/index.ts +1 -1
- package/src/form/ConfirmationPanel.tsx +25 -24
- package/src/form/Fieldset/Fieldset.tsx +2 -1
- package/src/form/Fieldset/index.ts +5 -1
- package/src/form/Select.tsx +72 -68
- package/src/form/Switch.tsx +82 -80
- package/src/form/TextField.tsx +86 -82
- package/src/form/Textarea.tsx +1 -1
- package/src/form/checkbox/Checkbox.tsx +63 -61
- package/src/form/checkbox/CheckboxGroup.tsx +4 -1
- package/src/form/error-summary/ErrorSummary.tsx +1 -1
- package/src/form/error-summary/ErrorSummaryItem.tsx +1 -1
- package/src/form/error-summary/index.ts +1 -1
- package/src/form/index.ts +7 -11
- package/src/form/radio/Radio.tsx +1 -1
- package/src/form/radio/RadioGroup.tsx +1 -1
- package/src/form/search/Search.tsx +130 -135
- package/src/form/search/SearchButton.tsx +2 -6
- package/src/form/search/search.stories.tsx +0 -1
- package/src/grid/Cell.tsx +1 -1
- package/src/grid/ContentContainer.tsx +10 -9
- package/src/grid/Grid.tsx +2 -1
- package/src/grid/index.ts +6 -6
- package/src/guide-panel/GuidePanel.tsx +1 -1
- package/src/guide-panel/index.ts +1 -2
- package/src/help-text/HelpText.tsx +1 -1
- package/src/help-text/index.ts +1 -1
- package/src/link/Link.tsx +1 -1
- package/src/link/index.ts +1 -1
- package/src/link-panel/LinkPanel.tsx +1 -1
- package/src/link-panel/index.ts +1 -1
- package/src/loader/Loader.tsx +1 -1
- package/src/loader/index.ts +1 -1
- package/src/menu/Menu.tsx +1 -1
- package/src/menu/MenuCollapse.tsx +1 -1
- package/src/menu/MenuItem.tsx +1 -1
- package/src/modal/Modal.tsx +1 -1
- package/src/modal/index.ts +1 -2
- package/src/page-header/index.ts +1 -1
- package/src/pagination/Pagination.tsx +2 -2
- package/src/pagination/index.ts +1 -1
- package/src/panel/Panel.tsx +1 -1
- package/src/panel/index.ts +1 -1
- package/src/popover/Popover.tsx +1 -1
- package/src/popover/index.ts +1 -2
- package/src/read-more/ReadMore.tsx +1 -1
- package/src/read-more/index.ts +1 -2
- package/src/read-more/read-more.stories.tsx +1 -1
- package/src/speech-bubble/SpeechBubble.tsx +1 -1
- package/src/speech-bubble/index.ts +1 -2
- package/src/step-indicator/Step.tsx +3 -3
- package/src/step-indicator/StepIndicator.tsx +6 -3
- package/src/step-indicator/index.ts +1 -2
- package/src/stepper/Step.tsx +2 -2
- package/src/stepper/Stepper.tsx +4 -1
- package/src/stepper/index.ts +1 -2
- package/src/table/Body.tsx +3 -2
- package/src/table/ColumnHeader.tsx +3 -3
- package/src/table/DataCell.tsx +4 -3
- package/src/table/ExpandableRow.tsx +30 -22
- package/src/table/Header.tsx +3 -2
- package/src/table/HeaderCell.tsx +3 -2
- package/src/table/Row.tsx +1 -1
- package/src/table/Table.tsx +1 -1
- package/src/table/index.ts +8 -2
- package/src/table/stories/table-expandable.stories.tsx +2 -1
- package/src/tabs/Tab.tsx +1 -1
- package/src/tabs/TabList.tsx +6 -6
- package/src/tabs/TabPanel.tsx +6 -6
- package/src/tabs/Tabs.tsx +7 -7
- package/src/tabs/index.ts +3 -1
- package/src/tag/Tag.tsx +1 -1
- package/src/tag/index.ts +1 -2
- package/src/toggle-group/ToggleGroup.tsx +1 -1
- package/src/toggle-group/index.ts +2 -2
- package/src/tooltip/Tooltip.tsx +1 -1
- package/src/tooltip/index.ts +1 -2
- package/src/typography/BodyLong.tsx +1 -1
- package/src/typography/BodyShort.tsx +1 -1
- package/src/typography/Detail.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/index.ts +6 -6
package/src/form/Select.tsx
CHANGED
|
@@ -26,81 +26,85 @@ export interface SelectProps
|
|
|
26
26
|
hideLabel?: boolean;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
const Select = forwardRef<HTMLSelectElement, SelectProps>(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
export const Select = forwardRef<HTMLSelectElement, SelectProps>(
|
|
30
|
+
(props, ref) => {
|
|
31
|
+
const {
|
|
32
|
+
inputProps,
|
|
33
|
+
errorId,
|
|
34
|
+
showErrorMsg,
|
|
35
|
+
hasError,
|
|
36
|
+
size,
|
|
37
|
+
inputDescriptionId,
|
|
38
|
+
} = useFormField(props, "textField");
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
const {
|
|
41
|
+
children,
|
|
42
|
+
label,
|
|
43
|
+
className,
|
|
44
|
+
description,
|
|
45
|
+
htmlSize,
|
|
46
|
+
hideLabel = false,
|
|
47
|
+
...rest
|
|
48
|
+
} = props;
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
>
|
|
61
|
-
<Label
|
|
62
|
-
htmlFor={inputProps.id}
|
|
63
|
-
size={size}
|
|
64
|
-
as="label"
|
|
65
|
-
className={cl("navds-select__label", {
|
|
66
|
-
"navds-sr-only": hideLabel,
|
|
67
|
-
})}
|
|
50
|
+
return (
|
|
51
|
+
<div
|
|
52
|
+
className={cl(
|
|
53
|
+
className,
|
|
54
|
+
"navds-form-field",
|
|
55
|
+
`navds-form-field--${size}`,
|
|
56
|
+
{
|
|
57
|
+
"navds-select--error": hasError,
|
|
58
|
+
"navds-select--disabled": !!inputProps.disabled,
|
|
59
|
+
}
|
|
60
|
+
)}
|
|
68
61
|
>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
className={cl("navds-select__description", {
|
|
62
|
+
<Label
|
|
63
|
+
htmlFor={inputProps.id}
|
|
64
|
+
size={size}
|
|
65
|
+
as="label"
|
|
66
|
+
className={cl("navds-select__label", {
|
|
75
67
|
"navds-sr-only": hideLabel,
|
|
76
68
|
})}
|
|
77
|
-
id={inputDescriptionId}
|
|
78
|
-
size={size}
|
|
79
69
|
>
|
|
80
|
-
{
|
|
81
|
-
</
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
70
|
+
{label}
|
|
71
|
+
</Label>
|
|
72
|
+
{!!description && (
|
|
73
|
+
<BodyShort
|
|
74
|
+
as="div"
|
|
75
|
+
className={cl("navds-select__description", {
|
|
76
|
+
"navds-sr-only": hideLabel,
|
|
77
|
+
})}
|
|
78
|
+
id={inputDescriptionId}
|
|
79
|
+
size={size}
|
|
80
|
+
>
|
|
81
|
+
{description}
|
|
82
|
+
</BodyShort>
|
|
83
|
+
)}
|
|
84
|
+
<div className="navds-select__container">
|
|
85
|
+
<select
|
|
86
|
+
{...omit(rest, ["error", "errorId", "size"])}
|
|
87
|
+
{...inputProps}
|
|
88
|
+
ref={ref}
|
|
89
|
+
className={cl(
|
|
90
|
+
"navds-select__input",
|
|
91
|
+
"navds-body-short",
|
|
92
|
+
`navds-body--${size ?? "medium"}`
|
|
93
|
+
)}
|
|
94
|
+
size={props.htmlSize}
|
|
95
|
+
>
|
|
96
|
+
{children}
|
|
97
|
+
</select>
|
|
98
|
+
<Expand className="navds-select__chevron" aria-hidden />
|
|
99
|
+
</div>
|
|
100
|
+
<div id={errorId} aria-relevant="additions removals" aria-live="polite">
|
|
101
|
+
{showErrorMsg && (
|
|
102
|
+
<ErrorMessage size={size}>{props.error}</ErrorMessage>
|
|
92
103
|
)}
|
|
93
|
-
|
|
94
|
-
>
|
|
95
|
-
{children}
|
|
96
|
-
</select>
|
|
97
|
-
<Expand className="navds-select__chevron" aria-hidden />
|
|
98
|
-
</div>
|
|
99
|
-
<div id={errorId} aria-relevant="additions removals" aria-live="polite">
|
|
100
|
-
{showErrorMsg && <ErrorMessage size={size}>{props.error}</ErrorMessage>}
|
|
104
|
+
</div>
|
|
101
105
|
</div>
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
);
|
|
105
109
|
|
|
106
110
|
export default Select;
|
package/src/form/Switch.tsx
CHANGED
|
@@ -51,92 +51,94 @@ export interface SwitchProps
|
|
|
51
51
|
position?: "left" | "right";
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
const Switch = forwardRef<HTMLInputElement, SwitchProps>(
|
|
55
|
-
|
|
54
|
+
export const Switch = forwardRef<HTMLInputElement, SwitchProps>(
|
|
55
|
+
(props, ref) => {
|
|
56
|
+
const { inputProps, size } = useFormField(props, "switch");
|
|
56
57
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
58
|
+
const {
|
|
59
|
+
children,
|
|
60
|
+
className,
|
|
61
|
+
description,
|
|
62
|
+
hideLabel = false,
|
|
63
|
+
loading,
|
|
64
|
+
checked: checkedProp,
|
|
65
|
+
defaultChecked,
|
|
66
|
+
position = "left",
|
|
67
|
+
...rest
|
|
68
|
+
} = props;
|
|
68
69
|
|
|
69
|
-
|
|
70
|
+
const Description = size === "medium" ? BodyShort : Detail;
|
|
70
71
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
const [checked, setChecked] = useState(
|
|
73
|
+
defaultChecked ?? checkedProp ?? false
|
|
74
|
+
);
|
|
74
75
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
checkedProp !== undefined && setChecked(checkedProp);
|
|
78
|
+
}, [checkedProp]);
|
|
78
79
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
81
|
+
setChecked(e.target.checked);
|
|
82
|
+
props.onChange && props.onChange(e);
|
|
83
|
+
};
|
|
83
84
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
85
|
+
return (
|
|
86
|
+
<div
|
|
87
|
+
className={cl(
|
|
88
|
+
"navds-switch",
|
|
89
|
+
props.className,
|
|
90
|
+
`navds-switch--${size}`,
|
|
91
|
+
`navds-switch--${position}`,
|
|
92
|
+
{
|
|
93
|
+
"navds-switch--loading": loading,
|
|
94
|
+
"navds-switch--disabled": inputProps.disabled ?? loading,
|
|
95
|
+
}
|
|
96
|
+
)}
|
|
97
|
+
>
|
|
98
|
+
<input
|
|
99
|
+
{...omit(rest, ["size"])}
|
|
100
|
+
{...omit(inputProps, ["aria-invalid", "aria-describedby"])}
|
|
101
|
+
disabled={inputProps.disabled ?? loading}
|
|
102
|
+
checked={checkedProp}
|
|
103
|
+
defaultChecked={defaultChecked}
|
|
104
|
+
ref={ref}
|
|
105
|
+
type="checkbox"
|
|
106
|
+
onChange={(e) => handleChange(e)}
|
|
107
|
+
className={cl(className, "navds-switch__input")}
|
|
108
|
+
/>
|
|
109
|
+
<span className="navds-switch__track">
|
|
110
|
+
<span className="navds-switch__thumb">
|
|
111
|
+
{loading ? (
|
|
112
|
+
<Loader size="xsmall" aria-live="polite" />
|
|
113
|
+
) : checked ? (
|
|
114
|
+
<SelectedIcon />
|
|
115
|
+
) : null}
|
|
116
|
+
</span>
|
|
115
117
|
</span>
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
</
|
|
137
|
-
</
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
118
|
+
<label htmlFor={inputProps.id} className="navds-switch__label-wrapper">
|
|
119
|
+
<div
|
|
120
|
+
className={cl("navds-switch__content", {
|
|
121
|
+
"navds-sr-only": hideLabel,
|
|
122
|
+
"navds-switch--with-description": !!description && !hideLabel,
|
|
123
|
+
})}
|
|
124
|
+
>
|
|
125
|
+
<BodyShort as="div" size={size} className="navds-switch__label">
|
|
126
|
+
{children}
|
|
127
|
+
</BodyShort>
|
|
128
|
+
{description && (
|
|
129
|
+
<Description
|
|
130
|
+
as="div"
|
|
131
|
+
size="small"
|
|
132
|
+
className="navds-switch__description"
|
|
133
|
+
>
|
|
134
|
+
{description}
|
|
135
|
+
</Description>
|
|
136
|
+
)}
|
|
137
|
+
</div>
|
|
138
|
+
</label>
|
|
139
|
+
</div>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
);
|
|
141
143
|
|
|
142
144
|
export default Switch;
|
package/src/form/TextField.tsx
CHANGED
|
@@ -34,93 +34,97 @@ export interface TextFieldProps
|
|
|
34
34
|
type?: "email" | "number" | "password" | "tel" | "text" | "url";
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
37
|
+
export const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
|
|
38
|
+
(props, ref) => {
|
|
39
|
+
const {
|
|
40
|
+
inputProps,
|
|
41
|
+
errorId,
|
|
42
|
+
showErrorMsg,
|
|
43
|
+
hasError,
|
|
44
|
+
size,
|
|
45
|
+
inputDescriptionId,
|
|
46
|
+
} = useFormField(props, "textField");
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
48
|
+
const {
|
|
49
|
+
label,
|
|
50
|
+
className,
|
|
51
|
+
description,
|
|
52
|
+
htmlSize,
|
|
53
|
+
hideLabel = false,
|
|
54
|
+
type = "text",
|
|
55
|
+
...rest
|
|
56
|
+
} = props;
|
|
56
57
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
>
|
|
69
|
-
<Label
|
|
70
|
-
htmlFor={inputProps.id}
|
|
71
|
-
size={size}
|
|
72
|
-
as="label"
|
|
73
|
-
className={cl("navds-text-field__label", {
|
|
74
|
-
"navds-sr-only": hideLabel,
|
|
75
|
-
})}
|
|
58
|
+
return (
|
|
59
|
+
<div
|
|
60
|
+
className={cl(
|
|
61
|
+
className,
|
|
62
|
+
"navds-form-field",
|
|
63
|
+
`navds-form-field--${size}`,
|
|
64
|
+
{
|
|
65
|
+
"navds-text-field--error": hasError,
|
|
66
|
+
"navds-text-field--disabled": !!inputProps.disabled,
|
|
67
|
+
}
|
|
68
|
+
)}
|
|
76
69
|
>
|
|
77
|
-
|
|
78
|
-
|
|
70
|
+
<Label
|
|
71
|
+
htmlFor={inputProps.id}
|
|
72
|
+
size={size}
|
|
73
|
+
as="label"
|
|
74
|
+
className={cl("navds-text-field__label", {
|
|
75
|
+
"navds-sr-only": hideLabel,
|
|
76
|
+
})}
|
|
77
|
+
>
|
|
78
|
+
{label}
|
|
79
|
+
</Label>
|
|
79
80
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
)}
|
|
107
|
-
<input
|
|
108
|
-
{...omit(rest, ["error", "errorId", "size"])}
|
|
109
|
-
{...inputProps}
|
|
110
|
-
ref={ref}
|
|
111
|
-
type={type}
|
|
112
|
-
className={cl(
|
|
113
|
-
"navds-text-field__input",
|
|
114
|
-
"navds-body-short",
|
|
115
|
-
`navds-body-${size ?? "medium"}`
|
|
81
|
+
{!!description && (
|
|
82
|
+
<>
|
|
83
|
+
{size === "medium" ? (
|
|
84
|
+
<BodyShort
|
|
85
|
+
className={cl("navds-text-field__description", {
|
|
86
|
+
"navds-sr-only": hideLabel,
|
|
87
|
+
})}
|
|
88
|
+
id={inputDescriptionId}
|
|
89
|
+
size="small"
|
|
90
|
+
as="div"
|
|
91
|
+
>
|
|
92
|
+
{description}
|
|
93
|
+
</BodyShort>
|
|
94
|
+
) : (
|
|
95
|
+
<Detail
|
|
96
|
+
className={cl("navds-text-field__description", {
|
|
97
|
+
"navds-sr-only": hideLabel,
|
|
98
|
+
})}
|
|
99
|
+
id={inputDescriptionId}
|
|
100
|
+
size="small"
|
|
101
|
+
as="div"
|
|
102
|
+
>
|
|
103
|
+
{description}
|
|
104
|
+
</Detail>
|
|
105
|
+
)}
|
|
106
|
+
</>
|
|
116
107
|
)}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
108
|
+
<input
|
|
109
|
+
{...omit(rest, ["error", "errorId", "size"])}
|
|
110
|
+
{...inputProps}
|
|
111
|
+
ref={ref}
|
|
112
|
+
type={type}
|
|
113
|
+
className={cl(
|
|
114
|
+
"navds-text-field__input",
|
|
115
|
+
"navds-body-short",
|
|
116
|
+
`navds-body-${size ?? "medium"}`
|
|
117
|
+
)}
|
|
118
|
+
size={htmlSize}
|
|
119
|
+
/>
|
|
120
|
+
<div id={errorId} aria-relevant="additions removals" aria-live="polite">
|
|
121
|
+
{showErrorMsg && (
|
|
122
|
+
<ErrorMessage size={size}>{props.error}</ErrorMessage>
|
|
123
|
+
)}
|
|
124
|
+
</div>
|
|
121
125
|
</div>
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
);
|
|
125
129
|
|
|
126
130
|
export default TextField;
|
package/src/form/Textarea.tsx
CHANGED
|
@@ -31,70 +31,72 @@ export interface CheckboxProps
|
|
|
31
31
|
indeterminate?: boolean;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
|
|
35
|
-
|
|
34
|
+
export const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
|
|
35
|
+
(props, ref) => {
|
|
36
|
+
const { inputProps, hasError, size } = useCheckbox(props);
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
const Description = size === "medium" ? BodyShort : Detail;
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
)}
|
|
50
|
-
>
|
|
51
|
-
<input
|
|
52
|
-
{...omit(props, [
|
|
53
|
-
"children",
|
|
54
|
-
"size",
|
|
55
|
-
"error",
|
|
56
|
-
"description",
|
|
57
|
-
"hideLabel",
|
|
58
|
-
"indeterminate",
|
|
59
|
-
])}
|
|
60
|
-
{...inputProps}
|
|
61
|
-
type="checkbox"
|
|
62
|
-
className="navds-checkbox__input"
|
|
63
|
-
aria-checked={props.indeterminate ? "mixed" : inputProps.checked}
|
|
64
|
-
ref={(el) => {
|
|
65
|
-
if (el) {
|
|
66
|
-
el.indeterminate = props.indeterminate ?? false;
|
|
40
|
+
return (
|
|
41
|
+
<div
|
|
42
|
+
className={cl(
|
|
43
|
+
props.className,
|
|
44
|
+
"navds-checkbox",
|
|
45
|
+
`navds-checkbox--${size}`,
|
|
46
|
+
{
|
|
47
|
+
"navds-checkbox--error": hasError,
|
|
48
|
+
"navds-checkbox--disabled": inputProps.disabled,
|
|
67
49
|
}
|
|
50
|
+
)}
|
|
51
|
+
>
|
|
52
|
+
<input
|
|
53
|
+
{...omit(props, [
|
|
54
|
+
"children",
|
|
55
|
+
"size",
|
|
56
|
+
"error",
|
|
57
|
+
"description",
|
|
58
|
+
"hideLabel",
|
|
59
|
+
"indeterminate",
|
|
60
|
+
])}
|
|
61
|
+
{...inputProps}
|
|
62
|
+
type="checkbox"
|
|
63
|
+
className="navds-checkbox__input"
|
|
64
|
+
aria-checked={props.indeterminate ? "mixed" : inputProps.checked}
|
|
65
|
+
ref={(el) => {
|
|
66
|
+
if (el) {
|
|
67
|
+
el.indeterminate = props.indeterminate ?? false;
|
|
68
|
+
}
|
|
68
69
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
70
|
+
if (typeof ref === "function") {
|
|
71
|
+
ref(el);
|
|
72
|
+
} else if (ref != null) {
|
|
73
|
+
ref.current = el;
|
|
74
|
+
}
|
|
75
|
+
}}
|
|
76
|
+
/>
|
|
77
|
+
<label htmlFor={inputProps.id} className="navds-checkbox__label">
|
|
78
|
+
<div
|
|
79
|
+
className={cl("navds-checkbox__content", {
|
|
80
|
+
"navds-sr-only": props.hideLabel,
|
|
81
|
+
})}
|
|
82
|
+
>
|
|
83
|
+
<BodyShort as="div" size={size}>
|
|
84
|
+
{props.children}
|
|
85
|
+
</BodyShort>
|
|
86
|
+
{props.description && (
|
|
87
|
+
<Description
|
|
88
|
+
as="div"
|
|
89
|
+
size="small"
|
|
90
|
+
className="navds-checkbox__description"
|
|
91
|
+
>
|
|
92
|
+
{props.description}
|
|
93
|
+
</Description>
|
|
94
|
+
)}
|
|
95
|
+
</div>
|
|
96
|
+
</label>
|
|
97
|
+
</div>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
);
|
|
99
101
|
|
|
100
102
|
export default Checkbox;
|
|
@@ -35,7 +35,10 @@ export interface CheckboxGroupProps
|
|
|
35
35
|
onChange?: (value: any[]) => void;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
const CheckboxGroup = forwardRef<
|
|
38
|
+
export const CheckboxGroup = forwardRef<
|
|
39
|
+
HTMLFieldSetElement,
|
|
40
|
+
CheckboxGroupProps
|
|
41
|
+
>(
|
|
39
42
|
(
|
|
40
43
|
{ value, defaultValue, onChange = () => {}, children, className, ...rest },
|
|
41
44
|
ref
|