@edvisor/product-language 0.5.3 → 0.5.4

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/index.js CHANGED
@@ -2278,37 +2278,6 @@ $$a({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
2278
2278
  }
2279
2279
  });
2280
2280
 
2281
- const Nothing = () => null;
2282
- function maybeRender(prop, JSX) {
2283
- return isDefined(prop) && Boolean(prop) ? JSX : jsx(Nothing, {});
2284
- }
2285
- const If = props => {
2286
- // eslint-disable-next-line react/jsx-no-useless-fragment
2287
- return maybeRender(props.is, jsx(Fragment, {
2288
- children: props.children
2289
- }));
2290
- };
2291
-
2292
- /**
2293
- * @TODO these aren't quiiiiite right
2294
- *
2295
- * They all say they return ReactNode but I feel like JSX.Element or something
2296
- * is more accurate? The child type needs to include _anything react can render_
2297
- * but it should also allow the caller to cloneElement on the results so that
2298
- * they can do stuff like
2299
- *
2300
- * const sections = getSlots(Section, children)
2301
- * .map((el, i) => i === 0 ? cloneElement(el, { first: true }) : el)
2302
- *
2303
- * Right? I want this...
2304
- * */
2305
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2306
-
2307
- function isReactElement(obj) {
2308
- // eslint-disable-next-line no-prototype-builtins
2309
- return isDefined(obj) && obj.hasOwnProperty('type');
2310
- }
2311
-
2312
2281
  const isReactElementOfType = ( // eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any
2313
2282
  component) => // eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any
2314
2283
  element => {
@@ -2338,7 +2307,41 @@ element => {
2338
2307
  }
2339
2308
 
2340
2309
  return false;
2341
- }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
2310
+ };
2311
+
2312
+ const Nothing = () => null; // eslint-disable-next-line @typescript-eslint/no-explicit-any
2313
+
2314
+ const isNothing = isReactElementOfType(Nothing);
2315
+ function maybeRender(prop, JSX) {
2316
+ return isNil(prop) || false === Boolean(prop) || isNothing(prop) ? jsx(Nothing, {}) : JSX;
2317
+ }
2318
+ const If = props => {
2319
+ // eslint-disable-next-line react/jsx-no-useless-fragment
2320
+ return maybeRender(props.is, jsx(Fragment, {
2321
+ children: props.children
2322
+ }));
2323
+ };
2324
+
2325
+ /**
2326
+ * @TODO these aren't quiiiiite right
2327
+ *
2328
+ * They all say they return ReactNode but I feel like JSX.Element or something
2329
+ * is more accurate? The child type needs to include _anything react can render_
2330
+ * but it should also allow the caller to cloneElement on the results so that
2331
+ * they can do stuff like
2332
+ *
2333
+ * const sections = getSlots(Section, children)
2334
+ * .map((el, i) => i === 0 ? cloneElement(el, { first: true }) : el)
2335
+ *
2336
+ * Right? I want this...
2337
+ * */
2338
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2339
+
2340
+ function isReactElement(obj) {
2341
+ // eslint-disable-next-line no-prototype-builtins
2342
+ return isDefined(obj) && obj.hasOwnProperty('type');
2343
+ } // eslint-disable-next-line @typescript-eslint/no-explicit-any
2344
+
2342
2345
 
2343
2346
  const isSlotOfType = type => obj => {
2344
2347
  return isDefined(obj) && isReactElement(obj) && isDefined(obj.type) && (Object.getPrototypeOf(obj.type) === type || obj.type === type) || isDefined(obj.type) && isDefined(obj.type.target) && (Object.getPrototypeOf(obj.type.target) === type || obj.type.target === type);
@@ -4018,7 +4021,7 @@ function getBorderColor(props) {
4018
4021
  const CardFrame$1 = /*#__PURE__*/styled.section.withConfig({
4019
4022
  displayName: "card-frame__CardFrame",
4020
4023
  componentId: "l58n4z-0"
4021
- })(["background:", ";max-width:1024px;border-radius:6px;margin-bottom:", ";"], Surface.Default.Default, Margin.m);
4024
+ })(["background:", ";border-radius:6px;margin-bottom:", ";"], Surface.Default.Default, Margin.m);
4022
4025
 
