@ckwag/elements 0.0.1-dev.4ce9c14

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.
Files changed (57) hide show
  1. package/LICENSE +191 -0
  2. package/README.md +70 -0
  3. package/dist/Button/Button.css +263 -0
  4. package/dist/Button/Button.d.ts +29 -0
  5. package/dist/Button/Button.d.ts.map +1 -0
  6. package/dist/Button/Button.js +28 -0
  7. package/dist/Button/Button.js.map +1 -0
  8. package/dist/Button/index.d.ts +3 -0
  9. package/dist/Button/index.d.ts.map +1 -0
  10. package/dist/Button/index.js +2 -0
  11. package/dist/Button/index.js.map +1 -0
  12. package/dist/InlineMessage/InlineMessage.css +161 -0
  13. package/dist/InlineMessage/InlineMessage.d.ts +30 -0
  14. package/dist/InlineMessage/InlineMessage.d.ts.map +1 -0
  15. package/dist/InlineMessage/InlineMessage.js +39 -0
  16. package/dist/InlineMessage/InlineMessage.js.map +1 -0
  17. package/dist/InlineMessage/index.d.ts +3 -0
  18. package/dist/InlineMessage/index.d.ts.map +1 -0
  19. package/dist/InlineMessage/index.js +2 -0
  20. package/dist/InlineMessage/index.js.map +1 -0
  21. package/dist/InputField/InputField.css +275 -0
  22. package/dist/InputField/InputField.d.ts +38 -0
  23. package/dist/InputField/InputField.d.ts.map +1 -0
  24. package/dist/InputField/InputField.js +42 -0
  25. package/dist/InputField/InputField.js.map +1 -0
  26. package/dist/InputField/index.d.ts +3 -0
  27. package/dist/InputField/index.d.ts.map +1 -0
  28. package/dist/InputField/index.js +2 -0
  29. package/dist/InputField/index.js.map +1 -0
  30. package/dist/PasswordInput/PasswordInput.css +67 -0
  31. package/dist/PasswordInput/PasswordInput.d.ts +21 -0
  32. package/dist/PasswordInput/PasswordInput.d.ts.map +1 -0
  33. package/dist/PasswordInput/PasswordInput.js +41 -0
  34. package/dist/PasswordInput/PasswordInput.js.map +1 -0
  35. package/dist/PasswordInput/index.d.ts +3 -0
  36. package/dist/PasswordInput/index.d.ts.map +1 -0
  37. package/dist/PasswordInput/index.js +2 -0
  38. package/dist/PasswordInput/index.js.map +1 -0
  39. package/dist/SegmentedControl/SegmentedControl.css +235 -0
  40. package/dist/SegmentedControl/SegmentedControl.d.ts +50 -0
  41. package/dist/SegmentedControl/SegmentedControl.d.ts.map +1 -0
  42. package/dist/SegmentedControl/SegmentedControl.js +141 -0
  43. package/dist/SegmentedControl/SegmentedControl.js.map +1 -0
  44. package/dist/SegmentedControl/index.d.ts +3 -0
  45. package/dist/SegmentedControl/index.d.ts.map +1 -0
  46. package/dist/SegmentedControl/index.js +2 -0
  47. package/dist/SegmentedControl/index.js.map +1 -0
  48. package/dist/index.d.ts +11 -0
  49. package/dist/index.d.ts.map +1 -0
  50. package/dist/index.js +7 -0
  51. package/dist/index.js.map +1 -0
  52. package/dist/react/index.d.ts +11 -0
  53. package/dist/react/index.d.ts.map +1 -0
  54. package/dist/react/index.js +7 -0
  55. package/dist/react/index.js.map +1 -0
  56. package/dist/styles.css +5 -0
  57. package/package.json +64 -0
