@adamjanicki/ui 1.1.9 → 1.2.1

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.
@@ -26,7 +26,6 @@ import { classNames } from "../../utils/util";
26
26
  var identity = function (x) { return x; };
27
27
  var Select = function (_a, ref) {
28
28
  var className = _a.className, options = _a.options, _b = _a.getOptionValue, getOptionValue = _b === void 0 ? identity : _b, _c = _a.getOptionLabel, getOptionLabel = _c === void 0 ? identity : _c, _d = _a.corners, corners = _d === void 0 ? "rounded" : _d, _e = _a.style, style = _e === void 0 ? {} : _e, innerStyle = _a.innerStyle, innerClassName = _a.innerClassName, disabled = _a.disabled, props = __rest(_a, ["className", "options", "getOptionValue", "getOptionLabel", "corners", "style", "innerStyle", "innerClassName", "disabled"]);
29
- return (_jsxs("div", { className: classNames(disabled ? "ajui-select-disabled" : undefined, className) ||
30
- undefined, style: __assign(__assign({}, style), { position: "relative", padding: 0 }), children: [_jsx("select", __assign({}, props, { ref: ref, className: classNames("ajui-select-base corners--".concat(corners), innerClassName), style: innerStyle, disabled: disabled, children: options.map(function (option, index) { return (_jsx("option", { value: getOptionValue(option), children: getOptionLabel(option) }, index)); }) })), _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 64 64", className: "ajui-select-triangle", "aria-hidden": "true", children: _jsx("path", { fill: "currentColor", d: "M 29.175781 50.824219 C 30.738281 52.386719 33.273438 52.386719 34.835938 50.824219 L 58.835938 26.824219 C 60.398438 25.261719 60.398438 22.726562 58.835938 21.164062 C 57.273438 19.601562 54.738281 19.601562 53.175781 21.164062 L 32 42.335938 L 10.824219 21.175781 C 9.261719 19.613281 6.726562 19.613281 5.164062 21.175781 C 3.601562 22.738281 3.601562 25.273438 5.164062 26.835938 L 29.164062 50.835938 Z M 29.175781 50.824219" }) })] }));
29
+ return (_jsxs("div", { className: classNames("ajui-select-container", disabled ? "ajui-select-disabled" : undefined, className) || undefined, children: [_jsx("select", __assign({}, props, { ref: ref, className: classNames("ajui-select-base corners--".concat(corners), innerClassName), style: innerStyle, disabled: disabled, children: options.map(function (option, index) { return (_jsx("option", { value: getOptionValue(option), children: getOptionLabel(option) }, index)); }) })), _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 64 64", className: "ajui-select-triangle", "aria-hidden": "true", children: _jsx("path", { fill: "currentColor", d: "M 29.175781 50.824219 C 30.738281 52.386719 33.273438 52.386719 34.835938 50.824219 L 58.835938 26.824219 C 60.398438 25.261719 60.398438 22.726562 58.835938 21.164062 C 57.273438 19.601562 54.738281 19.601562 53.175781 21.164062 L 32 42.335938 L 10.824219 21.175781 C 9.261719 19.613281 6.726562 19.613281 5.164062 21.175781 C 3.601562 22.738281 3.601562 25.273438 5.164062 26.835938 L 29.164062 50.835938 Z M 29.175781 50.824219" }) })] }));
31
30
  };
32
31
  export default forwardRef(Select);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adamjanicki/ui",
3
- "version": "1.1.9",
3
+ "version": "1.2.1",
4
4
  "description": "Basic UI components and hooks for React in TypeScript",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
package/style.css CHANGED
@@ -294,12 +294,19 @@ a {
294
294
  }
295
295
 
296
296
  /* Select */
297
+ .ajui-select-container {
298
+ position: relative;
299
+ padding: 0;
300
+ width: fit-content;
301
+ }
302
+
297
303
  .ajui-select-disabled {
298
304
  opacity: var(--ajui-disabled-opacity);
299
305
  cursor: not-allowed;
300
306
  }
301
307
 
302
308
  .ajui-select-base {
309
+ width: 100%;
303
310
  color: inherit;
304
311
  outline: 0px solid transparent;
305
312
  border: none;
package/tmp DELETED
@@ -1,95 +0,0 @@
1
- import React, { forwardRef } from "react";
2
- import { classNames } from "../../utils/util";
3
- import { CornerType } from "../../utils/types";
4
-
5
- type Props = Omit<
6
- React.DetailedHTMLProps<
7
- React.SelectHTMLAttributes<HTMLSelectElement>,
8
- HTMLSelectElement
9
- >,
10
- "aria-label"
11
- > & {
12
- /**
13
- * Array of options to display in the select
14
- */
15
- options: string[];
16
- /**
17
- * Mapper function to get the value of the option
18
- *
19
- * @param option the option to get the value of
20
- * @returns the value of the option
21
- */
22
- getOptionValue?: (option: string) => string;
23
- /**
24
- * Mapper function to get the label of the option
25
- *
26
- * @param option the option to get the label of
27
- * @returns the label of the option
28
- */
29
- getOptionLabel?: (option: string) => string;
30
- /**
31
- * [Optional] The corner style of the select element.
32
- * @default "rounded"
33
- */
34
- corners?: CornerType;
35
- /**
36
- * Name of the select for accessibility purposes
37
- */
38
- "aria-label": string;
39
- /**
40
- * [Optional] The styles to apply to the select element
41
- */
42
- innerStyle?: React.CSSProperties;
43
- /**
44
- * [Optional] The class name to apply to the select element
45
- */
46
- innerClassName?: string;
47
- };
48
-
49
- const identity = (x: string) => x;
50
-
51
- const Select = (
52
- {
53
- className,
54
- options,
55
- getOptionValue = identity,
56
- getOptionLabel = identity,
57
- corners = "rounded",
58
- style,
59
- innerStyle,
60
- innerClassName,
61
- ...props
62
- }: Props,
63
- ref: React.Ref<HTMLSelectElement>
64
- ) => (
65
- <div className={classNames("ajui-select-container", className)} style={style}>
66
- <select
67
- {...props}
68
- ref={ref}
69
- className={classNames(
70
- `ajui-select-base corners--${corners}`,
71
- innerClassName
72
- )}
73
- style={innerStyle}
74
- >
75
- {options.map((option, index) => (
76
- <option key={index} value={getOptionValue(option)}>
77
- {getOptionLabel(option)}
78
- </option>
79
- ))}
80
- </select>
81
- <svg
82
- xmlns="http://www.w3.org/2000/svg"
83
- viewBox="0 0 64 64"
84
- className="ajui-select-triangle"
85
- aria-hidden="true"
86
- >
87
- <path
88
- fill="currentColor"
89
- d="M 29.175781 50.824219 C 30.738281 52.386719 33.273438 52.386719 34.835938 50.824219 L 58.835938 26.824219 C 60.398438 25.261719 60.398438 22.726562 58.835938 21.164062 C 57.273438 19.601562 54.738281 19.601562 53.175781 21.164062 L 32 42.335938 L 10.824219 21.175781 C 9.261719 19.613281 6.726562 19.613281 5.164062 21.175781 C 3.601562 22.738281 3.601562 25.273438 5.164062 26.835938 L 29.164062 50.835938 Z M 29.175781 50.824219"
90
- />
91
- </svg>
92
- </div>
93
- );
94
-
95
- export default forwardRef(Select);