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

css modules #1302

Merged
merged 73 commits into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
04534c9
wip
mayank99 May 18, 2023
63949ff
Merge branch 'dev' into mayank/css-modules
mayank99 May 25, 2023
e112b9f
move inside src
mayank99 May 25, 2023
858e5de
.js in folder name
mayank99 May 25, 2023
263e3f0
move dts file out of dist
mayank99 May 25, 2023
b05246b
fix deps
mayank99 May 25, 2023
85699bb
leftover import
mayank99 May 25, 2023
8b22f87
kinda working
mayank99 May 25, 2023
40c3fbb
fix module structure
mayank99 May 30, 2023
182524f
copy files manually
mayank99 May 30, 2023
55dec6a
use vite plugin instead of script
mayank99 May 30, 2023
1ea3a0d
Merge branch 'dev' into mayank/css-modules
mayank99 May 30, 2023
23ec7b5
less verbose comments
mayank99 May 30, 2023
c8ee4b4
remove all css imports
mayank99 May 30, 2023
bd2d8a0
update "getting started" instructions
mayank99 May 30, 2023
bbc091a
update all templates
mayank99 May 30, 2023
9fe6d64
fix template styling
mayank99 May 30, 2023
55cc47c
fix storybook
mayank99 May 30, 2023
2e16a86
fix box-sizing?
mayank99 May 30, 2023
8a867ac
lint
mayank99 May 30, 2023
b8fbe35
add underscore prefix
mayank99 May 30, 2023
63551ef
Merge branch 'dev' into mayank/css-modules
mayank99 May 31, 2023
1ed88c0
add unscoped table styles
mayank99 May 31, 2023
c23814e
move scoping from `Box` to `polymorphic`
mayank99 May 31, 2023
a6debbb
fix `getContainer`
mayank99 May 31, 2023
4177e72
add Box to remaining components
mayank99 May 31, 2023
9f0762d
Merge branch 'mayank/missing-box' into mayank/css-modules
mayank99 May 31, 2023
8ad4039
remove css imports from components
mayank99 Jun 1, 2023
041cf93
add changeset
mayank99 Jun 1, 2023
45c6840
remove jest style mocks
mayank99 Jun 1, 2023
c01929e
Merge branch 'mayank/css-imports' into mayank/css-modules
mayank99 Jun 1, 2023
1a30195
minimize diff
mayank99 Jun 1, 2023
fdf82f1
oop
mayank99 Jun 1, 2023
52144fe
fix searchbox
mayank99 Jun 1, 2023
28f48d9
Merge branch 'mayank/css-imports' into mayank/css-modules
mayank99 Jun 1, 2023
096dd76
fix Flex wrapper styles
mayank99 Jun 1, 2023
d7970ab
fix ToggleSwitch styles
mayank99 Jun 1, 2023
e0ecb1b
fix Slider Track box
mayank99 Jun 1, 2023
aa98958
fix tabs querySelector
mayank99 Jun 1, 2023
cc26762
everything is border-box
mayank99 Jun 1, 2023
152ec56
avoid referencing iui classes
mayank99 Jun 1, 2023
dc7ae69
add wrappers around table sort/filter buttons
mayank99 Jun 1, 2023
c3ad631
remove empty string
mayank99 Jun 1, 2023
a633762
Merge branch 'dev' into mayank/css-imports
mayank99 Jun 6, 2023
cf0e025
remove `transfer-list.css`
mayank99 Jun 6, 2023
38470a7
Merge branch 'dev' into mayank/css-imports
mayank99 Jun 6, 2023
18a2aa8
Merge branch 'mayank/css-imports' into mayank/css-modules
mayank99 Jun 6, 2023
d3a7a93
Merge branch 'dev' into mayank/css-modules
mayank99 Jun 6, 2023
2b900ff
create cjs and esm dirs if they don't exist
mayank99 Jun 6, 2023
f212552
fix unit tests using jest mock
mayank99 Jun 6, 2023
ff9723c
fix storybook css
mayank99 Jun 6, 2023
8a4ec73
fix (most) cypress tests using different selectors
mayank99 Jun 6, 2023
e6211c7
lets also scope table i guess
mayank99 Jun 6, 2023
060889c
remove confusing styles.tsx
mayank99 Jun 6, 2023
ecd3f91
fix stylesMock
mayank99 Jun 6, 2023
a1b2f91
fix Flex styles
mayank99 Jun 6, 2023
221c51f
update Header image
mayank99 Jun 6, 2023
29d5ac9
fix Tile thumbnail
mayank99 Jun 6, 2023
ac6938c
update css images because of `border-box`
mayank99 Jun 6, 2023
f483e01
Merge branch 'dev' into mayank/css-modules
mayank99 Jun 6, 2023
86d4916
fix some more selectors
mayank99 Jun 6, 2023
bd0850a
revert header img change
mayank99 Jun 6, 2023
5625f6d
fix Tile unit test
mayank99 Jun 6, 2023
d69f216
fix submenu selector
mayank99 Jun 6, 2023
f36f7eb
clean up tabs selectors
mayank99 Jun 6, 2023
1c68dfa
fix Tabs querySelector
mayank99 Jun 6, 2023
7f5ba39
update images
mayank99 Jun 6, 2023
2177a26
pls
mayank99 Jun 7, 2023
7f1c6f7
🤬
mayank99 Jun 7, 2023
17b701d
Merge branch 'dev' into mayank/css-modules
mayank99 Jun 7, 2023
83b4eb5
add changesets
mayank99 Jun 7, 2023
215829b
update image even though it passes locally
mayank99 Jun 7, 2023
a47eac7
copyright headers
mayank99 Jun 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/storybook/src/Flex.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ export default {
<style
dangerouslySetInnerHTML={{
__html: /* css */ `
:where(.demo-flex-wrapper .iui-flex) {
:where(.demo-flex-wrapper > *) {
outline: 1px solid var(--iui-color-border);
min-height: 100px;
}
:where(.demo-flex-wrapper :not([class*='iui'])) {
:where(.demo-flex-wrapper > * > *) {
font-family: var(--iui-font-sans);
color: var(--iui-color-text);
padding: 1rem;
Expand Down
21 changes: 8 additions & 13 deletions packages/itwinui-css/src/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,6 @@
font-size: var(--iui-font-size-1);
line-height: 1.5;
font-family: var(--iui-font-sans);

// border-box on iui-root, all iui- elements and their descendants under it, excluding any nested iui-root elements
&,
:where([class*='iui-'], [class*='_iui3-']):where(:not(.iui-root)) {
&,
&::before,
&::after {
box-sizing: border-box;
}
}
}

// reset margin only for <body> element.
Expand All @@ -30,9 +20,14 @@
background-color: var(--iui-color-background-backdrop);
}

// text selection and scrollbar styling on iui-root and all elements under it
:where(.iui-root),
:where(.iui-root *) {
// box-sizing, text selection and scrollbar styling on iui-root and all elements under it
:where(.iui-root, .iui-root *) {
@include mixins.iui-text-selection;
@include mixins.iui-scrollbar;

&,
&::before,
&::after {
box-sizing: border-box;
}
}
3 changes: 2 additions & 1 deletion packages/itwinui-react/src/core/Slider/Track.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import * as React from 'react';
import { Box } from '../utils/index.js';
import type { SliderProps, TrackDisplayMode } from './Slider.js';

function shouldDisplaySegment(segmentIndex: number, mode: TrackDisplayMode) {
Expand Down Expand Up @@ -79,7 +80,7 @@ export const Track = (props: TrackProps) => {
return (
<React.Fragment key={index}>
{shouldDisplaySegment(index, trackDisplayMode) ? (
<div
<Box
className='iui-slider-track'
style={{
...(orientation === 'horizontal'
Expand Down
9 changes: 7 additions & 2 deletions packages/itwinui-react/src/core/Tabs/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
Box,
} from '../utils/index.js';
import { Tab } from './Tab.js';
import styles from '../../styles.js';

export type OverflowOptions = {
/**
Expand Down Expand Up @@ -244,7 +245,9 @@ export const Tabs = (props: TabsProps) => {
const [focusedIndex, setFocusedIndex] = React.useState<number | undefined>();
React.useEffect(() => {
if (tablistRef.current && focusedIndex !== undefined) {
const tab = tablistRef.current.querySelectorAll('.iui-tab')[focusedIndex];
const tab = tablistRef.current.querySelectorAll(`.${styles['iui-tab']}`)[
focusedIndex
];
(tab as HTMLElement)?.focus();
}
}, [focusedIndex]);
Expand All @@ -253,7 +256,9 @@ export const Tabs = (props: TabsProps) => {
useIsomorphicLayoutEffect(() => {
setHasSublabel(
type !== 'pill' && // pill tabs should never have sublabels
!!tablistRef.current?.querySelector('.iui-tab-description'), // check directly for the sublabel class
!!tablistRef.current?.querySelector(
`.${styles['iui-tab-description']}`, // check directly for the sublabel class
),
);
}, [type]);

Expand Down
6 changes: 3 additions & 3 deletions packages/itwinui-react/src/core/ToggleSwitch/ToggleSwitch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ export const ToggleSwitch = React.forwardRef((props, ref) => {

const inputElementRef = React.useRef<HTMLInputElement>(null);
const refs = useMergedRefs<HTMLInputElement>(inputElementRef, ref);
const WrapperComponent = label ? 'label' : 'div';

React.useEffect(() => {
if (inputElementRef.current && setFocus) {
inputElementRef.current.focus();
}
}, [setFocus]);
return (
<WrapperComponent
<Box
as={label ? 'label' : 'div'}
className={cx(
'iui-toggle-switch-wrapper',
{
Expand Down Expand Up @@ -118,7 +118,7 @@ export const ToggleSwitch = React.forwardRef((props, ref) => {
{label}
</Box>
)}
</WrapperComponent>
</Box>
);
}) as PolymorphicForwardRefComponent<'input', ToggleSwitchProps>;

Expand Down