@hashicorp/mds-react 0.9.12 → 0.9.14
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/components/accordion/item/index.js.map +1 -1
- package/components/accordion/style.module.scss +4 -4
- package/components/alert/alert.module.scss +2 -4
- package/components/alert/index.js.map +1 -1
- package/components/badge/index.js.map +1 -1
- package/components/badge/style.module.scss +1 -7
- package/components/badge-count/index.js.map +1 -1
- package/components/badge-count/style.module.scss +1 -6
- package/components/breadcrumbs/index.js.map +1 -1
- package/components/breadcrumbs/style.module.scss +2 -2
- package/components/button/button-primitive.js.map +1 -1
- package/components/button/styles.module.scss +9 -13
- package/components/card/index.js.map +1 -1
- package/components/code-block/code-block.module.scss +5 -11
- package/components/code-block/code-lines/utils/split-jsx-into-lines.js.map +1 -1
- package/components/code-block/hidden-copy-content/index.js.map +1 -1
- package/components/code-block/index.js.map +1 -1
- package/components/code-block/utils/parse-highlighted-lines.js.map +1 -1
- package/components/code-block/utils/shellwords.js.map +1 -1
- package/components/combo-box-primitive/index.js.map +1 -1
- package/components/dialog-primitive/index.js.map +1 -1
- package/components/disclosure-primitive/index.js.map +1 -1
- package/components/disclosure-primitive/use-disclosure-primitive.js.map +1 -1
- package/components/dismiss-button/styles.module.scss +1 -6
- package/components/dropdown/index.js.map +1 -1
- package/components/dropdown/list-item/styles.module.css +2 -6
- package/components/dropdown/list-item/title.js.map +1 -1
- package/components/dropdown/toggle-button/index.js.map +1 -1
- package/components/dropdown/toggle-button/styles.module.scss +5 -5
- package/components/flight-icon/index.js.map +1 -1
- package/components/form/checkbox/form-checkbox.module.css +4 -11
- package/components/form/file-input/form-file-input.module.scss +1 -1
- package/components/form/radio/form-radio.module.scss +2 -5
- package/components/form/radio-card/form-radio-card.module.css +1 -2
- package/components/form/radio-card/index.js.map +1 -1
- package/components/form/select/form-select.module.css +6 -14
- package/components/form/select/index.js.map +1 -1
- package/components/form/super-select/form-super-select.module.css +4 -10
- package/components/form/super-select/index.js.map +1 -1
- package/components/form/text-input/index.js.map +1 -1
- package/components/form/text-input/styles.module.css +7 -21
- package/components/form/textarea/form-textarea.module.css +1 -2
- package/components/form/textarea/index.js.map +1 -1
- package/components/form/toggle/form-toggle.module.scss +7 -20
- package/components/icon-tile/index.js.map +1 -1
- package/components/icon-tile/style.module.scss +3 -18
- package/components/index.d.ts +2 -0
- package/components/index.js +49 -45
- package/components/index.js.map +1 -1
- package/components/interactive/index.d.ts +2 -2
- package/components/interactive/index.js.map +1 -1
- package/components/legacy-button/index.js.map +1 -1
- package/components/legacy-button/utils.js.map +1 -1
- package/components/menu-primitive/index.js.map +1 -1
- package/components/menu-primitive/use-menu-primitive.js.map +1 -1
- package/components/modal/index.js.map +1 -1
- package/components/modal/use-modal.js.map +1 -1
- package/components/skeleton/index.d.ts +14 -0
- package/components/skeleton/index.js +30 -0
- package/components/skeleton/index.js.map +1 -0
- package/components/skeleton/skeleton-form/index.d.ts +7 -0
- package/components/skeleton/skeleton-form/index.js +19 -0
- package/components/skeleton/skeleton-form/index.js.map +1 -0
- package/components/skeleton/skeleton-form/skeleton-form.module.css +32 -0
- package/components/skeleton/skeleton-form/skeleton-form.module.css.js +11 -0
- package/components/skeleton/skeleton-form/skeleton-form.module.css.js.map +1 -0
- package/components/skeleton/skeleton.module.css +87 -0
- package/components/skeleton/skeleton.module.css.js +19 -0
- package/components/skeleton/skeleton.module.css.js.map +1 -0
- package/components/standalone-link/index.js.map +1 -1
- package/components/standalone-link/styles.module.scss +4 -6
- package/components/table/index.js.map +1 -1
- package/components/table/td.js.map +1 -1
- package/components/table/th.js.map +1 -1
- package/components/table/utils.js.map +1 -1
- package/components/tabs/index.js.map +1 -1
- package/components/tabs/tab-panel.js.map +1 -1
- package/components/tabs/tab.js.map +1 -1
- package/components/tabs/tabs.module.scss +11 -54
- package/components/tabs/use-tabs-context.js.map +1 -1
- package/components/text/index.js.map +1 -1
- package/components/visualizations/bar-chart/horizontal-chart/dataset-value/index.js +19 -18
- package/components/visualizations/bar-chart/horizontal-chart/dataset-value/index.js.map +1 -1
- package/components/visualizations/bar-chart/horizontal-chart/index.js +1 -1
- package/components/visualizations/bar-chart/horizontal-chart/index.js.map +1 -1
- package/components/visualizations/bar-chart/horizontal-chart/style.module.css +2 -2
- package/components/visualizations/bar-chart/style.module.css +2 -4
- package/components/visualizations/donut-chart/index.js +49 -48
- package/components/visualizations/donut-chart/index.js.map +1 -1
- package/components/visualizations/donut-chart/styles.module.css +2 -4
- package/index.js +107 -101
- package/index.js.map +1 -1
- package/package.json +8 -7
- package/patterns/card/style.module.css +0 -2
- package/patterns/card/unified-card/index.js.map +1 -1
- package/patterns/copy-button/index.d.ts +3 -3
- package/patterns/copy-button/index.js +17 -17
- package/patterns/copy-button/index.js.map +1 -1
- package/patterns/layout/layout.module.css +2 -8
- package/patterns/product-badge/style.module.css +1 -1
- package/patterns/related-content/style.module.css +1 -1
- package/style.css +1 -1
- package/styles/mixins/button.scss +18 -73
- package/styles/mixins/focus-ring.scss +1 -8
- package/{patterns/copy-button → utils}/clipboard.d.ts +5 -5
- package/{patterns/copy-button → utils}/clipboard.js +1 -1
- package/utils/clipboard.js.map +1 -0
- package/utils/get-contrast-yiq.js.map +1 -1
- package/utils/hooks/use-media-query/index.d.ts +1 -0
- package/utils/hooks/use-media-query/index.js +16 -0
- package/utils/hooks/use-media-query/index.js.map +1 -0
- package/utils/hooks/{use-screen-size.js → use-screen-size/index.js} +2 -2
- package/utils/hooks/use-screen-size/index.js.map +1 -0
- package/utils/i18n/constants/index.d.ts +14 -0
- package/utils/i18n/constants/index.js.map +1 -1
- package/utils/i18n/helpers/index.d.ts +1 -0
- package/utils/i18n/helpers/is-supported-local.d.ts +2 -0
- package/utils/i18n/helpers/{index.js → is-supported-local.js} +1 -1
- package/utils/i18n/helpers/is-supported-local.js.map +1 -0
- package/utils/i18n/helpers/locale-provider.d.ts +1 -1
- package/utils/i18n/helpers/locale-provider.js +1 -1
- package/utils/i18n/helpers/locale-provider.js.map +1 -1
- package/utils/i18n/helpers/to-smart-sentence-case.d.ts +1 -1
- package/utils/i18n/helpers/to-smart-sentence-case.js.map +1 -1
- package/utils/i18n/helpers/to-smart-title-case.d.ts +1 -1
- package/utils/i18n/helpers/to-smart-title-case.js.map +1 -1
- package/utils/i18n/helpers/use-locale.d.ts +1 -1
- package/utils/i18n/helpers/use-locale.js +6 -6
- package/utils/i18n/helpers/use-locale.js.map +1 -1
- package/utils/i18n/index.d.ts +1 -1
- package/utils/i18n/index.js.map +1 -1
- package/utils/i18n/types.d.ts +2 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.js +8 -6
- package/utils/index.js.map +1 -1
- package/utils/make-normalizer/index.js.map +1 -1
- package/utils/mds-context/index.js.map +1 -1
- package/hooks/use-media-query/index.js +0 -16
- package/hooks/use-media-query/index.js.map +0 -1
- package/patterns/copy-button/clipboard.js.map +0 -1
- package/utils/hooks/use-screen-size.js.map +0 -1
- package/utils/i18n/helpers/index.js.map +0 -1
- /package/utils/hooks/{use-screen-size.d.ts → use-screen-size/index.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/form/super-select/index.tsx"],"sourcesContent":["import { useId } from 'react'\nimport classNames from 'classnames'\nimport { Field } from '../field'\nimport { FlightIcon } from '../../flight-icon'\nimport { ComboBox } from '../../combo-box-primitive'\nimport type {\n\tTComboBoxItem,\n\tComboBoxSearchInputProps,\n\tComboBoxListProps,\n} from '../../combo-box-primitive'\nimport type { FieldProps } from '../field'\nimport s from './form-super-select.module.css'\n\ntype SuperSelectRootProps = {\n\tchildren: React.ReactNode\n\tonChangeSelectedOption?: (option: TComboBoxItem) => void\n\tonChangeVFocusedOption?: (option: TComboBoxItem) => void\n}\n\nconst SuperSelectRoot = ({\n\tchildren,\n\tonChangeSelectedOption,\n\tonChangeVFocusedOption,\n}: SuperSelectRootProps) => {\n\treturn (\n\t\t<ComboBox.Root\n\t\t\tonChangeSelectedOption={onChangeSelectedOption}\n\t\t\tonChangeVFocusedOption={onChangeVFocusedOption}\n\t\t>\n\t\t\t<div className={s.root}>{children}</div>\n\t\t</ComboBox.Root>\n\t)\n}\n\ninterface SuperSelectTriggerProps {\n\tclassName?: string\n}\n\nconst SuperSelectTrigger = ({ className }: SuperSelectTriggerProps) => {\n\treturn (\n\t\t<ComboBox.Trigger className={classNames(s.trigger, className)}>\n\t\t\t<ComboBox.Value />\n\t\t</ComboBox.Trigger>\n\t)\n}\n\ntype SuperSelectPopoverProps = {\n\tchildren: React.ReactNode\n}\n\nconst SuperSelectPopover = ({ children }: SuperSelectPopoverProps) => {\n\treturn <ComboBox.Popover className={s.popover}>{children}</ComboBox.Popover>\n}\n\ntype SuperSelectSearchInputProps = ComboBoxSearchInputProps\n\nconst SuperSelectSearchInput = ({\n\tplaceholder = 'Search',\n\tvalue,\n\tonChange,\n\tonBlur,\n}: SuperSelectSearchInputProps) => {\n\treturn (\n\t\t<div className={s['search-input-wrapper']}>\n\t\t\t<ComboBox.SearchInput\n\t\t\t\tplaceholder={placeholder}\n\t\t\t\tvalue={value}\n\t\t\t\tonChange={onChange}\n\t\t\t\tonBlur={onBlur}\n\t\t\t/>\n\t\t</div>\n\t)\n}\n\ntype SuperSelectListProps = ComboBoxListProps\n\nconst SuperSelectList = ({\n\tlabel,\n\tchildren,\n\tclassName,\n\tmaxHeight,\n\tonScroll,\n}: SuperSelectListProps) => {\n\treturn (\n\t\t<ComboBox.List\n\t\t\tlabel={label}\n\t\t\tclassName={classNames(s.list, className)}\n\t\t\tmaxHeight={maxHeight}\n\t\t\tonScroll={onScroll}\n\t\t>\n\t\t\t{children}\n\t\t</ComboBox.List>\n\t)\n}\n\ninterface SuperSelectOptionProps extends TComboBoxItem {\n\tisLoading?: boolean\n\t/**\n\t * Leading icon. Acceptable value: any [icon](https://helios.hashicorp.design/icons/library) name.\n\t */\n\ticon?: string\n\t/**\n\t * Trailing icon. Acceptable value: any [icon](https://helios.hashicorp.design/icons/library) name.\n\t */\n\ttrailingIcon?: string\n\tclassName?: string\n}\n\nconst SuperSelectOption = ({\n\tvalue,\n\tlabel,\n\tisLoading,\n\ticon,\n\tclassName,\n\ttrailingIcon,\n}: SuperSelectOptionProps) => {\n\treturn (\n\t\t<ComboBox.Item\n\t\t\tvalue={value}\n\t\t\tlabel={label}\n\t\t\tclassName={classNames(s.option, className)}\n\t\t>\n\t\t\t{isLoading ? (\n\t\t\t\t<div className={s['interactive-loading-wrapper']}>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t\ts['interactive-icon'],\n\t\t\t\t\t\t\ts['interactive-icon-leading']\n\t\t\t\t\t\t)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<FlightIcon name=\"loading\" isInlineBlock={false} />\n\t\t\t\t\t</div>\n\t\t\t\t\t<span className={s['option-text']}>{label}</span>\n\t\t\t\t</div>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t{icon && (\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t\t\ts['interactive-icon'],\n\t\t\t\t\t\t\t\ts['interactive-icon-leading']\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<FlightIcon name={icon} isInlineBlock={false} />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t)}\n\t\t\t\t\t<span className={s['option-text']}>{label}</span>\n\t\t\t\t\t{trailingIcon && (\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t\t\ts['interactive-icon'],\n\t\t\t\t\t\t\t\ts['interactive-icon-trailing']\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<FlightIcon name={trailingIcon} isInlineBlock={false} />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t)}\n\t\t\t\t</>\n\t\t\t)}\n\t\t</ComboBox.Item>\n\t)\n}\n\ntype TSuperSelectOption = TComboBoxItem\n\nconst SuperSelect = Object.freeze({\n\tRoot: SuperSelectRoot,\n\tTrigger: SuperSelectTrigger,\n\tPopover: SuperSelectPopover,\n\t/**\n\t * Note that this only acts as a view layer,\n\t * it does not participate in the search logic.\n\t * This is left for the consumer to implement.\n\t */\n\tSearchInput: SuperSelectSearchInput,\n\tList: SuperSelectList,\n\tOption: SuperSelectOption,\n})\n\ninterface SuperSelectFieldProps\n\textends Omit<FieldProps, 'children' | 'id' | 'layout'> {\n\tid?: string\n\toptions: SuperSelectOptionProps[]\n\t/**\n\t * @default false\n\t */\n\tsearchProps?: SuperSelectSearchInputProps\n\t/**\n\t * Used for assistive technologies,\n\t * indicate the category of options you are presenting\n\t * eg. Schools | Languages | Countries\n\t */\n\tlistLabel: string\n\t/**\n\t * Is actually a `max-height` for the list.\n\t * Pass this when you have a lot of options and want to limit the height of the list.\n\t * @default `240px`\n\t */\n\tlistHeight?: `${number}em` | `${number}px` | `${number}%`\n\t/**\n\t * Callback for when the list is scrolled.\n\t * This is useful for implementing pagination, recommended for large lists.\n\t */\n\tonScroll?: (e: React.UIEvent<HTMLUListElement>) => void\n\tonChangeSelectedOption?: (option: SuperSelectOptionProps) => void\n\tonChangeVFocusedOption?: (option: SuperSelectOptionProps) => void\n\tonSearchBlur?: () => void\n}\n\n/**\n * Convenience component for using {@link SuperSelect}\n * with a {@link Field} component. This should cover most use cases\n * unless you need advanced patterns like pagination, async options, etc. outside of a form context.\n */\nconst SuperSelectField = ({\n\tlabel,\n\thelperText,\n\terror,\n\tid,\n\tsearchProps,\n\toptions,\n\tlistLabel,\n\tlistHeight = '240px',\n\tonScroll,\n\tonChangeSelectedOption,\n\tonChangeVFocusedOption,\n\tonSearchBlur,\n\t...rest\n}: SuperSelectFieldProps) => {\n\tconst genID = useId()\n\tconst fieldId = id ?? genID\n\n\treturn (\n\t\t<Field\n\t\t\tlabel={label}\n\t\t\thelperText={helperText}\n\t\t\terror={error}\n\t\t\tid={fieldId}\n\t\t\tlayout={'vertical'}\n\t\t\t{...rest}\n\t\t>\n\t\t\t<SuperSelect.Root\n\t\t\t\tonChangeSelectedOption={onChangeSelectedOption}\n\t\t\t\tonChangeVFocusedOption={onChangeVFocusedOption}\n\t\t\t>\n\t\t\t\t<SuperSelect.Trigger />\n\t\t\t\t<SuperSelect.Popover>\n\t\t\t\t\t{searchProps && (\n\t\t\t\t\t\t<SuperSelect.SearchInput\n\t\t\t\t\t\t\tplaceholder={searchProps.placeholder}\n\t\t\t\t\t\t\tvalue={searchProps.value}\n\t\t\t\t\t\t\tonChange={searchProps.onChange}\n\t\t\t\t\t\t\tonBlur={onSearchBlur}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t\t<SuperSelect.List\n\t\t\t\t\t\tlabel={listLabel}\n\t\t\t\t\t\tmaxHeight={listHeight}\n\t\t\t\t\t\tonScroll={onScroll}\n\t\t\t\t\t>\n\t\t\t\t\t\t{options.map((option) => (\n\t\t\t\t\t\t\t<SuperSelect.Option key={option.value} {...option} />\n\t\t\t\t\t\t))}\n\t\t\t\t\t</SuperSelect.List>\n\t\t\t\t</SuperSelect.Popover>\n\t\t\t</SuperSelect.Root>\n\t\t</Field>\n\t)\n}\n\nSuperSelectField.displayName = 'SuperSelectField'\n\nexport type {\n\tTSuperSelectOption,\n\tSuperSelectOptionProps,\n\tSuperSelectSearchInputProps,\n}\n\nexport { SuperSelectField }\n"],"names":["SuperSelectRoot","children","onChangeSelectedOption","onChangeVFocusedOption","jsx","ComboBox","s","SuperSelectTrigger","className","classNames","SuperSelectPopover","SuperSelectSearchInput","placeholder","value","onChange","onBlur","SuperSelectList","label","maxHeight","onScroll","SuperSelectOption","isLoading","icon","trailingIcon","jsxs","FlightIcon","Fragment","SuperSelect","SuperSelectField","helperText","error","id","searchProps","options","listLabel","listHeight","onSearchBlur","rest","genID","useId","Field","option"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/form/super-select/index.tsx"],"sourcesContent":["import { useId } from 'react'\nimport classNames from 'classnames'\nimport { Field } from '../field'\nimport { FlightIcon } from '../../flight-icon'\nimport { ComboBox } from '../../combo-box-primitive'\nimport type {\n\tTComboBoxItem,\n\tComboBoxSearchInputProps,\n\tComboBoxListProps,\n} from '../../combo-box-primitive'\nimport type { FieldProps } from '../field'\nimport s from './form-super-select.module.css'\n\ntype SuperSelectRootProps = {\n\tchildren: React.ReactNode\n\tonChangeSelectedOption?: (option: TComboBoxItem) => void\n\tonChangeVFocusedOption?: (option: TComboBoxItem) => void\n}\n\nconst SuperSelectRoot = ({\n\tchildren,\n\tonChangeSelectedOption,\n\tonChangeVFocusedOption,\n}: SuperSelectRootProps) => {\n\treturn (\n\t\t<ComboBox.Root\n\t\t\tonChangeSelectedOption={onChangeSelectedOption}\n\t\t\tonChangeVFocusedOption={onChangeVFocusedOption}\n\t\t>\n\t\t\t<div className={s.root}>{children}</div>\n\t\t</ComboBox.Root>\n\t)\n}\n\ninterface SuperSelectTriggerProps {\n\tclassName?: string\n}\n\nconst SuperSelectTrigger = ({ className }: SuperSelectTriggerProps) => {\n\treturn (\n\t\t<ComboBox.Trigger className={classNames(s.trigger, className)}>\n\t\t\t<ComboBox.Value />\n\t\t</ComboBox.Trigger>\n\t)\n}\n\ntype SuperSelectPopoverProps = {\n\tchildren: React.ReactNode\n}\n\nconst SuperSelectPopover = ({ children }: SuperSelectPopoverProps) => {\n\treturn <ComboBox.Popover className={s.popover}>{children}</ComboBox.Popover>\n}\n\ntype SuperSelectSearchInputProps = ComboBoxSearchInputProps\n\nconst SuperSelectSearchInput = ({\n\tplaceholder = 'Search',\n\tvalue,\n\tonChange,\n\tonBlur,\n}: SuperSelectSearchInputProps) => {\n\treturn (\n\t\t<div className={s['search-input-wrapper']}>\n\t\t\t<ComboBox.SearchInput\n\t\t\t\tplaceholder={placeholder}\n\t\t\t\tvalue={value}\n\t\t\t\tonChange={onChange}\n\t\t\t\tonBlur={onBlur}\n\t\t\t/>\n\t\t</div>\n\t)\n}\n\ntype SuperSelectListProps = ComboBoxListProps\n\nconst SuperSelectList = ({\n\tlabel,\n\tchildren,\n\tclassName,\n\tmaxHeight,\n\tonScroll,\n}: SuperSelectListProps) => {\n\treturn (\n\t\t<ComboBox.List\n\t\t\tlabel={label}\n\t\t\tclassName={classNames(s.list, className)}\n\t\t\tmaxHeight={maxHeight}\n\t\t\tonScroll={onScroll}\n\t\t>\n\t\t\t{children}\n\t\t</ComboBox.List>\n\t)\n}\n\ninterface SuperSelectOptionProps extends TComboBoxItem {\n\tisLoading?: boolean\n\t/**\n\t * Leading icon. Acceptable value: any [icon](https://helios.hashicorp.design/icons/library) name.\n\t */\n\ticon?: string\n\t/**\n\t * Trailing icon. Acceptable value: any [icon](https://helios.hashicorp.design/icons/library) name.\n\t */\n\ttrailingIcon?: string\n\tclassName?: string\n}\n\nconst SuperSelectOption = ({\n\tvalue,\n\tlabel,\n\tisLoading,\n\ticon,\n\tclassName,\n\ttrailingIcon,\n}: SuperSelectOptionProps) => {\n\treturn (\n\t\t<ComboBox.Item\n\t\t\tvalue={value}\n\t\t\tlabel={label}\n\t\t\tclassName={classNames(s.option, className)}\n\t\t>\n\t\t\t{isLoading ? (\n\t\t\t\t<div className={s['interactive-loading-wrapper']}>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t\ts['interactive-icon'],\n\t\t\t\t\t\t\ts['interactive-icon-leading'],\n\t\t\t\t\t\t)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<FlightIcon name=\"loading\" isInlineBlock={false} />\n\t\t\t\t\t</div>\n\t\t\t\t\t<span className={s['option-text']}>{label}</span>\n\t\t\t\t</div>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t{icon && (\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t\t\ts['interactive-icon'],\n\t\t\t\t\t\t\t\ts['interactive-icon-leading'],\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<FlightIcon name={icon} isInlineBlock={false} />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t)}\n\t\t\t\t\t<span className={s['option-text']}>{label}</span>\n\t\t\t\t\t{trailingIcon && (\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t\t\ts['interactive-icon'],\n\t\t\t\t\t\t\t\ts['interactive-icon-trailing'],\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<FlightIcon name={trailingIcon} isInlineBlock={false} />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t)}\n\t\t\t\t</>\n\t\t\t)}\n\t\t</ComboBox.Item>\n\t)\n}\n\ntype TSuperSelectOption = TComboBoxItem\n\nconst SuperSelect = Object.freeze({\n\tRoot: SuperSelectRoot,\n\tTrigger: SuperSelectTrigger,\n\tPopover: SuperSelectPopover,\n\t/**\n\t * Note that this only acts as a view layer,\n\t * it does not participate in the search logic.\n\t * This is left for the consumer to implement.\n\t */\n\tSearchInput: SuperSelectSearchInput,\n\tList: SuperSelectList,\n\tOption: SuperSelectOption,\n})\n\ninterface SuperSelectFieldProps extends Omit<\n\tFieldProps,\n\t'children' | 'id' | 'layout'\n> {\n\tid?: string\n\toptions: SuperSelectOptionProps[]\n\t/**\n\t * @default false\n\t */\n\tsearchProps?: SuperSelectSearchInputProps\n\t/**\n\t * Used for assistive technologies,\n\t * indicate the category of options you are presenting\n\t * eg. Schools | Languages | Countries\n\t */\n\tlistLabel: string\n\t/**\n\t * Is actually a `max-height` for the list.\n\t * Pass this when you have a lot of options and want to limit the height of the list.\n\t * @default `240px`\n\t */\n\tlistHeight?: `${number}em` | `${number}px` | `${number}%`\n\t/**\n\t * Callback for when the list is scrolled.\n\t * This is useful for implementing pagination, recommended for large lists.\n\t */\n\tonScroll?: (e: React.UIEvent<HTMLUListElement>) => void\n\tonChangeSelectedOption?: (option: SuperSelectOptionProps) => void\n\tonChangeVFocusedOption?: (option: SuperSelectOptionProps) => void\n\tonSearchBlur?: () => void\n}\n\n/**\n * Convenience component for using {@link SuperSelect}\n * with a {@link Field} component. This should cover most use cases\n * unless you need advanced patterns like pagination, async options, etc. outside of a form context.\n */\nconst SuperSelectField = ({\n\tlabel,\n\thelperText,\n\terror,\n\tid,\n\tsearchProps,\n\toptions,\n\tlistLabel,\n\tlistHeight = '240px',\n\tonScroll,\n\tonChangeSelectedOption,\n\tonChangeVFocusedOption,\n\tonSearchBlur,\n\t...rest\n}: SuperSelectFieldProps) => {\n\tconst genID = useId()\n\tconst fieldId = id ?? genID\n\n\treturn (\n\t\t<Field\n\t\t\tlabel={label}\n\t\t\thelperText={helperText}\n\t\t\terror={error}\n\t\t\tid={fieldId}\n\t\t\tlayout={'vertical'}\n\t\t\t{...rest}\n\t\t>\n\t\t\t<SuperSelect.Root\n\t\t\t\tonChangeSelectedOption={onChangeSelectedOption}\n\t\t\t\tonChangeVFocusedOption={onChangeVFocusedOption}\n\t\t\t>\n\t\t\t\t<SuperSelect.Trigger />\n\t\t\t\t<SuperSelect.Popover>\n\t\t\t\t\t{searchProps && (\n\t\t\t\t\t\t<SuperSelect.SearchInput\n\t\t\t\t\t\t\tplaceholder={searchProps.placeholder}\n\t\t\t\t\t\t\tvalue={searchProps.value}\n\t\t\t\t\t\t\tonChange={searchProps.onChange}\n\t\t\t\t\t\t\tonBlur={onSearchBlur}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t\t<SuperSelect.List\n\t\t\t\t\t\tlabel={listLabel}\n\t\t\t\t\t\tmaxHeight={listHeight}\n\t\t\t\t\t\tonScroll={onScroll}\n\t\t\t\t\t>\n\t\t\t\t\t\t{options.map((option) => (\n\t\t\t\t\t\t\t<SuperSelect.Option key={option.value} {...option} />\n\t\t\t\t\t\t))}\n\t\t\t\t\t</SuperSelect.List>\n\t\t\t\t</SuperSelect.Popover>\n\t\t\t</SuperSelect.Root>\n\t\t</Field>\n\t)\n}\n\nSuperSelectField.displayName = 'SuperSelectField'\n\nexport type {\n\tTSuperSelectOption,\n\tSuperSelectOptionProps,\n\tSuperSelectSearchInputProps,\n}\n\nexport { SuperSelectField }\n"],"names":["SuperSelectRoot","children","onChangeSelectedOption","onChangeVFocusedOption","jsx","ComboBox","s","SuperSelectTrigger","className","classNames","SuperSelectPopover","SuperSelectSearchInput","placeholder","value","onChange","onBlur","SuperSelectList","label","maxHeight","onScroll","SuperSelectOption","isLoading","icon","trailingIcon","jsxs","FlightIcon","Fragment","SuperSelect","SuperSelectField","helperText","error","id","searchProps","options","listLabel","listHeight","onSearchBlur","rest","genID","useId","Field","option"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/form/text-input/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport type { HTMLInputTypeAttribute, HTMLProps, ReactNode } from 'react'\nimport { useId } from 'react'\nimport { Field } from '../field'\nimport s from './styles.module.css'\n\ninterface TextInputBaseProps {\n\t/**\n\t * Sets the native HTML `type` of the `<input>`.\n\t */\n\ttype?: HTMLInputTypeAttribute\n\n\t/**\n\t * Applies an “invalid” appearance to the control but doesn’t modify its logical validity.\n\t */\n\tisInvalid?: boolean\n\n\t/**\n\t * When true, it shows a loading indicator instead of a magnifying glass; only applicable when `type=\"search\"`.\n\t */\n\tisLoading?: boolean\n\tisRequired?: boolean\n\tclassName?: string\n\tid?: string\n\n\t/**\n\t * Can be used to supply any props that the native `<input>` element supports (such as `value`, `placeholder`, in addition to events like `onChange` and `onBlur`)\n\t */\n\tfield: HTMLProps<HTMLInputElement>\n\n\t/**\n\t * Sets the size of the input to match either medium Buttons or large Buttons.\n\t */\n\tsize?: 'medium' | 'large'\n\terror?: ReactNode\n\tdisabled?: boolean\n}\n\nconst TextInputBase = ({\n\ttype,\n\tisInvalid,\n\tisLoading,\n\tisRequired,\n\tclassName,\n\tid,\n\tfield,\n\tsize = 'medium',\n\terror,\n\t...rest\n}: TextInputBaseProps) => {\n\tconst generatedId = useId()\n\tconst inputId = id ?? generatedId\n\n\treturn (\n\t\t<input\n\t\t\tid={inputId}\n\t\t\ttype={type}\n\t\t\tclassName={classNames(\n\t\t\t\ts['text-input'],\n\t\t\t\ts[`size-${size}`],\n\t\t\t\t{\n\t\t\t\t\t[s['invalid']]: isInvalid,\n\t\t\t\t\t[s['loading']]: isLoading,\n\t\t\t\t},\n\t\t\t\tclassName
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/form/text-input/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport type { HTMLInputTypeAttribute, HTMLProps, ReactNode } from 'react'\nimport { useId } from 'react'\nimport { Field } from '../field'\nimport s from './styles.module.css'\n\ninterface TextInputBaseProps {\n\t/**\n\t * Sets the native HTML `type` of the `<input>`.\n\t */\n\ttype?: HTMLInputTypeAttribute\n\n\t/**\n\t * Applies an “invalid” appearance to the control but doesn’t modify its logical validity.\n\t */\n\tisInvalid?: boolean\n\n\t/**\n\t * When true, it shows a loading indicator instead of a magnifying glass; only applicable when `type=\"search\"`.\n\t */\n\tisLoading?: boolean\n\tisRequired?: boolean\n\tclassName?: string\n\tid?: string\n\n\t/**\n\t * Can be used to supply any props that the native `<input>` element supports (such as `value`, `placeholder`, in addition to events like `onChange` and `onBlur`)\n\t */\n\tfield: HTMLProps<HTMLInputElement>\n\n\t/**\n\t * Sets the size of the input to match either medium Buttons or large Buttons.\n\t */\n\tsize?: 'medium' | 'large'\n\terror?: ReactNode\n\tdisabled?: boolean\n}\n\nconst TextInputBase = ({\n\ttype,\n\tisInvalid,\n\tisLoading,\n\tisRequired,\n\tclassName,\n\tid,\n\tfield,\n\tsize = 'medium',\n\terror,\n\t...rest\n}: TextInputBaseProps) => {\n\tconst generatedId = useId()\n\tconst inputId = id ?? generatedId\n\n\treturn (\n\t\t<input\n\t\t\tid={inputId}\n\t\t\ttype={type}\n\t\t\tclassName={classNames(\n\t\t\t\ts['text-input'],\n\t\t\t\ts[`size-${size}`],\n\t\t\t\t{\n\t\t\t\t\t[s['invalid']]: isInvalid,\n\t\t\t\t\t[s['loading']]: isLoading,\n\t\t\t\t},\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\trequired={isRequired}\n\t\t\taria-describedby={`${error ? 'error' : 'helper-text'}-${id}`}\n\t\t\t{...field}\n\t\t\t{...rest}\n\t\t/>\n\t)\n}\n\nTextInputBase.displayName = 'TextInputBase'\n\ninterface TextInputProps {\n\t/**\n\t * When provided, appends a badge next to the label text.\n\t */\n\tbadgeText?: string\n\n\t/**\n\t * Sets the native HTML `type` of the `<input>`.\n\t */\n\ttype?: HTMLInputTypeAttribute\n\n\t/**\n\t * Applies an “invalid” appearance to the control but doesn’t modify its logical validity.\n\t */\n\tisInvalid?: boolean\n\n\t/**\n\t * When true, it shows a loading indicator instead of a magnifying glass; only applicable when `type=\"search\"`.\n\t */\n\tisLoading?: boolean\n\n\t/**\n\t * Appends a `Required` indicator next to the label text and sets the `required` attribute on the control when user input is required.\n\t */\n\tisRequired?: boolean\n\n\t/**\n\t * Appends an `Optional` indicator next to the label text when user input is optional.\n\t */\n\tisOptional?: boolean\n\n\t/**\n\t * Input control’s ID attribute.\n\t *\n\t * By default, the ID is automatically generated by the component. Use this argument to pass a custom ID.\n\t */\n\tid?: string\n\n\t/**\n\t * Container that renders its content inside the `<label>` element. The content can be a simple string or a `ReactNode`, in which case it inherits the text style.\n\t *\n\t * The `for` attribute of the label is automatically generated using the `controlId` value of the control.\n\t */\n\tlabel?: ReactNode\n\n\t/**\n\t * Container that renders its content inside the \"helper text\" block. The content can be a simple string or a `ReactNode`, in which case it inherits the text style.\n\t *\n\t * The `id` attribute of the message is automatically generated using the `controlId` value of the control.\n\t */\n\thelperText?: ReactNode\n\n\t/**\n\t * Container that renders its content inside the \"error\" block. The content can be a simple string or a `ReactNode`, in which case it inherits the text style.\n\t *\n\t * The `id` attribute of the error message is automatically generated using the `controlId` value of the control.\n\t */\n\terror?: ReactNode\n\n\t/**\n\t * Can be used to supply any props that the native `<input>` element supports (such as `value`, `placeholder`, in addition to events like `onChange` and `onBlur`)\n\t */\n\tfield: HTMLProps<HTMLInputElement>\n\tclassName?: string\n\n\t/**\n\t * Sets the size of the input to match either medium Buttons or large Buttons.\n\t */\n\tsize?: 'medium' | 'large'\n\tdisabled?: boolean\n}\n\nconst TextInput = ({\n\tbadgeText,\n\ttype = 'text',\n\tisInvalid,\n\tisLoading,\n\tisRequired,\n\tisOptional,\n\tid,\n\tlabel,\n\thelperText,\n\terror,\n\tfield,\n\tclassName,\n\tsize = 'medium',\n\t...rest\n}: TextInputProps) => {\n\tconst generatedId = useId()\n\tconst inputId = id ?? generatedId\n\n\treturn (\n\t\t<Field\n\t\t\tlabel={label}\n\t\t\tbadgeText={badgeText}\n\t\t\thelperText={helperText}\n\t\t\terror={error}\n\t\t\tisRequired={isRequired}\n\t\t\tisOptional={isOptional}\n\t\t\tid={inputId}\n\t\t\tlayout=\"vertical\"\n\t\t\tclassName={className}\n\t\t>\n\t\t\t<TextInputBase\n\t\t\t\tid={inputId}\n\t\t\t\ttype={type}\n\t\t\t\tisInvalid={isInvalid}\n\t\t\t\tisLoading={isLoading}\n\t\t\t\tisRequired={isRequired}\n\t\t\t\tfield={field}\n\t\t\t\tsize={size}\n\t\t\t\t{...rest}\n\t\t\t/>\n\t\t</Field>\n\t)\n}\n\nTextInput.displayName = 'TextInput'\n\nexport type { TextInputBaseProps, TextInputProps }\nexport { TextInputBase, TextInput }\n"],"names":["TextInputBase","type","isInvalid","isLoading","isRequired","className","id","field","size","error","rest","generatedId","useId","jsx","classNames","s","TextInput","badgeText","isOptional","label","helperText","inputId","Field"],"mappings":";;;;;AAsCA,MAAMA,IAAgB,CAAC;AAAA,EACtB,MAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,IAAAC;AAAA,EACA,OAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,OAAAC;AAAA,EACA,GAAGC;AACJ,MAA0B;AACzB,QAAMC,IAAcC,EAAA;AAGpB,SACC,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,IAJcP,KAAMK;AAAA,MAKpB,MAAAV;AAAA,MACA,WAAWa;AAAA,QACVC,EAAE,YAAY;AAAA,QACdA,EAAE,QAAQP,CAAI,EAAE;AAAA,QAChB;AAAA,UACC,CAACO,EAAE,OAAU,GAAGb;AAAA,UAChB,CAACa,EAAE,OAAU,GAAGZ;AAAA,QAAA;AAAA,QAEjBE;AAAA,MAAA;AAAA,MAED,UAAUD;AAAA,MACV,oBAAkB,GAAGK,IAAQ,UAAU,aAAa,IAAIH,CAAE;AAAA,MACzD,GAAGC;AAAA,MACH,GAAGG;AAAA,IAAA;AAAA,EAAA;AAGP;AAEAV,EAAc,cAAc;AA0E5B,MAAMgB,IAAY,CAAC;AAAA,EAClB,WAAAC;AAAA,EACA,MAAAhB,IAAO;AAAA,EACP,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAc;AAAA,EACA,IAAAZ;AAAA,EACA,OAAAa;AAAA,EACA,YAAAC;AAAA,EACA,OAAAX;AAAA,EACA,OAAAF;AAAA,EACA,WAAAF;AAAA,EACA,MAAAG,IAAO;AAAA,EACP,GAAGE;AACJ,MAAsB;AACrB,QAAMC,IAAcC,EAAA,GACdS,IAAUf,KAAMK;AAEtB,SACC,gBAAAE;AAAA,IAACS;AAAA,IAAA;AAAA,MACA,OAAAH;AAAA,MACA,WAAAF;AAAA,MACA,YAAAG;AAAA,MACA,OAAAX;AAAA,MACA,YAAAL;AAAA,MACA,YAAAc;AAAA,MACA,IAAIG;AAAA,MACJ,QAAO;AAAA,MACP,WAAAhB;AAAA,MAEA,UAAA,gBAAAQ;AAAA,QAACb;AAAA,QAAA;AAAA,UACA,IAAIqB;AAAA,UACJ,MAAApB;AAAA,UACA,WAAAC;AAAA,UACA,WAAAC;AAAA,UACA,YAAAC;AAAA,UACA,OAAAG;AAAA,UACA,MAAAC;AAAA,UACC,GAAGE;AAAA,QAAA;AAAA,MAAA;AAAA,IACL;AAAA,EAAA;AAGH;AAEAM,EAAU,cAAc;"}
|
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
padding: var(--mds-form-control-padding);
|
|
6
6
|
color: var(--mds-form-control-base-foreground-value-color);
|
|
7
7
|
background-color: var(--mds-form-control-base-surface-color-default);
|
|
8
|
-
border: var(--mds-form-control-border-width) solid
|
|
9
|
-
var(--mds-form-control-base-border-color-default);
|
|
8
|
+
border: var(--mds-form-control-border-width) solid var(--mds-form-control-base-border-color-default);
|
|
10
9
|
border-radius: var(--mds-form-control-border-radius);
|
|
11
10
|
box-shadow: var(--mds-elevation-inset-box-shadow);
|
|
12
11
|
|
|
@@ -95,9 +94,7 @@
|
|
|
95
94
|
&[type='date'],
|
|
96
95
|
&[type='datetime-local'] {
|
|
97
96
|
&::-webkit-calendar-picker-indicator {
|
|
98
|
-
background-image: var(
|
|
99
|
-
--mds-form-text-input-background-image-data-url-date
|
|
100
|
-
);
|
|
97
|
+
background-image: var(--mds-form-text-input-background-image-data-url-date);
|
|
101
98
|
background-position: center center;
|
|
102
99
|
background-size: var(--mds-form-text-input-background-image-size);
|
|
103
100
|
}
|
|
@@ -105,9 +102,7 @@
|
|
|
105
102
|
|
|
106
103
|
&[type='time'] {
|
|
107
104
|
&::-webkit-calendar-picker-indicator {
|
|
108
|
-
background-image: var(
|
|
109
|
-
--mds-form-text-input-background-image-data-url-time
|
|
110
|
-
);
|
|
105
|
+
background-image: var(--mds-form-text-input-background-image-data-url-time);
|
|
111
106
|
background-position: center center;
|
|
112
107
|
background-size: var(--mds-form-text-input-background-image-size);
|
|
113
108
|
}
|
|
@@ -116,31 +111,22 @@
|
|
|
116
111
|
/* SEARCH */
|
|
117
112
|
&[type='search'] {
|
|
118
113
|
padding-left: calc(var(--mds-form-control-padding) + 24px);
|
|
119
|
-
background-image: var(
|
|
120
|
-
--mds-form-text-input-background-image-data-url-search
|
|
121
|
-
);
|
|
114
|
+
background-image: var(--mds-form-text-input-background-image-data-url-search);
|
|
122
115
|
background-repeat: no-repeat;
|
|
123
|
-
background-position: var(
|
|
124
|
-
--mds-form-text-input-background-image-position-x
|
|
125
|
-
)
|
|
126
|
-
50%;
|
|
116
|
+
background-position: var(--mds-form-text-input-background-image-position-x) 50%;
|
|
127
117
|
background-size: var(--mds-form-text-input-background-image-size);
|
|
128
118
|
|
|
129
119
|
&::-webkit-search-cancel-button {
|
|
130
120
|
width: var(--mds-form-text-input-background-image-size);
|
|
131
121
|
height: var(--mds-form-text-input-background-image-size);
|
|
132
|
-
background-image: var(
|
|
133
|
-
--mds-form-text-input-background-image-data-url-search-cancel
|
|
134
|
-
);
|
|
122
|
+
background-image: var(--mds-form-text-input-background-image-data-url-search-cancel);
|
|
135
123
|
background-position: center center;
|
|
136
124
|
background-size: var(--mds-form-text-input-background-image-size);
|
|
137
125
|
-webkit-appearance: none;
|
|
138
126
|
}
|
|
139
127
|
|
|
140
128
|
&.loading {
|
|
141
|
-
background-image: var(
|
|
142
|
-
--mds-form-text-input-background-image-data-url-search-loading
|
|
143
|
-
);
|
|
129
|
+
background-image: var(--mds-form-text-input-background-image-data-url-search-loading);
|
|
144
130
|
}
|
|
145
131
|
}
|
|
146
132
|
}
|
|
@@ -12,8 +12,7 @@
|
|
|
12
12
|
padding: var(--mds-form-control-padding);
|
|
13
13
|
color: var(--mds-form-control-base-foreground-value-color);
|
|
14
14
|
background-color: var(--mds-form-control-base-surface-color-default);
|
|
15
|
-
border: var(--mds-form-control-border-width) solid
|
|
16
|
-
var(--mds-form-control-base-border-color-default);
|
|
15
|
+
border: var(--mds-form-control-border-width) solid var(--mds-form-control-base-border-color-default);
|
|
17
16
|
border-radius: var(--mds-form-control-border-radius);
|
|
18
17
|
box-shadow: var(--mds-elevation-inset-box-shadow);
|
|
19
18
|
resize: vertical;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/form/textarea/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport { useId } from 'react'\nimport { Field } from '../field'\nimport type { HTMLProps, ReactNode } from 'react'\nimport s from './form-textarea.module.css'\n\ninterface TextAreaBaseProps {\n\tisInvalid?: boolean\n\tisLoading?: boolean\n\trequired?: boolean\n\tclassName?: string\n\tid: string\n\tfield: HTMLProps<HTMLTextAreaElement>\n\tsize: 'medium' | 'large'\n\terror?: ReactNode\n\tdisabled?: boolean\n}\n\nconst TextAreaBase = ({\n\tisInvalid,\n\tisLoading,\n\tclassName,\n\tid,\n\tfield,\n\tsize,\n\terror,\n\t...rest\n}: TextAreaBaseProps) => {\n\treturn (\n\t\t<textarea\n\t\t\tid={id}\n\t\t\tclassName={classNames(\n\t\t\t\ts.textarea,\n\t\t\t\ts[size],\n\t\t\t\t{\n\t\t\t\t\t[s.invalid]: isInvalid,\n\t\t\t\t},\n\t\t\t\tclassName
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/form/textarea/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport { useId } from 'react'\nimport { Field } from '../field'\nimport type { HTMLProps, ReactNode } from 'react'\nimport s from './form-textarea.module.css'\n\ninterface TextAreaBaseProps {\n\tisInvalid?: boolean\n\tisLoading?: boolean\n\trequired?: boolean\n\tclassName?: string\n\tid: string\n\tfield: HTMLProps<HTMLTextAreaElement>\n\tsize: 'medium' | 'large'\n\terror?: ReactNode\n\tdisabled?: boolean\n}\n\nconst TextAreaBase = ({\n\tisInvalid,\n\tisLoading,\n\tclassName,\n\tid,\n\tfield,\n\tsize,\n\terror,\n\t...rest\n}: TextAreaBaseProps) => {\n\treturn (\n\t\t<textarea\n\t\t\tid={id}\n\t\t\tclassName={classNames(\n\t\t\t\ts.textarea,\n\t\t\t\ts[size],\n\t\t\t\t{\n\t\t\t\t\t[s.invalid]: isInvalid,\n\t\t\t\t},\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\taria-describedby={`${error ? 'error' : 'helper-text'}-${id}`}\n\t\t\t{...field}\n\t\t\t{...rest}\n\t\t/>\n\t)\n}\n\ninterface TextAreaFieldProps {\n\tisInvalid?: boolean\n\tisLoading?: boolean\n\tisRequired?: boolean\n\tisOptional?: boolean\n\tid?: string\n\tlabel?: ReactNode\n\thelperText?: ReactNode\n\terror?: ReactNode\n\tfield: HTMLProps<HTMLTextAreaElement>\n\tsize?: 'medium' | 'large'\n\tdisabled?: boolean\n}\n\nconst TextAreaField = ({\n\tisInvalid,\n\tisLoading,\n\tisRequired,\n\tisOptional,\n\tid,\n\tlabel,\n\thelperText,\n\terror,\n\tfield,\n\tsize = 'medium',\n\t...rest\n}: TextAreaFieldProps) => {\n\tconst generatedId = useId()\n\tconst inputId = id ?? generatedId\n\n\treturn (\n\t\t<Field\n\t\t\tlabel={label}\n\t\t\thelperText={helperText}\n\t\t\terror={error}\n\t\t\tisRequired={isRequired}\n\t\t\tisOptional={isOptional}\n\t\t\tid={inputId}\n\t\t\tlayout=\"vertical\"\n\t\t>\n\t\t\t<TextAreaBase\n\t\t\t\tid={inputId}\n\t\t\t\tisInvalid={isInvalid}\n\t\t\t\tisLoading={isLoading}\n\t\t\t\trequired={isRequired}\n\t\t\t\tfield={field}\n\t\t\t\tsize={size}\n\t\t\t\t{...rest}\n\t\t\t/>\n\t\t</Field>\n\t)\n}\n\nTextAreaField.displayName = 'TextAreaField'\n\nexport { TextAreaField }\n"],"names":["TextAreaBase","isInvalid","isLoading","className","id","field","size","error","rest","jsx","classNames","s","TextAreaField","isRequired","isOptional","label","helperText","generatedId","useId","inputId","Field"],"mappings":";;;;;AAkBA,MAAMA,IAAe,CAAC;AAAA,EACrB,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,IAAAC;AAAA,EACA,OAAAC;AAAA,EACA,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,GAAGC;AACJ,MAEE,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACA,IAAAL;AAAA,IACA,WAAWM;AAAA,MACVC,EAAE;AAAA,MACFA,EAAEL,CAAI;AAAA,MACN;AAAA,QACC,CAACK,EAAE,OAAO,GAAGV;AAAA,MAAA;AAAA,MAEdE;AAAA,IAAA;AAAA,IAED,oBAAkB,GAAGI,IAAQ,UAAU,aAAa,IAAIH,CAAE;AAAA,IACzD,GAAGC;AAAA,IACH,GAAGG;AAAA,EAAA;AAAA,GAmBDI,IAAgB,CAAC;AAAA,EACtB,WAAAX;AAAA,EACA,WAAAC;AAAA,EACA,YAAAW;AAAA,EACA,YAAAC;AAAA,EACA,IAAAV;AAAA,EACA,OAAAW;AAAA,EACA,YAAAC;AAAA,EACA,OAAAT;AAAA,EACA,OAAAF;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,GAAGE;AACJ,MAA0B;AACzB,QAAMS,IAAcC,EAAA,GACdC,IAAUf,KAAMa;AAEtB,SACC,gBAAAR;AAAA,IAACW;AAAA,IAAA;AAAA,MACA,OAAAL;AAAA,MACA,YAAAC;AAAA,MACA,OAAAT;AAAA,MACA,YAAAM;AAAA,MACA,YAAAC;AAAA,MACA,IAAIK;AAAA,MACJ,QAAO;AAAA,MAEP,UAAA,gBAAAV;AAAA,QAACT;AAAA,QAAA;AAAA,UACA,IAAImB;AAAA,UACJ,WAAAlB;AAAA,UACA,WAAAC;AAAA,UACA,UAAUW;AAAA,UACV,OAAAR;AAAA,UACA,MAAAC;AAAA,UACC,GAAGE;AAAA,QAAA;AAAA,MAAA;AAAA,IACL;AAAA,EAAA;AAGH;AAEAI,EAAc,cAAc;"}
|
|
@@ -51,16 +51,13 @@
|
|
|
51
51
|
background-image: var(--mds-form-toggle-background-image-data-url);
|
|
52
52
|
background-repeat: no-repeat;
|
|
53
53
|
background-position: var(--mds-form-toggle-background-image-position-x) 50%;
|
|
54
|
-
background-size: var(--mds-form-toggle-background-image-size)
|
|
55
|
-
var(--mds-form-toggle-background-image-size);
|
|
54
|
+
background-size: var(--mds-form-toggle-background-image-size) var(--mds-form-toggle-background-image-size);
|
|
56
55
|
// notice: we want to share the border color between the "thumb" and the "track" so we use a local CSS prop for this
|
|
57
56
|
border: var(--mds-form-radio-border-width) solid var(--border-color);
|
|
58
57
|
border-radius: calc(var(--mds-form-toggle-height) / 2);
|
|
59
58
|
|
|
60
59
|
@media (prefers-reduced-motion: no-preference) {
|
|
61
|
-
transition-timing-function: var(
|
|
62
|
-
--mds-form-toggle-transition-timing-function
|
|
63
|
-
);
|
|
60
|
+
transition-timing-function: var(--mds-form-toggle-transition-timing-function);
|
|
64
61
|
transition-duration: var(--mds-form-toggle-transition-duration);
|
|
65
62
|
transition-property: all;
|
|
66
63
|
}
|
|
@@ -80,9 +77,7 @@
|
|
|
80
77
|
content: '';
|
|
81
78
|
|
|
82
79
|
@media (prefers-reduced-motion: no-preference) {
|
|
83
|
-
transition-timing-function: var(
|
|
84
|
-
--mds-form-toggle-transition-timing-function
|
|
85
|
-
);
|
|
80
|
+
transition-timing-function: var(--mds-form-toggle-transition-timing-function);
|
|
86
81
|
transition-duration: var(--mds-form-toggle-transition-duration);
|
|
87
82
|
transition-property: all;
|
|
88
83
|
}
|
|
@@ -102,9 +97,7 @@
|
|
|
102
97
|
left: -$shift;
|
|
103
98
|
margin: auto;
|
|
104
99
|
border-width: $outline-width;
|
|
105
|
-
border-radius: calc(
|
|
106
|
-
var(--mds-form-toggle-height) / 2 + $outline-width + $outline-offset
|
|
107
|
-
);
|
|
100
|
+
border-radius: calc(var(--mds-form-toggle-height) / 2 + $outline-width + $outline-offset);
|
|
108
101
|
content: '';
|
|
109
102
|
}
|
|
110
103
|
|
|
@@ -114,9 +107,7 @@
|
|
|
114
107
|
|
|
115
108
|
:not(:checked) + & {
|
|
116
109
|
--border-color: var(--mds-form-control-base-border-color-default);
|
|
117
|
-
background-color: var(
|
|
118
|
-
--mds-form-toggle-base-surface-color-default
|
|
119
|
-
); // this is specific for "toggle", is not like the other controls!
|
|
110
|
+
background-color: var(--mds-form-toggle-base-surface-color-default); // this is specific for "toggle", is not like the other controls!
|
|
120
111
|
}
|
|
121
112
|
|
|
122
113
|
:checked + & {
|
|
@@ -124,9 +115,7 @@
|
|
|
124
115
|
background-color: var(--mds-form-control-checked-surface-color-default);
|
|
125
116
|
|
|
126
117
|
&::after {
|
|
127
|
-
$translation: calc(
|
|
128
|
-
var(--mds-form-toggle-width) - var(--mds-form-toggle-thumb-size)
|
|
129
|
-
);
|
|
118
|
+
$translation: calc(var(--mds-form-toggle-width) - var(--mds-form-toggle-thumb-size));
|
|
130
119
|
transform: translate3d($translation, 0, 0);
|
|
131
120
|
}
|
|
132
121
|
}
|
|
@@ -157,8 +146,6 @@
|
|
|
157
146
|
:disabled:checked + & {
|
|
158
147
|
--border-color: var(--mds-form-control-disabled-border-color);
|
|
159
148
|
background-color: var(--mds-form-control-disabled-surface-color);
|
|
160
|
-
background-image: var(
|
|
161
|
-
--mds-form-toggle-background-image-data-url-disabled
|
|
162
|
-
);
|
|
149
|
+
background-image: var(--mds-form-toggle-background-image-data-url-disabled);
|
|
163
150
|
}
|
|
164
151
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/icon-tile/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport type { FlightIconSize } from '../flight-icon'\nimport { FlightIcon } from '../flight-icon'\nimport type { HTMLAttributes } from 'react'\nimport s from './style.module.scss'\n\ntype BaseProps = {\n\tsize: 'small' | 'medium' | 'large'\n\ticonSecondary?: string\n\tcolor?:\n\t\t| 'neutral'\n\t\t| 'boundary'\n\t\t| 'consul'\n\t\t| 'nomad'\n\t\t| 'packer'\n\t\t| 'terraform'\n\t\t| 'vagrant'\n\t\t| 'vault'\n\t\t| 'vault-secrets'\n\t\t| 'waypoint'\n} & Omit<HTMLAttributes<HTMLDivElement>, 'className' | 'style'>\n\ntype WithLogo = {\n\tlogo:\n\t\t| 'hcp'\n\t\t| 'boundary'\n\t\t| 'consul'\n\t\t| 'nomad'\n\t\t| 'packer'\n\t\t| 'terraform'\n\t\t| 'vagrant'\n\t\t| 'vault'\n\t\t| 'vault-secrets'\n\t\t| 'waypoint'\n\ticon?: never\n}\n\ntype WithIcon = {\n\ticon: string\n\tlogo?: never\n}\n\ntype IconTileProps = BaseProps & (WithLogo | WithIcon)\n\nconst EXTRA_ICON_SIZE_MAP = {\n\tsmall: 12,\n\tmedium: 16,\n\tlarge: 16,\n} as const satisfies Record<'small' | 'medium' | 'large', FlightIconSize>\n\nconst IconTile = ({\n\tsize = 'medium',\n\tlogo,\n\ticon,\n\ticonSecondary,\n\tcolor = 'neutral',\n\t...rest\n}: IconTileProps) => {\n\tconst iconName = logo ? `${logo}-color` : icon\n\n\tif (iconName) {\n\t\tconst iconSize = size === 'small' ? 16 : 24\n\t\tconst entity = logo ? 'logo' : 'icon'\n\t\tconst colorUse = logo ? logo : color\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName={classNames(\n\t\t\t\t\ts['icon-tile'],\n\t\t\t\t\ts[`type-${entity}`],\n\t\t\t\t\ts[`size-${size}`],\n\t\t\t\t\ts[`color-${colorUse}`]
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/icon-tile/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport type { FlightIconSize } from '../flight-icon'\nimport { FlightIcon } from '../flight-icon'\nimport type { HTMLAttributes } from 'react'\nimport s from './style.module.scss'\n\ntype BaseProps = {\n\tsize: 'small' | 'medium' | 'large'\n\ticonSecondary?: string\n\tcolor?:\n\t\t| 'neutral'\n\t\t| 'boundary'\n\t\t| 'consul'\n\t\t| 'nomad'\n\t\t| 'packer'\n\t\t| 'terraform'\n\t\t| 'vagrant'\n\t\t| 'vault'\n\t\t| 'vault-secrets'\n\t\t| 'waypoint'\n} & Omit<HTMLAttributes<HTMLDivElement>, 'className' | 'style'>\n\ntype WithLogo = {\n\tlogo:\n\t\t| 'hcp'\n\t\t| 'boundary'\n\t\t| 'consul'\n\t\t| 'nomad'\n\t\t| 'packer'\n\t\t| 'terraform'\n\t\t| 'vagrant'\n\t\t| 'vault'\n\t\t| 'vault-secrets'\n\t\t| 'waypoint'\n\ticon?: never\n}\n\ntype WithIcon = {\n\ticon: string\n\tlogo?: never\n}\n\ntype IconTileProps = BaseProps & (WithLogo | WithIcon)\n\nconst EXTRA_ICON_SIZE_MAP = {\n\tsmall: 12,\n\tmedium: 16,\n\tlarge: 16,\n} as const satisfies Record<'small' | 'medium' | 'large', FlightIconSize>\n\nconst IconTile = ({\n\tsize = 'medium',\n\tlogo,\n\ticon,\n\ticonSecondary,\n\tcolor = 'neutral',\n\t...rest\n}: IconTileProps) => {\n\tconst iconName = logo ? `${logo}-color` : icon\n\n\tif (iconName) {\n\t\tconst iconSize = size === 'small' ? 16 : 24\n\t\tconst entity = logo ? 'logo' : 'icon'\n\t\tconst colorUse = logo ? logo : color\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName={classNames(\n\t\t\t\t\ts['icon-tile'],\n\t\t\t\t\ts[`type-${entity}`],\n\t\t\t\t\ts[`size-${size}`],\n\t\t\t\t\ts[`color-${colorUse}`],\n\t\t\t\t)}\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\t{...rest}\n\t\t\t>\n\t\t\t\t<div className={logo ? s.logo : s.icon}>\n\t\t\t\t\t<FlightIcon name={iconName} size={iconSize} stretched />\n\t\t\t\t</div>\n\t\t\t\t{iconSecondary && (\n\t\t\t\t\t<div className={s.extra}>\n\t\t\t\t\t\t<FlightIcon\n\t\t\t\t\t\t\tname={iconSecondary}\n\t\t\t\t\t\t\tsize={EXTRA_ICON_SIZE_MAP[size]}\n\t\t\t\t\t\t\tcolor=\"var(--mds-color-foreground-strong)\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t)\n\t}\n}\n\nIconTile.displayName = 'IconTile'\n\nexport type { IconTileProps }\nexport { IconTile }\n"],"names":["EXTRA_ICON_SIZE_MAP","IconTile","size","logo","icon","iconSecondary","color","rest","iconName","iconSize","entity","colorUse","jsxs","classNames","s","jsx","FlightIcon"],"mappings":";;;;AA4CA,MAAMA,IAAsB;AAAA,EAC3B,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AACR,GAEMC,IAAW,CAAC;AAAA,EACjB,MAAAC,IAAO;AAAA,EACP,MAAAC;AAAA,EACA,MAAAC;AAAA,EACA,eAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,GAAGC;AACJ,MAAqB;AACpB,QAAMC,IAAWL,IAAO,GAAGA,CAAI,WAAWC;AAE1C,MAAII,GAAU;AACb,UAAMC,IAAWP,MAAS,UAAU,KAAK,IACnCQ,IAASP,IAAO,SAAS,QACzBQ,IAAWR,KAAcG;AAE/B,WACC,gBAAAM;AAAA,MAAC;AAAA,MAAA;AAAA,QACA,WAAWC;AAAA,UACVC,EAAE,WAAW;AAAA,UACbA,EAAE,QAAQJ,CAAM,EAAE;AAAA,UAClBI,EAAE,QAAQZ,CAAI,EAAE;AAAA,UAChBY,EAAE,SAASH,CAAQ,EAAE;AAAA,QAAA;AAAA,QAEtB,eAAY;AAAA,QACX,GAAGJ;AAAA,QAEJ,UAAA;AAAA,UAAA,gBAAAQ,EAAC,OAAA,EAAI,WAAWZ,IAAOW,EAAE,OAAOA,EAAE,MACjC,UAAA,gBAAAC,EAACC,GAAA,EAAW,MAAMR,GAAU,MAAMC,GAAU,WAAS,IAAC,GACvD;AAAA,UACCJ,KACA,gBAAAU,EAAC,OAAA,EAAI,WAAWD,EAAE,OACjB,UAAA,gBAAAC;AAAA,YAACC;AAAA,YAAA;AAAA,cACA,MAAMX;AAAA,cACN,MAAML,EAAoBE,CAAI;AAAA,cAC9B,OAAM;AAAA,YAAA;AAAA,UAAA,EACP,CACD;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIJ;AACD;AAEAD,EAAS,cAAc;"}
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
@use 'sass:map';
|
|
2
2
|
|
|
3
3
|
$hds-icon-tile-sizes: ('small', 'medium', 'large');
|
|
4
|
-
$hds-icon-tile-colors-products: (
|
|
5
|
-
'boundary',
|
|
6
|
-
'consul',
|
|
7
|
-
'hcp',
|
|
8
|
-
'nomad',
|
|
9
|
-
'packer',
|
|
10
|
-
'terraform',
|
|
11
|
-
'vagrant',
|
|
12
|
-
'vault',
|
|
13
|
-
'vault-secrets',
|
|
14
|
-
'waypoint'
|
|
15
|
-
);
|
|
4
|
+
$hds-icon-tile-colors-products: ('boundary', 'consul', 'hcp', 'nomad', 'packer', 'terraform', 'vagrant', 'vault', 'vault-secrets', 'waypoint');
|
|
16
5
|
$size-props: (
|
|
17
6
|
'small': (
|
|
18
7
|
'size': 1.75rem,
|
|
@@ -116,7 +105,7 @@ $size-props: (
|
|
|
116
105
|
}
|
|
117
106
|
|
|
118
107
|
@each $product in $hds-icon-tile-colors-products {
|
|
119
|
-
@if
|
|
108
|
+
@if $product == 'hcp' {
|
|
120
109
|
// exception for HCP (we use neutral colors, we don't have specific product colors for foreground/background)
|
|
121
110
|
&.color-hcp {
|
|
122
111
|
color: var(--mds-color-hcp-brand);
|
|
@@ -126,11 +115,7 @@ $size-props: (
|
|
|
126
115
|
} @else {
|
|
127
116
|
&.color-#{$product} {
|
|
128
117
|
color: var(--mds-color-#{$product}-foreground);
|
|
129
|
-
background: linear-gradient(
|
|
130
|
-
135deg,
|
|
131
|
-
var(--mds-color-#{$product}-gradient-faint-start) 0%,
|
|
132
|
-
var(--mds-color-#{$product}-gradient-faint-stop) 100%
|
|
133
|
-
);
|
|
118
|
+
background: linear-gradient(135deg, var(--mds-color-#{$product}-gradient-faint-start) 0%, var(--mds-color-#{$product}-gradient-faint-stop) 100%);
|
|
134
119
|
border-color: var(--mds-color-#{$product}-border);
|
|
135
120
|
}
|
|
136
121
|
}
|
package/components/index.d.ts
CHANGED
|
@@ -45,6 +45,8 @@ export { MDSButton } from './legacy-button';
|
|
|
45
45
|
export { ModalProvider, useModal } from './modal';
|
|
46
46
|
export type { SeparatorProps } from './separator';
|
|
47
47
|
export { Separator } from './separator';
|
|
48
|
+
export { Skeleton, type SkeletonProps } from './skeleton';
|
|
49
|
+
export { SkeletonForm, type SkeletonFormProps } from './skeleton/skeleton-form';
|
|
48
50
|
export type { StandaloneLinkColor, StandaloneLinkIconPosition, StandaloneLinkProps, StandaloneLinkSize, } from './standalone-link';
|
|
49
51
|
export { StandaloneLink, STANDALONE_LINK_COLORS, STANDALONE_LINK_ICON_POSITIONS, STANDALONE_LINK_SIZES, } from './standalone-link';
|
|
50
52
|
export type { TableProps } from './table';
|
package/components/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Accordion as e } from "./accordion/index.js";
|
|
2
2
|
import { BADGE_COLORS as p, BADGE_SIZES as x, BADGE_TYPES as m, Badge as f } from "./badge/index.js";
|
|
3
3
|
import { BadgeCount as n } from "./badge-count/index.js";
|
|
4
|
-
import { Alert as a, AlertActions as d, AlertButton as
|
|
4
|
+
import { Alert as a, AlertActions as d, AlertButton as S, AlertStandaloneLink as T } from "./alert/index.js";
|
|
5
5
|
import { Breadcrumbs as c } from "./breadcrumbs/index.js";
|
|
6
6
|
import { BUTTON_COLORS as C, BUTTON_ICON_POSITIONS as O, BUTTON_SIZES as u, Button as B } from "./button/index.js";
|
|
7
7
|
import { Card as s, CardContent as _ } from "./card/index.js";
|
|
8
8
|
import { CodeBlock as L } from "./code-block/index.js";
|
|
9
9
|
import { DisclosurePrimitive as F } from "./disclosure-primitive/index.js";
|
|
10
|
-
import { useDisclosurePrimitive as
|
|
11
|
-
import { Dropdown as
|
|
10
|
+
import { useDisclosurePrimitive as k } from "./disclosure-primitive/use-disclosure-primitive.js";
|
|
11
|
+
import { Dropdown as R } from "./dropdown/index.js";
|
|
12
12
|
import { FLIGHT_ICON_SIZES as h, FlightIcon as P } from "./flight-icon/index.js";
|
|
13
13
|
import { CheckboxBase as Z, CheckboxField as v, CheckboxGroup as K } from "./form/checkbox/index.js";
|
|
14
14
|
import { Error as U } from "./form/error/index.js";
|
|
@@ -22,35 +22,37 @@ import { Legend as eo } from "./form/legend/index.js";
|
|
|
22
22
|
import { RadioBase as po, RadioField as xo, RadioGroup as mo } from "./form/radio/index.js";
|
|
23
23
|
import { RadioCard as io } from "./form/radio-card/index.js";
|
|
24
24
|
import { SelectField as lo } from "./form/select/index.js";
|
|
25
|
-
import { SuperSelectField as
|
|
25
|
+
import { SuperSelectField as So } from "./form/super-select/index.js";
|
|
26
26
|
import { TextInput as Io, TextInputBase as co } from "./form/text-input/index.js";
|
|
27
27
|
import { TextAreaField as Co } from "./form/textarea/index.js";
|
|
28
28
|
import { ToggleBase as uo, ToggleField as Bo, ToggleGroup as go } from "./form/toggle/index.js";
|
|
29
29
|
import { IconTile as _o } from "./icon-tile/index.js";
|
|
30
30
|
import { InlineLink as Lo } from "./inline-link/index.js";
|
|
31
31
|
import { MDSButton as Fo } from "./legacy-button/index.js";
|
|
32
|
-
import { ModalProvider as
|
|
33
|
-
import { Separator as
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
32
|
+
import { ModalProvider as ko } from "./modal/index.js";
|
|
33
|
+
import { Separator as Ro } from "./separator/index.js";
|
|
34
|
+
import { Skeleton as ho } from "./skeleton/index.js";
|
|
35
|
+
import { SkeletonForm as Ho } from "./skeleton/skeleton-form/index.js";
|
|
36
|
+
import { STANDALONE_LINK_COLORS as vo, STANDALONE_LINK_ICON_POSITIONS as Ko, STANDALONE_LINK_SIZES as Mo, StandaloneLink as Uo } from "./standalone-link/index.js";
|
|
37
|
+
import { Table as wo } from "./table/index.js";
|
|
38
|
+
import { getDensity as zo, getHorizontalAlignment as Vo, getScope as Wo, getVerticalAlignment as Yo } from "./table/utils.js";
|
|
39
|
+
import { Tabs as qo } from "./tabs/index.js";
|
|
40
|
+
import { useTabsContext as Qo } from "./tabs/use-tabs-context.js";
|
|
41
|
+
import { TEXT_COLORS as or, TEXT_WEIGHTS as rr, Text as er } from "./text/index.js";
|
|
42
|
+
import { BarChart as pr } from "./visualizations/bar-chart/index.js";
|
|
43
|
+
import { DonutChart as mr } from "./visualizations/donut-chart/index.js";
|
|
44
|
+
import { AccordionContent as ir, AccordionItem as nr, AccordionToggle as lr } from "./accordion/item/index.js";
|
|
45
|
+
import { RadioCardGroup as dr } from "./form/radio-card/group.js";
|
|
46
|
+
import { useModal as Tr } from "./modal/use-modal.js";
|
|
45
47
|
export {
|
|
46
48
|
e as Accordion,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
ir as AccordionContent,
|
|
50
|
+
nr as AccordionItem,
|
|
51
|
+
lr as AccordionToggle,
|
|
50
52
|
a as Alert,
|
|
51
53
|
d as AlertActions,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
S as AlertButton,
|
|
55
|
+
T as AlertStandaloneLink,
|
|
54
56
|
p as BADGE_COLORS,
|
|
55
57
|
x as BADGE_SIZES,
|
|
56
58
|
m as BADGE_TYPES,
|
|
@@ -59,7 +61,7 @@ export {
|
|
|
59
61
|
u as BUTTON_SIZES,
|
|
60
62
|
f as Badge,
|
|
61
63
|
n as BadgeCount,
|
|
62
|
-
|
|
64
|
+
pr as BarChart,
|
|
63
65
|
c as Breadcrumbs,
|
|
64
66
|
B as Button,
|
|
65
67
|
s as Card,
|
|
@@ -69,8 +71,8 @@ export {
|
|
|
69
71
|
K as CheckboxGroup,
|
|
70
72
|
L as CodeBlock,
|
|
71
73
|
F as DisclosurePrimitive,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
mr as DonutChart,
|
|
75
|
+
R as Dropdown,
|
|
74
76
|
U as Error,
|
|
75
77
|
h as FLIGHT_ICON_SIZES,
|
|
76
78
|
w as Field,
|
|
@@ -85,36 +87,38 @@ export {
|
|
|
85
87
|
oo as Label,
|
|
86
88
|
eo as Legend,
|
|
87
89
|
Fo as MDSButton,
|
|
88
|
-
|
|
90
|
+
ko as ModalProvider,
|
|
89
91
|
po as RadioBase,
|
|
90
92
|
io as RadioCard,
|
|
91
|
-
|
|
93
|
+
dr as RadioCardGroup,
|
|
92
94
|
xo as RadioField,
|
|
93
95
|
mo as RadioGroup,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
vo as STANDALONE_LINK_COLORS,
|
|
97
|
+
Ko as STANDALONE_LINK_ICON_POSITIONS,
|
|
98
|
+
Mo as STANDALONE_LINK_SIZES,
|
|
97
99
|
lo as SelectField,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
100
|
+
Ro as Separator,
|
|
101
|
+
ho as Skeleton,
|
|
102
|
+
Ho as SkeletonForm,
|
|
103
|
+
Uo as StandaloneLink,
|
|
104
|
+
So as SuperSelectField,
|
|
105
|
+
or as TEXT_COLORS,
|
|
106
|
+
rr as TEXT_WEIGHTS,
|
|
107
|
+
wo as Table,
|
|
108
|
+
qo as Tabs,
|
|
109
|
+
er as Text,
|
|
106
110
|
Co as TextAreaField,
|
|
107
111
|
Io as TextInput,
|
|
108
112
|
co as TextInputBase,
|
|
109
113
|
uo as ToggleBase,
|
|
110
114
|
Bo as ToggleField,
|
|
111
115
|
go as ToggleGroup,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
zo as getDensity,
|
|
117
|
+
Vo as getHorizontalAlignment,
|
|
118
|
+
Wo as getScope,
|
|
119
|
+
Yo as getVerticalAlignment,
|
|
120
|
+
k as useDisclosurePrimitive,
|
|
121
|
+
Tr as useModal,
|
|
122
|
+
Qo as useTabsContext
|
|
119
123
|
};
|
|
120
124
|
//# sourceMappingURL=index.js.map
|
package/components/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ButtonHTMLAttributes, MouseEventHandler, ForwardRefExoticComponent } from 'react';
|
|
2
2
|
interface InteractiveProps extends React.HTMLAttributes<HTMLElement> {
|
|
3
3
|
isHrefExternal?: boolean;
|
|
4
4
|
href?: string;
|
|
@@ -11,7 +11,7 @@ declare const Interactive: ForwardRefExoticComponent<InteractiveProps & import('
|
|
|
11
11
|
/**
|
|
12
12
|
* Smaller, local version of our getLocalizedLinkProps util,
|
|
13
13
|
* cloned here to work around a cyclic dependency issue
|
|
14
|
-
* with the main @web/utils package.
|
|
14
|
+
* with the main @web/utils package in the web repo.
|
|
15
15
|
*
|
|
16
16
|
* @param url An internal URL path
|
|
17
17
|
* @param locale A supported locale
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/interactive/index.tsx"],"sourcesContent":["'use client'\n\nimport { forwardRef
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/interactive/index.tsx"],"sourcesContent":["'use client'\n\nimport { forwardRef } from 'react'\nimport type {\n\tButtonHTMLAttributes,\n\tMouseEventHandler,\n\tForwardRefExoticComponent,\n} from 'react'\nimport { useMDSLink } from '../../utils/mds-context'\n\ninterface InteractiveProps extends React.HTMLAttributes<HTMLElement> {\n\tisHrefExternal?: boolean\n\thref?: string\n\tonClick?: MouseEventHandler\n\ttype?: ButtonHTMLAttributes<HTMLButtonElement>['type']\n\tprefetch?: boolean\n\tlocale?: string\n}\n\nconst Interactive = forwardRef<\n\tHTMLAnchorElement | HTMLButtonElement,\n\tInteractiveProps\n>((props, ref) => {\n\tconst Link = useMDSLink()\n\tconst {\n\t\thref,\n\t\tclassName,\n\t\tisHrefExternal,\n\t\tonClick,\n\t\tchildren,\n\t\tlocale,\n\t\t...rest\n\t} = props\n\n\t// TODO: trigger link on space key up\n\tif (href) {\n\t\treturn (\n\t\t\t<Link\n\t\t\t\tclassName={className}\n\t\t\t\ttarget={isHrefExternal ? '_blank' : undefined}\n\t\t\t\trel={isHrefExternal ? 'noopener noreferrer' : undefined}\n\t\t\t\tonClick={onClick}\n\t\t\t\t{...getLocalizedLinkProps(href, locale, isHrefExternal)}\n\t\t\t\t{...rest}\n\t\t\t\tref={ref as ForwardRefExoticComponent<HTMLAnchorElement>}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</Link>\n\t\t)\n\t} else {\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tclassName={className}\n\t\t\t\tonClick={onClick}\n\t\t\t\t{...rest}\n\t\t\t\tref={ref as ForwardRefExoticComponent<HTMLButtonElement>}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</button>\n\t\t)\n\t}\n})\nInteractive.displayName = 'Interactive'\n\n/**\n * Smaller, local version of our getLocalizedLinkProps util,\n * cloned here to work around a cyclic dependency issue\n * with the main @web/utils package in the web repo.\n *\n * @param url An internal URL path\n * @param locale A supported locale\n * @returns A prefixed URL if locale is defined, otherwise the URL without prefix\n */\nexport const getLocalizedLinkProps = (\n\thref: string,\n\tlocale?: string,\n\tisHrefExternal?: boolean,\n): {\n\thref: string\n\threfLang: string | undefined\n\tisHrefExternal?: boolean\n} => {\n\tif (isHrefExternal) {\n\t\treturn {\n\t\t\thref: href,\n\t\t\threfLang: undefined,\n\t\t}\n\t}\n\n\tif (\n\t\t['en', 'de', 'es', 'fr', 'ja', 'ko', 'pt', 'id'].includes(\n\t\t\thref.substring(1, 3),\n\t\t)\n\t) {\n\t\t// Don't localize if the href is already localized\n\t\treturn {\n\t\t\thref: href,\n\t\t\threfLang: href.substring(1, 3),\n\t\t}\n\t}\n\n\tif (href.startsWith('/') && locale) {\n\t\treturn {\n\t\t\thref: `/${locale}${href}`,\n\t\t\threfLang: locale,\n\t\t}\n\t}\n\n\treturn {\n\t\thref: href,\n\t\threfLang: undefined,\n\t}\n}\n\nexport type { InteractiveProps }\nexport { Interactive }\n"],"names":["Interactive","forwardRef","props","ref","Link","useMDSLink","href","className","isHrefExternal","onClick","children","locale","rest","jsx","getLocalizedLinkProps"],"mappings":";;;;AAuBC,MAAAA,IAAaC,EAAW,CAAAC,GAAAC,MAAA;AACxB,QAAMC,IAAAC,EAAA,GACL;AAAA,IACA,MAAAC;AAAA,IACA,WAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,SAAAC;AAAA,IACA,UAAAC;AAAA,IACA,QAAAC;AAAA,OACGC;AAAA,EAGJ,IAAIV;AACH,aACE,gBAAAW;AAAA,IAAAT;AAAA,IAAA;AAAA,MAEA,WAAAG;AAAA,MACA,QAAKC,IAAiB,WAAA;AAAA,MACtB,KAAAA,IAAA,wBAAA;AAAA,MACC,SAAAC;AAAA,MACA,GAAGK,EAAAR,GAAAK,GAAAH,CAAA;AAAA,MACJ,GAAAI;AAAA,MAEC,KAAAT;AAAA,MAAA,UAAAO;AAAA,IACF;AAAA,EAEF,IAEG,gBAAAG;AAAA,IAAA;AAAA,IAAA;AAAA,MAEA,MAAA;AAAA,MACA,WAAAN;AAAA,MACC,SAAAE;AAAA,MACD,GAAAG;AAAA,MAEC,KAAAT;AAAA,MAAA,UAAAO;AAAA,IACF;AAAA,EAEF;AAED,CAAA;AAWOV,EAAM,cAAA;AASZ,MAAIc,IAAgB,CAAAR,GAAAK,GAAAH,MACnBA,IACC;AAAA,EACA,MAAAF;AAAA,EACD,UAAA;AACD,WAIO,MAAU,MAAI,MAAA,MAAA,MAAA,MAAA,IAAA,EAAA;AAAA,EACpBA,EACC,UAAA,GAAA,CAAA;AAED,IACC;AAAA,EACA,MAAAA;AAAA,EACD,UAAAA,EAAA,UAAA,GAAA,CAAA;AACD,IAGCA,EAAO,WAAA,GAAA,KAAAK,IACN;AAAA,EACA,UAAUA,CAAA,GAAAL,CAAA;AAAA,EACX,UAAAK;AACD,IAGC;AAAA,EACA,MAAAL;AAAA,EACD,UAAA;AACD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/legacy-button/index.tsx"],"sourcesContent":["import { type ForwardRefExoticComponent, forwardRef } from 'react'\nimport type { ButtonProps } from './types'\nimport { determineColor, LINK_TYPE_ICON_MAP } from './utils'\nimport { StandaloneLink } from '../standalone-link'\nimport { Button } from '../button'\n\n/** @deprecated Use <Button> from '@hashicorp/mds-react/button' instead. Will be removed in v1.0. */\nconst MDSButton = forwardRef<\n\tHTMLAnchorElement | HTMLButtonElement,\n\tButtonProps\n>(\n\t(\n\t\t{\n\t\t\tlocale,\n\t\t\ttext,\n\t\t\ttitle,\n\t\t\turl,\n\t\t\thref,\n\t\t\tlinkType,\n\t\t\tonClick,\n\t\t\texternal,\n\t\t\tclassName,\n\t\t\tsize,\n\t\t\ticon,\n\t\t\ticonPosition = 'trailing',\n\t\t\tlabel,\n\t\t\tdisabled,\n\t\t\ttype,\n\t\t\ttheme,\n\t\t\t...rest\n\t\t},\n\t\tref
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/legacy-button/index.tsx"],"sourcesContent":["import { type ForwardRefExoticComponent, forwardRef } from 'react'\nimport type { ButtonProps } from './types'\nimport { determineColor, LINK_TYPE_ICON_MAP } from './utils'\nimport { StandaloneLink } from '../standalone-link'\nimport { Button } from '../button'\n\n/** @deprecated Use <Button> from '@hashicorp/mds-react/button' instead. Will be removed in v1.0. */\nconst MDSButton = forwardRef<\n\tHTMLAnchorElement | HTMLButtonElement,\n\tButtonProps\n>(\n\t(\n\t\t{\n\t\t\tlocale,\n\t\t\ttext,\n\t\t\ttitle,\n\t\t\turl,\n\t\t\thref,\n\t\t\tlinkType,\n\t\t\tonClick,\n\t\t\texternal,\n\t\t\tclassName,\n\t\t\tsize,\n\t\t\ticon,\n\t\t\ticonPosition = 'trailing',\n\t\t\tlabel,\n\t\t\tdisabled,\n\t\t\ttype,\n\t\t\ttheme,\n\t\t\t...rest\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst color = determineColor(theme)\n\n\t\tif (color === 'tertiary') {\n\t\t\t// We prefer the Standalone Link component over the tertiary\n\t\t\t// button styles.\n\t\t\treturn (\n\t\t\t\t<StandaloneLink\n\t\t\t\t\ttext={(text || title) as string}\n\t\t\t\t\tcolor={\n\t\t\t\t\t\ttheme?.background === 'dark' ? 'secondary-inverted' : 'secondary'\n\t\t\t\t\t}\n\t\t\t\t\thref={url || href}\n\t\t\t\t\ticon={linkType ? LINK_TYPE_ICON_MAP[linkType] : icon}\n\t\t\t\t\ticonPosition={linkType ? 'trailing' : iconPosition}\n\t\t\t\t\tclassName={className}\n\t\t\t\t\tonClick={onClick as () => void}\n\t\t\t\t\tsize={size}\n\t\t\t\t\tisHrefExternal={linkType === 'outbound' || external}\n\t\t\t\t\tref={ref as ForwardRefExoticComponent<HTMLAnchorElement>}\n\t\t\t\t\tlocale={locale}\n\t\t\t\t/>\n\t\t\t)\n\t\t}\n\n\t\treturn (\n\t\t\t<Button\n\t\t\t\ttext={text || title}\n\t\t\t\thref={url || href}\n\t\t\t\tisHrefExternal={linkType === 'outbound' || external}\n\t\t\t\tcolor={determineColor(theme)}\n\t\t\t\ttype={type}\n\t\t\t\ticon={linkType ? LINK_TYPE_ICON_MAP[linkType] : icon}\n\t\t\t\ticonPosition={linkType ? 'trailing' : iconPosition}\n\t\t\t\tonClick={onClick as React.MouseEventHandler<HTMLButtonElement>}\n\t\t\t\tclassName={className}\n\t\t\t\t// Default buttons to the large size unless we specifically request the\n\t\t\t\t// small variant\n\t\t\t\tsize={size === 'small' ? 'medium' : 'large'}\n\t\t\t\taria-label={label}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tref={ref as ForwardRefExoticComponent<HTMLButtonElement>}\n\t\t\t\tlocale={locale}\n\t\t\t\t{...rest}\n\t\t\t/>\n\t\t)\n\t},\n)\n\nMDSButton.displayName = 'MDSButton'\n\nexport { MDSButton }\n"],"names":["MDSButton","forwardRef","locale","text","title","url","href","linkType","onClick","external","className","size","icon","iconPosition","label","disabled","type","theme","rest","ref","determineColor","jsx","StandaloneLink","LINK_TYPE_ICON_MAP","Button"],"mappings":";;;;;AAOA,MAAMA,IAAYC;AAAA,EAIjB,CACC;AAAA,IACC,QAAAC;AAAA,IACA,MAAAC;AAAA,IACA,OAAAC;AAAA,IACA,KAAAC;AAAA,IACA,MAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,MAAAC;AAAA,IACA,MAAAC;AAAA,IACA,cAAAC,IAAe;AAAA,IACf,OAAAC;AAAA,IACA,UAAAC;AAAA,IACA,MAAAC;AAAA,IACA,OAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAEJC,MAEcC,EAAeH,CAAK,MAEpB,aAIZ,gBAAAI;AAAA,IAACC;AAAA,IAAA;AAAA,MACA,MAAOnB,KAAQC;AAAA,MACf,OACCa,GAAO,eAAe,SAAS,uBAAuB;AAAA,MAEvD,MAAMZ,KAAOC;AAAA,MACb,MAAMC,IAAWgB,EAAmBhB,CAAQ,IAAIK;AAAA,MAChD,cAAcL,IAAW,aAAaM;AAAA,MACtC,WAAAH;AAAA,MACA,SAAAF;AAAA,MACA,MAAAG;AAAA,MACA,gBAAgBJ,MAAa,cAAcE;AAAA,MAC3C,KAAAU;AAAA,MACA,QAAAjB;AAAA,IAAA;AAAA,EAAA,IAMF,gBAAAmB;AAAA,IAACG;AAAA,IAAA;AAAA,MACA,MAAMrB,KAAQC;AAAA,MACd,MAAMC,KAAOC;AAAA,MACb,gBAAgBC,MAAa,cAAcE;AAAA,MAC3C,OAAOW,EAAeH,CAAK;AAAA,MAC3B,MAAAD;AAAA,MACA,MAAMT,IAAWgB,EAAmBhB,CAAQ,IAAIK;AAAA,MAChD,cAAcL,IAAW,aAAaM;AAAA,MACtC,SAAAL;AAAA,MACA,WAAAE;AAAA,MAGA,MAAMC,MAAS,UAAU,WAAW;AAAA,MACpC,cAAYG;AAAA,MACZ,UAAAC;AAAA,MACA,KAAAI;AAAA,MACA,QAAAjB;AAAA,MACC,GAAGgB;AAAA,IAAA;AAAA,EAAA;AAIR;AAEAlB,EAAU,cAAc;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../src/components/legacy-button/utils.tsx"],"sourcesContent":["import type { ButtonColor, Theme, ThemeVariant } from './types'\n\nexport const COLORS = [\n\t'primary',\n\t'primary-black',\n\t'primary-white',\n\t'secondary', // deprecated; maps to secondary-white\n\t'secondary-high-contrast', // alternates between secondary-black and secondary-white based on theme\n\t'secondary-white',\n\t'secondary-black',\n\t'tertiary',\n\t'critical',\n\t'boundary',\n\t'consul',\n\t'nomad',\n\t'packer',\n\t'terraform',\n\t'vagrant',\n\t'vault',\n\t'waypoint',\n\t'hashicorp', // alias to primary\n] as const\n\nexport function determineColor(theme?: Theme): ButtonColor {\n\tconst variant: ThemeVariant = theme?.variant ? theme.variant : 'primary'\n\n\tif (variant === 'primary') {\n\t\tswitch (theme?.brand) {\n\t\t\tcase 'hashicorp':\n\t\t\t\treturn 'primary'\n\t\t\tcase 'boundary':\n\t\t\tcase 'consul':\n\t\t\tcase 'nomad':\n\t\t\tcase 'packer':\n\t\t\tcase 'terraform':\n\t\t\tcase 'vagrant':\n\t\t\tcase 'vault':\n\t\t\tcase 'waypoint':\n\t\t\t\treturn theme.brand\n\t\t\tcase 'neutral':\n\t\t\t\treturn 'secondary-high-contrast'\n\t\t\tdefault:\n\t\t\t\treturn 'primary'\n\t\t}\n\t}\n\n\tif (variant === 'secondary') {\n\t\treturn 'secondary'\n\t}\n\n\tif (\n\t\tvariant === 'tertiary' ||\n\t\tvariant === 'tertiary-neutral' ||\n\t\tvariant === 'ghost'\n\t) {\n\t\treturn 'tertiary'\n\t}\n\n\tthrow new Error(\n\t\t`Unable to determine HDS Button color from theme: ${JSON.stringify(theme)}
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../src/components/legacy-button/utils.tsx"],"sourcesContent":["import type { ButtonColor, Theme, ThemeVariant } from './types'\n\nexport const COLORS = [\n\t'primary',\n\t'primary-black',\n\t'primary-white',\n\t'secondary', // deprecated; maps to secondary-white\n\t'secondary-high-contrast', // alternates between secondary-black and secondary-white based on theme\n\t'secondary-white',\n\t'secondary-black',\n\t'tertiary',\n\t'critical',\n\t'boundary',\n\t'consul',\n\t'nomad',\n\t'packer',\n\t'terraform',\n\t'vagrant',\n\t'vault',\n\t'waypoint',\n\t'hashicorp', // alias to primary\n] as const\n\nexport function determineColor(theme?: Theme): ButtonColor {\n\tconst variant: ThemeVariant = theme?.variant ? theme.variant : 'primary'\n\n\tif (variant === 'primary') {\n\t\tswitch (theme?.brand) {\n\t\t\tcase 'hashicorp':\n\t\t\t\treturn 'primary'\n\t\t\tcase 'boundary':\n\t\t\tcase 'consul':\n\t\t\tcase 'nomad':\n\t\t\tcase 'packer':\n\t\t\tcase 'terraform':\n\t\t\tcase 'vagrant':\n\t\t\tcase 'vault':\n\t\t\tcase 'waypoint':\n\t\t\t\treturn theme.brand\n\t\t\tcase 'neutral':\n\t\t\t\treturn 'secondary-high-contrast'\n\t\t\tdefault:\n\t\t\t\treturn 'primary'\n\t\t}\n\t}\n\n\tif (variant === 'secondary') {\n\t\treturn 'secondary'\n\t}\n\n\tif (\n\t\tvariant === 'tertiary' ||\n\t\tvariant === 'tertiary-neutral' ||\n\t\tvariant === 'ghost'\n\t) {\n\t\treturn 'tertiary'\n\t}\n\n\tthrow new Error(\n\t\t`Unable to determine HDS Button color from theme: ${JSON.stringify(theme)}`,\n\t)\n}\n\nexport const LINK_TYPE_ICON_MAP = {\n\tinbound: 'arrow-right',\n\toutbound: 'external-link',\n\tdownload: 'download',\n\tanchor: 'anchor',\n}\n"],"names":["determineColor","theme","variant","LINK_TYPE_ICON_MAP"],"mappings":"AAuBO,SAASA,EAAeC,GAA4B;AAC1D,QAAMC,IAAwBD,GAAO,UAAUA,EAAM,UAAU;AAE/D,MAAIC,MAAY;AACf,YAAQD,GAAO,OAAA;AAAA,MACd,KAAK;AACJ,eAAO;AAAA,MACR,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AACJ,eAAOA,EAAM;AAAA,MACd,KAAK;AACJ,eAAO;AAAA,MACR;AACC,eAAO;AAAA,IAAA;AAIV,MAAIC,MAAY;AACf,WAAO;AAGR,MACCA,MAAY,cACZA,MAAY,sBACZA,MAAY;AAEZ,WAAO;AAGR,QAAM,IAAI;AAAA,IACT,oDAAoD,KAAK,UAAUD,CAAK,CAAC;AAAA,EAAA;AAE3E;AAEO,MAAME,IAAqB;AAAA,EACjC,SAAS;AAAA,EACT,UAAU;AAAA,EACV,UAAU;AAAA,EACV,QAAQ;AACT;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/menu-primitive/index.tsx"],"sourcesContent":["'use client'\n\nimport {\n\tuseMemo,\n\tuseState,\n\tuseRef,\n\tuseCallback,\n\ttype ReactNode,\n\ttype FocusEvent,\n\ttype KeyboardEvent,\n\ttype HTMLAttributes,\n} from 'react'\nimport classNames from 'classnames'\nimport {\n\tMenuPrimitiveContext,\n\tuseMenuPrimitive,\n\ttype MenuPrimitiveContextState,\n} from './use-menu-primitive'\nimport s from './styles.module.css'\n\ninterface MenuPrimitiveProps extends HTMLAttributes<HTMLDivElement> {\n\tonClose?: () => void\n\tisFullWidth?: boolean\n\tchildren: ReactNode\n}\n\nconst Provider = ({\n\tonClose,\n\tisFullWidth,\n\tchildren,\n\tclassName,\n\t...rest\n}: MenuPrimitiveProps) => {\n\tconst [isOpen, setIsOpen] = useState(false)\n\tconst menuRef = useRef<HTMLDivElement | null>(null)\n\tconst toggleRef = useRef<HTMLDivElement | null>(null)\n\n\tconst closeMenu = useCallback(() => {\n\t\tsetIsOpen(false)\n\t\tif (onClose) {\n\t\t\tonClose()\n\t\t}\n\t}, [setIsOpen, onClose])\n\n\tconst onClickToggle = useCallback(() => {\n\t\tsetIsOpen((prevState) => !prevState)\n\t\ttoggleRef?.current?.focus()\n\t}, [toggleRef, setIsOpen])\n\n\tconst onFocusOut = useCallback(\n\t\t(event: FocusEvent) => {\n\t\t\tif (\n\t\t\t\t!menuRef?.current?.contains(\n\t\t\t\t\tevent.relatedTarget || document.activeElement
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/menu-primitive/index.tsx"],"sourcesContent":["'use client'\n\nimport {\n\tuseMemo,\n\tuseState,\n\tuseRef,\n\tuseCallback,\n\ttype ReactNode,\n\ttype FocusEvent,\n\ttype KeyboardEvent,\n\ttype HTMLAttributes,\n} from 'react'\nimport classNames from 'classnames'\nimport {\n\tMenuPrimitiveContext,\n\tuseMenuPrimitive,\n\ttype MenuPrimitiveContextState,\n} from './use-menu-primitive'\nimport s from './styles.module.css'\n\ninterface MenuPrimitiveProps extends HTMLAttributes<HTMLDivElement> {\n\tonClose?: () => void\n\tisFullWidth?: boolean\n\tchildren: ReactNode\n}\n\nconst Provider = ({\n\tonClose,\n\tisFullWidth,\n\tchildren,\n\tclassName,\n\t...rest\n}: MenuPrimitiveProps) => {\n\tconst [isOpen, setIsOpen] = useState(false)\n\tconst menuRef = useRef<HTMLDivElement | null>(null)\n\tconst toggleRef = useRef<HTMLDivElement | null>(null)\n\n\tconst closeMenu = useCallback(() => {\n\t\tsetIsOpen(false)\n\t\tif (onClose) {\n\t\t\tonClose()\n\t\t}\n\t}, [setIsOpen, onClose])\n\n\tconst onClickToggle = useCallback(() => {\n\t\tsetIsOpen((prevState) => !prevState)\n\t\ttoggleRef?.current?.focus()\n\t}, [toggleRef, setIsOpen])\n\n\tconst onFocusOut = useCallback(\n\t\t(event: FocusEvent) => {\n\t\t\tif (\n\t\t\t\t!menuRef?.current?.contains(\n\t\t\t\t\tevent.relatedTarget || document.activeElement,\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tcloseMenu()\n\t\t\t}\n\t\t},\n\t\t[closeMenu],\n\t)\n\n\tconst onKeyUp = useCallback(\n\t\t(event: KeyboardEvent) => {\n\t\t\tif (event.key === 'Escape') {\n\t\t\t\tcloseMenu()\n\t\t\t\ttoggleRef?.current?.querySelector('button')?.focus()\n\t\t\t}\n\t\t},\n\t\t[closeMenu],\n\t)\n\n\tconst contextValue: MenuPrimitiveContextState = useMemo(\n\t\t() => ({\n\t\t\tisOpen,\n\t\t\tonClickToggle,\n\t\t\ttoggleRef,\n\t\t\tcloseMenu,\n\t\t}),\n\t\t[isOpen, onClickToggle, toggleRef, closeMenu],\n\t)\n\n\treturn (\n\t\t<MenuPrimitiveContext.Provider value={contextValue}>\n\t\t\t<div\n\t\t\t\tclassName={classNames(\n\t\t\t\t\ts['menu-primitive'],\n\t\t\t\t\t{\n\t\t\t\t\t\t[s['width-full']]: isFullWidth,\n\t\t\t\t\t},\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tonBlur={onFocusOut}\n\t\t\t\tonKeyUp={onKeyUp}\n\t\t\t\tref={menuRef}\n\t\t\t\t{...rest}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t</MenuPrimitiveContext.Provider>\n\t)\n}\n\nconst Toggle = ({ children }: { children: ReactNode }) => {\n\tconst { toggleRef } = useMenuPrimitive()\n\treturn (\n\t\t<div className=\"hds-menu-primitive__toggle\" ref={toggleRef}>\n\t\t\t{children}\n\t\t</div>\n\t)\n}\n\nconst Content = ({ children }: { children: ReactNode }) => {\n\tconst { isOpen } = useMenuPrimitive()\n\treturn (\n\t\t<div className={isOpen ? s.isOpen : s.isClosed} tabIndex={-1}>\n\t\t\t{children}\n\t\t</div>\n\t)\n}\n\nexport { Provider, Toggle, Content }\n"],"names":["Provider","onClose","isFullWidth","children","className","rest","isOpen","setIsOpen","useState","menuRef","useRef","toggleRef","closeMenu","useCallback","prevState","event","contextValue","useMemo","onClickToggle","jsx","MenuPrimitiveContext","classNames","s","onFocusOut","onKeyUp","useMenuPrimitive"],"mappings":";;;;;;AA0BkB,MACjBA,IAAA,CAAA;AAAA,EACA,SAAAC;AAAA,EACA,aAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACD,GAAAC;AACC,MAAA;AACA,QAAM,CAAAC,GAAAC,KAA4CC,EAAA,EAAA,GAC5CC,IAAAC,EAAY,OAEZC,IAAYD,EAAA,OACjBE,IAAeC,EAAA,MAAA;AACf,IAAAN,IAAa,QAEbN,EAAA;AAAA,EAGD,GAAA,CAAAM,GAAMN,CAAgB,CAAA,OACVY,QAAwB;AACnC,IAAAN,EAAA,CAAWO,MAAS,CAAAA,CAAM,GAC3BH,GAAI,SAAW,MAAU;AAAA,EAEzB,GAAA,CAAAA,GAAMJ,CAAa,CAAA,OACKM;AAAA,IACtB,CAAAE,MACE;AAAkB,MAClBN,GAAM;QACPM,EACC,iBAAA,SAAA;AAAA,MACD,KACDH,EAAA;AAAA,IAED;AAAA,IACD,CAAAA,CAAA;AAAA,EAEA,OAC2BC;AAAA,IACzB,CAAAE,MAAI;AACH,gBAAU,aACVH,EAAA,GACDD,GAAA,SAAA,cAAA,QAAA,GAAA,MAAA;AAAA,IAED;AAAA,IACD,CAAAC,CAAA;AAAA,EAEA,GACCI,IAAOC;AAAA,IAAA,OACN;AAAA,MACA,QAAAX;AAAA,MACA,eAAAY;AAAA,MACA,WAAAP;AAAA,MACD,WAAAC;AAAA,IACA;AAAA,IACD,CAAAN,GAAAY,GAAAP,GAAAC,CAAA;AAAA,EAEA;AAEE,SAAC,gBAAAO,EAAAC,EAAA,UAAA,EAAA,OAAAJ,GAAA,UAAA,gBAAAG;AAAA,IAAA;AAAA,IAAA;AAAA,MACW,WACRE;AAAA,QACFC,EAAA,gBAAA;AAAA,QAAA;AAAA,UAEA,CAAAA,EAAA,YAAA,CAAA,GAAApB;AAAA,QACA;AAAA,QACDE;AAAA,MACA;AAAA,MACA,QAAAmB;AAAA,MACA,SAAAC;AAAA,MACC,KAAGf;AAAA,MAEH,GAAAJ;AAAA,MAAA,UAAAF;AAAA;EAIL,EAAA,CAAA;AAEA,OACS,CAAA,EAAA,UAAAA;AACR,6BACM;AAIP,SAAA,gBAAAgB,EAAA,OAAA,EAAA,WAAA,8BAAA,KAAAR,GAAA,UAAAR,EAAA,CAAA;AAEA,OACS,CAAA,EAAO,UAAAA;AACf,QAAA,EAAA,QAAAG,EAAA,IAAAmB,EACM;AAIP,SAAA,gBAAAN,EAAA,OAAA,EAAA,WAAAb,IAAAgB,EAAA,SAAAA,EAAA,UAAA,UAAA,IAAA,UAAAnB,EAAA,CAAA;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-menu-primitive.js","sources":["../../../src/components/menu-primitive/use-menu-primitive.ts"],"sourcesContent":["'use client'\n\nimport {\n\tcreateContext,\n\tuseContext,\n\ttype MouseEventHandler,\n\ttype RefObject,\n} from 'react'\n\nexport interface MenuPrimitiveContextState {\n\tisOpen: boolean\n\tonClickToggle: MouseEventHandler<HTMLButtonElement>\n\ttoggleRef: RefObject<HTMLDivElement>\n\tcloseMenu: () => void\n}\n\nexport const MenuPrimitiveContext = createContext<\n\tMenuPrimitiveContextState | undefined\n>(undefined)\nMenuPrimitiveContext.displayName = 'MenuPrimitiveContext'\n\nexport function useMenuPrimitive(): MenuPrimitiveContextState {\n\tconst context = useContext(MenuPrimitiveContext)\n\tif (context === undefined) {\n\t\tthrow new Error(\n\t\t\t'useMenuPrimitive must be used within a MenuPrimitiveContext.Provider'
|
|
1
|
+
{"version":3,"file":"use-menu-primitive.js","sources":["../../../src/components/menu-primitive/use-menu-primitive.ts"],"sourcesContent":["'use client'\n\nimport {\n\tcreateContext,\n\tuseContext,\n\ttype MouseEventHandler,\n\ttype RefObject,\n} from 'react'\n\nexport interface MenuPrimitiveContextState {\n\tisOpen: boolean\n\tonClickToggle: MouseEventHandler<HTMLButtonElement>\n\ttoggleRef: RefObject<HTMLDivElement>\n\tcloseMenu: () => void\n}\n\nexport const MenuPrimitiveContext = createContext<\n\tMenuPrimitiveContextState | undefined\n>(undefined)\nMenuPrimitiveContext.displayName = 'MenuPrimitiveContext'\n\nexport function useMenuPrimitive(): MenuPrimitiveContextState {\n\tconst context = useContext(MenuPrimitiveContext)\n\tif (context === undefined) {\n\t\tthrow new Error(\n\t\t\t'useMenuPrimitive must be used within a MenuPrimitiveContext.Provider',\n\t\t)\n\t}\n\treturn context\n}\n"],"names":["MenuPrimitiveContext","createContext","useMenuPrimitive","context","useContext"],"mappings":";;AAmBA,MAAAA,IAAqBC,EAAc,MAAA;AAE5BD,gBAAuD;AAC7D,SAAME;AACN,QAAIC,IAAYC,EAAWJ,CAAA;AAC1B,MAAAG,MAAU;AAAA,UACT,IAAA;AAAA,MACD;AAAA,IACD;AAED,SAAAA;;"}
|