@atom-learning/components 6.0.0-beta.36 → 6.0.0-beta.37

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.
@@ -1,2 +1,2 @@
1
- import*as i from"react";import{styled as t}from"../../styled.js";const s=t("li",{base:["last:mb-0","not-last:mb-2"]}),l=t("ul",{base:["list-inside","font-body"],variants:{size:{xs:["text-xs","leading-[1.6]","capsize-[0.4364]"],sm:["text-sm","leading-[1.53]","capsize-[0.4056]"],md:["text-md","leading-normal","capsize-[0.3864]"],lg:["text-lg","leading-[1.52]","capsize-[0.3983]"],xl:["text-xl","leading-[1.42]","capsize-[0.3506]"]},noCapsize:{true:["before:hidden!","after:hidden!"]},ordered:{true:["pl-4","list-decimal","[&_>_li]:pl-1"],false:["pl-3","list-disc","[&_>_li]:pl-2"]},theme:{primary:["marker:text-primary-800"]}}}),a=i.forwardRef(({size:r="md",noCapsize:d=!0,ordered:e=!1,...m},o)=>i.createElement(l,{ref:o,as:e?"ol":"ul",ordered:e,size:r,noCapsize:d,...m}));a.Item=s;export{a as List,s as StyledLi,l as StyledList};
1
+ import*as i from"react";import{styled as t}from"../../styled.js";const l=t("li",{base:["last:mb-0","not-last:mb-2"]}),s=t("ul",{base:["list-inside","font-body"],variants:{size:{xs:["text-xs","leading-[1.6]","capsize-[0.4364]"],sm:["text-sm","leading-[1.53]","capsize-[0.4056]"],md:["text-md","leading-normal","capsize-[0.3864]"],lg:["text-lg","leading-[1.52]","capsize-[0.3983]"],xl:["text-xl","leading-[1.42]","capsize-[0.3506]"]},noCapsize:{true:["before:hidden!","after:hidden!"]},ordered:{true:["pl-4","list-decimal","[&_>_li]:pl-1","[&_>_li::marker]:font-medium","[&_>_li::marker]:text-sm"],false:["pl-3","list-disc","[&_>_li]:pl-2"]},theme:{primary:["marker:text-primary-800"]}}}),a=i.forwardRef(({size:r="md",noCapsize:d=!0,ordered:e=!1,...m},o)=>i.createElement(s,{ref:o,as:e?"ol":"ul",ordered:e,size:r,noCapsize:d,...m}));a.Item=l;export{a as List,l as StyledLi,s as StyledList};
2
2
  //# sourceMappingURL=List.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"List.js","sources":["../../../src/components/list/List.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { styled } from '~/styled'\n\nexport const StyledLi = styled('li', {\n base: ['last:mb-0', 'not-last:mb-2']\n})\n\nexport const StyledList = styled('ul', {\n base: ['list-inside', 'font-body'],\n variants: {\n size: {\n xs: ['text-xs', 'leading-[1.6]', 'capsize-[0.4364]'],\n sm: ['text-sm', 'leading-[1.53]', 'capsize-[0.4056]'],\n md: ['text-md', 'leading-normal', 'capsize-[0.3864]'],\n lg: ['text-lg', 'leading-[1.52]', 'capsize-[0.3983]'],\n xl: ['text-xl', 'leading-[1.42]', 'capsize-[0.3506]']\n },\n noCapsize: {\n true: ['before:hidden!', 'after:hidden!']\n },\n ordered: {\n true: ['pl-4', 'list-decimal', '[&_>_li]:pl-1'],\n false: ['pl-3', 'list-disc', '[&_>_li]:pl-2']\n },\n theme: {\n primary: ['marker:text-primary-800']\n }\n }\n})\n\ntype ListProps = React.ComponentProps<typeof StyledList> & {\n ordered?: boolean\n}\n\ntype ListType = ReturnType<\n typeof React.forwardRef<HTMLUListElement, ListProps>\n> & {\n Item: typeof StyledLi\n}\n\nexport const List = React.forwardRef<HTMLUListElement, ListProps>(\n (\n { size = 'md', noCapsize = true, ordered = false, ...remainingProps },\n ref\n ) => (\n <StyledList\n ref={ref}\n as={ordered ? 'ol' : 'ul'}\n ordered={ordered}\n size={size}\n noCapsize={noCapsize}\n {...remainingProps}\n />\n )\n) as ListType\n\nList.Item = StyledLi\n"],"names":["StyledLi","styled","StyledList","List","React","size","noCapsize","ordered","remainingProps","ref"],"mappings":"iEAIa,MAAAA,EAAWC,EAAO,KAAM,CACnC,KAAM,CAAC,YAAa,eAAe,CACrC,CAAC,EAEYC,EAAaD,EAAO,KAAM,CACrC,KAAM,CAAC,cAAe,WAAW,EACjC,SAAU,CACR,KAAM,CACJ,GAAI,CAAC,UAAW,gBAAiB,kBAAkB,EACnD,GAAI,CAAC,UAAW,iBAAkB,kBAAkB,EACpD,GAAI,CAAC,UAAW,iBAAkB,kBAAkB,EACpD,GAAI,CAAC,UAAW,iBAAkB,kBAAkB,EACpD,GAAI,CAAC,UAAW,iBAAkB,kBAAkB,CACtD,EACA,UAAW,CACT,KAAM,CAAC,iBAAkB,eAAe,CAC1C,EACA,QAAS,CACP,KAAM,CAAC,OAAQ,eAAgB,eAAe,EAC9C,MAAO,CAAC,OAAQ,YAAa,eAAe,CAC9C,EACA,MAAO,CACL,QAAS,CAAC,yBAAyB,CACrC,CACF,CACF,CAAC,EAYYE,EAAOC,EAAM,WACxB,CACE,CAAE,KAAAC,EAAO,KAAM,UAAAC,EAAY,GAAM,QAAAC,EAAU,GAAO,GAAGC,CAAe,EACpEC,IAEAL,EAAA,cAACF,EACC,CAAA,IAAKO,EACL,GAAIF,EAAU,KAAO,KACrB,QAASA,EACT,KAAMF,EACN,UAAWC,EACV,GAAGE,CAAAA,CACN,CAEJ,EAEAL,EAAK,KAAOH"}
