@infonomic/uikit 2.15.0 → 3.1.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 +48 -6
- package/dist/components/badge/badge_module.css +49 -80
- package/dist/components/button/button_module.css +133 -227
- package/dist/components/button/control-buttons_module.css +2 -11
- package/dist/components/button/copy-button.d.ts.map +1 -1
- package/dist/components/button/copy-button.js +14 -7
- package/dist/components/button/copy-button.module.js +5 -5
- package/dist/components/button/copy-button_module.css +31 -12
- package/dist/components/dropdown/dropdown_module.css +8 -13
- package/dist/components/input/checkbox_module.css +42 -91
- package/dist/components/input/help-text_module.css +1 -5
- package/dist/components/input/input_module.css +42 -109
- package/dist/components/input/radio-group_module.css +14 -49
- package/dist/components/input/select_module.css +10 -17
- package/dist/components/notifications/alert_module.css +0 -4
- package/dist/components/pager/pagination_module.css +7 -18
- package/dist/components/scroll-area/scroll-area_module.css +4 -20
- package/dist/components/tooltip/tooltip_module.css +4 -14
- package/dist/icons/close-icon.js +1 -1
- package/dist/icons/copy-icon.d.ts.map +1 -1
- package/dist/icons/copy-icon.js +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +1 -1
- package/dist/styles/styles.css +1 -1
- package/dist/widgets/datepicker/datepicker_module.css +2 -2
- package/dist/widgets/drawer/drawer_module.css +1 -5
- package/dist/widgets/modal/modal_module.css +1 -5
- package/dist/widgets/timeline/timeline.d.ts.map +1 -0
- package/dist/widgets/timeline/timeline.module.js +17 -0
- package/dist/{components → widgets}/timeline/timeline_module.css +10 -10
- package/package.json +8 -8
- package/src/components/badge/badge.module.css +38 -68
- package/src/components/button/button-intents.stories.tsx +1 -1
- package/src/components/button/button-overrides.stories.tsx +43 -0
- package/src/components/button/button-variants.stories.tsx +1 -1
- package/src/components/button/button.module.css +135 -230
- package/src/components/button/control-buttons.module.css +5 -17
- package/src/components/button/control-buttons.stories.tsx +1 -1
- package/src/components/button/copy-button.module.css +32 -14
- package/src/components/button/copy-button.stories.tsx +6 -6
- package/src/components/button/copy-button.tsx +16 -12
- package/src/components/calendar/calendar.stories.tsx +1 -1
- package/src/components/dropdown/dropdown.module.css +9 -24
- package/src/components/input/checkbox.module.css +43 -99
- package/src/components/input/help-text.module.css +1 -12
- package/src/components/input/input.module.css +44 -119
- package/src/components/input/input.stories.tsx +1 -1
- package/src/components/input/radio-group.module.css +16 -72
- package/src/components/input/radio-group.stories.tsx +1 -1
- package/src/components/input/select.module.css +10 -17
- package/src/components/input/select.stories.tsx +1 -1
- package/src/components/notifications/alert.module.css +0 -4
- package/src/components/pager/pagination.module.css +7 -23
- package/src/components/scroll-area/scroll-area.module.css +4 -20
- package/src/components/tooltip/tooltip.module.css +6 -16
- package/src/icons/close-icon.tsx +1 -1
- package/src/icons/copy-icon.tsx +1 -2
- package/src/icons/icons.module.css +1 -0
- package/src/react.ts +1 -1
- package/src/styles/theme/theme.css +6 -4
- package/src/styles/theme/tokens.css +670 -0
- package/src/widgets/datepicker/datepicker.module.css +2 -2
- package/src/widgets/drawer/drawer.module.css +1 -5
- package/src/widgets/drawer/drawer.stories.tsx +1 -34
- package/src/widgets/modal/modal.module.css +1 -5
- package/src/{components → widgets}/timeline/timeline.stories.tsx +2 -2
- package/dist/components/timeline/timeline.d.ts.map +0 -1
- package/dist/components/timeline/timeline.module.js +0 -17
- /package/dist/{components → widgets}/timeline/timeline.d.ts +0 -0
- /package/dist/{components → widgets}/timeline/timeline.js +0 -0
- /package/src/components/button/{button-icon.stories.tsx → icon-button.stories.tsx} +0 -0
- /package/src/{components → widgets}/timeline/timeline.module.css +0 -0
- /package/src/{components → widgets}/timeline/timeline.tsx +0 -0
package/README.md
CHANGED
|
@@ -1,22 +1,37 @@
|
|
|
1
|
-
# UI Kit
|
|
1
|
+
# Infonomic UI Kit
|
|
2
2
|
|
|
3
|
-
A UI kit
|
|
3
|
+
A UI kit that relies on CSS Modules for component styling, while playing nicely with all front-end frameworks that use CSS or [Tailwind CSS](https://tailwindcss.com/).
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
7
|
-
We created this
|
|
7
|
+
We created this project because while we appreciate Tailwind CSS for front-end development of PoC and smaller applications, we don't feel it belongs in a component library. Tailwind CSS as a ['programmatic' atomic CSS system](https://css-tricks.com/lets-define-exactly-atomic-css/#aa-programmatic) - is brilliant at what it does in preventing CSS rot and gradual CSS bloat - as well as making it clear how a layout or front-end component has been styled. It's also the ultimate expression of what [Thierry Koblentz](https://www.smashingmagazine.com/author/thierry-koblentz/) was talking about in his 2103 article, [Challenging CSS Best Practices](https://www.smashingmagazine.com/2013/10/challenging-css-best-practices-atomic-approach/).
|
|
8
8
|
|
|
9
9
|
It just doesn't belong in UI kits and libraries.
|
|
10
10
|
|
|
11
11
|
## Design Goals
|
|
12
12
|
|
|
13
|
+
TODO: Rationale behind adopting and 'folding in' best-in-class components, like the ones in well-known 'à la carte' component libraries such as [Base UI](https://base-ui.com/), [Radix](https://www.radix-ui.com/), and others.
|
|
14
|
+
|
|
13
15
|
We built this with the following goals in mind:
|
|
14
16
|
|
|
15
|
-
1. We'd like a structure and style system that will work with any framework -[React](https://react.dev/), [Vue.js](https://vuejs.org/), [Solid](https://www.solidjs.com/), [Svelte](https://svelte.dev/) etc.
|
|
17
|
+
1. We'd like a structure and style system that will work with any component framework - [Astro](https://astro.build/), [React](https://react.dev/), [Vue.js](https://vuejs.org/), [Solid](https://www.solidjs.com/), [Svelte](https://svelte.dev/) etc.
|
|
16
18
|
2. We'd like to be able to easily target various front-end meta frameworks, from [Astro](https://astro.build/), to [Next.js](https://nextjs.org/) to [React Router v7](https://reactrouter.com/) (formerly Remix) - and even plain old HTML/CSS.
|
|
17
|
-
3. We'd like a good developer experience (DX), allowing us to develop our components in the 'kit' via tests and Storybook, as well as in a monorepo
|
|
19
|
+
3. We'd like a good developer experience (DX), allowing us to develop our components in the 'kit' via tests and Storybook, as well as in a monorepo with the example front-end meta-frameworks.
|
|
20
|
+
|
|
18
21
|
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.
|
|
19
22
|
|
|
23
|
+
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.
|
|
24
|
+
|
|
25
|
+
### Other key points:
|
|
26
|
+
|
|
27
|
+
We use CSS Cascade layers via the @layer statement at-rule for named layers. This allows all of our CSS to be easily overwritten by any consuming client application - since CSS outside any layer, automatically has a higher specificity than CSS within a layer. We also carefully order our layers to create our own specificity hierarchy - for example - @layer infonomic-base, infonomic-utilities, infonomic-theme, infonomic-typography, infonomic-components;
|
|
28
|
+
|
|
29
|
+
For component CSS modules - this means ensuring that the layer specificity order appears at the top of each CSS module. It acts as sort of a 'preamble' - and it means that the component's bundled CSS will behave correctly when used within the overall UI kit.
|
|
30
|
+
|
|
31
|
+
The use of CSS modules will also allow us to support exporting individual components separately, to help reduce the import and bundle size of the consuming client. A client would import the main style.css file, and then only the individual components needed.
|
|
32
|
+
|
|
33
|
+
Lastly - we highly value the option to 'tell' components to ignore or override a top-level theme decision of light or dark. There is an intentionally duplicated `.not-dark` class selector in our tokens.css file. Since we're using shadows to create ring offsets (which we desire for focus, active modes etc.) and since CSS shadows need a background color - being able to use `.not-dark` means that we can override components that need to be in 'dark mode' on an otherwise 'light theme', or that need to be in .not-dark mode, on an otherwise 'dark theme'. This allows us to use the correct ring, background and component colors for components that might be placed on fixed dark or light background panels or sections - irrespective of the currently selected theme
|
|
34
|
+
|
|
20
35
|
## Getting Started
|
|
21
36
|
|
|
22
37
|
Install packages
|
|
@@ -27,7 +42,34 @@ or...
|
|
|
27
42
|
|
|
28
43
|
`pnpm add @infonomic/uikit`
|
|
29
44
|
|
|
30
|
-
And then in your application...
|
|
45
|
+
And then in your application in a global.css or other root css file...
|
|
46
|
+
|
|
47
|
+
```css
|
|
48
|
+
/**
|
|
49
|
+
* Core uikit styles including var system for breakpoints,
|
|
50
|
+
* colors, scales, utils etc., which can be optionally
|
|
51
|
+
* integrated with Tailwind (colors, breakpoints etc.) via
|
|
52
|
+
* Tailwind theme configuration.
|
|
53
|
+
*/
|
|
54
|
+
@import '@infonomic/uikit/styles.css';
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Optional uikit typography including prose and fonts
|
|
58
|
+
*/
|
|
59
|
+
@import '@infonomic/uikit/typography.css';
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Tailwind (optional) - should come after the above.
|
|
63
|
+
*/
|
|
64
|
+
@import './tailwind.css';
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Application styles
|
|
68
|
+
*/
|
|
69
|
+
@import './app.css';
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Followed by the below in any of your components or routes that want to import a component...
|
|
31
73
|
|
|
32
74
|
```ts
|
|
33
75
|
import { Button, Card, Container, Section } from '@infonomic/uikit/react
|
|
@@ -1,82 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
background-color: var(--primary-400);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.dark .secondary-VsqJTm:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
|
|
54
|
-
color: #000;
|
|
55
|
-
background-color: var(--secondary-400);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.dark .noeffect-R8eJtO:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
|
|
59
|
-
color: #fff;
|
|
60
|
-
background-color: var(--gray-700);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.dark .success-h2otET:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
|
|
64
|
-
color: #fff;
|
|
65
|
-
background-color: var(--green-400);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.dark .info-OG3F3u:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
|
|
69
|
-
color: #fff;
|
|
70
|
-
background-color: var(--blue-400);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.dark .warning-zTXksZ:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
|
|
74
|
-
color: #000;
|
|
75
|
-
background-color: var(--yellow-400);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.dark .danger-hKF7l_:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
|
|
79
|
-
color: #fff;
|
|
80
|
-
background-color: var(--red-400);
|
|
1
|
+
@layer infonomic-base, infonomic-utilities, infonomic-theme, infonomic-typography;
|
|
2
|
+
|
|
3
|
+
@layer infonomic-components {
|
|
4
|
+
.badge-8xVidp {
|
|
5
|
+
font-size: var(--font-size-sm);
|
|
6
|
+
text-align: center;
|
|
7
|
+
white-space: nowrap;
|
|
8
|
+
vertical-align: baseline;
|
|
9
|
+
border-radius: var(--border-radius-sm);
|
|
10
|
+
padding: .25em .4em;
|
|
11
|
+
font-weight: 400;
|
|
12
|
+
line-height: 1;
|
|
13
|
+
display: inline-block;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.primary-oZyR_M {
|
|
17
|
+
color: var(--text-on-primary);
|
|
18
|
+
background-color: var(--fill-primary-strong);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.secondary-VsqJTm {
|
|
22
|
+
color: var(--text-on-secondary);
|
|
23
|
+
background-color: var(--fill-secondary-strong);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.noeffect-R8eJtO {
|
|
27
|
+
color: var(--text-on-noeffect);
|
|
28
|
+
background-color: var(--fill-noeffect-strong);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.success-h2otET {
|
|
32
|
+
color: var(--text-on-success);
|
|
33
|
+
background-color: var(--fill-success-strong);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.info-OG3F3u {
|
|
37
|
+
color: var(--text-on-info);
|
|
38
|
+
background-color: var(--fill-info-strong);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.warning-zTXksZ {
|
|
42
|
+
color: var(--text-on-warning);
|
|
43
|
+
background-color: var(--fill-warning-strong);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.danger-hKF7l_ {
|
|
47
|
+
color: var(--text-on-danger);
|
|
48
|
+
background-color: var(--fill-danger-strong);
|
|
49
|
+
}
|
|
81
50
|
}
|
|
82
51
|
|