@@ -0,0 +1,161 @@
1
+ /**
2
+ * Inline Message Styles
3
+ *
4
+ * Uses only semantic design tokens from @ckwag/elements-tokens.
5
+ * Variants: Info, Success, Error.
6
+ * Responsive behavior follows the Figma Desktop/Mobile variants by default.
7
+ */
8
+
9
+ /* ============================================
10
+ Root
11
+ ============================================ */
12
+
13
+ .ckw-inline-message {
14
+ --ckw-inline-message-status-color: var(--status-info-border);
15
+
16
+ display: flex;
17
+ width: 100%;
18
+ max-width: 100%;
19
+ overflow: hidden;
20
+ border-radius: var(--border-radius-s);
21
+ background-color: var(--background-default);
22
+ color: var(--text-primary);
23
+ font-family: var(--font-family-brand), sans-serif;
24
+ box-sizing: border-box;
25
+ }
26
+
27
+ .ckw-inline-message *,
28
+ .ckw-inline-message *::before,
29
+ .ckw-inline-message *::after {
30
+ box-sizing: border-box;
31
+ }
32
+
33
+ .ckw-inline-message--success {
34
+ --ckw-inline-message-status-color: var(--status-success-border);
35
+ }
36
+
37
+ .ckw-inline-message--error {
38
+ --ckw-inline-message-status-color: var(--status-error-border);
39
+ }
40
+
41
+ /* ============================================
42
+ Status Rail
43
+ ============================================ */
44
+
45
+ .ckw-inline-message__status {
46
+ flex: 0 0 var(--spacing-xs);
47
+ width: var(--spacing-xs);
48
+ background-color: var(--ckw-inline-message-status-color);
49
+ }
50
+
51
+ /* ============================================
52
+ Content
53
+ ============================================ */
54
+
55
+ .ckw-inline-message__content {
56
+ display: flex;
57
+ flex: 1 1 auto;
58
+ min-width: 0;
59
+ gap: var(--spacing-m);
60
+ align-items: flex-start;
61
+ padding: var(--spacing-m) var(--spacing-l);
62
+ background-color: var(--background-default);
63
+ }
64
+
65
+ .ckw-inline-message__icon {
66
+ display: flex;
67
+ align-items: center;
68
+ justify-content: center;
69
+ flex: 0 0 calc(var(--spacing-xl) + var(--spacing-2xs));
70
+ width: calc(var(--spacing-xl) + var(--spacing-2xs));
71
+ height: calc(var(--spacing-xl) + var(--spacing-2xs));
72
+ color: var(--ckw-inline-message-status-color);
73
+ }
74
+
75
+ .ckw-inline-message--has-title .ckw-inline-message__icon {
76
+ margin-top: var(--spacing-2xs);
77
+ }
78
+
79
+ .ckw-inline-message__icon > svg {
80
+ width: 100%;
81
+ height: 100%;
82
+ }
83
+
84
+ .ckw-inline-message__text {
85
+ display: flex;
86
+ flex: 1 1 auto;
87
+ min-width: 0;
88
+ flex-direction: column;
89
+ }
90
+
91
+ .ckw-inline-message__title {
92
+ font-family: var(--font-family-brand), sans-serif;
93
+ font-size: var(--body-m-emphasized-size);
94
+ line-height: var(--body-m-emphasized-height);
95
+ font-weight: var(--body-m-emphasized-weight);
96
+ color: var(--text-primary);
97
+ }
98
+
99
+ .ckw-inline-message__body {
100
+ font-family: var(--font-family-brand), sans-serif;
101
+ font-size: var(--body-m-size);
102
+ line-height: var(--body-m-height);
103
+ font-weight: var(--body-m-weight);
104
+ color: var(--text-primary);
105
+ }
106
+
107
+ /* ============================================
108
+ Mobile Breakpoint
109
+ ============================================ */
110
+
111
+ .ckw-inline-message--breakpoint-mobile .ckw-inline-message__content {
112
+ gap: var(--spacing-s);
113
+ padding: var(--spacing-m);
114
+ }
115
+
116
+ .ckw-inline-message--breakpoint-mobile .ckw-inline-message__icon {
117
+ flex-basis: var(--spacing-xl);
118
+ width: var(--spacing-xl);
119
+ height: var(--spacing-xl);
120
+ }
121
+
122
+ .ckw-inline-message--breakpoint-mobile.ckw-inline-message--has-title .ckw-inline-message__icon {
123
+ margin-top: var(--spacing-2xs);
124
+ }
125
+
126
+ .ckw-inline-message--breakpoint-mobile .ckw-inline-message__title {
127
+ font-size: var(--body-s-emphasized-size);
128
+ line-height: var(--body-s-emphasized-height);
129
+ font-weight: var(--body-s-emphasized-weight);
130
+ }
131
+
132
+ .ckw-inline-message--breakpoint-mobile .ckw-inline-message__body {
133
+ font-size: var(--body-s-size);
134
+ line-height: var(--body-s-height);
135
+ font-weight: var(--body-s-weight);
136
+ }
137
+
138
+ @media (max-width: 767px) {
139
+ .ckw-inline-message:not(.ckw-inline-message--breakpoint-desktop) .ckw-inline-message__content {
140
+ gap: var(--spacing-s);
141
+ padding: var(--spacing-m);
142
+ }
143
+
144
+ .ckw-inline-message:not(.ckw-inline-message--breakpoint-desktop) .ckw-inline-message__icon {
145
+ flex-basis: var(--spacing-xl);
146
+ width: var(--spacing-xl);
147
+ height: var(--spacing-xl);
148
+ }
149
+
150
+ .ckw-inline-message:not(.ckw-inline-message--breakpoint-desktop) .ckw-inline-message__title {
151
+ font-size: var(--body-s-emphasized-size);
152
+ line-height: var(--body-s-emphasized-height);
153
+ font-weight: var(--body-s-emphasized-weight);
154
+ }
155
+
156
+ .ckw-inline-message:not(.ckw-inline-message--breakpoint-desktop) .ckw-inline-message__body {
157
+ font-size: var(--body-s-size);
158
+ line-height: var(--body-s-height);
159
+ font-weight: var(--body-s-weight);
160
+ }
161
+ }
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import './InlineMessage.css';
3
+ export type InlineMessageStatus = 'Info' | 'Success' | 'Error';
4
+ export type InlineMessageBreakpoint = 'Auto' | 'Desktop' | 'Mobile';
5
+ export interface InlineMessageProps {
6
+ /** Optional headline shown above the body text. */
7
+ title?: React.ReactNode;
8
+ /** Message body text or content. */
9
+ children: React.ReactNode;
10
+ /** Semantic status variant. */
11
+ status?: InlineMessageStatus;
12
+ /** Optional custom icon. If omitted, a status icon is rendered. */
13
+ icon?: React.ReactNode;
14
+ /** Whether the icon area is shown. */
15
+ showIcon?: boolean;
16
+ /** Responsive behavior. Auto follows viewport width; Desktop/Mobile force a documented variant. */
17
+ breakpoint?: InlineMessageBreakpoint;
18
+ /** ARIA landmark role for the inline message. */
19
+ role?: React.AriaRole;
20
+ /** Additional CSS class names on the root element. */
21
+ className?: string;
22
+ }
23
+ /**
24
+ * Inline Message provides contextual feedback directly within page content.
25
+ *
26
+ * Use it for non-time-critical status updates, confirmations, limitations,
27
+ * or errors that should remain visible near the related content.
28
+ */
29
+ export declare function InlineMessage({ title, children, status, icon, showIcon, breakpoint, role, className, }: InlineMessageProps): React.JSX.Element;
30
+ //# sourceMappingURL=InlineMessage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InlineMessage.d.ts","sourceRoot":"","sources":["../../src/InlineMessage/InlineMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,qBAAqB,CAAC;AAE7B,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AAC/D,MAAM,MAAM,uBAAuB,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEpE,MAAM,WAAW,kBAAkB;IACjC,mDAAmD;IACnD,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,oCAAoC;IACpC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,+BAA+B;IAC/B,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,mEAAmE;IACnE,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mGAAmG;IACnG,UAAU,CAAC,EAAE,uBAAuB,CAAC;IACrC,iDAAiD;IACjD,IAAI,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC;IACtB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAkBD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,QAAQ,EACR,MAAe,EACf,IAAI,EACJ,QAAe,EACf,UAAmB,EACnB,IAAa,EACb,SAAS,GACV,EAAE,kBAAkB,qBA8BpB"}
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+ import { IconCheckCircleFilled, IconInformation, IconWarningCircleFilled, } from '@ckwag/elements-icons';
3
+ import './InlineMessage.css';
4
+ function InlineMessageDefaultIcon({ status }) {
5
+ if (status === 'Success') {
6
+ return React.createElement(IconCheckCircleFilled, null);
7
+ }
8
+ if (status === 'Error') {
9
+ return React.createElement(IconWarningCircleFilled, null);
10
+ }
11
+ return React.createElement(IconInformation, null);
12
+ }
13
+ /**
14
+ * Inline Message provides contextual feedback directly within page content.
15
+ *
16
+ * Use it for non-time-critical status updates, confirmations, limitations,
17
+ * or errors that should remain visible near the related content.
18
+ */
19
+ export function InlineMessage({ title, children, status = 'Info', icon, showIcon = true, breakpoint = 'Auto', role = 'note', className, }) {
20
+ const rootClasses = [
21
+ 'ckw-inline-message',
22
+ `ckw-inline-message--${status.toLowerCase()}`,
23
+ title ? 'ckw-inline-message--has-title' : '',
24
+ showIcon ? 'ckw-inline-message--has-icon' : '',
25
+ breakpoint !== 'Auto' ? `ckw-inline-message--breakpoint-${breakpoint.toLowerCase()}` : '',
26
+ className ?? '',
27
+ ]
28
+ .filter(Boolean)
29
+ .join(' ');
30
+ const renderedIcon = icon ?? React.createElement(InlineMessageDefaultIcon, { status: status });
31
+ return (React.createElement("div", { className: rootClasses, role: role },
32
+ React.createElement("div", { className: "ckw-inline-message__status", "aria-hidden": "true" }),
33
+ React.createElement("div", { className: "ckw-inline-message__content" },
34
+ showIcon && (React.createElement("span", { className: "ckw-inline-message__icon", "aria-hidden": "true" }, renderedIcon)),
35
+ React.createElement("div", { className: "ckw-inline-message__text" },
36
+ title && React.createElement("div", { className: "ckw-inline-message__title" }, title),
37
+ React.createElement("div", { className: "ckw-inline-message__body" }, children)))));
38
+ }
39
+ //# sourceMappingURL=InlineMessage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InlineMessage.js","sourceRoot":"","sources":["../../src/InlineMessage/InlineMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,qBAAqB,CAAC;AA4B7B,SAAS,wBAAwB,CAAC,EAAE,MAAM,EAAiC;IACzE,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,oBAAC,qBAAqB,OAAG,CAAC;IACnC,CAAC;IAED,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;QACvB,OAAO,oBAAC,uBAAuB,OAAG,CAAC;IACrC,CAAC;IAED,OAAO,oBAAC,eAAe,OAAG,CAAC;AAC7B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,EAC5B,KAAK,EACL,QAAQ,EACR,MAAM,GAAG,MAAM,EACf,IAAI,EACJ,QAAQ,GAAG,IAAI,EACf,UAAU,GAAG,MAAM,EACnB,IAAI,GAAG,MAAM,EACb,SAAS,GACU;IACnB,MAAM,WAAW,GAAG;QAClB,oBAAoB;QACpB,uBAAuB,MAAM,CAAC,WAAW,EAAE,EAAE;QAC7C,KAAK,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC,CAAC,EAAE;QAC5C,QAAQ,CAAC,CAAC,CAAC,8BAA8B,CAAC,CAAC,CAAC,EAAE;QAC9C,UAAU,KAAK,MAAM,CAAC,CAAC,CAAC,kCAAkC,UAAU,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE;QACzF,SAAS,IAAI,EAAE;KAChB;SACE,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAC;IAEb,MAAM,YAAY,GAAG,IAAI,IAAI,oBAAC,wBAAwB,IAAC,MAAM,EAAE,MAAM,GAAI,CAAC;IAE1E,OAAO,CACL,6BAAK,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI;QACrC,6BAAK,SAAS,EAAC,4BAA4B,iBAAa,MAAM,GAAG;QACjE,6BAAK,SAAS,EAAC,6BAA6B;YACzC,QAAQ,IAAI,CACX,8BAAM,SAAS,EAAC,0BAA0B,iBAAa,MAAM,IAC1D,YAAY,CACR,CACR;YACD,6BAAK,SAAS,EAAC,0BAA0B;gBACtC,KAAK,IAAI,6BAAK,SAAS,EAAC,2BAA2B,IAAE,KAAK,CAAO;gBAClE,6BAAK,SAAS,EAAC,0BAA0B,IAAE,QAAQ,CAAO,CACtD,CACF,CACF,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { InlineMessage } from './InlineMessage.js';
2
+ export type { InlineMessageBreakpoint, InlineMessageProps, InlineMessageStatus, } from './InlineMessage.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/InlineMessage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EACV,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { InlineMessage } from './InlineMessage.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/InlineMessage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,275 @@
1
+ /**
2
+ * Input Field Component Styles
3
+ *
4
+ * Uses only semantic design tokens from @ckwag/elements-tokens.
5
+ * States: Default, Hover, Active (focus), Error, Disabled.
6
+ *
7
+ * Border strategy (no layout shift):
8
+ * - The base border is always border-weight-s (1px) via CSS border.
9
+ * - Hover adds a soft green outline around the input.
10
+ * - Active/Focus uses an inset box-shadow for the thick active border
11
+ * to avoid changing border-width (which causes layout shift).
12
+ * - Error uses the same inset box-shadow technique.
13
+ */
14
+
15
+ /* ============================================
16
+ Root
17
+ ============================================ */
18
+
19
+ .ckw-input-field {
20
+ display: flex;
21
+ flex-direction: column;
22
+ gap: var(--spacing-xs);
23
+ align-items: flex-start;
24
+ width: 100%;
25
+ box-sizing: border-box;
26
+ }
27
+
28
+ .ckw-input-field *,
29
+ .ckw-input-field *::before,
30
+ .ckw-input-field *::after {
31
+ box-sizing: border-box;
32
+ }
33
+
34
+ /* ============================================
35
+ Label Row
36
+ ============================================ */
37
+
38
+ .ckw-input-field__label-row {
39
+ display: flex;
40
+ gap: var(--spacing-2xs);
41
+ align-items: center;
42
+ padding-left: var(--spacing-2xs);
43
+ padding-right: var(--spacing-2xs);
44
+ }
45
+
46
+ .ckw-input-field__label {
47
+ font-family: var(--font-family-brand), sans-serif;
48
+ font-size: var(--label-s-size);
49
+ line-height: var(--label-s-height);
50
+ font-weight: var(--label-s-weight);
51
+ color: var(--text-primary);
52
+ overflow: hidden;
53
+ text-overflow: ellipsis;
54
+ white-space: nowrap;
55
+ }
56
+
57
+ .ckw-input-field__optional {
58
+ font-family: var(--font-family-brand), sans-serif;
59
+ font-size: var(--caption-size);
60
+ line-height: var(--caption-height);
61
+ font-weight: var(--caption-weight);
62
+ color: var(--text-secondary);
63
+ }
64
+
65
+ .ckw-input-field__info-icon {
66
+ display: flex;
67
+ align-items: center;
68
+ justify-content: center;
69
+ width: 18px;
70
+ height: 18px;
71
+ flex-shrink: 0;
72
+ color: var(--interactive-text);
73
+ background: none;
74
+ border: none;
75
+ padding: 0;
76
+ margin: 0;
77
+ cursor: pointer;
78
+ border-radius: 50%;
79
+ outline: none;
80
+ }
81
+
82
+ .ckw-input-field__info-icon:focus-visible {
83
+ outline: var(--border-weight-m) solid var(--border-active);
84
+ outline-offset: 2px;
85
+ }
86
+
87
+ /* ============================================
88
+ Input Wrapper
89
+ ============================================ */
90
+
91
+ .ckw-input-field__outer {
92
+ display: flex;
93
+ flex-direction: column;
94
+ align-items: flex-start;
95
+ width: 100%;
96
+ }
97
+
98
+ /* ============================================
99
+ Input Inner Frame
100
+ ============================================ */
101
+
102
+ .ckw-input-field__inner {
103
+ display: flex;
104
+ gap: var(--spacing-xs);
105
+ align-items: center;
106
+ width: 100%;
107
+ height: 44px;
108
+ padding-left: var(--spacing-m);
109
+ padding-right: var(--spacing-m);
110
+ border-radius: var(--border-radius-s);
111
+ border: var(--border-weight-s) solid var(--border-strong);
112
+ background-color: var(--background-input);
113
+ outline: var(--border-weight-m) solid transparent;
114
+ outline-offset: 0px;
115
+ box-shadow: none;
116
+ overflow: hidden;
117
+ transition:
118
+ border-color 150ms ease,
119
+ background-color 150ms ease,
120
+ outline-color 150ms ease,
121
+ box-shadow 150ms ease;
122
+ }
123
+
124
+ /* Hover — soft green outline */
125
+ .ckw-input-field:not(.ckw-input-field--error):not(.ckw-input-field--disabled)
126
+ .ckw-input-field__inner:hover {
127
+ outline-color: var(--border-hover);
128
+ }
129
+
130
+ /* Focus — green outline + dark green inset shadow + green background */
131
+ .ckw-input-field:not(.ckw-input-field--error):not(.ckw-input-field--disabled)
132
+ .ckw-input-field__inner:has(.ckw-input-field__input:focus) {
133
+ outline-color: var(--border-hover);
134
+ border-color: var(--border-active);
135
+ box-shadow: inset 0 0 0 1px var(--border-active);
136
+ background-color: var(--background-active);
137
+ }
138
+
139
+ /* ============================================
140
+ Native Input
141
+ ============================================ */
142
+
143
+ .ckw-input-field__input {
144
+ flex: 1 0 0;
145
+ min-width: 0;
146
+ border: none;
147
+ outline: none;
148
+ background: transparent;
149
+ padding: 0;
150
+ margin: 0;
151
+ font-family: var(--font-family-brand), sans-serif;
152
+ font-size: var(--body-m-emphasized-size);
153
+ line-height: var(--body-m-emphasized-height);
154
+ font-weight: var(--body-m-emphasized-weight);
155
+ color: var(--text-primary);
156
+ text-overflow: ellipsis;
157
+ white-space: nowrap;
158
+ overflow: hidden;
159
+ }
160
+
161
+ .ckw-input-field__input::placeholder {
162
+ color: var(--text-tertiary);
163
+ }
164
+
165
+ /* ============================================
166
+ Trailing Icon
167
+ ============================================ */
168
+
169
+ .ckw-input-field__icon {
170
+ display: flex;
171
+ align-items: center;
172
+ justify-content: center;
173
+ width: 20px;
174
+ height: 20px;
175
+ flex-shrink: 0;
176
+ color: var(--text-primary);
177
+ }
178
+
179
+ .ckw-input-field__icon > svg {
180
+ width: 100%;
181
+ height: 100%;
182
+ }
183
+
184
+ /* ============================================
185
+ Error State
186
+ ============================================ */
187
+
188
+ .ckw-input-field--error .ckw-input-field__inner {
189
+ border-color: var(--status-error-border);
190
+ box-shadow: inset 0 0 0 1px var(--status-error-border);
191
+ background-color: var(--background-input);
192
+ }
193
+
194
+ .ckw-input-field__error {
195
+ display: flex;
196
+ gap: var(--spacing-2xs);
197
+ align-items: center;
198
+ width: 100%;
199
+ }
200
+
201
+ .ckw-input-field__error-icon {
202
+ display: flex;
203
+ align-items: center;
204
+ justify-content: center;
205
+ width: 16px;
206
+ height: 16px;
207
+ flex-shrink: 0;
208
+ color: var(--status-error-text);
209
+ }
210
+
211
+ .ckw-input-field__error-text {
212
+ font-family: var(--font-family-brand), sans-serif;
213
+ font-size: var(--caption-size);
214
+ line-height: var(--caption-height);
215
+ font-weight: var(--caption-weight);
216
+ color: var(--status-error-text);
217
+ flex: 1 0 0;
218
+ min-width: 0;
219
+ }
220
+
221
+ /* ============================================
222
+ Disabled State
223
+ ============================================ */
224
+
225
+ .ckw-input-field--disabled .ckw-input-field__label {
226
+ color: var(--text-tertiary);
227
+ }
228
+
229
+ .ckw-input-field--disabled .ckw-input-field__optional {
230
+ color: var(--text-tertiary);
231
+ }
232
+
233
+ .ckw-input-field--disabled .ckw-input-field__inner {
234
+ background-color: var(--background-canvas);
235
+ border-color: var(--border-soft);
236
+ cursor: not-allowed;
237
+ }
238
+
239
+ .ckw-input-field--disabled .ckw-input-field__input {
240
+ color: var(--text-tertiary);
241
+ cursor: not-allowed;
242
+ }
243
+
244
+ .ckw-input-field--disabled .ckw-input-field__input::placeholder {
245
+ color: var(--text-tertiary);
246
+ }
247
+
248
+ .ckw-input-field--disabled .ckw-input-field__icon {
249
+ color: var(--text-tertiary);
250
+ }
251
+
252
+ /* ============================================
253
+ Docs-only forced states
254
+ ============================================ */
255
+
256
+ .ckw-input-field--state-hover:not(.ckw-input-field--error):not(.ckw-input-field--disabled)
257
+ .ckw-input-field__inner {
258
+ outline-color: var(--border-hover);
259
+ }
260
+
261
+ .ckw-input-field--state-active:not(.ckw-input-field--error):not(.ckw-input-field--disabled)
262
+ .ckw-input-field__inner {
263
+ outline-color: var(--border-hover);
264
+ border-color: var(--border-active);
265
+ box-shadow: inset 0 0 0 1px var(--border-active);
266
+ background-color: var(--background-active);
267
+ }
268
+
269
+ .ckw-input-field--state-focus-visible:not(.ckw-input-field--error):not(.ckw-input-field--disabled)
270
+ .ckw-input-field__inner {
271
+ outline-color: var(--border-hover);
272
+ border-color: var(--border-active);
273
+ box-shadow: inset 0 0 0 1px var(--border-active);
274
+ background-color: var(--background-active);
275
+ }
@@ -0,0 +1,38 @@
1
+ import React from 'react';
2
+ import './InputField.css';
3
+ export type InputFieldState = 'Default' | 'Hover' | 'Active' | 'Error' | 'Disabled';
4
+ export interface InputFieldProps extends Omit<React.ComponentProps<'input'>, 'className' | 'type'> {
5
+ /** Label text above the input. */
6
+ label?: string;
7
+ /** Placeholder text shown when empty. */
8
+ placeholder?: string;
9
+ /** Whether the field is optional (shows "(optional)" next to label). */
10
+ optional?: boolean;
11
+ /** Error text shown below the input. Pass a non-empty string to trigger the error state. */
12
+ errorText?: string;
13
+ /** Trailing icon inside the input. */
14
+ icon?: React.ReactNode;
15
+ /** Info icon next to the label. */
16
+ showInfo?: boolean;
17
+ /** Info icon click handler. */
18
+ onInfoClick?: React.MouseEventHandler<HTMLButtonElement>;
19
+ /** HTML input type attribute. */
20
+ type?: React.HTMLInputTypeAttribute;
21
+ /**
22
+ * Id applied to the underlying `<input>` and wired to the `<label htmlFor>`.
23
+ * Auto-generated via `useId` when omitted; provide your own to override.
24
+ */
25
+ id?: string;
26
+ /** Additional CSS class names on the root element. */
27
+ className?: string;
28
+ }
29
+ /**
30
+ * Input Field component for text-based data entry.
31
+ *
32
+ * Supports Default, Hover, Active, Error, and Disabled states.
33
+ * The component is a native `<input>` with semantic token styling.
34
+ * Hover and Active states are handled via CSS pseudo-classes in real usage;
35
+ * the explicit state prop is primarily for Storybook documentation.
36
+ */
37
+ export declare const InputField: React.ForwardRefExoticComponent<Omit<InputFieldProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
38
+ //# sourceMappingURL=InputField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InputField.d.ts","sourceRoot":"","sources":["../../src/InputField/InputField.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,kBAAkB,CAAC;AAE1B,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,CAAC;AAEpF,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAChG,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4FAA4F;IAC5F,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+BAA+B;IAC/B,WAAW,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACzD,iCAAiC;IACjC,IAAI,CAAC,EAAE,KAAK,CAAC,sBAAsB,CAAC;IACpC;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,uGAkFrB,CAAC"}
@@ -0,0 +1,42 @@
1
+ 'use client';
2
+ import React from 'react';
3
+ import { IconInformation, IconWarningCircle } from '@ckwag/elements-icons';
4
+ import './InputField.css';
5
+ /**
6
+ * Input Field component for text-based data entry.
7
+ *
8
+ * Supports Default, Hover, Active, Error, and Disabled states.
9
+ * The component is a native `<input>` with semantic token styling.
10
+ * Hover and Active states are handled via CSS pseudo-classes in real usage;
11
+ * the explicit state prop is primarily for Storybook documentation.
12
+ */
13
+ export const InputField = React.forwardRef(function InputField({ label = 'Label', placeholder = 'Placeholder', disabled = false, optional = false, errorText, icon, showInfo = false, onInfoClick, type = 'text', id, className, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, ...inputProps }, ref) {
14
+ const hasError = Boolean(errorText);
15
+ const reactId = React.useId();
16
+ const inputId = id ?? `ckw-input-${reactId}`;
17
+ const errorId = hasError ? `ckw-input-error-${reactId}` : undefined;
18
+ const describedBy = [ariaDescribedBy, errorId].filter(Boolean).join(' ') || undefined;
19
+ const rootClasses = [
20
+ 'ckw-input-field',
21
+ hasError && 'ckw-input-field--error',
22
+ disabled && 'ckw-input-field--disabled',
23
+ className,
24
+ ]
25
+ .filter(Boolean)
26
+ .join(' ');
27
+ return (React.createElement("div", { className: rootClasses },
28
+ React.createElement("div", { className: "ckw-input-field__label-row" },
29
+ React.createElement("label", { className: "ckw-input-field__label", htmlFor: inputId }, label),
30
+ optional && React.createElement("span", { className: "ckw-input-field__optional" }, "(optional)"),
31
+ showInfo && (React.createElement("button", { type: "button", className: "ckw-input-field__info-icon", onClick: onInfoClick, "aria-label": "More information" },
32
+ React.createElement(IconInformation, { size: 18 })))),
33
+ React.createElement("div", { className: "ckw-input-field__outer" },
34
+ React.createElement("div", { className: "ckw-input-field__inner" },
35
+ React.createElement("input", { ...inputProps, ref: ref, className: "ckw-input-field__input", id: inputId, type: type, placeholder: placeholder, disabled: disabled, "aria-invalid": hasError ? true : ariaInvalid, "aria-describedby": describedBy }),
36
+ icon && React.createElement("span", { className: "ckw-input-field__icon" }, icon))),
37
+ hasError && (React.createElement("div", { className: "ckw-input-field__error", id: errorId },
38
+ React.createElement("span", { className: "ckw-input-field__error-icon" },
39
+ React.createElement(IconWarningCircle, { size: 16 })),
40
+ React.createElement("span", { className: "ckw-input-field__error-text" }, errorText)))));
41
+ });
42
+ //# sourceMappingURL=InputField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InputField.js","sourceRoot":"","sources":["../../src/InputField/InputField.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,kBAAkB,CAAC;AA8B1B;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAoC,SAAS,UAAU,CAC/F,EACE,KAAK,GAAG,OAAO,EACf,WAAW,GAAG,aAAa,EAC3B,QAAQ,GAAG,KAAK,EAChB,QAAQ,GAAG,KAAK,EAChB,SAAS,EACT,IAAI,EACJ,QAAQ,GAAG,KAAK,EAChB,WAAW,EACX,IAAI,GAAG,MAAM,EACb,EAAE,EACF,SAAS,EACT,kBAAkB,EAAE,eAAe,EACnC,cAAc,EAAE,WAAW,EAC3B,GAAG,UAAU,EACd,EACD,GAAG;IAEH,MAAM,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IACpC,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC;IAC9B,MAAM,OAAO,GAAG,EAAE,IAAI,aAAa,OAAO,EAAE,CAAC;IAC7C,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,mBAAmB,OAAO,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IACpE,MAAM,WAAW,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC;IACtF,MAAM,WAAW,GAAG;QAClB,iBAAiB;QACjB,QAAQ,IAAI,wBAAwB;QACpC,QAAQ,IAAI,2BAA2B;QACvC,SAAS;KACV;SACE,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAC;IAEb,OAAO,CACL,6BAAK,SAAS,EAAE,WAAW;QAEzB,6BAAK,SAAS,EAAC,4BAA4B;YACzC,+BAAO,SAAS,EAAC,wBAAwB,EAAC,OAAO,EAAE,OAAO,IACvD,KAAK,CACA;YACP,QAAQ,IAAI,8BAAM,SAAS,EAAC,2BAA2B,iBAAkB;YACzE,QAAQ,IAAI,CACX,gCACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,4BAA4B,EACtC,OAAO,EAAE,WAAW,gBACT,kBAAkB;gBAE7B,oBAAC,eAAe,IAAC,IAAI,EAAE,EAAE,GAAI,CACtB,CACV,CACG;QAGN,6BAAK,SAAS,EAAC,wBAAwB;YACrC,6BAAK,SAAS,EAAC,wBAAwB;gBACrC,kCACM,UAAU,EACd,GAAG,EAAE,GAAG,EACR,SAAS,EAAC,wBAAwB,EAClC,EAAE,EAAE,OAAO,EACX,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,kBACJ,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,sBACzB,WAAW,GAC7B;gBACD,IAAI,IAAI,8BAAM,SAAS,EAAC,uBAAuB,IAAE,IAAI,CAAQ,CAC1D,CACF;QAGL,QAAQ,IAAI,CACX,6BAAK,SAAS,EAAC,wBAAwB,EAAC,EAAE,EAAE,OAAO;YACjD,8BAAM,SAAS,EAAC,6BAA6B;gBAC3C,oBAAC,iBAAiB,IAAC,IAAI,EAAE,EAAE,GAAI,CAC1B;YACP,8BAAM,SAAS,EAAC,6BAA6B,IAAE,SAAS,CAAQ,CAC5D,CACP,CACG,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { InputField } from './InputField.js';
2
+ export type { InputFieldProps, InputFieldState } from './InputField.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/InputField/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { InputField } from './InputField.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/InputField/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}