1
+ {"version":3,"file":"List.js","sources":["../../../src/components/list/List.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { styled } from '~/styled'\n\nexport const StyledLi = styled('li', {\n base: ['last:mb-0', 'not-last:mb-2']\n})\n\nexport const StyledList = styled('ul', {\n base: ['list-inside', 'font-body'],\n variants: {\n size: {\n xs: ['text-xs', 'leading-[1.6]', 'capsize-[0.4364]'],\n sm: ['text-sm', 'leading-[1.53]', 'capsize-[0.4056]'],\n md: ['text-md', 'leading-normal', 'capsize-[0.3864]'],\n lg: ['text-lg', 'leading-[1.52]', 'capsize-[0.3983]'],\n xl: ['text-xl', 'leading-[1.42]', 'capsize-[0.3506]']\n },\n noCapsize: {\n true: ['before:hidden!', 'after:hidden!']\n },\n ordered: {\n true: ['pl-4', 'list-decimal', '[&_>_li]:pl-1', '[&_>_li::marker]:font-medium', '[&_>_li::marker]:text-sm'],\n false: ['pl-3', 'list-disc', '[&_>_li]:pl-2']\n },\n theme: {\n primary: ['marker:text-primary-800']\n }\n }\n})\n\ntype ListProps = React.ComponentProps<typeof StyledList> & {\n ordered?: boolean\n}\n\ntype ListType = ReturnType<\n typeof React.forwardRef<HTMLUListElement, ListProps>\n> & {\n Item: typeof StyledLi\n}\n\nexport const List = React.forwardRef<HTMLUListElement, ListProps>(\n (\n { size = 'md', noCapsize = true, ordered = false, ...remainingProps },\n ref\n ) => (\n <StyledList\n ref={ref}\n as={ordered ? 'ol' : 'ul'}\n ordered={ordered}\n size={size}\n noCapsize={noCapsize}\n {...remainingProps}\n />\n )\n) as ListType\n\nList.Item = StyledLi\n"],"names":["StyledLi","styled","StyledList","List","React","size","noCapsize","ordered","remainingProps","ref"],"mappings":"iEAIa,MAAAA,EAAWC,EAAO,KAAM,CACnC,KAAM,CAAC,YAAa,eAAe,CACrC,CAAC,EAEYC,EAAaD,EAAO,KAAM,CACrC,KAAM,CAAC,cAAe,WAAW,EACjC,SAAU,CACR,KAAM,CACJ,GAAI,CAAC,UAAW,gBAAiB,kBAAkB,EACnD,GAAI,CAAC,UAAW,iBAAkB,kBAAkB,EACpD,GAAI,CAAC,UAAW,iBAAkB,kBAAkB,EACpD,GAAI,CAAC,UAAW,iBAAkB,kBAAkB,EACpD,GAAI,CAAC,UAAW,iBAAkB,kBAAkB,CACtD,EACA,UAAW,CACT,KAAM,CAAC,iBAAkB,eAAe,CAC1C,EACA,QAAS,CACP,KAAM,CAAC,OAAQ,eAAgB,gBAAiB,+BAAgC,0BAA0B,EAC1G,MAAO,CAAC,OAAQ,YAAa,eAAe,CAC9C,EACA,MAAO,CACL,QAAS,CAAC,yBAAyB,CACrC,CACF,CACF,CAAC,EAYYE,EAAOC,EAAM,WACxB,CACE,CAAE,KAAAC,EAAO,KAAM,UAAAC,EAAY,GAAM,QAAAC,EAAU,GAAO,GAAGC,CAAe,EACpEC,IAEAL,EAAA,cAACF,EACC,CAAA,IAAKO,EACL,GAAIF,EAAU,KAAO,KACrB,QAASA,EACT,KAAMF,EACN,UAAWC,EACV,GAAGE,CAAAA,CACN,CAEJ,EAEAL,EAAK,KAAOH"}
@@ -1,2 +1,2 @@
1
- import*as e from"react";import{useFormContext as C,useController as F}from"react-hook-form";import{Description as V}from"../field-wrapper/FieldDescription.js";import"../form/Form.js";import{useFieldError as h}from"../form/useFieldError.js";import"../form/useFormCustomContext.js";import{InlineMessage as v}from"../inline-message/InlineMessage.js";import{Label as B}from"../label/Label.js";import"../radio-button/RadioButton.js";import{RadioButtonGroup as R}from"../radio-button/RadioButtonGroup.js";import{styled as x}from"../../styled.js";import{RadioField as y}from"./RadioField.js";const q=x("fieldset",{base:["[all:unset]"]}),u=({children:d,className:c,direction:p="column",defaultValue:r,value:t,description:a,label:f,name:l,validation:o,onValueChange:m,...b})=>{const{control:E}=C(),{field:{ref:N,onChange:n,value:g,name:j}}=F({name:l,control:E,rules:o,defaultValue:r}),{error:i}=h(l);return e.useEffect(()=>{typeof t<"u"&&n(t)},[t]),e.createElement(q,{className:c},e.createElement(B,{as:"legend",required:!!(o!=null&&o.required),className:"mb-3 p-0"},f),a&&e.createElement(V,{className:"mb-3"},a),e.createElement(R,{ref:N,direction:p,defaultValue:r,onValueChange:s=>{n(s),m==null||m(s)},value:g,...b},d),i&&e.createElement(v,{className:"mt-2"},i))},I=Object.assign(u,{Item:y});u.displayName="RadioButtonField";export{I as RadioButtonField};
1
+ import*as e from"react";import{useFormContext as C,useController as F}from"react-hook-form";import{Description as V}from"../field-wrapper/FieldDescription.js";import"../form/Form.js";import{useFieldError as h}from"../form/useFieldError.js";import"../form/useFormCustomContext.js";import{InlineMessage as v}from"../inline-message/InlineMessage.js";import{Label as B}from"../label/Label.js";import"../radio-button/RadioButton.js";import{RadioButtonGroup as R}from"../radio-button/RadioButtonGroup.js";import{styled as x}from"../../styled.js";import{RadioField as y}from"./RadioField.js";const q=x("fieldset",{base:["border-0","p-0","m-0","min-w-0"]}),u=({children:c,className:d,direction:p="column",defaultValue:t,value:r,description:a,label:f,name:l,validation:o,onValueChange:m,...b})=>{const{control:E}=C(),{field:{ref:N,onChange:n,value:g,name:j}}=F({name:l,control:E,rules:o,defaultValue:t}),{error:i}=h(l);return e.useEffect(()=>{typeof r<"u"&&n(r)},[r]),e.createElement(q,{className:d},e.createElement(B,{as:"legend",required:!!(o!=null&&o.required),className:"mb-3 p-0"},f),a&&e.createElement(V,{className:"mb-3"},a),e.createElement(R,{ref:N,direction:p,defaultValue:t,onValueChange:s=>{n(s),m==null||m(s)},value:g,...b},c),i&&e.createElement(v,{className:"mt-2"},i))},I=Object.assign(u,{Item:y});u.displayName="RadioButtonField";export{I as RadioButtonField};
2
2
  //# sourceMappingURL=RadioButtonField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RadioButtonField.js","sources":["../../../src/components/radio-button-field/RadioButtonField.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useController, useFormContext } from 'react-hook-form'\n\nimport { FieldElementWrapperProps } from '~/components/field-wrapper'\nimport { Description as FieldDescription } from '~/components/field-wrapper/FieldDescription'\nimport { useFieldError } from '~/components/form'\nimport { InlineMessage } from '~/components/inline-message'\nimport { Label } from '~/components/label'\nimport { RadioButtonGroup } from '~/components/radio-button'\nimport { styled } from '~/styled'\n\nimport { RadioField } from './RadioField'\n\nconst Fieldset = styled('fieldset', {\n base: ['[all:unset]']\n})\n\ntype RadioButtonFieldProps = React.ComponentProps<typeof RadioButtonGroup> &\n FieldElementWrapperProps\n\nconst RadioButtonFieldComponent = ({\n children,\n className,\n direction = 'column',\n defaultValue,\n value,\n description,\n label,\n name,\n validation,\n onValueChange,\n ...remainingProps\n}: RadioButtonFieldProps) => {\n const { control } = useFormContext()\n const {\n field: { ref, onChange, value: innerValue, name: innerName }\n } = useController({\n name,\n control,\n rules: validation,\n defaultValue\n })\n const { error } = useFieldError(name)\n\n React.useEffect(() => {\n // Update the react-hook-form inner value to match what is passed in.\n if (typeof value !== 'undefined') onChange(value)\n }, [value])\n\n return (\n <Fieldset className={className}>\n <Label\n as=\"legend\"\n required={Boolean(validation?.required)}\n className=\"mb-3 p-0\"\n >\n {label}\n </Label>\n {description && (\n <FieldDescription className=\"mb-3\">{description}</FieldDescription>\n )}\n\n <RadioButtonGroup\n ref={ref}\n direction={direction}\n defaultValue={defaultValue}\n onValueChange={(newValue) => {\n onChange(newValue)\n onValueChange?.(newValue)\n }}\n value={innerValue}\n {...remainingProps}\n >\n {children}\n </RadioButtonGroup>\n\n {error && <InlineMessage className=\"mt-2\">{error}</InlineMessage>}\n </Fieldset>\n )\n}\n\nexport const RadioButtonField = Object.assign(RadioButtonFieldComponent, {\n Item: RadioField\n})\n\nRadioButtonFieldComponent.displayName = 'RadioButtonField'\n"],"names":["Fieldset","styled","RadioButtonFieldComponent","children","className","direction","defaultValue","value","description","label","name","validation","onValueChange","remainingProps","control","useFormContext","ref","onChange","innerValue","innerName","useController","error","useFieldError","React","Label","FieldDescription","RadioButtonGroup","newValue","InlineMessage","RadioButtonField","RadioField"],"mappings":"ykBAaA,MAAMA,EAAWC,EAAO,WAAY,CAClC,KAAM,CAAC,aAAa,CACtB,CAAC,EAKKC,EAA4B,CAAC,CACjC,SAAAC,EACA,UAAAC,EACA,UAAAC,EAAY,SACZ,aAAAC,EACA,MAAAC,EACA,YAAAC,EACA,MAAAC,EACA,KAAAC,EACA,WAAAC,EACA,cAAAC,EACA,GAAGC,CACL,IAA6B,CAC3B,KAAM,CAAE,QAAAC,CAAQ,EAAIC,IACd,CACJ,MAAO,CAAE,IAAAC,EAAK,SAAAC,EAAU,MAAOC,EAAY,KAAMC,CAAU,CAC7D,EAAIC,EAAc,CAChB,KAAAV,EACA,QAAAI,EACA,MAAOH,EACP,aAAAL,CACF,CAAC,EACK,CAAE,MAAAe,CAAM,EAAIC,EAAcZ,CAAI,EAEpC,OAAAa,EAAM,UAAU,IAAM,CAEhB,OAAOhB,EAAU,KAAaU,EAASV,CAAK,CAClD,EAAG,CAACA,CAAK,CAAC,EAGRgB,EAAA,cAACvB,EAAA,CAAS,UAAWI,CACnBmB,EAAAA,EAAA,cAACC,EAAA,CACC,GAAG,SACH,SAAU,CAAA,EAAQb,GAAA,MAAAA,EAAY,UAC9B,UAAU,UAETF,EAAAA,CACH,EACCD,GACCe,EAAA,cAACE,EAAA,CAAiB,UAAU,QAAQjB,CAAY,EAGlDe,EAAA,cAACG,EAAA,CACC,IAAKV,EACL,UAAWX,EACX,aAAcC,EACd,cAAgBqB,GAAa,CAC3BV,EAASU,CAAQ,EACjBf,GAAA,MAAAA,EAAgBe,CAAAA,CAClB,EACA,MAAOT,EACN,GAAGL,GAEHV,CACH,EAECkB,GAASE,EAAA,cAACK,EAAA,CAAc,UAAU,MAAQP,EAAAA,CAAM,CACnD,CAEJ,EAEaQ,EAAmB,OAAO,OAAO3B,EAA2B,CACvE,KAAM4B,CACR,CAAC,EAED5B,EAA0B,YAAc"}
