@bi-digital/react 0.12.0 → 0.12.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.mjs","names":[],"sources":["../../../src/components/avatar/avatar.tsx"],"sourcesContent":["import { Fragment, type HTMLAttributes, type Ref } from 'react';\nimport clsx from 'clsx/lite';\nimport { Slot } from '@radix-ui/react-slot';\nimport type { DefaultProps } from '../../types';\nimport type { MergeRight } from '../../utilities';\n\nexport type AvatarProps = MergeRight<\n DefaultProps & HTMLAttributes<HTMLSpanElement>,\n {\n /**\n * Name of the person the avatar represents.\n */\n 'aria-label': string;\n /**\n * Size of the avatar.\n * @default 'medium'\n */\n size?: 'small' | 'medium';\n ref?: Ref<HTMLSpanElement>;\n }\n>;\n\n/**\n * An Avatar represents a person.\n *\n * @example\n * <Avatar aria-label=\"Ola Nordmann\">ON</Avatar>\n *\n * @example\n * <Avatar aria-label=\"Ola Nordmann\">\n * <img src='…' alt='Ola Nordmann' />\n * </Avatar>\n */\nexport const Avatar = ({ 'aria-label': ariaLabel, className, ref, size, children, ...props }: AvatarProps) => {\n const isSlotInUse = children && typeof children !== 'string';\n const Component = isSlotInUse ? Slot : Fragment;\n return (\n <span\n className={clsx('bi-avatar', className)}\n aria-label={ariaLabel}\n role='img'\n data-size={size}\n ref={ref}\n {...props}\n >\n <Component {...(isSlotInUse ? { 'aria-hidden': true } : {})}>{children}</Component>\n </span>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAiCA,MAAa,UAAU,EAAE,cAAc,WAAW,WAAW,KAAK,MAAM,UAAU,GAAG,YAAyB;CAC5G,MAAM,cAAc,YAAY,OAAO,aAAa;CACpD,MAAM,YAAY,cAAc,OAAO;CACvC,OACE,oBAAC,QAAD;EACE,WAAW,KAAK,aAAa,UAAU;EACvC,cAAY;
|
|
1
|
+
{"version":3,"file":"avatar.mjs","names":[],"sources":["../../../src/components/avatar/avatar.tsx"],"sourcesContent":["import { Fragment, type HTMLAttributes, type Ref } from 'react';\nimport clsx from 'clsx/lite';\nimport { Slot } from '@radix-ui/react-slot';\nimport type { DefaultProps } from '../../types';\nimport type { MergeRight } from '../../utilities';\n\nexport type AvatarProps = MergeRight<\n DefaultProps & HTMLAttributes<HTMLSpanElement>,\n {\n /**\n * Name of the person the avatar represents.\n */\n 'aria-label': string;\n /**\n * Size of the avatar.\n * @default 'medium'\n */\n size?: 'small' | 'medium';\n ref?: Ref<HTMLSpanElement>;\n }\n>;\n\n/**\n * An Avatar represents a person.\n *\n * @example\n * <Avatar aria-label=\"Ola Nordmann\">ON</Avatar>\n *\n * @example\n * <Avatar aria-label=\"Ola Nordmann\">\n * <img src='…' alt='Ola Nordmann' />\n * </Avatar>\n */\nexport const Avatar = ({ 'aria-label': ariaLabel, className, ref, size, children, ...props }: AvatarProps) => {\n const isSlotInUse = children && typeof children !== 'string';\n const Component = isSlotInUse ? Slot : Fragment;\n return (\n <span\n className={clsx('bi-avatar', className)}\n aria-label={ariaLabel}\n // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role\n role='img'\n data-size={size}\n ref={ref}\n {...props}\n >\n <Component {...(isSlotInUse ? { 'aria-hidden': true } : {})}>{children}</Component>\n </span>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAiCA,MAAa,UAAU,EAAE,cAAc,WAAW,WAAW,KAAK,MAAM,UAAU,GAAG,YAAyB;CAC5G,MAAM,cAAc,YAAY,OAAO,aAAa;CACpD,MAAM,YAAY,cAAc,OAAO;CACvC,OACE,oBAAC,QAAD;EACE,WAAW,KAAK,aAAa,UAAU;EACvC,cAAY;EAEZ,MAAK;EACL,aAAW;EACN;EACL,GAAI;YAEJ,oBAAC,WAAD;GAAW,GAAK,cAAc,EAAE,eAAe,MAAM,GAAG,EAAE;GAAI;GAAqB,CAAA;EAC9E,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.mjs","names":[],"sources":["../../../src/components/switch/switch.tsx"],"sourcesContent":["import type { ReactNode, Ref } from 'react';\n\nimport type { LabelRequiredProps } from '../../types';\nimport type { MergeRight } from '../../utilities';\nimport { Field, type FieldProps } from '../field';\nimport { Input, type InputProps } from '../input';\nimport { Label } from '../label';\n\nexport type SwitchProps = MergeRight<\n LabelRequiredProps & Omit<InputProps, 'type' | 'role' | 'size'> & Pick<FieldProps, 'position'>,\n {\n /** Label */\n label?: ReactNode;\n /** Add error indication to the switch. */\n error?: boolean;\n /** If true, the switch will take up the full width of the container, and not just \"fit-content\" which is default */\n fullwidth?: boolean;\n ref?: Ref<HTMLInputElement>;\n }\n>;\n\nexport const Switch = ({\n label,\n error,\n fullwidth,\n style,\n className,\n ref,\n id,\n 'data-color': color,\n 'data-color-scheme': colorScheme,\n position = 'end',\n ...props\n}: SwitchProps) => {\n return (\n <Field\n className={className}\n data-color={color}\n data-color-scheme={colorScheme}\n style={style}\n fullwidth={fullwidth}\n position={position}\n asChild\n >\n <label>\n <Input role='switch' type='checkbox' id={id} ref={ref} aria-invalid={error || undefined} {...props} />\n {label && (\n <Label weight='medium' htmlFor={id} asChild>\n <span>{label}</span>\n </Label>\n )}\n </label>\n </Field>\n );\n};\n"],"mappings":";;;;;;;;AAqBA,MAAa,UAAU,EACrB,OACA,OACA,WACA,OACA,WACA,KACA,IACA,cAAc,OACd,qBAAqB,aACrB,WAAW,OACX,GAAG,YACc;CACjB,OACE,oBAAC,OAAD;EACa;EACX,cAAY;EACZ,qBAAmB;EACZ;EACI;EACD;EACV,SAAA;YAEA,qBAAC,SAAD,EAAA,UAAA,
|
|
1
|
+
{"version":3,"file":"switch.mjs","names":[],"sources":["../../../src/components/switch/switch.tsx"],"sourcesContent":["import type { ReactNode, Ref } from 'react';\n\nimport type { LabelRequiredProps } from '../../types';\nimport type { MergeRight } from '../../utilities';\nimport { Field, type FieldProps } from '../field';\nimport { Input, type InputProps } from '../input';\nimport { Label } from '../label';\n\nexport type SwitchProps = MergeRight<\n LabelRequiredProps & Omit<InputProps, 'type' | 'role' | 'size'> & Pick<FieldProps, 'position'>,\n {\n /** Label */\n label?: ReactNode;\n /** Add error indication to the switch. */\n error?: boolean;\n /** If true, the switch will take up the full width of the container, and not just \"fit-content\" which is default */\n fullwidth?: boolean;\n ref?: Ref<HTMLInputElement>;\n }\n>;\n\nexport const Switch = ({\n label,\n error,\n fullwidth,\n style,\n className,\n ref,\n id,\n 'data-color': color,\n 'data-color-scheme': colorScheme,\n position = 'end',\n ...props\n}: SwitchProps) => {\n return (\n <Field\n className={className}\n data-color={color}\n data-color-scheme={colorScheme}\n style={style}\n fullwidth={fullwidth}\n position={position}\n asChild\n >\n <label>\n {/* oxlint-disable-next-line jsx-a11y/role-has-required-aria-props */}\n <Input role='switch' type='checkbox' id={id} ref={ref} aria-invalid={error || undefined} {...props} />\n {label && (\n <Label weight='medium' htmlFor={id} asChild>\n <span>{label}</span>\n </Label>\n )}\n </label>\n </Field>\n );\n};\n"],"mappings":";;;;;;;;AAqBA,MAAa,UAAU,EACrB,OACA,OACA,WACA,OACA,WACA,KACA,IACA,cAAc,OACd,qBAAqB,aACrB,WAAW,OACX,GAAG,YACc;CACjB,OACE,oBAAC,OAAD;EACa;EACX,cAAY;EACZ,qBAAmB;EACZ;EACI;EACD;EACV,SAAA;YAEA,qBAAC,SAAD,EAAA,UAAA,CAEE,oBAAC,OAAD;GAAO,MAAK;GAAS,MAAK;GAAe;GAAS;GAAK,gBAAc,SAAS,KAAA;GAAW,GAAI;GAAS,CAAA,EACrG,SACC,oBAAC,OAAD;GAAO,QAAO;GAAS,SAAS;GAAI,SAAA;aAClC,oBAAC,QAAD,EAAA,UAAO,OAAa,CAAA;GACd,CAAA,CAEJ,EAAA,CAAA;EACF,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bi-digital/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.12.
|
|
4
|
+
"version": "0.12.1",
|
|
5
5
|
"description": "React components from BI Digital",
|
|
6
6
|
"author": "BI Digital",
|
|
7
7
|
"homepage": "https://designsystem.bi.no/",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@radix-ui/react-slot": "^1.3.0",
|
|
42
42
|
"@radix-ui/react-use-controllable-state": "^1.2.2",
|
|
43
43
|
"clsx": "^2.1.1",
|
|
44
|
-
"@bi-digital/icons": "0.12.
|
|
44
|
+
"@bi-digital/icons": "0.12.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/react": "^19.2.14",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"react": "^19",
|
|
61
61
|
"react-dom": "^19",
|
|
62
|
-
"@bi-digital/css": "0.12.
|
|
62
|
+
"@bi-digital/css": "0.12.1"
|
|
63
63
|
},
|
|
64
64
|
"scripts": {
|
|
65
65
|
"build": "tsdown",
|