@cosxai/ui 0.2.0 → 0.2.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosxai/ui",
3
- "version": "0.2.0",
3
+ "version": "0.2.3",
4
4
  "description": "COSX design system — React 19 component primitives shared across product-meta and other consumers",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -38,10 +38,15 @@ export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>,
38
38
  const ADDON_STYLE = {
39
39
  display: "inline-flex",
40
40
  alignItems: "center",
41
- padding: "0 10px",
41
+ padding: "0 12px",
42
42
  font: "400 13px/1 var(--ck-font-mono, var(--ck-font-sans))",
43
- color: "var(--ck-text-tertiary)",
44
- background: "var(--ck-bg-subtle, transparent)",
43
+ color: "var(--ck-text-secondary)",
44
+ // `--ck-bg-muted` is the canonical "slightly recessed slab"
45
+ // background — gives the addon visible separation from the input
46
+ // (`--ck-bg-surface`) without needing a hard divider line. The
47
+ // bg shift carries across all chromes; tokens.css defines a
48
+ // muted tone per chrome (light + dark).
49
+ background: "var(--ck-bg-muted)",
45
50
  whiteSpace: "nowrap" as const,
46
51
  userSelect: "none" as const,
47
52
  };
@@ -71,7 +76,7 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(function Input(
71
76
  style={{
72
77
  flex: hasAddon ? "1 1 auto" : undefined,
73
78
  minWidth: 0,
74
- height: hasAddon ? "100%" : 34,
79
+ height: hasAddon ? "100%" : 36,
75
80
  padding: "0 12px",
76
81
  font: "400 13px/1 var(--ck-font-sans)",
77
82
  background: "var(--ck-bg-surface)",
@@ -110,7 +115,7 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(function Input(
110
115
  style={{
111
116
  display: "flex",
112
117
  alignItems: "stretch",
113
- height: 34,
118
+ height: 36,
114
119
  background: "var(--ck-bg-surface)",
115
120
  border: fieldBorder,
116
121
  borderRadius: fieldRadius,
@@ -118,25 +123,13 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(function Input(
118
123
  }}
119
124
  >
120
125
  {prefix != null && (
121
- <span
122
- className="ck-input-addon ck-input-addon--prefix"
123
- style={{
124
- ...ADDON_STYLE,
125
- borderRight: "1px solid var(--ck-border-subtle)",
126
- }}
127
- >
126
+ <span className="ck-input-addon ck-input-addon--prefix" style={ADDON_STYLE}>
128
127
  {prefix}
129
128
  </span>
130
129
  )}
131
130
  {inputEl}
132
131
  {suffix != null && (
133
- <span
134
- className="ck-input-addon ck-input-addon--suffix"
135
- style={{
136
- ...ADDON_STYLE,
137
- borderLeft: "1px solid var(--ck-border-subtle)",
138
- }}
139
- >
132
+ <span className="ck-input-addon ck-input-addon--suffix" style={ADDON_STYLE}>
140
133
  {suffix}
141
134
  </span>
142
135
  )}
@@ -75,7 +75,12 @@ html[data-ck-chrome="swiss"] .ck-btn--ghost:hover:not(:disabled) {
75
75
 
76
76
  /* ===== Inputs — bottom-border-only (canonical Swiss form) === */
77
77
 
78
- html[data-ck-chrome="swiss"] .ck-input,
78
+ /* :not(.ck-input--with-addon) — when the input is inside a
79
+ prefix/suffix wrapper the wrapper carries the border + padding,
80
+ and stripping the input's own padding makes the placeholder
81
+ collide with the addon. The addon variant gets the swiss
82
+ underline only at the OUTER wrap level (rule further down). */
83
+ html[data-ck-chrome="swiss"] .ck-input:not(.ck-input--with-addon),
79
84
  html[data-ck-chrome="swiss"] .ck-textarea {
80
85
  background: transparent !important;
81
86
  border: none !important;
@@ -86,7 +91,7 @@ html[data-ck-chrome="swiss"] .ck-textarea {
86
91
  color: var(--ck-text-primary);
87
92
  transition: border-bottom-color 120ms ease, border-bottom-width 120ms ease;
88
93
  }
89
- html[data-ck-chrome="swiss"] .ck-input:focus-visible,
94
+ html[data-ck-chrome="swiss"] .ck-input:not(.ck-input--with-addon):focus-visible,
90
95
  html[data-ck-chrome="swiss"] .ck-textarea:focus-visible {
91
96
  outline: none;
92
97
  border-bottom-color: var(--ck-text-primary) !important;
@@ -94,6 +99,26 @@ html[data-ck-chrome="swiss"] .ck-textarea:focus-visible {
94
99
  box-shadow: none !important;
95
100
  }
96
101
 
102
+ /* Addon variant — flatten the wrapper to the swiss underline-only
103
+ form so the whole field (input + addons) reads as one bar. The
104
+ inner .ck-input keeps its default padding; the wrap loses its
105
+ side / top borders and its corner radius. */
106
+ html[data-ck-chrome="swiss"] .ck-input-addon-wrap {
107
+ border: none !important;
108
+ border-bottom: 1px solid var(--ck-border-subtle) !important;
109
+ border-radius: 0 !important;
110
+ background: transparent !important;
111
+ }
112
+ html[data-ck-chrome="swiss"] .ck-input-addon-wrap:focus-within {
113
+ border-bottom-color: var(--ck-text-primary) !important;
114
+ border-bottom-width: 2px !important;
115
+ }
116
+ /* Recess the addon further so the slab still reads against the
117
+ underlined input column. */
118
+ html[data-ck-chrome="swiss"] .ck-input-addon {
119
+ background: var(--ck-bg-muted) !important;
120
+ }
121
+
97
122
  /* ===== Cards — rules-only sectioning ======================== */
98
123
 
99
124
  html[data-ck-chrome="swiss"] .ck-card {