@infonomic/uikit 6.8.2 → 6.9.0
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/README.md +183 -19
- package/dist/components/accordion/accordion.js +5 -5
- package/dist/components/accordion/accordion.module.css +11 -1
- package/dist/components/accordion/accordion_module.css +3 -1
- package/dist/components/avatar/avatar.module.css +9 -4
- package/dist/components/avatar/avatar_module.css +3 -1
- package/dist/components/badge/badge.d.ts +1 -1
- package/dist/components/badge/badge.module.css +9 -4
- package/dist/components/badge/badge_module.css +3 -1
- package/dist/components/button/button-group.d.ts +1 -1
- package/dist/components/button/button-group.module.css +11 -1
- package/dist/components/button/button-group_module.css +4 -2
- package/dist/components/button/button.module.css +9 -4
- package/dist/components/button/button_module.css +3 -1
- package/dist/components/button/combo-button.d.ts +1 -1
- package/dist/components/button/combo-button.module.css +11 -1
- package/dist/components/button/combo-button_module.css +3 -1
- package/dist/components/button/control-buttons.module.css +11 -1
- package/dist/components/button/control-buttons_module.css +3 -1
- package/dist/components/button/copy-button.module.css +9 -4
- package/dist/components/button/copy-button_module.css +3 -1
- package/dist/components/button/index.d.ts +5 -5
- package/dist/components/card/card.module.css +9 -4
- package/dist/components/card/card_module.css +3 -1
- package/dist/components/chips/chip.module.css +9 -4
- package/dist/components/chips/chip_module.css +3 -1
- package/dist/components/container/container.module.css +9 -4
- package/dist/components/container/container_module.css +6 -4
- package/dist/components/dropdown/dropdown.js +11 -11
- package/dist/components/dropdown/dropdown.module.css +9 -4
- package/dist/components/dropdown/dropdown_module.css +3 -1
- package/dist/components/hamburger/hamburger.module.css +9 -4
- package/dist/components/hamburger/hamburger_module.css +3 -1
- package/dist/components/inputs/autocomplete.module.css +9 -4
- package/dist/components/inputs/autocomplete_module.css +3 -1
- package/dist/components/inputs/calendar.module.css +9 -4
- package/dist/components/inputs/calendar_module.css +4 -2
- package/dist/components/inputs/checkbox-group.module.css +9 -4
- package/dist/components/inputs/checkbox-group_module.css +3 -1
- package/dist/components/inputs/checkbox.module.css +9 -4
- package/dist/components/inputs/checkbox_module.css +3 -1
- package/dist/components/inputs/error-text.module.css +9 -4
- package/dist/components/inputs/error-text_module.css +3 -1
- package/dist/components/inputs/help-text.module.css +9 -4
- package/dist/components/inputs/help-text_module.css +3 -1
- package/dist/components/inputs/input-adornment.module.css +9 -4
- package/dist/components/inputs/input-adornment_module.css +3 -1
- package/dist/components/inputs/input-password.d.ts +18 -2
- package/dist/components/inputs/input-password.d.ts.map +1 -1
- package/dist/components/inputs/input-password.js +19 -11
- package/dist/components/inputs/input-password.module.css +55 -0
- package/dist/components/inputs/input-password.module.js +5 -0
- package/dist/components/inputs/input-password_module.css +25 -0
- package/dist/components/inputs/input.d.ts +1 -1
- package/dist/components/inputs/input.module.css +9 -4
- package/dist/components/inputs/input_module.css +3 -1
- package/dist/components/inputs/label.module.css +9 -4
- package/dist/components/inputs/label_module.css +3 -1
- package/dist/components/inputs/radio-group.d.ts +1 -1
- package/dist/components/inputs/radio-group.module.css +9 -4
- package/dist/components/inputs/radio-group_module.css +3 -1
- package/dist/components/inputs/select.module.css +9 -4
- package/dist/components/inputs/select_module.css +3 -1
- package/dist/components/inputs/text-area.module.css +9 -4
- package/dist/components/inputs/text-area_module.css +3 -1
- package/dist/components/notifications/alert.module.css +9 -4
- package/dist/components/notifications/alert_module.css +4 -2
- package/dist/components/notifications/toast.module.css +9 -4
- package/dist/components/notifications/toast_module.css +5 -3
- package/dist/components/pager/first-button.d.ts +1 -1
- package/dist/components/pager/hooks/usePagination.d.ts +1 -1
- package/dist/components/pager/last-button.d.ts +1 -1
- package/dist/components/pager/next-button.d.ts +1 -1
- package/dist/components/pager/number-button.d.ts +1 -1
- package/dist/components/pager/pagination.d.ts +7 -7
- package/dist/components/pager/pagination.module.css +9 -4
- package/dist/components/pager/pagination_module.css +4 -2
- package/dist/components/pager/previous-button.d.ts +1 -1
- package/dist/components/scroll-area/scroll-area.module.css +9 -4
- package/dist/components/scroll-area/scroll-area_module.css +3 -1
- package/dist/components/scroll-to-top/scroll-to-top.module.css +9 -3
- package/dist/components/scroll-to-top/scroll-to-top_module.css +4 -2
- package/dist/components/section/section.module.css +9 -4
- package/dist/components/section/section_module.css +3 -1
- package/dist/components/shimmer/shimmer.module.css +9 -4
- package/dist/components/shimmer/shimmer_module.css +3 -1
- package/dist/components/table/table.module.css +9 -4
- package/dist/components/table/table_module.css +3 -1
- package/dist/components/tabs/tabs.module.css +9 -4
- package/dist/components/tabs/tabs_module.css +3 -1
- package/dist/components/tooltip/tooltip.module.css +9 -4
- package/dist/components/tooltip/tooltip_module.css +3 -1
- package/dist/css-layers.d.ts +23 -0
- package/dist/css-layers.d.ts.map +1 -0
- package/dist/css-layers.js +14 -0
- package/dist/icons/icons.module.css +11 -1
- package/dist/icons/icons_module.css +3 -1
- package/dist/icons/stopwatch-icon.d.ts +1 -1
- package/dist/loaders/ellipses.module.css +9 -4
- package/dist/loaders/ellipses_module.css +3 -1
- package/dist/loaders/ring.module.css +9 -4
- package/dist/loaders/ring_module.css +3 -1
- package/dist/loaders/spinner.module.css +9 -4
- package/dist/loaders/spinner_module.css +3 -1
- package/dist/react.d.ts +14 -14
- package/dist/styles/components-vanilla.css +1 -1
- package/dist/styles/reset.css +1 -1
- package/dist/styles/styles.css +1 -1
- package/dist/styles/typography.css +1 -1
- package/dist/widgets/datepicker/datepicker.d.ts +42 -1
- package/dist/widgets/datepicker/datepicker.d.ts.map +1 -1
- package/dist/widgets/datepicker/datepicker.js +34 -4
- package/dist/widgets/datepicker/datepicker.module.css +21 -2
- package/dist/widgets/datepicker/datepicker.module.js +1 -0
- package/dist/widgets/datepicker/datepicker_module.css +7 -2
- package/dist/widgets/drawer/drawer.d.ts +4 -4
- package/dist/widgets/drawer/drawer.module.css +11 -1
- package/dist/widgets/drawer/drawer_module.css +4 -2
- package/dist/widgets/modal/modal-context.d.ts +20 -0
- package/dist/widgets/modal/modal-context.d.ts.map +1 -0
- package/dist/widgets/modal/modal-context.js +4 -0
- package/dist/widgets/modal/modal-header.d.ts +1 -1
- package/dist/widgets/modal/modal-header.d.ts.map +1 -1
- package/dist/widgets/modal/modal-header.js +23 -1
- package/dist/widgets/modal/modal.d.ts +13 -8
- package/dist/widgets/modal/modal.d.ts.map +1 -1
- package/dist/widgets/modal/modal.js +8 -4
- package/dist/widgets/modal/modal.module.css +11 -1
- package/dist/widgets/modal/modal_module.css +5 -3
- package/dist/widgets/timeline/timeline.module.css +9 -4
- package/dist/widgets/timeline/timeline_module.css +3 -1
- package/package.json +45 -32
- package/src/components/accordion/accordion.module.css +11 -1
- package/src/components/avatar/avatar.module.css +9 -4
- package/src/components/badge/badge.module.css +9 -4
- package/src/components/button/button-group.module.css +11 -1
- package/src/components/button/button.module.css +9 -4
- package/src/components/button/combo-button.module.css +11 -1
- package/src/components/button/control-buttons.module.css +11 -1
- package/src/components/button/copy-button.module.css +9 -4
- package/src/components/card/card.module.css +9 -4
- package/src/components/chips/chip.module.css +9 -4
- package/src/components/container/container.module.css +9 -4
- package/src/components/dropdown/dropdown.module.css +9 -4
- package/src/components/hamburger/hamburger.module.css +9 -4
- package/src/components/inputs/autocomplete.module.css +9 -4
- package/src/components/inputs/calendar.module.css +9 -4
- package/src/components/inputs/checkbox-group.module.css +9 -4
- package/src/components/inputs/checkbox.module.css +9 -4
- package/src/components/inputs/error-text.module.css +9 -4
- package/src/components/inputs/help-text.module.css +9 -4
- package/src/components/inputs/input-adornment.module.css +9 -4
- package/src/components/inputs/input-password.module.css +55 -0
- package/src/components/inputs/input-password.tsx +49 -7
- package/src/components/inputs/input.module.css +9 -4
- package/src/components/inputs/label.module.css +9 -4
- package/src/components/inputs/radio-group.module.css +9 -4
- package/src/components/inputs/select.module.css +9 -4
- package/src/components/inputs/text-area.module.css +9 -4
- package/src/components/notifications/alert.module.css +9 -4
- package/src/components/notifications/toast.module.css +9 -4
- package/src/components/pager/pagination.module.css +9 -4
- package/src/components/scroll-area/scroll-area.module.css +9 -4
- package/src/components/scroll-to-top/scroll-to-top.module.css +9 -3
- package/src/components/section/section.module.css +9 -4
- package/src/components/shimmer/shimmer.module.css +9 -4
- package/src/components/table/table.module.css +9 -4
- package/src/components/tabs/tabs.module.css +9 -4
- package/src/components/tooltip/tooltip.module.css +9 -4
- package/src/css-layers.ts +34 -0
- package/src/icons/icons.module.css +11 -1
- package/src/loaders/ellipses.module.css +9 -4
- package/src/loaders/ring.module.css +9 -4
- package/src/loaders/spinner.module.css +9 -4
- package/src/styles/base/animations.css +12 -0
- package/src/styles/base/base.css +12 -0
- package/src/styles/base/borders.css +12 -0
- package/src/styles/base/breakpoints.css +12 -0
- package/src/styles/base/colors.css +12 -0
- package/src/styles/base/opacity.css +12 -0
- package/src/styles/base/shadows.css +12 -0
- package/src/styles/base/size.css +12 -0
- package/src/styles/base/spacing.css +12 -0
- package/src/styles/base/transitions.css +12 -0
- package/src/styles/base/typography.css +12 -0
- package/src/styles/base/z-index.css +12 -0
- package/src/styles/components/components.css +12 -0
- package/src/styles/components/fade-in-lift.css +27 -13
- package/src/styles/components/hamburger.css +11 -6
- package/src/styles/components/loaders.css +168 -154
- package/src/styles/functional/README.md +18 -18
- package/src/styles/functional/borders.css +12 -0
- package/src/styles/functional/colors.css +12 -0
- package/src/styles/functional/functional.css +12 -0
- package/src/styles/functional/grid-flex.css +12 -0
- package/src/styles/functional/shadcn-compat.css +12 -0
- package/src/styles/functional/surfaces.css +12 -0
- package/src/styles/functional/typography.css +12 -0
- package/src/styles/local-fonts.css +12 -0
- package/src/styles/reset.css +18 -0
- package/src/styles/styles.css +9 -4
- package/src/styles/theme/autofill.css +12 -0
- package/src/styles/theme/defaults.css +12 -0
- package/src/styles/theme/scrollers.css +12 -0
- package/src/styles/theme/theme.css +12 -0
- package/src/styles/typography/fonts.css +12 -0
- package/src/styles/typography/prose.css +12 -0
- package/src/styles/typography.css +12 -0
- package/src/styles/utils/scroll-layout-shift.css +12 -0
- package/src/styles/utils/utility-classes.css +12 -0
- package/src/styles/utils/utils.css +12 -0
- package/src/widgets/datepicker/datepicker.module.css +21 -2
- package/src/widgets/datepicker/datepicker.tsx +97 -4
- package/src/widgets/drawer/drawer.module.css +11 -1
- package/src/widgets/modal/modal-context.ts +23 -0
- package/src/widgets/modal/modal-header.tsx +29 -2
- package/src/widgets/modal/modal.module.css +11 -1
- package/src/widgets/modal/modal.tsx +15 -6
- package/src/widgets/timeline/timeline.module.css +9 -4
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ It just doesn't belong in UI kits and libraries.
|
|
|
10
10
|
|
|
11
11
|
## Rationale
|
|
12
12
|
|
|
13
|
-
In addition to our thoughts above, this kit is built around the philosophy of adopting or 'folding in' best-in-class components, like the ones in well-known 'à la carte' headless component libraries such as [Base UI](https://base-ui.com/) and [React Aria](https://react-spectrum.adobe.com/react-aria/index.html), as well as other well-known individual components such as [React Day Picker](https://github.com/gpbl/react-day-picker) and more.
|
|
13
|
+
In addition to our thoughts above, this kit is built around the philosophy of adopting or 'folding in' best-in-class components, like the ones in well-known 'à la carte' headless component libraries such as [Base UI](https://base-ui.com/) and [React Aria](https://react-spectrum.adobe.com/react-aria/index.html), as well as other well-known individual components such as [React Day Picker](https://github.com/gpbl/react-day-picker) and more.
|
|
14
14
|
|
|
15
15
|
Many of the current components are built on [Base UI](https://base-ui.com/) - which is an excellent project. The great thing about wrapping these components in a client-consumable interface and library is that, in theory at least, the consumer of our kit's components won't have to worry about implementation details or migration from one underlying component library to another. The 'contract' and core styling semantics will never change.
|
|
16
16
|
|
|
@@ -24,7 +24,7 @@ We built this with the following design goals in mind:
|
|
|
24
24
|
|
|
25
25
|
4. We'd like our components' styles to be easily overridable - whether via 'style' attributes, Tailwind, regular CSS classnames and stylesheets, or any other style system being used by the front-end. We'd especially like to be able to override a component's styles without having to use CSS !important.
|
|
26
26
|
|
|
27
|
-
5. We have a very opinionated definition of variants and intents. Variants in our kit refer to overall style variations - meaning they may differ in terms of shape, form, borders, etc. For example, `outlined`, `gradient`, or `filled` buttons, or `outlined`, `filled`, and `underlined` text input components. Our intents system, as the name suggests, signals semantic intent and is composed of `primary`, `secondary`, `noeffect`, `info`, `warning`, `success` and `danger`. Many of our components support both variant and intent properties.
|
|
27
|
+
5. We have a very opinionated definition of variants and intents. Variants in our kit refer to overall style variations - meaning they may differ in terms of shape, form, borders, etc. For example, `outlined`, `gradient`, or `filled` buttons, or `outlined`, `filled`, and `underlined` text input components. Our intents system, as the name suggests, signals semantic intent and is composed of `primary`, `secondary`, `noeffect`, `info`, `warning`, `success` and `danger`. Many of our components support both variant and intent properties.
|
|
28
28
|
|
|
29
29
|
### Other key points:
|
|
30
30
|
|
|
@@ -53,8 +53,6 @@ The intent token taxonomy follows `element-intent-emphasis-state`:
|
|
|
53
53
|
|
|
54
54
|
Example: `--text-on-primary-strong-disabled`. Components that need a role without an intent (e.g. a focus ring on a form field) should use the generic tokens: `--focus-ring`, `--field-border`, `--field-border-invalid`, `--surface-subtle`, `--text-subtle`.
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
56
|
## Getting Started
|
|
59
57
|
|
|
60
58
|
Install packages
|
|
@@ -69,37 +67,201 @@ And then in your application in a global.css or other root CSS file...
|
|
|
69
67
|
|
|
70
68
|
```css
|
|
71
69
|
/**
|
|
72
|
-
* Optional reset and core styles including var system for
|
|
70
|
+
* Optional reset and core styles including var system for
|
|
73
71
|
* breakpoints, colors, scales, utils etc., which can be
|
|
74
72
|
* integrated with Tailwind (colors, breakpoints etc.) via
|
|
75
73
|
* Tailwind theme configuration.
|
|
76
74
|
*/
|
|
77
|
-
@import
|
|
78
|
-
@import
|
|
75
|
+
@import "@infonomic/uikit/reset.css";
|
|
76
|
+
@import "@infonomic/uikit/styles.css";
|
|
79
77
|
|
|
80
78
|
/**
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
@import
|
|
79
|
+
* Optional uikit typography including prose and fonts
|
|
80
|
+
*/
|
|
81
|
+
@import "@infonomic/uikit/typography.css";
|
|
84
82
|
|
|
85
83
|
/**
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
@import
|
|
84
|
+
* Tailwind (optional) - should come after the above.
|
|
85
|
+
*/
|
|
86
|
+
@import "./tailwind.css";
|
|
89
87
|
|
|
90
88
|
/**
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
@import
|
|
89
|
+
* Application styles
|
|
90
|
+
*/
|
|
91
|
+
@import "./app.css";
|
|
94
92
|
```
|
|
95
93
|
|
|
96
94
|
Followed by the below in any of your components or routes where you'd like to import a component...
|
|
97
95
|
|
|
98
96
|
```ts
|
|
99
97
|
import { Button, Card, Container, Section } from '@infonomic/uikit/react'
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## CSS cascade layers
|
|
101
|
+
|
|
102
|
+
A Tailwind utility applied directly to an element overrides ordinary
|
|
103
|
+
component, typography and theme declarations for the same property on that
|
|
104
|
+
element. This is a cascade-order contract, not a matter of selector
|
|
105
|
+
specificity.
|
|
100
106
|
|
|
107
|
+
Limits:
|
|
108
|
+
|
|
109
|
+
- Per element and per property. A utility on a parent does not beat a rule
|
|
110
|
+
on its children.
|
|
111
|
+
- Two conflicting utilities follow Tailwind's generated order, not their order
|
|
112
|
+
in `className`.
|
|
113
|
+
- `@apply` keeps the precedence of the layer it is written in. `@utility` is
|
|
114
|
+
emitted into Tailwind's `utilities` layer.
|
|
115
|
+
- `!important`, inline styles, animations and transitions are outside the
|
|
116
|
+
contract. Important declarations reverse layer order, so `!important` is not
|
|
117
|
+
a fix for a rule in the wrong layer. Do not make Tailwind `important`
|
|
118
|
+
globally, and do not raise selector specificity as a substitute for layering.
|
|
119
|
+
|
|
120
|
+
Every kit stylesheet reserves this order, lowest to highest precedence:
|
|
121
|
+
|
|
122
|
+
```css
|
|
123
|
+
@layer base,
|
|
124
|
+
infonomic-base,
|
|
125
|
+
theme,
|
|
126
|
+
infonomic-theme,
|
|
127
|
+
infonomic-functional,
|
|
128
|
+
infonomic-typography,
|
|
129
|
+
components,
|
|
130
|
+
infonomic-components,
|
|
131
|
+
overrides,
|
|
132
|
+
infonomic-utilities,
|
|
133
|
+
utilities;
|
|
101
134
|
```
|
|
102
135
|
|
|
136
|
+
| Layer | Owner | Holds |
|
|
137
|
+
| ------------------------------------------ | -------- | ---------------------------------------------------------------------- |
|
|
138
|
+
| `base`, `theme`, `components`, `utilities` | Tailwind | Tailwind's output |
|
|
139
|
+
| `infonomic-*` | uikit | Reset, tokens, functional rules, typography, components, kit utilities |
|
|
140
|
+
| `components` | Host | The host's own component CSS, including CSS modules |
|
|
141
|
+
| `overrides` | Host | Brand tokens, area themes, restyles of kit components |
|
|
142
|
+
| `utilities` | Tailwind | The final say |
|
|
143
|
+
|
|
144
|
+
Avoid ordinary unlayered rules in a host: they outrank every named layer,
|
|
145
|
+
including Tailwind utilities. CSS modules rename classes; they do not create
|
|
146
|
+
a layer, so wrap module rules in `@layer components` too. A packaged
|
|
147
|
+
application built on the kit may add its own layers between these (for
|
|
148
|
+
example a package theme layer directly above `infonomic-theme`), provided its
|
|
149
|
+
full statement keeps the same relative order for every name above and reaches
|
|
150
|
+
the browser first.
|
|
151
|
+
|
|
152
|
+
### Host integration
|
|
153
|
+
|
|
154
|
+
Import the kit CSS as shown in [Getting Started](#getting-started), then
|
|
155
|
+
establish the order with both of the helpers exported from the React-free
|
|
156
|
+
`@infonomic/uikit/css-layers` entry. The PostCSS plugin needs PostCSS 8, which
|
|
157
|
+
Vite already uses; add `postcss` as a development dependency if your host does
|
|
158
|
+
not already have it.
|
|
159
|
+
|
|
160
|
+
```ts
|
|
161
|
+
// vite.config.ts
|
|
162
|
+
import { infonomicLayerOrder } from '@infonomic/uikit/css-layers'
|
|
163
|
+
import { defineConfig } from 'vite'
|
|
164
|
+
|
|
165
|
+
export default defineConfig({
|
|
166
|
+
css: { postcss: { plugins: [infonomicLayerOrder()] } },
|
|
167
|
+
})
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
```tsx
|
|
171
|
+
// root document
|
|
172
|
+
import { INFONOMIC_LAYER_ORDER } from '@infonomic/uikit/css-layers'
|
|
173
|
+
|
|
174
|
+
;<head>
|
|
175
|
+
<style>{INFONOMIC_LAYER_ORDER}</style>
|
|
176
|
+
<HeadContent />
|
|
177
|
+
</head>
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Keep both. The head statement covers CSS injected in development. React can
|
|
181
|
+
hoist production stylesheet links above that `<style>`, so the plugin puts the
|
|
182
|
+
statement at the top of every stylesheet before the bundler hashes it.
|
|
183
|
+
Repeating the order is harmless, but a layer name's position is fixed where it
|
|
184
|
+
first appears, and a partial order cannot be repaired afterwards. In a host
|
|
185
|
+
that does not use PostCSS (for example Vite's `lightningcss` transformer),
|
|
186
|
+
import `@infonomic/uikit/reset.css` or `styles.css` first: each kit stylesheet
|
|
187
|
+
opens with the full statement. Check the first appearance of layer names in
|
|
188
|
+
your production CSS; minifiers may fold statements into layer blocks without
|
|
189
|
+
changing their order.
|
|
190
|
+
|
|
191
|
+
In a Tailwind entry, open with the full statement rather than Tailwind's
|
|
192
|
+
default `@layer theme, base, components, utilities;` (see
|
|
193
|
+
[Tailwind CSS Integration](#tailwind-css-integration)).
|
|
194
|
+
|
|
195
|
+
### Themed areas
|
|
196
|
+
|
|
197
|
+
To theme part of a site (a public front end, say) without reaching another
|
|
198
|
+
area that should keep the kit defaults, set an attribute on `<html>` during
|
|
199
|
+
rendering, including SSR, and scope overrides to it. Putting it on `<html>`
|
|
200
|
+
keeps portalled dialogs, drawers and toasts in the right theme.
|
|
201
|
+
|
|
202
|
+
```css
|
|
203
|
+
@layer overrides {
|
|
204
|
+
@scope (:root[data-theme-context="public"]) {
|
|
205
|
+
:scope {
|
|
206
|
+
--theme-base: oklch(0.55 0.084 144.28);
|
|
207
|
+
}
|
|
208
|
+
:scope.dark {
|
|
209
|
+
--prose-body: var(--gray-100);
|
|
210
|
+
}
|
|
211
|
+
.infonomic-button {
|
|
212
|
+
border-radius: 0;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Inside `@scope (:root[…])`, a rule written as `:root { … }`, `html { … }` or
|
|
219
|
+
`.dark .x { … }` never matches, and nothing reports it. Write `:scope { … }`,
|
|
220
|
+
`:scope.dark .x { … }` or `.x:is(.dark *)`. Set tokens on the root itself
|
|
221
|
+
(`:scope`), not on a descendant wrapper: Tailwind's colour aliases resolve
|
|
222
|
+
tokens on the root before inheritance. The attribute and context names are a
|
|
223
|
+
host convention.
|
|
224
|
+
|
|
225
|
+
Tailwind theme variables are global. Add new names in a top-level `@theme`
|
|
226
|
+
freely, but change shared values (an existing colour or font) on the scoped
|
|
227
|
+
root instead.
|
|
228
|
+
|
|
229
|
+
### Upgrading existing hosts
|
|
230
|
+
|
|
231
|
+
This order changes observable behaviour:
|
|
232
|
+
|
|
233
|
+
- Kit utilities (`infonomic-utilities`, for example `.sr-only` and the
|
|
234
|
+
`.text-*`, `.font-*` and `.primary-strong` helpers) now rank above kit theme,
|
|
235
|
+
typography and components. Before, they ranked below all three.
|
|
236
|
+
- `infonomic-theme` now ranks below `infonomic-functional`.
|
|
237
|
+
- Kit typography tokens now rank above Tailwind's `theme` layer. If you
|
|
238
|
+
import `typography.css` and set `--font-sans`, `--font-serif`,
|
|
239
|
+
`--font-display` or `--font-mono` in Tailwind `@theme`, the kit values now
|
|
240
|
+
win. Set those tokens in `@layer overrides` instead. No other kit token
|
|
241
|
+
shares a name with a Tailwind theme variable.
|
|
242
|
+
- Unlayered host rules are unchanged: they beat all kit CSS and Tailwind
|
|
243
|
+
utilities, whatever their specificity. A global `button` or `a` rule can
|
|
244
|
+
change kit controls, so the contract only holds once host CSS is layered.
|
|
245
|
+
|
|
246
|
+
Before upgrading, move ordinary host CSS (including CSS modules and global
|
|
247
|
+
element rules) into named layers: site components in `components`, kit
|
|
248
|
+
restyles and brand tokens in `overrides`. Add both integrations above, then
|
|
249
|
+
compare representative pages, dialogs and forms in light and dark against a
|
|
250
|
+
visual baseline taken before the upgrade.
|
|
251
|
+
|
|
252
|
+
### Verification
|
|
253
|
+
|
|
254
|
+
`pnpm --filter @infonomic/uikit test` runs the source guard
|
|
255
|
+
(`packages/uikit/tests/css-layers.test.mjs`): every kit stylesheet opens with
|
|
256
|
+
the full order, no declaration is unlayered or `!important`, `@scope` rules do
|
|
257
|
+
not select the scope root by `:root`, `html` or `.dark`, and the TanStack demo
|
|
258
|
+
keeps both integrations. After `pnpm build`, `test:css-build` also checks the
|
|
259
|
+
published helper and the first-appearance order of every emitted stylesheet.
|
|
260
|
+
|
|
261
|
+
The layer prefix is `infonomic-`. The Byline CMS kit (`@byline/ui`) uses the
|
|
262
|
+
same order with the `byline-` prefix; when porting a change between the kits,
|
|
263
|
+
rename `@layer` names but not the `.infonomic-*` DOM class hooks.
|
|
264
|
+
|
|
103
265
|
## Documentation
|
|
104
266
|
|
|
105
267
|
At the moment, self-documented component examples are all based on [Storybook](https://storybook.js.org/). For now at least, in order to view our Storybook stories you'll need to clone this repo, install all dependencies, then change into the packages/uikit directory and start Storybook with `pnpm storybook` or `npm run storybook`.
|
|
@@ -109,7 +271,9 @@ At the moment, self-documented component examples are all based on [Storybook](h
|
|
|
109
271
|
Here's an example Tailwind CSS integration. Note that we have our own reset, and optional typography system and so the order of our imports is a little different from the usual 'Tailwind first' approach. The example below does NOT use the Tailwind CSS reset.
|
|
110
272
|
|
|
111
273
|
```css
|
|
112
|
-
@layer
|
|
274
|
+
@layer base, infonomic-base, theme, infonomic-theme, infonomic-functional,
|
|
275
|
+
infonomic-typography, components, infonomic-components, overrides,
|
|
276
|
+
infonomic-utilities, utilities;
|
|
113
277
|
@import "tailwindcss/theme.css" layer(theme);
|
|
114
278
|
/* @import "tailwindcss/preflight.css" layer(base); */
|
|
115
279
|
@import "tailwindcss/utilities.css" layer(utilities);
|
|
@@ -305,5 +469,5 @@ Copyright © 2025 Anthony Bouch and contributors.
|
|
|
305
469
|
|
|
306
470
|
### Major Contributors
|
|
307
471
|
|
|
308
|
-
|
|
309
|
-
|
|
472
|
+
- Anthony Bouch https://www.linkedin.com/in/anthonybouch/ anthony@infonomic.io
|
|
473
|
+
- David Lipsky https://www.linkedin.com/in/david-lipsky-4391862a8/ david@infonomic.io
|
|
@@ -42,10 +42,10 @@ const Panel = function({ ref, children, className, ...props }) {
|
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
44
|
const accordion_Accordion = {
|
|
45
|
-
Root
|
|
46
|
-
Item
|
|
47
|
-
Header
|
|
48
|
-
Trigger
|
|
49
|
-
Panel
|
|
45
|
+
Root,
|
|
46
|
+
Item,
|
|
47
|
+
Header,
|
|
48
|
+
Trigger,
|
|
49
|
+
Panel
|
|
50
50
|
};
|
|
51
51
|
export { accordion_Accordion as Accordion };
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
@layer
|
|
1
|
+
@layer base,
|
|
2
|
+
infonomic-base,
|
|
3
|
+
theme,
|
|
4
|
+
infonomic-theme,
|
|
5
|
+
infonomic-functional,
|
|
6
|
+
infonomic-typography,
|
|
7
|
+
components,
|
|
8
|
+
infonomic-components,
|
|
9
|
+
overrides,
|
|
10
|
+
infonomic-utilities,
|
|
11
|
+
utilities;
|
|
2
12
|
|
|
3
13
|
@layer infonomic-components {
|
|
4
14
|
.item,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@layer infonomic-base, infonomic-
|
|
1
|
+
@layer base, infonomic-base, theme, infonomic-theme, infonomic-functional, infonomic-typography, components;
|
|
2
2
|
|
|
3
3
|
@layer infonomic-components {
|
|
4
4
|
:is(.item-iZzmBc, .infonomic-accordion-item) {
|
|
@@ -51,3 +51,5 @@
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
@layer overrides, infonomic-utilities, utilities;
|
|
55
|
+
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
@layer
|
|
2
|
-
infonomic-
|
|
3
|
-
|
|
1
|
+
@layer base,
|
|
2
|
+
infonomic-base,
|
|
3
|
+
theme,
|
|
4
4
|
infonomic-theme,
|
|
5
|
+
infonomic-functional,
|
|
5
6
|
infonomic-typography,
|
|
6
|
-
|
|
7
|
+
components,
|
|
8
|
+
infonomic-components,
|
|
9
|
+
overrides,
|
|
10
|
+
infonomic-utilities,
|
|
11
|
+
utilities;
|
|
7
12
|
|
|
8
13
|
@layer infonomic-components {
|
|
9
14
|
/* relative inline-flex h-10 w-10 rounded-full */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@layer
|
|
1
|
+
@layer base, infonomic-base, theme, infonomic-theme, infonomic-functional, infonomic-typography, components;
|
|
2
2
|
|
|
3
3
|
@layer infonomic-components {
|
|
4
4
|
:is(.avatar-root-WYOuF_, .infonomic-avatar-root) {
|
|
@@ -34,3 +34,5 @@
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
@layer overrides, infonomic-utilities, utilities;
|
|
38
|
+
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
@layer
|
|
2
|
-
infonomic-
|
|
3
|
-
|
|
1
|
+
@layer base,
|
|
2
|
+
infonomic-base,
|
|
3
|
+
theme,
|
|
4
4
|
infonomic-theme,
|
|
5
|
+
infonomic-functional,
|
|
5
6
|
infonomic-typography,
|
|
6
|
-
|
|
7
|
+
components,
|
|
8
|
+
infonomic-components,
|
|
9
|
+
overrides,
|
|
10
|
+
infonomic-utilities,
|
|
11
|
+
utilities;
|
|
7
12
|
|
|
8
13
|
@layer infonomic-components {
|
|
9
14
|
.badge,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@layer
|
|
1
|
+
@layer base, infonomic-base, theme, infonomic-theme, infonomic-functional, infonomic-typography, components;
|
|
2
2
|
|
|
3
3
|
@layer infonomic-components {
|
|
4
4
|
:is(.badge-8xVidp, .infonomic-badge) {
|
|
@@ -49,3 +49,5 @@
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
@layer overrides, infonomic-utilities, utilities;
|
|
53
|
+
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { type Ref } from 'react';
|
|
2
2
|
import { Toggle } from '@base-ui/react/toggle';
|
|
3
3
|
import { ToggleGroup } from '@base-ui/react/toggle-group';
|
|
4
|
-
import type { EnableRipple, Intent, Size, Variant } from './@types/button';
|
|
4
|
+
import type { EnableRipple, Intent, Size, Variant } from './@types/button.js';
|
|
5
5
|
interface ButtonGroupContextType {
|
|
6
6
|
variant?: Variant;
|
|
7
7
|
size?: Size;
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
@layer
|
|
1
|
+
@layer base,
|
|
2
|
+
infonomic-base,
|
|
3
|
+
theme,
|
|
4
|
+
infonomic-theme,
|
|
5
|
+
infonomic-functional,
|
|
6
|
+
infonomic-typography,
|
|
7
|
+
components,
|
|
8
|
+
infonomic-components,
|
|
9
|
+
overrides,
|
|
10
|
+
infonomic-utilities,
|
|
11
|
+
utilities;
|
|
2
12
|
|
|
3
13
|
@layer infonomic-components {
|
|
4
14
|
.button-group,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@layer infonomic-base, infonomic-
|
|
1
|
+
@layer base, infonomic-base, theme, infonomic-theme, infonomic-functional, infonomic-typography, components;
|
|
2
2
|
|
|
3
3
|
@layer infonomic-components {
|
|
4
4
|
:is(.button-group-uqvOi8, .infonomic-button-group) {
|
|
@@ -8,10 +8,12 @@
|
|
|
8
8
|
display: flex;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
@media screen and (
|
|
11
|
+
@media screen and (width >= 40rem) {
|
|
12
12
|
:is(.button-group-uqvOi8, .infonomic-button-group) {
|
|
13
13
|
flex-direction: row;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
@layer overrides, infonomic-utilities, utilities;
|
|
19
|
+
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
@layer
|
|
2
|
-
infonomic-
|
|
3
|
-
|
|
1
|
+
@layer base,
|
|
2
|
+
infonomic-base,
|
|
3
|
+
theme,
|
|
4
4
|
infonomic-theme,
|
|
5
|
+
infonomic-functional,
|
|
5
6
|
infonomic-typography,
|
|
6
|
-
|
|
7
|
+
components,
|
|
8
|
+
infonomic-components,
|
|
9
|
+
overrides,
|
|
10
|
+
infonomic-utilities,
|
|
11
|
+
utilities;
|
|
7
12
|
|
|
8
13
|
@layer infonomic-components {
|
|
9
14
|
.button,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@layer
|
|
1
|
+
@layer base, infonomic-base, theme, infonomic-theme, infonomic-functional, infonomic-typography, components;
|
|
2
2
|
|
|
3
3
|
@layer infonomic-components {
|
|
4
4
|
:is(.button-IjDhC0, .infonomic-button) {
|
|
@@ -380,3 +380,5 @@
|
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
382
|
|
|
383
|
+
@layer overrides, infonomic-utilities, utilities;
|
|
384
|
+
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
@layer
|
|
1
|
+
@layer base,
|
|
2
|
+
infonomic-base,
|
|
3
|
+
theme,
|
|
4
|
+
infonomic-theme,
|
|
5
|
+
infonomic-functional,
|
|
6
|
+
infonomic-typography,
|
|
7
|
+
components,
|
|
8
|
+
infonomic-components,
|
|
9
|
+
overrides,
|
|
10
|
+
infonomic-utilities,
|
|
11
|
+
utilities;
|
|
2
12
|
|
|
3
13
|
@layer infonomic-components {
|
|
4
14
|
.combo-button-wrapper,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@layer infonomic-base, infonomic-
|
|
1
|
+
@layer base, infonomic-base, theme, infonomic-theme, infonomic-functional, infonomic-typography, components;
|
|
2
2
|
|
|
3
3
|
@layer infonomic-components {
|
|
4
4
|
:is(.combo-button-wrapper-nRtH6j, .infonomic-combo-button-wrapper) {
|
|
@@ -70,3 +70,5 @@
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
@layer overrides, infonomic-utilities, utilities;
|
|
74
|
+
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
@layer
|
|
1
|
+
@layer base,
|
|
2
|
+
infonomic-base,
|
|
3
|
+
theme,
|
|
4
|
+
infonomic-theme,
|
|
5
|
+
infonomic-functional,
|
|
6
|
+
infonomic-typography,
|
|
7
|
+
components,
|
|
8
|
+
infonomic-components,
|
|
9
|
+
overrides,
|
|
10
|
+
infonomic-utilities,
|
|
11
|
+
utilities;
|
|
2
12
|
|
|
3
13
|
@layer infonomic-components {
|
|
4
14
|
.stop-button,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@layer infonomic-base, infonomic-
|
|
1
|
+
@layer base, infonomic-base, theme, infonomic-theme, infonomic-functional, infonomic-typography, components;
|
|
2
2
|
|
|
3
3
|
@layer infonomic-components {
|
|
4
4
|
:is(.stop-button-krMTsl, .play-button-GfHYHO, .directional-button-kGS8rA, .infonomic-stop-button, .infonomic-play-button, .infonomic-directional-button) {
|
|
@@ -107,3 +107,5 @@
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
@layer overrides, infonomic-utilities, utilities;
|
|
111
|
+
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
@layer
|
|
2
|
-
infonomic-
|
|
3
|
-
|
|
1
|
+
@layer base,
|
|
2
|
+
infonomic-base,
|
|
3
|
+
theme,
|
|
4
4
|
infonomic-theme,
|
|
5
|
+
infonomic-functional,
|
|
5
6
|
infonomic-typography,
|
|
6
|
-
|
|
7
|
+
components,
|
|
8
|
+
infonomic-components,
|
|
9
|
+
overrides,
|
|
10
|
+
infonomic-utilities,
|
|
11
|
+
utilities;
|
|
7
12
|
|
|
8
13
|
@layer infonomic-components {
|
|
9
14
|
.copy-button-container,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@layer
|
|
1
|
+
@layer base, infonomic-base, theme, infonomic-theme, infonomic-functional, infonomic-typography, components;
|
|
2
2
|
|
|
3
3
|
@layer infonomic-components {
|
|
4
4
|
:is(.copy-button-container-vCNz8o, .infonomic-copy-button-container) {
|
|
@@ -47,3 +47,5 @@
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
@layer overrides, infonomic-utilities, utilities;
|
|
51
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './button';
|
|
2
|
-
export * from './button-group';
|
|
3
|
-
export * from './control-buttons';
|
|
4
|
-
export * from './copy-button';
|
|
5
|
-
export * from './icon-button';
|
|
1
|
+
export * from './button.js';
|
|
2
|
+
export * from './button-group.js';
|
|
3
|
+
export * from './control-buttons.js';
|
|
4
|
+
export * from './copy-button.js';
|
|
5
|
+
export * from './icon-button.js';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
@layer
|
|
2
|
-
infonomic-
|
|
3
|
-
|
|
1
|
+
@layer base,
|
|
2
|
+
infonomic-base,
|
|
3
|
+
theme,
|
|
4
4
|
infonomic-theme,
|
|
5
|
+
infonomic-functional,
|
|
5
6
|
infonomic-typography,
|
|
6
|
-
|
|
7
|
+
components,
|
|
8
|
+
infonomic-components,
|
|
9
|
+
overrides,
|
|
10
|
+
infonomic-utilities,
|
|
11
|
+
utilities;
|
|
7
12
|
|
|
8
13
|
@layer infonomic-components {
|
|
9
14
|
.card,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@layer
|
|
1
|
+
@layer base, infonomic-base, theme, infonomic-theme, infonomic-functional, infonomic-typography, components;
|
|
2
2
|
|
|
3
3
|
@layer infonomic-components {
|
|
4
4
|
:is(.card-mqJaiW, .infonomic-card) {
|
|
@@ -60,3 +60,5 @@
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
@layer overrides, infonomic-utilities, utilities;
|
|
64
|
+
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
@layer
|
|
2
|
-
infonomic-
|
|
3
|
-
|
|
1
|
+
@layer base,
|
|
2
|
+
infonomic-base,
|
|
3
|
+
theme,
|
|
4
4
|
infonomic-theme,
|
|
5
|
+
infonomic-functional,
|
|
5
6
|
infonomic-typography,
|
|
6
|
-
|
|
7
|
+
components,
|
|
8
|
+
infonomic-components,
|
|
9
|
+
overrides,
|
|
10
|
+
infonomic-utilities,
|
|
11
|
+
utilities;
|
|
7
12
|
|
|
8
13
|
@layer infonomic-components {
|
|
9
14
|
.chip,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@layer
|
|
1
|
+
@layer base, infonomic-base, theme, infonomic-theme, infonomic-functional, infonomic-typography, components;
|
|
2
2
|
|
|
3
3
|
@layer infonomic-components {
|
|
4
4
|
:is(.chip-AhhT7N, .infonomic-chip) {
|
|
@@ -313,3 +313,5 @@
|
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
|
|
316
|
+
@layer overrides, infonomic-utilities, utilities;
|
|
317
|
+
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
@layer
|
|
2
|
-
infonomic-
|
|
3
|
-
|
|
1
|
+
@layer base,
|
|
2
|
+
infonomic-base,
|
|
3
|
+
theme,
|
|
4
4
|
infonomic-theme,
|
|
5
|
+
infonomic-functional,
|
|
5
6
|
infonomic-typography,
|
|
6
|
-
|
|
7
|
+
components,
|
|
8
|
+
infonomic-components,
|
|
9
|
+
overrides,
|
|
10
|
+
infonomic-utilities,
|
|
11
|
+
utilities;
|
|
7
12
|
|
|
8
13
|
@layer infonomic-components {
|
|
9
14
|
.container,
|