4023
4026
  const InCardFrame = /*#__PURE__*/styled(CardFrame$1).attrs({
4024
4027
  as: 'div'
@@ -6065,7 +6068,7 @@ const InputLayout = /*#__PURE__*/styled(Flex).withConfig({
6065
6068
  const HTMLInput = /*#__PURE__*/styled.input.withConfig({
6066
6069
  displayName: "input-field__HTMLInput",
6067
6070
  componentId: "sc-1yq0rb7-2"
6068
- })(["all:unset;padding:", " ", " ", " ", ";width:100%;::-webkit-inner-spin-button{-webkit-appearance:none;margin:", ";}", "::placeholder{", "}"], Padding.none, Padding.none, Padding.xs, Padding.none, Margin.none, Typography.Body, _Typography.LightText);
6071
+ })(["all:unset;cursor:auto;padding:", " ", " ", " ", ";width:100%;::-webkit-inner-spin-button{-webkit-appearance:none;margin:", ";}", "::placeholder{", "}"], Padding.none, Padding.none, Padding.xs, Padding.none, Margin.none, Typography.Body, _Typography.LightText);
6069
6072
  const PrefixFrame = /*#__PURE__*/styled(Label).withConfig({
6070
6073
  displayName: "input-field__PrefixFrame",
6071
6074
  componentId: "sc-1yq0rb7-3"
@@ -6083,10 +6086,13 @@ const InputFrame = /*#__PURE__*/styled.label.withConfig({
6083
6086
  displayName: "input-field__InputFrame",
6084
6087
  componentId: "sc-1yq0rb7-5"
6085
6088
  })(["width:100%;padding:", " ", " ", " ", ";flex-direction:column;display:flex;"], Padding.xs, Padding.none, Padding.none, Padding.none);
6086
- const ControlsFrame = Flex;
6089
+ const ControlsFrame = /*#__PURE__*/styled(Flex).withConfig({
6090
+ displayName: "input-field__ControlsFrame",
6091
+ componentId: "sc-1yq0rb7-6"
6092
+ })(["margin-right:", ";"], Margin.s);
6087
6093
  const InputLabel = /*#__PURE__*/styled(Label).withConfig({
6088
6094
  displayName: "input-field__InputLabel",
6089
- componentId: "sc-1yq0rb7-6"
6095
+ componentId: "sc-1yq0rb7-7"
6090
6096
  })(["margin-bottom:", ";"], Margin.xxs);
6091
6097
  const InputField = forwardRef((props, ref) => {
6092
6098
  const {
@@ -6094,16 +6100,18 @@ const InputField = forwardRef((props, ref) => {
6094
6100
  prefix,
6095
6101
  suffix,
6096
6102
  label,
6097
- className
6103
+ className,
6104
+ style
6098
6105
  } = props,
6099
- inputProps = __rest(props, ["children", "prefix", "suffix", "label", "className"]);
6106
+ inputProps = __rest(props, ["children", "prefix", "suffix", "label", "className", "style"]);
6100
6107
 
6101
6108
  const icon = getSlot(IconSlot, children);
6102
6109
  const controls = getSlot(ControlsSlot, children);
6103
6110
  const required = is(props.required) ? '*' : '';
6104
6111
  return jsxs(FancyBorder, Object.assign({
6105
6112
  invalid: props.invalid,
6106
- className: className
6113
+ className: className,
6114
+ style: style
6107
6115
  }, {
6108
6116
  children: [jsxs(InputFrame, {
6109
6117
  children: [jsx(If, Object.assign({
@@ -6116,7 +6124,7 @@ const InputField = forwardRef((props, ref) => {
6116
6124
  children: [label, required]
6117
6125
  }))
6118
6126
  })), jsxs(InputLayout, {
6119
- children: [icon, jsx(If, Object.assign({
6127
+ children: [jsx(If, Object.assign({
6120
6128
  is: prefix
6121
6129
  }, {
6122
6130
  children: jsx(PrefixFrame, Object.assign({
@@ -6138,10 +6146,22 @@ const InputField = forwardRef((props, ref) => {
6138
6146
  }))
6139
6147
  }))]
6140
6148
  })]
6141
- }), jsx(ControlsFrame, Object.assign({
6142
- center: true
6149
+ }), jsx(If, Object.assign({
6150
+ is: icon
6143
6151
  }, {
6144
- children: controls
6152
+ children: jsx(ControlsFrame, Object.assign({
6153
+ center: true
6154
+ }, {
6155
+ children: icon
6156
+ }))
6157
+ })), jsx(If, Object.assign({
6158
+ is: controls
6159
+ }, {
6160
+ children: jsx(ControlsFrame, Object.assign({
6161
+ center: true
6162
+ }, {
6163
+ children: controls
6164
+ }))
6145
6165
  }))]
6146
6166
  }));
6147
6167
  });
@@ -6457,15 +6477,15 @@ function getValuesBySize$2(props) {
6457
6477
  const Box = /*#__PURE__*/styled(SpaceAround).withConfig({
6458
6478
  displayName: "thumbnail__Box",
6459
6479
  componentId: "sc-1pn53g7-0"
6460
- })(["width:", ";height:", ";border-radius:6px;border:1px solid ", ";padding:", ";box-sizing:border-box;"], ({
6480
+ })(["width:", ";height:", ";border-radius:6px;border:1px solid ", ";box-sizing:border-box;"], ({
6461
6481
  size
6462
6482
  }) => size, ({
6463
6483
  size
6464
- }) => size, Borders.Default, Padding.xs);
6484
+ }) => size, Borders.Default.Subdued);
6465
6485
  const Image$1 = /*#__PURE__*/styled.img.withConfig({
6466
6486
  displayName: "thumbnail__Image",
6467
6487
  componentId: "sc-1pn53g7-1"
6468
- })(["width:100%;height:100%;"]);
6488
+ })(["width:100%;object-fit:contain;"]);
6469
6489
  const Thumbnail = props => {
6470
6490
  const {
6471
6491
  imageUrl,
@@ -6483,10 +6503,14 @@ const Thumbnail = props => {
6483
6503
  "data-testid": "thumbnail-test",
6484
6504
  className: className
6485
6505
  }, {
6486
- children: jsx(Image$1, {
6487
- src: imageUrl,
6488
- alt: imageLabel
6489
- })
6506
+ children: jsx(If, Object.assign({
6507
+ is: imageUrl
6508
+ }, {
6509
+ children: jsx(Image$1, {
6510
+ src: imageUrl,
6511
+ alt: imageLabel
6512
+ })
6513
+ }))
6490
6514
  }));
6491
6515
  };
6492
6516
 
@@ -8805,6 +8829,7 @@ const SelectImpl = (props, selectRef) => {
8805
8829
  const [focused, setFocused] = useState(false);
8806
8830
  const {
8807
8831
  className,
8832
+ style,
8808
8833
  clearable,
8809
8834
  placeholder,
8810
8835
  value,
@@ -9029,9 +9054,9 @@ const SelectImpl = (props, selectRef) => {
9029
9054
  */
9030
9055
 
9031
9056
  return jsxs("div", Object.assign({
9032
- style: ContainerStyles({
9057
+ style: Object.assign(Object.assign({}, style), ContainerStyles({
9033
9058
  disabled
9034
- }),
9059
+ })),
9035
9060
  ref: selectRef,
9036
9061
  className: classNames.join(' '),
9037
9062
  onKeyUp: onKeyUp,
@@ -9977,4 +10002,4 @@ const MultiChoiceList = props => {
9977
10002
  }));
9978
10003
  };
9979
10004
 
9980
- export { Actions, AlertBanner, Avatar, BODY, BODY_LARGE, Background, Badge, Body, BodyLarge, Borders, Button, CAPTION, Caption, Card, Center, Checkbox, Display, Divider, Flag, Flex, Focused, HTMLAnchor, HTMLInput, Heading1, Heading2, Heading3, Heading4, Icon, IconMinor, Icons, InputCheckbox, InputField, InputNumber, InputText, Interactive, LABEL, Label, LeftRightCard, Link, Margin, MenuList, MultiChoiceList, Padding, Select, SpaceAround, SpaceBetween, Spinner, Surface, Tab$1 as Tab, Tabs, Tag, Text$1 as Text, Thumbnail, TreeView, Typography, _Typography, gridLayoutGenerator, leftRightLayoutGenerator, shadow, shadow2Xl, shadowInner, shadowLg, shadowMd, shadowSm, shadowXl };
10005
+ export { Actions, AlertBanner, Avatar, BODY, BODY_LARGE, Background, Badge, Body, BodyLarge, Borders, Button, CAPTION, Caption, Card, CardFrame$1 as CardFrame, Center, Checkbox, Display, Divider, Flag, Flex, Focused, HTMLAnchor, HTMLInput, Heading1, Heading2, Heading3, Heading4, Icon, IconMinor, Icons, InputCheckbox, InputField, InputNumber, InputText, Interactive, LABEL, Label, LeftRightCard, Link, Margin, MenuList, MultiChoiceList, Padding, Select, SpaceAround, SpaceBetween, Spinner, Surface, Tab$1 as Tab, Tabs, Tag, Text$1 as Text, Thumbnail, TreeView, Typography, _Typography, gridLayoutGenerator, leftRightLayoutGenerator, shadow, shadow2Xl, shadowInner, shadowLg, shadowMd, shadowSm, shadowXl };
@@ -1,2 +1,3 @@
1
1
  export * from './card';
2
2
  export * from './molecules/left-right-card';
3
+ export * from './atoms';
@@ -1,7 +1,8 @@
1
- /// <reference types="react" />
2
1
  import { FC } from '@helpers';
2
+ import { CSSProperties } from 'react';
3
3
  export interface ISelectProps<T = any> {
4
4
  className?: string;
5
+ style?: CSSProperties;
5
6
  options?: IOption<T>[];
6
7
  value?: T | T[];
7
8
  placeholder?: string;
@@ -4,3 +4,4 @@ export * from './generic-types';
4
4
  export * from './numbers';
5
5
  export * from './nothing';
6
6
  export * from './strings';
7
+ export * from './isReactElementOfType';
@@ -0,0 +1,8 @@
1
+ import { PureComponent, ReactElement } from 'react';
2
+ import { StyledComponent } from 'styled-components';
3
+ import { FC } from './generic-types';
4
+ export declare const isReactElementOfType: <P extends {
5
+ children?: import("react").ReactNode;
6
+ }>(component: (FC<P, {}> | typeof PureComponent | StyledComponent<FC<P, {}>, any, {}, never>) & {
7
+ target?: any;
8
+ }) => (element?: any) => element is ReactElement<P, string | import("react").JSXElementConstructor<any>>;
@@ -1,5 +1,7 @@
1
+ /// <reference types="react" />
1
2
  import { FC, PropsWithChildren } from './generic-types';
2
3
  export declare const Nothing: FC;
4
+ export declare const isNothing: (element?: any) => element is import("react").ReactElement<{}, string | import("react").JSXElementConstructor<any>>;
3
5
  export declare function maybeRender<T>(prop: T, JSX: JSX.Element): JSX.Element;
4
6
  interface IIfProps {
5
7
  is: unknown;
@@ -1,11 +1,5 @@
1
1
  import { CSSProperties, PureComponent, ReactElement, ReactNode } from 'react';
2
- import { StyledComponent } from 'styled-components';
3
2
  import { FC, PropsWithChildren } from './generic-types';
4
- export declare const isReactElementOfType: <P extends {
5
- children?: ReactNode;
6
- }>(component: (FC<P, {}> | typeof Slot | StyledComponent<FC<P, {}>, any, {}, never>) & {
7
- target?: any;
8
- }) => (element?: any) => element is ReactElement<P, string | import("react").JSXElementConstructor<any>>;
9
3
  export declare const isSlotOfType: <T extends typeof Slot>(type: T | FC<{}, {}>) => (obj?: any) => obj is T;
10
4
  export declare class Slot<T = unknown> extends PureComponent<PropsWithChildren<T>> {
11
5
  render(): PropsWithChildren<T>["children"] | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edvisor/product-language",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "license": "MIT",
5
5
  "description": "Edvisor.io product-language components",
6
6
  "repository": "https://github.com/edvisor-io/front-end/",