@bonprix-ds/react-step-navi 1.0.4 → 1.0.5
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/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ var o = r({
|
|
|
8
8
|
container: "preflight w-full flex flex-col gap-1.5 items-center l:items-start xl:items-start group focus:outline-none",
|
|
9
9
|
icon: "h-5 w-5 fill-clr-fg-success invisible",
|
|
10
10
|
bar: "w-full h-1 bg-clr-bg-disabled",
|
|
11
|
-
labelSlot: ["typography-input-helper-text text-center text-clr-primary l:text-left xl:text-left px-1 break-all", "
|
|
11
|
+
labelSlot: ["typography-input-helper-text text-center text-clr-primary l:text-left xl:text-left px-1 break-all", "group-focus:outline outline-2 outline-offset-2 rounded-sm outline-clr-primary"]
|
|
12
12
|
},
|
|
13
13
|
variants: {
|
|
14
14
|
active: { true: { bar: "bg-clr-primary" } },
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/StepNaviStep.tsx","../src/StepNavi.tsx"],"sourcesContent":["// inspired by https://a11y-guidelines.orange.com/en/articles/disable-elements/#disable-a-link\nimport Icon from \"@bonprix-ds/react-icon\";\nimport React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nconst generateClasses = tv({\n slots: {\n container: \"preflight w-full flex flex-col gap-1.5 items-center l:items-start xl:items-start group focus:outline-none\",\n icon: \"h-5 w-5 fill-clr-fg-success invisible\",\n bar: \"w-full h-1 bg-clr-bg-disabled\",\n labelSlot: [\n \"typography-input-helper-text text-center text-clr-primary l:text-left xl:text-left px-1 break-all\",\n \"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/StepNaviStep.tsx","../src/StepNavi.tsx"],"sourcesContent":["// inspired by https://a11y-guidelines.orange.com/en/articles/disable-elements/#disable-a-link\nimport Icon from \"@bonprix-ds/react-icon\";\nimport React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nconst generateClasses = tv({\n slots: {\n container: \"preflight w-full flex flex-col gap-1.5 items-center l:items-start xl:items-start group focus:outline-none\",\n icon: \"h-5 w-5 fill-clr-fg-success invisible\",\n bar: \"w-full h-1 bg-clr-bg-disabled\",\n labelSlot: [\n \"typography-input-helper-text text-center text-clr-primary l:text-left xl:text-left px-1 break-all\",\n \"group-focus:outline outline-2 outline-offset-2 rounded-sm outline-clr-primary\",\n ],\n },\n variants: {\n active: {\n true: {\n bar: \"bg-clr-primary\",\n },\n },\n completed: {\n true: { icon: \"visible\" },\n },\n disabled: {\n true: {\n labelSlot: \"text-clr-disabled\",\n },\n false: {\n bar: \"group-hover:bg-clr-primary\",\n },\n },\n },\n});\n\nexport interface StepNaviStepProps {\n /** The name of the step. */\n children: string;\n /** The href attribute for the step link. */\n href?: string;\n}\n\n/**\n * `StepNavi` derives these for each of its steps and passes them in. They are not meant to be set\n * from the outside, so they are tagged `@internal` and left out of the generated API table.\n */\nexport interface StepNaviStepInternalProps {\n /** @internal */\n active?: boolean;\n /** @internal */\n completed?: boolean;\n /** @internal */\n disabled?: boolean;\n}\n\nconst StepNaviStep = ({ children, href, active, completed, disabled }: StepNaviStepProps & StepNaviStepInternalProps) => {\n const { container, icon, bar, labelSlot } = generateClasses({ active, completed, disabled });\n return (\n <a\n href={disabled ? undefined : href}\n className={container()}\n aria-current={active ? \"step\" : \"false\"}\n aria-disabled={disabled ? \"true\" : \"false\"}\n data-bpds-completed={completed}\n >\n <Icon variant=\"check-bold\" className={icon()} />\n <div className={bar()}></div>\n <div className={labelSlot()}>\n {children}\n {completed && <span className=\"sr-only\"> erfüllter schritt</span>}\n </div>\n </a>\n );\n};\n\nStepNaviStep.displayName = \"StepNavi.Step\";\n\nexport default StepNaviStep;\n","import React, { Children, cloneElement, ReactElement } from \"react\";\n\nimport StepNaviStep, { StepNaviStepInternalProps, StepNaviStepProps } from \"./StepNaviStep\";\n\ntype StepElement = ReactElement<StepNaviStepProps & StepNaviStepInternalProps, typeof StepNaviStep>;\n\nexport interface Props {\n /** StepNavi.Step subcomponents should be placed here. */\n children: StepElement | StepElement[];\n /** Amount of completed steps. */\n completedSteps?: number;\n /** Currently active step. Not index based, so starts with 1. */\n activeStep?: number;\n /** Accessible label for the navigation. */\n ariaLabel?: string;\n}\n\nconst checkActiveStep = (activeStep: number, stepsQuantity: number, completedSteps: number) => {\n if (activeStep > completedSteps + 1) {\n console.error(\"activeStep must not be greater than completedSteps + 1\");\n return completedSteps + 1;\n }\n\n if (activeStep > stepsQuantity) {\n console.error(\"activeStep must not be greater than the amount of steps. activeStep is set to last available step\");\n return stepsQuantity;\n }\n\n return activeStep;\n};\n\nconst StepNavi = ({ completedSteps = 0, activeStep = completedSteps + 1, children, ariaLabel }: Props) => {\n const steps = Children.toArray(children) as StepElement[];\n const checkedActiveStep = checkActiveStep(activeStep, steps.length, completedSteps);\n\n return (\n <nav aria-label={ariaLabel} data-bpds=\"step-navi\" data-bpds-completed-steps={completedSteps} data-bpds-active-step={checkedActiveStep}>\n <ol className=\"preflight m-0 flex list-none flex-row gap-1 p-0\">\n {steps.map((step, index) => {\n const stepNumber = index + 1;\n\n return (\n <li className=\"flex-1\" key={step.key ?? stepNumber}>\n {cloneElement(step, {\n active: checkedActiveStep === stepNumber,\n completed: completedSteps >= stepNumber,\n disabled: stepNumber > completedSteps + 1,\n })}\n </li>\n );\n })}\n </ol>\n </nav>\n );\n};\n\nStepNavi.displayName = \"StepNavi\";\n\nStepNavi.Step = StepNaviStep;\n\nexport default StepNavi;\n"],"mappings":";;;;;AAKA,IAAM,IAAkB,EAAG;CACzB,OAAO;EACL,WAAW;EACX,MAAM;EACN,KAAK;EACL,WAAW,CACT,qGACA,+EACF;CACF;CACA,UAAU;EACR,QAAQ,EACN,MAAM,EACJ,KAAK,iBACP,EACF;EACA,WAAW,EACT,MAAM,EAAE,MAAM,UAAU,EAC1B;EACA,UA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AAU,IAAa,IAAiB;KAC1C,CAAC;IACC,GANwB,EAAK,OAAO,CAMpC;GAER,CAAC;EACC,CAAA;CACD,CAAA;AAET;AAEA,EAAS,cAAc,YAEvB,EAAS,OAAO"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bonprix-ds/react-step-navi",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "StepNavi component, implemented in React, for the Bonprix Design System.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
],
|
|
23
23
|
"keywords": [],
|
|
24
24
|
"author": "",
|
|
25
|
-
"license": "
|
|
25
|
+
"license": "UNLICENSED",
|
|
26
26
|
"repository": {
|
|
27
27
|
"type": "git",
|
|
28
28
|
"url": "git+https://github.com/bonprix/design-system.git",
|
|
29
29
|
"directory": "packages/react/step-navi"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@bonprix-ds/react-icon": "1.1.
|
|
33
|
-
"@bonprix-ds/utils": "0.2.
|
|
32
|
+
"@bonprix-ds/react-icon": "1.1.3",
|
|
33
|
+
"@bonprix-ds/utils": "0.2.1"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"react": "^19.0.0",
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
"tailwind-variants": "0.3.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"vite": "8.2.
|
|
41
|
+
"vite": "8.2.2",
|
|
42
42
|
"@types/react": "19.2.18",
|
|
43
|
-
"@vitejs/plugin-react": "6.0
|
|
43
|
+
"@vitejs/plugin-react": "6.1.0",
|
|
44
44
|
"rollup-preserve-directives": "1.1.3",
|
|
45
45
|
"unplugin-dts": "1.0.3",
|
|
46
|
-
"@microsoft/api-extractor": "7.
|
|
46
|
+
"@microsoft/api-extractor": "7.59.0"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"build": "vite build"
|