UNPKG

@yamada-ui/stepper

Version:

Yamada UI stepper component

1 lines 2.07 kB
{"version":3,"sources":["../src/step.tsx"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport type { UseStepReturn } from \"./use-stepper\"\nimport { forwardRef, ui } from \"@yamada-ui/core\"\nimport { createContext, cx, dataAttr } from \"@yamada-ui/utils\"\nimport { useStep, useStepperContext } from \"./use-stepper\"\n\nexport interface StepContext extends Omit<UseStepReturn, \"getStepProps\"> {}\n\nexport const [StepProvider, useStepContext] = createContext<StepContext>({\n name: \"StepperContext\",\n errorMessage: `useStepContext returned is 'undefined'. Seems you forgot to wrap the components in \"<Step />\"`,\n})\n\nexport interface StepProps extends HTMLUIProps {}\n\nexport const Step = forwardRef<StepProps, \"div\">(\n ({ className, ...rest }, ref) => {\n const { orientation, showLastSeparator, styles } = useStepperContext()\n const { index, isFirst, isLast, status, getStepProps } = useStep()\n\n const css: CSSUIObject = { ...styles.step }\n\n return (\n <StepProvider value={{ index, isFirst, isLast, status }}>\n <ui.div\n className={cx(\"ui-step\", className)}\n data-orientation={orientation}\n data-stretch={dataAttr(showLastSeparator)}\n __css={css}\n {...getStepProps(rest, ref)}\n />\n </StepProvider>\n )\n },\n)\n\nStep.displayName = \"Step\"\nStep.__ui__ = \"Step\"\n"],"mappings":";;;;;;;AAEA,SAAS,YAAY,UAAU;AAC/B,SAAS,eAAe,IAAI,gBAAgB;AAqBpC;AAhBD,IAAM,CAAC,cAAc,cAAc,IAAI,cAA2B;AAAA,EACvE,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAIM,IAAM,OAAO;AAAA,EAClB,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,QAAQ;AAC/B,UAAM,EAAE,aAAa,mBAAmB,OAAO,IAAI,kBAAkB;AACrE,UAAM,EAAE,OAAO,SAAS,QAAQ,QAAQ,aAAa,IAAI,QAAQ;AAEjE,UAAM,MAAmB,EAAE,GAAG,OAAO,KAAK;AAE1C,WACE,oBAAC,gBAAa,OAAO,EAAE,OAAO,SAAS,QAAQ,OAAO,GACpD;AAAA,MAAC,GAAG;AAAA,MAAH;AAAA,QACC,WAAW,GAAG,WAAW,SAAS;AAAA,QAClC,oBAAkB;AAAA,QAClB,gBAAc,SAAS,iBAAiB;AAAA,QACxC,OAAO;AAAA,QACN,GAAG,aAAa,MAAM,GAAG;AAAA;AAAA,IAC5B,GACF;AAAA,EAEJ;AACF;AAEA,KAAK,cAAc;AACnB,KAAK,SAAS;","names":[]}