@freightos/freightwind 2.1.2 → 2.1.3-host-isolation.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.
@@ -0,0 +1,293 @@
1
+ /* @freightos/freightwind/host-isolation/webcargo.css ─────────────────────────
2
+ *
3
+ * Cancellation sheet for the WebCargo host's global CSS bleed into FreightWind
4
+ * components. Opt-in: import this only when mounting FreightWind inside the
5
+ * WebCargo shell. Clean hosts (e.g. freightwind-playground, partner apps with
6
+ * no Bootstrap layer) should NOT import this file.
7
+ *
8
+ * Why this exists
9
+ * ───────────────
10
+ * WebCargo loads `bootstrap.min.css`, `bootstrap_wcn.css`, and a ~3,000-rule
11
+ * `apps.php` stylesheet that target bare element names (`h1-h6`, `p`,
12
+ * `button`, `input`, `a`, `*`, …) with specificity 0-0-1. FreightWind 2.x
13
+ * intentionally skips Tailwind's global Preflight (it uses the per-element
14
+ * `@utility fw-base` reset). The side-effect is that host element-level
15
+ * rules bleed INTO FreightWind subtrees — heading margins, paragraph
16
+ * margins, button border-radius, focus rings, list bullets, table borders.
17
+ *
18
+ * Strategy
19
+ * ────────
20
+ * Scope a Tailwind-equivalent Preflight to a `.fw-root` ancestor. Wrap the
21
+ * scope class in `:where()` so it contributes ZERO specificity — the rule
22
+ * ties with Bootstrap's bare element selectors (0-0-1) and wins by source
23
+ * order (this file loads after the host). FDS class-anchored selectors
24
+ * (`.ant-btn`, etc.) and FreightWind utility classes (loaded via
25
+ * `@layer utilities important`) keep their full specificity advantage and
26
+ * are never affected by this reset.
27
+ *
28
+ * Usage
29
+ * ─────
30
+ * import '@freightos/freightwind/tokens.css';
31
+ * import '@freightos/freightwind/host-isolation/webcargo.css';
32
+ *
33
+ * <div className="fw-root">
34
+ * <App />
35
+ * </div>
36
+ *
37
+ * Pattern is identical to Tailwind v4's official Preflight, plus a `:focus`
38
+ * cancellation keyed on FW's `.fw-base` per-element marker so the rule also
39
+ * covers FreightWind components rendered inside Radix portals (Dialog,
40
+ * Popover, Tooltip, DropdownMenu, Select) that mount outside `.fw-root`.
41
+ * ──────────────────────────────────────────────────────────────────────── */
42
+
43
+ /* 1 ── Universal box model & border reset ─────────────────────────────────── */
44
+ :where(.fw-root) *,
45
+ :where(.fw-root) *::before,
46
+ :where(.fw-root) *::after {
47
+ box-sizing: border-box;
48
+ border-width: 0;
49
+ border-style: solid;
50
+ border-color: currentColor;
51
+ }
52
+
53
+ /* 2 ── Block-level margins ───────────────────────────────────────────────────
54
+ Bootstrap adds margin-bottom to h1–h6, p, pre, blockquote, dl, dd, figure. */
55
+ :where(.fw-root) blockquote,
56
+ :where(.fw-root) dl,
57
+ :where(.fw-root) dd,
58
+ :where(.fw-root) h1,
59
+ :where(.fw-root) h2,
60
+ :where(.fw-root) h3,
61
+ :where(.fw-root) h4,
62
+ :where(.fw-root) h5,
63
+ :where(.fw-root) h6,
64
+ :where(.fw-root) hr,
65
+ :where(.fw-root) figure,
66
+ :where(.fw-root) p,
67
+ :where(.fw-root) pre,
68
+ :where(.fw-root) fieldset {
69
+ margin: 0;
70
+ padding: 0;
71
+ }
72
+
73
+ /* 3 ── Headings — strip Bootstrap font-size/weight/line-height overrides ────
74
+ Bootstrap 4 sets h1=2.5rem, h2=2rem … h6=1rem, all with font-weight:500.
75
+ FreightWind components set their own heading styles via Tailwind utilities. */
76
+ :where(.fw-root) h1,
77
+ :where(.fw-root) h2,
78
+ :where(.fw-root) h3,
79
+ :where(.fw-root) h4,
80
+ :where(.fw-root) h5,
81
+ :where(.fw-root) h6 {
82
+ font-size: inherit;
83
+ font-weight: inherit;
84
+ line-height: inherit;
85
+ }
86
+
87
+ /* 4 ── Lists ─────────────────────────────────────────────────────────────────
88
+ Bootstrap adds margin-bottom:1rem to ol/ul and sets list-style-type. */
89
+ :where(.fw-root) ol,
90
+ :where(.fw-root) ul,
91
+ :where(.fw-root) menu {
92
+ list-style: none;
93
+ margin: 0;
94
+ padding: 0;
95
+ }
96
+
97
+ /* 5 ── Links — strip Bootstrap link color (#337ab7) and underline rules ───── */
98
+ :where(.fw-root) a {
99
+ color: inherit;
100
+ text-decoration: inherit;
101
+ }
102
+
103
+ /* 6 ── LABEL — Bootstrap sets `display:inline-block; margin-bottom:.5rem` ────
104
+ Resetting to `display:block; margin:0` restores the FreightWind layout.
105
+ FDS / Ant labels carry their own class (.ant-form-item-label, 0-1-0) and
106
+ beat this reset, so they keep their styling. */
107
+ :where(.fw-root) label {
108
+ display: block;
109
+ margin: 0;
110
+ font-weight: inherit;
111
+ font-size: inherit;
112
+ }
113
+
114
+ /* 7 ── Form controls ─────────────────────────────────────────────────────────
115
+ Bootstrap and browsers set font, margin, and padding on inputs/buttons that
116
+ differ from the page font. Inherit from the FW root instead. */
117
+ :where(.fw-root) button,
118
+ :where(.fw-root) input,
119
+ :where(.fw-root) optgroup,
120
+ :where(.fw-root) select,
121
+ :where(.fw-root) textarea {
122
+ font-family: inherit;
123
+ font-feature-settings: inherit;
124
+ font-variation-settings: inherit;
125
+ font-size: 100%;
126
+ font-weight: inherit;
127
+ line-height: inherit;
128
+ letter-spacing: inherit;
129
+ color: inherit;
130
+ margin: 0;
131
+ padding: 0;
132
+ }
133
+
134
+ :where(.fw-root) button,
135
+ :where(.fw-root) select {
136
+ text-transform: none;
137
+ }
138
+
139
+ /* Bootstrap 4 adds background gradients and border-radius to buttons. */
140
+ :where(.fw-root) button,
141
+ :where(.fw-root) input:where([type='button']),
142
+ :where(.fw-root) input:where([type='reset']),
143
+ :where(.fw-root) input:where([type='submit']) {
144
+ -webkit-appearance: button;
145
+ background-color: transparent;
146
+ background-image: none;
147
+ }
148
+
149
+ :where(.fw-root) :-moz-focusring {
150
+ outline: auto;
151
+ }
152
+
153
+ :where(.fw-root) :-moz-ui-invalid {
154
+ box-shadow: none;
155
+ }
156
+
157
+ :where(.fw-root) progress {
158
+ vertical-align: baseline;
159
+ }
160
+
161
+ :where(.fw-root) ::-webkit-inner-spin-button,
162
+ :where(.fw-root) ::-webkit-outer-spin-button {
163
+ height: auto;
164
+ }
165
+
166
+ :where(.fw-root) [type='search'] {
167
+ -webkit-appearance: textfield;
168
+ outline-offset: -2px;
169
+ }
170
+
171
+ :where(.fw-root) ::-webkit-search-decoration {
172
+ -webkit-appearance: none;
173
+ }
174
+
175
+ :where(.fw-root) ::-webkit-file-upload-button {
176
+ -webkit-appearance: button;
177
+ font: inherit;
178
+ }
179
+
180
+ :where(.fw-root) summary {
181
+ display: list-item;
182
+ }
183
+
184
+ /* 8 ── Tables ────────────────────────────────────────────────────────────────
185
+ Bootstrap adds border-spacing and td borders; collapse restores clean table. */
186
+ :where(.fw-root) table {
187
+ text-indent: 0;
188
+ border-color: inherit;
189
+ border-collapse: collapse;
190
+ }
191
+
192
+ /* 9 ── Typography ──────────────────────────────────────────────────────────── */
193
+ :where(.fw-root) b,
194
+ :where(.fw-root) strong {
195
+ font-weight: bolder;
196
+ }
197
+
198
+ :where(.fw-root) code,
199
+ :where(.fw-root) kbd,
200
+ :where(.fw-root) samp,
201
+ :where(.fw-root) pre {
202
+ font-size: 1em;
203
+ }
204
+
205
+ :where(.fw-root) small {
206
+ font-size: 80%;
207
+ }
208
+
209
+ :where(.fw-root) sub,
210
+ :where(.fw-root) sup {
211
+ font-size: 75%;
212
+ line-height: 0;
213
+ position: relative;
214
+ vertical-align: baseline;
215
+ }
216
+
217
+ :where(.fw-root) sub { bottom: -0.25em; }
218
+ :where(.fw-root) sup { top: -0.5em; }
219
+
220
+ /* 10 ── Media ────────────────────────────────────────────────────────────────
221
+ Bootstrap sets `svg { overflow:hidden; vertical-align:middle }` which is
222
+ inline, leaving white-space gaps. Tailwind preflight uses display:block. */
223
+ :where(.fw-root) img,
224
+ :where(.fw-root) svg,
225
+ :where(.fw-root) video,
226
+ :where(.fw-root) canvas,
227
+ :where(.fw-root) audio,
228
+ :where(.fw-root) iframe,
229
+ :where(.fw-root) embed,
230
+ :where(.fw-root) object {
231
+ display: block;
232
+ vertical-align: middle;
233
+ }
234
+
235
+ :where(.fw-root) img,
236
+ :where(.fw-root) video {
237
+ max-width: 100%;
238
+ height: auto;
239
+ }
240
+
241
+ /* 11 ── Misc ──────────────────────────────────────────────────────────────── */
242
+ :where(.fw-root) textarea {
243
+ resize: vertical;
244
+ }
245
+
246
+ :where(.fw-root) input::placeholder,
247
+ :where(.fw-root) textarea::placeholder {
248
+ opacity: 1;
249
+ color: #9ca3af;
250
+ }
251
+
252
+ :where(.fw-root) button,
253
+ :where(.fw-root) [role='button'] {
254
+ cursor: pointer;
255
+ }
256
+
257
+ :where(.fw-root) :disabled {
258
+ cursor: default;
259
+ }
260
+
261
+ :where(.fw-root) [hidden]:not([hidden='until-found']) {
262
+ display: none;
263
+ }
264
+
265
+ /* 12 ── Cancel host `:focus` bleed-through ──────────────────────────────────
266
+ Bootstrap sets `button:focus { outline: 5px auto -webkit-focus-ring-color }`
267
+ and `.btn:focus { box-shadow: 0 0 0 .2rem rgba(0,123,255,.25) }`. Both
268
+ target generic focusable elements and beat FreightWind utilities that
269
+ don't explicitly counter the property.
270
+
271
+ We *cancel* the host bleed without imposing a replacement ring — that
272
+ would hardcode an outline style at the isolation layer and drift from
273
+ FreightWind's own focus tokens whenever FW evolves. Two clean outcomes:
274
+
275
+ 1. FW components carry `focus-visible:outline-none focus-visible:ring-*`
276
+ utilities loaded via `@layer utilities important` (so `!important`).
277
+ Those utilities beat this reset and FW components render their own
278
+ ring exactly as the design system specifies. ✓
279
+ 2. Native / non-FW focusables fall back to the browser's UA
280
+ `:focus-visible` default — never visually out-of-sync with FW because
281
+ we never set a competing value. ✓
282
+
283
+ The `.fw-base:focus` arm catches FW components rendered inside Radix
284
+ portals (Dialog, Popover, Tooltip, DropdownMenu, Select) — those mount
285
+ under `<body>` outside `.fw-root`, so a scope-only rule would miss them.
286
+ `.fw-base` travels with every FW-rendered native element. */
287
+ :where(.fw-root) :is(
288
+ button, [role="button"], a, input, select, textarea, [tabindex], summary
289
+ ):focus,
290
+ .fw-base:focus {
291
+ outline: 0;
292
+ box-shadow: none;
293
+ }
package/package.json CHANGED
@@ -1,102 +1,104 @@
1
- {
2
- "name": "@freightos/freightwind",
3
- "version": "2.1.2",
4
- "private": false,
5
- "description": "FreightWind Design System — icons, constants, and utilities for Freightos applications",
6
- "main": "./dist/cjs/index.js",
7
- "module": "./dist/esm/index.js",
8
- "types": "./dist/types/index.d.ts",
9
- "exports": {
10
- ".": {
11
- "types": "./dist/types/index.d.ts",
12
- "import": "./dist/esm/index.js",
13
- "require": "./dist/cjs/index.js"
14
- },
15
- "./icons": {
16
- "types": "./dist/types/icons/index.d.ts",
17
- "import": "./dist/esm/icons/index.js",
18
- "require": "./dist/cjs/icons/index.js"
19
- },
20
- "./constants": {
21
- "types": "./dist/types/constants/index.d.ts",
22
- "import": "./dist/esm/constants/index.js",
23
- "require": "./dist/cjs/constants/index.js"
24
- },
25
- "./tokens.css": "./tokens.css",
26
- "./package.json": "./package.json"
27
- },
28
- "typesVersions": {
29
- "*": {
30
- "icons": [
31
- "./dist/types/icons/index.d.ts"
32
- ],
33
- "constants": [
34
- "./dist/types/constants/index.d.ts"
35
- ]
36
- }
37
- },
38
- "files": [
39
- "dist",
40
- "tokens.css",
41
- "guidelines",
42
- "README.md",
43
- "LICENSE"
44
- ],
45
- "sideEffects": [
46
- "*.css"
47
- ],
48
- "scripts": {
49
- "build": "npm run clean && npm run build:esm && npm run build:cjs && npm run build:types",
50
- "build:esm": "tsc --project tsconfig.esm.json",
51
- "build:cjs": "tsc --project tsconfig.cjs.json",
52
- "build:types": "tsc --project tsconfig.types.json",
53
- "clean": "rm -rf dist",
54
- "sync": "bash scripts/sync.sh",
55
- "fetch-icons": "node scripts/fetch-figma-icons.js",
56
- "generate": "node scripts/generate-icons.js",
57
- "prepublishOnly": "npm run build",
58
- "release:patch": "npm version patch && npm publish --access public && git push --follow-tags",
59
- "release:minor": "npm version minor && npm publish --access public && git push --follow-tags",
60
- "release:major": "npm version major && npm publish --access public && git push --follow-tags",
61
- "publish:dry": "npm publish --dry-run --access public"
62
- },
63
- "keywords": [
64
- "design-system",
65
- "react",
66
- "components",
67
- "icons",
68
- "freightos",
69
- "freightwind",
70
- "ui",
71
- "typescript",
72
- "tailwindcss"
73
- ],
74
- "author": "Jiries Nasrawi <jiries@freightos.com>",
75
- "license": "MIT",
76
- "repository": {
77
- "type": "git",
78
- "url": "https://Jeries_Nasrawi@bitbucket.org/freightos/freightwind.git"
79
- },
80
- "devDependencies": {
81
- "@types/node": "^20.10.0",
82
- "@types/react": "^19",
83
- "@types/react-dom": "^19",
84
- "typescript": "^5.3.3"
85
- },
86
- "peerDependencies": {
87
- "react": ">=18",
88
- "react-dom": ">=18"
89
- },
90
- "peerDependenciesMeta": {
91
- "react": {
92
- "optional": false
93
- },
94
- "react-dom": {
95
- "optional": false
96
- }
97
- },
98
- "dependencies": {
99
- "clsx": "^2.1.1",
100
- "tailwind-merge": "^3.4.0"
101
- }
102
- }
1
+ {
2
+ "name": "@freightos/freightwind",
3
+ "version": "2.1.3-host-isolation.0",
4
+ "private": false,
5
+ "description": "FreightWind Design System — icons, constants, and utilities for Freightos applications",
6
+ "main": "./dist/cjs/index.js",
7
+ "module": "./dist/esm/index.js",
8
+ "types": "./dist/types/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/types/index.d.ts",
12
+ "import": "./dist/esm/index.js",
13
+ "require": "./dist/cjs/index.js"
14
+ },
15
+ "./icons": {
16
+ "types": "./dist/types/icons/index.d.ts",
17
+ "import": "./dist/esm/icons/index.js",
18
+ "require": "./dist/cjs/icons/index.js"
19
+ },
20
+ "./constants": {
21
+ "types": "./dist/types/constants/index.d.ts",
22
+ "import": "./dist/esm/constants/index.js",
23
+ "require": "./dist/cjs/constants/index.js"
24
+ },
25
+ "./tokens.css": "./tokens.css",
26
+ "./host-isolation/webcargo.css": "./host-isolation/webcargo.css",
27
+ "./package.json": "./package.json"
28
+ },
29
+ "typesVersions": {
30
+ "*": {
31
+ "icons": [
32
+ "./dist/types/icons/index.d.ts"
33
+ ],
34
+ "constants": [
35
+ "./dist/types/constants/index.d.ts"
36
+ ]
37
+ }
38
+ },
39
+ "files": [
40
+ "dist",
41
+ "tokens.css",
42
+ "host-isolation",
43
+ "guidelines",
44
+ "README.md",
45
+ "LICENSE"
46
+ ],
47
+ "sideEffects": [
48
+ "*.css"
49
+ ],
50
+ "scripts": {
51
+ "build": "npm run clean && npm run build:esm && npm run build:cjs && npm run build:types",
52
+ "build:esm": "tsc --project tsconfig.esm.json",
53
+ "build:cjs": "tsc --project tsconfig.cjs.json",
54
+ "build:types": "tsc --project tsconfig.types.json",
55
+ "clean": "rm -rf dist",
56
+ "sync": "bash scripts/sync.sh",
57
+ "fetch-icons": "node scripts/fetch-figma-icons.js",
58
+ "generate": "node scripts/generate-icons.js",
59
+ "prepublishOnly": "npm run build",
60
+ "release:patch": "npm version patch && npm publish --access public && git push --follow-tags",
61
+ "release:minor": "npm version minor && npm publish --access public && git push --follow-tags",
62
+ "release:major": "npm version major && npm publish --access public && git push --follow-tags",
63
+ "publish:dry": "npm publish --dry-run --access public"
64
+ },
65
+ "keywords": [
66
+ "design-system",
67
+ "react",
68
+ "components",
69
+ "icons",
70
+ "freightos",
71
+ "freightwind",
72
+ "ui",
73
+ "typescript",
74
+ "tailwindcss"
75
+ ],
76
+ "author": "Jiries Nasrawi <jiries@freightos.com>",
77
+ "license": "MIT",
78
+ "repository": {
79
+ "type": "git",
80
+ "url": "https://Jeries_Nasrawi@bitbucket.org/freightos/freightwind.git"
81
+ },
82
+ "devDependencies": {
83
+ "@types/node": "^20.10.0",
84
+ "@types/react": "^19",
85
+ "@types/react-dom": "^19",
86
+ "typescript": "^5.3.3"
87
+ },
88
+ "peerDependencies": {
89
+ "react": ">=18",
90
+ "react-dom": ">=18"
91
+ },
92
+ "peerDependenciesMeta": {
93
+ "react": {
94
+ "optional": false
95
+ },
96
+ "react-dom": {
97
+ "optional": false
98
+ }
99
+ },
100
+ "dependencies": {
101
+ "clsx": "^2.1.1",
102
+ "tailwind-merge": "^3.4.0"
103
+ }
104
+ }