@pareto-engineering/design-system 2.0.0-alpha.57 → 2.0.0-alpha.58

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.
@@ -81,6 +81,12 @@ var FormInput = _ref => {
81
81
  }, otherProps));
82
82
  }
83
83
 
84
+ if (type === 'rating') {
85
+ return /*#__PURE__*/React.createElement(_fields.RatingsInput, _extends({
86
+ className: newClassName
87
+ }, otherProps));
88
+ }
89
+
84
90
  if (extraTypes !== null && extraTypes !== void 0 && extraTypes[type]) {
85
91
  var Component = extraTypes[type];
86
92
  return /*#__PURE__*/React.createElement(Component, _extends({
@@ -105,7 +111,7 @@ FormInput.propTypes = {
105
111
  /**
106
112
  * The HTML class names for this element
107
113
  */
108
- type: _propTypes.default.oneOf(['text', 'email', 'password', 'number', 'date', 'datetime', 'month', 'tel', 'hidden', 'select', 'choices', 'textarea', 'query-combobox', 'url', // to be removed
114
+ type: _propTypes.default.oneOf(['text', 'email', 'password', 'number', 'date', 'datetime', 'month', 'tel', 'hidden', 'select', 'choices', 'textarea', 'query-combobox', 'url', 'rating', // to be removed
109
115
  'extendedTypeInput']),
110
116
 
111
117
  /**
@@ -4,7 +4,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
4
4
  import * as React from 'react';
5
5
  import { memo, useLayoutEffect } from 'react';
6
6
  import PropTypes from 'prop-types';
7
- import { TextInput, TextareaInput, ChoicesInput, SelectInput, QueryCombobox, QuerySelect } from "../fields"; // Local Definitions
7
+ import { TextInput, TextareaInput, ChoicesInput, SelectInput, QueryCombobox, QuerySelect, RatingsInput } from "../fields"; // Local Definitions
8
8
  // const baseClassName = styleNames.base
9
9
 
10
10
  const componentClassName = 'form-input';
@@ -59,6 +59,12 @@ const FormInput = ({
59
59
  }, otherProps));
60
60
  }
61
61
 
62
+ if (type === 'rating') {
63
+ return /*#__PURE__*/React.createElement(RatingsInput, _extends({
64
+ className: newClassName
65
+ }, otherProps));
66
+ }
67
+
62
68
  if (extraTypes !== null && extraTypes !== void 0 && extraTypes[type]) {
63
69
  const Component = extraTypes[type];
64
70
  return /*#__PURE__*/React.createElement(Component, _extends({
@@ -83,7 +89,7 @@ FormInput.propTypes = {
83
89
  /**
84
90
  * The HTML class names for this element
85
91
  */
86
- type: PropTypes.oneOf(['text', 'email', 'password', 'number', 'date', 'datetime', 'month', 'tel', 'hidden', 'select', 'choices', 'textarea', 'query-combobox', 'url', // to be removed
92
+ type: PropTypes.oneOf(['text', 'email', 'password', 'number', 'date', 'datetime', 'month', 'tel', 'hidden', 'select', 'choices', 'textarea', 'query-combobox', 'url', 'rating', // to be removed
87
93
  'extendedTypeInput']),
88
94
 
89
95
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pareto-engineering/design-system",
3
- "version": "2.0.0-alpha.57",
3
+ "version": "2.0.0-alpha.58",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/es/index.js",
@@ -2950,7 +2950,7 @@ exports[`Storyshots a/Timestamp Distance Format 1`] = `
2950
2950
  className="base timestamp"
2951
2951
  onClick={[Function]}
2952
2952
  >
2953
- in about 1 month
2953
+ in 1 day
2954
2954
  </p>
2955
2955
  `;
2956
2956
 
@@ -11285,6 +11285,175 @@ exports[`Storyshots f/FormInput With Query Combobox 1`] = `
11285
11285
  </form>
11286
11286
  `;
11287
11287
 
11288
+ exports[`Storyshots f/FormInput With Ratings Input 1`] = `
11289
+ <form
11290
+ action="#"
11291
+ onReset={[Function]}
11292
+ onSubmit={[Function]}
11293
+ >
11294
+ <div
11295
+ className="base text-input form-input y-background2"
11296
+ >
11297
+ <label
11298
+ className="base label v50 mb-v x-main2"
11299
+ htmlFor="firstName"
11300
+ >
11301
+ What's your first name ?
11302
+ </label>
11303
+ <input
11304
+ className="input"
11305
+ disabled={false}
11306
+ id="firstName"
11307
+ name="firstName"
11308
+ onBlur={[Function]}
11309
+ onChange={[Function]}
11310
+ type="text"
11311
+ value="Test"
11312
+ />
11313
+ </div>
11314
+ <div
11315
+ className="base ratings-input form-input"
11316
+ >
11317
+ <label
11318
+ className="base label input-label v50 mb-v x-main2"
11319
+ htmlFor="ratings"
11320
+ >
11321
+ Your Rating
11322
+ </label>
11323
+ <div
11324
+ className="stars"
11325
+ >
11326
+ <div
11327
+ className="base rating x-main1 y-background2"
11328
+ >
11329
+ <label
11330
+ htmlFor="ratings-1"
11331
+ onMouseEnter={[Function]}
11332
+ onMouseLeave={[Function]}
11333
+ >
11334
+ <span
11335
+ className="f-icons c-dark-y"
11336
+ >
11337
+ [
11338
+ </span>
11339
+ </label>
11340
+ <input
11341
+ id="ratings-1"
11342
+ name="ratings"
11343
+ onBlur={[Function]}
11344
+ onChange={[Function]}
11345
+ type="radio"
11346
+ value={1}
11347
+ />
11348
+ </div>
11349
+ <div
11350
+ className="base rating x-main1 y-background2"
11351
+ >
11352
+ <label
11353
+ htmlFor="ratings-2"
11354
+ onMouseEnter={[Function]}
11355
+ onMouseLeave={[Function]}
11356
+ >
11357
+ <span
11358
+ className="f-icons c-dark-y"
11359
+ >
11360
+ [
11361
+ </span>
11362
+ </label>
11363
+ <input
11364
+ id="ratings-2"
11365
+ name="ratings"
11366
+ onBlur={[Function]}
11367
+ onChange={[Function]}
11368
+ type="radio"
11369
+ value={2}
11370
+ />
11371
+ </div>
11372
+ <div
11373
+ className="base rating x-main1 y-background2"
11374
+ >
11375
+ <label
11376
+ htmlFor="ratings-3"
11377
+ onMouseEnter={[Function]}
11378
+ onMouseLeave={[Function]}
11379
+ >
11380
+ <span
11381
+ className="f-icons c-dark-y"
11382
+ >
11383
+ [
11384
+ </span>
11385
+ </label>
11386
+ <input
11387
+ id="ratings-3"
11388
+ name="ratings"
11389
+ onBlur={[Function]}
11390
+ onChange={[Function]}
11391
+ type="radio"
11392
+ value={3}
11393
+ />
11394
+ </div>
11395
+ <div
11396
+ className="base rating x-main1 y-background2"
11397
+ >
11398
+ <label
11399
+ htmlFor="ratings-4"
11400
+ onMouseEnter={[Function]}
11401
+ onMouseLeave={[Function]}
11402
+ >
11403
+ <span
11404
+ className="f-icons c-dark-y"
11405
+ >
11406
+ [
11407
+ </span>
11408
+ </label>
11409
+ <input
11410
+ id="ratings-4"
11411
+ name="ratings"
11412
+ onBlur={[Function]}
11413
+ onChange={[Function]}
11414
+ type="radio"
11415
+ value={4}
11416
+ />
11417
+ </div>
11418
+ <div
11419
+ className="base rating x-main1 y-background2"
11420
+ >
11421
+ <label
11422
+ htmlFor="ratings-5"
11423
+ onMouseEnter={[Function]}
11424
+ onMouseLeave={[Function]}
11425
+ >
11426
+ <span
11427
+ className="f-icons c-dark-y"
11428
+ >
11429
+ [
11430
+ </span>
11431
+ </label>
11432
+ <input
11433
+ id="ratings-5"
11434
+ name="ratings"
11435
+ onBlur={[Function]}
11436
+ onChange={[Function]}
11437
+ type="radio"
11438
+ value={5}
11439
+ />
11440
+ </div>
11441
+ </div>
11442
+ </div>
11443
+ <div
11444
+ className="debugger"
11445
+ >
11446
+ <button
11447
+ className="base button x-main2"
11448
+ onClick={[Function]}
11449
+ type="button"
11450
+ >
11451
+ Open FormDebugger
11452
+ </button>
11453
+ </div>
11454
+ </form>
11455
+ `;
11456
+
11288
11457
  exports[`Storyshots f/common/Description Base 1`] = `
11289
11458
  <form
11290
11459
  action="#"
@@ -332,6 +332,32 @@ export const WithPrefetchedQuerySelect = () => {
332
332
  )
333
333
  }
334
334
 
335
+ export const WithRatingsInput = () => {
336
+ const inputMap = [
337
+ {
338
+ type :'text',
339
+ name :'firstName',
340
+ label:"What's your first name ?",
341
+ },
342
+ {
343
+ type :'rating',
344
+ ratingCount:5,
345
+ name :'ratings',
346
+ label :'Your Rating',
347
+ },
348
+ ]
349
+
350
+ return (
351
+ <>
352
+ {
353
+ inputMap.map((input) => <FormInput {...input} key={input.name} />)
354
+ }
355
+ <FormDebugger />
356
+
357
+ </>
358
+ )
359
+ }
360
+
335
361
  export const ExtensibleFormInput = () => {
336
362
  const ExtendedTextInput = (props) => (
337
363
  <TextInput
@@ -12,6 +12,7 @@ import {
12
12
  SelectInput,
13
13
  QueryCombobox,
14
14
  QuerySelect,
15
+ RatingsInput,
15
16
  } from '../fields'
16
17
 
17
18
  // Local Definitions
@@ -84,6 +85,15 @@ const FormInput = ({
84
85
  />
85
86
  )
86
87
  }
88
+
89
+ if (type === 'rating') {
90
+ return (
91
+ <RatingsInput
92
+ className={newClassName}
93
+ {...otherProps}
94
+ />
95
+ )
96
+ }
87
97
  if (extraTypes?.[type]) {
88
98
  const Component = extraTypes[type]
89
99
  return (
@@ -128,6 +138,7 @@ FormInput.propTypes = {
128
138
  'textarea',
129
139
  'query-combobox',
130
140
  'url',
141
+ 'rating',
131
142
  // to be removed
132
143
  'extendedTypeInput',
133
144
  ]),