@infonomic/uikit 2.0.0 → 2.1.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.
- package/dist/components/button/index.js +1 -17
- package/dist/components/card/card.d.ts.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +35 -31
- package/src/astro.d.ts +43 -0
- package/src/astro.js +2 -2
- package/src/components/@types/shared.ts +24 -0
- package/src/components/accordion/accordion.module.css +60 -0
- package/src/components/accordion/accordion.stories.tsx +117 -0
- package/src/components/accordion/accordion.tsx +105 -0
- package/src/components/animation/fade-in-lift.stories.tsx +81 -0
- package/src/components/animation/fade-in-lift.tsx +42 -0
- package/src/components/avatar/avatar.module.css +54 -0
- package/src/components/avatar/avatar.stories.tsx +28 -0
- package/src/components/avatar/avatar.tsx +19 -0
- package/src/components/button/@types/button.ts +17 -0
- package/src/components/button/button-group.module.css +17 -0
- package/src/components/button/button-group.stories.tsx +45 -0
- package/src/components/button/button-group.tsx +132 -0
- package/src/components/button/button-icon.stories.tsx +145 -0
- package/src/components/button/button-intents.stories.tsx +50 -0
- package/src/components/button/button-variants.stories.tsx +60 -0
- package/src/components/button/button.astro +86 -0
- package/src/components/button/button.module.css +533 -0
- package/src/components/button/button.tsx +81 -0
- package/src/components/button/control-buttons.module.css +144 -0
- package/src/components/button/control-buttons.stories.tsx +60 -0
- package/src/components/button/control-buttons.tsx +137 -0
- package/src/components/button/copy-button.module.css +31 -0
- package/src/components/button/copy-button.stories.tsx +50 -0
- package/src/components/button/copy-button.tsx +92 -0
- package/src/components/button/icon-button.astro +47 -0
- package/src/components/button/icon-button.tsx +44 -0
- package/src/components/button/index.ts +5 -0
- package/src/components/calendar/calendar.module.css +315 -0
- package/src/components/calendar/calendar.stories.tsx +139 -0
- package/src/components/calendar/calendar.tsx +173 -0
- package/src/components/card/card-content.astro +14 -0
- package/src/components/card/card-description.astro +14 -0
- package/src/components/card/card-footer.astro +14 -0
- package/src/components/card/card-header.astro +14 -0
- package/src/components/card/card-title.astro +14 -0
- package/src/components/card/card.astro +41 -0
- package/src/components/card/card.module.css +67 -0
- package/src/components/card/card.stories.tsx +61 -0
- package/src/components/card/card.tsx +86 -0
- package/src/components/container/container.astro +13 -0
- package/src/components/container/container.module.css +28 -0
- package/src/components/container/container.stories.tsx +42 -0
- package/src/components/container/container.tsx +23 -0
- package/src/components/dropdown/dropdown.module.css +131 -0
- package/src/components/dropdown/dropdown.stories.tsx +103 -0
- package/src/components/dropdown/dropdown.tsx +193 -0
- package/src/components/hamburger/hamburger.astro +30 -0
- package/src/components/hamburger/hamburger.tsx +66 -0
- package/src/components/input/@types/checkbox.ts +20 -0
- package/src/components/input/@types/input.ts +20 -0
- package/src/components/input/checkbox-group.tsx +78 -0
- package/src/components/input/checkbox.module.css +267 -0
- package/src/components/input/checkbox.stories.tsx +240 -0
- package/src/components/input/checkbox.tsx +95 -0
- package/src/components/input/error-text.astro +14 -0
- package/src/components/input/error-text.module.css +19 -0
- package/src/components/input/error-text.tsx +18 -0
- package/src/components/input/errors.tsx +37 -0
- package/src/components/input/help-text.astro +13 -0
- package/src/components/input/help-text.module.css +19 -0
- package/src/components/input/help-text.tsx +13 -0
- package/src/components/input/index.tsx +8 -0
- package/src/components/input/input-adornment.astro +26 -0
- package/src/components/input/input-adornment.module.css +18 -0
- package/src/components/input/input-adornment.tsx +36 -0
- package/src/components/input/input.astro +99 -0
- package/src/components/input/input.module.css +310 -0
- package/src/components/input/input.stories.tsx +174 -0
- package/src/components/input/input.tsx +103 -0
- package/src/components/input/label.astro +24 -0
- package/src/components/input/label.module.css +28 -0
- package/src/components/input/label.tsx +25 -0
- package/src/components/input/radio-group.module.css +219 -0
- package/src/components/input/radio-group.stories.tsx +73 -0
- package/src/components/input/radio-group.tsx +67 -0
- package/src/components/input/select.module.css +75 -0
- package/src/components/input/select.stories.tsx +34 -0
- package/src/components/input/select.tsx +115 -0
- package/src/components/input/text-area.module.css +9 -0
- package/src/components/input/text-area.stories.tsx +51 -0
- package/src/components/input/text-area.tsx +81 -0
- package/src/components/input/utils.ts +21 -0
- package/src/components/notifications/@types/alert.ts +12 -0
- package/src/components/notifications/@types/toast.ts +12 -0
- package/src/components/notifications/alert.module.css +114 -0
- package/src/components/notifications/alert.stories.tsx +39 -0
- package/src/components/notifications/alert.tsx +117 -0
- package/src/components/notifications/index.ts +2 -0
- package/src/components/notifications/toast.module.css +237 -0
- package/src/components/notifications/toast.stories.tsx +42 -0
- package/src/components/notifications/toast.tsx +124 -0
- package/src/components/overlay/index.stories.tsx +29 -0
- package/src/components/overlay/index.ts +2 -0
- package/src/components/overlay/overlay.module.css +41 -0
- package/src/components/overlay/overlay.tsx +61 -0
- package/src/components/pager/@types/index.ts +2 -0
- package/src/components/pager/ellipses.tsx +18 -0
- package/src/components/pager/event-pager.tsx +18 -0
- package/src/components/pager/first-button.tsx +53 -0
- package/src/components/pager/hooks/types/usePagination.ts +80 -0
- package/src/components/pager/hooks/usePagination.ts +140 -0
- package/src/components/pager/icons/first.tsx +33 -0
- package/src/components/pager/icons/index.tsx +4 -0
- package/src/components/pager/icons/last.tsx +33 -0
- package/src/components/pager/icons/next.tsx +20 -0
- package/src/components/pager/icons/previous.tsx +20 -0
- package/src/components/pager/index.ts +4 -0
- package/src/components/pager/last-button.tsx +57 -0
- package/src/components/pager/next-button.tsx +55 -0
- package/src/components/pager/number-button.tsx +83 -0
- package/src/components/pager/pagination.module.css +165 -0
- package/src/components/pager/pagination.stories.tsx +190 -0
- package/src/components/pager/pagination.tsx +266 -0
- package/src/components/pager/previous-button.tsx +51 -0
- package/src/components/scroll-area/scroll-area.module.css +80 -0
- package/src/components/scroll-area/scroll-area.stories.tsx +33 -0
- package/src/components/scroll-area/scroll-area.tsx +22 -0
- package/src/components/scroll-to-top/scroll-to-top.tsx +59 -0
- package/src/components/section/section.astro +13 -0
- package/src/components/section/section.module.css +7 -0
- package/src/components/section/section.tsx +23 -0
- package/src/components/shimmer/shimmer.module.css +53 -0
- package/src/components/shimmer/shimmer.stories.tsx +24 -0
- package/src/components/shimmer/shimmer.tsx +70 -0
- package/src/components/table/table.module.css +100 -0
- package/src/components/table/table.stories.tsx +95 -0
- package/src/components/table/table.tsx +165 -0
- package/src/components/tabs/tabs.module.css +64 -0
- package/src/components/tabs/tabs.stories.tsx +47 -0
- package/src/components/tabs/tabs.tsx +75 -0
- package/src/components/timeline/timeline.module.css +87 -0
- package/src/components/timeline/timeline.stories.tsx +50 -0
- package/src/components/timeline/timeline.tsx +177 -0
- package/src/components/tooltip/tooltip.module.css +55 -0
- package/src/components/tooltip/tooltip.stories.tsx +59 -0
- package/src/components/tooltip/tooltip.tsx +51 -0
- package/src/declarations.d.ts +4 -0
- package/src/hooks/use-media-query.ts +20 -0
- package/src/icons/activity-icon.tsx +40 -0
- package/src/icons/calendar-icon.tsx +39 -0
- package/src/icons/check-icon.tsx +33 -0
- package/src/icons/chevron-down-icon.tsx +39 -0
- package/src/icons/chevron-left-double-icon.tsx +58 -0
- package/src/icons/chevron-left-icon.tsx +58 -0
- package/src/icons/chevron-right-double-icon.tsx +58 -0
- package/src/icons/chevron-right-icon.tsx +58 -0
- package/src/icons/chevrons-up-down.tsx +37 -0
- package/src/icons/close-icon.astro +38 -0
- package/src/icons/close-icon.tsx +30 -0
- package/src/icons/copy-icon.tsx +35 -0
- package/src/icons/danger-icon.tsx +18 -0
- package/src/icons/dashboard-icon.tsx +41 -0
- package/src/icons/delete-icon.tsx +34 -0
- package/src/icons/document-icon.tsx +38 -0
- package/src/icons/download-icon.tsx +39 -0
- package/src/icons/edit-icon.tsx +35 -0
- package/src/icons/ellipsis-icon.tsx +38 -0
- package/src/icons/email-icon.tsx +33 -0
- package/src/icons/external-link-icon.tsx +39 -0
- package/src/icons/github-icon.tsx +27 -0
- package/src/icons/globe-icon.tsx +50 -0
- package/src/icons/google-icon.tsx +44 -0
- package/src/icons/gripper-vertical-icon.tsx +43 -0
- package/src/icons/history-icon.tsx +32 -0
- package/src/icons/home-icon.tsx +34 -0
- package/src/icons/icon-element.astro +27 -0
- package/src/icons/icon-element.tsx +32 -0
- package/src/icons/icon-sprite.tsx +18 -0
- package/src/icons/icons.module.css +147 -0
- package/src/icons/index.stories.tsx +25 -0
- package/src/icons/index.ts +39 -0
- package/src/icons/info-icon.tsx +18 -0
- package/src/icons/infonomic-icon.tsx +173 -0
- package/src/icons/light-icon.astro +36 -0
- package/src/icons/light-icon.tsx +29 -0
- package/src/icons/location-pin-icon.tsx +36 -0
- package/src/icons/moon-icon.astro +38 -0
- package/src/icons/moon-icon.tsx +42 -0
- package/src/icons/plus-icon.tsx +34 -0
- package/src/icons/primary-icon.tsx +22 -0
- package/src/icons/refresh-icon.tsx +33 -0
- package/src/icons/return-icon.tsx +36 -0
- package/src/icons/roles-icon.tsx +34 -0
- package/src/icons/search-icon.astro +40 -0
- package/src/icons/search-icon.tsx +29 -0
- package/src/icons/search-menu-icon.tsx +42 -0
- package/src/icons/settings-gear-icon.tsx +36 -0
- package/src/icons/settings-sliders-icon.tsx +43 -0
- package/src/icons/sign-out-icon.tsx +35 -0
- package/src/icons/source/icon-calendar.svg +1 -0
- package/src/icons/source/icon-check.svg +4 -0
- package/src/icons/source/icon-close.svg +3 -0
- package/src/icons/source/icon-coinbase.svg +9 -0
- package/src/icons/source/icon-copy.svg +4 -0
- package/src/icons/source/icon-document.svg +5 -0
- package/src/icons/source/icon-download.svg +4 -0
- package/src/icons/source/icon-edit.svg +6 -0
- package/src/icons/source/icon-eth-purple.svg +15 -0
- package/src/icons/source/icon-etherscan.svg +5 -0
- package/src/icons/source/icon-external-link.svg +4 -0
- package/src/icons/source/icon-globe.svg +7 -0
- package/src/icons/source/icon-gripper-vertical.svg +9 -0
- package/src/icons/source/icon-info.svg +4 -0
- package/src/icons/source/icon-infonomic.svg +43 -0
- package/src/icons/source/icon-ledger.svg +4 -0
- package/src/icons/source/icon-light.svg +3 -0
- package/src/icons/source/icon-location-pin.svg +8 -0
- package/src/icons/source/icon-logout.svg +6 -0
- package/src/icons/source/icon-metamask.svg +32 -0
- package/src/icons/source/icon-moon.svg +3 -0
- package/src/icons/source/icon-plus.svg +4 -0
- package/src/icons/source/icon-refresh.svg +4 -0
- package/src/icons/source/icon-return.svg +4 -0
- package/src/icons/source/icon-search-menu.svg +13 -0
- package/src/icons/source/icon-search.svg +3 -0
- package/src/icons/source/icon-settings-gear.svg +5 -0
- package/src/icons/source/icon-settings.svg +12 -0
- package/src/icons/source/icon-wallet.svg +3 -0
- package/src/icons/source/icon-walletconnect.svg +4 -0
- package/src/icons/source/icon-x.svg +4 -0
- package/src/icons/stopwatch-icon.tsx +39 -0
- package/src/icons/success-icon.tsx +18 -0
- package/src/icons/types/icon.ts +8 -0
- package/src/icons/user-icon.tsx +33 -0
- package/src/icons/users-icon.tsx +35 -0
- package/src/icons/wallet-icon.tsx +29 -0
- package/src/icons/warning-icon.tsx +18 -0
- package/src/icons/x-icon.tsx +33 -0
- package/src/loaders/ellipses.tsx +36 -0
- package/src/loaders/loaders.stories.tsx +46 -0
- package/src/loaders/ring.tsx +33 -0
- package/src/loaders/spinner.tsx +28 -0
- package/src/loaders/types/index.ts +6 -0
- package/src/react.ts +99 -0
- package/src/styles/base/animations.css +143 -0
- package/src/styles/base/base.css +5 -0
- package/src/styles/base/colors.css +163 -0
- package/src/styles/base/colors.stories.tsx +671 -0
- package/src/styles/base/reset.css +464 -0
- package/src/styles/base/typography.css +25 -0
- package/src/styles/base/vars.css +188 -0
- package/src/styles/components/card.css +20 -0
- package/src/styles/components/checkbox.css +55 -0
- package/src/styles/components/components.css +11 -0
- package/src/styles/components/directional-button.css +92 -0
- package/src/styles/components/dropdown.css +19 -0
- package/src/styles/components/fade-in-lift.css +13 -0
- package/src/styles/components/hamburger.css +107 -0
- package/src/styles/components/icon-element.css +4 -0
- package/src/styles/components/list-checkbox.css +60 -0
- package/src/styles/components/loaders.css +196 -0
- package/src/styles/components/popover.css +15 -0
- package/src/styles/components/scroll-to-top.css +89 -0
- package/src/styles/components/toast.css +18 -0
- package/src/styles/styles.css +6 -0
- package/src/styles/theme/autofill.css +58 -0
- package/src/styles/theme/scrollers.css +52 -0
- package/src/styles/theme/theme.css +130 -0
- package/src/styles/theme/theme.stories.tsx +33 -0
- package/src/styles/typography/code.stories.tsx +76 -0
- package/src/styles/typography/default.stories.tsx +51 -0
- package/src/styles/typography/fonts.css +30 -0
- package/src/styles/typography/lists.stories.tsx +50 -0
- package/src/styles/typography/prose.css +404 -0
- package/src/styles/typography/quote.stories.tsx +37 -0
- package/src/styles/typography.css +24 -0
- package/src/styles/utils/scroll-layout-shift.css +9 -0
- package/src/styles/utils/utility-classes.css +1278 -0
- package/src/styles/utils/utils.css +2 -0
- package/src/theme/theme-provider/index.ts +1 -0
- package/src/theme/theme-provider/provider.tsx +44 -0
- package/src/utils/capitalize.ts +6 -0
- package/src/utils/externalLinkProps.ts +6 -0
- package/src/utils/findMatch.ts +7 -0
- package/src/utils/getPortalRoot.ts +3 -0
- package/src/utils/isTouchDevice.ts +11 -0
- package/src/utils/objectsToArray.ts +15 -0
- package/src/utils/objectsToString.ts +5 -0
- package/src/utils/polymorphic.ts +16 -0
- package/src/utils/to-kebab-case.ts +5 -0
- package/src/widgets/datepicker/datepicker.module.css +189 -0
- package/src/widgets/datepicker/datepicker.stories.tsx +25 -0
- package/src/widgets/datepicker/datepicker.tsx +310 -0
- package/src/widgets/drawer/drawer-container.tsx +26 -0
- package/src/widgets/drawer/drawer-content.tsx +26 -0
- package/src/widgets/drawer/drawer-context.tsx +49 -0
- package/src/widgets/drawer/drawer-header.tsx +27 -0
- package/src/widgets/drawer/drawer-top-actions.tsx +27 -0
- package/src/widgets/drawer/drawer-wrapper.tsx +54 -0
- package/src/widgets/drawer/drawer.module.css +116 -0
- package/src/widgets/drawer/drawer.stories.tsx +224 -0
- package/src/widgets/drawer/drawer.tsx +115 -0
- package/src/widgets/drawer/motionDomAnimation.ts +4 -0
- package/src/widgets/drawer/motionDomMax.ts +4 -0
- package/src/widgets/modal/modal-actions.tsx +26 -0
- package/src/widgets/modal/modal-container.tsx +26 -0
- package/src/widgets/modal/modal-content.tsx +26 -0
- package/src/widgets/modal/modal-header.tsx +27 -0
- package/src/widgets/modal/modal-wrapper.tsx +50 -0
- package/src/widgets/modal/modal.module.css +85 -0
- package/src/widgets/modal/modal.stories.tsx +71 -0
- package/src/widgets/modal/modal.tsx +110 -0
- package/src/widgets/modal/motionDomAnimation.ts +4 -0
- package/src/widgets/modal/motionDomMax.ts +4 -0
- package/src/widgets/search/index.ts +1 -0
- package/src/widgets/search/search.stories.tsx +18 -0
- package/src/widgets/search/search.tsx +186 -0
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
@layer infonomic-base, infonomic-utilities, infonomic-theme, infonomic-typography, infonomic-components;
|
|
2
|
+
|
|
3
|
+
@layer infonomic-components {
|
|
4
|
+
.inputWrapper {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
gap: var(--gap-1);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.inputContainer {
|
|
11
|
+
position: relative;
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
gap: var(--gap-2);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.input {
|
|
18
|
+
border: none;
|
|
19
|
+
outline: none;
|
|
20
|
+
font-weight: normal;
|
|
21
|
+
display: inline-flex;
|
|
22
|
+
gap: var(--gap-2);
|
|
23
|
+
align-items: center;
|
|
24
|
+
width: 100%;
|
|
25
|
+
transition: all var(--transition-normal);
|
|
26
|
+
border-radius: var(--border-radius-sm);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.input:focus,
|
|
30
|
+
.input:active {
|
|
31
|
+
--ring-offset-color: var(--background);
|
|
32
|
+
--ring-offset-shadow: var(--ring-inset) 0 0 0 var(--ring-offset-width) var(--ring-offset-color);
|
|
33
|
+
--ring-shadow: var(--ring-inset) 0 0 0 calc(1px + var(--ring-offset-width)) var(--ring-color);
|
|
34
|
+
box-shadow: var(--ring-offset-shadow), var(--ring-shadow), var(--shadow, 0 0 #0000);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.input:disabled,
|
|
38
|
+
.input[disabled] {
|
|
39
|
+
pointer-events: none;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.label {
|
|
43
|
+
font-size: 0.875rem;
|
|
44
|
+
font-weight: 500;
|
|
45
|
+
color: var(--label-color);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* Sizes */
|
|
49
|
+
.sm {
|
|
50
|
+
min-height: 32px;
|
|
51
|
+
font-size: 0.875rem;
|
|
52
|
+
line-height: 0;
|
|
53
|
+
padding: 0.25rem 0.5rem;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.md {
|
|
57
|
+
min-height: 38px;
|
|
58
|
+
font-size: 1.1rem;
|
|
59
|
+
line-height: 0;
|
|
60
|
+
padding: 0.4rem 0.5rem;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.lg {
|
|
64
|
+
min-height: 46px;
|
|
65
|
+
font-size: 1.2rem;
|
|
66
|
+
line-height: 0;
|
|
67
|
+
padding: 0.5rem 0.5rem;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.startAdornment,
|
|
71
|
+
.endAdornment {
|
|
72
|
+
position: absolute;
|
|
73
|
+
display: flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.startAdornment {
|
|
78
|
+
left: 5px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.endAdornment {
|
|
82
|
+
right: 5px;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.helpText {
|
|
86
|
+
font-size: 0.75rem;
|
|
87
|
+
color: var(--help-text-color);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* Variants */
|
|
91
|
+
.outlined {
|
|
92
|
+
border: 1px solid var(--input-variant-outlined-border);
|
|
93
|
+
background-color: transparent;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.outlined:hover {
|
|
97
|
+
border: 1px solid var(--input-variant-outlined-hover-border);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.outlined:focus,
|
|
101
|
+
.outlined:active {
|
|
102
|
+
--ring-color: var(--input-variant-outline-ring-color);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.underlined {
|
|
106
|
+
border-bottom: 1px solid var(--input-variant-underlined-border);
|
|
107
|
+
border-radius: 0;
|
|
108
|
+
gap: var(--gap-1);
|
|
109
|
+
background-color: var(--input-variant-underlined);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* Sizes */
|
|
113
|
+
.underlined.sm {
|
|
114
|
+
padding: 0.25rem 0.1rem;
|
|
115
|
+
min-height: 26px
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.underlined.md {
|
|
119
|
+
padding: 0.25rem 0.1rem;
|
|
120
|
+
min-height: 30px;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.underlined.lg {
|
|
124
|
+
padding: 0 0.1rem;
|
|
125
|
+
min-height: 34px;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.underlined:hover {
|
|
129
|
+
border-bottom: 1px solid var(--input-variant-underlined-hover-border);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.filled {
|
|
133
|
+
background-color: var(--input-variant-filled);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
/* Error classes last, so that they override all
|
|
138
|
+
of the above */
|
|
139
|
+
.error {
|
|
140
|
+
border: 1px solid var(--red-400);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.error:hover {
|
|
144
|
+
border: 1px solid var(--red-400);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.error:focus,
|
|
148
|
+
.error:active {
|
|
149
|
+
--ring-color: var(--red-300);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.underlined.startAdornmentPadding,
|
|
153
|
+
.startAdornmentPadding {
|
|
154
|
+
padding-left: 2rem;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.underlined.endAdornmentPadding,
|
|
158
|
+
.endAdornmentPadding {
|
|
159
|
+
padding-right: 2rem;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.underlined.startAdornment {
|
|
163
|
+
left: 0;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.underlined.endAdornment {
|
|
167
|
+
right: 0;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/* Intents */
|
|
171
|
+
.primary {
|
|
172
|
+
--input-variant-outlined-border: var(--primary-300);
|
|
173
|
+
--input-variant-outlined-hover-border: var(--primary-500);
|
|
174
|
+
--input-variant-outline-ring-color: var(--primary-300);
|
|
175
|
+
--input-variant-underlined-border: var(--primary-300);
|
|
176
|
+
--input-variant-underlined-hover-border: var(--primary-500);
|
|
177
|
+
--input-variant-filled: var(--gray-50);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.secondary {
|
|
181
|
+
--input-variant-outlined-border: var(--secondary-600);
|
|
182
|
+
--input-variant-outlined-hover-border: var(--secondary-800);
|
|
183
|
+
--input-variant-outline-ring-color: var(--secondary-600);
|
|
184
|
+
--input-variant-underlined-border: var(--secondary-600);
|
|
185
|
+
--input-variant-underlined-hover-border: var(--secondary-800);
|
|
186
|
+
--input-variant-filled: var(--gray-50);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.noeffect {
|
|
190
|
+
--input-variant-outlined-border: var(--gray-500);
|
|
191
|
+
--input-variant-outlined-hover-border: var(--gray-700);
|
|
192
|
+
--input-variant-outline-ring-color: var(--gray-700);
|
|
193
|
+
--input-variant-underlined-border: var(--gray-500);
|
|
194
|
+
--input-variant-underlined-hover-border: var(--gray-700);
|
|
195
|
+
--input-variant-filled: var(--gray-50);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.success {
|
|
199
|
+
--input-variant-outlined-border: var(--green-300);
|
|
200
|
+
--input-variant-outlined-hover-border: var(--green-600);
|
|
201
|
+
--input-variant-outline-ring-color: var(--green-600);
|
|
202
|
+
--input-variant-underlined-border: var(--green-300);
|
|
203
|
+
--input-variant-underlined-hover-border: var(--green-600);
|
|
204
|
+
--input-variant-filled: var(--gray-50);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.info {
|
|
208
|
+
--input-variant-outlined-border: var(--blue-300);
|
|
209
|
+
--input-variant-outlined-hover-border: var(--blue-600);
|
|
210
|
+
--input-variant-outline-ring-color: var(--blue-300);
|
|
211
|
+
--input-variant-underlined-border: var(--blue-100);
|
|
212
|
+
--input-variant-underlined-hover-border: var(--blue-400);
|
|
213
|
+
--input-variant-filled: var(--gray-50);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.warning {
|
|
217
|
+
--input-variant-outlined-border: var(--yellow-600);
|
|
218
|
+
--input-variant-outlined-hover-border: var(--yellow-800);
|
|
219
|
+
--input-variant-outline-ring-color: var(--yellow-600);
|
|
220
|
+
--input-variant-underlined-border: var(--yellow-600);
|
|
221
|
+
--input-variant-underlined-hover-border: var(--yellow-800);
|
|
222
|
+
--input-variant-filled: var(--gray-50);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.danger {
|
|
226
|
+
--input-variant-outlined-border: var(--red-300);
|
|
227
|
+
--input-variant-outlined-hover-border: var(--red-600);
|
|
228
|
+
--input-variant-outline-ring-color: var(--red-600);
|
|
229
|
+
--input-variant-underlined-border: var(--red-300);
|
|
230
|
+
--input-variant-underlined-hover-border: var(--red-600);
|
|
231
|
+
--input-variant-filled: var(--gray-50);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/* 🌙 Dark via `.dark` class. We rely on the
|
|
235
|
+
* consuming application to detect a user's preferred
|
|
236
|
+
* color scheme - either by header or cookie, and set
|
|
237
|
+
* a root html class accordingly
|
|
238
|
+
*/
|
|
239
|
+
:global(.dark) {
|
|
240
|
+
|
|
241
|
+
.input:focus:not(:where([class~="not-dark"], [class~="not-dark"] *)),
|
|
242
|
+
.input:active:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
|
|
243
|
+
--ring-offset-color: var(--background);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/* Intents */
|
|
247
|
+
.primary:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
|
|
248
|
+
--input-variant-outlined-border: var(--primary-200);
|
|
249
|
+
--input-variant-outlined-hover-border: var(--primary-100);
|
|
250
|
+
--input-variant-outline-ring-color: var(--primary-200);
|
|
251
|
+
--input-variant-underlined-border: var(--primary-200);
|
|
252
|
+
--input-variant-underlined-hover-border: var(--primary-100);
|
|
253
|
+
--input-variant-filled: var(--canvas-800);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.secondary:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
|
|
257
|
+
--input-variant-outlined-border: var(--secondary-600);
|
|
258
|
+
--input-variant-outlined-hover-border: var(--secondary-400);
|
|
259
|
+
--input-variant-outline-ring-color: var(--secondary-600);
|
|
260
|
+
--input-variant-underlined-border: var(--secondary-600);
|
|
261
|
+
--input-variant-underlined-hover-border: var(--secondary-400);
|
|
262
|
+
--input-variant-filled: var(--canvas-800);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.noeffect:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
|
|
266
|
+
--input-variant-outlined-border: var(--gray-500);
|
|
267
|
+
--input-variant-outlined-hover-border: var(--gray-300);
|
|
268
|
+
--input-variant-outline-ring-color: var(--gray-400);
|
|
269
|
+
--input-variant-underlined-border: var(--gray-500);
|
|
270
|
+
--input-variant-underlined-hover-border: var(--gray-300);
|
|
271
|
+
--input-variant-filled: var(--canvas-800);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.success:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
|
|
275
|
+
--input-variant-outlined-border: var(--green-500);
|
|
276
|
+
--input-variant-outlined-hover-border: var(--green-300);
|
|
277
|
+
--input-variant-outline-ring-color: var(--green-400);
|
|
278
|
+
--input-variant-underlined-border: var(--green-500);
|
|
279
|
+
--input-variant-underlined-hover-border: var(--green-300);
|
|
280
|
+
--input-variant-filled: var(--canvas-800);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.info:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
|
|
284
|
+
--input-variant-outlined-border: var(--blue-500);
|
|
285
|
+
--input-variant-outlined-hover-border: var(--blue-300);
|
|
286
|
+
--input-variant-outline-ring-color: var(--blue-400);
|
|
287
|
+
--input-variant-underlined-border: var(--blue-500);
|
|
288
|
+
--input-variant-underlined-hover-border: var(--blue-300);
|
|
289
|
+
--input-variant-filled: var(--canvas-800);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.warning:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
|
|
293
|
+
--input-variant-outlined-border: var(--yellow-500);
|
|
294
|
+
--input-variant-outlined-hover-border: var(--yellow-300);
|
|
295
|
+
--input-variant-outline-ring-color: var(--yellow-400);
|
|
296
|
+
--input-variant-underlined-border: var(--yellow-500);
|
|
297
|
+
--input-variant-underlined-hover-border: var(--yellow-300);
|
|
298
|
+
--input-variant-filled: var(--canvas-800);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.danger:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
|
|
302
|
+
--input-variant-outlined-border: var(--red-500);
|
|
303
|
+
--input-variant-outlined-hover-border: var(--red-300);
|
|
304
|
+
--input-variant-outline-ring-color: var(--red-400);
|
|
305
|
+
--input-variant-underlined-border: var(--red-500);
|
|
306
|
+
--input-variant-underlined-hover-border: var(--red-500);
|
|
307
|
+
--input-variant-filled: var(--canvas-800);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import type React from 'react'
|
|
2
|
+
|
|
3
|
+
import { CloseIcon, SearchIcon } from '../../icons/index.js'
|
|
4
|
+
import { capitalize } from '../../utils/capitalize.js'
|
|
5
|
+
import { intent } from '../@types/shared.js'
|
|
6
|
+
import { IconButton } from '../button/icon-button.js'
|
|
7
|
+
import { size, variant } from './@types/input.js'
|
|
8
|
+
|
|
9
|
+
import { Input, InputAdornment } from './index.js'
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
title: 'Components/Input/TextInput',
|
|
13
|
+
component: Input,
|
|
14
|
+
argTypes: {},
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const Default = (): React.JSX.Element => {
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
<div style={{ marginBottom: '2rem' }}>
|
|
21
|
+
<div
|
|
22
|
+
style={{
|
|
23
|
+
maxWidth: '600px',
|
|
24
|
+
margin: '0 auto',
|
|
25
|
+
display: 'flex',
|
|
26
|
+
flexDirection: 'column',
|
|
27
|
+
gap: '1rem',
|
|
28
|
+
}}
|
|
29
|
+
>
|
|
30
|
+
<Input
|
|
31
|
+
variant="outlined"
|
|
32
|
+
intent="primary"
|
|
33
|
+
id="name"
|
|
34
|
+
name="name"
|
|
35
|
+
label="Name"
|
|
36
|
+
placeHolder="Name"
|
|
37
|
+
helpText="Please enter your name."
|
|
38
|
+
disabled={false}
|
|
39
|
+
error={false}
|
|
40
|
+
/>
|
|
41
|
+
<Input
|
|
42
|
+
variant="outlined"
|
|
43
|
+
intent="secondary"
|
|
44
|
+
required
|
|
45
|
+
id="foo"
|
|
46
|
+
name="foo"
|
|
47
|
+
label="Foo Required"
|
|
48
|
+
placeHolder="Foo"
|
|
49
|
+
helpText="Please enter your foo."
|
|
50
|
+
disabled={false}
|
|
51
|
+
error={false}
|
|
52
|
+
/>
|
|
53
|
+
<Input
|
|
54
|
+
variant="outlined"
|
|
55
|
+
intent="primary"
|
|
56
|
+
label="Start and End Adornments"
|
|
57
|
+
startAdornment={
|
|
58
|
+
<InputAdornment>
|
|
59
|
+
<IconButton role="button" intent="noeffect" variant="text" ripple={false} size="xs">
|
|
60
|
+
<SearchIcon width="20px" height="20px" />
|
|
61
|
+
</IconButton>
|
|
62
|
+
</InputAdornment>
|
|
63
|
+
}
|
|
64
|
+
endAdornment={
|
|
65
|
+
<InputAdornment>
|
|
66
|
+
<IconButton role="button" intent="noeffect" variant="text" size="xs">
|
|
67
|
+
<CloseIcon width="16px" height="16px" />
|
|
68
|
+
</IconButton>
|
|
69
|
+
</InputAdornment>
|
|
70
|
+
}
|
|
71
|
+
id="search"
|
|
72
|
+
name="search"
|
|
73
|
+
placeHolder="Search"
|
|
74
|
+
disabled={false}
|
|
75
|
+
error={false}
|
|
76
|
+
/>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
</>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export const Variants = (): React.JSX.Element => {
|
|
84
|
+
return (
|
|
85
|
+
<>
|
|
86
|
+
<div style={{ maxWidth: '1100px', margin: '0 auto' }}>
|
|
87
|
+
{variant.map((variant) => {
|
|
88
|
+
return (
|
|
89
|
+
<div
|
|
90
|
+
key={variant}
|
|
91
|
+
style={{ marginBottom: '2rem' }}
|
|
92
|
+
className="grid grid-cols-4 items-center gap-12"
|
|
93
|
+
>
|
|
94
|
+
{size.map((size) => {
|
|
95
|
+
return (
|
|
96
|
+
<Input
|
|
97
|
+
key={`${variant}=${size}`}
|
|
98
|
+
variant={variant}
|
|
99
|
+
inputSize={size}
|
|
100
|
+
id={`${variant}-${size}`}
|
|
101
|
+
name={`${variant}-${size}`}
|
|
102
|
+
label={`${capitalize(variant)} ${size.toUpperCase()}`}
|
|
103
|
+
placeHolder={`${capitalize(variant)} ${size.toUpperCase()}`}
|
|
104
|
+
helpText={`Please enter your ${variant} ${size.toUpperCase()}.`}
|
|
105
|
+
disabled={false}
|
|
106
|
+
error={false}
|
|
107
|
+
/>
|
|
108
|
+
)
|
|
109
|
+
})}
|
|
110
|
+
<Input
|
|
111
|
+
disabled={true}
|
|
112
|
+
key={`${variant}=${size}`}
|
|
113
|
+
variant={variant}
|
|
114
|
+
id={`${variant}-${size}`}
|
|
115
|
+
name={`${variant}-${size}`}
|
|
116
|
+
label={`${capitalize(variant)} Disabled`}
|
|
117
|
+
placeHolder={`${capitalize(variant)} disabled`}
|
|
118
|
+
helpText={`Please enter your ${variant} disabled.`}
|
|
119
|
+
error={false}
|
|
120
|
+
/>
|
|
121
|
+
</div>
|
|
122
|
+
)
|
|
123
|
+
})}
|
|
124
|
+
</div>
|
|
125
|
+
</>
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export const Intents = (): React.JSX.Element => {
|
|
130
|
+
return (
|
|
131
|
+
<div style={{ maxWidth: '800px', margin: '0 auto' }}>
|
|
132
|
+
{intent.map((i) => {
|
|
133
|
+
return (
|
|
134
|
+
<div key={i} style={{ marginBottom: '12px' }}>
|
|
135
|
+
<Input
|
|
136
|
+
key={i}
|
|
137
|
+
variant="outlined"
|
|
138
|
+
intent={i}
|
|
139
|
+
inputSize="md"
|
|
140
|
+
id={i}
|
|
141
|
+
name={i}
|
|
142
|
+
label={capitalize(i)}
|
|
143
|
+
placeHolder={capitalize(i)}
|
|
144
|
+
helpText={`Please enter your ${i}`}
|
|
145
|
+
disabled={false}
|
|
146
|
+
error={false}
|
|
147
|
+
/>
|
|
148
|
+
</div>
|
|
149
|
+
)
|
|
150
|
+
})}
|
|
151
|
+
</div>
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>
|
|
156
|
+
export const Error = (): React.JSX.Element => {
|
|
157
|
+
return (
|
|
158
|
+
<>
|
|
159
|
+
<div style={{ maxWidth: '600px', margin: '0 auto' }}>
|
|
160
|
+
<Input
|
|
161
|
+
required
|
|
162
|
+
id="name"
|
|
163
|
+
name="name"
|
|
164
|
+
label="Name"
|
|
165
|
+
placeHolder="Name"
|
|
166
|
+
helpText="Please enter your name."
|
|
167
|
+
disabled={false}
|
|
168
|
+
error={true}
|
|
169
|
+
errorText="Please enter a valid name."
|
|
170
|
+
/>
|
|
171
|
+
</div>
|
|
172
|
+
</>
|
|
173
|
+
)
|
|
174
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import cx from 'classnames'
|
|
4
|
+
import type React from 'react'
|
|
5
|
+
|
|
6
|
+
import type { Intent, Size, Variant } from './@types/input.js'
|
|
7
|
+
import { ErrorText } from './error-text.js'
|
|
8
|
+
import { HelpText } from './help-text.js'
|
|
9
|
+
import styles from './input.module.css'
|
|
10
|
+
|
|
11
|
+
import type { InputAdornmentProps } from './input-adornment.js'
|
|
12
|
+
import { Label } from './label.js'
|
|
13
|
+
|
|
14
|
+
export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
15
|
+
id: string
|
|
16
|
+
name: string
|
|
17
|
+
label?: string
|
|
18
|
+
variant?: Variant
|
|
19
|
+
inputSize?: Size
|
|
20
|
+
intent?: Intent
|
|
21
|
+
required?: boolean
|
|
22
|
+
type?: string
|
|
23
|
+
placeHolder?: string
|
|
24
|
+
autoComplete?: string
|
|
25
|
+
startAdornment?: React.ReactElement<InputAdornmentProps>
|
|
26
|
+
endAdornment?: React.ReactElement<InputAdornmentProps>
|
|
27
|
+
error?: boolean
|
|
28
|
+
helpText?: string
|
|
29
|
+
errorText?: string
|
|
30
|
+
className?: string
|
|
31
|
+
inputWrapperClassName?: string
|
|
32
|
+
ref?: React.RefCallback<HTMLInputElement | null> | React.RefObject<HTMLInputElement | null>
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const Input = <C extends React.ElementType = 'input'>({
|
|
36
|
+
ref,
|
|
37
|
+
id,
|
|
38
|
+
name,
|
|
39
|
+
type = 'text',
|
|
40
|
+
variant = 'outlined',
|
|
41
|
+
inputSize = 'md',
|
|
42
|
+
intent = 'primary',
|
|
43
|
+
required,
|
|
44
|
+
label,
|
|
45
|
+
startAdornment,
|
|
46
|
+
endAdornment,
|
|
47
|
+
placeHolder = '',
|
|
48
|
+
autoComplete = 'off',
|
|
49
|
+
error = false,
|
|
50
|
+
helpText = '',
|
|
51
|
+
errorText = '',
|
|
52
|
+
inputWrapperClassName,
|
|
53
|
+
className,
|
|
54
|
+
...rest
|
|
55
|
+
}: InputProps) => {
|
|
56
|
+
return (
|
|
57
|
+
<div className={cx('input-wrapper', styles.inputWrapper, inputWrapperClassName)}>
|
|
58
|
+
{label != null && <Label id={id} htmlFor={id} required={required} label={label} />}
|
|
59
|
+
<div className={cx('input-container', styles.inputContainer)}>
|
|
60
|
+
{startAdornment != null && (
|
|
61
|
+
<div className={cx(styles.startAdornment, styles[variant])}>{startAdornment}</div>
|
|
62
|
+
)}
|
|
63
|
+
<input
|
|
64
|
+
ref={ref}
|
|
65
|
+
id={id}
|
|
66
|
+
name={name}
|
|
67
|
+
type={type}
|
|
68
|
+
required={required}
|
|
69
|
+
autoComplete={autoComplete}
|
|
70
|
+
placeholder={placeHolder}
|
|
71
|
+
aria-labelledby={`label-for-${id}`}
|
|
72
|
+
aria-invalid={error}
|
|
73
|
+
aria-required={required}
|
|
74
|
+
aria-errormessage={errorText}
|
|
75
|
+
aria-describedby={error ? `error-for-${id}` : undefined}
|
|
76
|
+
className={cx(
|
|
77
|
+
'input',
|
|
78
|
+
variant,
|
|
79
|
+
inputSize,
|
|
80
|
+
intent,
|
|
81
|
+
styles.input,
|
|
82
|
+
styles[variant],
|
|
83
|
+
styles[inputSize],
|
|
84
|
+
styles[intent],
|
|
85
|
+
{ [styles.startAdornmentPadding]: startAdornment != null },
|
|
86
|
+
{ [styles.endAdornmentPadding]: endAdornment != null },
|
|
87
|
+
{ [styles.error]: error },
|
|
88
|
+
className
|
|
89
|
+
)}
|
|
90
|
+
{...rest}
|
|
91
|
+
/>
|
|
92
|
+
{endAdornment != null && (
|
|
93
|
+
<div className={cx(styles.endAdornment, styles[variant])}>{endAdornment}</div>
|
|
94
|
+
)}
|
|
95
|
+
</div>
|
|
96
|
+
{error ? (
|
|
97
|
+
<ErrorText id={`error-for-${id}`} text={errorText ?? helpText} />
|
|
98
|
+
) : (
|
|
99
|
+
helpText?.length > 0 && <HelpText text={helpText} />
|
|
100
|
+
)}
|
|
101
|
+
</div>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
3
|
+
import styles from './label.module.css'
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAttributes<'label'> {
|
|
6
|
+
id: string
|
|
7
|
+
for: string
|
|
8
|
+
label: string
|
|
9
|
+
required?: boolean
|
|
10
|
+
class?: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const { id, for: htmlFor, label, required, class: className, ...rest } = Astro.props as Props
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
<label
|
|
17
|
+
id={`label-for-${id}`}
|
|
18
|
+
for={htmlFor}
|
|
19
|
+
class:list={['label', styles.label, className]}
|
|
20
|
+
{...rest}
|
|
21
|
+
>
|
|
22
|
+
{label}
|
|
23
|
+
{required != null && <span class={styles.required}> *</span>}
|
|
24
|
+
</label>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
@layer infonomic-base, infonomic-utilities, infonomic-theme, infonomic-typography, infonomic-components;
|
|
2
|
+
|
|
3
|
+
@layer infonomic-components {
|
|
4
|
+
.label {
|
|
5
|
+
display: block;
|
|
6
|
+
font-weight: 500;
|
|
7
|
+
color: var(--gray-900)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.required {
|
|
11
|
+
color: var(--red-500);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/* 🌙 Dark via `.dark` class. We rely on the
|
|
15
|
+
* consuming application to detect a user's preferred
|
|
16
|
+
* color scheme - either by header or cookie, and set
|
|
17
|
+
* a root html class accordingly
|
|
18
|
+
*/
|
|
19
|
+
:global(.dark) {
|
|
20
|
+
.label:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
|
|
21
|
+
color: var(--gray-50);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.required:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
|
|
25
|
+
color: var(--red-400);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import cx from 'classnames'
|
|
2
|
+
import type React from 'react'
|
|
3
|
+
|
|
4
|
+
import styles from './label.module.css'
|
|
5
|
+
|
|
6
|
+
interface LabelProps {
|
|
7
|
+
className?: string
|
|
8
|
+
id: string
|
|
9
|
+
htmlFor: string
|
|
10
|
+
label: string
|
|
11
|
+
required?: boolean
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function Label({ className, id, htmlFor, label, required }: LabelProps): React.JSX.Element {
|
|
15
|
+
return (
|
|
16
|
+
<label
|
|
17
|
+
id={`label-for-${id}`}
|
|
18
|
+
htmlFor={htmlFor}
|
|
19
|
+
className={cx('label', styles.label, className)}
|
|
20
|
+
>
|
|
21
|
+
{label}
|
|
22
|
+
{required != null && <span className={styles.required}> *</span>}
|
|
23
|
+
</label>
|
|
24
|
+
)
|
|
25
|
+
}
|