@kaizen/components 0.0.0-canary-no-optint-or-toast-20240308001132 → 0.0.0-canary-less-gung-ho-20240308011930
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/cjs/Tag/Tag.cjs +3 -123
- package/dist/cjs/Tag/Tag.cjs.map +1 -1
- package/dist/cjs/dts/Tag/Tag.d.ts +0 -4
- package/dist/cjs/index.css +1 -2
- package/dist/esm/Tag/Tag.mjs +3 -123
- package/dist/esm/Tag/Tag.mjs.map +1 -1
- package/dist/esm/dts/Tag/Tag.d.ts +0 -4
- package/dist/esm/index.css +3 -4
- package/dist/index.d.ts +0 -4
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/Tag/Tag.tsx +3 -159
- package/dist/cjs/Tag/Tag.module.scss.cjs +0 -38
- package/dist/cjs/Tag/Tag.module.scss.cjs.map +0 -1
- package/dist/esm/Tag/Tag.module.scss.mjs +0 -36
- package/dist/esm/Tag/Tag.module.scss.mjs.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaizen/components",
|
|
3
|
-
"version": "0.0.0-canary-
|
|
3
|
+
"version": "0.0.0-canary-less-gung-ho-20240308011930",
|
|
4
4
|
"description": "Kaizen component library",
|
|
5
5
|
"author": "Geoffrey Chong <geoff.chong@cultureamp.com>",
|
|
6
6
|
"homepage": "https://cultureamp.design",
|
package/src/Tag/Tag.tsx
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import React from "react"
|
|
2
|
-
import
|
|
3
|
-
import { Avatar, AvatarProps } from "~components/Avatar"
|
|
4
|
-
import {
|
|
5
|
-
CautionIcon,
|
|
6
|
-
ClearIcon,
|
|
7
|
-
ExclamationIcon,
|
|
8
|
-
InformationIcon,
|
|
9
|
-
LiveIcon,
|
|
10
|
-
SuccessIcon,
|
|
11
|
-
} from "~components/Icon"
|
|
2
|
+
import { AvatarProps } from "~components/Avatar"
|
|
12
3
|
import { TagVariants } from "./types"
|
|
13
|
-
import styles from "./Tag.module.scss"
|
|
14
4
|
|
|
15
5
|
export type TagWithAvatarProps = Omit<DefaultTagProps, "variant"> & {
|
|
16
6
|
variant: "profile"
|
|
@@ -33,155 +23,9 @@ export interface DefaultTagProps {
|
|
|
33
23
|
|
|
34
24
|
export type TagProps = DefaultTagProps | TagWithAvatarProps
|
|
35
25
|
|
|
36
|
-
const isJSXElement = (
|
|
37
|
-
imageElementOrAvatarProps: JSX.Element | AvatarProps
|
|
38
|
-
): imageElementOrAvatarProps is JSX.Element =>
|
|
39
|
-
"props" in imageElementOrAvatarProps
|
|
40
|
-
|
|
41
|
-
const renderAvatar = (
|
|
42
|
-
imageElementOrAvatarProps: JSX.Element | AvatarProps
|
|
43
|
-
): JSX.Element =>
|
|
44
|
-
isJSXElement(imageElementOrAvatarProps) ? (
|
|
45
|
-
<>{imageElementOrAvatarProps}</>
|
|
46
|
-
) : (
|
|
47
|
-
<Avatar {...imageElementOrAvatarProps} size="small" />
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3081928978/Tags Guidance} |
|
|
52
|
-
* {@link https://cultureamp.design/?path=/docs/components-tag--docs Storybook}
|
|
53
|
-
*/
|
|
54
26
|
export const Tag = (props: TagProps): JSX.Element => {
|
|
55
|
-
const {
|
|
56
|
-
|
|
57
|
-
variant = "default",
|
|
58
|
-
size = "medium",
|
|
59
|
-
inline = false,
|
|
60
|
-
dismissible = false,
|
|
61
|
-
onDismiss,
|
|
62
|
-
onMouseDown,
|
|
63
|
-
onMouseLeave,
|
|
64
|
-
truncateWidth,
|
|
65
|
-
} = props
|
|
66
|
-
|
|
67
|
-
const isTruncated = truncateWidth && truncateWidth > 0
|
|
68
|
-
const canShowIcon = size === "medium"
|
|
69
|
-
return (
|
|
70
|
-
<div
|
|
71
|
-
className={classnames(
|
|
72
|
-
styles.root,
|
|
73
|
-
styles[variant],
|
|
74
|
-
variant === "profile" && styles.default,
|
|
75
|
-
styles[size],
|
|
76
|
-
inline && styles.inline,
|
|
77
|
-
dismissible && styles.dismissible
|
|
78
|
-
)}
|
|
79
|
-
>
|
|
80
|
-
<div className={styles.layoutContainer}>
|
|
81
|
-
<>
|
|
82
|
-
{canShowIcon &&
|
|
83
|
-
((): JSX.Element | void => {
|
|
84
|
-
switch (props.variant) {
|
|
85
|
-
case "validationPositive":
|
|
86
|
-
return (
|
|
87
|
-
<span className={styles.validationIcon}>
|
|
88
|
-
<SuccessIcon role="presentation" />
|
|
89
|
-
</span>
|
|
90
|
-
)
|
|
91
|
-
case "validationNegative":
|
|
92
|
-
return (
|
|
93
|
-
<span className={styles.validationIcon}>
|
|
94
|
-
<ExclamationIcon role="presentation" />
|
|
95
|
-
</span>
|
|
96
|
-
)
|
|
97
|
-
case "validationCautionary":
|
|
98
|
-
return (
|
|
99
|
-
<span className={styles.validationIcon}>
|
|
100
|
-
<CautionIcon role="presentation" />
|
|
101
|
-
</span>
|
|
102
|
-
)
|
|
103
|
-
case "validationInformative":
|
|
104
|
-
return (
|
|
105
|
-
<span className={styles.validationIcon}>
|
|
106
|
-
<InformationIcon role="presentation" />
|
|
107
|
-
</span>
|
|
108
|
-
)
|
|
109
|
-
case "profile":
|
|
110
|
-
return (
|
|
111
|
-
<span className={styles.profile}>
|
|
112
|
-
{props.avatar && renderAvatar(props.avatar)}
|
|
113
|
-
</span>
|
|
114
|
-
)
|
|
115
|
-
default:
|
|
116
|
-
return
|
|
117
|
-
}
|
|
118
|
-
})()}
|
|
119
|
-
<span
|
|
120
|
-
className={classnames(
|
|
121
|
-
styles.textContent,
|
|
122
|
-
isTruncated && styles.truncate
|
|
123
|
-
)}
|
|
124
|
-
style={{
|
|
125
|
-
maxWidth: isTruncated ? truncateWidth : undefined,
|
|
126
|
-
}}
|
|
127
|
-
>
|
|
128
|
-
{children}
|
|
129
|
-
</span>
|
|
130
|
-
{dismissible && (
|
|
131
|
-
<>
|
|
132
|
-
<button
|
|
133
|
-
type="button"
|
|
134
|
-
className={styles.dismissButton}
|
|
135
|
-
onClick={onDismiss}
|
|
136
|
-
onMouseDown={onMouseDown}
|
|
137
|
-
onMouseLeave={onMouseLeave}
|
|
138
|
-
>
|
|
139
|
-
<div className={styles.iconWrapper}>
|
|
140
|
-
<ClearIcon inheritSize role="img" aria-label="Dismiss" />
|
|
141
|
-
</div>
|
|
142
|
-
</button>
|
|
143
|
-
</>
|
|
144
|
-
)}
|
|
145
|
-
{variant === "statusLive" && (
|
|
146
|
-
<span className={styles.liveIcon}>
|
|
147
|
-
<LiveIcon
|
|
148
|
-
role="presentation"
|
|
149
|
-
classNameOverride={styles.liveIcon_base}
|
|
150
|
-
width="16"
|
|
151
|
-
height="16"
|
|
152
|
-
viewBox="0 0 16 16"
|
|
153
|
-
fill="none"
|
|
154
|
-
/>
|
|
155
|
-
<LiveIcon
|
|
156
|
-
role="presentation"
|
|
157
|
-
classNameOverride={styles.liveIcon_1}
|
|
158
|
-
width="16"
|
|
159
|
-
height="16"
|
|
160
|
-
viewBox="0 0 16 16"
|
|
161
|
-
fill="none"
|
|
162
|
-
/>
|
|
163
|
-
<LiveIcon
|
|
164
|
-
role="presentation"
|
|
165
|
-
classNameOverride={styles.liveIcon_2}
|
|
166
|
-
width="16"
|
|
167
|
-
height="16"
|
|
168
|
-
viewBox="0 0 16 16"
|
|
169
|
-
fill="none"
|
|
170
|
-
/>
|
|
171
|
-
<LiveIcon
|
|
172
|
-
role="presentation"
|
|
173
|
-
classNameOverride={styles.liveIcon_3}
|
|
174
|
-
width="16"
|
|
175
|
-
height="16"
|
|
176
|
-
viewBox="0 0 16 16"
|
|
177
|
-
fill="none"
|
|
178
|
-
/>
|
|
179
|
-
</span>
|
|
180
|
-
)}
|
|
181
|
-
</>
|
|
182
|
-
</div>
|
|
183
|
-
</div>
|
|
184
|
-
)
|
|
27
|
+
const { variant = "default" } = props
|
|
28
|
+
return <div>Testing Tag component {variant}</div>
|
|
185
29
|
}
|
|
186
30
|
|
|
187
31
|
Tag.displayName = "Tag"
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var styles = {
|
|
4
|
-
"root": "Tag-module_root__uRhoc",
|
|
5
|
-
"profile": "Tag-module_profile__OoGsS",
|
|
6
|
-
"layoutContainer": "Tag-module_layoutContainer__pBLSz",
|
|
7
|
-
"validationIcon": "Tag-module_validationIcon__B-YLv",
|
|
8
|
-
"textContent": "Tag-module_textContent__q76X-",
|
|
9
|
-
"iconWrapper": "Tag-module_iconWrapper__aPrKH",
|
|
10
|
-
"dismissButton": "Tag-module_dismissButton__rHv7r",
|
|
11
|
-
"background": "Tag-module_background__LkzGB",
|
|
12
|
-
"truncate": "Tag-module_truncate__5w7HW",
|
|
13
|
-
"inline": "Tag-module_inline__pPM-d",
|
|
14
|
-
"medium": "Tag-module_medium__NkOrv",
|
|
15
|
-
"small": "Tag-module_small__-xyNk",
|
|
16
|
-
"default": "Tag-module_default__6PVke",
|
|
17
|
-
"sentimentPositive": "Tag-module_sentimentPositive__nbqE1",
|
|
18
|
-
"sentimentNeutral": "Tag-module_sentimentNeutral__8BtD8",
|
|
19
|
-
"sentimentNegative": "Tag-module_sentimentNegative__1J85t",
|
|
20
|
-
"sentimentNone": "Tag-module_sentimentNone__8BWjU",
|
|
21
|
-
"validationPositive": "Tag-module_validationPositive__vgFUE",
|
|
22
|
-
"validationInformative": "Tag-module_validationInformative__bnJ4A",
|
|
23
|
-
"validationNegative": "Tag-module_validationNegative__lZgIY",
|
|
24
|
-
"validationCautionary": "Tag-module_validationCautionary__ERS2t",
|
|
25
|
-
"statusLive": "Tag-module_statusLive__xG48w",
|
|
26
|
-
"statusAction": "Tag-module_statusAction__woL-O",
|
|
27
|
-
"statusClosed": "Tag-module_statusClosed__VhZP-",
|
|
28
|
-
"statusDraft": "Tag-module_statusDraft__9QZDv",
|
|
29
|
-
"liveIcon": "Tag-module_liveIcon__URtak",
|
|
30
|
-
"liveIcon_base": "Tag-module_liveIcon_base__Nk5um",
|
|
31
|
-
"liveIcon_1": "Tag-module_liveIcon_1__STFJY",
|
|
32
|
-
"liveIcon_2": "Tag-module_liveIcon_2__rko-D",
|
|
33
|
-
"liveIcon_3": "Tag-module_liveIcon_3__fL71y",
|
|
34
|
-
"pulse-inner": "Tag-module_pulse-inner__0-JFL",
|
|
35
|
-
"pulse-outer": "Tag-module_pulse-outer__f9Oox"
|
|
36
|
-
};
|
|
37
|
-
module.exports = styles;
|
|
38
|
-
//# sourceMappingURL=Tag.module.scss.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.module.scss.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
var styles = {
|
|
2
|
-
"root": "Tag-module_root__uRhoc",
|
|
3
|
-
"profile": "Tag-module_profile__OoGsS",
|
|
4
|
-
"layoutContainer": "Tag-module_layoutContainer__pBLSz",
|
|
5
|
-
"validationIcon": "Tag-module_validationIcon__B-YLv",
|
|
6
|
-
"textContent": "Tag-module_textContent__q76X-",
|
|
7
|
-
"iconWrapper": "Tag-module_iconWrapper__aPrKH",
|
|
8
|
-
"dismissButton": "Tag-module_dismissButton__rHv7r",
|
|
9
|
-
"background": "Tag-module_background__LkzGB",
|
|
10
|
-
"truncate": "Tag-module_truncate__5w7HW",
|
|
11
|
-
"inline": "Tag-module_inline__pPM-d",
|
|
12
|
-
"medium": "Tag-module_medium__NkOrv",
|
|
13
|
-
"small": "Tag-module_small__-xyNk",
|
|
14
|
-
"default": "Tag-module_default__6PVke",
|
|
15
|
-
"sentimentPositive": "Tag-module_sentimentPositive__nbqE1",
|
|
16
|
-
"sentimentNeutral": "Tag-module_sentimentNeutral__8BtD8",
|
|
17
|
-
"sentimentNegative": "Tag-module_sentimentNegative__1J85t",
|
|
18
|
-
"sentimentNone": "Tag-module_sentimentNone__8BWjU",
|
|
19
|
-
"validationPositive": "Tag-module_validationPositive__vgFUE",
|
|
20
|
-
"validationInformative": "Tag-module_validationInformative__bnJ4A",
|
|
21
|
-
"validationNegative": "Tag-module_validationNegative__lZgIY",
|
|
22
|
-
"validationCautionary": "Tag-module_validationCautionary__ERS2t",
|
|
23
|
-
"statusLive": "Tag-module_statusLive__xG48w",
|
|
24
|
-
"statusAction": "Tag-module_statusAction__woL-O",
|
|
25
|
-
"statusClosed": "Tag-module_statusClosed__VhZP-",
|
|
26
|
-
"statusDraft": "Tag-module_statusDraft__9QZDv",
|
|
27
|
-
"liveIcon": "Tag-module_liveIcon__URtak",
|
|
28
|
-
"liveIcon_base": "Tag-module_liveIcon_base__Nk5um",
|
|
29
|
-
"liveIcon_1": "Tag-module_liveIcon_1__STFJY",
|
|
30
|
-
"liveIcon_2": "Tag-module_liveIcon_2__rko-D",
|
|
31
|
-
"liveIcon_3": "Tag-module_liveIcon_3__fL71y",
|
|
32
|
-
"pulse-inner": "Tag-module_pulse-inner__0-JFL",
|
|
33
|
-
"pulse-outer": "Tag-module_pulse-outer__f9Oox"
|
|
34
|
-
};
|
|
35
|
-
export { styles as default };
|
|
36
|
-
//# sourceMappingURL=Tag.module.scss.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.module.scss.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|