Closed Barsnes closed 1 week ago
My suggestion:
types.d.ts
with any types that are not dependent on tokens/themes to @digdir/designsystemet-react
which can be imported in the consuming librarytypes.d.ts
from the CLI build command with any types that depend on token values / modes etc, which then becomes a part of @digdir/designsystemet-theme
or an organization's own theme package"types"
array in tsconfig.json
I'm handling this as part of #2703.
We don't need to add this to our package, but we can tell our users how to ensure they have typesafety and autocomplete for our data attributes.
We already do this for
popover
(popovertarget
), and this is just something we need to add to our docsSame goes for size:
Since all components (and HTML elements) will support
data-size
anddata-color
, we should expose this as props also in React and thus avoiding confusion on whensize
is available and when it is not. We can however provide type safety by creating a shared props definition, which all components can extend:and those components with more sizes (Avatar, Spinner, Heading) can extend with more sizes in
data-size
Note:
data-color-scheme
has been separated out to #2812