Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial box (heavily inspired by shopify Box) #2195

Merged
merged 116 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
a8e0a17
initial box (heavily inspired by shopify Box)
JulianNymark Aug 21, 2023
73b8493
:art: Theming-demo
KenAJoh Aug 22, 2023
ae2cf8d
rm printHidden prop
larseirikhansen Aug 23, 2023
3307f0c
sr-only: clip is deprecated, adding clip-path
larseirikhansen Aug 23, 2023
47e5779
setting up padding story box primitive
larseirikhansen Aug 23, 2023
0e78157
95% complete padding example for Box (dynamic css code unfolding with…
JulianNymark Aug 23, 2023
6095451
Merge remote-tracking branch 'origin/main' into primitives-box
larseirikhansen Aug 24, 2023
2c5c4c8
WIP on padding/margin for box
JulianNymark Aug 24, 2023
3a42c58
working box padding/block/inline/margin?
JulianNymark Aug 24, 2023
d4666f6
remove console.log
JulianNymark Aug 24, 2023
422b587
story for Box, copy implementation from padding to apply to margin as…
JulianNymark Aug 24, 2023
6318832
remove unwanted props on Box
JulianNymark Aug 25, 2023
bf1c8d4
refactor semantic-colors.json, use json import for types in Box.tsx
JulianNymark Aug 25, 2023
311b6cd
squashme
JulianNymark Aug 25, 2023
df60dc2
Box: working border & background
JulianNymark Aug 28, 2023
bafa6c3
Merge branch 'main' into primitives-box
JulianNymark Aug 28, 2023
6731bd4
:fire: remove props on Box we will not implement in v1
JulianNymark Aug 28, 2023
31fe8c6
refactoring / less things needed (no margin) and things that are brok…
JulianNymark Aug 28, 2023
2a73c1c
:bug: fix erroneous padding assignment (a flipped index)
JulianNymark Aug 29, 2023
30c1b38
fully recreated LinkPanel
JulianNymark Aug 29, 2023
2a034db
box: add all borderRadius props
JulianNymark Aug 29, 2023
e4b1d54
box: complete example for chat bubbles
JulianNymark Aug 29, 2023
bc8a5a4
:memo: refactor box hover props to be an object instead
JulianNymark Aug 29, 2023
a949165
checkout main yarn.lock
JulianNymark Aug 30, 2023
efaf8ea
Merge branch 'main' into primitives-box
JulianNymark Aug 30, 2023
48a1b9e
yarn changeset
JulianNymark Aug 30, 2023
9c9283f
:memo: add jsdoc for Box
JulianNymark Aug 30, 2023
2ebe176
:memo: add token documentation
JulianNymark Aug 30, 2023
704d217
:construction: Box: add barrel file
JulianNymark Aug 30, 2023
2890eee
:fire: remove overriding tokens for Box
JulianNymark Aug 31, 2023
f56fb2e
Merge branch 'main' into primitives-box
JulianNymark Aug 31, 2023
793779a
:recycle: refactor the borderRadius API
JulianNymark Aug 31, 2023
7db8ba6
:fire: remove console.logs
JulianNymark Sep 1, 2023
68c9377
bump ts version (make them all equal)
JulianNymark Sep 1, 2023
675865e
fix new type error that surfaced when upgrading TS
JulianNymark Sep 1, 2023
56824ee
add yarn.lock
JulianNymark Sep 1, 2023
ca09f3c
:construction: testing with older TS version again
JulianNymark Sep 1, 2023
9ac795c
Revert ":construction: testing with older TS version again"
JulianNymark Sep 1, 2023
f9dd5ea
add minimum permissions check utility (official github action)
JulianNymark Sep 1, 2023
0faa6c4
Revert "add minimum permissions check utility (official github action)"
JulianNymark Sep 1, 2023
2ff7e06
test with "read-all|write-all" for a chromatic.yml action
JulianNymark Sep 1, 2023
28eceb4
remove unused comments
JulianNymark Sep 1, 2023
ccf4711
:construction: try skip a test suite
JulianNymark Sep 1, 2023
fb31064
:construction: update yarn.lock
JulianNymark Sep 1, 2023
ca37c96
Revert ":construction: try skip a test suite"
JulianNymark Sep 1, 2023
ff5f717
:construction: update all node-version to 19
JulianNymark Sep 1, 2023
685735b
:boom: Force-tester GHA
KenAJoh Sep 1, 2023
0586321
Merge
KenAJoh Sep 1, 2023
2b90fa7
:boom: bump node-version to 20
JulianNymark Sep 1, 2023
95c7345
Merge branch 'primitives-box' of github.com:navikt/aksel into primiti…
JulianNymark Sep 1, 2023
9969473
:boom: test with jsonModules again, but this time with node v20
JulianNymark Sep 1, 2023
7941267
:construction: revert type erasure (for tests)
JulianNymark Sep 1, 2023
d5e24a2
Merge branch 'main' into primitives-box
KenAJoh Sep 3, 2023
029fd3b
Merge branch 'main' into primitives-box
JulianNymark Sep 4, 2023
4e57614
Merge branch 'primitives-box' of github.com:navikt/aksel into primiti…
JulianNymark Sep 4, 2023
b957d1c
:fire: remove hover from Box
JulianNymark Sep 4, 2023
c686bca
:construction: test with module identifier import
JulianNymark Sep 4, 2023
98b1817
:construction: squashme
JulianNymark Sep 4, 2023
f5f7b8c
a working token type solution
JulianNymark Sep 5, 2023
cbf159f
:memo: group Primitives in storybook
JulianNymark Sep 5, 2023
e3f1734
Merge branch 'main' into primitives-box
JulianNymark Sep 5, 2023
d1bbdbb
no longer assert type, hint instead
JulianNymark Sep 5, 2023
8d92f43
:memo: improve jsdoc for Box
JulianNymark Sep 5, 2023
96e389b
:memo: improve jsdoc for Box
JulianNymark Sep 5, 2023
8c857dd
:construction: test relative import for github action
JulianNymark Sep 5, 2023
4ca46de
:construction: test ordering of yarn builds
JulianNymark Sep 5, 2023
8c4727a
:construction: test ordering of yarn workspaces
JulianNymark Sep 5, 2023
24a7d88
:construction: test dependency for yarn workspaces
JulianNymark Sep 6, 2023
31498b0
:bug: fix human error in token refactoring
JulianNymark Sep 6, 2023
6ec78fb
:memo: reword jsdoc
JulianNymark Sep 6, 2023
7fba1b9
:recycle: refactor
JulianNymark Sep 6, 2023
3e695d8
:construction: test again with module identifier import
JulianNymark Sep 6, 2023
eb19f30
squashme
JulianNymark Sep 6, 2023
1b2e4e4
:construction: fully revert to importing .json
JulianNymark Sep 6, 2023
2998c9d
:construction: remove duplicate types
JulianNymark Sep 6, 2023
6833d96
:fire: remove style-dicitonary format (now unused), fix shadow.json refs
JulianNymark Sep 6, 2023
2a52a3e
remove devDependency on tokens (for react)
JulianNymark Sep 6, 2023
31c8711
:memo::recycle: update comments & naming
JulianNymark Sep 6, 2023
7c079fe
Merge branch 'main' into primitives-box
JulianNymark Sep 6, 2023
f7d6a63
Merge branch 'main' into primitives-box
KenAJoh Sep 7, 2023
00ea74a
Merge branch 'main' into primitives-box
JulianNymark Sep 7, 2023
8db55d5
:truck: Oppdatert CSS-config etter ny primitives gruppering
KenAJoh Sep 7, 2023
107aef5
make border-color also control border-style
JulianNymark Sep 8, 2023
0a2bcd0
Merge branch 'primitives-box' of github.com:navikt/aksel into primiti…
JulianNymark Sep 8, 2023
9291790
Merge branch 'main' into primitives-box
JulianNymark Sep 8, 2023
f4eec2d
add examples for Box to aksel.nav.no
JulianNymark Sep 8, 2023
232b5f2
Merge branch 'main' into primitives-box
KenAJoh Sep 11, 2023
424ea52
:arrow_up: Yarn sort av dependencies
KenAJoh Sep 11, 2023
14bb9fe
:art: BorderWidth tokens
KenAJoh Sep 11, 2023
d01d347
:art: Css for borderRadius
KenAJoh Sep 11, 2023
f6b990f
:art: Setup responsiveRadius utility
KenAJoh Sep 11, 2023
a207bfe
:recycle: Forenklet borderRadius
KenAJoh Sep 11, 2023
aa18a9e
:art: refactor padding in box
KenAJoh Sep 11, 2023
ad301d8
:fire: Fjernet unødvendig kode
KenAJoh Sep 11, 2023
6c3fb78
:art: Oppdatert token for borderWidth
KenAJoh Sep 11, 2023
aec7028
:bug: Default 0px border
KenAJoh Sep 11, 2023
08c7219
:label: Refactor types
KenAJoh Sep 11, 2023
db73ffd
:bug: Fikset stories
KenAJoh Sep 11, 2023
cfe67f6
:recycle: refactor away one of the getResponsiveProps(), renaming
JulianNymark Sep 11, 2023
078b670
:recycle: refactor + add token exceptions
JulianNymark Sep 11, 2023
4f2c793
Merge branch 'main' into primitives-box
JulianNymark Sep 11, 2023
4ec01bd
:bug: new props based on BoxProps
JulianNymark Sep 11, 2023
69d22f6
:memo: Oppdatert box-eksempler
KenAJoh Sep 11, 2023
8f73cd2
:memo: border-eksempler
KenAJoh Sep 11, 2023
130abdd
:memo: shadow-eksempel
KenAJoh Sep 11, 2023
2d4a086
:memo: header demo
KenAJoh Sep 11, 2023
af4136d
:fire: Fjernet theming demo, la til panel-demo
KenAJoh Sep 11, 2023
a804fcd
:truck: Flyttet show/hide inn i primitives
KenAJoh Sep 11, 2023
9c92576
:truck: extract stateful colors to separate files
JulianNymark Sep 12, 2023
0bae3cb
:truck: move shadow stateful tokens as well
JulianNymark Sep 12, 2023
ae80e28
:recycle: rename some Box types
JulianNymark Sep 12, 2023
95a86d6
:truck: re-add missing token
JulianNymark Sep 12, 2023
d86a817
:truck: move types file to utils, (bonus: fix some jsdoc)
JulianNymark Sep 12, 2023
997508a
:heavy_plus_sign: add @navikt/ds-tokens to react
JulianNymark Sep 12, 2023
5aab3b2
Update .changeset/happy-pianos-cheat.md
KenAJoh Sep 12, 2023
d7d1ac1
Merge branch 'main' into primitives-box
KenAJoh Sep 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/happy-pianos-cheat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@navikt/ds-tokens": minor
"@navikt/ds-react": minor
"@navikt/ds-css": minor
---

Box: Ny primitive, erstatter dagens `Panel`
2 changes: 2 additions & 0 deletions @navikt/core/css/baseline/_utilities.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
.navds-sr-only {
border: 0;
clip: rect(0, 0, 0, 0);
clip-path: inset(50%);
JulianNymark marked this conversation as resolved.
Show resolved Hide resolved
height: 1px;
margin: -1px;
overflow: hidden;
Expand All @@ -50,6 +51,7 @@
.navds-sr-only.focusable:active,
.navds-sr-only.focusable:focus {
clip: auto;
clip-path: none;
height: auto;
margin: 0;
overflow: visible;
Expand Down
52 changes: 28 additions & 24 deletions @navikt/core/css/config/_mappings.js
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Har fikset import + config etter merge av Show/Hide PR 🚀

Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,34 @@ const StyleMappings = {
},
],
components: [
{
component: "Box",
main: primitivesCss,
},
{
component: "HGrid",
main: primitivesCss,
},
{
component: "HStack",
main: primitivesCss,
},
{
component: "VStack",
main: primitivesCss,
},
{
component: "Spacer",
main: primitivesCss,
},
{
component: "Show",
main: primitivesCss,
},
{
component: "Hide",
main: primitivesCss,
},
{
component: "Accordion",
main: "accordion.css",
Expand Down Expand Up @@ -100,10 +128,6 @@ const StyleMappings = {
main: "help-text.css",
dependencies: ["popover.css"],
},
{
component: "HGrid",
main: primitivesCss,
},
{ component: "Ingress", main: typoCss },
{
component: "InternalHeader",
Expand Down Expand Up @@ -139,26 +163,6 @@ const StyleMappings = {
{ component: "Select", main: formCss, dependencies: [typoCss] },
{ component: "Skeleton", main: "skeleton.css", dependencies: [] },
{ component: "Stepper", main: "stepper.css", dependencies: [typoCss] },
{
component: "HStack",
main: primitivesCss,
},
{
component: "VStack",
main: primitivesCss,
},
{
component: "Spacer",
main: primitivesCss,
},
{
component: "Show",
main: primitivesCss,
},
{
component: "Hide",
main: primitivesCss,
},
{ component: "Switch", main: formCss, dependencies: [typoCss] },
{ component: "Table", main: "table.css", dependencies: [typoCss] },
{ component: "Tabs", main: "tabs.css", dependencies: [typoCss] },
Expand Down
117 changes: 117 additions & 0 deletions @navikt/core/css/primitives/box.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
.navds-box {
--__ac-box-padding-xs: initial;
--__ac-box-padding-sm: initial;
--__ac-box-padding-md: initial;
--__ac-box-padding-lg: initial;
--__ac-box-padding-xl: initial;
--__ac-box-padding-block-xs: initial;
--__ac-box-padding-inline-xs: initial;
--__ac-box-padding-block-sm: initial;
--__ac-box-padding-inline-sm: initial;
--__ac-box-padding-block-md: initial;
--__ac-box-padding-inline-md: initial;
--__ac-box-padding-block-lg: initial;
--__ac-box-padding-inline-lg: initial;
--__ac-box-padding-block-xl: initial;
--__ac-box-padding-inline-xl: initial;
--__ac-box-padding: var(--__ac-box-padding-xs);
--__ac-box-padding-inline: var(--__ac-box-padding-inline-xs);
--__ac-box-padding-block: var(--__ac-box-padding-block-xs);
--__ac-box-background: initial;
--__ac-box-border-color: initial;
--__ac-box-shadow: initial;
--__ac-box-border-width: initial;
--__ac-box-border-radius-xs: initial;
--__ac-box-border-radius-sm: initial;
--__ac-box-border-radius-md: initial;
--__ac-box-border-radius-lg: initial;
--__ac-box-border-radius-xl: initial;
--__ac-box-border-radius: var(--__ac-box-border-radius-xs);

padding-inline: var(--__ac-box-padding-inline, var(--__ac-box-padding));
padding-block: var(--__ac-box-padding-block, var(--__ac-box-padding));
background-color: var(--__ac-box-background);
border-style: solid;
border-color: var(--__ac-box-border-color);
border-radius: var(--__ac-box-border-radius);
box-shadow: var(--__ac-box-shadow);
border-width: var(--__ac-box-border-width, 0);
}

@media (min-width: 480px) {
.navds-box {
--__ac-box-padding: var(--__ac-box-padding-sm, var(--__ac-box-padding-xs));
--__ac-box-padding-inline: var(--__ac-box-padding-inline-sm, var(--__ac-box-padding-inline-xs));
--__ac-box-padding-block: var(--__ac-box-padding-block-sm, var(--__ac-box-padding-block-xs));
--__ac-box-border-radius: var(--__ac-box-border-radius-sm, var(--__ac-box-border-radius-xs));
}
}

@media (min-width: 768px) {
.navds-box {
--__ac-box-padding: var(--__ac-box-padding-md, var(--__ac-box-padding-sm, var(--__ac-box-padding-xs)));
--__ac-box-padding-inline: var(
--__ac-box-padding-inline-md,
var(--__ac-box-padding-inline-sm, var(--__ac-box-padding-inline-xs))
);
--__ac-box-padding-block: var(
--__ac-box-padding-block-md,
var(--__ac-box-padding-block-sm, var(--__ac-box-padding-block-xs))
);
--__ac-box-border-radius: var(
--__ac-box-border-radius-md,
var(--__ac-box-border-radius-sm, var(--__ac-box-border-radius-xs))
);
}
}

@media (min-width: 1024px) {
.navds-box {
--__ac-box-padding: var(
--__ac-box-padding-lg,
var(--__ac-box-padding-md, var(--__ac-box-padding-sm, var(--__ac-box-padding-xs)))
);
--__ac-box-padding-inline: var(
--__ac-box-padding-inline-lg,
var(--__ac-box-padding-inline-md, var(--__ac-box-padding-inline-sm, var(--__ac-box-padding-inline-xs)))
);
--__ac-box-padding-block: var(
--__ac-box-padding-block-lg,
var(--__ac-box-padding-block-md, var(--__ac-box-padding-block-sm, var(--__ac-box-padding-block-xs)))
);
--__ac-box-border-radius: var(
--__ac-box-border-radius-lg,
var(--__ac-box-border-radius-md, var(--__ac-box-border-radius-sm, var(--__ac-box-border-radius-xs)))
);
}
}

@media (min-width: 1280px) {
.navds-box {
--__ac-box-padding: var(
--__ac-box-padding-xl,
var(--__ac-box-padding-lg, var(--__ac-box-padding-md, var(--__ac-box-padding-sm, var(--__ac-box-padding-xs))))
);
--__ac-box-padding-inline: var(
--__ac-box-padding-inline-xl,
var(
--__ac-box-padding-inline-lg,
var(--__ac-box-padding-inline-md, var(--__ac-box-padding-inline-sm, var(--__ac-box-padding-inline-xs)))
)
);
--__ac-box-padding-block: var(
--__ac-box-padding-block-xl,
var(
--__ac-box-padding-block-lg,
var(--__ac-box-padding-block-md, var(--__ac-box-padding-block-sm, var(--__ac-box-padding-block-xs)))
)
);
--__ac-box-border-radius: var(
--__ac-box-border-radius-xl,
var(
--__ac-box-border-radius-lg,
var(--__ac-box-border-radius-md, var(--__ac-box-border-radius-sm, var(--__ac-box-border-radius-xs)))
)
);
}
}
1 change: 1 addition & 0 deletions @navikt/core/css/primitives/index.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@import "box.css";
@import "hgrid.css";
@import "stack.css";
@import "responsive.css";
1 change: 1 addition & 0 deletions @navikt/core/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"dependencies": {
"@floating-ui/react": "0.24.1",
"@navikt/aksel-icons": "^5.4.1",
"@navikt/ds-tokens": "^5.4.1",
"@radix-ui/react-tabs": "1.0.0",
"@radix-ui/react-toggle-group": "1.0.0",
"clsx": "^1.2.1",
Expand Down
2 changes: 1 addition & 1 deletion @navikt/core/react/src/grid/grid.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from "react";
import { BodyLong, Grid, Cell, ContentContainer } from "../index";

export default {
title: "ds-react/Grid",
title: "ds-react/Primitives/Grid",
component: { Grid, Cell },
parameters: {
layout: "fullscreen",
Expand Down
1 change: 1 addition & 0 deletions @navikt/core/react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export * from "./toggle-group";
export * from "./tooltip";
export * from "./typography";
export * from "./util";
export * from "./layout/box";
export * from "./layout/stack";
export * from "./layout/grid";
export * from "./layout/content-container";
Expand Down
Loading