@marwes-ui/core 1.4.1 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -4
- package/dist/index.d.ts +23 -1
- package/dist/index.js +20 -13
- package/dist/index.js.map +1 -1
- package/package.json +22 -2
package/README.md
CHANGED
|
@@ -152,10 +152,10 @@ Use these helpers when custom styling needs to stay connected to the active prov
|
|
|
152
152
|
- `mwThemeVars` is the default custom styling API. It returns CSS `var(...)` references such as `"var(--mw-spacing-sp-24)"`.
|
|
153
153
|
- `mwThemeVarNames` returns raw custom property names such as `"--mw-spacing-sp-24"` for assignment, inspection, tests, and bridge packages.
|
|
154
154
|
- `mwVar()` wraps a custom `--mw-*` property name in `var(...)`, with optional fallback support.
|
|
155
|
-
- `
|
|
155
|
+
- `mwTheme` mirrors `mwThemeVars` as a plain object for styled-components and Emotion theme providers. `mwStyledTheme` remains as a deprecated compatibility alias.
|
|
156
156
|
|
|
157
157
|
```ts
|
|
158
|
-
import {
|
|
158
|
+
import { mwTheme, mwThemeVarNames, mwThemeVars, mwVar } from "@marwes-ui/core"
|
|
159
159
|
|
|
160
160
|
mwThemeVars.spacing.sp24 // "var(--mw-spacing-sp-24)"
|
|
161
161
|
mwThemeVars.color.text // "var(--mw-color-text)"
|
|
@@ -164,11 +164,13 @@ mwThemeVars.ui.radius // "var(--mw-ui-radius)"
|
|
|
164
164
|
|
|
165
165
|
mwThemeVarNames.spacing.sp24 // "--mw-spacing-sp-24"
|
|
166
166
|
mwVar("--mw-color-text", "#141414") // "var(--mw-color-text, #141414)"
|
|
167
|
-
|
|
167
|
+
mwTheme.spacing.sp24 // "var(--mw-spacing-sp-24)"
|
|
168
168
|
```
|
|
169
169
|
|
|
170
170
|
This enables one theme contract across plain CSS, CSS Modules, CSS-in-JS, vanilla-extract, Tailwind-style config files, inline style objects, React, Vue, Svelte, and future adapters. Because the helpers only expose CSS variable references and names, they remain framework-agnostic and follow any `ThemeInput` resolved by the provider.
|
|
171
171
|
|
|
172
|
+
`mwTheme`, `mwStyledTheme`, and `mwThemeVars` are CSS-reference objects, not resolved runtime themes. Values such as `"var(--mw-color-primary-base)"` are intended for CSS evaluation inside the provider scope and can be empty when JavaScript tries to resolve them from `:root`. Never use these helpers as the source for JavaScript color calculations, aliases, charts, or design-tool bridges. Use the adapter's `useTheme()` hook when logic needs concrete values such as `"#2457FF"`.
|
|
173
|
+
|
|
172
174
|
Keep the APIs separate:
|
|
173
175
|
- `Spacings.sp24` returns `"sp-24"` for Marwes component props.
|
|
174
176
|
- `mwThemeVars.spacing.sp24` returns `"var(--mw-spacing-sp-24)"` for custom styling.
|
|
@@ -264,7 +266,8 @@ Theme:
|
|
|
264
266
|
- `createMarwesThemeStyle`
|
|
265
267
|
- `mwThemeVars`
|
|
266
268
|
- `mwThemeVarNames`
|
|
267
|
-
- `
|
|
269
|
+
- `mwTheme`
|
|
270
|
+
- `mwStyledTheme` (deprecated compatibility alias)
|
|
268
271
|
- `mwVar`
|
|
269
272
|
- `lightThemeDefaults`
|
|
270
273
|
- `darkThemeDefaults`
|
package/dist/index.d.ts
CHANGED
|
@@ -3737,6 +3737,11 @@ declare const storybookButtonGeneralArgTypes: {
|
|
|
3737
3737
|
readonly control: "select";
|
|
3738
3738
|
readonly options: readonly ["primary", "secondary", "neutral", "text", "success", "danger"];
|
|
3739
3739
|
};
|
|
3740
|
+
readonly type: {
|
|
3741
|
+
readonly control: "select";
|
|
3742
|
+
readonly options: readonly ["button", "submit", "reset"];
|
|
3743
|
+
readonly description: "Native form behavior; defaults to \"button\". Form actions (submit/reset) take precedence. Ignored for anchors.";
|
|
3744
|
+
};
|
|
3740
3745
|
readonly iconLeft: {
|
|
3741
3746
|
readonly control: "select";
|
|
3742
3747
|
readonly options: ("tablet" | "info" | "search" | "repeat" | "bold" | "link" | "save" | "edit" | "upload" | "download" | "copy" | "delete" | "code" | "airplay" | "alertCircle" | "alertOctagon" | "alertTriangle" | "alignCenter" | "alignJustify" | "alignLeft" | "alignRight" | "arrowDown" | "arrowDownCircle" | "arrowDownLeft" | "arrowDownRight" | "arrowIn" | "arrowInCircle" | "arrowInSquare" | "arrowLeft" | "arrowLeftCircle" | "arrowOut" | "arrowOutCircle" | "arrowOutSquare" | "arrowRight" | "arrowRightCircle" | "arrowUp" | "arrowUpCircle" | "arrowUpLeft" | "arrowUpRight" | "atSign" | "barChart" | "barChart2" | "barChart3" | "barChart4" | "bell" | "bluetooth" | "bookmark" | "calendar" | "camera" | "cast" | "check" | "checkCircle" | "checkSquare" | "chevronDown" | "chevronLeft" | "chevronRight" | "chevronUp" | "chevronsDown" | "chevronsLeft" | "chevronsRight" | "chevronsUp" | "circle" | "clipboard" | "clock" | "command" | "compass" | "cornerDownLeft" | "cornerDownRight" | "cornerLeftDown" | "cornerLeftUp" | "cornerRightDown" | "cornerRightUp" | "cornerUpLeft" | "cornerUpRight" | "cpu" | "creditCard" | "database" | "disc" | "dollarSign" | "downloadCloud" | "edit2" | "edit3" | "expand" | "externalLink" | "eye" | "eyeOff" | "facebook" | "fastForward" | "file" | "fileMinus" | "fileMinus2" | "filePlus" | "filePlus2" | "fileText" | "fileX" | "fileX2" | "film" | "flag" | "folder" | "folderMinus" | "folderMinus2" | "folderPlus" | "folderPlus2" | "folderX" | "folderX2" | "grid" | "hardDrive" | "hash" | "headphones" | "heart" | "helpCircle" | "hexagon" | "home" | "home2" | "image" | "inbox" | "italic" | "layout" | "layout2" | "layout3" | "layout4" | "layout5" | "layout6" | "lineChart" | "lineChart2" | "list" | "loader" | "lock" | "mail" | "mapMarker1" | "mapMarker2" | "mapMarker3" | "maximize" | "maximize2" | "menu" | "messageCircle" | "messageSquare" | "mic" | "minimize" | "minimize3" | "minus" | "minusCircle" | "minusSquare" | "monitor" | "moon" | "moreHorizontal" | "moreVertical" | "move" | "music" | "octagon" | "paperclip" | "pause" | "pauseCircle" | "percent" | "phone" | "pieChart" | "pieChart2" | "pieChart3" | "pieChart4" | "pieChart5" | "play" | "playCircle" | "plus" | "plusCircle" | "plusSquare" | "power" | "printer" | "radio" | "refreshCcw" | "refreshCw" | "rewind" | "rotateLeft" | "rotateRight" | "rss" | "scissors" | "server" | "settings" | "share" | "shoppingBag" | "shoppingCart" | "shuffle" | "skipBack" | "skipForward" | "slash" | "sliders" | "smartphone" | "speaker" | "square" | "star" | "stopCircle" | "strikethrough" | "sun" | "table" | "table2" | "tag" | "thumbsDown" | "thumbsUp" | "trash" | "trendingDown" | "trendingUp" | "triangle" | "tv" | "twitter" | "type" | "underline" | "unlock" | "uploadCloud" | "user" | "userCheck" | "userCircle" | "userMinus" | "userPlus" | "userX" | "users" | "video" | "videoOff" | "volume" | "volume1" | "volume2" | "volumeX" | "watch" | "wifi" | "x" | "xCircle" | "xSquare" | "zoomIn" | "zoomOut" | undefined)[];
|
|
@@ -4106,6 +4111,7 @@ declare const storybookSliderArgTypes: {
|
|
|
4106
4111
|
};
|
|
4107
4112
|
};
|
|
4108
4113
|
declare const storybookDocsDescription: {
|
|
4114
|
+
readonly primaryButton: "PrimaryButton controls visual emphasis and defaults to type=\"button\". Set type=\"submit\" for a form, or use SubmitButton for a fixed submit purpose.";
|
|
4109
4115
|
readonly linkButton: "LinkButton locks navigation semantics, renders as an anchor, and keeps the canonical text treatment. Use Button for intentional visual deviations.";
|
|
4110
4116
|
readonly destructiveButton: "DestructiveButton locks destructive semantics, uses the canonical danger treatment, and requires confirmation by default. Use Button for intentional exceptions.";
|
|
4111
4117
|
readonly submitButton: "SubmitButton locks form-submit semantics, always renders as a button, and keeps the canonical primary treatment.";
|
|
@@ -5139,9 +5145,25 @@ interface ResolvedButtonLoading {
|
|
|
5139
5145
|
spinnerVariant: SpinnerVariant;
|
|
5140
5146
|
loadingLabel?: string;
|
|
5141
5147
|
}
|
|
5148
|
+
/** Accessible-name contract for controls that never render visible text. */
|
|
5149
|
+
type AccessibleButtonName = {
|
|
5150
|
+
label: string;
|
|
5151
|
+
ariaLabel?: string;
|
|
5152
|
+
ariaLabelledBy?: string;
|
|
5153
|
+
} | {
|
|
5154
|
+
label?: string;
|
|
5155
|
+
ariaLabel: string;
|
|
5156
|
+
ariaLabelledBy?: string;
|
|
5157
|
+
} | {
|
|
5158
|
+
label?: string;
|
|
5159
|
+
ariaLabel?: string;
|
|
5160
|
+
ariaLabelledBy: string;
|
|
5161
|
+
};
|
|
5142
5162
|
type ButtonOptions = {
|
|
5143
5163
|
as?: "button" | "a";
|
|
5144
5164
|
href?: string;
|
|
5165
|
+
/** Native form behavior. Defaults to "button"; submit/reset actions take precedence. Ignored for anchors. */
|
|
5166
|
+
type?: "button" | "submit" | "reset";
|
|
5145
5167
|
size?: ButtonSize;
|
|
5146
5168
|
variant?: ButtonVariant;
|
|
5147
5169
|
disabled?: boolean;
|
|
@@ -10483,4 +10505,4 @@ interface SkipLinkRenderKit {
|
|
|
10483
10505
|
|
|
10484
10506
|
declare function createSkipLinkRecipe(opts: SkipLinkOptions): SkipLinkRenderKit;
|
|
10485
10507
|
|
|
10486
|
-
export { type AccordionA11yProps, type AccordionOptions, type AccordionRenderKit, type AvatarA11yProps, type AvatarDataAttributes, type AvatarOptions, type AvatarRenderContent, type AvatarRenderKit, AvatarSize, AvatarType, type BadgeA11yProps, type BadgeOptions, type BadgeRenderKit, BadgeVariant, type BannerA11yProps, type BannerOptions, type BannerRenderKit, BannerVariant, type BreadcrumbA11yProps, type BreadcrumbEntryRenderKit, type BreadcrumbHomeA11yProps, type BreadcrumbHomeRenderKit, type BreadcrumbItem, type BreadcrumbItemA11yProps, type BreadcrumbItemRenderKit, type BreadcrumbListA11yProps, type BreadcrumbOptions, type BreadcrumbRenderKit, type BreadcrumbSeparatorA11yProps, type ButtonA11yProps, ButtonAction, type ButtonLoadingOptions, type ButtonOptions, type ButtonRenderKit, ButtonSize, ButtonVariant, type CardOptions, type CardRenderKit, type CheckboxA11y, type CheckboxProps, type CheckboxRenderKit, type CheckboxState, type ColorInput, type ColorRole, type ContextMenuA11yProps, type ContextMenuActionItem, type ContextMenuActionItemRenderKit, type ContextMenuDividerA11yProps, type ContextMenuDividerItem, type ContextMenuDividerRenderKit, type ContextMenuEntry, type ContextMenuEntryRenderKit, type ContextMenuItemA11yProps, type ContextMenuItemKind, type ContextMenuOptions, type ContextMenuRenderKit, type CssVars, type CurrencyCode, DEFAULT_PROGRESS_BAR_LABEL, DEFAULT_PROGRESS_BAR_MAX, DEFAULT_PROGRESS_BAR_MIN, DENSITY_SCALES, type DatePickerA11yProps, type DatePickerDataAttributes, type DatePickerDay, type DatePickerDayRenderKit, type DatePickerDayState, type DatePickerDevice, type DatePickerOptions, type DatePickerRenderKit, type Density, type DensityScale, type DialogA11yProps, type DialogOptions, type DialogRenderKit, type DialogSize, type DividerA11y, type DividerDataAttributes, type DividerOptions, type DividerOrientation, type DividerRenderKit, type DividerSize, type DrawerA11yProps, type DrawerOptions, type DrawerPanelRenderKit, type DrawerPlacement, type DrawerRenderKit, type DrawerScrimRenderKit, type DrawerSize, type FamilySemanticDefinition, type FieldComparisonRow, type FontLoadingConfig, type FontLoadingMode, type FontLoadingOptions, type HeadingA11y, type HeadingLevel, type HeadingOptions, type HeadingRenderKit, type HeadingSize, type IconA11yProps, type IconColor, IconName, IconName as IconNameType, type IconOptions, type IconPreset, type IconRenderKit, type IconSize, type IconSizeKey, type IconStrokeWidth, type IconStrokeWidthKey, type InputA11yProps, type InputOptions, type InputOtpA11yProps, type InputOtpOptions, type InputOtpRenderKit, type InputRenderKit, type InputTone, type LabeledCopy, type MarwesThemeScriptOptions, type MarwesThemeStyleOptions, type MwAvailableFont, type MwFontFallback, type MwGoogleFontFamily, type MwStyledTheme, type MwTheme, type MwThemeMedia, type MwThemeVarName, type MwThemeVarNames, type MwThemeVarReference, type MwThemeVars, type PaginationA11yProps, type PaginationAdaptiveMaxVisibleItemsOptions, type PaginationAdaptiveProfile, type PaginationAdaptiveProfileOptions, type PaginationControlA11yProps, type PaginationControlDirection, type PaginationControlDisplay, type PaginationControlOptions, type PaginationControlRenderKit, type PaginationEllipsisA11yProps, type PaginationEllipsisRenderKit, type PaginationGetItemAriaLabel, type PaginationItem, type PaginationItemAriaLabelOptions, type PaginationItemType, type PaginationListA11yProps, type PaginationListItemRenderKit, type PaginationListRenderKit, type PaginationOptions, type PaginationPageA11yProps, type PaginationPageOptions, type PaginationPageRenderKit, type PaginationRenderKit, type PaginationReservedItemCountOptions, type PaginationResolvedControlDisplay, type ParagraphA11y, type ParagraphOptions, type ParagraphRenderKit, type ParagraphSize, type PersonalityName, type ProgressBarA11yProps, type ProgressBarDataAttributes, type ProgressBarOptions, type ProgressBarRenderKit, ProgressBarSize, ProgressBarState, type PurposeSemanticDefinition, type RadioA11y, type RadioOptions, type RadioRenderKit, type ResolvedButtonLoading, type ResolvedTheme, type RichTextA11yProps, type RichTextFormat, type RichTextOptions, type RichTextRenderKit, type SecondaryColorRole, type SegmentedControlA11yProps, type SegmentedControlItemA11yProps, type SegmentedControlItemOptions, type SegmentedControlItemRenderKit, type SegmentedControlItemState, type SegmentedControlNavigationDirection, type SegmentedControlOptions, type SegmentedControlRenderKit, type SegmentedControlSize, type SegmentedControlVariant, type SelectA11yProps, type SelectAppearance, type SelectMode, type SelectOption, type SelectOptions, type SelectRenderKit, type SemanticAttributeDefinition, type SemanticAttributeName, type SemanticAttributeValue, type SemanticAttributes, type SemanticFamily, type SemanticHeadingLevel, type SemanticIntent, type SemanticLayer, type SemanticOrientation, type SemanticOutcome, type SemanticPurpose, type SkeletonA11yProps, SkeletonAnimation, type SkeletonDataAttributes, type SkeletonDimension, type SkeletonOptions, type SkeletonRenderKit, SkeletonVariant, type SkipLinkOptions, type SkipLinkRenderKit, type SliderA11yProps, type SliderDataAttributes, type SliderOptions, type SliderRenderKit, type SpacingA11y, type SpacingDataAttributes, type SpacingOptions, type SpacingRenderKit, type SpacingSize, Spacings, type SpinnerA11yProps, type SpinnerDataAttributes, type SpinnerOptions, type SpinnerRenderKit, type SpinnerSize, type SpinnerSvgDefinition, type SpinnerSvgElement, type SpinnerSvgNode, SpinnerVariant, SpinnerVariants, type StatTileA11yProps, type StatTileDataAttributes, type StatTileOptions, type StatTileRenderKit, type StatTileTone, type StatTileTrendDirection, type SvgElementType, type SvgNode, type SwitchA11yProps, type SwitchOptions, type SwitchRenderKit, SwitchSize, type SystemThemeMode, type TabA11yProps, type TabGroupA11yIds, type TabGroupItemState, type TabNavigationDirection, type TabOptions, type TabRenderKit, type TextA11y, type TextAs, type TextOptions, type TextRenderKit, type TextTransform, type TextTypographyStyle, TextVariant, type TextareaA11yProps, type TextareaOptions, type TextareaRenderKit, type TextareaResize, type Theme, type ThemeBreakpointName, type ThemeBreakpoints, type ThemeInput, type ThemeInputColor, ThemeMode, type ThemeModeAttribute, type ThemeModeCSSRulesOptions, type ThemeModeRootTarget, type ThemePreference, type ThemeVariableStrategy, type ToastA11yProps, type ToastContainerOptions, type ToastIntent, type ToastOptions, type ToastPlacement, type ToastRenderKit, type ToastVariant, type ToneName, type TooltipA11yProps, type TooltipDataAttributes, type TooltipOptions, type TooltipRenderKit, type TypographyStyle, accordionPurposeComponentReference, accordionWhyPurposeComponents, avatarPurposeSemantics, avatarPurposes, badgePurposeComponentReference, badgePurposeSemantics, badgePurposes, badgeWhyPurposeComponents, bannerPurposeSemantics, bannerPurposes, buildAccordionFieldA11yIds, buildCheckboxA11y, buildCheckboxFieldA11yIds, buildCheckboxGroupFieldA11yIds, buildCurrencyHelperText, buildGoogleFontsUrl, buildHeadingA11y, buildInputFieldA11yIds, buildRadioA11y, buildRadioGroupFieldA11yIds, buildRichTextFieldA11yIds, buildSliderFieldA11yIds, buildSwitchFieldA11yIds, buildTabGroupA11yIds, buttonActionSemanticPurposes, buttonPurposeSemantics, buttonPurposes, buttonVariantVisualStyles, buttonWhySemanticComponents, canonicalSemanticAttributeNames, canonicalSemanticAttributeRegistry, canonicalSemanticAttributes, cardPurposeComponentReference, cardWhyPurposeComponents, checkboxRecipe, clampPaginationPage, clampProgressBarValue, createAccordionRecipe, createAvatarRecipe, createBadgeRecipe, createBannerRecipe, createBreadcrumbRecipe, createButtonRecipe, createCardRecipe, createContextMenuRecipe, createDatePickerRecipe, createDialogRecipe, createDividerRecipe, createDrawerRecipe, createFamilySemanticAttributes, createFontStack, createIconRecipe, createInputOtpRecipe, createInputRecipe, createMarwesThemeScript, createMarwesThemeStyle, createMwTheme, createMwThemeMedia, createPaginationControlRecipe, createPaginationEllipsisRecipe, createPaginationItems, createPaginationListItemRecipe, createPaginationListRecipe, createPaginationPageRecipe, createPaginationRecipe, createProgressBarRecipe, createPurposeSemanticAttributes, createRichTextRecipe, createSegmentedControlItemRecipe, createSegmentedControlRecipe, createSelectRecipe, createSkeletonRecipe, createSkipLinkRecipe, createSliderRecipe, createSpacingRecipe, createSpinnerRecipe, createStatTileRecipe, createSwitchRecipe, createTabRecipe, createTextareaRecipe, createToastRecipe, createTooltipRecipe, currencyCodes, darkThemeDefaults, defaultThemeBreakpoints, densityToCSSVars, dialogPurposeComponentReference, dialogPurposeSemantics, dialogPurposes, dialogWhyPurposeComponents, emptySemanticAttributes, escapeRichTextHtml, extractFontFamilyName, extractUsedWeights, familySemanticsRegistry, fieldComparisonRows, fieldWhyPurposeComponents, filterUndefinedSemanticAttributes, getCurrencySymbol, headingRecipe, iconNames, iconNamesList, iconRegistry, iconSizeScale, iconStrokeWidthScale, isRichTextHtmlEmpty, isSystemFont, isThemeMode, isThemePreference, lightThemeDefaults, mergeIdRefs, mergeSemanticAttributes, moveSegmentedControlSelection, moveTabSelection, mwAvailableFonts, mwFontFallbacks, mwGoogleFontFamilies, mwStyledTheme, mwTheme, mwThemeVarNames, mwThemeVars, mwVar, nextThemeMode, normalizeRichTextHtml, paragraphRecipe, progressBarSizes, progressBarStates, purposeSemanticsRegistry, radioPurposeComponentReference, radioRecipe, radioWhyPurposeComponents, resolveAccordionA11y, resolveAvatarA11y, resolveBadgeA11y, resolveBannerA11y, resolveBreadcrumbA11y, resolveBreadcrumbHomeA11y, resolveBreadcrumbItemA11y, resolveBreadcrumbListA11y, resolveBreadcrumbSeparatorA11y, resolveButtonLoading, resolveContextMenuA11y, resolveContextMenuDividerA11y, resolveContextMenuItemA11y, resolveDatePickerDayLabel, resolveDialogA11y, resolveDrawerA11y, resolveIconA11y, resolveIconSize, resolveIconStrokeWidth, resolvePaginationA11y, resolvePaginationAdaptiveMaxVisibleItems, resolvePaginationAdaptiveProfile, resolvePaginationControlA11y, resolvePaginationEllipsisA11y, resolvePaginationItemAriaLabel, resolvePaginationListA11y, resolvePaginationPageA11y, resolvePaginationReservedItemCount, resolveProgressBarA11y, resolveProgressBarBounds, resolveRichTextAllowedFormats, resolveSegmentedControlA11y, resolveSegmentedControlItemA11y, resolveSegmentedControlValue, resolveSelectMode, resolveServerThemeMode, resolveSkeletonA11y, resolveSliderA11y, resolveSpinnerA11y, resolveSpinnerSize, resolveStatTileTrendLabel, resolveSwitchA11y, resolveTabA11y, resolveTabValue, resolveThemeInput, resolveThemePreference, resolveToastA11y, resolveTone, resolveTooltipA11y, richTextCommandByFormat, richTextFormattingReference, richTextWhyUseIt, sanitizeCurrencyValue, sanitizeInputOtpValue, semanticFamilies, semanticFrameworkSupport, semanticIntents, semanticLayers, semanticOrientations, semanticOutcomes, semanticPurposes, shouldLoadGoogleFont, skeletonAnimations, skeletonVariants, sliderPurposeComponentReference, sliderWhyPurposeComponents, spinnerSizeScale, spinnerSizes, spinnerVariants, storybookA11yPolicy, storybookButtonGeneralArgTypes, storybookButtonIconArgTypes, storybookButtonPurposeArgTypes, storybookCheckboxArgTypes, storybookDatePickerArgTypes, storybookDividerArgTypes, storybookDocsDescription, storybookIconButtonArgTypes, storybookIconGalleryArgTypes, storybookIconGalleryDefaults, storybookIconNames, storybookLayout, storybookOptionalIconNames, storybookProgressBarArgTypes, storybookRadioArgTypes, storybookSkeletonArgTypes, storybookSliderArgTypes, storybookSpacingArgTypes, storybookSpinnerArgTypes, storybookStatTileArgTypes, switchPurposeComponentReference, switchWhyPurposeComponents, tabPurposeComponentReference, tabWhyPurposeComponents, textRecipe, themeModesToCSSRules, themeToCSSRule, themeToCSSVars, toastPurposeComponentReference, toastPurposeSemantics, toastPurposes, toastWhyPurposeComponents, validateSemanticRegistry };
|
|
10508
|
+
export { type AccessibleButtonName, type AccordionA11yProps, type AccordionOptions, type AccordionRenderKit, type AvatarA11yProps, type AvatarDataAttributes, type AvatarOptions, type AvatarRenderContent, type AvatarRenderKit, AvatarSize, AvatarType, type BadgeA11yProps, type BadgeOptions, type BadgeRenderKit, BadgeVariant, type BannerA11yProps, type BannerOptions, type BannerRenderKit, BannerVariant, type BreadcrumbA11yProps, type BreadcrumbEntryRenderKit, type BreadcrumbHomeA11yProps, type BreadcrumbHomeRenderKit, type BreadcrumbItem, type BreadcrumbItemA11yProps, type BreadcrumbItemRenderKit, type BreadcrumbListA11yProps, type BreadcrumbOptions, type BreadcrumbRenderKit, type BreadcrumbSeparatorA11yProps, type ButtonA11yProps, ButtonAction, type ButtonLoadingOptions, type ButtonOptions, type ButtonRenderKit, ButtonSize, ButtonVariant, type CardOptions, type CardRenderKit, type CheckboxA11y, type CheckboxProps, type CheckboxRenderKit, type CheckboxState, type ColorInput, type ColorRole, type ContextMenuA11yProps, type ContextMenuActionItem, type ContextMenuActionItemRenderKit, type ContextMenuDividerA11yProps, type ContextMenuDividerItem, type ContextMenuDividerRenderKit, type ContextMenuEntry, type ContextMenuEntryRenderKit, type ContextMenuItemA11yProps, type ContextMenuItemKind, type ContextMenuOptions, type ContextMenuRenderKit, type CssVars, type CurrencyCode, DEFAULT_PROGRESS_BAR_LABEL, DEFAULT_PROGRESS_BAR_MAX, DEFAULT_PROGRESS_BAR_MIN, DENSITY_SCALES, type DatePickerA11yProps, type DatePickerDataAttributes, type DatePickerDay, type DatePickerDayRenderKit, type DatePickerDayState, type DatePickerDevice, type DatePickerOptions, type DatePickerRenderKit, type Density, type DensityScale, type DialogA11yProps, type DialogOptions, type DialogRenderKit, type DialogSize, type DividerA11y, type DividerDataAttributes, type DividerOptions, type DividerOrientation, type DividerRenderKit, type DividerSize, type DrawerA11yProps, type DrawerOptions, type DrawerPanelRenderKit, type DrawerPlacement, type DrawerRenderKit, type DrawerScrimRenderKit, type DrawerSize, type FamilySemanticDefinition, type FieldComparisonRow, type FontLoadingConfig, type FontLoadingMode, type FontLoadingOptions, type HeadingA11y, type HeadingLevel, type HeadingOptions, type HeadingRenderKit, type HeadingSize, type IconA11yProps, type IconColor, IconName, IconName as IconNameType, type IconOptions, type IconPreset, type IconRenderKit, type IconSize, type IconSizeKey, type IconStrokeWidth, type IconStrokeWidthKey, type InputA11yProps, type InputOptions, type InputOtpA11yProps, type InputOtpOptions, type InputOtpRenderKit, type InputRenderKit, type InputTone, type LabeledCopy, type MarwesThemeScriptOptions, type MarwesThemeStyleOptions, type MwAvailableFont, type MwFontFallback, type MwGoogleFontFamily, type MwStyledTheme, type MwTheme, type MwThemeMedia, type MwThemeVarName, type MwThemeVarNames, type MwThemeVarReference, type MwThemeVars, type PaginationA11yProps, type PaginationAdaptiveMaxVisibleItemsOptions, type PaginationAdaptiveProfile, type PaginationAdaptiveProfileOptions, type PaginationControlA11yProps, type PaginationControlDirection, type PaginationControlDisplay, type PaginationControlOptions, type PaginationControlRenderKit, type PaginationEllipsisA11yProps, type PaginationEllipsisRenderKit, type PaginationGetItemAriaLabel, type PaginationItem, type PaginationItemAriaLabelOptions, type PaginationItemType, type PaginationListA11yProps, type PaginationListItemRenderKit, type PaginationListRenderKit, type PaginationOptions, type PaginationPageA11yProps, type PaginationPageOptions, type PaginationPageRenderKit, type PaginationRenderKit, type PaginationReservedItemCountOptions, type PaginationResolvedControlDisplay, type ParagraphA11y, type ParagraphOptions, type ParagraphRenderKit, type ParagraphSize, type PersonalityName, type ProgressBarA11yProps, type ProgressBarDataAttributes, type ProgressBarOptions, type ProgressBarRenderKit, ProgressBarSize, ProgressBarState, type PurposeSemanticDefinition, type RadioA11y, type RadioOptions, type RadioRenderKit, type ResolvedButtonLoading, type ResolvedTheme, type RichTextA11yProps, type RichTextFormat, type RichTextOptions, type RichTextRenderKit, type SecondaryColorRole, type SegmentedControlA11yProps, type SegmentedControlItemA11yProps, type SegmentedControlItemOptions, type SegmentedControlItemRenderKit, type SegmentedControlItemState, type SegmentedControlNavigationDirection, type SegmentedControlOptions, type SegmentedControlRenderKit, type SegmentedControlSize, type SegmentedControlVariant, type SelectA11yProps, type SelectAppearance, type SelectMode, type SelectOption, type SelectOptions, type SelectRenderKit, type SemanticAttributeDefinition, type SemanticAttributeName, type SemanticAttributeValue, type SemanticAttributes, type SemanticFamily, type SemanticHeadingLevel, type SemanticIntent, type SemanticLayer, type SemanticOrientation, type SemanticOutcome, type SemanticPurpose, type SkeletonA11yProps, SkeletonAnimation, type SkeletonDataAttributes, type SkeletonDimension, type SkeletonOptions, type SkeletonRenderKit, SkeletonVariant, type SkipLinkOptions, type SkipLinkRenderKit, type SliderA11yProps, type SliderDataAttributes, type SliderOptions, type SliderRenderKit, type SpacingA11y, type SpacingDataAttributes, type SpacingOptions, type SpacingRenderKit, type SpacingSize, Spacings, type SpinnerA11yProps, type SpinnerDataAttributes, type SpinnerOptions, type SpinnerRenderKit, type SpinnerSize, type SpinnerSvgDefinition, type SpinnerSvgElement, type SpinnerSvgNode, SpinnerVariant, SpinnerVariants, type StatTileA11yProps, type StatTileDataAttributes, type StatTileOptions, type StatTileRenderKit, type StatTileTone, type StatTileTrendDirection, type SvgElementType, type SvgNode, type SwitchA11yProps, type SwitchOptions, type SwitchRenderKit, SwitchSize, type SystemThemeMode, type TabA11yProps, type TabGroupA11yIds, type TabGroupItemState, type TabNavigationDirection, type TabOptions, type TabRenderKit, type TextA11y, type TextAs, type TextOptions, type TextRenderKit, type TextTransform, type TextTypographyStyle, TextVariant, type TextareaA11yProps, type TextareaOptions, type TextareaRenderKit, type TextareaResize, type Theme, type ThemeBreakpointName, type ThemeBreakpoints, type ThemeInput, type ThemeInputColor, ThemeMode, type ThemeModeAttribute, type ThemeModeCSSRulesOptions, type ThemeModeRootTarget, type ThemePreference, type ThemeVariableStrategy, type ToastA11yProps, type ToastContainerOptions, type ToastIntent, type ToastOptions, type ToastPlacement, type ToastRenderKit, type ToastVariant, type ToneName, type TooltipA11yProps, type TooltipDataAttributes, type TooltipOptions, type TooltipRenderKit, type TypographyStyle, accordionPurposeComponentReference, accordionWhyPurposeComponents, avatarPurposeSemantics, avatarPurposes, badgePurposeComponentReference, badgePurposeSemantics, badgePurposes, badgeWhyPurposeComponents, bannerPurposeSemantics, bannerPurposes, buildAccordionFieldA11yIds, buildCheckboxA11y, buildCheckboxFieldA11yIds, buildCheckboxGroupFieldA11yIds, buildCurrencyHelperText, buildGoogleFontsUrl, buildHeadingA11y, buildInputFieldA11yIds, buildRadioA11y, buildRadioGroupFieldA11yIds, buildRichTextFieldA11yIds, buildSliderFieldA11yIds, buildSwitchFieldA11yIds, buildTabGroupA11yIds, buttonActionSemanticPurposes, buttonPurposeSemantics, buttonPurposes, buttonVariantVisualStyles, buttonWhySemanticComponents, canonicalSemanticAttributeNames, canonicalSemanticAttributeRegistry, canonicalSemanticAttributes, cardPurposeComponentReference, cardWhyPurposeComponents, checkboxRecipe, clampPaginationPage, clampProgressBarValue, createAccordionRecipe, createAvatarRecipe, createBadgeRecipe, createBannerRecipe, createBreadcrumbRecipe, createButtonRecipe, createCardRecipe, createContextMenuRecipe, createDatePickerRecipe, createDialogRecipe, createDividerRecipe, createDrawerRecipe, createFamilySemanticAttributes, createFontStack, createIconRecipe, createInputOtpRecipe, createInputRecipe, createMarwesThemeScript, createMarwesThemeStyle, createMwTheme, createMwThemeMedia, createPaginationControlRecipe, createPaginationEllipsisRecipe, createPaginationItems, createPaginationListItemRecipe, createPaginationListRecipe, createPaginationPageRecipe, createPaginationRecipe, createProgressBarRecipe, createPurposeSemanticAttributes, createRichTextRecipe, createSegmentedControlItemRecipe, createSegmentedControlRecipe, createSelectRecipe, createSkeletonRecipe, createSkipLinkRecipe, createSliderRecipe, createSpacingRecipe, createSpinnerRecipe, createStatTileRecipe, createSwitchRecipe, createTabRecipe, createTextareaRecipe, createToastRecipe, createTooltipRecipe, currencyCodes, darkThemeDefaults, defaultThemeBreakpoints, densityToCSSVars, dialogPurposeComponentReference, dialogPurposeSemantics, dialogPurposes, dialogWhyPurposeComponents, emptySemanticAttributes, escapeRichTextHtml, extractFontFamilyName, extractUsedWeights, familySemanticsRegistry, fieldComparisonRows, fieldWhyPurposeComponents, filterUndefinedSemanticAttributes, getCurrencySymbol, headingRecipe, iconNames, iconNamesList, iconRegistry, iconSizeScale, iconStrokeWidthScale, isRichTextHtmlEmpty, isSystemFont, isThemeMode, isThemePreference, lightThemeDefaults, mergeIdRefs, mergeSemanticAttributes, moveSegmentedControlSelection, moveTabSelection, mwAvailableFonts, mwFontFallbacks, mwGoogleFontFamilies, mwStyledTheme, mwTheme, mwThemeVarNames, mwThemeVars, mwVar, nextThemeMode, normalizeRichTextHtml, paragraphRecipe, progressBarSizes, progressBarStates, purposeSemanticsRegistry, radioPurposeComponentReference, radioRecipe, radioWhyPurposeComponents, resolveAccordionA11y, resolveAvatarA11y, resolveBadgeA11y, resolveBannerA11y, resolveBreadcrumbA11y, resolveBreadcrumbHomeA11y, resolveBreadcrumbItemA11y, resolveBreadcrumbListA11y, resolveBreadcrumbSeparatorA11y, resolveButtonLoading, resolveContextMenuA11y, resolveContextMenuDividerA11y, resolveContextMenuItemA11y, resolveDatePickerDayLabel, resolveDialogA11y, resolveDrawerA11y, resolveIconA11y, resolveIconSize, resolveIconStrokeWidth, resolvePaginationA11y, resolvePaginationAdaptiveMaxVisibleItems, resolvePaginationAdaptiveProfile, resolvePaginationControlA11y, resolvePaginationEllipsisA11y, resolvePaginationItemAriaLabel, resolvePaginationListA11y, resolvePaginationPageA11y, resolvePaginationReservedItemCount, resolveProgressBarA11y, resolveProgressBarBounds, resolveRichTextAllowedFormats, resolveSegmentedControlA11y, resolveSegmentedControlItemA11y, resolveSegmentedControlValue, resolveSelectMode, resolveServerThemeMode, resolveSkeletonA11y, resolveSliderA11y, resolveSpinnerA11y, resolveSpinnerSize, resolveStatTileTrendLabel, resolveSwitchA11y, resolveTabA11y, resolveTabValue, resolveThemeInput, resolveThemePreference, resolveToastA11y, resolveTone, resolveTooltipA11y, richTextCommandByFormat, richTextFormattingReference, richTextWhyUseIt, sanitizeCurrencyValue, sanitizeInputOtpValue, semanticFamilies, semanticFrameworkSupport, semanticIntents, semanticLayers, semanticOrientations, semanticOutcomes, semanticPurposes, shouldLoadGoogleFont, skeletonAnimations, skeletonVariants, sliderPurposeComponentReference, sliderWhyPurposeComponents, spinnerSizeScale, spinnerSizes, spinnerVariants, storybookA11yPolicy, storybookButtonGeneralArgTypes, storybookButtonIconArgTypes, storybookButtonPurposeArgTypes, storybookCheckboxArgTypes, storybookDatePickerArgTypes, storybookDividerArgTypes, storybookDocsDescription, storybookIconButtonArgTypes, storybookIconGalleryArgTypes, storybookIconGalleryDefaults, storybookIconNames, storybookLayout, storybookOptionalIconNames, storybookProgressBarArgTypes, storybookRadioArgTypes, storybookSkeletonArgTypes, storybookSliderArgTypes, storybookSpacingArgTypes, storybookSpinnerArgTypes, storybookStatTileArgTypes, switchPurposeComponentReference, switchWhyPurposeComponents, tabPurposeComponentReference, tabWhyPurposeComponents, textRecipe, themeModesToCSSRules, themeToCSSRule, themeToCSSVars, toastPurposeComponentReference, toastPurposeSemantics, toastPurposes, toastWhyPurposeComponents, validateSemanticRegistry };
|
package/dist/index.js
CHANGED
|
@@ -5478,33 +5478,34 @@ function isDev2() {
|
|
|
5478
5478
|
return true;
|
|
5479
5479
|
}
|
|
5480
5480
|
var __DEV__2 = isDev2();
|
|
5481
|
+
function nonEmptyName(value) {
|
|
5482
|
+
const normalized = value?.trim();
|
|
5483
|
+
return normalized ? normalized : void 0;
|
|
5484
|
+
}
|
|
5481
5485
|
function resolveButtonA11y(opts, resolvedLoading) {
|
|
5482
5486
|
const tag = opts.as === "a" || !!opts.href ? "a" : "button";
|
|
5483
5487
|
const isDisabled = !!opts.disabled || resolvedLoading.isLoading && resolvedLoading.disableWhileLoading;
|
|
5488
|
+
const ariaLabelledBy = nonEmptyName(opts.ariaLabelledBy);
|
|
5489
|
+
const ariaLabel = nonEmptyName(opts.ariaLabel) ?? nonEmptyName(opts.label);
|
|
5490
|
+
const loadingAccessibleLabel = resolvedLoading.isLoading ? nonEmptyName(resolvedLoading.loadingLabel) : void 0;
|
|
5484
5491
|
if (__DEV__2) {
|
|
5485
5492
|
const iconOnly = opts.iconOnly || opts.hasVisibleText === false;
|
|
5486
|
-
|
|
5487
|
-
const loadingAccessibleLabel = resolvedLoading.isLoading ? resolvedLoading.loadingLabel : void 0;
|
|
5488
|
-
if (iconOnly && !accessibleLabel && !loadingAccessibleLabel) {
|
|
5493
|
+
if (iconOnly && !ariaLabelledBy && !ariaLabel && !loadingAccessibleLabel) {
|
|
5489
5494
|
console.warn(
|
|
5490
|
-
"[marwes] Icon-only Button requires ariaLabel,
|
|
5495
|
+
"[marwes] Icon-only Button requires label, ariaLabel, ariaLabelledBy, or loadingLabel while loading."
|
|
5491
5496
|
);
|
|
5492
5497
|
}
|
|
5493
5498
|
}
|
|
5494
5499
|
const common = {};
|
|
5495
|
-
if (
|
|
5496
|
-
|
|
5497
|
-
} else {
|
|
5498
|
-
const accessibleLabel = opts.ariaLabel ?? opts.label;
|
|
5499
|
-
if (accessibleLabel) common.ariaLabel = accessibleLabel;
|
|
5500
|
-
}
|
|
5500
|
+
if (ariaLabelledBy) common.ariaLabelledBy = ariaLabelledBy;
|
|
5501
|
+
else if (ariaLabel) common.ariaLabel = ariaLabel;
|
|
5501
5502
|
if (resolvedLoading.isLoading) common.ariaBusy = true;
|
|
5502
5503
|
if (isDisabled) common.ariaDisabled = true;
|
|
5503
5504
|
if (opts.toggle) common.ariaPressed = !!opts.pressed;
|
|
5504
5505
|
if (opts.ariaExpanded !== void 0) common.ariaExpanded = opts.ariaExpanded;
|
|
5505
5506
|
if (opts.ariaControls) common.ariaControls = opts.ariaControls;
|
|
5506
5507
|
if (tag === "button") {
|
|
5507
|
-
const nativeButtonType = opts.action === "submit" ? "submit" : opts.action === "reset" ? "reset" : "button";
|
|
5508
|
+
const nativeButtonType = opts.action === "submit" ? "submit" : opts.action === "reset" ? "reset" : opts.type ?? "button";
|
|
5508
5509
|
const a11y2 = { ...common, type: nativeButtonType };
|
|
5509
5510
|
if (isDisabled) a11y2.disabled = true;
|
|
5510
5511
|
return { tag, a11y: a11y2, blockClick: false };
|
|
@@ -5527,7 +5528,7 @@ function createButtonRecipe(opts) {
|
|
|
5527
5528
|
const { tag, a11y, blockClick } = resolveButtonA11y(opts, resolvedLoading);
|
|
5528
5529
|
const size = opts.size ?? "md";
|
|
5529
5530
|
const variant = opts.variant ?? "primary";
|
|
5530
|
-
const action = opts.action ?? (tag === "button" ? "button" : "navigate");
|
|
5531
|
+
const action = opts.action ?? (tag === "button" ? a11y.type ?? "button" : "navigate");
|
|
5531
5532
|
const hasAffordance = resolvedLoading.isLoading || Boolean(opts.iconLeft || opts.iconRight);
|
|
5532
5533
|
return {
|
|
5533
5534
|
tag,
|
|
@@ -12461,7 +12462,12 @@ var storybookButtonIconArgTypes = {
|
|
|
12461
12462
|
};
|
|
12462
12463
|
var storybookButtonGeneralArgTypes = {
|
|
12463
12464
|
...storybookButtonIconArgTypes,
|
|
12464
|
-
variant: storybookButtonVariantArgType
|
|
12465
|
+
variant: storybookButtonVariantArgType,
|
|
12466
|
+
type: {
|
|
12467
|
+
control: "select",
|
|
12468
|
+
options: ["button", "submit", "reset"],
|
|
12469
|
+
description: 'Native form behavior; defaults to "button". Form actions (submit/reset) take precedence. Ignored for anchors.'
|
|
12470
|
+
}
|
|
12465
12471
|
};
|
|
12466
12472
|
var storybookIconButtonArgTypes = {
|
|
12467
12473
|
icon: {
|
|
@@ -12680,6 +12686,7 @@ var storybookSliderArgTypes = {
|
|
|
12680
12686
|
ariaValueText: { control: "text" }
|
|
12681
12687
|
};
|
|
12682
12688
|
var storybookDocsDescription = {
|
|
12689
|
+
primaryButton: 'PrimaryButton controls visual emphasis and defaults to type="button". Set type="submit" for a form, or use SubmitButton for a fixed submit purpose.',
|
|
12683
12690
|
linkButton: "LinkButton locks navigation semantics, renders as an anchor, and keeps the canonical text treatment. Use Button for intentional visual deviations.",
|
|
12684
12691
|
destructiveButton: "DestructiveButton locks destructive semantics, uses the canonical danger treatment, and requires confirmation by default. Use Button for intentional exceptions.",
|
|
12685
12692
|
submitButton: "SubmitButton locks form-submit semantics, always renders as a button, and keeps the canonical primary treatment.",
|