1
+ {"version":3,"file":"RadioButtonField.js","sources":["../../../src/components/radio-button-field/RadioButtonField.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useController, useFormContext } from 'react-hook-form'\n\nimport { FieldElementWrapperProps } from '~/components/field-wrapper'\nimport { Description as FieldDescription } from '~/components/field-wrapper/FieldDescription'\nimport { useFieldError } from '~/components/form'\nimport { InlineMessage } from '~/components/inline-message'\nimport { Label } from '~/components/label'\nimport { RadioButtonGroup } from '~/components/radio-button'\nimport { styled } from '~/styled'\n\nimport { RadioField } from './RadioField'\n\nconst Fieldset = styled('fieldset', {\n base: ['border-0', 'p-0', 'm-0', 'min-w-0']\n})\n\ntype RadioButtonFieldProps = React.ComponentProps<typeof RadioButtonGroup> &\n FieldElementWrapperProps\n\nconst RadioButtonFieldComponent = ({\n children,\n className,\n direction = 'column',\n defaultValue,\n value,\n description,\n label,\n name,\n validation,\n onValueChange,\n ...remainingProps\n}: RadioButtonFieldProps) => {\n const { control } = useFormContext()\n const {\n field: { ref, onChange, value: innerValue, name: innerName }\n } = useController({\n name,\n control,\n rules: validation,\n defaultValue\n })\n const { error } = useFieldError(name)\n\n React.useEffect(() => {\n // Update the react-hook-form inner value to match what is passed in.\n if (typeof value !== 'undefined') onChange(value)\n }, [value])\n\n return (\n <Fieldset className={className}>\n <Label\n as=\"legend\"\n required={Boolean(validation?.required)}\n className=\"mb-3 p-0\"\n >\n {label}\n </Label>\n {description && (\n <FieldDescription className=\"mb-3\">{description}</FieldDescription>\n )}\n\n <RadioButtonGroup\n ref={ref}\n direction={direction}\n defaultValue={defaultValue}\n onValueChange={(newValue) => {\n onChange(newValue)\n onValueChange?.(newValue)\n }}\n value={innerValue}\n {...remainingProps}\n >\n {children}\n </RadioButtonGroup>\n\n {error && <InlineMessage className=\"mt-2\">{error}</InlineMessage>}\n </Fieldset>\n )\n}\n\nexport const RadioButtonField = Object.assign(RadioButtonFieldComponent, {\n Item: RadioField\n})\n\nRadioButtonFieldComponent.displayName = 'RadioButtonField'\n"],"names":["Fieldset","styled","RadioButtonFieldComponent","children","className","direction","defaultValue","value","description","label","name","validation","onValueChange","remainingProps","control","useFormContext","ref","onChange","innerValue","innerName","useController","error","useFieldError","React","Label","FieldDescription","RadioButtonGroup","newValue","InlineMessage","RadioButtonField","RadioField"],"mappings":"ykBAaA,MAAMA,EAAWC,EAAO,WAAY,CAClC,KAAM,CAAC,WAAY,MAAO,MAAO,SAAS,CAC5C,CAAC,EAKKC,EAA4B,CAAC,CACjC,SAAAC,EACA,UAAAC,EACA,UAAAC,EAAY,SACZ,aAAAC,EACA,MAAAC,EACA,YAAAC,EACA,MAAAC,EACA,KAAAC,EACA,WAAAC,EACA,cAAAC,EACA,GAAGC,CACL,IAA6B,CAC3B,KAAM,CAAE,QAAAC,CAAQ,EAAIC,EAAe,EAC7B,CACJ,MAAO,CAAE,IAAAC,EAAK,SAAAC,EAAU,MAAOC,EAAY,KAAMC,CAAU,CAC7D,EAAIC,EAAc,CAChB,KAAAV,EACA,QAAAI,EACA,MAAOH,EACP,aAAAL,CACF,CAAC,EACK,CAAE,MAAAe,CAAM,EAAIC,EAAcZ,CAAI,EAEpC,OAAAa,EAAM,UAAU,IAAM,CAEhB,OAAOhB,EAAU,KAAaU,EAASV,CAAK,CAClD,EAAG,CAACA,CAAK,CAAC,EAGRgB,EAAA,cAACvB,EAAA,CAAS,UAAWI,CAAAA,EACnBmB,EAAA,cAACC,EAAA,CACC,GAAG,SACH,SAAU,GAAQb,GAAA,MAAAA,EAAY,UAC9B,UAAU,UAAA,EAETF,CACH,EACCD,GACCe,EAAA,cAACE,EAAA,CAAiB,UAAU,MAAQjB,EAAAA,CAAY,EAGlDe,EAAA,cAACG,EAAA,CACC,IAAKV,EACL,UAAWX,EACX,aAAcC,EACd,cAAgBqB,GAAa,CAC3BV,EAASU,CAAQ,EACjBf,GAAA,MAAAA,EAAgBe,CAClB,CAAA,EACA,MAAOT,EACN,GAAGL,CAEHV,EAAAA,CACH,EAECkB,GAASE,EAAA,cAACK,EAAA,CAAc,UAAU,MAAQP,EAAAA,CAAM,CACnD,CAEJ,EAEaQ,EAAmB,OAAO,OAAO3B,EAA2B,CACvE,KAAM4B,CACR,CAAC,EAED5B,EAA0B,YAAc"}