Skip to content

Commit 3f07c6c

Browse files
author
Matt Shwery
authored
add resize and outline css props (#62)
1 parent d1c1958 commit 3f07c6c

File tree

8 files changed

+82
-3
lines changed

8 files changed

+82
-3
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ All of these CSS properties are support. You can pass either a string or a numbe
186186
* `minWidth`
187187
* `opacity`
188188
* `order`
189+
* `outline`
189190
* `overflow`
190191
* `overflowX`
191192
* `overflowY`
@@ -201,6 +202,7 @@ All of these CSS properties are support. You can pass either a string or a numbe
201202
* `placeSelf`
202203
* `pointerEvents`
203204
* `position`
205+
* `resize`
204206
* `right`
205207
* `rowGap`
206208
* `textAlign`
@@ -313,14 +315,14 @@ By default `ui-box` does not ensure that urls use safe protocols when passed to
313315
```js
314316
import { configureSafeHref } from 'ui-box'
315317
configureSafeHref({
316-
enabled: true,
318+
enabled: true,
317319
})
318320
```
319321
```js
320322
import { configureSafeHref } from 'ui-box'
321323
configureSafeHref({
322324
enabled: true
323-
origin: 'https://app.segmentio.com',
325+
origin: 'https://app.segmentio.com',
324326
})
325327
```
326328

src/enhancers/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ import * as interaction from './interaction'
99
import * as layout from './layout'
1010
import * as list from './list'
1111
import * as opacity from './opacity'
12+
import * as outline from './outline'
1213
import * as overflow from './overflow'
1314
import * as position from './position'
15+
import * as resize from './resize'
1416
import * as spacing from './spacing'
1517
import * as text from './text'
1618
import * as transform from './transform'
@@ -29,8 +31,10 @@ export {
2931
layout,
3032
list,
3133
opacity,
34+
outline,
3235
overflow,
3336
position,
37+
resize,
3438
spacing,
3539
text,
3640
transform,
@@ -49,8 +53,10 @@ export const propTypes: PropTypesMapping = {
4953
...layout.propTypes,
5054
...list.propTypes,
5155
...opacity.propTypes,
56+
...outline.propTypes,
5257
...overflow.propTypes,
5358
...position.propTypes,
59+
...resize.propTypes,
5460
...spacing.propTypes,
5561
...text.propTypes,
5662
...transform.propTypes,
@@ -71,8 +77,10 @@ export const propAliases: PropAliases = {
7177
...layout.propAliases,
7278
...list.propAliases,
7379
...opacity.propAliases,
80+
...outline.propAliases,
7481
...overflow.propAliases,
7582
...position.propAliases,
83+
...resize.propAliases,
7684
...spacing.propAliases,
7785
...text.propAliases,
7886
...transform.propAliases,
@@ -91,8 +99,10 @@ export const propValidators: PropValidators = {
9199
...layout.propValidators,
92100
...list.propValidators,
93101
...opacity.propValidators,
102+
...outline.propValidators,
94103
...overflow.propValidators,
95104
...position.propValidators,
105+
...resize.propValidators,
96106
...spacing.propValidators,
97107
...text.propValidators,
98108
...transform.propValidators,
@@ -111,8 +121,10 @@ export const propEnhancers: PropEnhancers = {
111121
...layout.propEnhancers,
112122
...list.propEnhancers,
113123
...opacity.propEnhancers,
124+
...outline.propEnhancers,
114125
...overflow.propEnhancers,
115126
...position.propEnhancers,
127+
...resize.propEnhancers,
116128
...spacing.propEnhancers,
117129
...text.propEnhancers,
118130
...transform.propEnhancers,

src/enhancers/outline.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import PropTypes from 'prop-types'
2+
import getCss from '../get-css'
3+
import { PropEnhancerValueType, PropValidators, PropEnhancers, PropTypesMapping } from '../types/enhancers'
4+
5+
export const propTypes: PropTypesMapping = {
6+
outline: PropTypes.string
7+
}
8+
9+
export const propAliases = {}
10+
11+
export const propValidators: PropValidators = { }
12+
13+
const outline = {
14+
className: 'otln',
15+
cssName: 'outline',
16+
jsName: 'outline',
17+
complexValue: true
18+
}
19+
20+
export const propEnhancers: PropEnhancers = {
21+
outline: (value: PropEnhancerValueType) => getCss(outline, value)
22+
}

src/enhancers/resize.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import PropTypes from 'prop-types'
2+
import getCss from '../get-css'
3+
import { PropEnhancerValueType, PropValidators, PropEnhancers, PropTypesMapping } from '../types/enhancers'
4+
5+
export const propTypes: PropTypesMapping = {
6+
resize: PropTypes.string
7+
}
8+
9+
export const propAliases = {}
10+
11+
export const propValidators: PropValidators = { }
12+
13+
const resize = {
14+
className: 'rsz',
15+
cssName: 'resize',
16+
jsName: 'resize'
17+
}
18+
19+
export const propEnhancers: PropEnhancers = {
20+
resize: (value: PropEnhancerValueType) => getCss(resize, value)
21+
}

src/types/enhancers.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ type CssProps = Pick<
100100
| 'minWidth'
101101
| 'opacity'
102102
| 'order'
103+
| 'outline'
103104
| 'overflow'
104105
| 'overflowX'
105106
| 'overflowY'
@@ -113,6 +114,7 @@ type CssProps = Pick<
113114
| 'placeSelf'
114115
| 'pointerEvents'
115116
| 'position'
117+
| 'resize'
116118
| 'right'
117119
| 'rowGap'
118120
| 'textAlign'

test/snapshots/box.tsx.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Generated by [AVA](https://ava.li).
99
> DOM
1010
1111
<div
12-
className="ub-algn-cnt_center ub-algn-itms_center ub-algn-slf_center ub-bg_169mlyl ub-bg-blnd-md_multiply ub-bg-clp_padding-box ub-bg-clr_red ub-bg-img_181xl07 ub-bg-orgn_border-box ub-bg-pos_center ub-bg-rpt_no-repeat ub-bg-siz_cover ub-b-btm_1px-solid-black ub-b-lft_1px-solid-black ub-b-rgt_1px-solid-black ub-b-top_1px-solid-black ub-b-btm-clr_red ub-bblr_5px ub-bbrr_5px ub-b-btm-stl_dashed ub-b-btm-wdt_2px ub-b-lft-clr_red ub-b-rgt-clr_red ub-b-top-clr_red ub-b-lft-stl_dashed ub-b-lft-wdt_2px ub-btlr_5px ub-btrr_5px ub-b-rgt-stl_dashed ub-b-rgt-wdt_2px ub-b-top-stl_dashed ub-b-top-wdt_2px ub-btm_10px ub-bs_1yidkis ub-box-szg_border-box ub-clr_both ub-clearfix ub-color_blue ub-col-gap_3px ub-crsr_pointer ub-dspl_flex ub-flx_1 ub-flx-basis_10px ub-flx-drct_column ub-flx-flow_column-wrap ub-flx-grow_1 ub-flx-srnk_1 ub-flx-wrap_wrap ub-flt_left ub-fnt_foz7o3 ub-fnt-fam_1bil31i ub-fnt-sze_14px ub-fnt-stl_italic ub-f-vari_small-caps ub-f-wght_bold ub-gap_3px ub-grd_1lsuugy ub-grd-ara_15fp4eo ub-grd-ato-col_1mp9azz ub-grd-ato-flw_row-dense ub-grd-ato-row_1mp9azz ub-grd-col_1i1wt59 ub-grd-col-end_span-3 ub-grd-col-gap_3px ub-grd-col-str_span-3 ub-grd-gap_3px ub-grd-row_1i1wt59 ub-grd-row-end_span-3 ub-grd-row-gap_3px ub-grd-row-str_span-3 ub-grd-tmp_1b7k023 ub-grd-tmp-ara_1s7jr1l ub-grd-tmp-col_2czdni ub-grd-tmp-row_2czdni ub-h_100px ub-just-cnt_center ub-just-items_center ub-just-self_center ub-lft_10px ub-ltr-spc_0-4em ub-ln-ht_1-2 ub-ls_1j8swju ub-ls-img_iu2jf4 ub-ls-pos_inside ub-ls-typ_lower-greek ub-mb_10px ub-ml_10px ub-mr_10px ub-mt_10px ub-max-h_100prcnt ub-max-w_100prcnt ub-min-h_100px ub-min-w_100px ub-opct_1 ub-order_1 ub-ovflw-x_auto ub-ovflw-y_auto ub-pb_10px ub-pl_10px ub-pr_10px ub-pt_10px ub-plc-cnt_center-center ub-plc-items_center-center ub-plc-self_center-center ub-ptr-evts_auto ub-pst_relative ub-rgt_10px ub-row-gap_3px ub-txt-algn_right ub-txt-deco_underline-dotted ub-txt-ovrf_ellipsis ub-txt-shdw_1kcg6ht ub-txt-trns_capitalize ub-top_10px ub-tfrm_yf7huz ub-tfrm-orgn_tkeb9y ub-tstn_7vzx02 ub-tstn-dly_ru3mkq ub-tstn-drn_i11nm5 ub-tstn-pty_ayd6f0 ub-tstn-tf_r9onko ub-usr-slct_none ub-vsblt_visible ub-wht-spc_nowrap ub-w_10ae43h ub-wrd-brk_normal ub-wrd-wrp_break-word ub-z-idx_1"
12+
className="ub-algn-cnt_center ub-algn-itms_center ub-algn-slf_center ub-bg_169mlyl ub-bg-blnd-md_multiply ub-bg-clp_padding-box ub-bg-clr_red ub-bg-img_181xl07 ub-bg-orgn_border-box ub-bg-pos_center ub-bg-rpt_no-repeat ub-bg-siz_cover ub-b-btm_1px-solid-black ub-b-lft_1px-solid-black ub-b-rgt_1px-solid-black ub-b-top_1px-solid-black ub-b-btm-clr_red ub-bblr_5px ub-bbrr_5px ub-b-btm-stl_dashed ub-b-btm-wdt_2px ub-b-lft-clr_red ub-b-rgt-clr_red ub-b-top-clr_red ub-b-lft-stl_dashed ub-b-lft-wdt_2px ub-btlr_5px ub-btrr_5px ub-b-rgt-stl_dashed ub-b-rgt-wdt_2px ub-b-top-stl_dashed ub-b-top-wdt_2px ub-btm_10px ub-bs_1yidkis ub-box-szg_border-box ub-clr_both ub-clearfix ub-color_blue ub-col-gap_3px ub-crsr_pointer ub-dspl_flex ub-flx_1 ub-flx-basis_10px ub-flx-drct_column ub-flx-flow_column-wrap ub-flx-grow_1 ub-flx-srnk_1 ub-flx-wrap_wrap ub-flt_left ub-fnt_foz7o3 ub-fnt-fam_1bil31i ub-fnt-sze_14px ub-fnt-stl_italic ub-f-vari_small-caps ub-f-wght_bold ub-gap_3px ub-grd_1lsuugy ub-grd-ara_15fp4eo ub-grd-ato-col_1mp9azz ub-grd-ato-flw_row-dense ub-grd-ato-row_1mp9azz ub-grd-col_1i1wt59 ub-grd-col-end_span-3 ub-grd-col-gap_3px ub-grd-col-str_span-3 ub-grd-gap_3px ub-grd-row_1i1wt59 ub-grd-row-end_span-3 ub-grd-row-gap_3px ub-grd-row-str_span-3 ub-grd-tmp_1b7k023 ub-grd-tmp-ara_1s7jr1l ub-grd-tmp-col_2czdni ub-grd-tmp-row_2czdni ub-h_100px ub-just-cnt_center ub-just-items_center ub-just-self_center ub-lft_10px ub-ltr-spc_0-4em ub-ln-ht_1-2 ub-ls_1j8swju ub-ls-img_iu2jf4 ub-ls-pos_inside ub-ls-typ_lower-greek ub-mb_10px ub-ml_10px ub-mr_10px ub-mt_10px ub-max-h_100prcnt ub-max-w_100prcnt ub-min-h_100px ub-min-w_100px ub-opct_1 ub-order_1 ub-otln_iu2jf4 ub-ovflw-x_auto ub-ovflw-y_auto ub-pb_10px ub-pl_10px ub-pr_10px ub-pt_10px ub-plc-cnt_center-center ub-plc-items_center-center ub-plc-self_center-center ub-ptr-evts_auto ub-pst_relative ub-rsz_none ub-rgt_10px ub-row-gap_3px ub-txt-algn_right ub-txt-deco_underline-dotted ub-txt-ovrf_ellipsis ub-txt-shdw_1kcg6ht ub-txt-trns_capitalize ub-top_10px ub-tfrm_yf7huz ub-tfrm-orgn_tkeb9y ub-tstn_7vzx02 ub-tstn-dly_ru3mkq ub-tstn-drn_i11nm5 ub-tstn-pty_ayd6f0 ub-tstn-tf_r9onko ub-usr-slct_none ub-vsblt_visible ub-wht-spc_nowrap ub-w_10ae43h ub-wrd-brk_normal ub-wrd-wrp_break-word ub-z-idx_1"
1313
contentEditable={true}
1414
/>
1515

@@ -315,6 +315,9 @@ Generated by [AVA](https://ava.li).
315315
.ub-order_1 {␊
316316
order: 1;␊
317317
}␊
318+
.ub-otln_iu2jf4 {␊
319+
outline: none;␊
320+
}␊
318321
.ub-ovflw-x_auto {␊
319322
overflow-x: auto;␊
320323
}␊
@@ -348,6 +351,9 @@ Generated by [AVA](https://ava.li).
348351
.ub-pst_relative {␊
349352
position: relative;␊
350353
}␊
354+
.ub-rsz_none {␊
355+
resize: none;␊
356+
}␊
351357
.ub-rgt_10px {␊
352358
right: 10px;␊
353359
}␊
@@ -696,6 +702,9 @@ Generated by [AVA](https://ava.li).
696702
.ub-opct_inherit {␊
697703
opacity: inherit;␊
698704
}␊
705+
.ub-otln_inherit {␊
706+
outline: inherit;␊
707+
}␊
699708
.ub-ovflw-x_inherit {␊
700709
overflow-x: inherit;␊
701710
}␊
@@ -717,6 +726,9 @@ Generated by [AVA](https://ava.li).
717726
.ub-top_inherit {␊
718727
top: inherit;␊
719728
}␊
729+
.ub-rsz_inherit {␊
730+
resize: inherit;␊
731+
}␊
720732
.ub-mb_inherit {␊
721733
margin-bottom: inherit;␊
722734
}␊
@@ -1092,6 +1104,9 @@ Generated by [AVA](https://ava.li).
10921104
.ub-opct_initial {␊
10931105
opacity: initial;␊
10941106
}␊
1107+
.ub-otln_initial {␊
1108+
outline: initial;␊
1109+
}␊
10951110
.ub-ovflw-x_initial {␊
10961111
overflow-x: initial;␊
10971112
}␊
@@ -1113,6 +1128,9 @@ Generated by [AVA](https://ava.li).
11131128
.ub-top_initial {␊
11141129
top: initial;␊
11151130
}␊
1131+
.ub-rsz_initial {␊
1132+
resize: initial;␊
1133+
}␊
11161134
.ub-mb_initial {␊
11171135
margin-bottom: initial;␊
11181136
}␊

test/snapshots/box.tsx.snap

59 Bytes
Binary file not shown.

tools/all-properties-component.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ export default () => {
110110
minWidth={100}
111111
opacity={1}
112112
order={1}
113+
outline="none"
113114
overflow="auto"
114115
overflowX="auto"
115116
overflowY="auto"
@@ -125,6 +126,7 @@ export default () => {
125126
placeSelf="center center"
126127
pointerEvents="auto"
127128
position="relative"
129+
resize="none"
128130
right={10}
129131
rowGap={3}
130132
textAlign="right"

0 commit comments

Comments
 (0)