@mittwald/flow-react-components 1.6.0-next.71 → 1.6.0-next.72
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/dist/assets/component-index.json +1 -1
- package/dist/assets/doc-properties.json +1 -1
- package/dist/css/all-layered.css +1 -1
- package/dist/css/all.css +8 -1
- package/dist/js/packages/components/src/components/AccentBox/AccentBox.mjs +8 -2
- package/dist/js/packages/components/src/components/AccentBox/AccentBox.mjs.map +1 -1
- package/dist/js/packages/components/src/components/AccentBox/AccentBox.module.mjs +5 -1
- package/dist/js/packages/components/src/components/AccentBox/AccentBox.module.mjs.map +1 -1
- package/dist/js/packages/components/src/components/Link/Link.module.mjs.map +1 -1
- package/dist/js/packages/design-tokens/dist/json-runtime/all-dark.mjs +8 -0
- package/dist/js/packages/design-tokens/dist/json-runtime/all-dark.mjs.map +1 -1
- package/dist/js/packages/design-tokens/dist/json-runtime/all-light.mjs +8 -0
- package/dist/js/packages/design-tokens/dist/json-runtime/all-light.mjs.map +1 -1
- package/dist/types/lib/theming/hooks/useDesignTokens.d.ts +8 -0
- package/package.json +10 -10
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import AccentBox_module_default from "./AccentBox.module.mjs";
|
|
4
4
|
import { PropsContextProvider } from "../../lib/propsContext/components/PropsContextProvider.mjs";
|
|
5
5
|
import { flowComponent } from "../../lib/componentFactory/flowComponent.mjs";
|
|
6
|
+
import dynamic from "../../lib/propsContext/dynamicProps/dynamic.mjs";
|
|
6
7
|
import { SectionHeadingReset } from "../Section/context.mjs";
|
|
7
8
|
import clsx from "clsx";
|
|
8
9
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -35,11 +36,16 @@ var AccentBox = flowComponent("AccentBox", (props) => {
|
|
|
35
36
|
aspectRatio,
|
|
36
37
|
...styleFromProps
|
|
37
38
|
};
|
|
38
|
-
const rootClassName = clsx(AccentBox_module_default.accentBox, backgroundColorFromColor ? AccentBox_module_default[backgroundColorFromColor] : isAFlowColor ? AccentBox_module_default[backgroundColor] : void 0, className);
|
|
39
|
+
const rootClassName = clsx(AccentBox_module_default.accentBox, backgroundColorFromColor ? AccentBox_module_default[backgroundColorFromColor] : isAFlowColor ? AccentBox_module_default[backgroundColor] : void 0, backgroundImage && AccentBox_module_default.backgroundImage, className);
|
|
39
40
|
const Element = elementType;
|
|
40
41
|
const contentColor = color === "default" ? void 0 : color;
|
|
42
|
+
const actionClassName = (slot) => slot === "action" ? AccentBox_module_default.action : void 0;
|
|
41
43
|
const propsContext = {
|
|
42
|
-
Link: {
|
|
44
|
+
Link: {
|
|
45
|
+
color: contentColor,
|
|
46
|
+
className: dynamic((props) => actionClassName(props.slot))
|
|
47
|
+
},
|
|
48
|
+
Button: { className: dynamic((props) => actionClassName(props.slot)) },
|
|
43
49
|
Text: { color: contentColor },
|
|
44
50
|
Heading: { color: contentColor },
|
|
45
51
|
Icon: { className: AccentBox_module_default.icon }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccentBox.mjs","names":["anyAccentBoxBackgroundColors","styles"],"sources":["../../../../../../../src/components/AccentBox/AccentBox.tsx"],"sourcesContent":["import type { CSSProperties, PropsWithChildren } from \"react\";\nimport type {\n AlphaColor,\n PropsWithClassName,\n PropsWithElementType,\n} from \"@/lib/types/props\";\nimport clsx from \"clsx\";\nimport styles from \"./AccentBox.module.scss\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport {
|
|
1
|
+
{"version":3,"file":"AccentBox.mjs","names":["anyAccentBoxBackgroundColors","styles"],"sources":["../../../../../../../src/components/AccentBox/AccentBox.tsx"],"sourcesContent":["import type { CSSProperties, PropsWithChildren } from \"react\";\nimport type {\n AlphaColor,\n PropsWithClassName,\n PropsWithElementType,\n} from \"@/lib/types/props\";\nimport clsx from \"clsx\";\nimport styles from \"./AccentBox.module.scss\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport {\n dynamic,\n type PropsContext,\n PropsContextProvider,\n} from \"@/lib/propsContext\";\nimport { SectionHeadingReset } from \"@/components/Section/context\";\n\nconst accentBoxBackgroundColors = [\n \"neutral\",\n \"blue\",\n \"violet\",\n \"teal\",\n \"lilac\",\n \"green\",\n \"navy\",\n \"gradient\",\n] as const;\n\ntype AccentBoxBackgroundColor = (typeof accentBoxBackgroundColors)[number];\ntype AccentBoxWithCustomBackgroundColor =\n AccentBoxBackgroundColor | (string & {});\n\nfunction isFlowColor(\n something: unknown,\n): something is AccentBoxBackgroundColor {\n const anyAccentBoxBackgroundColors =\n accentBoxBackgroundColors as readonly string[];\n return (\n typeof something === \"string\" &&\n anyAccentBoxBackgroundColors.includes(something)\n );\n}\n\nexport interface AccentBoxProps\n extends\n PropsWithChildren,\n PropsWithElementType<\"div\" | \"section\" | \"article\">,\n PropsWithClassName,\n FlowComponentProps<HTMLElement> {\n /** The background color of the accent box. @default \"neutral\" */\n backgroundColor?: AccentBoxWithCustomBackgroundColor;\n /** The content color of the accent box. @default \"default\" */\n color?: \"default\" | AlphaColor;\n /** The background image of the accent box. */\n backgroundImage?: string;\n /** The aspect ratio of the accent box. */\n aspectRatio?: CSSProperties[\"aspectRatio\"];\n}\n\n/**\n * @flr-generate all\n * @flowStatus beta\n */\nexport const AccentBox = flowComponent(\"AccentBox\", (props) => {\n const {\n color: colorFromProps,\n backgroundColor = \"neutral\",\n backgroundImage,\n children,\n elementType = \"div\",\n className,\n style: styleFromProps,\n aspectRatio,\n ref,\n } = props;\n\n const defaultColor =\n (colorFromProps as unknown as string) === \"gradient\" ||\n backgroundColor === \"gradient\"\n ? \"dark\"\n : \"default\";\n\n const color = colorFromProps ?? defaultColor;\n\n const isAFlowColor = isFlowColor(backgroundColor);\n\n // backwards compatibility\n const backgroundColorFromColor =\n (colorFromProps as unknown as string) === \"neutral\" ||\n (colorFromProps as unknown as string) === \"gradient\" ||\n (colorFromProps as unknown as string) === \"green\"\n ? (colorFromProps as unknown as AccentBoxBackgroundColor)\n : undefined;\n\n const style = {\n backgroundColor: isAFlowColor ? undefined : backgroundColor,\n backgroundImage: backgroundImage ? `url(${backgroundImage})` : undefined,\n aspectRatio,\n ...styleFromProps,\n };\n\n const rootClassName = clsx(\n styles.accentBox,\n backgroundColorFromColor\n ? styles[backgroundColorFromColor]\n : isAFlowColor\n ? styles[backgroundColor]\n : undefined,\n backgroundImage && styles.backgroundImage,\n className,\n );\n\n const Element = elementType;\n\n const contentColor = color === \"default\" ? undefined : color;\n\n /* A Link or Button in the \"action\" slot covers the whole box. */\n const actionClassName = (slot: string | undefined) =>\n slot === \"action\" ? styles.action : undefined;\n\n const propsContext: PropsContext = {\n Link: {\n color: contentColor,\n className: dynamic((props) => actionClassName(props.slot)),\n },\n Button: {\n className: dynamic((props) => actionClassName(props.slot)),\n },\n Text: {\n color: contentColor,\n },\n Heading: {\n color: contentColor,\n },\n Icon: {\n className: styles.icon,\n },\n };\n\n return (\n <Element ref={ref as never} className={rootClassName} style={style}>\n <SectionHeadingReset>\n <PropsContextProvider props={propsContext}>\n {children}\n </PropsContextProvider>\n </SectionHeadingReset>\n </Element>\n );\n});\n\nexport default AccentBox;\n"],"mappings":";;;;;;;;;;AAmBA,IAAM,4BAA4B;CAChC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAMA,SAAS,YACP,WACuC;CAGvC,OACE,OAAO,cAAc,YACrBA,0BAA6B,SAAS,SAAS;AAEnD;;;;;AAsBA,IAAa,YAAY,cAAc,cAAc,UAAU;CAC7D,MAAM,EACJ,OAAO,gBACP,kBAAkB,WAClB,iBACA,UACA,cAAc,OACd,WACA,OAAO,gBACP,aACA,QACE;CAQJ,MAAM,QAAQ,mBALX,mBAAyC,cAC1C,oBAAoB,aAChB,SACA;CAIN,MAAM,eAAe,YAAY,eAAe;CAGhD,MAAM,2BACH,mBAAyC,aACzC,mBAAyC,cACzC,mBAAyC,UACrC,iBACD,KAAA;CAEN,MAAM,QAAQ;EACZ,iBAAiB,eAAe,KAAA,IAAY;EAC5C,iBAAiB,kBAAkB,OAAO,gBAAgB,KAAK,KAAA;EAC/D;EACA,GAAG;CACL;CAEA,MAAM,gBAAgB,KACpBC,yBAAO,WACP,2BACIA,yBAAO,4BACP,eACEA,yBAAO,mBACP,KAAA,GACN,mBAAmBA,yBAAO,iBAC1B,SACF;CAEA,MAAM,UAAU;CAEhB,MAAM,eAAe,UAAU,YAAY,KAAA,IAAY;CAGvD,MAAM,mBAAmB,SACvB,SAAS,WAAWA,yBAAO,SAAS,KAAA;CAEtC,MAAM,eAA6B;EACjC,MAAM;GACJ,OAAO;GACP,WAAW,SAAS,UAAU,gBAAgB,MAAM,IAAI,CAAC;EAC3D;EACA,QAAQ,EACN,WAAW,SAAS,UAAU,gBAAgB,MAAM,IAAI,CAAC,EAC3D;EACA,MAAM,EACJ,OAAO,aACT;EACA,SAAS,EACP,OAAO,aACT;EACA,MAAM,EACJ,WAAWA,yBAAO,KACpB;CACF;CAEA,OACE,oBAAC,SAAD;EAAc;EAAc,WAAW;EAAsB;EAC3D,UAAA,oBAAC,qBAAD,EAAA,UACE,oBAAC,sBAAD;GAAsB,OAAO;GAC1B;EACmB,CAAA,EACH,CAAA;CACd,CAAA;AAEb,CAAC"}
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
// src/components/AccentBox/AccentBox.module.scss
|
|
4
4
|
var accentBox = "flow--accent-box";
|
|
5
5
|
var gradient = "flow--accent-box--gradient";
|
|
6
|
+
var backgroundImage = "flow--accent-box--background-image";
|
|
7
|
+
var action = "flow--accent-box--action";
|
|
6
8
|
var neutral = "flow--accent-box--neutral";
|
|
7
9
|
var blue = "flow--accent-box--blue";
|
|
8
10
|
var teal = "flow--accent-box--teal";
|
|
@@ -14,6 +16,8 @@ var icon = "flow--accent-box--icon";
|
|
|
14
16
|
var AccentBox_module_default = {
|
|
15
17
|
accentBox,
|
|
16
18
|
gradient,
|
|
19
|
+
backgroundImage,
|
|
20
|
+
action,
|
|
17
21
|
neutral,
|
|
18
22
|
blue,
|
|
19
23
|
teal,
|
|
@@ -23,6 +27,6 @@ var AccentBox_module_default = {
|
|
|
23
27
|
navy,
|
|
24
28
|
icon
|
|
25
29
|
};
|
|
26
|
-
export { accentBox, blue, AccentBox_module_default as default, gradient, green, icon, lilac, navy, neutral, teal, violet };
|
|
30
|
+
export { accentBox, action, backgroundImage, blue, AccentBox_module_default as default, gradient, green, icon, lilac, navy, neutral, teal, violet };
|
|
27
31
|
|
|
28
32
|
//# sourceMappingURL=AccentBox.module.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccentBox.module.mjs","names":[],"sources":["../../../../../../../src/components/AccentBox/AccentBox.module.scss"],"sourcesContent":[".accentBox {\n align-self: normal;\n padding: var(--accent-box--padding);\n border-radius: var(--accent-box--corner-radius);\n isolation: isolate;\n position: relative;\n display: flex;\n flex-direction: column;\n background-size: cover;\n background-repeat: no-repeat;\n min-width: 0;\n\n &.gradient {\n background: var(--accent-box--background-color-gradient);\n }\n\n /* Color */\n\n @mixin color($color) {\n &.#{$color} {\n background-color: var(--accent-box--background-color-#{$color});\n }\n }\n\n @include color(\"neutral\");\n @include color(\"blue\");\n @include color(\"teal\");\n @include color(\"lilac\");\n @include color(\"violet\");\n @include color(\"green\");\n @include color(\"navy\");\n\n /* backwards compatibility */\n > .icon {\n display: none;\n }\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"AccentBox.module.mjs","names":[],"sources":["../../../../../../../src/components/AccentBox/AccentBox.module.scss"],"sourcesContent":[".accentBox {\n align-self: normal;\n padding: var(--accent-box--padding);\n border-radius: var(--accent-box--corner-radius);\n isolation: isolate;\n position: relative;\n display: flex;\n flex-direction: column;\n background-size: cover;\n background-repeat: no-repeat;\n min-width: 0;\n\n &.gradient {\n background: var(--accent-box--background-color-gradient);\n }\n\n /* The hover layer: translucent, above the background and below the\n content. An action or a Link around the box (Link.module.scss) fades it\n in through --hover-overlay-opacity. */\n &::before {\n content: \"\";\n position: absolute;\n inset: 0;\n z-index: -1;\n border-radius: inherit;\n background-color: var(--accent-box--hover-overlay-color);\n opacity: var(--hover-overlay-opacity, 0);\n transition: opacity var(--transition--duration--default) ease;\n pointer-events: none;\n }\n\n /* An image looks the same in both themes, so its layer stays dark. */\n &.backgroundImage::before {\n background-color: var(--accent-box--hover-overlay-color-image);\n }\n\n /* Action */\n\n &:has(.action) {\n /* Other links and buttons stay clickable above the action. Selected by\n their own classes, so a props context that sets their className\n cannot drop them below it. */\n :is(:global(.flow--button), :global(.flow--link)):not(.action) {\n z-index: 2;\n }\n\n /* The action itself is invisible and covers the whole box. It names\n the box for assistive technology; the box shows hover and focus. */\n .action {\n position: absolute;\n inset: 0;\n z-index: 1;\n width: auto;\n max-width: none;\n height: auto;\n margin: 0;\n padding: 0;\n border-radius: var(--accent-box--corner-radius);\n opacity: 0;\n transform: none;\n }\n }\n\n &:has(.action[data-hovered]) {\n --hover-overlay-opacity: 1;\n }\n\n &:has(.action[data-focus-visible]) {\n outline: var(--focus--outline-width) solid var(--focus--outline-color);\n outline-offset: var(--focus--outline-offset);\n box-shadow: 0 0 0 var(--focus--outline-width)\n var(--focus--secondary-outline-color);\n }\n\n /* Color */\n\n @mixin color($color) {\n &.#{$color} {\n background-color: var(--accent-box--background-color-#{$color});\n }\n }\n\n @include color(\"neutral\");\n @include color(\"blue\");\n @include color(\"teal\");\n @include color(\"lilac\");\n @include color(\"violet\");\n @include color(\"green\");\n @include color(\"navy\");\n\n /* backwards compatibility */\n > .icon {\n display: none;\n }\n}\n\n/* Without specificity, so a component that positions its own button\n (TextField, Slider) keeps it absolute and only gets the z-index. */\n:where(.accentBox:has(.action))\n :where(:global(.flow--button), :global(.flow--link)) {\n position: relative;\n}\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.module.mjs","names":[],"sources":["../../../../../../../src/components/Link/Link.module.scss"],"sourcesContent":["@use \"@/styles/mixins/focus\";\n\n.link {\n display: inline-block;\n font-weight: var(--link--font-weight);\n transition-property: color;\n transition-duration: var(--transition--duration--default);\n color: var(--link--color--default);\n width: fit-content;\n\n &:hover {\n color: var(--link--color--hover);\n }\n\n &[data-pressed] {\n color: var(--link--color--pressed);\n }\n\n @include focus.focus;\n\n &:not([aria-disabled]) {\n cursor: pointer;\n }\n\n &.inline {\n font-weight: normal;\n text-decoration: underline;\n }\n\n /* Elements */\n\n .icon {\n margin-inline-start: var(--link--spacing);\n vertical-align: text-bottom;\n height: var(--link--icon-height);\n }\n\n .linkIcon {\n -webkit-user-select: none;\n user-select: none;\n }\n\n &[aria-disabled] {\n color: var(--link--color--disabled);\n }\n\n /* Size s */\n\n &.size-s {\n font-size: var(--font-size-text--s);\n\n .icon {\n height: var(--link--icon-height-s);\n }\n }\n\n &:has(.button) {\n > .linkIcon {\n display: none;\n }\n }\n\n /* Alpha Colors */\n @mixin color($color) {\n &:where(.#{$color}) {\n color: var(--link--color-#{$color}--default);\n\n &:hover {\n color: var(--link--color-#{$color}--hover);\n }\n\n &[data-pressed] {\n color: var(--link--color-#{$color}--pressed);\n }\n\n &[aria-disabled] {\n color: var(--link--color-#{$color}--disabled);\n }\n }\n }\n\n @include color(light);\n @include color(dark);\n @include color(dark-static);\n @include color(light-static);\n\n /* AlertText Colors */\n @mixin status($status) {\n &:has(.alertText[class*=\"#{$status}\"]) {\n color: var(--alert-text--#{$status}-color);\n }\n }\n\n @include status(\"danger\");\n @include status(\"success\");\n @include status(\"warning\");\n @include status(\"info\");\n @include status(\"unavailable\");\n\n &:has(> .accentBox),\n &:has(> .layoutCard) {\n color: unset;\n font-weight: unset;\n display: block;\n min-width: 0;\n width: auto;\n\n .linkIcon {\n display: none;\n }\n }\n\n &:has(> .accentBox) {\n border-radius: var(--accent-box--corner-radius);\n }\n\n &:has(> .layoutCard) {\n border-radius: var(--layout-card--corner-radius);\n }\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"Link.module.mjs","names":[],"sources":["../../../../../../../src/components/Link/Link.module.scss"],"sourcesContent":["@use \"@/styles/mixins/focus\";\n\n.link {\n display: inline-block;\n font-weight: var(--link--font-weight);\n transition-property: color;\n transition-duration: var(--transition--duration--default);\n color: var(--link--color--default);\n width: fit-content;\n\n &:hover {\n color: var(--link--color--hover);\n }\n\n &[data-pressed] {\n color: var(--link--color--pressed);\n }\n\n @include focus.focus;\n\n &:not([aria-disabled]) {\n cursor: pointer;\n }\n\n &.inline {\n font-weight: normal;\n text-decoration: underline;\n }\n\n /* Elements */\n\n .icon {\n margin-inline-start: var(--link--spacing);\n vertical-align: text-bottom;\n height: var(--link--icon-height);\n }\n\n .linkIcon {\n -webkit-user-select: none;\n user-select: none;\n }\n\n &[aria-disabled] {\n color: var(--link--color--disabled);\n }\n\n /* Size s */\n\n &.size-s {\n font-size: var(--font-size-text--s);\n\n .icon {\n height: var(--link--icon-height-s);\n }\n }\n\n &:has(.button) {\n > .linkIcon {\n display: none;\n }\n }\n\n /* Alpha Colors */\n @mixin color($color) {\n &:where(.#{$color}) {\n color: var(--link--color-#{$color}--default);\n\n &:hover {\n color: var(--link--color-#{$color}--hover);\n }\n\n &[data-pressed] {\n color: var(--link--color-#{$color}--pressed);\n }\n\n &[aria-disabled] {\n color: var(--link--color-#{$color}--disabled);\n }\n }\n }\n\n @include color(light);\n @include color(dark);\n @include color(dark-static);\n @include color(light-static);\n\n /* AlertText Colors */\n @mixin status($status) {\n &:has(.alertText[class*=\"#{$status}\"]) {\n color: var(--alert-text--#{$status}-color);\n }\n }\n\n @include status(\"danger\");\n @include status(\"success\");\n @include status(\"warning\");\n @include status(\"info\");\n @include status(\"unavailable\");\n\n &:has(> .accentBox),\n &:has(> .layoutCard) {\n color: unset;\n font-weight: unset;\n display: block;\n min-width: 0;\n width: auto;\n\n .linkIcon {\n display: none;\n }\n }\n\n &:has(> .accentBox) {\n border-radius: var(--accent-box--corner-radius);\n }\n\n /* The whole box is the link target, so the box shows the hover – also\n inside a LayoutCard, which gives the box its own class. */\n &:not([aria-disabled])[data-hovered] {\n > .accentBox,\n > .layoutCard > :global(.flow--accent-box) {\n --hover-overlay-opacity: 1;\n }\n }\n\n &:has(> .layoutCard) {\n border-radius: var(--layout-card--corner-radius);\n }\n}\n"],"mappings":""}
|
|
@@ -5528,6 +5528,14 @@ var all_dark_default = {
|
|
|
5528
5528
|
"value": "radial-gradient(circle at 18% 20%, #3D55C159, transparent 22%), radial-gradient(circle at 82% 18%, #00A1B54D, transparent 18%), radial-gradient(circle at 70% 82%, #715DEE47, transparent 24%), linear-gradient(180deg, #06070A 0%, #0A0E18 45%, #0F1424 100%)",
|
|
5529
5529
|
"path": ["accent-box", "background-color-gradient"]
|
|
5530
5530
|
},
|
|
5531
|
+
"hover-overlay-color": {
|
|
5532
|
+
"value": "rgb(255 255 255 / 12.5%)",
|
|
5533
|
+
"path": ["accent-box", "hover-overlay-color"]
|
|
5534
|
+
},
|
|
5535
|
+
"hover-overlay-color-image": {
|
|
5536
|
+
"value": "rgb(0 0 0 / 12.5%)",
|
|
5537
|
+
"path": ["accent-box", "hover-overlay-color-image"]
|
|
5538
|
+
},
|
|
5531
5539
|
"padding": {
|
|
5532
5540
|
"value": "16px",
|
|
5533
5541
|
"path": ["accent-box", "padding"]
|